@vue/compat 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,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-alpha.2
2
+ * @vue/compat v3.6.0-alpha.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -10,7 +10,6 @@ var estreeWalker = require('estree-walker');
10
10
  var decode_js = require('entities/lib/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
- /*! #__NO_SIDE_EFFECTS__ */
14
13
  // @__NO_SIDE_EFFECTS__
15
14
  function makeMap(str) {
16
15
  const map = /* @__PURE__ */ Object.create(null);
@@ -65,10 +64,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
65
64
  );
66
65
  const cacheStringFunction = (fn) => {
67
66
  const cache = /* @__PURE__ */ Object.create(null);
68
- return (str) => {
67
+ return ((str) => {
69
68
  const hit = cache[str];
70
69
  return hit || (cache[str] = fn(str));
71
- };
70
+ });
72
71
  };
73
72
  const camelizeRE = /-(\w)/g;
74
73
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
@@ -88,6 +87,9 @@ const toHandlerKey = cacheStringFunction(
88
87
  return s;
89
88
  }
90
89
  );
90
+ const getModifierPropName = (name) => {
91
+ return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
92
+ };
91
93
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
92
94
  const invokeArrayFns = (fns, ...arg) => {
93
95
  for (let i = 0; i < fns.length; i++) {
@@ -249,6 +251,9 @@ function shouldSetAsAttr(tagName, key) {
249
251
  if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
250
252
  return true;
251
253
  }
254
+ if (key === "sandbox" && tagName === "IFRAME") {
255
+ return true;
256
+ }
252
257
  return false;
253
258
  }
254
259
 
@@ -448,6 +453,7 @@ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
448
453
  const notifyBuffer = [];
449
454
  let batchDepth = 0;
450
455
  let activeSub = void 0;
456
+ let globalVersion = 0;
451
457
  let notifyIndex = 0;
452
458
  let notifyBufferLength = 0;
453
459
  function setActiveSub(sub) {
@@ -470,17 +476,18 @@ function link(dep, sub) {
470
476
  if (prevDep !== void 0 && prevDep.dep === dep) {
471
477
  return;
472
478
  }
473
- let nextDep = void 0;
474
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
475
- if (recursedCheck) {
476
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
477
- if (nextDep !== void 0 && nextDep.dep === dep) {
478
- sub.depsTail = nextDep;
479
- return;
480
- }
479
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
480
+ if (nextDep !== void 0 && nextDep.dep === dep) {
481
+ nextDep.version = globalVersion;
482
+ sub.depsTail = nextDep;
483
+ return;
481
484
  }
482
485
  const prevSub = dep.subsTail;
486
+ if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) {
487
+ return;
488
+ }
483
489
  const newLink = sub.depsTail = dep.subsTail = {
490
+ version: globalVersion,
484
491
  dep,
485
492
  sub,
486
493
  prevDep,
@@ -586,6 +593,7 @@ function propagate(link2) {
586
593
  } while (true);
587
594
  }
588
595
  function startTracking(sub) {
596
+ ++globalVersion;
589
597
  sub.depsTail = void 0;
590
598
  sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
591
599
  return setActiveSub(sub);
@@ -681,18 +689,12 @@ function shallowPropagate(link2) {
681
689
  } while (link2 !== void 0);
682
690
  }
683
691
  function isValidLink(checkLink, sub) {
684
- const depsTail = sub.depsTail;
685
- if (depsTail !== void 0) {
686
- let link2 = sub.deps;
687
- do {
688
- if (link2 === checkLink) {
689
- return true;
690
- }
691
- if (link2 === depsTail) {
692
- break;
693
- }
694
- link2 = link2.nextDep;
695
- } while (link2 !== void 0);
692
+ let link2 = sub.depsTail;
693
+ while (link2 !== void 0) {
694
+ if (link2 === checkLink) {
695
+ return true;
696
+ }
697
+ link2 = link2.prevDep;
696
698
  }
697
699
  return false;
698
700
  }
@@ -860,7 +862,7 @@ const arrayInstrumentations = {
860
862
  join(separator) {
861
863
  return reactiveReadArray(this).join(separator);
862
864
  },
863
- // keys() iterator only reads `length`, no optimisation required
865
+ // keys() iterator only reads `length`, no optimization required
864
866
  lastIndexOf(...args) {
865
867
  return searchProxy(this, "lastIndexOf", args);
866
868
  },
@@ -912,7 +914,7 @@ function iterator(self, method, wrapValue) {
912
914
  iter._next = iter.next;
913
915
  iter.next = () => {
914
916
  const result = iter._next();
915
- if (result.value) {
917
+ if (!result.done) {
916
918
  result.value = wrapValue(result.value);
917
919
  }
918
920
  return result;
@@ -1043,7 +1045,8 @@ class BaseReactiveHandler {
1043
1045
  return res;
1044
1046
  }
1045
1047
  if (isRef(res)) {
1046
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1048
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1049
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1047
1050
  }
1048
1051
  if (isObject(res)) {
1049
1052
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1065,7 +1068,7 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1065
1068
  }
1066
1069
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1067
1070
  if (isOldValueReadonly) {
1068
- return false;
1071
+ return true;
1069
1072
  } else {
1070
1073
  oldValue.value = value;
1071
1074
  return true;
@@ -1191,7 +1194,7 @@ function createInstrumentations(readonly, shallow) {
1191
1194
  get size() {
1192
1195
  const target = this["__v_raw"];
1193
1196
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1194
- return Reflect.get(target, "size", target);
1197
+ return target.size;
1195
1198
  },
1196
1199
  has(key) {
1197
1200
  const target = this["__v_raw"];
@@ -2111,11 +2114,11 @@ function traverse(value, depth = Infinity, seen) {
2111
2114
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2112
2115
  return value;
2113
2116
  }
2114
- seen = seen || /* @__PURE__ */ new Set();
2115
- if (seen.has(value)) {
2117
+ seen = seen || /* @__PURE__ */ new Map();
2118
+ if ((seen.get(value) || 0) >= depth) {
2116
2119
  return value;
2117
2120
  }
2118
- seen.add(value);
2121
+ seen.set(value, depth);
2119
2122
  depth--;
2120
2123
  if (isRef(value)) {
2121
2124
  traverse(value.value, depth, seen);
@@ -2837,9 +2840,6 @@ const TeleportImpl = {
2837
2840
  insert(mainAnchor, container, anchor);
2838
2841
  const mount = (container2, anchor2) => {
2839
2842
  if (shapeFlag & 16) {
2840
- if (parentComponent && parentComponent.isCE) {
2841
- parentComponent.ce._teleportTarget = container2;
2842
- }
2843
2843
  mountChildren(
2844
2844
  children,
2845
2845
  container2,
@@ -2861,6 +2861,9 @@ const TeleportImpl = {
2861
2861
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
2862
2862
  namespace = "mathml";
2863
2863
  }
2864
+ if (parentComponent && parentComponent.isCE) {
2865
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2866
+ }
2864
2867
  if (!disabled) {
2865
2868
  mount(target, targetAnchor);
2866
2869
  updateCssVars(n2, false);
@@ -3049,26 +3052,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3049
3052
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3050
3053
  o: { nextSibling, parentNode, querySelector, insert, createText }
3051
3054
  }, hydrateChildren) {
3055
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3056
+ vnode2.anchor = hydrateChildren(
3057
+ nextSibling(node2),
3058
+ vnode2,
3059
+ parentNode(node2),
3060
+ parentComponent,
3061
+ parentSuspense,
3062
+ slotScopeIds,
3063
+ optimized
3064
+ );
3065
+ vnode2.targetStart = targetStart;
3066
+ vnode2.targetAnchor = targetAnchor;
3067
+ }
3052
3068
  const target = vnode.target = resolveTarget(
3053
3069
  vnode.props,
3054
3070
  querySelector
3055
3071
  );
3072
+ const disabled = isTeleportDisabled(vnode.props);
3056
3073
  if (target) {
3057
- const disabled = isTeleportDisabled(vnode.props);
3058
3074
  const targetNode = target._lpa || target.firstChild;
3059
3075
  if (vnode.shapeFlag & 16) {
3060
3076
  if (disabled) {
3061
- vnode.anchor = hydrateChildren(
3062
- nextSibling(node),
3077
+ hydrateDisabledTeleport(
3078
+ node,
3063
3079
  vnode,
3064
- parentNode(node),
3065
- parentComponent,
3066
- parentSuspense,
3067
- slotScopeIds,
3068
- optimized
3080
+ targetNode,
3081
+ targetNode && nextSibling(targetNode)
3069
3082
  );
3070
- vnode.targetStart = targetNode;
3071
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
3072
3083
  } else {
3073
3084
  vnode.anchor = nextSibling(node);
3074
3085
  let targetAnchor = targetNode;
@@ -3099,6 +3110,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
3099
3110
  }
3100
3111
  }
3101
3112
  updateCssVars(vnode, disabled);
3113
+ } else if (disabled) {
3114
+ if (vnode.shapeFlag & 16) {
3115
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
3116
+ }
3102
3117
  }
3103
3118
  return vnode.anchor && nextSibling(vnode.anchor);
3104
3119
  }
@@ -3139,7 +3154,7 @@ function useTransitionState() {
3139
3154
  isMounted: false,
3140
3155
  isLeaving: false,
3141
3156
  isUnmounting: false,
3142
- leavingVNodes: /* @__PURE__ */ new Map()
3157
+ leavingNodes: /* @__PURE__ */ new Map()
3143
3158
  };
3144
3159
  onMounted(() => {
3145
3160
  state.isMounted = true;
@@ -3171,7 +3186,7 @@ const BaseTransitionPropsValidators = {
3171
3186
  onAppearCancelled: TransitionHookValidator
3172
3187
  };
3173
3188
  const recursiveGetSubtree = (instance) => {
3174
- const subTree = instance.subTree;
3189
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
3175
3190
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
3176
3191
  };
3177
3192
  const BaseTransitionImpl = {
@@ -3207,7 +3222,7 @@ const BaseTransitionImpl = {
3207
3222
  setTransitionHooks(innerChild, enterHooks);
3208
3223
  }
3209
3224
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3210
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3225
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3211
3226
  let leavingHooks = resolveTransitionHooks(
3212
3227
  oldInnerChild,
3213
3228
  rawProps,
@@ -3272,15 +3287,53 @@ function findNonCommentChild(children) {
3272
3287
  }
3273
3288
  const BaseTransition = BaseTransitionImpl;
3274
3289
  function getLeavingNodesForType(state, vnode) {
3275
- const { leavingVNodes } = state;
3276
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
3290
+ const { leavingNodes } = state;
3291
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
3277
3292
  if (!leavingVNodesCache) {
3278
3293
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
3279
- leavingVNodes.set(vnode.type, leavingVNodesCache);
3294
+ leavingNodes.set(vnode.type, leavingVNodesCache);
3280
3295
  }
3281
3296
  return leavingVNodesCache;
3282
3297
  }
3283
3298
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3299
+ const key = String(vnode.key);
3300
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3301
+ const context = {
3302
+ setLeavingNodeCache: () => {
3303
+ leavingVNodesCache[key] = vnode;
3304
+ },
3305
+ unsetLeavingNodeCache: () => {
3306
+ if (leavingVNodesCache[key] === vnode) {
3307
+ delete leavingVNodesCache[key];
3308
+ }
3309
+ },
3310
+ earlyRemove: () => {
3311
+ const leavingVNode = leavingVNodesCache[key];
3312
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3313
+ leavingVNode.el[leaveCbKey]();
3314
+ }
3315
+ },
3316
+ cloneHooks: (vnode2) => {
3317
+ const hooks = resolveTransitionHooks(
3318
+ vnode2,
3319
+ props,
3320
+ state,
3321
+ instance,
3322
+ postClone
3323
+ );
3324
+ if (postClone) postClone(hooks);
3325
+ return hooks;
3326
+ }
3327
+ };
3328
+ return baseResolveTransitionHooks(context, props, state, instance);
3329
+ }
3330
+ function baseResolveTransitionHooks(context, props, state, instance) {
3331
+ const {
3332
+ setLeavingNodeCache,
3333
+ unsetLeavingNodeCache,
3334
+ earlyRemove,
3335
+ cloneHooks
3336
+ } = context;
3284
3337
  const {
3285
3338
  appear,
3286
3339
  mode,
@@ -3298,8 +3351,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3298
3351
  onAfterAppear,
3299
3352
  onAppearCancelled
3300
3353
  } = props;
3301
- const key = String(vnode.key);
3302
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3303
3354
  const callHook = (hook, args) => {
3304
3355
  hook && callWithAsyncErrorHandling(
3305
3356
  hook,
@@ -3335,10 +3386,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3335
3386
  /* cancelled */
3336
3387
  );
3337
3388
  }
3338
- const leavingVNode = leavingVNodesCache[key];
3339
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3340
- leavingVNode.el[leaveCbKey]();
3341
- }
3389
+ earlyRemove();
3342
3390
  callHook(hook, [el]);
3343
3391
  },
3344
3392
  enter(el) {
@@ -3375,7 +3423,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3375
3423
  }
3376
3424
  },
3377
3425
  leave(el, remove) {
3378
- const key2 = String(vnode.key);
3379
3426
  if (el[enterCbKey$1]) {
3380
3427
  el[enterCbKey$1](
3381
3428
  true
@@ -3397,27 +3444,17 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3397
3444
  callHook(onAfterLeave, [el]);
3398
3445
  }
3399
3446
  el[leaveCbKey] = void 0;
3400
- if (leavingVNodesCache[key2] === vnode) {
3401
- delete leavingVNodesCache[key2];
3402
- }
3447
+ unsetLeavingNodeCache(el);
3403
3448
  };
3404
- leavingVNodesCache[key2] = vnode;
3449
+ setLeavingNodeCache(el);
3405
3450
  if (onLeave) {
3406
3451
  callAsyncHook(onLeave, [el, done]);
3407
3452
  } else {
3408
3453
  done();
3409
3454
  }
3410
3455
  },
3411
- clone(vnode2) {
3412
- const hooks2 = resolveTransitionHooks(
3413
- vnode2,
3414
- props,
3415
- state,
3416
- instance,
3417
- postClone
3418
- );
3419
- if (postClone) postClone(hooks2);
3420
- return hooks2;
3456
+ clone(node) {
3457
+ return cloneHooks(node);
3421
3458
  }
3422
3459
  };
3423
3460
  return hooks;
@@ -3451,8 +3488,15 @@ function getInnerChild$1(vnode) {
3451
3488
  }
3452
3489
  function setTransitionHooks(vnode, hooks) {
3453
3490
  if (vnode.shapeFlag & 6 && vnode.component) {
3454
- vnode.transition = hooks;
3455
- setTransitionHooks(vnode.component.subTree, hooks);
3491
+ if (vnode.type.__vapor) {
3492
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
3493
+ vnode.component,
3494
+ hooks
3495
+ );
3496
+ } else {
3497
+ vnode.transition = hooks;
3498
+ setTransitionHooks(vnode.component.subTree, hooks);
3499
+ }
3456
3500
  } else if (vnode.shapeFlag & 128) {
3457
3501
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3458
3502
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -3483,7 +3527,6 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3483
3527
  return ret;
3484
3528
  }
3485
3529
 
3486
- /*! #__NO_SIDE_EFFECTS__ */
3487
3530
  // @__NO_SIDE_EFFECTS__
3488
3531
  function defineComponent(options, extraOptions) {
3489
3532
  return isFunction(options) ? (
@@ -3521,6 +3564,7 @@ function useTemplateRef(key) {
3521
3564
  return ret;
3522
3565
  }
3523
3566
 
3567
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
3524
3568
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3525
3569
  if (isArray(rawRef)) {
3526
3570
  rawRef.forEach(
@@ -3546,18 +3590,20 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3546
3590
  const oldRef = oldRawRef && oldRawRef.r;
3547
3591
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3548
3592
  const setupState = owner.setupState;
3549
- const rawSetupState = toRaw(setupState);
3550
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3551
- return hasOwn(rawSetupState, key);
3552
- };
3593
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
3553
3594
  if (oldRef != null && oldRef !== ref) {
3595
+ invalidatePendingSetRef(oldRawRef);
3554
3596
  if (isString(oldRef)) {
3555
3597
  refs[oldRef] = null;
3556
3598
  if (canSetSetupRef(oldRef)) {
3557
3599
  setupState[oldRef] = null;
3558
3600
  }
3559
3601
  } else if (isRef(oldRef)) {
3560
- oldRef.value = null;
3602
+ {
3603
+ oldRef.value = null;
3604
+ }
3605
+ const oldRawRefAtom = oldRawRef;
3606
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
3561
3607
  }
3562
3608
  }
3563
3609
  if (isFunction(ref)) {
@@ -3568,7 +3614,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3568
3614
  if (_isString || _isRef) {
3569
3615
  const doSet = () => {
3570
3616
  if (rawRef.f) {
3571
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3617
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value ;
3572
3618
  if (isUnmount) {
3573
3619
  isArray(existing) && remove(existing, refValue);
3574
3620
  } else {
@@ -3579,8 +3625,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3579
3625
  setupState[ref] = refs[ref];
3580
3626
  }
3581
3627
  } else {
3582
- ref.value = [refValue];
3583
- if (rawRef.k) refs[rawRef.k] = ref.value;
3628
+ const newVal = [refValue];
3629
+ {
3630
+ ref.value = newVal;
3631
+ }
3632
+ if (rawRef.k) refs[rawRef.k] = newVal;
3584
3633
  }
3585
3634
  } else if (!existing.includes(refValue)) {
3586
3635
  existing.push(refValue);
@@ -3592,18 +3641,39 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3592
3641
  setupState[ref] = value;
3593
3642
  }
3594
3643
  } else if (_isRef) {
3595
- ref.value = value;
3644
+ {
3645
+ ref.value = value;
3646
+ }
3596
3647
  if (rawRef.k) refs[rawRef.k] = value;
3597
3648
  } else ;
3598
3649
  };
3599
3650
  if (value) {
3600
- queuePostRenderEffect(doSet, -1, parentSuspense);
3651
+ const job = () => {
3652
+ doSet();
3653
+ pendingSetRefMap.delete(rawRef);
3654
+ };
3655
+ pendingSetRefMap.set(rawRef, job);
3656
+ queuePostRenderEffect(job, -1, parentSuspense);
3601
3657
  } else {
3658
+ invalidatePendingSetRef(rawRef);
3602
3659
  doSet();
3603
3660
  }
3604
3661
  }
3605
3662
  }
3606
3663
  }
3664
+ function createCanSetSetupRefChecker(setupState) {
3665
+ const rawSetupState = toRaw(setupState);
3666
+ return setupState === void 0 || setupState === EMPTY_OBJ ? NO : (key) => {
3667
+ return hasOwn(rawSetupState, key);
3668
+ };
3669
+ }
3670
+ function invalidatePendingSetRef(rawRef) {
3671
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
3672
+ if (pendingSetRef) {
3673
+ pendingSetRef.flags |= 4;
3674
+ pendingSetRefMap.delete(rawRef);
3675
+ }
3676
+ }
3607
3677
 
3608
3678
  let hasLoggedMismatchError = false;
3609
3679
  const logMismatchError = () => {
@@ -3684,7 +3754,7 @@ function createHydrationFunctions(rendererInternals) {
3684
3754
  }
3685
3755
  break;
3686
3756
  case Comment:
3687
- if (isTemplateNode(node)) {
3757
+ if (isTemplateNode$1(node)) {
3688
3758
  nextNode = nextSibling(node);
3689
3759
  replaceNode(
3690
3760
  vnode.el = node.content.firstChild,
@@ -3732,9 +3802,15 @@ function createHydrationFunctions(rendererInternals) {
3732
3802
  );
3733
3803
  }
3734
3804
  break;
3805
+ case VaporSlot:
3806
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
3807
+ vnode,
3808
+ node
3809
+ );
3810
+ break;
3735
3811
  default:
3736
3812
  if (shapeFlag & 1) {
3737
- if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
3813
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) {
3738
3814
  nextNode = onMismatch();
3739
3815
  } else {
3740
3816
  nextNode = hydrateElement(
@@ -3747,9 +3823,6 @@ function createHydrationFunctions(rendererInternals) {
3747
3823
  );
3748
3824
  }
3749
3825
  } else if (shapeFlag & 6) {
3750
- if (vnode.type.__vapor) {
3751
- throw new Error("Vapor component hydration is not supported yet.");
3752
- }
3753
3826
  vnode.slotScopeIds = slotScopeIds;
3754
3827
  const container = parentNode(node);
3755
3828
  if (isFragmentStart) {
@@ -3759,15 +3832,25 @@ function createHydrationFunctions(rendererInternals) {
3759
3832
  } else {
3760
3833
  nextNode = nextSibling(node);
3761
3834
  }
3762
- mountComponent(
3763
- vnode,
3764
- container,
3765
- null,
3766
- parentComponent,
3767
- parentSuspense,
3768
- getContainerType(container),
3769
- optimized
3770
- );
3835
+ if (vnode.type.__vapor) {
3836
+ getVaporInterface(parentComponent, vnode).hydrate(
3837
+ vnode,
3838
+ node,
3839
+ container,
3840
+ null,
3841
+ parentComponent
3842
+ );
3843
+ } else {
3844
+ mountComponent(
3845
+ vnode,
3846
+ container,
3847
+ null,
3848
+ parentComponent,
3849
+ parentSuspense,
3850
+ getContainerType(container),
3851
+ optimized
3852
+ );
3853
+ }
3771
3854
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
3772
3855
  let subTree;
3773
3856
  if (isFragmentStart) {
@@ -3822,7 +3905,7 @@ function createHydrationFunctions(rendererInternals) {
3822
3905
  invokeDirectiveHook(vnode, null, parentComponent, "created");
3823
3906
  }
3824
3907
  let needCallTransitionHooks = false;
3825
- if (isTemplateNode(el)) {
3908
+ if (isTemplateNode$1(el)) {
3826
3909
  needCallTransitionHooks = needTransition(
3827
3910
  null,
3828
3911
  // no need check parentSuspense in hydration
@@ -3849,7 +3932,7 @@ function createHydrationFunctions(rendererInternals) {
3849
3932
  optimized
3850
3933
  );
3851
3934
  while (next) {
3852
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
3935
+ if (!isMismatchAllowed(el, 1)) {
3853
3936
  logMismatchError();
3854
3937
  }
3855
3938
  const cur = next;
@@ -3861,8 +3944,10 @@ function createHydrationFunctions(rendererInternals) {
3861
3944
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
3862
3945
  clientText = clientText.slice(1);
3863
3946
  }
3864
- if (el.textContent !== clientText) {
3865
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
3947
+ const { textContent } = el;
3948
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
3949
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
3950
+ if (!isMismatchAllowed(el, 0)) {
3866
3951
  logMismatchError();
3867
3952
  }
3868
3953
  el.textContent = vnode.children;
@@ -3942,7 +4027,7 @@ function createHydrationFunctions(rendererInternals) {
3942
4027
  } else if (isText && !vnode.children) {
3943
4028
  insert(vnode.el = createText(""), container);
3944
4029
  } else {
3945
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4030
+ if (!isMismatchAllowed(container, 1)) {
3946
4031
  logMismatchError();
3947
4032
  }
3948
4033
  patch(
@@ -3983,7 +4068,7 @@ function createHydrationFunctions(rendererInternals) {
3983
4068
  }
3984
4069
  };
3985
4070
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
3986
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4071
+ if (!isMismatchAllowed(node.parentElement, 1)) {
3987
4072
  logMismatchError();
3988
4073
  }
3989
4074
  vnode.el = null;
@@ -4047,21 +4132,21 @@ function createHydrationFunctions(rendererInternals) {
4047
4132
  parent = parent.parent;
4048
4133
  }
4049
4134
  };
4050
- const isTemplateNode = (node) => {
4051
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
4052
- };
4053
4135
  return [hydrate, hydrateNode];
4054
4136
  }
4137
+ const isTemplateNode$1 = (node) => {
4138
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4139
+ };
4055
4140
  const allowMismatchAttr = "data-allow-mismatch";
4056
4141
  const MismatchTypeString = {
4057
- [0 /* TEXT */]: "text",
4058
- [1 /* CHILDREN */]: "children",
4059
- [2 /* CLASS */]: "class",
4060
- [3 /* STYLE */]: "style",
4061
- [4 /* ATTRIBUTE */]: "attribute"
4142
+ [0]: "text",
4143
+ [1]: "children",
4144
+ [2]: "class",
4145
+ [3]: "style",
4146
+ [4]: "attribute"
4062
4147
  };
4063
4148
  function isMismatchAllowed(el, allowedType) {
4064
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
4149
+ if (allowedType === 0 || allowedType === 1) {
4065
4150
  while (el && !el.hasAttribute(allowMismatchAttr)) {
4066
4151
  el = el.parentElement;
4067
4152
  }
@@ -4073,7 +4158,7 @@ function isMismatchAllowed(el, allowedType) {
4073
4158
  return true;
4074
4159
  } else {
4075
4160
  const list = allowedAttr.split(",");
4076
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4161
+ if (allowedType === 0 && list.includes("children")) {
4077
4162
  return true;
4078
4163
  }
4079
4164
  return list.includes(MismatchTypeString[allowedType]);
@@ -4130,7 +4215,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
4130
4215
  hasHydrated = true;
4131
4216
  teardown();
4132
4217
  hydrate();
4133
- e.target.dispatchEvent(new e.constructor(e.type, e));
4218
+ if (!(`$evt${e.type}` in e.target)) {
4219
+ e.target.dispatchEvent(new e.constructor(e.type, e));
4220
+ }
4134
4221
  }
4135
4222
  };
4136
4223
  const teardown = () => {
@@ -4172,89 +4259,46 @@ function forEachElement(node, cb) {
4172
4259
  }
4173
4260
 
4174
4261
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4175
- /*! #__NO_SIDE_EFFECTS__ */
4176
4262
  // @__NO_SIDE_EFFECTS__
4177
4263
  function defineAsyncComponent(source) {
4178
- if (isFunction(source)) {
4179
- source = { loader: source };
4180
- }
4181
4264
  const {
4182
- loader,
4183
- loadingComponent,
4184
- errorComponent,
4185
- delay = 200,
4186
- hydrate: hydrateStrategy,
4187
- timeout,
4188
- // undefined = never times out
4189
- suspensible = true,
4190
- onError: userOnError
4191
- } = source;
4192
- let pendingRequest = null;
4193
- let resolvedComp;
4194
- let retries = 0;
4195
- const retry = () => {
4196
- retries++;
4197
- pendingRequest = null;
4198
- return load();
4199
- };
4200
- const load = () => {
4201
- let thisRequest;
4202
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4203
- err = err instanceof Error ? err : new Error(String(err));
4204
- if (userOnError) {
4205
- return new Promise((resolve, reject) => {
4206
- const userRetry = () => resolve(retry());
4207
- const userFail = () => reject(err);
4208
- userOnError(err, userRetry, userFail, retries + 1);
4209
- });
4210
- } else {
4211
- throw err;
4212
- }
4213
- }).then((comp) => {
4214
- if (thisRequest !== pendingRequest && pendingRequest) {
4215
- return pendingRequest;
4216
- }
4217
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4218
- comp = comp.default;
4219
- }
4220
- resolvedComp = comp;
4221
- return comp;
4222
- }));
4223
- };
4265
+ load,
4266
+ getResolvedComp,
4267
+ setPendingRequest,
4268
+ source: {
4269
+ loadingComponent,
4270
+ errorComponent,
4271
+ delay,
4272
+ hydrate: hydrateStrategy,
4273
+ timeout,
4274
+ suspensible = true
4275
+ }
4276
+ } = createAsyncComponentContext(source);
4224
4277
  return defineComponent({
4225
4278
  name: "AsyncComponentWrapper",
4226
4279
  __asyncLoader: load,
4227
4280
  __asyncHydrate(el, instance, hydrate) {
4228
- const doHydrate = hydrateStrategy ? () => {
4229
- const performHydrate = () => {
4230
- hydrate();
4231
- };
4232
- const teardown = hydrateStrategy(
4233
- performHydrate,
4234
- (cb) => forEachElement(el, cb)
4235
- );
4236
- if (teardown) {
4237
- (instance.bum || (instance.bum = [])).push(teardown);
4238
- }
4239
- (instance.u || (instance.u = [])).push(() => true);
4240
- } : hydrate;
4241
- if (resolvedComp) {
4242
- doHydrate();
4243
- } else {
4244
- load().then(() => !instance.isUnmounted && doHydrate());
4245
- }
4281
+ performAsyncHydrate(
4282
+ el,
4283
+ instance,
4284
+ hydrate,
4285
+ getResolvedComp,
4286
+ load,
4287
+ hydrateStrategy
4288
+ );
4246
4289
  },
4247
4290
  get __asyncResolved() {
4248
- return resolvedComp;
4291
+ return getResolvedComp();
4249
4292
  },
4250
4293
  setup() {
4251
4294
  const instance = currentInstance;
4252
4295
  markAsyncBoundary(instance);
4296
+ let resolvedComp = getResolvedComp();
4253
4297
  if (resolvedComp) {
4254
4298
  return () => createInnerComp(resolvedComp, instance);
4255
4299
  }
4256
4300
  const onError = (err) => {
4257
- pendingRequest = null;
4301
+ setPendingRequest(null);
4258
4302
  handleError(
4259
4303
  err,
4260
4304
  instance,
@@ -4272,25 +4316,11 @@ function defineAsyncComponent(source) {
4272
4316
  }) : null;
4273
4317
  });
4274
4318
  }
4275
- const loaded = ref(false);
4276
- const error = ref();
4277
- const delayed = ref(!!delay);
4278
- if (delay) {
4279
- setTimeout(() => {
4280
- delayed.value = false;
4281
- }, delay);
4282
- }
4283
- if (timeout != null) {
4284
- setTimeout(() => {
4285
- if (!loaded.value && !error.value) {
4286
- const err = new Error(
4287
- `Async component timed out after ${timeout}ms.`
4288
- );
4289
- onError(err);
4290
- error.value = err;
4291
- }
4292
- }, timeout);
4293
- }
4319
+ const { loaded, error, delayed } = useAsyncComponentState(
4320
+ delay,
4321
+ timeout,
4322
+ onError
4323
+ );
4294
4324
  load().then(() => {
4295
4325
  loaded.value = true;
4296
4326
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -4301,6 +4331,7 @@ function defineAsyncComponent(source) {
4301
4331
  error.value = err;
4302
4332
  });
4303
4333
  return () => {
4334
+ resolvedComp = getResolvedComp();
4304
4335
  if (loaded.value && resolvedComp) {
4305
4336
  return createInnerComp(resolvedComp, instance);
4306
4337
  } else if (error.value && errorComponent) {
@@ -4308,7 +4339,10 @@ function defineAsyncComponent(source) {
4308
4339
  error: error.value
4309
4340
  });
4310
4341
  } else if (loadingComponent && !delayed.value) {
4311
- return createVNode(loadingComponent);
4342
+ return createInnerComp(
4343
+ loadingComponent,
4344
+ instance
4345
+ );
4312
4346
  }
4313
4347
  };
4314
4348
  }
@@ -4322,6 +4356,94 @@ function createInnerComp(comp, parent) {
4322
4356
  delete parent.vnode.ce;
4323
4357
  return vnode;
4324
4358
  }
4359
+ function createAsyncComponentContext(source) {
4360
+ if (isFunction(source)) {
4361
+ source = { loader: source };
4362
+ }
4363
+ const { loader, onError: userOnError } = source;
4364
+ let pendingRequest = null;
4365
+ let resolvedComp;
4366
+ let retries = 0;
4367
+ const retry = () => {
4368
+ retries++;
4369
+ pendingRequest = null;
4370
+ return load();
4371
+ };
4372
+ const load = () => {
4373
+ let thisRequest;
4374
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4375
+ err = err instanceof Error ? err : new Error(String(err));
4376
+ if (userOnError) {
4377
+ return new Promise((resolve, reject) => {
4378
+ const userRetry = () => resolve(retry());
4379
+ const userFail = () => reject(err);
4380
+ userOnError(err, userRetry, userFail, retries + 1);
4381
+ });
4382
+ } else {
4383
+ throw err;
4384
+ }
4385
+ }).then((comp) => {
4386
+ if (thisRequest !== pendingRequest && pendingRequest) {
4387
+ return pendingRequest;
4388
+ }
4389
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4390
+ comp = comp.default;
4391
+ }
4392
+ resolvedComp = comp;
4393
+ return comp;
4394
+ }));
4395
+ };
4396
+ return {
4397
+ load,
4398
+ source,
4399
+ getResolvedComp: () => resolvedComp,
4400
+ setPendingRequest: (request) => pendingRequest = request
4401
+ };
4402
+ }
4403
+ const useAsyncComponentState = (delay, timeout, onError) => {
4404
+ const loaded = ref(false);
4405
+ const error = ref();
4406
+ const delayed = ref(!!delay);
4407
+ if (delay) {
4408
+ setTimeout(() => {
4409
+ delayed.value = false;
4410
+ }, delay);
4411
+ }
4412
+ if (timeout != null) {
4413
+ setTimeout(() => {
4414
+ if (!loaded.value && !error.value) {
4415
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
4416
+ onError(err);
4417
+ error.value = err;
4418
+ }
4419
+ }, timeout);
4420
+ }
4421
+ return { loaded, error, delayed };
4422
+ };
4423
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
4424
+ let patched = false;
4425
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
4426
+ const performHydrate = () => {
4427
+ if (patched) {
4428
+ return;
4429
+ }
4430
+ hydrate();
4431
+ };
4432
+ const doHydrate = hydrateStrategy ? () => {
4433
+ const teardown = hydrateStrategy(
4434
+ performHydrate,
4435
+ (cb) => forEachElement(el, cb)
4436
+ );
4437
+ if (teardown) {
4438
+ (instance.bum || (instance.bum = [])).push(teardown);
4439
+ }
4440
+ } : performHydrate;
4441
+ if (getResolvedComp()) {
4442
+ doHydrate();
4443
+ } else {
4444
+ load().then(() => !instance.isUnmounted && doHydrate());
4445
+ }
4446
+ }
4325
4447
 
4326
4448
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4327
4449
  const KeepAliveImpl = {
@@ -4348,77 +4470,37 @@ const KeepAliveImpl = {
4348
4470
  const keys = /* @__PURE__ */ new Set();
4349
4471
  let current = null;
4350
4472
  const parentSuspense = keepAliveInstance.suspense;
4473
+ const { renderer } = sharedContext;
4351
4474
  const {
4352
- renderer: {
4353
- p: patch,
4354
- m: move,
4355
- um: _unmount,
4356
- o: { createElement }
4357
- }
4358
- } = sharedContext;
4475
+ um: _unmount,
4476
+ o: { createElement }
4477
+ } = renderer;
4359
4478
  const storageContainer = createElement("div");
4479
+ sharedContext.getStorageContainer = () => storageContainer;
4480
+ sharedContext.getCachedComponent = (vnode) => {
4481
+ const key = vnode.key == null ? vnode.type : vnode.key;
4482
+ return cache.get(key);
4483
+ };
4360
4484
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
4361
- const instance = vnode.component;
4362
- move(
4485
+ activate(
4363
4486
  vnode,
4364
4487
  container,
4365
4488
  anchor,
4366
- 0,
4489
+ renderer,
4367
4490
  keepAliveInstance,
4368
- parentSuspense
4369
- );
4370
- patch(
4371
- instance.vnode,
4372
- vnode,
4373
- container,
4374
- anchor,
4375
- instance,
4376
4491
  parentSuspense,
4377
4492
  namespace,
4378
- vnode.slotScopeIds,
4379
4493
  optimized
4380
4494
  );
4381
- queuePostRenderEffect(
4382
- () => {
4383
- instance.isDeactivated = false;
4384
- if (instance.a) {
4385
- invokeArrayFns(instance.a);
4386
- }
4387
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4388
- if (vnodeHook) {
4389
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
4390
- }
4391
- },
4392
- void 0,
4393
- parentSuspense
4394
- );
4395
4495
  };
4396
4496
  sharedContext.deactivate = (vnode) => {
4397
- const instance = vnode.component;
4398
- invalidateMount(instance.m);
4399
- invalidateMount(instance.a);
4400
- move(
4497
+ deactivate(
4401
4498
  vnode,
4402
4499
  storageContainer,
4403
- null,
4404
- 1,
4500
+ renderer,
4405
4501
  keepAliveInstance,
4406
4502
  parentSuspense
4407
4503
  );
4408
- queuePostRenderEffect(
4409
- () => {
4410
- if (instance.da) {
4411
- invokeArrayFns(instance.da);
4412
- }
4413
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4414
- if (vnodeHook) {
4415
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
4416
- }
4417
- instance.isDeactivated = true;
4418
- },
4419
- void 0,
4420
- parentSuspense
4421
- );
4422
4504
  };
4423
4505
  function unmount(vnode) {
4424
4506
  resetShapeFlag(vnode);
@@ -4566,7 +4648,7 @@ function onActivated(hook, target) {
4566
4648
  function onDeactivated(hook, target) {
4567
4649
  registerKeepAliveHook(hook, "da", target);
4568
4650
  }
4569
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
4651
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
4570
4652
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
4571
4653
  let current = target;
4572
4654
  while (current) {
@@ -4580,8 +4662,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
4580
4662
  injectHook(type, wrappedHook, target);
4581
4663
  if (target) {
4582
4664
  let current = target.parent;
4583
- while (current && current.parent && current.parent.vnode) {
4584
- if (isKeepAlive(current.parent.vnode)) {
4665
+ while (current && current.parent) {
4666
+ let parent = current.parent;
4667
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
4585
4668
  injectToKeepAliveRoot(wrappedHook, type, target, current);
4586
4669
  }
4587
4670
  current = current.parent;
@@ -4607,6 +4690,62 @@ function resetShapeFlag(vnode) {
4607
4690
  function getInnerChild(vnode) {
4608
4691
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
4609
4692
  }
4693
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
4694
+ const instance = vnode.component;
4695
+ move(
4696
+ vnode,
4697
+ container,
4698
+ anchor,
4699
+ 0,
4700
+ parentComponent,
4701
+ parentSuspense
4702
+ );
4703
+ patch(
4704
+ instance.vnode,
4705
+ vnode,
4706
+ container,
4707
+ anchor,
4708
+ instance,
4709
+ parentSuspense,
4710
+ namespace,
4711
+ vnode.slotScopeIds,
4712
+ optimized
4713
+ );
4714
+ queuePostRenderEffect(
4715
+ () => {
4716
+ instance.isDeactivated = false;
4717
+ if (instance.a) {
4718
+ invokeArrayFns(instance.a);
4719
+ }
4720
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
4721
+ if (vnodeHook) {
4722
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
4723
+ }
4724
+ },
4725
+ void 0,
4726
+ parentSuspense
4727
+ );
4728
+ }
4729
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
4730
+ const instance = vnode.component;
4731
+ invalidateMount(instance.m);
4732
+ invalidateMount(instance.a);
4733
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
4734
+ queuePostRenderEffect(
4735
+ () => {
4736
+ if (instance.da) {
4737
+ invokeArrayFns(instance.da);
4738
+ }
4739
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
4740
+ if (vnodeHook) {
4741
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
4742
+ }
4743
+ instance.isDeactivated = true;
4744
+ },
4745
+ void 0,
4746
+ parentSuspense
4747
+ );
4748
+ }
4610
4749
 
4611
4750
  function injectHook(type, hook, target = currentInstance, prepend = false) {
4612
4751
  if (target) {
@@ -5065,12 +5204,13 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5065
5204
  return ret;
5066
5205
  }
5067
5206
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
5207
+ const hasProps = Object.keys(props).length > 0;
5068
5208
  if (name !== "default") props.name = name;
5069
5209
  return openBlock(), createBlock(
5070
5210
  Fragment,
5071
5211
  null,
5072
5212
  [createVNode("slot", props, fallback && fallback())],
5073
- 64
5213
+ hasProps ? -2 : 64
5074
5214
  );
5075
5215
  }
5076
5216
  if (slot && slot._c) {
@@ -5078,6 +5218,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5078
5218
  }
5079
5219
  openBlock();
5080
5220
  const validSlotContent = slot && ensureValidVNode(slot(props));
5221
+ ensureVaporSlotFallback(validSlotContent, fallback);
5081
5222
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5082
5223
  // key attached in the `createSlots` helper, respect that
5083
5224
  validSlotContent && validSlotContent.key;
@@ -5107,6 +5248,14 @@ function ensureValidVNode(vnodes) {
5107
5248
  return true;
5108
5249
  }) ? vnodes : null;
5109
5250
  }
5251
+ function ensureVaporSlotFallback(vnodes, fallback) {
5252
+ let vaporSlot;
5253
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
5254
+ if (!vaporSlot.fallback && fallback) {
5255
+ vaporSlot.fallback = fallback;
5256
+ }
5257
+ }
5258
+ }
5110
5259
 
5111
5260
  function toHandlers(obj, preserveCaseIfNecessary) {
5112
5261
  const ret = {};
@@ -5164,7 +5313,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
5164
5313
  }
5165
5314
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
5166
5315
  }
5167
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
5316
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
5168
5317
  return createSlots(
5169
5318
  raw || { $stable: !hasDynamicKeys },
5170
5319
  mapKeyToName(fns)
@@ -5325,7 +5474,7 @@ function installCompatInstanceProperties(map) {
5325
5474
  _b: () => legacyBindObjectProps,
5326
5475
  _v: () => createTextVNode,
5327
5476
  _e: () => createCommentVNode,
5328
- _u: () => legacyresolveScopedSlots,
5477
+ _u: () => legacyResolveScopedSlots,
5329
5478
  _g: () => legacyBindObjectListeners,
5330
5479
  _d: () => legacyBindDynamicKeys,
5331
5480
  _p: () => legacyPrependModifier
@@ -5463,10 +5612,10 @@ const PublicInstanceProxyHandlers = {
5463
5612
  return true;
5464
5613
  },
5465
5614
  has({
5466
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5615
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
5467
5616
  }, key) {
5468
- let normalizedProps;
5469
- 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);
5617
+ let normalizedProps, cssModules;
5618
+ 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]);
5470
5619
  },
5471
5620
  defineProperty(target, key, descriptor) {
5472
5621
  if (descriptor.get != null) {
@@ -5527,7 +5676,7 @@ function useSlots() {
5527
5676
  function useAttrs() {
5528
5677
  return getContext().attrs;
5529
5678
  }
5530
- function getContext() {
5679
+ function getContext(calledFunctionName) {
5531
5680
  const i = getCurrentGenericInstance();
5532
5681
  if (i.vapor) {
5533
5682
  return i;
@@ -5719,7 +5868,8 @@ function applyOptions(instance) {
5719
5868
  expose.forEach((key) => {
5720
5869
  Object.defineProperty(exposed, key, {
5721
5870
  get: () => publicThis[key],
5722
- set: (val) => publicThis[key] = val
5871
+ set: (val) => publicThis[key] = val,
5872
+ enumerable: true
5723
5873
  });
5724
5874
  });
5725
5875
  } else if (!instance.exposed) {
@@ -6007,7 +6157,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
6007
6157
  return vm;
6008
6158
  }
6009
6159
  }
6010
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.2"}`;
6160
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.4"}`;
6011
6161
  Vue.config = singletonApp.config;
6012
6162
  Vue.use = (plugin, ...options) => {
6013
6163
  if (plugin && isFunction(plugin.install)) {
@@ -6021,22 +6171,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
6021
6171
  singletonApp.mixin(m);
6022
6172
  return Vue;
6023
6173
  };
6024
- Vue.component = (name, comp) => {
6174
+ Vue.component = ((name, comp) => {
6025
6175
  if (comp) {
6026
6176
  singletonApp.component(name, comp);
6027
6177
  return Vue;
6028
6178
  } else {
6029
6179
  return singletonApp.component(name);
6030
6180
  }
6031
- };
6032
- Vue.directive = (name, dir) => {
6181
+ });
6182
+ Vue.directive = ((name, dir) => {
6033
6183
  if (dir) {
6034
6184
  singletonApp.directive(name, dir);
6035
6185
  return Vue;
6036
6186
  } else {
6037
6187
  return singletonApp.directive(name);
6038
6188
  }
6039
- };
6189
+ });
6040
6190
  Vue.options = { _base: Vue };
6041
6191
  let cid = 1;
6042
6192
  Vue.cid = cid;
@@ -6099,14 +6249,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
6099
6249
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
6100
6250
  return reactive(target);
6101
6251
  };
6102
- Vue.filter = (name, filter) => {
6252
+ Vue.filter = ((name, filter) => {
6103
6253
  if (filter) {
6104
6254
  singletonApp.filter(name, filter);
6105
6255
  return Vue;
6106
6256
  } else {
6107
6257
  return singletonApp.filter(name);
6108
6258
  }
6109
- };
6259
+ });
6110
6260
  const util = {
6111
6261
  warn: NOOP,
6112
6262
  extend,
@@ -6852,7 +7002,7 @@ function validatePropName(key) {
6852
7002
  return false;
6853
7003
  }
6854
7004
 
6855
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7005
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6856
7006
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6857
7007
  const normalizeSlot = (key, rawSlot, ctx) => {
6858
7008
  if (rawSlot._n) {
@@ -6892,8 +7042,6 @@ const assignSlots = (slots, children, optimized) => {
6892
7042
  const initSlots = (instance, children, optimized) => {
6893
7043
  const slots = instance.slots = createInternalObject();
6894
7044
  if (instance.vnode.shapeFlag & 32) {
6895
- const cacheIndexes = children.__;
6896
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6897
7045
  const type = children._;
6898
7046
  if (type) {
6899
7047
  assignSlots(slots, children, optimized);
@@ -7133,15 +7281,25 @@ function baseCreateRenderer(options, createHydrationFns) {
7133
7281
  optimized
7134
7282
  );
7135
7283
  } else {
7136
- patchElement(
7137
- n1,
7138
- n2,
7139
- parentComponent,
7140
- parentSuspense,
7141
- namespace,
7142
- slotScopeIds,
7143
- optimized
7144
- );
7284
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
7285
+ try {
7286
+ if (customElement) {
7287
+ customElement._beginPatch();
7288
+ }
7289
+ patchElement(
7290
+ n1,
7291
+ n2,
7292
+ parentComponent,
7293
+ parentSuspense,
7294
+ namespace,
7295
+ slotScopeIds,
7296
+ optimized
7297
+ );
7298
+ } finally {
7299
+ if (customElement) {
7300
+ customElement._endPatch();
7301
+ }
7302
+ }
7145
7303
  }
7146
7304
  };
7147
7305
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -7188,16 +7346,20 @@ function baseCreateRenderer(options, createHydrationFns) {
7188
7346
  if (dirs) {
7189
7347
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7190
7348
  }
7191
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
7192
- if (needCallTransitionHooks) {
7193
- transition.beforeEnter(el);
7349
+ if (transition) {
7350
+ performTransitionEnter(
7351
+ el,
7352
+ transition,
7353
+ () => hostInsert(el, container, anchor),
7354
+ parentSuspense
7355
+ );
7356
+ } else {
7357
+ hostInsert(el, container, anchor);
7194
7358
  }
7195
- hostInsert(el, container, anchor);
7196
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7359
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
7197
7360
  queuePostRenderEffect(
7198
7361
  () => {
7199
7362
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7200
- needCallTransitionHooks && transition.enter(el);
7201
7363
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7202
7364
  },
7203
7365
  void 0,
@@ -7214,18 +7376,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7214
7376
  hostSetScopeId(el, slotScopeIds[i]);
7215
7377
  }
7216
7378
  }
7217
- let subTree = parentComponent && parentComponent.subTree;
7218
- if (subTree) {
7219
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
7220
- const parentVNode = parentComponent.vnode;
7221
- setScopeId(
7222
- el,
7223
- parentVNode,
7224
- parentVNode.scopeId,
7225
- parentVNode.slotScopeIds,
7226
- parentComponent.parent
7227
- );
7228
- }
7379
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
7380
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
7381
+ hostSetScopeId(el, inheritedScopeIds[i]);
7229
7382
  }
7230
7383
  };
7231
7384
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -7458,12 +7611,21 @@ function baseCreateRenderer(options, createHydrationFns) {
7458
7611
  n2.slotScopeIds = slotScopeIds;
7459
7612
  if (n2.type.__vapor) {
7460
7613
  if (n1 == null) {
7461
- getVaporInterface(parentComponent, n2).mount(
7462
- n2,
7463
- container,
7464
- anchor,
7465
- parentComponent
7466
- );
7614
+ if (n2.shapeFlag & 512) {
7615
+ getVaporInterface(parentComponent, n2).activate(
7616
+ n2,
7617
+ container,
7618
+ anchor,
7619
+ parentComponent
7620
+ );
7621
+ } else {
7622
+ getVaporInterface(parentComponent, n2).mount(
7623
+ n2,
7624
+ container,
7625
+ anchor,
7626
+ parentComponent
7627
+ );
7628
+ }
7467
7629
  } else {
7468
7630
  getVaporInterface(parentComponent, n2).update(
7469
7631
  n1,
@@ -7513,6 +7675,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7513
7675
  if (!initialVNode.el) {
7514
7676
  const placeholder = instance.subTree = createVNode(Comment);
7515
7677
  processCommentNode(null, placeholder, container, anchor);
7678
+ initialVNode.placeholder = placeholder.el;
7516
7679
  }
7517
7680
  } else {
7518
7681
  setupRenderEffect(
@@ -8011,7 +8174,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8011
8174
  for (i = toBePatched - 1; i >= 0; i--) {
8012
8175
  const nextIndex = s2 + i;
8013
8176
  const nextChild = c2[nextIndex];
8014
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
8177
+ const anchorVNode = c2[nextIndex + 1];
8178
+ const anchor = nextIndex + 1 < l2 ? (
8179
+ // #13559, fallback to el placeholder for unresolved async component
8180
+ anchorVNode.el || anchorVNode.placeholder
8181
+ ) : parentAnchor;
8015
8182
  if (newIndexToOldIndexMap[i] === 0) {
8016
8183
  patch(
8017
8184
  null,
@@ -8091,12 +8258,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8091
8258
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
8092
8259
  if (needTransition2) {
8093
8260
  if (moveType === 0) {
8094
- transition.beforeEnter(el);
8095
- hostInsert(el, container, anchor);
8096
- queuePostRenderEffect(
8097
- () => transition.enter(el),
8098
- void 0,
8099
- parentSuspense
8261
+ performTransitionEnter(
8262
+ el,
8263
+ transition,
8264
+ () => hostInsert(el, container, anchor),
8265
+ parentSuspense,
8266
+ true
8100
8267
  );
8101
8268
  } else {
8102
8269
  const { leave, delayLeave, afterLeave } = transition;
@@ -8108,6 +8275,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8108
8275
  }
8109
8276
  };
8110
8277
  const performLeave = () => {
8278
+ if (el._isLeaving) {
8279
+ el[leaveCbKey](
8280
+ true
8281
+ /* cancelled */
8282
+ );
8283
+ }
8111
8284
  leave(el, () => {
8112
8285
  remove2();
8113
8286
  afterLeave && afterLeave();
@@ -8147,7 +8320,14 @@ function baseCreateRenderer(options, createHydrationFns) {
8147
8320
  parentComponent.renderCache[cacheIndex] = void 0;
8148
8321
  }
8149
8322
  if (shapeFlag & 256) {
8150
- parentComponent.ctx.deactivate(vnode);
8323
+ if (vnode.type.__vapor) {
8324
+ getVaporInterface(parentComponent, vnode).deactivate(
8325
+ vnode,
8326
+ parentComponent.ctx.getStorageContainer()
8327
+ );
8328
+ } else {
8329
+ parentComponent.ctx.deactivate(vnode);
8330
+ }
8151
8331
  return;
8152
8332
  }
8153
8333
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -8227,22 +8407,15 @@ function baseCreateRenderer(options, createHydrationFns) {
8227
8407
  removeStaticNode(vnode);
8228
8408
  return;
8229
8409
  }
8230
- const performRemove = () => {
8231
- hostRemove(el);
8232
- if (transition && !transition.persisted && transition.afterLeave) {
8233
- transition.afterLeave();
8234
- }
8235
- };
8236
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
8237
- const { leave, delayLeave } = transition;
8238
- const performLeave = () => leave(el, performRemove);
8239
- if (delayLeave) {
8240
- delayLeave(vnode.el, performRemove, performLeave);
8241
- } else {
8242
- performLeave();
8243
- }
8410
+ if (transition) {
8411
+ performTransitionLeave(
8412
+ el,
8413
+ transition,
8414
+ () => hostRemove(el),
8415
+ !!(vnode.shapeFlag & 1)
8416
+ );
8244
8417
  } else {
8245
- performRemove();
8418
+ hostRemove(el);
8246
8419
  }
8247
8420
  };
8248
8421
  const removeFragment = (cur, end) => {
@@ -8255,27 +8428,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8255
8428
  hostRemove(end);
8256
8429
  };
8257
8430
  const unmountComponent = (instance, parentSuspense, doRemove) => {
8258
- const {
8259
- bum,
8260
- scope,
8261
- effect,
8262
- subTree,
8263
- um,
8264
- m,
8265
- a,
8266
- parent,
8267
- slots: { __: slotCacheKeys }
8268
- } = instance;
8431
+ const { bum, scope, effect, subTree, um, m, a } = instance;
8269
8432
  invalidateMount(m);
8270
8433
  invalidateMount(a);
8271
8434
  if (bum) {
8272
8435
  invokeArrayFns(bum);
8273
8436
  }
8274
- if (parent && isArray(slotCacheKeys)) {
8275
- slotCacheKeys.forEach((v) => {
8276
- parent.renderCache[v] = void 0;
8277
- });
8278
- }
8279
8437
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
8280
8438
  instance.emit("hook:beforeDestroy");
8281
8439
  }
@@ -8299,12 +8457,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8299
8457
  void 0,
8300
8458
  parentSuspense
8301
8459
  );
8302
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8303
- parentSuspense.deps--;
8304
- if (parentSuspense.deps === 0) {
8305
- parentSuspense.resolve();
8306
- }
8307
- }
8308
8460
  };
8309
8461
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
8310
8462
  for (let i = start; i < children.length; i++) {
@@ -8314,7 +8466,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8314
8466
  const getNextHostNode = (vnode) => {
8315
8467
  if (vnode.shapeFlag & 6) {
8316
8468
  if (vnode.type.__vapor) {
8317
- return hostNextSibling(vnode.component.block);
8469
+ return hostNextSibling(vnode.anchor);
8318
8470
  }
8319
8471
  return getNextHostNode(vnode.component.subTree);
8320
8472
  }
@@ -8385,6 +8537,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8385
8537
  return {
8386
8538
  render,
8387
8539
  hydrate,
8540
+ hydrateNode,
8388
8541
  internals,
8389
8542
  createApp: createAppAPI(
8390
8543
  mountApp,
@@ -8426,7 +8579,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8426
8579
  if (!shallow && c2.patchFlag !== -2)
8427
8580
  traverseStaticChildren(c1, c2);
8428
8581
  }
8429
- if (c2.type === Text) {
8582
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
8583
+ c2.patchFlag !== -1) {
8430
8584
  c2.el = c1.el;
8431
8585
  }
8432
8586
  if (c2.type === Comment && !c2.el) {
@@ -8436,7 +8590,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8436
8590
  }
8437
8591
  }
8438
8592
  function locateNonHydratedAsyncRoot(instance) {
8439
- const subComponent = instance.vapor ? null : instance.subTree.component;
8593
+ const subComponent = instance.subTree && instance.subTree.component;
8440
8594
  if (subComponent) {
8441
8595
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
8442
8596
  return subComponent;
@@ -8451,11 +8605,62 @@ function invalidateMount(hooks) {
8451
8605
  hooks[i].flags |= 4;
8452
8606
  }
8453
8607
  }
8608
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
8609
+ if (force || needTransition(parentSuspense, transition)) {
8610
+ transition.beforeEnter(el);
8611
+ insert();
8612
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
8613
+ } else {
8614
+ insert();
8615
+ }
8616
+ }
8617
+ function performTransitionLeave(el, transition, remove, isElement = true) {
8618
+ const performRemove = () => {
8619
+ remove();
8620
+ if (transition && !transition.persisted && transition.afterLeave) {
8621
+ transition.afterLeave();
8622
+ }
8623
+ };
8624
+ if (isElement && transition && !transition.persisted) {
8625
+ const { leave, delayLeave } = transition;
8626
+ const performLeave = () => leave(el, performRemove);
8627
+ if (delayLeave) {
8628
+ delayLeave(el, performRemove, performLeave);
8629
+ } else {
8630
+ performLeave();
8631
+ }
8632
+ } else {
8633
+ performRemove();
8634
+ }
8635
+ }
8454
8636
  function getVaporInterface(instance, vnode) {
8455
8637
  const ctx = instance ? instance.appContext : vnode.appContext;
8456
8638
  const res = ctx && ctx.vapor;
8457
8639
  return res;
8458
8640
  }
8641
+ function getInheritedScopeIds(vnode, parentComponent) {
8642
+ const inheritedScopeIds = [];
8643
+ let currentParent = parentComponent;
8644
+ let currentVNode = vnode;
8645
+ while (currentParent) {
8646
+ let subTree = currentParent.subTree;
8647
+ if (!subTree) break;
8648
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
8649
+ const parentVNode = currentParent.vnode;
8650
+ if (parentVNode.scopeId) {
8651
+ inheritedScopeIds.push(parentVNode.scopeId);
8652
+ }
8653
+ if (parentVNode.slotScopeIds) {
8654
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
8655
+ }
8656
+ currentVNode = parentVNode;
8657
+ currentParent = currentParent.parent;
8658
+ } else {
8659
+ break;
8660
+ }
8661
+ }
8662
+ return inheritedScopeIds;
8663
+ }
8459
8664
 
8460
8665
  const ssrContextKey = Symbol.for("v-scx");
8461
8666
  const useSSRContext = () => {
@@ -8663,7 +8868,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
8663
8868
  return res;
8664
8869
  }
8665
8870
  const getModelModifiers = (props, modelName, getter) => {
8666
- return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
8871
+ return getter(props, getModifierPropName(modelName)) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
8667
8872
  };
8668
8873
 
8669
8874
  function emit(instance, event, ...rawArgs) {
@@ -8730,8 +8935,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
8730
8935
  function defaultPropGetter(props, key) {
8731
8936
  return props[key];
8732
8937
  }
8938
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
8733
8939
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8734
- const cache = appContext.emitsCache;
8940
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
8735
8941
  const cached = cache.get(comp);
8736
8942
  if (cached !== void 0) {
8737
8943
  return cached;
@@ -9117,7 +9323,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9117
9323
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
9118
9324
  if (pendingBranch) {
9119
9325
  suspense.pendingBranch = newBranch;
9120
- if (isSameVNodeType(newBranch, pendingBranch)) {
9326
+ if (isSameVNodeType(pendingBranch, newBranch)) {
9121
9327
  patch(
9122
9328
  pendingBranch,
9123
9329
  newBranch,
@@ -9188,7 +9394,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9188
9394
  );
9189
9395
  setActiveBranch(suspense, newFallback);
9190
9396
  }
9191
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9397
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
9192
9398
  patch(
9193
9399
  activeBranch,
9194
9400
  newBranch,
@@ -9219,7 +9425,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9219
9425
  }
9220
9426
  }
9221
9427
  } else {
9222
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9428
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
9223
9429
  patch(
9224
9430
  activeBranch,
9225
9431
  newBranch,
@@ -9310,7 +9516,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9310
9516
  pendingId,
9311
9517
  effects,
9312
9518
  parentComponent: parentComponent2,
9313
- container: container2
9519
+ container: container2,
9520
+ isInFallback
9314
9521
  } = suspense;
9315
9522
  let delayEnter = false;
9316
9523
  if (suspense.isHydrating) {
@@ -9328,6 +9535,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9328
9535
  parentComponent2
9329
9536
  );
9330
9537
  queuePostFlushCb(effects);
9538
+ if (isInFallback && vnode2.ssFallback) {
9539
+ vnode2.ssFallback.el = null;
9540
+ }
9331
9541
  }
9332
9542
  };
9333
9543
  }
@@ -9336,6 +9546,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9336
9546
  anchor = next(activeBranch);
9337
9547
  }
9338
9548
  unmount(activeBranch, parentComponent2, suspense, true);
9549
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
9550
+ vnode2.ssFallback.el = null;
9551
+ }
9339
9552
  }
9340
9553
  if (!delayEnter) {
9341
9554
  move(
@@ -9457,6 +9670,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9457
9670
  optimized2
9458
9671
  );
9459
9672
  if (placeholder) {
9673
+ vnode2.placeholder = null;
9460
9674
  remove(placeholder);
9461
9675
  }
9462
9676
  updateHOCHostEl(instance, vnode2.el);
@@ -9698,15 +9912,11 @@ function isSameVNodeType(n1, n2) {
9698
9912
  function transformVNodeArgs(transformer) {
9699
9913
  }
9700
9914
  const normalizeKey = ({ key }) => key != null ? key : null;
9701
- const normalizeRef = ({
9702
- ref,
9703
- ref_key,
9704
- ref_for
9705
- }) => {
9915
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
9706
9916
  if (typeof ref === "number") {
9707
9917
  ref = "" + ref;
9708
9918
  }
9709
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
9919
+ return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
9710
9920
  };
9711
9921
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
9712
9922
  const vnode = {
@@ -9864,6 +10074,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
9864
10074
  suspense: vnode.suspense,
9865
10075
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
9866
10076
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
10077
+ placeholder: vnode.placeholder,
9867
10078
  el: vnode.el,
9868
10079
  anchor: vnode.anchor,
9869
10080
  ctx: vnode.ctx,
@@ -10019,6 +10230,17 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
10019
10230
  simpleSetCurrentInstance(instance);
10020
10231
  }
10021
10232
  };
10233
+ const internalOptions = ["ce", "type"];
10234
+ const useInstanceOption = (key, silent = false) => {
10235
+ const instance = getCurrentGenericInstance();
10236
+ if (!instance) {
10237
+ return { hasInstance: false, value: void 0 };
10238
+ }
10239
+ if (!internalOptions.includes(key)) {
10240
+ return { hasInstance: true, value: void 0 };
10241
+ }
10242
+ return { hasInstance: true, value: instance[key] };
10243
+ };
10022
10244
 
10023
10245
  const emptyAppContext = createAppContext();
10024
10246
  let uid = 0;
@@ -10293,23 +10515,28 @@ const computed = (getterOrOptions, debugOptions) => {
10293
10515
  };
10294
10516
 
10295
10517
  function h(type, propsOrChildren, children) {
10296
- const l = arguments.length;
10297
- if (l === 2) {
10298
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10299
- if (isVNode(propsOrChildren)) {
10300
- return createVNode(type, null, [propsOrChildren]);
10518
+ try {
10519
+ setBlockTracking(-1);
10520
+ const l = arguments.length;
10521
+ if (l === 2) {
10522
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10523
+ if (isVNode(propsOrChildren)) {
10524
+ return createVNode(type, null, [propsOrChildren]);
10525
+ }
10526
+ return createVNode(type, propsOrChildren);
10527
+ } else {
10528
+ return createVNode(type, null, propsOrChildren);
10301
10529
  }
10302
- return createVNode(type, propsOrChildren);
10303
10530
  } else {
10304
- return createVNode(type, null, propsOrChildren);
10305
- }
10306
- } else {
10307
- if (l > 3) {
10308
- children = Array.prototype.slice.call(arguments, 2);
10309
- } else if (l === 3 && isVNode(children)) {
10310
- children = [children];
10531
+ if (l > 3) {
10532
+ children = Array.prototype.slice.call(arguments, 2);
10533
+ } else if (l === 3 && isVNode(children)) {
10534
+ children = [children];
10535
+ }
10536
+ return createVNode(type, propsOrChildren, children);
10311
10537
  }
10312
- return createVNode(type, propsOrChildren, children);
10538
+ } finally {
10539
+ setBlockTracking(1);
10313
10540
  }
10314
10541
  }
10315
10542
 
@@ -10345,7 +10572,7 @@ function isMemoSame(cached, memo) {
10345
10572
  return true;
10346
10573
  }
10347
10574
 
10348
- const version = "3.6.0-alpha.2";
10575
+ const version = "3.6.0-alpha.4";
10349
10576
  const warn$1 = NOOP;
10350
10577
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10351
10578
  const devtools = void 0;
@@ -10614,11 +10841,11 @@ function resolveTransitionProps(rawProps) {
10614
10841
  addTransitionClass(el, legacyLeaveFromClass);
10615
10842
  }
10616
10843
  if (!el._enterCancelled) {
10617
- forceReflow();
10844
+ forceReflow(el);
10618
10845
  addTransitionClass(el, leaveActiveClass);
10619
10846
  } else {
10620
10847
  addTransitionClass(el, leaveActiveClass);
10621
- forceReflow();
10848
+ forceReflow(el);
10622
10849
  }
10623
10850
  nextFrame(() => {
10624
10851
  if (!el._isLeaving) {
@@ -10744,7 +10971,7 @@ function getTransitionInfo(el, expectedType) {
10744
10971
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
10745
10972
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
10746
10973
  }
10747
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
10974
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
10748
10975
  getStyleProperties(`${TRANSITION$1}Property`).toString()
10749
10976
  );
10750
10977
  return {
@@ -10764,8 +10991,9 @@ function toMs(s) {
10764
10991
  if (s === "auto") return 0;
10765
10992
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
10766
10993
  }
10767
- function forceReflow() {
10768
- return document.body.offsetHeight;
10994
+ function forceReflow(el) {
10995
+ const targetDocument = el ? el.ownerDocument : document;
10996
+ return targetDocument.body.offsetHeight;
10769
10997
  }
10770
10998
 
10771
10999
  function patchClass(el, value, isSVG) {
@@ -10785,6 +11013,8 @@ function patchClass(el, value, isSVG) {
10785
11013
  const vShowOriginalDisplay = Symbol("_vod");
10786
11014
  const vShowHidden = Symbol("_vsh");
10787
11015
  const vShow = {
11016
+ // used for prop mismatch check during hydration
11017
+ name: "show",
10788
11018
  beforeMount(el, { value }, { transition }) {
10789
11019
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10790
11020
  if (transition && value) {
@@ -10835,7 +11065,7 @@ function useCssVars(getter) {
10835
11065
  return;
10836
11066
  }
10837
11067
 
10838
- const displayRE = /(^|;)\s*display\s*:/;
11068
+ const displayRE = /(?:^|;)\s*display\s*:/;
10839
11069
  function patchStyle(el, prev, next) {
10840
11070
  const style = el.style;
10841
11071
  const isCssString = isString(next);
@@ -11155,11 +11385,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
11155
11385
  }
11156
11386
 
11157
11387
  const REMOVAL = {};
11158
- /*! #__NO_SIDE_EFFECTS__ */
11159
11388
  // @__NO_SIDE_EFFECTS__
11160
11389
  function defineCustomElement(options, extraOptions, _createApp) {
11161
- const Comp = defineComponent(options, extraOptions);
11162
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
11390
+ let Comp = defineComponent(options, extraOptions);
11391
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
11163
11392
  class VueCustomElement extends VueElement {
11164
11393
  constructor(initialProps) {
11165
11394
  super(Comp, initialProps, _createApp);
@@ -11168,18 +11397,14 @@ function defineCustomElement(options, extraOptions, _createApp) {
11168
11397
  VueCustomElement.def = Comp;
11169
11398
  return VueCustomElement;
11170
11399
  }
11171
- /*! #__NO_SIDE_EFFECTS__ */
11172
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11400
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11173
11401
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11174
- };
11402
+ });
11175
11403
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11176
11404
  };
11177
- class VueElement extends BaseClass {
11178
- constructor(_def, _props = {}, _createApp = createApp) {
11405
+ class VueElementBase extends BaseClass {
11406
+ constructor(def, props = {}, createAppFn) {
11179
11407
  super();
11180
- this._def = _def;
11181
- this._props = _props;
11182
- this._createApp = _createApp;
11183
11408
  this._isVueCE = true;
11184
11409
  /**
11185
11410
  * @internal
@@ -11189,20 +11414,26 @@ class VueElement extends BaseClass {
11189
11414
  * @internal
11190
11415
  */
11191
11416
  this._app = null;
11192
- /**
11193
- * @internal
11194
- */
11195
- this._nonce = this._def.nonce;
11196
11417
  this._connected = false;
11197
11418
  this._resolved = false;
11198
11419
  this._numberProps = null;
11199
11420
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11421
+ this._patching = false;
11422
+ this._dirty = false;
11200
11423
  this._ob = null;
11201
- if (this.shadowRoot && _createApp !== createApp) {
11424
+ this._def = def;
11425
+ this._props = props;
11426
+ this._createApp = createAppFn;
11427
+ this._nonce = def.nonce;
11428
+ if (this._needsHydration()) {
11202
11429
  this._root = this.shadowRoot;
11203
11430
  } else {
11204
- if (_def.shadowRoot !== false) {
11205
- this.attachShadow({ mode: "open" });
11431
+ if (def.shadowRoot !== false) {
11432
+ this.attachShadow(
11433
+ extend({}, def.shadowRootOptions, {
11434
+ mode: "open"
11435
+ })
11436
+ );
11206
11437
  this._root = this.shadowRoot;
11207
11438
  } else {
11208
11439
  this._root = this;
@@ -11217,14 +11448,14 @@ class VueElement extends BaseClass {
11217
11448
  this._connected = true;
11218
11449
  let parent = this;
11219
11450
  while (parent = parent && (parent.parentNode || parent.host)) {
11220
- if (parent instanceof VueElement) {
11451
+ if (parent instanceof VueElementBase) {
11221
11452
  this._parent = parent;
11222
11453
  break;
11223
11454
  }
11224
11455
  }
11225
11456
  if (!this._instance) {
11226
11457
  if (this._resolved) {
11227
- this._mount(this._def);
11458
+ this._mountComponent(this._def);
11228
11459
  } else {
11229
11460
  if (parent && parent._pendingResolve) {
11230
11461
  this._pendingResolve = parent._pendingResolve.then(() => {
@@ -11237,8 +11468,24 @@ class VueElement extends BaseClass {
11237
11468
  }
11238
11469
  }
11239
11470
  }
11471
+ disconnectedCallback() {
11472
+ this._connected = false;
11473
+ nextTick(() => {
11474
+ if (!this._connected) {
11475
+ if (this._ob) {
11476
+ this._ob.disconnect();
11477
+ this._ob = null;
11478
+ }
11479
+ this._unmount();
11480
+ if (this._teleportTargets) {
11481
+ this._teleportTargets.clear();
11482
+ this._teleportTargets = void 0;
11483
+ }
11484
+ }
11485
+ });
11486
+ }
11240
11487
  _setParent(parent = this._parent) {
11241
- if (parent) {
11488
+ if (parent && this._instance) {
11242
11489
  this._instance.parent = parent._instance;
11243
11490
  this._inheritParentContext(parent);
11244
11491
  }
@@ -11251,19 +11498,10 @@ class VueElement extends BaseClass {
11251
11498
  );
11252
11499
  }
11253
11500
  }
11254
- disconnectedCallback() {
11255
- this._connected = false;
11256
- nextTick(() => {
11257
- if (!this._connected) {
11258
- if (this._ob) {
11259
- this._ob.disconnect();
11260
- this._ob = null;
11261
- }
11262
- this._app && this._app.unmount();
11263
- if (this._instance) this._instance.ce = void 0;
11264
- this._app = this._instance = null;
11265
- }
11266
- });
11501
+ _processMutations(mutations) {
11502
+ for (const m of mutations) {
11503
+ this._setAttr(m.attributeName);
11504
+ }
11267
11505
  }
11268
11506
  /**
11269
11507
  * resolve inner component definition (handle possible async component)
@@ -11275,13 +11513,9 @@ class VueElement extends BaseClass {
11275
11513
  for (let i = 0; i < this.attributes.length; i++) {
11276
11514
  this._setAttr(this.attributes[i].name);
11277
11515
  }
11278
- this._ob = new MutationObserver((mutations) => {
11279
- for (const m of mutations) {
11280
- this._setAttr(m.attributeName);
11281
- }
11282
- });
11516
+ this._ob = new MutationObserver(this._processMutations.bind(this));
11283
11517
  this._ob.observe(this, { attributes: true });
11284
- const resolve = (def, isAsync = false) => {
11518
+ const resolve = (def) => {
11285
11519
  this._resolved = true;
11286
11520
  this._pendingResolve = void 0;
11287
11521
  const { props, styles } = def;
@@ -11302,26 +11536,25 @@ class VueElement extends BaseClass {
11302
11536
  if (this.shadowRoot) {
11303
11537
  this._applyStyles(styles);
11304
11538
  }
11305
- this._mount(def);
11539
+ this._mountComponent(def);
11306
11540
  };
11307
11541
  const asyncDef = this._def.__asyncLoader;
11308
11542
  if (asyncDef) {
11543
+ const { configureApp } = this._def;
11309
11544
  this._pendingResolve = asyncDef().then((def) => {
11310
- def.configureApp = this._def.configureApp;
11311
- resolve(this._def = def, true);
11545
+ def.configureApp = configureApp;
11546
+ this._def = def;
11547
+ resolve(def);
11312
11548
  });
11313
11549
  } else {
11314
11550
  resolve(this._def);
11315
11551
  }
11316
11552
  }
11317
- _mount(def) {
11318
- this._app = this._createApp(def);
11319
- this._inheritParentContext();
11320
- if (def.configureApp) {
11321
- def.configureApp(this._app);
11322
- }
11323
- this._app._ceVNode = this._createVNode();
11324
- this._app.mount(this._root);
11553
+ _mountComponent(def) {
11554
+ this._mount(def);
11555
+ this._processExposed();
11556
+ }
11557
+ _processExposed() {
11325
11558
  const exposed = this._instance && this._instance.exposed;
11326
11559
  if (!exposed) return;
11327
11560
  for (const key in exposed) {
@@ -11333,6 +11566,25 @@ class VueElement extends BaseClass {
11333
11566
  }
11334
11567
  }
11335
11568
  }
11569
+ _processInstance() {
11570
+ this._instance.ce = this;
11571
+ this._instance.isCE = true;
11572
+ const dispatch = (event, args) => {
11573
+ this.dispatchEvent(
11574
+ new CustomEvent(
11575
+ event,
11576
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
11577
+ )
11578
+ );
11579
+ };
11580
+ this._instance.emit = (event, ...args) => {
11581
+ dispatch(event, args);
11582
+ if (hyphenate(event) !== event) {
11583
+ dispatch(hyphenate(event), args);
11584
+ }
11585
+ };
11586
+ this._setParent();
11587
+ }
11336
11588
  _resolveProps(def) {
11337
11589
  const { props } = def;
11338
11590
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
@@ -11347,7 +11599,7 @@ class VueElement extends BaseClass {
11347
11599
  return this._getProp(key);
11348
11600
  },
11349
11601
  set(val) {
11350
- this._setProp(key, val, true, true);
11602
+ this._setProp(key, val, true, !this._patching);
11351
11603
  }
11352
11604
  });
11353
11605
  }
@@ -11373,11 +11625,12 @@ class VueElement extends BaseClass {
11373
11625
  */
11374
11626
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
11375
11627
  if (val !== this._props[key]) {
11628
+ this._dirty = true;
11376
11629
  if (val === REMOVAL) {
11377
11630
  delete this._props[key];
11378
11631
  } else {
11379
11632
  this._props[key] = val;
11380
- if (key === "key" && this._app) {
11633
+ if (key === "key" && this._app && this._app._ceVNode) {
11381
11634
  this._app._ceVNode.key = val;
11382
11635
  }
11383
11636
  }
@@ -11386,7 +11639,10 @@ class VueElement extends BaseClass {
11386
11639
  }
11387
11640
  if (shouldReflect) {
11388
11641
  const ob = this._ob;
11389
- ob && ob.disconnect();
11642
+ if (ob) {
11643
+ this._processMutations(ob.takeRecords());
11644
+ ob.disconnect();
11645
+ }
11390
11646
  if (val === true) {
11391
11647
  this.setAttribute(hyphenate(key), "");
11392
11648
  } else if (typeof val === "string" || typeof val === "number") {
@@ -11398,41 +11654,6 @@ class VueElement extends BaseClass {
11398
11654
  }
11399
11655
  }
11400
11656
  }
11401
- _update() {
11402
- const vnode = this._createVNode();
11403
- if (this._app) vnode.appContext = this._app._context;
11404
- render(vnode, this._root);
11405
- }
11406
- _createVNode() {
11407
- const baseProps = {};
11408
- if (!this.shadowRoot) {
11409
- baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
11410
- }
11411
- const vnode = createVNode(this._def, extend(baseProps, this._props));
11412
- if (!this._instance) {
11413
- vnode.ce = (instance) => {
11414
- this._instance = instance;
11415
- instance.ce = this;
11416
- instance.isCE = true;
11417
- const dispatch = (event, args) => {
11418
- this.dispatchEvent(
11419
- new CustomEvent(
11420
- event,
11421
- isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
11422
- )
11423
- );
11424
- };
11425
- instance.emit = (event, ...args) => {
11426
- dispatch(event, args);
11427
- if (hyphenate(event) !== event) {
11428
- dispatch(hyphenate(event), args);
11429
- }
11430
- };
11431
- this._setParent();
11432
- };
11433
- }
11434
- return vnode;
11435
- }
11436
11657
  _applyStyles(styles, owner) {
11437
11658
  if (!styles) return;
11438
11659
  if (owner) {
@@ -11465,13 +11686,15 @@ class VueElement extends BaseClass {
11465
11686
  * Only called when shadowRoot is false
11466
11687
  */
11467
11688
  _renderSlots() {
11468
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
11689
+ const outlets = this._getSlots();
11469
11690
  const scopeId = this._instance.type.__scopeId;
11691
+ const slotReplacements = /* @__PURE__ */ new Map();
11470
11692
  for (let i = 0; i < outlets.length; i++) {
11471
11693
  const o = outlets[i];
11472
11694
  const slotName = o.getAttribute("name") || "default";
11473
11695
  const content = this._slots[slotName];
11474
11696
  const parent = o.parentNode;
11697
+ const replacementNodes = [];
11475
11698
  if (content) {
11476
11699
  for (const n of content) {
11477
11700
  if (scopeId && n.nodeType === 1) {
@@ -11484,28 +11707,122 @@ class VueElement extends BaseClass {
11484
11707
  }
11485
11708
  }
11486
11709
  parent.insertBefore(n, o);
11710
+ replacementNodes.push(n);
11487
11711
  }
11488
11712
  } else {
11489
- while (o.firstChild) parent.insertBefore(o.firstChild, o);
11713
+ while (o.firstChild) {
11714
+ const child = o.firstChild;
11715
+ parent.insertBefore(child, o);
11716
+ replacementNodes.push(child);
11717
+ }
11490
11718
  }
11491
11719
  parent.removeChild(o);
11720
+ slotReplacements.set(o, replacementNodes);
11721
+ }
11722
+ this._updateSlotNodes(slotReplacements);
11723
+ }
11724
+ /**
11725
+ * @internal
11726
+ */
11727
+ _getSlots() {
11728
+ const roots = [this];
11729
+ if (this._teleportTargets) {
11730
+ roots.push(...this._teleportTargets);
11731
+ }
11732
+ const slots = /* @__PURE__ */ new Set();
11733
+ for (const root of roots) {
11734
+ const found = root.querySelectorAll("slot");
11735
+ for (let i = 0; i < found.length; i++) {
11736
+ slots.add(found[i]);
11737
+ }
11738
+ }
11739
+ return Array.from(slots);
11740
+ }
11741
+ /**
11742
+ * @internal
11743
+ */
11744
+ _injectChildStyle(comp) {
11745
+ this._applyStyles(comp.styles, comp);
11746
+ }
11747
+ /**
11748
+ * @internal
11749
+ */
11750
+ _beginPatch() {
11751
+ this._patching = true;
11752
+ this._dirty = false;
11753
+ }
11754
+ /**
11755
+ * @internal
11756
+ */
11757
+ _endPatch() {
11758
+ this._patching = false;
11759
+ if (this._dirty && this._instance) {
11760
+ this._update();
11761
+ }
11762
+ }
11763
+ /**
11764
+ * @internal
11765
+ */
11766
+ _removeChildStyle(comp) {
11767
+ }
11768
+ }
11769
+ class VueElement extends VueElementBase {
11770
+ constructor(def, props = {}, createAppFn = createApp) {
11771
+ super(def, props, createAppFn);
11772
+ }
11773
+ _needsHydration() {
11774
+ if (this.shadowRoot && this._createApp !== createApp) {
11775
+ return true;
11776
+ }
11777
+ return false;
11778
+ }
11779
+ _mount(def) {
11780
+ this._app = this._createApp(def);
11781
+ this._inheritParentContext();
11782
+ if (def.configureApp) {
11783
+ def.configureApp(this._app);
11784
+ }
11785
+ this._app._ceVNode = this._createVNode();
11786
+ this._app.mount(this._root);
11787
+ }
11788
+ _update() {
11789
+ if (!this._app) return;
11790
+ const vnode = this._createVNode();
11791
+ vnode.appContext = this._app._context;
11792
+ render(vnode, this._root);
11793
+ }
11794
+ _unmount() {
11795
+ if (this._app) {
11796
+ this._app.unmount();
11797
+ }
11798
+ if (this._instance && this._instance.ce) {
11799
+ this._instance.ce = void 0;
11492
11800
  }
11801
+ this._app = this._instance = null;
11493
11802
  }
11494
11803
  /**
11495
- * @internal
11804
+ * Only called when shadowRoot is false
11496
11805
  */
11497
- _injectChildStyle(comp) {
11498
- this._applyStyles(comp.styles, comp);
11806
+ _updateSlotNodes(replacements) {
11499
11807
  }
11500
- /**
11501
- * @internal
11502
- */
11503
- _removeChildStyle(comp) {
11808
+ _createVNode() {
11809
+ const baseProps = {};
11810
+ if (!this.shadowRoot) {
11811
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
11812
+ }
11813
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
11814
+ if (!this._instance) {
11815
+ vnode.ce = (instance) => {
11816
+ this._instance = instance;
11817
+ this._processInstance();
11818
+ };
11819
+ }
11820
+ return vnode;
11504
11821
  }
11505
11822
  }
11506
11823
  function useHost(caller) {
11507
- const instance = getCurrentInstance();
11508
- const el = instance && instance.ce;
11824
+ const { hasInstance, value } = useInstanceOption("ce", true);
11825
+ const el = value;
11509
11826
  if (el) {
11510
11827
  return el;
11511
11828
  }
@@ -11518,11 +11835,11 @@ function useShadowRoot() {
11518
11835
 
11519
11836
  function useCssModule(name = "$style") {
11520
11837
  {
11521
- const instance = getCurrentInstance();
11522
- if (!instance) {
11838
+ const { hasInstance, value: type } = useInstanceOption("type", true);
11839
+ if (!hasInstance) {
11523
11840
  return EMPTY_OBJ;
11524
11841
  }
11525
- const modules = instance.type.__cssModules;
11842
+ const modules = type.__cssModules;
11526
11843
  if (!modules) {
11527
11844
  return EMPTY_OBJ;
11528
11845
  }
@@ -11569,26 +11886,13 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11569
11886
  prevChildren = [];
11570
11887
  return;
11571
11888
  }
11572
- prevChildren.forEach(callPendingCbs);
11889
+ prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
11573
11890
  prevChildren.forEach(recordPosition);
11574
11891
  const movedChildren = prevChildren.filter(applyTranslation);
11575
- forceReflow();
11892
+ forceReflow(instance.vnode.el);
11576
11893
  movedChildren.forEach((c) => {
11577
11894
  const el = c.el;
11578
- const style = el.style;
11579
- addTransitionClass(el, moveClass);
11580
- style.transform = style.webkitTransform = style.transitionDuration = "";
11581
- const cb = el[moveCbKey] = (e) => {
11582
- if (e && e.target !== el) {
11583
- return;
11584
- }
11585
- if (!e || /transform$/.test(e.propertyName)) {
11586
- el.removeEventListener("transitionend", cb);
11587
- el[moveCbKey] = null;
11588
- removeTransitionClass(el, moveClass);
11589
- }
11590
- };
11591
- el.addEventListener("transitionend", cb);
11895
+ handleMovedChildren(el, moveClass);
11592
11896
  });
11593
11897
  prevChildren = [];
11594
11898
  });
@@ -11617,10 +11921,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11617
11921
  instance
11618
11922
  )
11619
11923
  );
11620
- positionMap.set(
11621
- child,
11622
- child.el.getBoundingClientRect()
11623
- );
11924
+ positionMap.set(child, {
11925
+ left: child.el.offsetLeft,
11926
+ top: child.el.offsetTop
11927
+ });
11624
11928
  }
11625
11929
  }
11626
11930
  }
@@ -11639,8 +11943,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11639
11943
  }
11640
11944
  });
11641
11945
  const TransitionGroup = TransitionGroupImpl;
11642
- function callPendingCbs(c) {
11643
- const el = c.el;
11946
+ function callPendingCbs(el) {
11644
11947
  if (el[moveCbKey]) {
11645
11948
  el[moveCbKey]();
11646
11949
  }
@@ -11649,19 +11952,30 @@ function callPendingCbs(c) {
11649
11952
  }
11650
11953
  }
11651
11954
  function recordPosition(c) {
11652
- newPositionMap.set(c, c.el.getBoundingClientRect());
11955
+ newPositionMap.set(c, {
11956
+ left: c.el.offsetLeft,
11957
+ top: c.el.offsetTop
11958
+ });
11653
11959
  }
11654
11960
  function applyTranslation(c) {
11655
- const oldPos = positionMap.get(c);
11656
- const newPos = newPositionMap.get(c);
11961
+ if (baseApplyTranslation(
11962
+ positionMap.get(c),
11963
+ newPositionMap.get(c),
11964
+ c.el
11965
+ )) {
11966
+ return c;
11967
+ }
11968
+ }
11969
+ function baseApplyTranslation(oldPos, newPos, el) {
11657
11970
  const dx = oldPos.left - newPos.left;
11658
11971
  const dy = oldPos.top - newPos.top;
11659
11972
  if (dx || dy) {
11660
- const s = c.el.style;
11973
+ const s = el.style;
11661
11974
  s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
11662
11975
  s.transitionDuration = "0s";
11663
- return c;
11976
+ return true;
11664
11977
  }
11978
+ return false;
11665
11979
  }
11666
11980
  function hasCSSTransform(el, root, moveClass) {
11667
11981
  const clone = el.cloneNode();
@@ -11679,6 +11993,22 @@ function hasCSSTransform(el, root, moveClass) {
11679
11993
  container.removeChild(clone);
11680
11994
  return hasTransform;
11681
11995
  }
11996
+ const handleMovedChildren = (el, moveClass) => {
11997
+ const style = el.style;
11998
+ addTransitionClass(el, moveClass);
11999
+ style.transform = style.webkitTransform = style.transitionDuration = "";
12000
+ const cb = el[moveCbKey] = (e) => {
12001
+ if (e && e.target !== el) {
12002
+ return;
12003
+ }
12004
+ if (!e || e.propertyName.endsWith("transform")) {
12005
+ el.removeEventListener("transitionend", cb);
12006
+ el[moveCbKey] = null;
12007
+ removeTransitionClass(el, moveClass);
12008
+ }
12009
+ };
12010
+ el.addEventListener("transitionend", cb);
12011
+ };
11682
12012
 
11683
12013
  const getModelAssigner = (vnode) => {
11684
12014
  const fn = vnode.props["onUpdate:modelValue"] || vnode.props["onModelCompat:input"];
@@ -11714,21 +12044,21 @@ const vModelText = {
11714
12044
  vModelTextUpdate(el, oldValue, value, trim, number, lazy);
11715
12045
  }
11716
12046
  };
12047
+ function castValue(value, trim, number) {
12048
+ if (trim) value = value.trim();
12049
+ if (number) value = looseToNumber(value);
12050
+ return value;
12051
+ }
11717
12052
  const vModelTextInit = (el, trim, number, lazy, set) => {
11718
12053
  addEventListener(el, lazy ? "change" : "input", (e) => {
11719
12054
  if (e.target.composing) return;
11720
- let domValue = el.value;
11721
- if (trim) {
11722
- domValue = domValue.trim();
11723
- }
11724
- if (number || el.type === "number") {
11725
- domValue = looseToNumber(domValue);
11726
- }
11727
- (0, el[assignKey])(domValue);
12055
+ (0, el[assignKey])(
12056
+ castValue(el.value, trim, number || el.type === "number")
12057
+ );
11728
12058
  });
11729
- if (trim) {
12059
+ if (trim || number) {
11730
12060
  addEventListener(el, "change", () => {
11731
- el.value = el.value.trim();
12061
+ el.value = castValue(el.value, trim, number || el.type === "number");
11732
12062
  });
11733
12063
  }
11734
12064
  if (!lazy) {
@@ -12008,13 +12338,13 @@ const modifierGuards = {
12008
12338
  const withModifiers = (fn, modifiers) => {
12009
12339
  const cache = fn._withMods || (fn._withMods = {});
12010
12340
  const cacheKey = modifiers.join(".");
12011
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12341
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
12012
12342
  for (let i = 0; i < modifiers.length; i++) {
12013
12343
  const guard = modifierGuards[modifiers[i]];
12014
12344
  if (guard && guard(event, modifiers)) return;
12015
12345
  }
12016
12346
  return fn(event, ...args);
12017
- });
12347
+ }));
12018
12348
  };
12019
12349
  const keyNames = {
12020
12350
  esc: "escape",
@@ -12038,7 +12368,7 @@ const withKeys = (fn, modifiers) => {
12038
12368
  }
12039
12369
  const cache = fn._withKeys || (fn._withKeys = {});
12040
12370
  const cacheKey = modifiers.join(".");
12041
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
12371
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
12042
12372
  if (!("key" in event)) {
12043
12373
  return;
12044
12374
  }
@@ -12068,7 +12398,7 @@ const withKeys = (fn, modifiers) => {
12068
12398
  }
12069
12399
  }
12070
12400
  }
12071
- });
12401
+ }));
12072
12402
  };
12073
12403
 
12074
12404
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12082,13 +12412,13 @@ function ensureHydrationRenderer() {
12082
12412
  enabledHydration = true;
12083
12413
  return renderer;
12084
12414
  }
12085
- const render = (...args) => {
12415
+ const render = ((...args) => {
12086
12416
  ensureRenderer().render(...args);
12087
- };
12088
- const hydrate = (...args) => {
12417
+ });
12418
+ const hydrate = ((...args) => {
12089
12419
  ensureHydrationRenderer().hydrate(...args);
12090
- };
12091
- const createApp = (...args) => {
12420
+ });
12421
+ const createApp = ((...args) => {
12092
12422
  const app = ensureRenderer().createApp(...args);
12093
12423
  const { mount } = app;
12094
12424
  app.mount = (containerOrSelector) => {
@@ -12109,8 +12439,8 @@ const createApp = (...args) => {
12109
12439
  return proxy;
12110
12440
  };
12111
12441
  return app;
12112
- };
12113
- const createSSRApp = (...args) => {
12442
+ });
12443
+ const createSSRApp = ((...args) => {
12114
12444
  const app = ensureHydrationRenderer().createApp(...args);
12115
12445
  const { mount } = app;
12116
12446
  app.mount = (containerOrSelector) => {
@@ -12120,7 +12450,7 @@ const createSSRApp = (...args) => {
12120
12450
  }
12121
12451
  };
12122
12452
  return app;
12123
- };
12453
+ });
12124
12454
  function resolveRootNamespace(container) {
12125
12455
  if (container instanceof SVGElement) {
12126
12456
  return "svg";
@@ -12166,6 +12496,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12166
12496
  TransitionGroup: TransitionGroup,
12167
12497
  TriggerOpTypes: TriggerOpTypes,
12168
12498
  VueElement: VueElement,
12499
+ VueElementBase: VueElementBase,
12169
12500
  assertNumber: assertNumber,
12170
12501
  callWithAsyncErrorHandling: callWithAsyncErrorHandling,
12171
12502
  callWithErrorHandling: callWithErrorHandling,
@@ -12230,6 +12561,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12230
12561
  mergeModels: mergeModels,
12231
12562
  mergeProps: mergeProps,
12232
12563
  nextTick: nextTick,
12564
+ nodeOps: nodeOps,
12233
12565
  normalizeClass: normalizeClass,
12234
12566
  normalizeProps: normalizeProps,
12235
12567
  normalizeStyle: normalizeStyle,
@@ -12248,6 +12580,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12248
12580
  onUpdated: onUpdated,
12249
12581
  onWatcherCleanup: onWatcherCleanup,
12250
12582
  openBlock: openBlock,
12583
+ patchProp: patchProp,
12251
12584
  popScopeId: popScopeId,
12252
12585
  provide: provide,
12253
12586
  proxyRefs: proxyRefs,
@@ -12289,6 +12622,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
12289
12622
  useCssVars: useCssVars,
12290
12623
  useHost: useHost,
12291
12624
  useId: useId,
12625
+ useInstanceOption: useInstanceOption,
12292
12626
  useModel: useModel,
12293
12627
  useSSRContext: useSSRContext,
12294
12628
  useShadowRoot: useShadowRoot,
@@ -13596,16 +13930,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
13596
13930
  (id) => markScopeIdentifier(node, id, knownIds)
13597
13931
  );
13598
13932
  }
13933
+ } else if (node.type === "SwitchStatement") {
13934
+ if (node.scopeIds) {
13935
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
13936
+ } else {
13937
+ walkSwitchStatement(
13938
+ node,
13939
+ false,
13940
+ (id) => markScopeIdentifier(node, id, knownIds)
13941
+ );
13942
+ }
13599
13943
  } else if (node.type === "CatchClause" && node.param) {
13600
- for (const id of extractIdentifiers(node.param)) {
13601
- markScopeIdentifier(node, id, knownIds);
13944
+ if (node.scopeIds) {
13945
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
13946
+ } else {
13947
+ for (const id of extractIdentifiers(node.param)) {
13948
+ markScopeIdentifier(node, id, knownIds);
13949
+ }
13602
13950
  }
13603
13951
  } else if (isForStatement(node)) {
13604
- walkForStatement(
13605
- node,
13606
- false,
13607
- (id) => markScopeIdentifier(node, id, knownIds)
13608
- );
13952
+ if (node.scopeIds) {
13953
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
13954
+ } else {
13955
+ walkForStatement(
13956
+ node,
13957
+ false,
13958
+ (id) => markScopeIdentifier(node, id, knownIds)
13959
+ );
13960
+ }
13609
13961
  }
13610
13962
  },
13611
13963
  leave(node, parent) {
@@ -13628,14 +13980,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
13628
13980
  if (id.name === "arguments") {
13629
13981
  return false;
13630
13982
  }
13631
- if (isReferenced(id, parent)) {
13983
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
13632
13984
  return true;
13633
13985
  }
13634
13986
  switch (parent.type) {
13635
13987
  case "AssignmentExpression":
13636
13988
  case "AssignmentPattern":
13637
13989
  return true;
13638
- case "ObjectPattern":
13990
+ case "ObjectProperty":
13991
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
13639
13992
  case "ArrayPattern":
13640
13993
  return isInDestructureAssignment(parent, parentStack);
13641
13994
  }
@@ -13675,7 +14028,8 @@ function walkFunctionParams(node, onIdent) {
13675
14028
  }
13676
14029
  }
13677
14030
  function walkBlockDeclarations(block, onIdent) {
13678
- for (const stmt of block.body) {
14031
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
14032
+ for (const stmt of body) {
13679
14033
  if (stmt.type === "VariableDeclaration") {
13680
14034
  if (stmt.declare) continue;
13681
14035
  for (const decl of stmt.declarations) {
@@ -13688,6 +14042,8 @@ function walkBlockDeclarations(block, onIdent) {
13688
14042
  onIdent(stmt.id);
13689
14043
  } else if (isForStatement(stmt)) {
13690
14044
  walkForStatement(stmt, true, onIdent);
14045
+ } else if (stmt.type === "SwitchStatement") {
14046
+ walkSwitchStatement(stmt, true, onIdent);
13691
14047
  }
13692
14048
  }
13693
14049
  }
@@ -13704,6 +14060,20 @@ function walkForStatement(stmt, isVar, onIdent) {
13704
14060
  }
13705
14061
  }
13706
14062
  }
14063
+ function walkSwitchStatement(stmt, isVar, onIdent) {
14064
+ for (const cs of stmt.cases) {
14065
+ for (const stmt2 of cs.consequent) {
14066
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
14067
+ for (const decl of stmt2.declarations) {
14068
+ for (const id of extractIdentifiers(decl.id)) {
14069
+ onIdent(id);
14070
+ }
14071
+ }
14072
+ }
14073
+ }
14074
+ walkBlockDeclarations(cs, onIdent);
14075
+ }
14076
+ }
13707
14077
  function extractIdentifiers(param, nodes = []) {
13708
14078
  switch (param.type) {
13709
14079
  case "Identifier":
@@ -13804,7 +14174,7 @@ function isReferenced(node, parent, grandparent) {
13804
14174
  if (parent.key === node) {
13805
14175
  return !!parent.computed;
13806
14176
  }
13807
- return true;
14177
+ return !grandparent || grandparent.type !== "ObjectPattern";
13808
14178
  // no: class { NODE = value; }
13809
14179
  // yes: class { [NODE] = value; }
13810
14180
  // yes: class { key = NODE; }
@@ -13854,6 +14224,9 @@ function isReferenced(node, parent, grandparent) {
13854
14224
  // yes: export { NODE as foo };
13855
14225
  // no: export { NODE as foo } from "foo";
13856
14226
  case "ExportSpecifier":
14227
+ if (grandparent == null ? void 0 : grandparent.source) {
14228
+ return false;
14229
+ }
13857
14230
  return parent.local === node;
13858
14231
  // no: import NODE from "foo";
13859
14232
  // no: import * as NODE from "foo";
@@ -13934,8 +14307,9 @@ function isCoreComponent(tag) {
13934
14307
  return BASE_TRANSITION;
13935
14308
  }
13936
14309
  }
13937
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
14310
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
13938
14311
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
14312
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
13939
14313
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
13940
14314
  const isMemberExpressionNode = (exp, context) => {
13941
14315
  try {
@@ -14027,6 +14401,9 @@ function hasDynamicKeyVBind(node) {
14027
14401
  function isText$1(node) {
14028
14402
  return node.type === 5 || node.type === 2;
14029
14403
  }
14404
+ function isVPre(p) {
14405
+ return p.type === 7 && p.name === "pre";
14406
+ }
14030
14407
  function isVSlot(p) {
14031
14408
  return p.type === 7 && p.name === "slot";
14032
14409
  }
@@ -14325,7 +14702,7 @@ const tokenizer = new Tokenizer(stack, {
14325
14702
  ondirarg(start, end) {
14326
14703
  if (start === end) return;
14327
14704
  const arg = getSlice(start, end);
14328
- if (inVPre) {
14705
+ if (inVPre && !isVPre(currentProp)) {
14329
14706
  currentProp.name += arg;
14330
14707
  setLocEnd(currentProp.nameLoc, end);
14331
14708
  } else {
@@ -14340,7 +14717,7 @@ const tokenizer = new Tokenizer(stack, {
14340
14717
  },
14341
14718
  ondirmodifier(start, end) {
14342
14719
  const mod = getSlice(start, end);
14343
- if (inVPre) {
14720
+ if (inVPre && !isVPre(currentProp)) {
14344
14721
  currentProp.name += "." + mod;
14345
14722
  setLocEnd(currentProp.nameLoc, end);
14346
14723
  } else if (currentProp.name === "slot") {
@@ -14950,6 +15327,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14950
15327
  } else if (child.type === 12) {
14951
15328
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
14952
15329
  if (constantType >= 2) {
15330
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
15331
+ child.codegenNode.arguments.push(
15332
+ -1 + (``)
15333
+ );
15334
+ }
14953
15335
  toCache.push(child);
14954
15336
  continue;
14955
15337
  }
@@ -14978,7 +15360,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14978
15360
  }
14979
15361
  }
14980
15362
  let cachedAsArray = false;
14981
- const slotCacheKeys = [];
14982
15363
  if (toCache.length === children.length && node.type === 1) {
14983
15364
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14984
15365
  node.codegenNode.children = getCacheExpression(
@@ -14988,7 +15369,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14988
15369
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14989
15370
  const slot = getSlotNode(node.codegenNode, "default");
14990
15371
  if (slot) {
14991
- slotCacheKeys.push(context.cached.length);
14992
15372
  slot.returns = getCacheExpression(
14993
15373
  createArrayExpression(slot.returns)
14994
15374
  );
@@ -14998,7 +15378,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14998
15378
  const slotName = findDir(node, "slot", true);
14999
15379
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
15000
15380
  if (slot) {
15001
- slotCacheKeys.push(context.cached.length);
15002
15381
  slot.returns = getCacheExpression(
15003
15382
  createArrayExpression(slot.returns)
15004
15383
  );
@@ -15008,23 +15387,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
15008
15387
  }
15009
15388
  if (!cachedAsArray) {
15010
15389
  for (const child of toCache) {
15011
- slotCacheKeys.push(context.cached.length);
15012
15390
  child.codegenNode = context.cache(child.codegenNode);
15013
15391
  }
15014
15392
  }
15015
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
15016
- node.codegenNode.children.properties.push(
15017
- createObjectProperty(
15018
- `__`,
15019
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
15020
- )
15021
- );
15022
- }
15023
15393
  function getCacheExpression(value) {
15024
15394
  const exp = context.cache(value);
15025
- if (inFor && context.hmr) {
15026
- exp.needArraySpread = true;
15027
- }
15395
+ exp.needArraySpread = true;
15028
15396
  return exp;
15029
15397
  }
15030
15398
  function getSlotNode(node2, name) {
@@ -16504,7 +16872,7 @@ function isConst(type) {
16504
16872
  }
16505
16873
 
16506
16874
  const transformIf = createStructuralDirectiveTransform(
16507
- /^(if|else|else-if)$/,
16875
+ /^(?:if|else|else-if)$/,
16508
16876
  (node, dir, context) => {
16509
16877
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
16510
16878
  const siblings = context.parent.children;
@@ -16571,7 +16939,7 @@ function processIf(node, dir, context, processCodegen) {
16571
16939
  continue;
16572
16940
  }
16573
16941
  if (sibling && sibling.type === 9) {
16574
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16942
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16575
16943
  context.onError(
16576
16944
  createCompilerError(30, node.loc)
16577
16945
  );
@@ -16713,90 +17081,6 @@ function getParentCondition(node) {
16713
17081
  }
16714
17082
  }
16715
17083
 
16716
- const transformBind = (dir, _node, context) => {
16717
- const { modifiers, loc } = dir;
16718
- const arg = dir.arg;
16719
- let { exp } = dir;
16720
- if (exp && exp.type === 4 && !exp.content.trim()) {
16721
- {
16722
- context.onError(
16723
- createCompilerError(34, loc)
16724
- );
16725
- return {
16726
- props: [
16727
- createObjectProperty(arg, createSimpleExpression("", true, loc))
16728
- ]
16729
- };
16730
- }
16731
- }
16732
- if (!exp) {
16733
- if (arg.type !== 4 || !arg.isStatic) {
16734
- context.onError(
16735
- createCompilerError(
16736
- 52,
16737
- arg.loc
16738
- )
16739
- );
16740
- return {
16741
- props: [
16742
- createObjectProperty(arg, createSimpleExpression("", true, loc))
16743
- ]
16744
- };
16745
- }
16746
- transformBindShorthand(dir, context);
16747
- exp = dir.exp;
16748
- }
16749
- if (arg.type !== 4) {
16750
- arg.children.unshift(`(`);
16751
- arg.children.push(`) || ""`);
16752
- } else if (!arg.isStatic) {
16753
- arg.content = `${arg.content} || ""`;
16754
- }
16755
- if (modifiers.some((mod) => mod.content === "camel")) {
16756
- if (arg.type === 4) {
16757
- if (arg.isStatic) {
16758
- arg.content = camelize(arg.content);
16759
- } else {
16760
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
16761
- }
16762
- } else {
16763
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
16764
- arg.children.push(`)`);
16765
- }
16766
- }
16767
- if (!context.inSSR) {
16768
- if (modifiers.some((mod) => mod.content === "prop")) {
16769
- injectPrefix(arg, ".");
16770
- }
16771
- if (modifiers.some((mod) => mod.content === "attr")) {
16772
- injectPrefix(arg, "^");
16773
- }
16774
- }
16775
- return {
16776
- props: [createObjectProperty(arg, exp)]
16777
- };
16778
- };
16779
- const transformBindShorthand = (dir, context) => {
16780
- const arg = dir.arg;
16781
- const propName = camelize(arg.content);
16782
- dir.exp = createSimpleExpression(propName, false, arg.loc);
16783
- {
16784
- dir.exp = processExpression(dir.exp, context);
16785
- }
16786
- };
16787
- const injectPrefix = (arg, prefix) => {
16788
- if (arg.type === 4) {
16789
- if (arg.isStatic) {
16790
- arg.content = prefix + arg.content;
16791
- } else {
16792
- arg.content = `\`${prefix}\${${arg.content}}\``;
16793
- }
16794
- } else {
16795
- arg.children.unshift(`'${prefix}' + (`);
16796
- arg.children.push(`)`);
16797
- }
16798
- };
16799
-
16800
17084
  const transformFor = createStructuralDirectiveTransform(
16801
17085
  "for",
16802
17086
  (node, dir, context) => {
@@ -16809,9 +17093,6 @@ const transformFor = createStructuralDirectiveTransform(
16809
17093
  const memo = findDir(node, "memo");
16810
17094
  const keyProp = findProp(node, `key`, false, true);
16811
17095
  const isDirKey = keyProp && keyProp.type === 7;
16812
- if (isDirKey && !keyProp.exp) {
16813
- transformBindShorthand(keyProp, context);
16814
- }
16815
17096
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16816
17097
  if (memo && keyExp && isDirKey) {
16817
17098
  {
@@ -17092,7 +17373,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17092
17373
  const dynamicSlots = [];
17093
17374
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
17094
17375
  if (!context.ssr && context.prefixIdentifiers) {
17095
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
17376
+ hasDynamicSlots = node.props.some(
17377
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
17378
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
17096
17379
  }
17097
17380
  const onComponentSlot = findDir(node, "slot", true);
17098
17381
  if (onComponentSlot) {
@@ -17155,7 +17438,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17155
17438
  );
17156
17439
  } else if (vElse = findDir(
17157
17440
  slotElement,
17158
- /^else(-if)?$/,
17441
+ /^else(?:-if)?$/,
17159
17442
  true
17160
17443
  /* allowEmpty */
17161
17444
  )) {
@@ -17167,7 +17450,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
17167
17450
  break;
17168
17451
  }
17169
17452
  }
17170
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17453
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
17171
17454
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17172
17455
  while (conditional.alternate.type === 19) {
17173
17456
  conditional = conditional.alternate;
@@ -18092,6 +18375,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
18092
18375
  return ret;
18093
18376
  };
18094
18377
 
18378
+ const transformBind = (dir, _node, context) => {
18379
+ const { modifiers, loc } = dir;
18380
+ const arg = dir.arg;
18381
+ let { exp } = dir;
18382
+ if (exp && exp.type === 4 && !exp.content.trim()) {
18383
+ {
18384
+ context.onError(
18385
+ createCompilerError(34, loc)
18386
+ );
18387
+ return {
18388
+ props: [
18389
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
18390
+ ]
18391
+ };
18392
+ }
18393
+ }
18394
+ if (arg.type !== 4) {
18395
+ arg.children.unshift(`(`);
18396
+ arg.children.push(`) || ""`);
18397
+ } else if (!arg.isStatic) {
18398
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
18399
+ }
18400
+ if (modifiers.some((mod) => mod.content === "camel")) {
18401
+ if (arg.type === 4) {
18402
+ if (arg.isStatic) {
18403
+ arg.content = camelize(arg.content);
18404
+ } else {
18405
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
18406
+ }
18407
+ } else {
18408
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
18409
+ arg.children.push(`)`);
18410
+ }
18411
+ }
18412
+ if (!context.inSSR) {
18413
+ if (modifiers.some((mod) => mod.content === "prop")) {
18414
+ injectPrefix(arg, ".");
18415
+ }
18416
+ if (modifiers.some((mod) => mod.content === "attr")) {
18417
+ injectPrefix(arg, "^");
18418
+ }
18419
+ }
18420
+ return {
18421
+ props: [createObjectProperty(arg, exp)]
18422
+ };
18423
+ };
18424
+ const injectPrefix = (arg, prefix) => {
18425
+ if (arg.type === 4) {
18426
+ if (arg.isStatic) {
18427
+ arg.content = prefix + arg.content;
18428
+ } else {
18429
+ arg.content = `\`${prefix}\${${arg.content}}\``;
18430
+ }
18431
+ } else {
18432
+ arg.children.unshift(`'${prefix}' + (`);
18433
+ arg.children.push(`)`);
18434
+ }
18435
+ };
18436
+
18095
18437
  const transformText = (node, context) => {
18096
18438
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
18097
18439
  return () => {
@@ -18253,7 +18595,7 @@ const transformModel$1 = (dir, node, context) => {
18253
18595
  }
18254
18596
  if (dir.modifiers.length && node.tagType === 1) {
18255
18597
  const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
18256
- const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
18598
+ const modifiersKey = arg ? isStaticExp(arg) ? getModifierPropName(arg.content) : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
18257
18599
  props.push(
18258
18600
  createObjectProperty(
18259
18601
  modifiersKey,
@@ -18420,7 +18762,7 @@ const seen = /* @__PURE__ */ new WeakSet();
18420
18762
  const transformMemo = (node, context) => {
18421
18763
  if (node.type === 1) {
18422
18764
  const dir = findDir(node, "memo");
18423
- if (!dir || seen.has(node)) {
18765
+ if (!dir || seen.has(node) || context.inSSR) {
18424
18766
  return;
18425
18767
  }
18426
18768
  seen.add(node);
@@ -18442,9 +18784,36 @@ const transformMemo = (node, context) => {
18442
18784
  }
18443
18785
  };
18444
18786
 
18787
+ const transformVBindShorthand = (node, context) => {
18788
+ if (node.type === 1) {
18789
+ for (const prop of node.props) {
18790
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
18791
+ false) && prop.arg) {
18792
+ const arg = prop.arg;
18793
+ if (arg.type !== 4 || !arg.isStatic) {
18794
+ context.onError(
18795
+ createCompilerError(
18796
+ 52,
18797
+ arg.loc
18798
+ )
18799
+ );
18800
+ prop.exp = createSimpleExpression("", true, arg.loc);
18801
+ } else {
18802
+ const propName = camelize(arg.content);
18803
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
18804
+ propName[0] === "-") {
18805
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
18806
+ }
18807
+ }
18808
+ }
18809
+ }
18810
+ }
18811
+ };
18812
+
18445
18813
  function getBaseTransformPreset(prefixIdentifiers) {
18446
18814
  return [
18447
18815
  [
18816
+ transformVBindShorthand,
18448
18817
  transformOnce,
18449
18818
  transformIf,
18450
18819
  transformMemo,
@@ -18563,7 +18932,7 @@ const parserOptions = {
18563
18932
  let ns = parent ? parent.ns : rootNamespace;
18564
18933
  if (parent && ns === 2) {
18565
18934
  if (parent.tag === "annotation-xml") {
18566
- if (tag === "svg") {
18935
+ if (isSVGTag(tag)) {
18567
18936
  return 1;
18568
18937
  }
18569
18938
  if (parent.props.some(
@@ -18580,10 +18949,10 @@ const parserOptions = {
18580
18949
  }
18581
18950
  }
18582
18951
  if (ns === 0) {
18583
- if (tag === "svg") {
18952
+ if (isSVGTag(tag)) {
18584
18953
  return 1;
18585
18954
  }
18586
- if (tag === "math") {
18955
+ if (isMathMLTag(tag)) {
18587
18956
  return 2;
18588
18957
  }
18589
18958
  }
@@ -18932,7 +19301,7 @@ const getCachedNode = (node) => {
18932
19301
  return node.codegenNode;
18933
19302
  }
18934
19303
  };
18935
- const dataAriaRE = /^(data|aria)-/;
19304
+ const dataAriaRE = /^(?:data|aria)-/;
18936
19305
  const isStringifiableAttr = (name, ns) => {
18937
19306
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
18938
19307
  };
@@ -18943,6 +19312,9 @@ function analyzeNode(node) {
18943
19312
  if (node.type === 1 && isNonStringifiable(node.tag)) {
18944
19313
  return false;
18945
19314
  }
19315
+ if (node.type === 1 && findDir(node, "once", true)) {
19316
+ return false;
19317
+ }
18946
19318
  if (node.type === 12) {
18947
19319
  return [1, 0];
18948
19320
  }