@vue/runtime-vapor 3.6.0-alpha.3 → 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,10 +1,10 @@
1
1
  /**
2
- * @vue/runtime-vapor v3.6.0-alpha.3
2
+ * @vue/runtime-vapor v3.6.0-alpha.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { isMismatchAllowed, warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, TransitionPropsValidators, leaveCbKey, isAsyncWrapper, getComponentName, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, isKeepAlive, isRef, unsafeToTrustedHTML, patchStyle, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, onMounted, onUpdated, onBeforeUnmount, resetShapeFlag, watch, matches, devtoolsComponentAdded, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, isVNode, Fragment, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, markAsyncBoundary, useAsyncComponentState, performAsyncHydrate, handleError, createCanSetSetupRefChecker, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
7
- import { invokeArrayFns, isArray, extend, EMPTY_OBJ, isFunction, NO, hasOwn, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, stringifyStyle, isReservedProp, EMPTY_ARR, camelize, YES, getGlobalThis, isObject, remove as remove$1, looseEqual } from '@vue/shared';
6
+ import { isMismatchAllowed, warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, TransitionPropsValidators, leaveCbKey, isAsyncWrapper, getComponentName, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, isKeepAlive, callWithAsyncErrorHandling, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, isRef, onMounted, onUpdated, onBeforeUnmount, resetShapeFlag, watch, matches, devtoolsComponentAdded, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, isVNode, Fragment, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, markAsyncBoundary, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation, createCanSetSetupRefChecker, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected } from '@vue/runtime-dom';
7
+ import { invokeArrayFns, isArray, extend, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, EMPTY_OBJ, isFunction, NO, hasOwn, isReservedProp, EMPTY_ARR, YES, getGlobalThis, isPlainObject, isObject, remove as remove$1, looseEqual } from '@vue/shared';
8
8
  import { ReactiveEffect, setActiveSub, EffectScope, onEffectCleanup, pauseTracking, resetTracking, onScopeDispose as onScopeDispose$1, markRaw, unref, proxyRefs, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
9
9
 
10
10
  let insertionParent;
@@ -357,6 +357,8 @@ class RenderEffect extends ReactiveEffect {
357
357
  if (!!(process.env.NODE_ENV !== "production")) {
358
358
  this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
359
359
  this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
360
+ }
361
+ if (!!(process.env.NODE_ENV !== "production") || instance.type.ce) {
360
362
  (instance.renderEffects || (instance.renderEffects = [])).push(this);
361
363
  }
362
364
  job.i = instance;
@@ -544,7 +546,7 @@ function applyTransitionHooks(block, hooks, fallthroughAttrs = true, isResolved
544
546
  if (isFrag) setTransitionHooksOnFragment(block, hooks);
545
547
  return hooks;
546
548
  }
547
- const { props, instance, state, delayedLeave } = hooks;
549
+ const { props, instance, state, delayedLeave, group } = hooks;
548
550
  let resolvedHooks = resolveTransitionHooks(
549
551
  child,
550
552
  props,
@@ -553,6 +555,7 @@ function applyTransitionHooks(block, hooks, fallthroughAttrs = true, isResolved
553
555
  (hooks2) => resolvedHooks = hooks2
554
556
  );
555
557
  resolvedHooks.delayedLeave = delayedLeave;
558
+ resolvedHooks.group = group;
556
559
  child.$transition = resolvedHooks;
557
560
  if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
558
561
  if (fallthroughAttrs && instance.hasFallthrough) {
@@ -642,6 +645,9 @@ function findTransitionBlock(block, inFragment = false) {
642
645
  function setTransitionHooksOnFragment(block, hooks) {
643
646
  if (isFragment(block)) {
644
647
  block.$transition = hooks;
648
+ if (block.nodes && isFragment(block.nodes)) {
649
+ setTransitionHooksOnFragment(block.nodes, hooks);
650
+ }
645
651
  } else if (isArray(block)) {
646
652
  for (let i = 0; i < block.length; i++) {
647
653
  setTransitionHooksOnFragment(block[i], hooks);
@@ -832,160 +838,6 @@ function isFragment(val) {
832
838
  return val instanceof VaporFragment;
833
839
  }
834
840
 
835
- let currentSlotScopeIds = null;
836
- function setCurrentSlotScopeIds(scopeIds) {
837
- const prev = currentSlotScopeIds;
838
- currentSlotScopeIds = scopeIds;
839
- return prev;
840
- }
841
- const dynamicSlotsProxyHandlers = {
842
- get: getSlot,
843
- has: (target, key) => !!getSlot(target, key),
844
- getOwnPropertyDescriptor(target, key) {
845
- const slot = getSlot(target, key);
846
- if (slot) {
847
- return {
848
- configurable: true,
849
- enumerable: true,
850
- value: slot
851
- };
852
- }
853
- },
854
- ownKeys(target) {
855
- let keys = Object.keys(target);
856
- const dynamicSources = target.$;
857
- if (dynamicSources) {
858
- keys = keys.filter((k) => k !== "$");
859
- for (const source of dynamicSources) {
860
- if (isFunction(source)) {
861
- const slot = source();
862
- if (isArray(slot)) {
863
- for (const s of slot) keys.push(String(s.name));
864
- } else {
865
- keys.push(String(slot.name));
866
- }
867
- } else {
868
- keys.push(...Object.keys(source));
869
- }
870
- }
871
- }
872
- return keys;
873
- },
874
- set: NO,
875
- deleteProperty: NO
876
- };
877
- function getSlot(target, key) {
878
- if (key === "$") return;
879
- const dynamicSources = target.$;
880
- if (dynamicSources) {
881
- let i = dynamicSources.length;
882
- let source;
883
- while (i--) {
884
- source = dynamicSources[i];
885
- if (isFunction(source)) {
886
- const slot = source();
887
- if (slot) {
888
- if (isArray(slot)) {
889
- for (const s of slot) {
890
- if (String(s.name) === key) return s.fn;
891
- }
892
- } else if (String(slot.name) === key) {
893
- return slot.fn;
894
- }
895
- }
896
- } else if (hasOwn(source, key)) {
897
- return source[key];
898
- }
899
- }
900
- }
901
- if (hasOwn(target, key)) {
902
- return target[key];
903
- }
904
- }
905
- function withVaporCtx(fn) {
906
- const instance = currentInstance;
907
- return (...args) => {
908
- const prev = setCurrentInstance(instance);
909
- try {
910
- return fn(...args);
911
- } finally {
912
- setCurrentInstance(...prev);
913
- }
914
- };
915
- }
916
- function createSlot(name, rawProps, fallback, noSlotted) {
917
- const _insertionParent = insertionParent;
918
- const _insertionAnchor = insertionAnchor;
919
- const _isLastInsertion = isLastInsertion;
920
- if (!isHydrating) resetInsertionState();
921
- const instance = currentInstance;
922
- const rawSlots = instance.rawSlots;
923
- const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
924
- let fragment;
925
- if (isRef(rawSlots._)) {
926
- if (isHydrating) locateHydrationNode();
927
- fragment = instance.appContext.vapor.vdomSlot(
928
- rawSlots._,
929
- name,
930
- slotProps,
931
- instance,
932
- fallback
933
- );
934
- } else {
935
- fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
936
- const isDynamicName = isFunction(name);
937
- const slotScopeIds = [];
938
- if (!noSlotted) {
939
- const scopeId = instance.type.__scopeId;
940
- if (scopeId) {
941
- slotScopeIds.push(`${scopeId}-s`);
942
- }
943
- }
944
- const renderSlot = () => {
945
- const slot = getSlot(rawSlots, isFunction(name) ? name() : name);
946
- if (slot) {
947
- fragment.fallback = fallback;
948
- fragment.update(
949
- slot._bound || (slot._bound = () => {
950
- const prevSlotScopeIds = setCurrentSlotScopeIds(
951
- slotScopeIds.length > 0 ? slotScopeIds : null
952
- );
953
- try {
954
- return slot(slotProps);
955
- } finally {
956
- setCurrentSlotScopeIds(prevSlotScopeIds);
957
- }
958
- })
959
- );
960
- } else {
961
- fragment.update(fallback);
962
- }
963
- };
964
- if (isDynamicName || rawSlots.$) {
965
- renderEffect(renderSlot);
966
- } else {
967
- renderSlot();
968
- }
969
- }
970
- if (!isHydrating) {
971
- if (!noSlotted) {
972
- const scopeId = instance.type.__scopeId;
973
- if (scopeId) {
974
- setScopeId(fragment, [`${scopeId}-s`]);
975
- }
976
- }
977
- if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
978
- } else {
979
- if (fragment.insert) {
980
- fragment.hydrate();
981
- }
982
- if (_isLastInsertion) {
983
- advanceHydrationNode(_insertionParent);
984
- }
985
- }
986
- return fragment;
987
- }
988
-
989
841
  function addEventListener(el, event, handler, options) {
990
842
  el.addEventListener(event, handler, options);
991
843
  return () => el.removeEventListener(event, handler, options);
@@ -1057,6 +909,15 @@ function setDynamicEvents(el, events) {
1057
909
  on(el, name, events[name], { effect: true });
1058
910
  }
1059
911
  }
912
+ function createInvoker(handler) {
913
+ const i = currentInstance;
914
+ return (...args) => callWithAsyncErrorHandling(
915
+ handler,
916
+ i,
917
+ 5,
918
+ args
919
+ );
920
+ }
1060
921
 
1061
922
  const hasFallthroughKey = (key) => currentInstance.hasFallthrough && key in currentInstance.attrs;
1062
923
  function setProp(el, key, value) {
@@ -1066,7 +927,7 @@ function setProp(el, key, value) {
1066
927
  setAttr(el, key, value);
1067
928
  }
1068
929
  }
1069
- function setAttr(el, key, value) {
930
+ function setAttr(el, key, value, isSVG = false) {
1070
931
  if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
1071
932
  return;
1072
933
  }
@@ -1081,14 +942,22 @@ function setAttr(el, key, value) {
1081
942
  }
1082
943
  if (value !== el[`$${key}`]) {
1083
944
  el[`$${key}`] = value;
1084
- if (value != null) {
1085
- el.setAttribute(key, value);
945
+ if (isSVG && key.startsWith("xlink:")) {
946
+ if (value != null) {
947
+ el.setAttributeNS(xlinkNS, key, value);
948
+ } else {
949
+ el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
950
+ }
1086
951
  } else {
1087
- el.removeAttribute(key);
952
+ if (value != null) {
953
+ el.setAttribute(key, value);
954
+ } else {
955
+ el.removeAttribute(key);
956
+ }
1088
957
  }
1089
958
  }
1090
959
  }
1091
- function setDOMProp(el, key, value, forceHydrate = false) {
960
+ function setDOMProp(el, key, value, forceHydrate = false, attrName) {
1092
961
  if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
1093
962
  return;
1094
963
  }
@@ -1122,9 +991,9 @@ function setDOMProp(el, key, value, forceHydrate = false) {
1122
991
  );
1123
992
  }
1124
993
  }
1125
- needRemove && el.removeAttribute(key);
994
+ needRemove && el.removeAttribute(attrName || key);
1126
995
  }
1127
- function setClass(el, value) {
996
+ function setClass(el, value, isSVG = false) {
1128
997
  if (el.$root) {
1129
998
  setClassIncremental(el, value);
1130
999
  } else {
@@ -1134,7 +1003,11 @@ function setClass(el, value) {
1134
1003
  return;
1135
1004
  }
1136
1005
  if (value !== el.$cls) {
1137
- el.className = el.$cls = value;
1006
+ if (isSVG) {
1007
+ el.setAttribute("class", el.$cls = value);
1008
+ } else {
1009
+ el.className = el.$cls = value;
1010
+ }
1138
1011
  }
1139
1012
  }
1140
1013
  }
@@ -1296,26 +1169,26 @@ function setHtmlToBlock(block, value) {
1296
1169
  setHtmlToBlock(block.nodes, value);
1297
1170
  }
1298
1171
  }
1299
- function setDynamicProps(el, args) {
1172
+ function setDynamicProps(el, args, root, isSVG) {
1300
1173
  const props = args.length > 1 ? mergeProps(...args) : args[0];
1301
1174
  const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
1302
1175
  const prevKeys = el[cacheKey];
1176
+ if (root) el.$root = root;
1303
1177
  if (prevKeys) {
1304
1178
  for (const key of prevKeys) {
1305
1179
  if (!(key in props)) {
1306
- setDynamicProp(el, key, null);
1180
+ setDynamicProp(el, key, null, isSVG);
1307
1181
  }
1308
1182
  }
1309
1183
  }
1310
1184
  for (const key of el[cacheKey] = Object.keys(props)) {
1311
- setDynamicProp(el, key, props[key]);
1185
+ setDynamicProp(el, key, props[key], isSVG);
1312
1186
  }
1313
1187
  }
1314
- function setDynamicProp(el, key, value) {
1315
- const isSVG = false;
1188
+ function setDynamicProp(el, key, value, isSVG = false) {
1316
1189
  let forceHydrate = false;
1317
1190
  if (key === "class") {
1318
- setClass(el, value);
1191
+ setClass(el, value, isSVG);
1319
1192
  } else if (key === "style") {
1320
1193
  setStyle(el, value);
1321
1194
  } else if (isOn(key)) {
@@ -1333,8 +1206,13 @@ function setDynamicProp(el, key, value) {
1333
1206
  } else {
1334
1207
  setDOMProp(el, key, value, forceHydrate);
1335
1208
  }
1209
+ } else if (
1210
+ // custom elements
1211
+ el._isVueCE && (/[A-Z]/.test(key) || !isString(value))
1212
+ ) {
1213
+ setDOMProp(el, camelize(key), value, forceHydrate, key);
1336
1214
  } else {
1337
- setAttr(el, key, value);
1215
+ setAttr(el, key, value, isSVG);
1338
1216
  }
1339
1217
  return value;
1340
1218
  }
@@ -1347,7 +1225,8 @@ function optimizePropertyLookup() {
1347
1225
  proto.$key = void 0;
1348
1226
  proto.$fc = proto.$evtclick = void 0;
1349
1227
  proto.$root = false;
1350
- proto.$html = proto.$txt = proto.$cls = proto.$sty = Text.prototype.$txt = "";
1228
+ proto.$html = proto.$cls = proto.$sty = "";
1229
+ Text.prototype.$txt = void 0;
1351
1230
  }
1352
1231
  function classHasMismatch(el, expected, isIncremental) {
1353
1232
  const actual = el.getAttribute("class");
@@ -1418,75 +1297,257 @@ function shouldForceHydrate(el, key) {
1418
1297
  tagName.includes("-");
1419
1298
  }
1420
1299
 
1421
- /*! #__NO_SIDE_EFFECTS__ */
1422
- // @__NO_SIDE_EFFECTS__
1423
- function defineVaporComponent(comp, extraOptions) {
1424
- if (isFunction(comp)) {
1425
- return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
1426
- setup: comp,
1427
- __vapor: true
1428
- }))();
1300
+ let currentSlotScopeIds = null;
1301
+ function setCurrentSlotScopeIds(scopeIds) {
1302
+ try {
1303
+ return currentSlotScopeIds;
1304
+ } finally {
1305
+ currentSlotScopeIds = scopeIds;
1429
1306
  }
1430
- comp.__vapor = true;
1431
- return comp;
1432
1307
  }
1433
-
1434
- const VaporKeepAliveImpl = defineVaporComponent({
1435
- name: "VaporKeepAlive",
1436
- __isKeepAlive: true,
1437
- props: {
1438
- include: [String, RegExp, Array],
1439
- exclude: [String, RegExp, Array],
1440
- max: [String, Number]
1441
- },
1442
- setup(props, { slots }) {
1443
- if (!slots.default) {
1444
- return void 0;
1445
- }
1446
- const keepAliveInstance = currentInstance;
1447
- const cache = /* @__PURE__ */ new Map();
1448
- const keys = /* @__PURE__ */ new Set();
1449
- const storageContainer = createElement("div");
1450
- let current;
1451
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
1452
- keepAliveInstance.__v_cache = cache;
1453
- }
1454
- function shouldCache(instance) {
1455
- if (isAsyncWrapper(instance) && !instance.type.__asyncResolved) {
1456
- return false;
1457
- }
1458
- const { include, exclude } = props;
1459
- const name = getComponentName(
1460
- isAsyncWrapper(instance) ? instance.type.__asyncResolved : instance.type
1461
- );
1462
- return !(include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name));
1308
+ const dynamicSlotsProxyHandlers = {
1309
+ get: getSlot,
1310
+ has: (target, key) => !!getSlot(target, key),
1311
+ getOwnPropertyDescriptor(target, key) {
1312
+ const slot = getSlot(target, key);
1313
+ if (slot) {
1314
+ return {
1315
+ configurable: true,
1316
+ enumerable: true,
1317
+ value: slot
1318
+ };
1463
1319
  }
1464
- function innerCacheBlock(key, instance) {
1465
- const { max } = props;
1466
- if (cache.has(key)) {
1467
- keys.delete(key);
1468
- keys.add(key);
1469
- } else {
1470
- keys.add(key);
1471
- if (max && keys.size > parseInt(max, 10)) {
1472
- pruneCacheEntry(keys.values().next().value);
1320
+ },
1321
+ ownKeys(target) {
1322
+ let keys = Object.keys(target);
1323
+ const dynamicSources = target.$;
1324
+ if (dynamicSources) {
1325
+ keys = keys.filter((k) => k !== "$");
1326
+ for (const source of dynamicSources) {
1327
+ if (isFunction(source)) {
1328
+ const slot = source();
1329
+ if (isArray(slot)) {
1330
+ for (const s of slot) keys.push(String(s.name));
1331
+ } else {
1332
+ keys.push(String(slot.name));
1333
+ }
1334
+ } else {
1335
+ keys.push(...Object.keys(source));
1473
1336
  }
1474
1337
  }
1475
- cache.set(key, instance);
1476
- current = instance;
1477
1338
  }
1478
- function cacheBlock() {
1479
- const block = keepAliveInstance.block;
1480
- const innerBlock = getInnerBlock(block);
1481
- if (!innerBlock || !shouldCache(innerBlock)) return;
1482
- let toCache;
1483
- let key;
1484
- let frag;
1485
- if (isFragment(block) && (frag = findInteropFragment(block))) {
1486
- toCache = frag;
1487
- key = frag.vnode.type;
1488
- } else {
1489
- toCache = innerBlock;
1339
+ return keys;
1340
+ },
1341
+ set: NO,
1342
+ deleteProperty: NO
1343
+ };
1344
+ function getSlot(target, key) {
1345
+ if (key === "$") return;
1346
+ const dynamicSources = target.$;
1347
+ if (dynamicSources) {
1348
+ let i = dynamicSources.length;
1349
+ let source;
1350
+ while (i--) {
1351
+ source = dynamicSources[i];
1352
+ if (isFunction(source)) {
1353
+ const slot = source();
1354
+ if (slot) {
1355
+ if (isArray(slot)) {
1356
+ for (const s of slot) {
1357
+ if (String(s.name) === key) return s.fn;
1358
+ }
1359
+ } else if (String(slot.name) === key) {
1360
+ return slot.fn;
1361
+ }
1362
+ }
1363
+ } else if (hasOwn(source, key)) {
1364
+ return source[key];
1365
+ }
1366
+ }
1367
+ }
1368
+ if (hasOwn(target, key)) {
1369
+ return target[key];
1370
+ }
1371
+ }
1372
+ let currentSlotConsumer = null;
1373
+ function setCurrentSlotConsumer(consumer) {
1374
+ try {
1375
+ return currentSlotConsumer;
1376
+ } finally {
1377
+ currentSlotConsumer = consumer;
1378
+ }
1379
+ }
1380
+ function getParentInstance() {
1381
+ return currentSlotConsumer || currentInstance;
1382
+ }
1383
+ function withVaporCtx(fn) {
1384
+ const owner = currentInstance;
1385
+ return (...args) => {
1386
+ const prev = setCurrentInstance(owner);
1387
+ const prevConsumer = setCurrentSlotConsumer(prev[0]);
1388
+ try {
1389
+ return fn(...args);
1390
+ } finally {
1391
+ setCurrentInstance(...prev);
1392
+ setCurrentSlotConsumer(prevConsumer);
1393
+ }
1394
+ };
1395
+ }
1396
+ function createSlot(name, rawProps, fallback, noSlotted) {
1397
+ const _insertionParent = insertionParent;
1398
+ const _insertionAnchor = insertionAnchor;
1399
+ const _isLastInsertion = isLastInsertion;
1400
+ if (!isHydrating) resetInsertionState();
1401
+ const instance = currentInstance;
1402
+ const rawSlots = instance.rawSlots;
1403
+ const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
1404
+ let fragment;
1405
+ if (isRef(rawSlots._)) {
1406
+ if (isHydrating) locateHydrationNode();
1407
+ fragment = instance.appContext.vapor.vdomSlot(
1408
+ rawSlots._,
1409
+ name,
1410
+ slotProps,
1411
+ instance,
1412
+ fallback
1413
+ );
1414
+ } else {
1415
+ fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
1416
+ const isDynamicName = isFunction(name);
1417
+ const slotScopeIds = [];
1418
+ if (!noSlotted) {
1419
+ const scopeId = instance.type.__scopeId;
1420
+ if (scopeId) {
1421
+ slotScopeIds.push(`${scopeId}-s`);
1422
+ }
1423
+ }
1424
+ const renderSlot = () => {
1425
+ const slotName = isFunction(name) ? name() : name;
1426
+ if (instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce) {
1427
+ const el = createElement("slot");
1428
+ renderEffect(() => {
1429
+ setDynamicProps(el, [
1430
+ slotProps,
1431
+ slotName !== "default" ? { name: slotName } : {}
1432
+ ]);
1433
+ });
1434
+ if (fallback) insert(fallback(), el);
1435
+ fragment.nodes = el;
1436
+ return;
1437
+ }
1438
+ const slot = getSlot(rawSlots, slotName);
1439
+ if (slot) {
1440
+ fragment.fallback = fallback;
1441
+ fragment.update(
1442
+ slot._bound || (slot._bound = () => {
1443
+ const prevSlotScopeIds = setCurrentSlotScopeIds(
1444
+ slotScopeIds.length > 0 ? slotScopeIds : null
1445
+ );
1446
+ try {
1447
+ return slot(slotProps);
1448
+ } finally {
1449
+ setCurrentSlotScopeIds(prevSlotScopeIds);
1450
+ }
1451
+ })
1452
+ );
1453
+ } else {
1454
+ fragment.update(fallback);
1455
+ }
1456
+ };
1457
+ if (isDynamicName || rawSlots.$) {
1458
+ renderEffect(renderSlot);
1459
+ } else {
1460
+ renderSlot();
1461
+ }
1462
+ }
1463
+ if (!isHydrating) {
1464
+ if (!noSlotted) {
1465
+ const scopeId = instance.type.__scopeId;
1466
+ if (scopeId) {
1467
+ setScopeId(fragment, [`${scopeId}-s`]);
1468
+ }
1469
+ }
1470
+ if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
1471
+ } else {
1472
+ if (fragment.insert) {
1473
+ fragment.hydrate();
1474
+ }
1475
+ if (_isLastInsertion) {
1476
+ advanceHydrationNode(_insertionParent);
1477
+ }
1478
+ }
1479
+ return fragment;
1480
+ }
1481
+
1482
+ /*! #__NO_SIDE_EFFECTS__ */
1483
+ // @__NO_SIDE_EFFECTS__
1484
+ function defineVaporComponent(comp, extraOptions) {
1485
+ if (isFunction(comp)) {
1486
+ return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
1487
+ setup: comp,
1488
+ __vapor: true
1489
+ }))();
1490
+ }
1491
+ comp.__vapor = true;
1492
+ return comp;
1493
+ }
1494
+
1495
+ const VaporKeepAliveImpl = defineVaporComponent({
1496
+ name: "VaporKeepAlive",
1497
+ __isKeepAlive: true,
1498
+ props: {
1499
+ include: [String, RegExp, Array],
1500
+ exclude: [String, RegExp, Array],
1501
+ max: [String, Number]
1502
+ },
1503
+ setup(props, { slots }) {
1504
+ if (!slots.default) {
1505
+ return void 0;
1506
+ }
1507
+ const keepAliveInstance = currentInstance;
1508
+ const cache = /* @__PURE__ */ new Map();
1509
+ const keys = /* @__PURE__ */ new Set();
1510
+ const storageContainer = createElement("div");
1511
+ let current;
1512
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
1513
+ keepAliveInstance.__v_cache = cache;
1514
+ }
1515
+ function shouldCache(instance) {
1516
+ if (isAsyncWrapper(instance) && !instance.type.__asyncResolved) {
1517
+ return false;
1518
+ }
1519
+ const { include, exclude } = props;
1520
+ const name = getComponentName(
1521
+ isAsyncWrapper(instance) ? instance.type.__asyncResolved : instance.type
1522
+ );
1523
+ return !(include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name));
1524
+ }
1525
+ function innerCacheBlock(key, instance) {
1526
+ const { max } = props;
1527
+ if (cache.has(key)) {
1528
+ keys.delete(key);
1529
+ keys.add(key);
1530
+ } else {
1531
+ keys.add(key);
1532
+ if (max && keys.size > parseInt(max, 10)) {
1533
+ pruneCacheEntry(keys.values().next().value);
1534
+ }
1535
+ }
1536
+ cache.set(key, instance);
1537
+ current = instance;
1538
+ }
1539
+ function cacheBlock() {
1540
+ const block = keepAliveInstance.block;
1541
+ const innerBlock = getInnerBlock(block);
1542
+ if (!innerBlock || !shouldCache(innerBlock)) return;
1543
+ let toCache;
1544
+ let key;
1545
+ let frag;
1546
+ if (isFragment(block) && (frag = findInteropFragment(block))) {
1547
+ toCache = frag;
1548
+ key = frag.vnode.type;
1549
+ } else {
1550
+ toCache = innerBlock;
1490
1551
  key = innerBlock.type;
1491
1552
  }
1492
1553
  innerCacheBlock(key, toCache);
@@ -1824,8 +1885,7 @@ const vaporSlotsProxyHandler = {
1824
1885
  }
1825
1886
  };
1826
1887
  let vdomHydrateNode;
1827
- function createVDOMComponent(internals, component, rawProps, rawSlots) {
1828
- const parentInstance = currentInstance;
1888
+ function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots) {
1829
1889
  const frag = new VaporFragment([]);
1830
1890
  const vnode = frag.vnode = createVNode(
1831
1891
  component,
@@ -1834,7 +1894,10 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
1834
1894
  const wrapper = new VaporComponentInstance(
1835
1895
  { props: component.props },
1836
1896
  rawProps,
1837
- rawSlots
1897
+ rawSlots,
1898
+ parentComponent ? parentComponent.appContext : void 0,
1899
+ void 0,
1900
+ parentComponent
1838
1901
  );
1839
1902
  vnode.vi = (instance) => {
1840
1903
  instance.props = shallowReactive(wrapper.props);
@@ -1854,9 +1917,9 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
1854
1917
  if (vnode.shapeFlag & 256) {
1855
1918
  deactivate$1(
1856
1919
  vnode,
1857
- findParentKeepAlive(parentInstance).getStorageContainer(),
1920
+ findParentKeepAlive(parentComponent).getStorageContainer(),
1858
1921
  internals,
1859
- parentInstance,
1922
+ parentComponent,
1860
1923
  null
1861
1924
  );
1862
1925
  return;
@@ -1864,12 +1927,12 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
1864
1927
  internals.umt(vnode.component, null, !!parentNode);
1865
1928
  };
1866
1929
  frag.hydrate = () => {
1867
- hydrateVNode(vnode, parentInstance);
1930
+ hydrateVNode(vnode, parentComponent);
1868
1931
  onScopeDispose(unmount, true);
1869
1932
  isMounted = true;
1870
1933
  frag.nodes = vnode.el;
1871
1934
  };
1872
- vnode.scopeId = parentInstance && parentInstance.type.__scopeId;
1935
+ vnode.scopeId = currentInstance && currentInstance.type.__scopeId || null;
1873
1936
  vnode.slotScopeIds = currentSlotScopeIds;
1874
1937
  frag.insert = (parentNode, anchor, transition) => {
1875
1938
  if (isHydrating) return;
@@ -1879,21 +1942,21 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
1879
1942
  parentNode,
1880
1943
  anchor,
1881
1944
  internals,
1882
- parentInstance,
1945
+ parentComponent,
1883
1946
  null,
1884
1947
  void 0,
1885
1948
  false
1886
1949
  );
1887
1950
  } else {
1888
1951
  const prev = currentInstance;
1889
- simpleSetCurrentInstance(parentInstance);
1952
+ simpleSetCurrentInstance(parentComponent);
1890
1953
  if (!isMounted) {
1891
1954
  if (transition) setTransitionHooks$1(vnode, transition);
1892
1955
  internals.mt(
1893
1956
  vnode,
1894
1957
  parentNode,
1895
1958
  anchor,
1896
- parentInstance,
1959
+ parentComponent,
1897
1960
  null,
1898
1961
  void 0,
1899
1962
  false
@@ -1907,7 +1970,7 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
1907
1970
  parentNode,
1908
1971
  anchor,
1909
1972
  2,
1910
- parentInstance
1973
+ parentComponent
1911
1974
  );
1912
1975
  }
1913
1976
  simpleSetCurrentInstance(prev);
@@ -2154,7 +2217,7 @@ function getPropsProxyHandlers(comp, once) {
2154
2217
  return resolvePropValue(
2155
2218
  propsOptions,
2156
2219
  key,
2157
- rawProps[rawKey](),
2220
+ resolveSource(rawProps[rawKey]),
2158
2221
  instance,
2159
2222
  resolveDefault
2160
2223
  );
@@ -2257,10 +2320,11 @@ function getAttrFromRawProps(rawProps, key) {
2257
2320
  }
2258
2321
  }
2259
2322
  if (hasOwn(rawProps, key)) {
2323
+ const value = resolveSource(rawProps[key]);
2260
2324
  if (merged) {
2261
- merged.push(rawProps[key]());
2325
+ merged.push(value);
2262
2326
  } else {
2263
- return rawProps[key]();
2327
+ return value;
2264
2328
  }
2265
2329
  }
2266
2330
  if (merged && merged.length) {
@@ -2351,7 +2415,7 @@ function resolveDynamicProps(props) {
2351
2415
  const mergedRawProps = {};
2352
2416
  for (const key in props) {
2353
2417
  if (key !== "$") {
2354
- mergedRawProps[key] = props[key]();
2418
+ mergedRawProps[key] = resolveSource(props[key]);
2355
2419
  }
2356
2420
  }
2357
2421
  if (props.$) {
@@ -2485,6 +2549,7 @@ class TeleportFragment extends VaporFragment {
2485
2549
  };
2486
2550
  this.rawProps = props;
2487
2551
  this.rawSlots = slots;
2552
+ this.parentComponent = currentInstance;
2488
2553
  this.anchor = isHydrating ? void 0 : !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createTextNode();
2489
2554
  renderEffect(() => {
2490
2555
  this.resolvedProps = extend(
@@ -2554,6 +2619,9 @@ class TeleportFragment extends VaporFragment {
2554
2619
  insert(this.targetStart = createTextNode(""), target);
2555
2620
  insert(this.targetAnchor = createTextNode(""), target);
2556
2621
  }
2622
+ if (this.parentComponent && this.parentComponent.isCE) {
2623
+ (this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2624
+ }
2557
2625
  mount(target, this.targetAnchor);
2558
2626
  } else if (!!(process.env.NODE_ENV !== "production")) {
2559
2627
  warn(
@@ -2566,7 +2634,9 @@ class TeleportFragment extends VaporFragment {
2566
2634
  if (isTeleportDisabled(this.resolvedProps)) {
2567
2635
  mount(this.parent, this.anchor);
2568
2636
  } else {
2569
- if (isTeleportDeferred(this.resolvedProps)) {
2637
+ if (isTeleportDeferred(this.resolvedProps) || // force defer when the parent is not connected to the DOM,
2638
+ // typically due to an early insertion caused by setInsertionState.
2639
+ !this.parent.isConnected) {
2570
2640
  queuePostFlushCb(mountToTarget);
2571
2641
  } else {
2572
2642
  mountToTarget();
@@ -2774,13 +2844,15 @@ function setScopeId(block, scopeIds) {
2774
2844
  }
2775
2845
  }
2776
2846
  function setComponentScopeId(instance) {
2777
- const parent = instance.parent;
2778
- if (!parent) return;
2847
+ const { parent, scopeId } = instance;
2848
+ if (!parent || !scopeId) return;
2779
2849
  if (isArray(instance.block) && instance.block.length > 1) return;
2780
2850
  const scopeIds = [];
2781
- const scopeId = parent.type.__scopeId;
2782
- if (scopeId) {
2851
+ const parentScopeId = parent && parent.type.__scopeId;
2852
+ if (parentScopeId !== scopeId) {
2783
2853
  scopeIds.push(scopeId);
2854
+ } else {
2855
+ if (parentScopeId) scopeIds.push(parentScopeId);
2784
2856
  }
2785
2857
  if (parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
2786
2858
  scopeIds.push(parent.vnode.scopeId);
@@ -2866,8 +2938,9 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
2866
2938
  } else {
2867
2939
  resetInsertionState();
2868
2940
  }
2869
- if (isSingleRoot && component.inheritAttrs !== false && isVaporComponent(currentInstance) && currentInstance.hasFallthrough) {
2870
- const attrs = currentInstance.attrs;
2941
+ const parentInstance = getParentInstance();
2942
+ if (isSingleRoot && component.inheritAttrs !== false && isVaporComponent(parentInstance) && parentInstance.hasFallthrough) {
2943
+ const attrs = parentInstance.attrs;
2871
2944
  if (rawProps) {
2872
2945
  (rawProps.$ || (rawProps.$ = [])).push(
2873
2946
  () => attrs
@@ -2876,18 +2949,21 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
2876
2949
  rawProps = { $: [() => attrs] };
2877
2950
  }
2878
2951
  }
2879
- if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
2880
- const cached = currentInstance.getCachedComponent(
2952
+ if (parentInstance && parentInstance.vapor && isKeepAlive(parentInstance)) {
2953
+ const cached = parentInstance.getCachedComponent(
2881
2954
  component
2882
2955
  );
2883
2956
  if (cached) return cached;
2884
2957
  }
2885
2958
  if (appContext.vapor && !component.__vapor) {
2959
+ const prevSlotConsumer2 = setCurrentSlotConsumer(null);
2886
2960
  const frag = appContext.vapor.vdomMount(
2887
2961
  component,
2962
+ parentInstance,
2888
2963
  rawProps,
2889
2964
  rawSlots
2890
2965
  );
2966
+ setCurrentSlotConsumer(prevSlotConsumer2);
2891
2967
  if (!isHydrating) {
2892
2968
  if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
2893
2969
  } else {
@@ -2915,8 +2991,10 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
2915
2991
  rawProps,
2916
2992
  rawSlots,
2917
2993
  appContext,
2918
- once
2994
+ once,
2995
+ parentInstance
2919
2996
  );
2997
+ const prevSlotConsumer = setCurrentSlotConsumer(null);
2920
2998
  if (!!(process.env.NODE_ENV !== "production") && component.__hmrId) {
2921
2999
  registerHMR(instance);
2922
3000
  instance.isSingleRoot = isSingleRoot;
@@ -2958,6 +3036,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
2958
3036
  } else {
2959
3037
  setupComponent(instance, component);
2960
3038
  }
3039
+ setCurrentSlotConsumer(prevSlotConsumer);
2961
3040
  onScopeDispose$1(() => unmountComponent(instance), true);
2962
3041
  if (_insertionParent || isHydrating) {
2963
3042
  mountComponent(instance, _insertionParent, _insertionAnchor);
@@ -3055,16 +3134,16 @@ const emptyContext = {
3055
3134
  provides: /* @__PURE__ */ Object.create(null)
3056
3135
  };
3057
3136
  class VaporComponentInstance {
3058
- constructor(comp, rawProps, rawSlots, appContext, once) {
3137
+ constructor(comp, rawProps, rawSlots, appContext, once, parent = currentInstance) {
3059
3138
  this.vapor = true;
3060
3139
  this.uid = nextUid();
3061
3140
  this.type = comp;
3062
- this.parent = currentInstance;
3063
- this.root = currentInstance ? currentInstance.root : this;
3064
- if (currentInstance) {
3065
- this.appContext = currentInstance.appContext;
3066
- this.provides = currentInstance.provides;
3067
- this.ids = currentInstance.ids;
3141
+ this.parent = parent;
3142
+ this.root = parent ? parent.root : this;
3143
+ if (parent) {
3144
+ this.appContext = parent.appContext;
3145
+ this.provides = parent.provides;
3146
+ this.ids = parent.ids;
3068
3147
  } else {
3069
3148
  this.appContext = appContext || emptyContext;
3070
3149
  this.provides = Object.create(this.appContext.provides);
@@ -3088,6 +3167,10 @@ class VaporComponentInstance {
3088
3167
  }
3089
3168
  this.rawSlots = rawSlots || EMPTY_OBJ;
3090
3169
  this.slots = rawSlots ? rawSlots.$ ? new Proxy(rawSlots, dynamicSlotsProxyHandlers) : rawSlots : EMPTY_OBJ;
3170
+ this.scopeId = currentInstance && currentInstance.type.__scopeId;
3171
+ if (comp.ce) {
3172
+ comp.ce(this);
3173
+ }
3091
3174
  }
3092
3175
  /**
3093
3176
  * Expose `getKeysFromRawProps` on the instance so it can be used in code
@@ -3111,6 +3194,9 @@ function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, onc
3111
3194
  appContext
3112
3195
  );
3113
3196
  }
3197
+ return createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once);
3198
+ }
3199
+ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
3114
3200
  const _insertionParent = insertionParent;
3115
3201
  const _insertionAnchor = insertionAnchor;
3116
3202
  const _isLastInsertion = isLastInsertion;
@@ -3136,8 +3222,15 @@ function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, onc
3136
3222
  nextNode = locateNextNode(el);
3137
3223
  setCurrentHydrationNode(el.firstChild);
3138
3224
  }
3139
- if (rawSlots.$) ; else {
3140
- insert(getSlot(rawSlots, "default")(), el);
3225
+ if (rawSlots.$) {
3226
+ const frag = new DynamicFragment(
3227
+ isHydrating ? "" : !!(process.env.NODE_ENV !== "production") ? "slot" : void 0
3228
+ );
3229
+ renderEffect(() => frag.update(getSlot(rawSlots, "default")));
3230
+ if (!isHydrating) insert(frag, el);
3231
+ } else {
3232
+ const block = getSlot(rawSlots, "default")();
3233
+ if (!isHydrating) insert(block, el);
3141
3234
  }
3142
3235
  if (isHydrating) {
3143
3236
  setCurrentHydrationNode(nextNode);
@@ -3157,6 +3250,11 @@ function mountComponent(instance, parent, anchor) {
3157
3250
  findParentKeepAlive(instance).activate(instance, parent, anchor);
3158
3251
  return;
3159
3252
  }
3253
+ const { root, type } = instance;
3254
+ if (root && root.ce && // @ts-expect-error _def is private
3255
+ root.ce._def.shadowRoot !== false) {
3256
+ root.ce._injectChildStyle(type);
3257
+ }
3160
3258
  if (!!(process.env.NODE_ENV !== "production")) {
3161
3259
  startMeasure(instance, `mount`);
3162
3260
  }
@@ -3224,7 +3322,7 @@ const mountApp = (app, container) => {
3224
3322
  }
3225
3323
  container.textContent = "";
3226
3324
  }
3227
- const instance = createComponent(
3325
+ const instance = app._ceComponent || createComponent(
3228
3326
  app._component,
3229
3327
  app._props,
3230
3328
  null,
@@ -3241,7 +3339,7 @@ const hydrateApp = (app, container) => {
3241
3339
  optimizePropertyLookup();
3242
3340
  let instance;
3243
3341
  withHydration(container, () => {
3244
- instance = createComponent(
3342
+ instance = app._ceComponent || createComponent(
3245
3343
  app._component,
3246
3344
  app._props,
3247
3345
  null,
@@ -3420,10 +3518,130 @@ function createInnerComp(comp, parent, frag) {
3420
3518
  return instance;
3421
3519
  }
3422
3520
 
3521
+ // @__NO_SIDE_EFFECTS__
3522
+ function defineVaporCustomElement(options, extraOptions, _createApp) {
3523
+ let Comp = defineVaporComponent(options, extraOptions);
3524
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
3525
+ class VaporCustomElement extends VaporElement {
3526
+ constructor(initialProps) {
3527
+ super(Comp, initialProps, _createApp);
3528
+ }
3529
+ }
3530
+ VaporCustomElement.def = Comp;
3531
+ return VaporCustomElement;
3532
+ }
3533
+ const defineVaporSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
3534
+ return /* @__PURE__ */ defineVaporCustomElement(options, extraOptions, createVaporSSRApp);
3535
+ });
3536
+ class VaporElement extends VueElementBase {
3537
+ constructor(def, props = {}, createAppFn = createVaporApp) {
3538
+ super(def, props, createAppFn);
3539
+ }
3540
+ _needsHydration() {
3541
+ if (this.shadowRoot && this._createApp !== createVaporApp) {
3542
+ return true;
3543
+ } else {
3544
+ if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
3545
+ warn(
3546
+ `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineVaporSSRCustomElement\`.`
3547
+ );
3548
+ }
3549
+ }
3550
+ return false;
3551
+ }
3552
+ _mount(def) {
3553
+ if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
3554
+ def.name = "VaporElement";
3555
+ }
3556
+ this._app = this._createApp(this._def);
3557
+ this._inheritParentContext();
3558
+ if (this._def.configureApp) {
3559
+ this._def.configureApp(this._app);
3560
+ }
3561
+ if (this.shadowRoot && this._createApp === createVaporSSRApp) {
3562
+ withHydration(this._root, this._createComponent.bind(this));
3563
+ } else {
3564
+ this._createComponent();
3565
+ }
3566
+ this._app.mount(this._root);
3567
+ if (!this.shadowRoot) {
3568
+ this._renderSlots();
3569
+ }
3570
+ }
3571
+ _update() {
3572
+ if (!this._app) return;
3573
+ const renderEffects = this._instance.renderEffects;
3574
+ if (renderEffects) renderEffects.forEach((e) => e.run());
3575
+ }
3576
+ _unmount() {
3577
+ {
3578
+ this._app.unmount();
3579
+ }
3580
+ if (this._instance && this._instance.ce) {
3581
+ this._instance.ce = void 0;
3582
+ }
3583
+ this._app = this._instance = null;
3584
+ }
3585
+ /**
3586
+ * Only called when shadowRoot is false
3587
+ */
3588
+ _updateSlotNodes(replacements) {
3589
+ this._updateFragmentNodes(
3590
+ this._instance.block,
3591
+ replacements
3592
+ );
3593
+ }
3594
+ /**
3595
+ * Replace slot nodes with their replace content
3596
+ * @internal
3597
+ */
3598
+ _updateFragmentNodes(block, replacements) {
3599
+ if (Array.isArray(block)) {
3600
+ block.forEach((item) => this._updateFragmentNodes(item, replacements));
3601
+ return;
3602
+ }
3603
+ if (!isFragment(block)) return;
3604
+ const { nodes } = block;
3605
+ if (Array.isArray(nodes)) {
3606
+ const newNodes = [];
3607
+ for (const node of nodes) {
3608
+ if (node instanceof HTMLSlotElement) {
3609
+ newNodes.push(...replacements.get(node));
3610
+ } else {
3611
+ this._updateFragmentNodes(node, replacements);
3612
+ newNodes.push(node);
3613
+ }
3614
+ }
3615
+ block.nodes = newNodes;
3616
+ } else if (nodes instanceof HTMLSlotElement) {
3617
+ block.nodes = replacements.get(nodes);
3618
+ } else {
3619
+ this._updateFragmentNodes(nodes, replacements);
3620
+ }
3621
+ }
3622
+ _createComponent() {
3623
+ this._def.ce = (instance) => {
3624
+ this._app._ceComponent = this._instance = instance;
3625
+ if (!this.shadowRoot) {
3626
+ this._instance.u = [this._renderSlots.bind(this)];
3627
+ }
3628
+ this._processInstance();
3629
+ };
3630
+ createComponent(
3631
+ this._def,
3632
+ this._props,
3633
+ void 0,
3634
+ void 0,
3635
+ void 0,
3636
+ this._app._context
3637
+ );
3638
+ }
3639
+ }
3640
+
3423
3641
  let t;
3424
3642
  /*! #__NO_SIDE_EFFECTS__ */
3425
3643
  // @__NO_SIDE_EFFECTS__
3426
- function template(html, root) {
3644
+ function template(html, root, ns) {
3427
3645
  let node;
3428
3646
  return () => {
3429
3647
  if (isHydrating) {
@@ -3435,9 +3653,15 @@ function template(html, root) {
3435
3653
  return createTextNode(html);
3436
3654
  }
3437
3655
  if (!node) {
3438
- t = t || createElement("template");
3439
- t.innerHTML = html;
3440
- node = _child(t.content);
3656
+ t = t || document.createElement("template");
3657
+ if (ns) {
3658
+ const tag = ns === 1 ? "svg" : "math";
3659
+ t.innerHTML = `<${tag}>${html}</${tag}>`;
3660
+ node = _child(_child(t.content));
3661
+ } else {
3662
+ t.innerHTML = html;
3663
+ node = _child(t.content);
3664
+ }
3441
3665
  }
3442
3666
  const ret = node.cloneNode(true);
3443
3667
  if (root) ret.$root = true;
@@ -3486,12 +3710,177 @@ function createKeyedFragment(key, render) {
3486
3710
  return frag;
3487
3711
  }
3488
3712
 
3489
- class ForBlock extends VaporFragment {
3490
- constructor(nodes, scope, item, key, index, renderKey) {
3491
- super(nodes);
3492
- this.scope = scope;
3493
- this.itemRef = item;
3494
- this.keyRef = key;
3713
+ const positionMap = /* @__PURE__ */ new WeakMap();
3714
+ const newPositionMap = /* @__PURE__ */ new WeakMap();
3715
+ const decorate = (t) => {
3716
+ delete t.props.mode;
3717
+ t.__vapor = true;
3718
+ return t;
3719
+ };
3720
+ const VaporTransitionGroup = decorate({
3721
+ name: "VaporTransitionGroup",
3722
+ props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
3723
+ tag: String,
3724
+ moveClass: String
3725
+ }),
3726
+ setup(props, { slots }) {
3727
+ const instance = currentInstance;
3728
+ const state = useTransitionState();
3729
+ const cssTransitionProps = resolveTransitionProps(props);
3730
+ let prevChildren;
3731
+ let children;
3732
+ const slottedBlock = slots.default && slots.default();
3733
+ onBeforeUpdate(() => {
3734
+ prevChildren = [];
3735
+ children = getTransitionBlocks(slottedBlock);
3736
+ if (children) {
3737
+ for (let i = 0; i < children.length; i++) {
3738
+ const child = children[i];
3739
+ if (isValidTransitionBlock(child)) {
3740
+ prevChildren.push(child);
3741
+ child.$transition.disabled = true;
3742
+ positionMap.set(
3743
+ child,
3744
+ getTransitionElement(child).getBoundingClientRect()
3745
+ );
3746
+ }
3747
+ }
3748
+ }
3749
+ });
3750
+ onUpdated(() => {
3751
+ if (!prevChildren.length) {
3752
+ return;
3753
+ }
3754
+ const moveClass = props.moveClass || `${props.name || "v"}-move`;
3755
+ const firstChild = getFirstConnectedChild(prevChildren);
3756
+ if (!firstChild || !hasCSSTransform(
3757
+ firstChild,
3758
+ firstChild.parentNode,
3759
+ moveClass
3760
+ )) {
3761
+ prevChildren = [];
3762
+ return;
3763
+ }
3764
+ prevChildren.forEach(callPendingCbs);
3765
+ prevChildren.forEach((child) => {
3766
+ child.$transition.disabled = false;
3767
+ recordPosition(child);
3768
+ });
3769
+ const movedChildren = prevChildren.filter(applyTranslation);
3770
+ forceReflow();
3771
+ movedChildren.forEach(
3772
+ (c) => handleMovedChildren(
3773
+ getTransitionElement(c),
3774
+ moveClass
3775
+ )
3776
+ );
3777
+ prevChildren = [];
3778
+ });
3779
+ setTransitionHooksOnFragment(slottedBlock, {
3780
+ props: cssTransitionProps,
3781
+ state,
3782
+ instance,
3783
+ group: true
3784
+ });
3785
+ children = getTransitionBlocks(slottedBlock);
3786
+ for (let i = 0; i < children.length; i++) {
3787
+ const child = children[i];
3788
+ if (isValidTransitionBlock(child)) {
3789
+ if (child.$key != null) {
3790
+ const hooks = resolveTransitionHooks(
3791
+ child,
3792
+ cssTransitionProps,
3793
+ state,
3794
+ instance
3795
+ );
3796
+ hooks.group = true;
3797
+ setTransitionHooks(child, hooks);
3798
+ } else if (!!(process.env.NODE_ENV !== "production") && child.$key == null) {
3799
+ warn(`<transition-group> children must be keyed`);
3800
+ }
3801
+ }
3802
+ }
3803
+ const tag = props.tag;
3804
+ if (tag) {
3805
+ const container = createElement(tag);
3806
+ insert(slottedBlock, container);
3807
+ if (instance.hasFallthrough) {
3808
+ container.$root = true;
3809
+ renderEffect(() => applyFallthroughProps(container, instance.attrs));
3810
+ }
3811
+ return container;
3812
+ } else {
3813
+ const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("transition-group") : new DynamicFragment();
3814
+ renderEffect(() => frag.update(() => slottedBlock));
3815
+ return frag;
3816
+ }
3817
+ }
3818
+ });
3819
+ function getTransitionBlocks(block) {
3820
+ let children = [];
3821
+ if (block instanceof Node) {
3822
+ children.push(block);
3823
+ } else if (isVaporComponent(block)) {
3824
+ children.push(...getTransitionBlocks(block.block));
3825
+ } else if (isArray(block)) {
3826
+ for (let i = 0; i < block.length; i++) {
3827
+ const b = block[i];
3828
+ const blocks = getTransitionBlocks(b);
3829
+ if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
3830
+ children.push(...blocks);
3831
+ }
3832
+ } else if (isFragment(block)) {
3833
+ if (block.insert) {
3834
+ children.push(block);
3835
+ } else {
3836
+ children.push(...getTransitionBlocks(block.nodes));
3837
+ }
3838
+ }
3839
+ return children;
3840
+ }
3841
+ function isValidTransitionBlock(block) {
3842
+ return !!(block instanceof Element || isFragment(block) && block.insert);
3843
+ }
3844
+ function getTransitionElement(c) {
3845
+ return isFragment(c) ? c.nodes : c;
3846
+ }
3847
+ function recordPosition(c) {
3848
+ newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
3849
+ }
3850
+ function applyTranslation(c) {
3851
+ if (baseApplyTranslation(
3852
+ positionMap.get(c),
3853
+ newPositionMap.get(c),
3854
+ getTransitionElement(c)
3855
+ )) {
3856
+ return c;
3857
+ }
3858
+ }
3859
+ function getFirstConnectedChild(children) {
3860
+ for (let i = 0; i < children.length; i++) {
3861
+ const child = children[i];
3862
+ const el = getTransitionElement(child);
3863
+ if (el.isConnected) return el;
3864
+ }
3865
+ }
3866
+ function triggerTransitionGroupUpdate(transition) {
3867
+ const { instance } = transition;
3868
+ if (!instance.isUpdating) {
3869
+ instance.isUpdating = true;
3870
+ if (instance.bu) invokeArrayFns(instance.bu);
3871
+ queuePostFlushCb(() => {
3872
+ instance.isUpdating = false;
3873
+ if (instance.u) invokeArrayFns(instance.u);
3874
+ });
3875
+ }
3876
+ }
3877
+
3878
+ class ForBlock extends VaporFragment {
3879
+ constructor(nodes, scope, item, key, index, renderKey) {
3880
+ super(nodes);
3881
+ this.scope = scope;
3882
+ this.itemRef = item;
3883
+ this.keyRef = key;
3495
3884
  this.indexRef = index;
3496
3885
  this.key = renderKey;
3497
3886
  }
@@ -3528,6 +3917,10 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
3528
3917
  const oldLength = oldBlocks.length;
3529
3918
  newBlocks = new Array(newLength);
3530
3919
  let isFallback = false;
3920
+ const transitionHooks = frag.$transition;
3921
+ if (transitionHooks && transitionHooks.group) {
3922
+ triggerTransitionGroupUpdate(transitionHooks);
3923
+ }
3531
3924
  const prevSub = setActiveSub();
3532
3925
  if (!isMounted) {
3533
3926
  isMounted = true;
@@ -4246,153 +4639,4 @@ function withVaporDirectives(node, dirs) {
4246
4639
  }
4247
4640
  }
4248
4641
 
4249
- const positionMap = /* @__PURE__ */ new WeakMap();
4250
- const newPositionMap = /* @__PURE__ */ new WeakMap();
4251
- const decorate = (t) => {
4252
- delete t.props.mode;
4253
- t.__vapor = true;
4254
- return t;
4255
- };
4256
- const VaporTransitionGroup = decorate({
4257
- name: "VaporTransitionGroup",
4258
- props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
4259
- tag: String,
4260
- moveClass: String
4261
- }),
4262
- setup(props, { slots }) {
4263
- const instance = currentInstance;
4264
- const state = useTransitionState();
4265
- const cssTransitionProps = resolveTransitionProps(props);
4266
- let prevChildren;
4267
- let children;
4268
- const slottedBlock = slots.default && slots.default();
4269
- onBeforeUpdate(() => {
4270
- prevChildren = [];
4271
- children = getTransitionBlocks(slottedBlock);
4272
- if (children) {
4273
- for (let i = 0; i < children.length; i++) {
4274
- const child = children[i];
4275
- if (isValidTransitionBlock(child)) {
4276
- prevChildren.push(child);
4277
- child.$transition.disabled = true;
4278
- positionMap.set(
4279
- child,
4280
- getTransitionElement(child).getBoundingClientRect()
4281
- );
4282
- }
4283
- }
4284
- }
4285
- });
4286
- onUpdated(() => {
4287
- if (!prevChildren.length) {
4288
- return;
4289
- }
4290
- const moveClass = props.moveClass || `${props.name || "v"}-move`;
4291
- const firstChild = getFirstConnectedChild(prevChildren);
4292
- if (!firstChild || !hasCSSTransform(
4293
- firstChild,
4294
- firstChild.parentNode,
4295
- moveClass
4296
- )) {
4297
- prevChildren = [];
4298
- return;
4299
- }
4300
- prevChildren.forEach(callPendingCbs);
4301
- prevChildren.forEach((child) => {
4302
- child.$transition.disabled = false;
4303
- recordPosition(child);
4304
- });
4305
- const movedChildren = prevChildren.filter(applyTranslation);
4306
- forceReflow();
4307
- movedChildren.forEach(
4308
- (c) => handleMovedChildren(
4309
- getTransitionElement(c),
4310
- moveClass
4311
- )
4312
- );
4313
- prevChildren = [];
4314
- });
4315
- setTransitionHooksOnFragment(slottedBlock, {
4316
- props: cssTransitionProps,
4317
- state,
4318
- instance
4319
- });
4320
- children = getTransitionBlocks(slottedBlock);
4321
- for (let i = 0; i < children.length; i++) {
4322
- const child = children[i];
4323
- if (isValidTransitionBlock(child)) {
4324
- if (child.$key != null) {
4325
- setTransitionHooks(
4326
- child,
4327
- resolveTransitionHooks(child, cssTransitionProps, state, instance)
4328
- );
4329
- } else if (!!(process.env.NODE_ENV !== "production") && child.$key == null) {
4330
- warn(`<transition-group> children must be keyed`);
4331
- }
4332
- }
4333
- }
4334
- const tag = props.tag;
4335
- if (tag) {
4336
- const container = createElement(tag);
4337
- insert(slottedBlock, container);
4338
- if (instance.hasFallthrough) {
4339
- container.$root = true;
4340
- renderEffect(() => applyFallthroughProps(container, instance.attrs));
4341
- }
4342
- return container;
4343
- } else {
4344
- const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("transition-group") : new DynamicFragment();
4345
- renderEffect(() => frag.update(() => slottedBlock));
4346
- return frag;
4347
- }
4348
- }
4349
- });
4350
- function getTransitionBlocks(block) {
4351
- let children = [];
4352
- if (block instanceof Node) {
4353
- children.push(block);
4354
- } else if (isVaporComponent(block)) {
4355
- children.push(...getTransitionBlocks(block.block));
4356
- } else if (isArray(block)) {
4357
- for (let i = 0; i < block.length; i++) {
4358
- const b = block[i];
4359
- const blocks = getTransitionBlocks(b);
4360
- if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
4361
- children.push(...blocks);
4362
- }
4363
- } else if (isFragment(block)) {
4364
- if (block.insert) {
4365
- children.push(block);
4366
- } else {
4367
- children.push(...getTransitionBlocks(block.nodes));
4368
- }
4369
- }
4370
- return children;
4371
- }
4372
- function isValidTransitionBlock(block) {
4373
- return !!(block instanceof Element || isFragment(block) && block.insert);
4374
- }
4375
- function getTransitionElement(c) {
4376
- return isFragment(c) ? c.nodes : c;
4377
- }
4378
- function recordPosition(c) {
4379
- newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
4380
- }
4381
- function applyTranslation(c) {
4382
- if (baseApplyTranslation(
4383
- positionMap.get(c),
4384
- newPositionMap.get(c),
4385
- getTransitionElement(c)
4386
- )) {
4387
- return c;
4388
- }
4389
- }
4390
- function getFirstConnectedChild(children) {
4391
- for (let i = 0; i < children.length; i++) {
4392
- const child = children[i];
4393
- const el = getTransitionElement(child);
4394
- if (el.isConnected) return el;
4395
- }
4396
- }
4397
-
4398
- export { VaporFragment, VaporKeepAliveImpl as VaporKeepAlive, VaporTeleportImpl as VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createKeyedFragment, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockText, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
4642
+ export { VaporFragment, VaporKeepAliveImpl as VaporKeepAlive, VaporTeleportImpl as VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockText, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, vaporInteropPlugin, withVaporCtx, withVaporDirectives };