@vue/runtime-vapor 3.6.0-beta.10 → 3.6.0-beta.11
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.
- package/dist/runtime-vapor.d.ts +94 -80
- package/dist/runtime-vapor.esm-bundler.js +1674 -913
- package/package.json +4 -4
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.11
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { EffectScope, Fragment, NULL_DYNAMIC_COMPONENT, Static, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, shouldSetAsPropForVueCE, shouldUpdateComponent, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, withAsyncContext as withAsyncContext$1, xlinkNS } from "@vue/runtime-dom";
|
|
6
|
+
import { EffectScope, Fragment, NULL_DYNAMIC_COMPONENT, Static, TransitionPropsValidators, VaporSlot, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureValidVNode, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, normalizeVNode, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, shouldSetAsPropForVueCE, shouldUpdateComponent, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, withAsyncContext as withAsyncContext$1, xlinkNS } from "@vue/runtime-dom";
|
|
7
7
|
import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, canSetValueDirectly, extend, getEscapedCssVarName, getGlobalThis, hasOwn, includeBooleanAttr, invokeArrayFns, isArray, isFunction, isObject, isOn, isPlainObject, isPromise, isReservedProp, isString, looseEqual, normalizeClass, normalizeCssVarValue, normalizeStyle, parseStringStyle, remove as remove$1, stringifyStyle, toDisplayString } from "@vue/shared";
|
|
8
|
-
import { EffectScope as EffectScope$1, ReactiveEffect, computed, effectScope, isReactive, isReadonly, isRef as isRef$1, isShallow, markRaw, onEffectCleanup, onScopeDispose as onScopeDispose$1, pauseTracking, proxyRefs, resetTracking, setActiveSub, shallowReadArray, shallowRef as shallowRef$1, toRaw, toReactive, toReadonly, traverse, unref, watch as watch$1 } from "@vue/reactivity";
|
|
8
|
+
import { EffectScope as EffectScope$1, ReactiveEffect, computed, effectScope, getCurrentScope, isReactive, isReadonly, isRef as isRef$1, isShallow, markRaw, onEffectCleanup, onScopeDispose as onScopeDispose$1, pauseTracking, proxyRefs, resetTracking, setActiveSub, shallowReadArray, shallowRef as shallowRef$1, toRaw, toReactive, toReadonly, traverse, unref, watch as watch$1 } from "@vue/reactivity";
|
|
9
9
|
//#region packages/runtime-vapor/src/insertionState.ts
|
|
10
10
|
let insertionParent;
|
|
11
11
|
let insertionAnchor;
|
|
12
12
|
let insertionIndex;
|
|
13
|
-
let isLastInsertion;
|
|
14
13
|
/**
|
|
15
14
|
* This function is called before a block type that requires insertion
|
|
16
15
|
* (component, slot outlet, if, for) is created. The state is used for actual
|
|
17
16
|
* insertion on client-side render, and used for node adoption during hydration.
|
|
18
17
|
*/
|
|
19
|
-
function setInsertionState(parent, anchor, logicalIndex
|
|
18
|
+
function setInsertionState(parent, anchor, logicalIndex) {
|
|
20
19
|
insertionParent = parent;
|
|
21
|
-
isLastInsertion = last;
|
|
22
20
|
insertionIndex = logicalIndex;
|
|
23
21
|
if (anchor !== void 0) if (isHydrating$1) insertionAnchor = void 0;
|
|
24
22
|
else {
|
|
@@ -28,7 +26,7 @@ function setInsertionState(parent, anchor, logicalIndex, last) {
|
|
|
28
26
|
else insertionAnchor = void 0;
|
|
29
27
|
}
|
|
30
28
|
function resetInsertionState() {
|
|
31
|
-
insertionParent = insertionAnchor = insertionIndex =
|
|
29
|
+
insertionParent = insertionAnchor = insertionIndex = void 0;
|
|
32
30
|
}
|
|
33
31
|
//#endregion
|
|
34
32
|
//#region packages/runtime-vapor/src/dom/hydration.ts
|
|
@@ -105,14 +103,38 @@ const isComment = (node, data) => node.nodeType === 8 && node.data === data;
|
|
|
105
103
|
function setCurrentHydrationNode(node) {
|
|
106
104
|
currentHydrationNode = node;
|
|
107
105
|
}
|
|
108
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
109
|
-
function locateNextSiblingOfParent(n) {
|
|
110
|
-
if (!n.parentNode) return null;
|
|
111
|
-
return /* @__PURE__ */ _next(n.parentNode) || /* @__PURE__ */ locateNextSiblingOfParent(n.parentNode);
|
|
112
|
-
}
|
|
113
106
|
function advanceHydrationNode(node) {
|
|
114
|
-
|
|
115
|
-
if (
|
|
107
|
+
let next = node.nextSibling;
|
|
108
|
+
if (next && currentHydrationNode === next) return;
|
|
109
|
+
while (!next) {
|
|
110
|
+
const parent = node.parentNode;
|
|
111
|
+
if (!parent) break;
|
|
112
|
+
node = parent;
|
|
113
|
+
next = node.nextSibling;
|
|
114
|
+
}
|
|
115
|
+
if (currentHydrationNode !== next) currentHydrationNode = next;
|
|
116
|
+
}
|
|
117
|
+
function enterHydrationCursor(consumeFragmentStart = false) {
|
|
118
|
+
const resume = insertionParent ? currentHydrationNode : void 0;
|
|
119
|
+
locateHydrationNode(consumeFragmentStart);
|
|
120
|
+
return {
|
|
121
|
+
start: currentHydrationNode,
|
|
122
|
+
resume
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Capture only the outer resume cursor for dynamic wrappers whose inner owner
|
|
127
|
+
* locates the local start later, after the selected inner path is known.
|
|
128
|
+
* This avoids consuming insertion state too early.
|
|
129
|
+
*/
|
|
130
|
+
function captureHydrationCursor() {
|
|
131
|
+
return {
|
|
132
|
+
start: null,
|
|
133
|
+
resume: insertionParent ? currentHydrationNode : void 0
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function exitHydrationCursor(cursor) {
|
|
137
|
+
if (cursor && cursor.resume !== void 0) setCurrentHydrationNode(cursor.resume);
|
|
116
138
|
}
|
|
117
139
|
/**
|
|
118
140
|
* Locate the first non-fragment-comment node and locate the next node
|
|
@@ -220,10 +242,19 @@ function removeHydrationNode(node, close = null) {
|
|
|
220
242
|
}
|
|
221
243
|
remove(node, parent);
|
|
222
244
|
}
|
|
223
|
-
function cleanupHydrationTail(node) {
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
|
|
245
|
+
function cleanupHydrationTail(node, container) {
|
|
246
|
+
const mismatchContainer = container || node.parentElement;
|
|
247
|
+
if (mismatchContainer instanceof Element) warnHydrationChildrenMismatch(mismatchContainer);
|
|
248
|
+
if (!container) {
|
|
249
|
+
removeHydrationNode(node);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
let current = node;
|
|
253
|
+
while (current && current.parentNode === container) {
|
|
254
|
+
const next = locateNextNode(current);
|
|
255
|
+
removeHydrationNode(current);
|
|
256
|
+
current = next;
|
|
257
|
+
}
|
|
227
258
|
}
|
|
228
259
|
function markHydrationAnchor(node) {
|
|
229
260
|
node.$vha = 1;
|
|
@@ -314,8 +345,8 @@ function child(node, logicalIndex) {
|
|
|
314
345
|
return /* @__PURE__ */ _child(node);
|
|
315
346
|
}
|
|
316
347
|
/* @__NO_SIDE_EFFECTS__ */
|
|
317
|
-
function nthChild(node, i) {
|
|
318
|
-
if (isHydrating$1) return locateChildByLogicalIndex(node,
|
|
348
|
+
function nthChild(node, i, logicalIndex = i) {
|
|
349
|
+
if (isHydrating$1) return locateChildByLogicalIndex(node, logicalIndex);
|
|
319
350
|
return node.childNodes[i];
|
|
320
351
|
}
|
|
321
352
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -628,11 +659,18 @@ function setHtmlToBlock(block, value) {
|
|
|
628
659
|
function setDynamicProps(el, args, isSVG) {
|
|
629
660
|
const props = args.length > 1 ? mergeProps(...args) : args[0];
|
|
630
661
|
const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
|
|
662
|
+
const prevProps = el[cacheKey];
|
|
663
|
+
const nextProps = Object.create(null);
|
|
664
|
+
if (prevProps) {
|
|
665
|
+
for (const key in prevProps) if (!(key in props)) setDynamicProp(el, key, null, isSVG);
|
|
666
|
+
}
|
|
667
|
+
for (const key of Object.keys(props)) {
|
|
668
|
+
const value = props[key];
|
|
669
|
+
nextProps[key] = value;
|
|
670
|
+
if (prevProps && key in prevProps && !isOn(key) && (value == null || typeof value !== "object") && Object.is(prevProps[key], value)) continue;
|
|
671
|
+
setDynamicProp(el, key, value, isSVG);
|
|
634
672
|
}
|
|
635
|
-
|
|
673
|
+
el[cacheKey] = nextProps;
|
|
636
674
|
}
|
|
637
675
|
/**
|
|
638
676
|
* @internal
|
|
@@ -734,17 +772,17 @@ function shouldForceHydrate(el, key) {
|
|
|
734
772
|
}
|
|
735
773
|
//#endregion
|
|
736
774
|
//#region packages/runtime-vapor/src/transition.ts
|
|
737
|
-
let
|
|
738
|
-
let
|
|
775
|
+
let applyTransitionHooks;
|
|
776
|
+
let applyTransitionLeaveHooks;
|
|
777
|
+
let isTransitionEnabled = false;
|
|
739
778
|
function registerTransitionHooks(applyHooks, applyLeaveHooks) {
|
|
740
|
-
|
|
741
|
-
|
|
779
|
+
isTransitionEnabled = true;
|
|
780
|
+
applyTransitionHooks = applyHooks;
|
|
781
|
+
applyTransitionLeaveHooks = applyLeaveHooks;
|
|
742
782
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
747
|
-
_applyTransitionLeaveHooks && _applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb);
|
|
783
|
+
const displayName = "VaporTransition";
|
|
784
|
+
function isVaporTransition(component) {
|
|
785
|
+
return getComponentName(component) === displayName;
|
|
748
786
|
}
|
|
749
787
|
//#endregion
|
|
750
788
|
//#region packages/runtime-vapor/src/directives/vShow.ts
|
|
@@ -822,7 +860,6 @@ function setInteropEnabled() {
|
|
|
822
860
|
}
|
|
823
861
|
//#endregion
|
|
824
862
|
//#region packages/runtime-vapor/src/components/Transition.ts
|
|
825
|
-
const displayName = "VaporTransition";
|
|
826
863
|
let registered = false;
|
|
827
864
|
const ensureTransitionHooksRegistered = () => {
|
|
828
865
|
if (!registered) {
|
|
@@ -1037,7 +1074,7 @@ function resolveTransitionBlock(block, onFragment) {
|
|
|
1037
1074
|
}
|
|
1038
1075
|
}
|
|
1039
1076
|
else {
|
|
1040
|
-
if (getComponentName(block.type) ===
|
|
1077
|
+
if (getComponentName(block.type) === "VaporTransition") return void 0;
|
|
1041
1078
|
child = resolveTransitionBlock(block.block, onFragment);
|
|
1042
1079
|
if (child) {
|
|
1043
1080
|
if (child.$key == null) {
|
|
@@ -1144,8 +1181,17 @@ function unsetRef(el) {
|
|
|
1144
1181
|
if (c) c.fn();
|
|
1145
1182
|
}
|
|
1146
1183
|
//#endregion
|
|
1147
|
-
//#region packages/runtime-vapor/src/
|
|
1184
|
+
//#region packages/runtime-vapor/src/keepAlive.ts
|
|
1185
|
+
let isKeepAliveEnabled = false;
|
|
1148
1186
|
let currentKeepAliveCtx = null;
|
|
1187
|
+
let currentCacheKey;
|
|
1188
|
+
function enableKeepAlive() {
|
|
1189
|
+
isKeepAliveEnabled = true;
|
|
1190
|
+
}
|
|
1191
|
+
function withKeepAliveEnabled(value) {
|
|
1192
|
+
enableKeepAlive();
|
|
1193
|
+
return value;
|
|
1194
|
+
}
|
|
1149
1195
|
function setCurrentKeepAliveCtx(ctx) {
|
|
1150
1196
|
try {
|
|
1151
1197
|
return currentKeepAliveCtx;
|
|
@@ -1153,7 +1199,6 @@ function setCurrentKeepAliveCtx(ctx) {
|
|
|
1153
1199
|
currentKeepAliveCtx = ctx;
|
|
1154
1200
|
}
|
|
1155
1201
|
}
|
|
1156
|
-
let currentCacheKey;
|
|
1157
1202
|
function withCurrentCacheKey(key, fn) {
|
|
1158
1203
|
const prev = currentCacheKey;
|
|
1159
1204
|
currentCacheKey = key;
|
|
@@ -1163,7 +1208,7 @@ function withCurrentCacheKey(key, fn) {
|
|
|
1163
1208
|
currentCacheKey = prev;
|
|
1164
1209
|
}
|
|
1165
1210
|
}
|
|
1166
|
-
const VaporKeepAlive = /* @__PURE__ */ defineVaporComponent({
|
|
1211
|
+
const VaporKeepAlive = /* @__PURE__ */ withKeepAliveEnabled(/* @__PURE__ */ defineVaporComponent({
|
|
1167
1212
|
name: "VaporKeepAlive",
|
|
1168
1213
|
__isKeepAlive: true,
|
|
1169
1214
|
props: {
|
|
@@ -1206,7 +1251,13 @@ const VaporKeepAlive = /* @__PURE__ */ defineVaporComponent({
|
|
|
1206
1251
|
const rerender = keepAliveInstance.hmrRerender;
|
|
1207
1252
|
keepAliveInstance.hmrRerender = () => {
|
|
1208
1253
|
keepAliveInstance.exposed = null;
|
|
1209
|
-
cache.forEach((cached) =>
|
|
1254
|
+
cache.forEach((cached) => {
|
|
1255
|
+
unsetShapeFlag(cached);
|
|
1256
|
+
if (cached !== current) {
|
|
1257
|
+
const parentNode = findBlockNode(cached).parentNode;
|
|
1258
|
+
if (parentNode) remove(cached, parentNode);
|
|
1259
|
+
}
|
|
1260
|
+
});
|
|
1210
1261
|
cache.clear();
|
|
1211
1262
|
keys.clear();
|
|
1212
1263
|
keptAliveScopes.forEach((scope) => scope.stop());
|
|
@@ -1373,7 +1424,7 @@ const VaporKeepAlive = /* @__PURE__ */ defineVaporComponent({
|
|
|
1373
1424
|
}
|
|
1374
1425
|
return children;
|
|
1375
1426
|
}
|
|
1376
|
-
});
|
|
1427
|
+
}));
|
|
1377
1428
|
const shouldCache = (block, props, interop = false) => {
|
|
1378
1429
|
const isAsync = isAsyncWrapper(interop ? block.vnode : block);
|
|
1379
1430
|
const type = interop && isInteropEnabled ? block.vnode.type : block.type;
|
|
@@ -1437,8 +1488,12 @@ function deactivate$1(instance, container) {
|
|
|
1437
1488
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentAdded(instance);
|
|
1438
1489
|
}
|
|
1439
1490
|
//#endregion
|
|
1440
|
-
//#region packages/runtime-vapor/src/
|
|
1491
|
+
//#region packages/runtime-vapor/src/suspense.ts
|
|
1492
|
+
let isSuspenseEnabled = false;
|
|
1441
1493
|
let parentSuspense = null;
|
|
1494
|
+
function enableSuspense() {
|
|
1495
|
+
isSuspenseEnabled = true;
|
|
1496
|
+
}
|
|
1442
1497
|
function setParentSuspense(suspense) {
|
|
1443
1498
|
try {
|
|
1444
1499
|
return parentSuspense;
|
|
@@ -1467,16 +1522,22 @@ const vaporInteropImpl = {
|
|
|
1467
1522
|
const propsRef = shallowRef(filterReservedProps(vnode.props));
|
|
1468
1523
|
const slotsRef = shallowRef(vnode.children);
|
|
1469
1524
|
let prevSuspense = null;
|
|
1470
|
-
if (parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
1525
|
+
if (isSuspenseEnabled && parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
1471
1526
|
const dynamicPropSource = [() => propsRef.value];
|
|
1472
1527
|
dynamicPropSource[interopKey] = true;
|
|
1473
1528
|
const instance = vnode.component = createComponent(vnode.type, { $: dynamicPropSource }, { _: slotsRef }, void 0, void 0, parentComponent ? parentComponent.appContext : vnode.appContext, true);
|
|
1474
1529
|
instance.rawPropsRef = propsRef;
|
|
1475
1530
|
instance.rawSlotsRef = slotsRef;
|
|
1476
1531
|
ensureVNodeHookState(instance, vnode);
|
|
1477
|
-
if (parentComponent && isKeepAlive(parentComponent))
|
|
1478
|
-
|
|
1479
|
-
|
|
1532
|
+
if (parentComponent && isKeepAlive(parentComponent)) {
|
|
1533
|
+
enableKeepAlive();
|
|
1534
|
+
instance.shapeFlag = vnode.shapeFlag;
|
|
1535
|
+
}
|
|
1536
|
+
if (vnode.transition) {
|
|
1537
|
+
ensureTransitionHooksRegistered();
|
|
1538
|
+
setTransitionHooks$1(instance, vnode.transition);
|
|
1539
|
+
}
|
|
1540
|
+
if (isSuspenseEnabled && parentSuspense) setParentSuspense(prevSuspense);
|
|
1480
1541
|
const rootEl = getRootElement(instance);
|
|
1481
1542
|
if (rootEl) vnode.el = rootEl;
|
|
1482
1543
|
onVnodeBeforeMount && onVnodeBeforeMount();
|
|
@@ -1513,24 +1574,47 @@ const vaporInteropImpl = {
|
|
|
1513
1574
|
unmount(vnode, doRemove) {
|
|
1514
1575
|
const container = doRemove ? vnode.anchor.parentNode : void 0;
|
|
1515
1576
|
const instance = vnode.component;
|
|
1577
|
+
let slotStartAnchor = null;
|
|
1516
1578
|
if (instance) {
|
|
1517
|
-
if (instance.block)
|
|
1579
|
+
if (instance.block) {
|
|
1580
|
+
const anchor = vnode.anchor;
|
|
1581
|
+
unmountComponent(instance, container);
|
|
1582
|
+
if (!doRemove) {
|
|
1583
|
+
const blockContainer = shouldUseCurrentParent(instance.block) ? anchor && anchor.parentNode : void 0;
|
|
1584
|
+
remove(instance.block, blockContainer);
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1518
1587
|
} else if (vnode.vb) {
|
|
1519
|
-
|
|
1588
|
+
const anchor = vnode.anchor;
|
|
1589
|
+
if (vnode.el && vnode.el !== anchor && isComment(vnode.el, "[")) slotStartAnchor = vnode.el;
|
|
1590
|
+
const blockContainer = container || (shouldUseCurrentParent(vnode.vb) ? anchor && anchor.parentNode : void 0);
|
|
1591
|
+
remove(vnode.vb, blockContainer);
|
|
1520
1592
|
stopVaporSlotScope(vnode);
|
|
1521
1593
|
}
|
|
1522
|
-
|
|
1594
|
+
if (doRemove) {
|
|
1595
|
+
if (slotStartAnchor) {
|
|
1596
|
+
const parent = slotStartAnchor.parentNode;
|
|
1597
|
+
if (parent) remove(slotStartAnchor, parent);
|
|
1598
|
+
}
|
|
1599
|
+
const anchor = vnode.anchor;
|
|
1600
|
+
const parent = anchor.parentNode;
|
|
1601
|
+
if (parent) remove(anchor, parent);
|
|
1602
|
+
}
|
|
1523
1603
|
},
|
|
1604
|
+
/**
|
|
1605
|
+
* vapor slot in vdom
|
|
1606
|
+
*/
|
|
1524
1607
|
slot(n1, n2, container, anchor, parentComponent, parentSuspense) {
|
|
1525
1608
|
if (!n1) {
|
|
1526
1609
|
const slotBlock = renderVaporSlot(n2, parentComponent, parentSuspense);
|
|
1527
1610
|
const selfAnchor = (isFragment(slotBlock) ? slotBlock.anchor : void 0) || /* @__PURE__ */ createTextNode();
|
|
1528
1611
|
insert(n2.el = n2.anchor = selfAnchor, container, anchor);
|
|
1529
1612
|
insert(n2.vb = slotBlock, container, selfAnchor);
|
|
1530
|
-
} else if (n2.vs.slot !== n1.vs.slot) {
|
|
1613
|
+
} else if (!n1.vs || !n2.vs || !n1.vs.slot || !n2.vs.slot || n2.vs.slot !== n1.vs.slot) {
|
|
1531
1614
|
const selfAnchor = n1.anchor;
|
|
1532
1615
|
const parent = selfAnchor.parentNode;
|
|
1533
1616
|
const nextSibling = selfAnchor.nextSibling;
|
|
1617
|
+
const rangeStartAnchor = n1.el && n1.el !== selfAnchor && isComment(n1.el, "[") ? n1.el : void 0;
|
|
1534
1618
|
const oldBlockOwnsAnchor = isFragment(n1.vb) && n1.vb.anchor === selfAnchor;
|
|
1535
1619
|
remove(n1.vb, parent);
|
|
1536
1620
|
stopVaporSlotScope(n1);
|
|
@@ -1544,16 +1628,22 @@ const vaporInteropImpl = {
|
|
|
1544
1628
|
newAnchor = selfAnchor;
|
|
1545
1629
|
insertAnchor = selfAnchor;
|
|
1546
1630
|
}
|
|
1547
|
-
insert(n2.
|
|
1631
|
+
insert(n2.anchor = newAnchor, parent, insertAnchor);
|
|
1632
|
+
n2.el = rangeStartAnchor || newAnchor;
|
|
1548
1633
|
insert(n2.vb = slotBlock, parent, newAnchor);
|
|
1549
1634
|
} else {
|
|
1550
|
-
|
|
1635
|
+
const vs1 = n1.vs;
|
|
1636
|
+
const vs2 = n2.vs;
|
|
1637
|
+
n2.el = n1.el;
|
|
1638
|
+
n2.anchor = n1.anchor;
|
|
1551
1639
|
n2.vb = n1.vb;
|
|
1552
|
-
(
|
|
1553
|
-
|
|
1640
|
+
(vs2.ref = vs1.ref).value = n2.props;
|
|
1641
|
+
vs2.scope = vs1.scope;
|
|
1642
|
+
syncInteropVaporSlotState(n1, n2);
|
|
1554
1643
|
}
|
|
1555
1644
|
},
|
|
1556
1645
|
move(vnode, container, anchor, moveType) {
|
|
1646
|
+
if (vnode.el && vnode.el !== vnode.anchor && isComment(vnode.el, "[")) move(vnode.el, container, anchor, moveType);
|
|
1557
1647
|
move(vnode.vb || vnode.component, container, anchor, moveType);
|
|
1558
1648
|
move(vnode.anchor, container, anchor, moveType);
|
|
1559
1649
|
},
|
|
@@ -1566,12 +1656,17 @@ const vaporInteropImpl = {
|
|
|
1566
1656
|
if (!isHydrating$1 && !isHydrating) return node;
|
|
1567
1657
|
hydrateNode(node, () => {
|
|
1568
1658
|
vnode.vb = renderVaporSlot(vnode, parentComponent, parentSuspense);
|
|
1569
|
-
|
|
1659
|
+
const anchor = isFragment(vnode.vb) && vnode.vb.anchor ? vnode.vb.anchor : currentHydrationNode;
|
|
1660
|
+
if (isComment(node, "[") && isComment(anchor, "]")) {
|
|
1661
|
+
vnode.el = node;
|
|
1662
|
+
vnode.anchor = anchor;
|
|
1663
|
+
} else vnode.anchor = vnode.el = anchor;
|
|
1570
1664
|
if (!!(process.env.NODE_ENV !== "production") && !vnode.anchor) throw new Error(`Failed to locate slot anchor. this is likely a Vue internal bug.`);
|
|
1571
1665
|
});
|
|
1572
1666
|
return isComment(node, "[") ? vnode.anchor.nextSibling : vnode.anchor;
|
|
1573
1667
|
},
|
|
1574
1668
|
setTransitionHooks(component, hooks) {
|
|
1669
|
+
ensureTransitionHooksRegistered();
|
|
1575
1670
|
setTransitionHooks$1(component, hooks);
|
|
1576
1671
|
},
|
|
1577
1672
|
activate(vnode, container, anchor, parentComponent) {
|
|
@@ -1660,13 +1755,16 @@ function resolveVNodeRange(vnode) {
|
|
|
1660
1755
|
const { type, shapeFlag, el, anchor } = vnode;
|
|
1661
1756
|
if (shapeFlag & 64 && el && anchor && anchor !== el) return [el, anchor];
|
|
1662
1757
|
if ((type === Static || type === Fragment) && el && anchor && anchor !== el) return [el, anchor];
|
|
1663
|
-
if (
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
if (subTree && (subTree.type === Static || subTree.type === Fragment) && subEl && subAnchor && subAnchor !== subEl) return [subEl, subAnchor];
|
|
1758
|
+
if (shapeFlag & 6) {
|
|
1759
|
+
const subTree = vnode.component && vnode.component.subTree;
|
|
1760
|
+
if (subTree) return resolveVNodeRange(subTree);
|
|
1761
|
+
}
|
|
1668
1762
|
}
|
|
1669
1763
|
function resolveVNodeNodes(vnode) {
|
|
1764
|
+
if (!isHydrating$1 && vnode.component && isVaporComponent(vnode.component)) {
|
|
1765
|
+
const block = vnode.component.block;
|
|
1766
|
+
if (block) return block;
|
|
1767
|
+
}
|
|
1670
1768
|
const vnodeRange = resolveVNodeRange(vnode);
|
|
1671
1769
|
if (vnodeRange) {
|
|
1672
1770
|
const nodeRange = [];
|
|
@@ -1678,8 +1776,17 @@ function resolveVNodeNodes(vnode) {
|
|
|
1678
1776
|
}
|
|
1679
1777
|
return nodeRange;
|
|
1680
1778
|
}
|
|
1779
|
+
if (vnode.shapeFlag & 6) {
|
|
1780
|
+
const subTree = vnode.component && vnode.component.subTree;
|
|
1781
|
+
if (subTree) return resolveVNodeNodes(subTree);
|
|
1782
|
+
}
|
|
1681
1783
|
return vnode.el;
|
|
1682
1784
|
}
|
|
1785
|
+
function removeAttachedNodes(block, parent) {
|
|
1786
|
+
if (block instanceof Node) {
|
|
1787
|
+
if (block.parentNode === parent) remove(block, parent);
|
|
1788
|
+
} else if (isArray(block)) for (let i = 0; i < block.length; i++) removeAttachedNodes(block[i], parent);
|
|
1789
|
+
}
|
|
1683
1790
|
function appendVnodeUpdatedHook(vnode, hook) {
|
|
1684
1791
|
const props = vnode.props || (vnode.props = {});
|
|
1685
1792
|
const existing = props.onVnodeUpdated;
|
|
@@ -1688,6 +1795,7 @@ function appendVnodeUpdatedHook(vnode, hook) {
|
|
|
1688
1795
|
function trackFragmentVNodeUpdates(frag, vnode) {
|
|
1689
1796
|
const refresh = () => {
|
|
1690
1797
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
1798
|
+
frag.validityPending = false;
|
|
1691
1799
|
if (frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1692
1800
|
};
|
|
1693
1801
|
appendVnodeUpdatedHook(vnode, refresh);
|
|
@@ -1698,6 +1806,7 @@ function trackFragmentVNodeUpdates(frag, vnode) {
|
|
|
1698
1806
|
function mountVNode(internals, vnode, parentComponent) {
|
|
1699
1807
|
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
1700
1808
|
const frag = new VaporFragment([]);
|
|
1809
|
+
frag.validityPending = !isHydrating$1;
|
|
1701
1810
|
frag.vnode = vnode;
|
|
1702
1811
|
frag.$key = vnode.key;
|
|
1703
1812
|
trackFragmentVNodeUpdates(frag, vnode);
|
|
@@ -1714,6 +1823,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1714
1823
|
onScopeDispose(unmount, true);
|
|
1715
1824
|
isMounted = true;
|
|
1716
1825
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
1826
|
+
frag.validityPending = false;
|
|
1717
1827
|
};
|
|
1718
1828
|
frag.insert = (parentNode, anchor, transition) => {
|
|
1719
1829
|
if (isHydrating$1) return;
|
|
@@ -1733,6 +1843,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1733
1843
|
simpleSetCurrentInstance(prev);
|
|
1734
1844
|
}
|
|
1735
1845
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
1846
|
+
frag.validityPending = false;
|
|
1736
1847
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1737
1848
|
};
|
|
1738
1849
|
frag.remove = unmount;
|
|
@@ -1746,10 +1857,11 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1746
1857
|
const useBridge = shouldUseRendererBridge(component);
|
|
1747
1858
|
const comp = useBridge ? ensureRendererBridge(component) : component;
|
|
1748
1859
|
const frag = new VaporFragment([]);
|
|
1860
|
+
frag.validityPending = !isHydrating$1;
|
|
1749
1861
|
const vnode = frag.vnode = createVNode(comp, rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers)));
|
|
1750
1862
|
frag.$key = vnode.key;
|
|
1751
1863
|
trackFragmentVNodeUpdates(frag, vnode);
|
|
1752
|
-
if (currentKeepAliveCtx) {
|
|
1864
|
+
if (isKeepAliveEnabled && currentKeepAliveCtx) {
|
|
1753
1865
|
currentKeepAliveCtx.processShapeFlag(frag);
|
|
1754
1866
|
if (component.__asyncLoader) {
|
|
1755
1867
|
const keepAliveCtx = currentKeepAliveCtx;
|
|
@@ -1788,21 +1900,35 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1788
1900
|
};
|
|
1789
1901
|
let rawRef = null;
|
|
1790
1902
|
let isMounted = false;
|
|
1903
|
+
let isUnmounted = false;
|
|
1904
|
+
let isDomRemoved = false;
|
|
1905
|
+
const removeDom = (parentNode) => {
|
|
1906
|
+
if (!parentNode || isDomRemoved) return;
|
|
1907
|
+
removeAttachedNodes(resolveVNodeNodes(vnode), parentNode);
|
|
1908
|
+
isDomRemoved = true;
|
|
1909
|
+
};
|
|
1791
1910
|
const unmount = (parentNode, transition) => {
|
|
1911
|
+
if (isUnmounted) {
|
|
1912
|
+
if (!transition) removeDom(parentNode);
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1792
1915
|
if (rawRef) setRef(rawRef, null, null, vnode, true);
|
|
1793
1916
|
if (transition) setTransitionHooks(vnode, transition);
|
|
1794
1917
|
if (vnode.shapeFlag & 256) {
|
|
1795
1918
|
deactivate(vnode, parentComponent.ctx.getStorageContainer(), internals, parentComponent, null);
|
|
1796
1919
|
return;
|
|
1797
1920
|
}
|
|
1921
|
+
isUnmounted = true;
|
|
1922
|
+
isMounted = false;
|
|
1798
1923
|
internals.umt(vnode.component, null, !!parentNode);
|
|
1924
|
+
if (!transition) removeDom(parentNode);
|
|
1799
1925
|
};
|
|
1800
1926
|
frag.hydrate = () => {
|
|
1801
1927
|
if (!isHydrating$1) return;
|
|
1802
1928
|
hydrateVNode(vnode, parentComponent);
|
|
1803
|
-
onScopeDispose(unmount, true);
|
|
1804
1929
|
isMounted = true;
|
|
1805
1930
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
1931
|
+
frag.validityPending = false;
|
|
1806
1932
|
};
|
|
1807
1933
|
vnode.scopeId = getCurrentScopeId() || null;
|
|
1808
1934
|
vnode.slotScopeIds = currentSlotScopeIds;
|
|
@@ -1816,12 +1942,12 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1816
1942
|
if (transition) setTransitionHooks(vnode, transition);
|
|
1817
1943
|
internals.mt(vnode, parentNode, anchor, parentComponent, suspense, void 0, false);
|
|
1818
1944
|
if (rawRef) setRef(rawRef, null, null, vnode);
|
|
1819
|
-
onScopeDispose(unmount, true);
|
|
1820
1945
|
isMounted = true;
|
|
1821
1946
|
} else internals.m(vnode, parentNode, anchor, 2, parentComponent);
|
|
1822
1947
|
simpleSetCurrentInstance(prev);
|
|
1823
1948
|
}
|
|
1824
1949
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
1950
|
+
frag.validityPending = false;
|
|
1825
1951
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1826
1952
|
};
|
|
1827
1953
|
frag.remove = unmount;
|
|
@@ -1856,12 +1982,52 @@ function ensureRendererBridge(component) {
|
|
|
1856
1982
|
return bridge;
|
|
1857
1983
|
}
|
|
1858
1984
|
function trackSlotVNodeUpdates(frag, vnode) {
|
|
1859
|
-
|
|
1985
|
+
trackSlotVNodeUpdatesWithRefresh(vnode, () => {
|
|
1860
1986
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
1861
1987
|
if (frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1862
|
-
};
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
function hasValidVNodeContent(vnode) {
|
|
1991
|
+
return !!ensureValidVNode(vnode.type === Fragment && isArray(vnode.children) ? vnode.children : [vnode]);
|
|
1992
|
+
}
|
|
1993
|
+
function isSlotOutletOnlyVNode(vnode) {
|
|
1994
|
+
if (vnode.type === VaporSlot) return true;
|
|
1995
|
+
return vnode.type === Fragment && isArray(vnode.children) && vnode.children.every((child) => isVNode(child) && isSlotOutletOnlyVNode(child));
|
|
1996
|
+
}
|
|
1997
|
+
function hydrateForwardedEmptySlotFragment(vnode, parentComponent) {
|
|
1998
|
+
if (vnode.type !== Fragment || !isArray(vnode.children)) return false;
|
|
1999
|
+
const children = vnode.children;
|
|
2000
|
+
const inheritedEmptySlotEndAnchor = isComment(currentHydrationNode, "]") && isComment(currentHydrationNode.previousSibling, "[") ? currentHydrationNode : null;
|
|
2001
|
+
const slotEndAnchor = getCurrentSlotEndAnchor() || inheritedEmptySlotEndAnchor;
|
|
2002
|
+
const slotStartAnchor = slotEndAnchor && slotEndAnchor.previousSibling;
|
|
2003
|
+
const contentValid = hasValidVNodeContent(vnode);
|
|
2004
|
+
if (!contentValid && currentHydrationNode === slotEndAnchor && slotStartAnchor && isComment(slotStartAnchor, "[")) {
|
|
2005
|
+
vnode.el = slotStartAnchor;
|
|
2006
|
+
vnode.anchor = slotEndAnchor;
|
|
2007
|
+
advanceHydrationNode(slotEndAnchor);
|
|
2008
|
+
return true;
|
|
2009
|
+
}
|
|
2010
|
+
const isEmptyFragmentStart = isComment(currentHydrationNode, "[");
|
|
2011
|
+
const hasSlotOutletChildren = children.length > 0;
|
|
2012
|
+
const slotOutletOnlyChildren = children.every((child) => isVNode(child) && isSlotOutletOnlyVNode(child));
|
|
2013
|
+
if (!isEmptyFragmentStart || !contentValid || !hasSlotOutletChildren || !slotOutletOnlyChildren) return false;
|
|
2014
|
+
const fragmentStartAnchor = currentHydrationNode;
|
|
2015
|
+
const fragmentEndAnchor = locateEndAnchor(fragmentStartAnchor);
|
|
2016
|
+
if (!fragmentEndAnchor || fragmentStartAnchor.nextSibling !== fragmentEndAnchor) return false;
|
|
2017
|
+
vnode.el = fragmentStartAnchor;
|
|
2018
|
+
withHydratingSlotBoundary(() => {
|
|
2019
|
+
children.forEach((child) => {
|
|
2020
|
+
hydrateVNode(child, parentComponent);
|
|
2021
|
+
});
|
|
2022
|
+
});
|
|
2023
|
+
vnode.anchor = fragmentEndAnchor;
|
|
2024
|
+
if (currentHydrationNode === fragmentEndAnchor) advanceHydrationNode(fragmentEndAnchor);
|
|
2025
|
+
return true;
|
|
2026
|
+
}
|
|
2027
|
+
function trackSlotVNodeUpdatesWithRefresh(vnode, refresh) {
|
|
2028
|
+
const onUpdated = () => refresh();
|
|
1863
2029
|
const track = (node) => {
|
|
1864
|
-
appendVnodeUpdatedHook(node,
|
|
2030
|
+
appendVnodeUpdatedHook(node, onUpdated);
|
|
1865
2031
|
if (node.type === Fragment && isArray(node.children)) node.children.forEach((child) => {
|
|
1866
2032
|
if (isVNode(child)) track(child);
|
|
1867
2033
|
});
|
|
@@ -1874,117 +2040,157 @@ function trackSlotVNodeUpdates(frag, vnode) {
|
|
|
1874
2040
|
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
1875
2041
|
const suspense = parentSuspense || parentComponent.suspense;
|
|
1876
2042
|
const frag = new VaporFragment([]);
|
|
2043
|
+
trackSlotBoundaryDirtying(frag);
|
|
2044
|
+
frag.validityPending = !isHydrating$1;
|
|
1877
2045
|
const instance = currentInstance;
|
|
1878
|
-
const slotOwner = currentSlotOwner;
|
|
1879
|
-
if (fallback && !frag.fallback) frag.fallback = fallback;
|
|
1880
2046
|
let isMounted = false;
|
|
1881
|
-
|
|
1882
|
-
|
|
2047
|
+
const contentState = {
|
|
2048
|
+
nodes: [],
|
|
2049
|
+
valid: false,
|
|
2050
|
+
rendered: null
|
|
2051
|
+
};
|
|
1883
2052
|
let currentParentNode;
|
|
1884
2053
|
let currentAnchor;
|
|
1885
|
-
let
|
|
2054
|
+
let disposed = false;
|
|
2055
|
+
const scope = effectScope();
|
|
2056
|
+
const inheritedBoundary = frag.inheritedSlotBoundary;
|
|
2057
|
+
const controller = new SlotFallbackController({
|
|
2058
|
+
getParentBoundary: () => inheritedBoundary,
|
|
2059
|
+
getLocalFallback: () => wrappedLocalFallback,
|
|
2060
|
+
getContent: () => contentState.nodes,
|
|
2061
|
+
getParentNode: () => {
|
|
2062
|
+
if (currentParentNode) return currentParentNode;
|
|
2063
|
+
const carrierAnchor = findFirstSlotFallbackCarrierNode(contentState.nodes);
|
|
2064
|
+
return carrierAnchor ? carrierAnchor.parentNode : null;
|
|
2065
|
+
},
|
|
2066
|
+
getAnchor: () => currentAnchor || null,
|
|
2067
|
+
isContentValid: () => contentState.valid,
|
|
2068
|
+
runWithRenderCtx: (fn) => runWithFragmentRenderCtx(frag, fn),
|
|
2069
|
+
isDisposed: () => disposed,
|
|
2070
|
+
onValidityChange: () => {}
|
|
2071
|
+
});
|
|
2072
|
+
const wrappedLocalFallback = fallback ? controller.wrapFallback(() => fallback(internals, parentComponent)) : void 0;
|
|
2073
|
+
const updateNodes = () => {
|
|
2074
|
+
frag.nodes = controller.getEffectiveOutput();
|
|
2075
|
+
};
|
|
2076
|
+
const setRenderedContent = (rendered) => {
|
|
2077
|
+
contentState.rendered = rendered;
|
|
2078
|
+
if (isVNode(rendered)) {
|
|
2079
|
+
contentState.nodes = resolveVNodeNodes(rendered);
|
|
2080
|
+
contentState.valid = hasValidVNodeContent(rendered);
|
|
2081
|
+
} else if (rendered) {
|
|
2082
|
+
contentState.nodes = rendered;
|
|
2083
|
+
contentState.valid = isValidBlock(rendered);
|
|
2084
|
+
} else {
|
|
2085
|
+
contentState.nodes = [];
|
|
2086
|
+
contentState.valid = false;
|
|
2087
|
+
}
|
|
2088
|
+
frag.validityPending = false;
|
|
2089
|
+
};
|
|
2090
|
+
const notifyUpdated = () => {
|
|
2091
|
+
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
2092
|
+
};
|
|
2093
|
+
const finishContentUpdate = (forceFallbackRecheck = false) => {
|
|
2094
|
+
controller.recheck(forceFallbackRecheck);
|
|
2095
|
+
updateNodes();
|
|
2096
|
+
notifyUpdated();
|
|
2097
|
+
};
|
|
1886
2098
|
frag.insert = (parentNode, anchor) => {
|
|
1887
2099
|
if (isHydrating$1) return;
|
|
1888
|
-
currentParentNode = parentNode;
|
|
2100
|
+
currentParentNode = parentNode || void 0;
|
|
1889
2101
|
currentAnchor = anchor;
|
|
1890
2102
|
if (!isMounted) {
|
|
1891
2103
|
scope.run(render);
|
|
1892
2104
|
isMounted = true;
|
|
1893
|
-
} else
|
|
1894
|
-
|
|
1895
|
-
|
|
2105
|
+
} else {
|
|
2106
|
+
if (isVNode(contentState.rendered)) internals.m(contentState.rendered, parentNode, anchor, 2, parentComponent);
|
|
2107
|
+
else if (contentState.rendered) insert(contentState.rendered, parentNode, anchor);
|
|
2108
|
+
controller.relocate();
|
|
2109
|
+
}
|
|
2110
|
+
notifyUpdated();
|
|
1896
2111
|
};
|
|
1897
2112
|
frag.remove = (parentNode) => {
|
|
2113
|
+
currentParentNode = parentNode || currentParentNode || void 0;
|
|
2114
|
+
currentAnchor = currentAnchor || null;
|
|
1898
2115
|
scope.stop();
|
|
1899
|
-
|
|
1900
|
-
|
|
2116
|
+
disposed = true;
|
|
2117
|
+
if (isVNode(contentState.rendered)) internals.um(contentState.rendered, parentComponent, null, !!parentNode);
|
|
2118
|
+
else if (contentState.rendered) remove(contentState.rendered, parentNode);
|
|
2119
|
+
controller.dispose();
|
|
1901
2120
|
};
|
|
1902
2121
|
const render = () => {
|
|
1903
2122
|
const prev = currentInstance;
|
|
1904
2123
|
simpleSetCurrentInstance(instance);
|
|
1905
2124
|
try {
|
|
1906
2125
|
renderEffect(() => {
|
|
1907
|
-
|
|
1908
|
-
try {
|
|
1909
|
-
const effectiveFallback = frag.fallback || fallback;
|
|
2126
|
+
runWithFragmentRenderCtx(frag, () => withOwnedSlotBoundary(controller.boundary, () => {
|
|
1910
2127
|
let slotContent;
|
|
1911
|
-
let
|
|
1912
|
-
let emptyFrag = null;
|
|
2128
|
+
let slotContentValid = false;
|
|
1913
2129
|
if (slotsRef.value) {
|
|
1914
2130
|
slotContent = renderSlot(slotsRef.value, isFunction(name) ? name() : name, props);
|
|
1915
|
-
if (isVNode(slotContent)) {
|
|
2131
|
+
if (isVNode(slotContent)) if (slotContent.type === Fragment) {
|
|
1916
2132
|
const children = slotContent.children;
|
|
1917
|
-
ensureVaporSlotFallback(children,
|
|
1918
|
-
|
|
1919
|
-
} else
|
|
1920
|
-
|
|
1921
|
-
isEmpty = !isValidBlock(slotContent);
|
|
1922
|
-
}
|
|
2133
|
+
ensureVaporSlotFallback(children, wrappedLocalFallback);
|
|
2134
|
+
slotContentValid = hasValidVNodeContent(slotContent);
|
|
2135
|
+
} else slotContentValid = true;
|
|
2136
|
+
else if (slotContent) slotContentValid = isValidBlock(slotContent);
|
|
1923
2137
|
}
|
|
1924
|
-
let resolved = slotContent;
|
|
1925
|
-
if (isEmpty && effectiveFallback) if (isVNode(slotContent)) resolved = effectiveFallback(internals, parentComponent);
|
|
1926
|
-
else if (slotContent) resolved = renderSlotFallback(slotContent, () => effectiveFallback(internals, parentComponent), emptyFrag);
|
|
1927
|
-
else resolved = effectiveFallback(internals, parentComponent);
|
|
1928
2138
|
if (isHydrating$1) {
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
frag
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
frag.nodes = resolved;
|
|
2139
|
+
const hydratedContent = slotContent && (slotContentValid || !controller.hasFallback()) ? slotContent : void 0;
|
|
2140
|
+
if (isVNode(hydratedContent)) {
|
|
2141
|
+
frag.vnode = hydratedContent;
|
|
2142
|
+
frag.$key = getVNodeKey(hydratedContent);
|
|
2143
|
+
trackSlotVNodeUpdates(frag, hydratedContent);
|
|
2144
|
+
if (!hydrateForwardedEmptySlotFragment(hydratedContent, parentComponent)) hydrateVNode(hydratedContent, parentComponent);
|
|
2145
|
+
setRenderedContent(hydratedContent);
|
|
2146
|
+
} else if (hydratedContent) {
|
|
2147
|
+
frag.vnode = null;
|
|
2148
|
+
frag.$key = void 0;
|
|
2149
|
+
setRenderedContent(hydratedContent);
|
|
1941
2150
|
} else {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
2151
|
+
frag.vnode = null;
|
|
2152
|
+
frag.$key = void 0;
|
|
2153
|
+
setRenderedContent(null);
|
|
1945
2154
|
}
|
|
2155
|
+
finishContentUpdate(true);
|
|
1946
2156
|
return;
|
|
1947
2157
|
}
|
|
1948
|
-
if (isVNode(
|
|
1949
|
-
frag.vnode =
|
|
1950
|
-
frag.$key = getVNodeKey(
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
2158
|
+
if (isVNode(slotContent)) {
|
|
2159
|
+
frag.vnode = slotContent;
|
|
2160
|
+
frag.$key = getVNodeKey(slotContent);
|
|
2161
|
+
trackSlotVNodeUpdatesWithRefresh(slotContent, () => {
|
|
2162
|
+
const prevValid = contentState.valid;
|
|
2163
|
+
const prevOutput = frag.nodes;
|
|
2164
|
+
setRenderedContent(slotContent);
|
|
2165
|
+
controller.recheck();
|
|
2166
|
+
updateNodes();
|
|
2167
|
+
if (contentState.valid !== prevValid || !isSameResolvedOutput(prevOutput, frag.nodes)) notifyUpdated();
|
|
2168
|
+
});
|
|
2169
|
+
const prevRendered = contentState.rendered;
|
|
2170
|
+
if (prevRendered && !isVNode(prevRendered)) remove(prevRendered, currentParentNode);
|
|
2171
|
+
internals.p(isVNode(prevRendered) ? prevRendered : null, slotContent, currentParentNode, currentAnchor, parentComponent, suspense, void 0, slotContent.slotScopeIds);
|
|
2172
|
+
setRenderedContent(slotContent);
|
|
2173
|
+
finishContentUpdate();
|
|
1959
2174
|
return;
|
|
1960
2175
|
}
|
|
1961
|
-
if (
|
|
2176
|
+
if (slotContent) {
|
|
1962
2177
|
frag.vnode = null;
|
|
1963
2178
|
frag.$key = void 0;
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
currentBlock = resolved;
|
|
1971
|
-
frag.nodes = resolved;
|
|
2179
|
+
const prevRendered = contentState.rendered;
|
|
2180
|
+
if (isVNode(prevRendered)) internals.um(prevRendered, parentComponent, null, true);
|
|
2181
|
+
else if (prevRendered) remove(prevRendered, currentParentNode);
|
|
2182
|
+
insert(slotContent, currentParentNode, currentAnchor);
|
|
2183
|
+
setRenderedContent(slotContent);
|
|
2184
|
+
finishContentUpdate();
|
|
1972
2185
|
return;
|
|
1973
2186
|
}
|
|
1974
|
-
if (
|
|
1975
|
-
|
|
1976
|
-
currentBlock = null;
|
|
1977
|
-
}
|
|
1978
|
-
if (currentVNode) {
|
|
1979
|
-
internals.um(currentVNode, parentComponent, null, true);
|
|
1980
|
-
currentVNode = null;
|
|
1981
|
-
}
|
|
2187
|
+
if (isVNode(contentState.rendered)) internals.um(contentState.rendered, parentComponent, null, true);
|
|
2188
|
+
else if (contentState.rendered) remove(contentState.rendered, currentParentNode);
|
|
1982
2189
|
frag.vnode = null;
|
|
1983
2190
|
frag.$key = void 0;
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
}
|
|
2191
|
+
setRenderedContent(null);
|
|
2192
|
+
finishContentUpdate();
|
|
2193
|
+
}));
|
|
1988
2194
|
});
|
|
1989
2195
|
} finally {
|
|
1990
2196
|
simpleSetCurrentInstance(prev);
|
|
@@ -1999,7 +2205,14 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
1999
2205
|
};
|
|
2000
2206
|
return frag;
|
|
2001
2207
|
}
|
|
2208
|
+
function shouldUseCurrentParent(block) {
|
|
2209
|
+
if (isVaporComponent(block)) return isKeepAlive(block) || shouldUseCurrentParent(block.block);
|
|
2210
|
+
if (isArray(block)) return block.some(shouldUseCurrentParent);
|
|
2211
|
+
if (isFragment(block)) return shouldUseCurrentParent(block.nodes);
|
|
2212
|
+
return false;
|
|
2213
|
+
}
|
|
2002
2214
|
const vaporInteropPlugin = (app) => {
|
|
2215
|
+
enableSuspense();
|
|
2003
2216
|
setInteropEnabled();
|
|
2004
2217
|
const internals = ensureRenderer().internals;
|
|
2005
2218
|
app._context.vapor = extend(vaporInteropImpl, {
|
|
@@ -2021,40 +2234,188 @@ function hydrateVNode(vnode, parentComponent) {
|
|
|
2021
2234
|
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
2022
2235
|
else advanceHydrationNode(node);
|
|
2023
2236
|
}
|
|
2024
|
-
function
|
|
2237
|
+
function createFallback(fallback, parentComponent, isVNodeFallback) {
|
|
2025
2238
|
const internals = ensureRenderer().internals;
|
|
2026
2239
|
return () => {
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2240
|
+
if (isVNodeFallback()) {
|
|
2241
|
+
const frag = createVNodeChildrenFragment(internals, () => fallback().map(normalizeVNode), parentComponent);
|
|
2242
|
+
if (isHydrating$1 && frag.hydrate) frag.hydrate();
|
|
2243
|
+
return frag;
|
|
2244
|
+
}
|
|
2245
|
+
return fallback();
|
|
2030
2246
|
};
|
|
2031
2247
|
}
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2248
|
+
const renderEmptyVNodes = () => [];
|
|
2249
|
+
function runWithFragmentRenderCtx(fragment, fn) {
|
|
2250
|
+
const prevSlotOwner = setCurrentSlotOwner(fragment.slotOwner);
|
|
2251
|
+
let prevKeepAliveCtx = null;
|
|
2252
|
+
if (isKeepAliveEnabled) prevKeepAliveCtx = setCurrentKeepAliveCtx(fragment.keepAliveCtx || null);
|
|
2253
|
+
try {
|
|
2254
|
+
return withOwnedSlotBoundary(fragment.inheritedSlotBoundary, fn);
|
|
2255
|
+
} finally {
|
|
2256
|
+
if (isKeepAliveEnabled) setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
2257
|
+
setCurrentSlotOwner(prevSlotOwner);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
function composeInteropLocalFallback(localFallback, outletFallback) {
|
|
2261
|
+
if (!localFallback) return outletFallback;
|
|
2262
|
+
if (!outletFallback) return localFallback;
|
|
2263
|
+
return (...args) => {
|
|
2264
|
+
const local = localFallback(...args);
|
|
2265
|
+
if (isValidBlock(local)) return local;
|
|
2266
|
+
const outlet = outletFallback(...args);
|
|
2267
|
+
return resolveSlotFallbackCarrierOwner(local) ? [outlet, local] : outlet;
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
function resolveInteropVaporSlotState(vnode) {
|
|
2271
|
+
const slot = vnode.vs;
|
|
2272
|
+
let state = slot.state;
|
|
2273
|
+
if (!state) {
|
|
2274
|
+
state = {
|
|
2275
|
+
localFallback: shallowRef(slot.fallback),
|
|
2276
|
+
outletFallback: shallowRef(slot.outletFallback)
|
|
2277
|
+
};
|
|
2278
|
+
slot.state = state;
|
|
2279
|
+
}
|
|
2280
|
+
return state;
|
|
2281
|
+
}
|
|
2282
|
+
function syncInteropVaporSlotState(n1, n2) {
|
|
2283
|
+
const prevState = n1.vs.state;
|
|
2284
|
+
if (!prevState) return;
|
|
2285
|
+
n2.vs.state = prevState;
|
|
2286
|
+
prevState.localFallback.value = n2.vs.fallback;
|
|
2287
|
+
prevState.outletFallback.value = n2.vs.outletFallback;
|
|
2288
|
+
}
|
|
2289
|
+
function trackInteropFallbackChanges(scope, state, onChange) {
|
|
2290
|
+
if (!scope) return;
|
|
2291
|
+
let trackedLocalFallback;
|
|
2292
|
+
let trackedOutletFallback;
|
|
2293
|
+
let initialized = false;
|
|
2294
|
+
scope.run(() => {
|
|
2295
|
+
renderEffect(() => {
|
|
2296
|
+
const nextLocalFallback = state.localFallback.value;
|
|
2297
|
+
const nextOutletFallback = state.outletFallback.value;
|
|
2298
|
+
if (!initialized) {
|
|
2299
|
+
trackedLocalFallback = nextLocalFallback;
|
|
2300
|
+
trackedOutletFallback = nextOutletFallback;
|
|
2301
|
+
initialized = true;
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
if (trackedLocalFallback === nextLocalFallback && trackedOutletFallback === nextOutletFallback) return;
|
|
2305
|
+
trackedLocalFallback = nextLocalFallback;
|
|
2306
|
+
trackedOutletFallback = nextOutletFallback;
|
|
2307
|
+
onChange();
|
|
2308
|
+
}, true);
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2037
2311
|
function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
2038
2312
|
const prev = currentInstance;
|
|
2039
2313
|
let prevSuspense = null;
|
|
2040
2314
|
simpleSetCurrentInstance(parentComponent);
|
|
2041
|
-
if (parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
2315
|
+
if (isSuspenseEnabled && parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
2042
2316
|
try {
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2317
|
+
if (!vnode.vs || !vnode.vs.slot) return [];
|
|
2318
|
+
const slotState = resolveInteropVaporSlotState(vnode);
|
|
2319
|
+
const frag = new VaporFragment([]);
|
|
2320
|
+
frag.validityPending = !isHydrating$1;
|
|
2321
|
+
const inheritedBoundary = frag.inheritedSlotBoundary;
|
|
2322
|
+
let contentNodes = [];
|
|
2323
|
+
let isResolvingContent = false;
|
|
2324
|
+
let wrappedLocalFallback;
|
|
2325
|
+
let wrappedOutletFallback;
|
|
2326
|
+
let currentParentNode = null;
|
|
2327
|
+
let currentAnchor = null;
|
|
2328
|
+
let slotScope;
|
|
2329
|
+
let disposed = false;
|
|
2330
|
+
const controller = new SlotFallbackController({
|
|
2331
|
+
getParentBoundary: () => inheritedBoundary,
|
|
2332
|
+
getLocalFallback: () => composeInteropLocalFallback(slotState.localFallback.value ? wrappedLocalFallback : void 0, slotState.outletFallback.value ? wrappedOutletFallback : void 0),
|
|
2333
|
+
getContent: () => contentNodes,
|
|
2334
|
+
getParentNode: () => {
|
|
2335
|
+
if (currentParentNode) return currentParentNode;
|
|
2336
|
+
const carrierAnchor = findFirstSlotFallbackCarrierNode(contentNodes);
|
|
2337
|
+
return carrierAnchor ? carrierAnchor.parentNode : null;
|
|
2338
|
+
},
|
|
2339
|
+
getAnchor: () => currentAnchor,
|
|
2340
|
+
runWithRenderCtx: (fn) => runWithFragmentRenderCtx(frag, fn),
|
|
2341
|
+
isBusy: () => isResolvingContent,
|
|
2342
|
+
isDisposed: () => disposed,
|
|
2343
|
+
syncEffectiveOutput: () => {
|
|
2344
|
+
frag.nodes = controller.getEffectiveOutput();
|
|
2345
|
+
frag.validityPending = false;
|
|
2346
|
+
},
|
|
2347
|
+
onValidityChange: () => {
|
|
2348
|
+
if (inheritedBoundary) inheritedBoundary.markDirty();
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
const dispose = (parentNode) => {
|
|
2352
|
+
if (disposed) return;
|
|
2353
|
+
currentParentNode = parentNode || currentParentNode;
|
|
2354
|
+
disposed = true;
|
|
2355
|
+
controller.dispose();
|
|
2356
|
+
slotScope = void 0;
|
|
2357
|
+
currentParentNode = null;
|
|
2358
|
+
currentAnchor = null;
|
|
2359
|
+
};
|
|
2360
|
+
try {
|
|
2361
|
+
wrappedLocalFallback = controller.wrapFallback(createFallback(() => (slotState.localFallback.value || renderEmptyVNodes)(), parentComponent, () => !!slotState.localFallback.value && !!slotState.localFallback.value.__vdom));
|
|
2362
|
+
wrappedOutletFallback = controller.wrapFallback(createFallback(() => (slotState.outletFallback.value || renderEmptyVNodes)(), parentComponent, () => !!slotState.outletFallback.value && !!slotState.outletFallback.value.__vdom));
|
|
2363
|
+
const preferSlotFragmentOwnership = !!slotState.localFallback.value || !!slotState.outletFallback.value;
|
|
2364
|
+
controller.clearPendingRecheck();
|
|
2365
|
+
const finalizeResolvedContent = (resolvedContent) => {
|
|
2366
|
+
if (preferSlotFragmentOwnership && resolvedContent instanceof SlotFragment) return resolvedContent;
|
|
2367
|
+
contentNodes = resolvedContent || [];
|
|
2368
|
+
controller.recheck(controller.takePendingRecheck());
|
|
2369
|
+
return resolvedContent;
|
|
2370
|
+
};
|
|
2371
|
+
let resolvedContent;
|
|
2372
|
+
isResolvingContent = true;
|
|
2373
|
+
try {
|
|
2374
|
+
if (isHydrating$1) resolvedContent = withHydratingSlotBoundary(() => finalizeResolvedContent(runWithFragmentRenderCtx(frag, () => {
|
|
2375
|
+
const renderSlot = () => withOwnedSlotBoundary(controller.boundary, () => invokeVaporSlot(vnode));
|
|
2376
|
+
return controller.hasFallback() ? withHydratingSlotFallbackActive(renderSlot) : renderSlot();
|
|
2377
|
+
})));
|
|
2378
|
+
else resolvedContent = finalizeResolvedContent(runWithFragmentRenderCtx(frag, () => withOwnedSlotBoundary(controller.boundary, () => invokeVaporSlot(vnode))));
|
|
2379
|
+
} finally {
|
|
2380
|
+
isResolvingContent = false;
|
|
2381
|
+
}
|
|
2382
|
+
const nextScope = vnode.vs.scope;
|
|
2383
|
+
if (nextScope && slotScope !== nextScope && !disposed) {
|
|
2384
|
+
slotScope = nextScope;
|
|
2385
|
+
nextScope.run(() => {
|
|
2386
|
+
onScopeDispose(() => dispose(), true);
|
|
2387
|
+
});
|
|
2388
|
+
}
|
|
2389
|
+
if (preferSlotFragmentOwnership && resolvedContent instanceof SlotFragment) {
|
|
2390
|
+
dispose();
|
|
2391
|
+
return resolvedContent;
|
|
2392
|
+
}
|
|
2393
|
+
controller.clearPendingRecheck();
|
|
2394
|
+
frag.insert = (parentNode, anchor) => {
|
|
2395
|
+
currentParentNode = parentNode;
|
|
2396
|
+
currentAnchor = anchor;
|
|
2397
|
+
if (controller.getActiveFallback()) {
|
|
2398
|
+
controller.relocate();
|
|
2399
|
+
mutateSlotFallbackCarrier(contentNodes, (block) => insert(block, parentNode, anchor));
|
|
2400
|
+
} else insert(frag.nodes, parentNode, anchor);
|
|
2401
|
+
};
|
|
2402
|
+
frag.remove = (parentNode) => {
|
|
2403
|
+
if (controller.getActiveFallback()) mutateSlotFallbackCarrier(contentNodes, (block) => remove(block, parentNode));
|
|
2404
|
+
else remove(frag.nodes, parentNode);
|
|
2405
|
+
dispose(parentNode);
|
|
2406
|
+
};
|
|
2407
|
+
trackInteropFallbackChanges(vnode.vs.scope, slotState, () => {
|
|
2408
|
+
controller.recheck(true);
|
|
2409
|
+
controller.syncActiveFallback();
|
|
2410
|
+
});
|
|
2047
2411
|
return frag;
|
|
2412
|
+
} catch (e) {
|
|
2413
|
+
dispose();
|
|
2414
|
+
stopVaporSlotScope(vnode);
|
|
2415
|
+
throw e;
|
|
2048
2416
|
}
|
|
2049
|
-
if (!fallback) return invokeVaporSlot(vnode);
|
|
2050
|
-
let slotBlock = invokeVaporSlot(vnode);
|
|
2051
|
-
const vaporFallback = createVaporFallback(fallback, parentComponent);
|
|
2052
|
-
if (!slotBlock) return vaporFallback();
|
|
2053
|
-
const emptyFrag = attachSlotFallback(slotBlock, vaporFallback);
|
|
2054
|
-
if (!isValidBlock(slotBlock)) slotBlock = renderSlotFallback(slotBlock, vaporFallback, emptyFrag);
|
|
2055
|
-
return slotBlock;
|
|
2056
2417
|
} finally {
|
|
2057
|
-
if (parentSuspense) setParentSuspense(prevSuspense);
|
|
2418
|
+
if (isSuspenseEnabled && parentSuspense) setParentSuspense(prevSuspense);
|
|
2058
2419
|
simpleSetCurrentInstance(prev);
|
|
2059
2420
|
}
|
|
2060
2421
|
}
|
|
@@ -2118,38 +2479,60 @@ function ensureVNodeHookState(instance, vnode) {
|
|
|
2118
2479
|
function createVNodeChildrenFragment(internals, render, parentComponent) {
|
|
2119
2480
|
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
2120
2481
|
const frag = new VaporFragment([]);
|
|
2482
|
+
frag.validityPending = !isHydrating$1;
|
|
2121
2483
|
let currentVNode = null;
|
|
2122
2484
|
let currentChildren = [];
|
|
2123
2485
|
let currentParentNode = null;
|
|
2124
2486
|
let currentAnchor = null;
|
|
2125
2487
|
let isMounted = false;
|
|
2126
2488
|
const scope = effectScope();
|
|
2489
|
+
const syncResolvedNodes = (children = currentChildren) => {
|
|
2490
|
+
const prevValid = frag.validityPending ? true : isValidBlock(frag.nodes);
|
|
2491
|
+
if (children.length === 0) frag.nodes = [];
|
|
2492
|
+
else if (children.length === 1) frag.nodes = resolveVNodeNodes(children[0]);
|
|
2493
|
+
else frag.nodes = children.map(resolveVNodeNodes);
|
|
2494
|
+
frag.validityPending = false;
|
|
2495
|
+
return prevValid !== isValidBlock(frag.nodes);
|
|
2496
|
+
};
|
|
2497
|
+
const notifyUpdated = (validityChanged = false) => {
|
|
2498
|
+
if (validityChanged && frag.inheritedSlotBoundary) frag.inheritedSlotBoundary.markDirty();
|
|
2499
|
+
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((hook) => hook());
|
|
2500
|
+
};
|
|
2127
2501
|
const renderContent = () => {
|
|
2128
2502
|
const prev = currentInstance;
|
|
2129
2503
|
simpleSetCurrentInstance(parentComponent);
|
|
2130
2504
|
try {
|
|
2131
2505
|
renderEffect(() => {
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2506
|
+
runWithFragmentRenderCtx(frag, () => {
|
|
2507
|
+
const nextChildren = render();
|
|
2508
|
+
if (isHydrating$1) {
|
|
2509
|
+
nextChildren.forEach((vnode) => hydrateVNode(vnode, parentComponent));
|
|
2510
|
+
currentChildren = nextChildren;
|
|
2511
|
+
currentVNode = createVNode(Fragment, null, nextChildren);
|
|
2512
|
+
currentParentNode = currentHydrationNode.parentNode;
|
|
2513
|
+
currentAnchor = currentHydrationNode;
|
|
2514
|
+
if (frag.inheritedSlotBoundary && currentAnchor && isHydrationAnchor(currentAnchor) && currentAnchor !== getCurrentSlotEndAnchor() && currentAnchor.nextSibling) currentAnchor = currentAnchor.nextSibling;
|
|
2515
|
+
} else if (!currentVNode) {
|
|
2516
|
+
currentChildren = nextChildren;
|
|
2517
|
+
currentVNode = createVNode(Fragment, null, nextChildren);
|
|
2518
|
+
trackSlotVNodeUpdatesWithRefresh(currentVNode, () => {
|
|
2519
|
+
notifyUpdated(syncResolvedNodes(nextChildren));
|
|
2520
|
+
});
|
|
2521
|
+
if (nextChildren.length) internals.mc(nextChildren, currentParentNode, currentAnchor, parentComponent, suspense, void 0, null, false);
|
|
2522
|
+
} else {
|
|
2523
|
+
const nextVNode = createVNode(Fragment, null, nextChildren);
|
|
2524
|
+
trackSlotVNodeUpdatesWithRefresh(nextVNode, () => {
|
|
2525
|
+
notifyUpdated(syncResolvedNodes(nextChildren));
|
|
2526
|
+
});
|
|
2527
|
+
internals.pc(currentVNode, nextVNode, currentParentNode, currentAnchor, parentComponent, suspense, void 0, null, false);
|
|
2528
|
+
currentChildren = nextChildren;
|
|
2529
|
+
currentVNode = nextVNode;
|
|
2530
|
+
}
|
|
2531
|
+
const validityChanged = syncResolvedNodes();
|
|
2532
|
+
if (isHydrating$1) {
|
|
2533
|
+
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((hook) => hook());
|
|
2534
|
+
} else notifyUpdated(validityChanged);
|
|
2535
|
+
});
|
|
2153
2536
|
});
|
|
2154
2537
|
} finally {
|
|
2155
2538
|
simpleSetCurrentInstance(prev);
|
|
@@ -2179,6 +2562,9 @@ function createVNodeChildrenFragment(internals, render, parentComponent) {
|
|
|
2179
2562
|
};
|
|
2180
2563
|
return frag;
|
|
2181
2564
|
}
|
|
2565
|
+
function isSameResolvedOutput(prev, next) {
|
|
2566
|
+
return prev === next || isArray(prev) && isArray(next) && prev.length === next.length && prev.every((node, index) => node === next[index]);
|
|
2567
|
+
}
|
|
2182
2568
|
//#endregion
|
|
2183
2569
|
//#region packages/runtime-vapor/src/componentEmits.ts
|
|
2184
2570
|
/**
|
|
@@ -2219,10 +2605,10 @@ function resolveFunctionSource(source) {
|
|
|
2219
2605
|
if (source._cache) return source._cache.value;
|
|
2220
2606
|
const parent = currentInstance && currentInstance.parent;
|
|
2221
2607
|
if (parent) {
|
|
2222
|
-
source._cache = computed(() => {
|
|
2608
|
+
source._cache = computed((oldValue) => {
|
|
2223
2609
|
const prev = setCurrentInstance(parent);
|
|
2224
2610
|
try {
|
|
2225
|
-
return source();
|
|
2611
|
+
return stabilizeDynamicSourceValue(oldValue, source());
|
|
2226
2612
|
} finally {
|
|
2227
2613
|
setCurrentInstance(...prev);
|
|
2228
2614
|
}
|
|
@@ -2232,12 +2618,23 @@ function resolveFunctionSource(source) {
|
|
|
2232
2618
|
}
|
|
2233
2619
|
return source();
|
|
2234
2620
|
}
|
|
2621
|
+
function stabilizeDynamicSourceValue(oldValue, value) {
|
|
2622
|
+
if (!isPlainObject(oldValue) || !isPlainObject(value)) return value;
|
|
2623
|
+
const oldKeys = Object.keys(oldValue);
|
|
2624
|
+
const newKeys = Object.keys(value);
|
|
2625
|
+
if (oldKeys.length !== newKeys.length) return value;
|
|
2626
|
+
for (let i = 0; i < newKeys.length; i++) {
|
|
2627
|
+
const key = newKeys[i];
|
|
2628
|
+
if (!hasOwn(oldValue, key) || !Object.is(oldValue[key], value[key])) return value;
|
|
2629
|
+
}
|
|
2630
|
+
return oldValue;
|
|
2631
|
+
}
|
|
2235
2632
|
function getPropsProxyHandlers(comp, once) {
|
|
2236
2633
|
if (comp.__propsHandlers) return comp.__propsHandlers;
|
|
2237
2634
|
const propsOptions = normalizePropsOptions(comp)[0];
|
|
2238
2635
|
const emitsOptions = normalizeEmitsOptions(comp);
|
|
2239
2636
|
const isProp = propsOptions ? (key) => isString(key) && hasOwn(propsOptions, camelize(key)) : NO;
|
|
2240
|
-
const isAttr = propsOptions ? (key) => isString(key) && key !== "$" && !isProp(key) && !isEmitListener(emitsOptions, key) : (key) => isString(key);
|
|
2637
|
+
const isAttr = propsOptions || emitsOptions ? (key) => isString(key) && key !== "$" && !isProp(key) && !isEmitListener(emitsOptions, key) : (key) => isString(key);
|
|
2241
2638
|
const getProp = (instance, key) => {
|
|
2242
2639
|
if (key === "__v_isReactive") return true;
|
|
2243
2640
|
if (!isProp(key)) return;
|
|
@@ -2567,18 +2964,19 @@ function withVaporCtx(fn) {
|
|
|
2567
2964
|
function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
2568
2965
|
const _insertionParent = insertionParent;
|
|
2569
2966
|
const _insertionAnchor = insertionAnchor;
|
|
2570
|
-
const _isLastInsertion = isLastInsertion;
|
|
2571
2967
|
if (!isHydrating$1) resetInsertionState();
|
|
2968
|
+
let hydrationCursor = null;
|
|
2572
2969
|
const instance = getScopeOwner();
|
|
2573
2970
|
const rawSlots = instance.rawSlots;
|
|
2574
2971
|
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
2575
2972
|
let fragment;
|
|
2576
2973
|
if (isRef(rawSlots._) && isInteropEnabled) {
|
|
2577
|
-
if (isHydrating$1)
|
|
2974
|
+
if (isHydrating$1) hydrationCursor = enterHydrationCursor();
|
|
2578
2975
|
fragment = instance.appContext.vapor.vdomSlot(rawSlots._, name, slotProps, instance, fallback);
|
|
2579
2976
|
} else {
|
|
2580
|
-
|
|
2581
|
-
|
|
2977
|
+
if (isHydrating$1) hydrationCursor = captureHydrationCursor();
|
|
2978
|
+
const slotFragment = fragment = new SlotFragment();
|
|
2979
|
+
slotFragment.forwarded = currentSlotOwner != null && currentSlotOwner !== currentInstance;
|
|
2582
2980
|
const isDynamicName = isFunction(name);
|
|
2583
2981
|
const slotScopeIds = [];
|
|
2584
2982
|
if (!noSlotted) {
|
|
@@ -2592,14 +2990,18 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
2592
2990
|
renderEffect(() => {
|
|
2593
2991
|
setDynamicProps(el, [slotProps, slotName !== "default" ? { name: slotName } : {}]);
|
|
2594
2992
|
});
|
|
2595
|
-
if (fallback)
|
|
2993
|
+
if (fallback) withOwnedSlotBoundary(slotFragment.parentSlotBoundary, () => {
|
|
2994
|
+
const fallbackBlock = fallback();
|
|
2995
|
+
slotFragment.customElementFallback = fallbackBlock;
|
|
2996
|
+
insert(fallbackBlock, el);
|
|
2997
|
+
});
|
|
2596
2998
|
fragment.nodes = el;
|
|
2597
2999
|
return;
|
|
2598
3000
|
}
|
|
2599
3001
|
const slot = getSlot(rawSlots, slotName);
|
|
2600
3002
|
if (slot) {
|
|
2601
3003
|
const boundMap = slot._boundMap || (slot._boundMap = /* @__PURE__ */ new WeakMap());
|
|
2602
|
-
let bound = boundMap.get(
|
|
3004
|
+
let bound = boundMap.get(slotFragment);
|
|
2603
3005
|
if (!bound) {
|
|
2604
3006
|
bound = () => {
|
|
2605
3007
|
const prevSlotScopeIds = setCurrentSlotScopeIds(slotScopeIds.length > 0 ? slotScopeIds : null);
|
|
@@ -2612,10 +3014,10 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
2612
3014
|
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
2613
3015
|
}
|
|
2614
3016
|
};
|
|
2615
|
-
boundMap.set(
|
|
3017
|
+
boundMap.set(slotFragment, bound);
|
|
2616
3018
|
}
|
|
2617
|
-
|
|
2618
|
-
} else
|
|
3019
|
+
slotFragment.updateSlot(bound, fallback);
|
|
3020
|
+
} else slotFragment.updateSlot(void 0, fallback);
|
|
2619
3021
|
};
|
|
2620
3022
|
if (!once && (isDynamicName || rawSlots.$)) renderEffect(renderSlot);
|
|
2621
3023
|
else renderSlot();
|
|
@@ -2628,7 +3030,7 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
2628
3030
|
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
2629
3031
|
} else {
|
|
2630
3032
|
if (fragment.insert) fragment.hydrate();
|
|
2631
|
-
|
|
3033
|
+
exitHydrationCursor(hydrationCursor);
|
|
2632
3034
|
}
|
|
2633
3035
|
return fragment;
|
|
2634
3036
|
}
|
|
@@ -2692,7 +3094,7 @@ function setBlockKey(block, key) {
|
|
|
2692
3094
|
if (block instanceof Node) block.$key = key;
|
|
2693
3095
|
else if (isVaporComponent(block)) {
|
|
2694
3096
|
block.$key = key;
|
|
2695
|
-
if (block.block) setBlockKey(block.block, key);
|
|
3097
|
+
if ((!isKeepAliveEnabled || !isKeepAlive(block)) && block.block) setBlockKey(block.block, key);
|
|
2696
3098
|
} else if (isArray(block)) {
|
|
2697
3099
|
if (block.length === 1) setBlockKey(block[0], key);
|
|
2698
3100
|
} else {
|
|
@@ -2706,24 +3108,32 @@ function setBlockKey(block, key) {
|
|
|
2706
3108
|
var VaporFragment = class {
|
|
2707
3109
|
constructor(nodes) {
|
|
2708
3110
|
this.vnode = null;
|
|
3111
|
+
this.renderInstance = currentInstance;
|
|
2709
3112
|
this.slotOwner = currentSlotOwner;
|
|
2710
|
-
this.
|
|
3113
|
+
this.inheritedSlotBoundary = currentSlotBoundary;
|
|
2711
3114
|
this.nodes = nodes;
|
|
3115
|
+
if (isKeepAliveEnabled) this.keepAliveCtx = currentKeepAliveCtx;
|
|
2712
3116
|
}
|
|
2713
|
-
runWithRenderCtx(fn) {
|
|
3117
|
+
runWithRenderCtx(fn, scope) {
|
|
3118
|
+
const prevInstance = setCurrentInstance(this.renderInstance, scope);
|
|
2714
3119
|
const prevSlotOwner = setCurrentSlotOwner(this.slotOwner);
|
|
2715
|
-
|
|
3120
|
+
let prevKeepAliveCtx = null;
|
|
3121
|
+
if (isKeepAliveEnabled) prevKeepAliveCtx = setCurrentKeepAliveCtx(this.keepAliveCtx || null);
|
|
3122
|
+
const prevBoundary = setCurrentSlotBoundary(this.inheritedSlotBoundary);
|
|
2716
3123
|
try {
|
|
2717
3124
|
return fn();
|
|
2718
3125
|
} finally {
|
|
2719
|
-
|
|
3126
|
+
setCurrentSlotBoundary(prevBoundary);
|
|
3127
|
+
if (isKeepAliveEnabled) setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
2720
3128
|
setCurrentSlotOwner(prevSlotOwner);
|
|
3129
|
+
setCurrentInstance(...prevInstance);
|
|
2721
3130
|
}
|
|
2722
3131
|
}
|
|
2723
3132
|
};
|
|
2724
3133
|
var ForFragment = class extends VaporFragment {
|
|
2725
3134
|
constructor(nodes) {
|
|
2726
3135
|
super(nodes);
|
|
3136
|
+
trackSlotBoundaryDirtying(this);
|
|
2727
3137
|
}
|
|
2728
3138
|
};
|
|
2729
3139
|
var ForBlock = class extends VaporFragment {
|
|
@@ -2741,7 +3151,6 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2741
3151
|
super([]);
|
|
2742
3152
|
this.hydrate = (isEmpty = false, isSlot = false) => {
|
|
2743
3153
|
if (!isHydrating$1) return;
|
|
2744
|
-
if (this.isAnchorPending) return;
|
|
2745
3154
|
let advanceAfterRestore = null;
|
|
2746
3155
|
let exitHydrationBoundary;
|
|
2747
3156
|
try {
|
|
@@ -2751,6 +3160,40 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2751
3160
|
advanceHydrationNode(currentHydrationNode);
|
|
2752
3161
|
return;
|
|
2753
3162
|
}
|
|
3163
|
+
if (this.anchorLabel && currentHydrationNode && isComment(currentHydrationNode, "teleport anchor")) {
|
|
3164
|
+
const parentNode$1 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
3165
|
+
const anchor = markHydrationAnchor(currentHydrationNode);
|
|
3166
|
+
if (parentNode$1) {
|
|
3167
|
+
queuePostFlushCb(() => {
|
|
3168
|
+
parentNode$1.insertBefore(this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode()), anchor.parentNode === parentNode$1 ? anchor : null);
|
|
3169
|
+
});
|
|
3170
|
+
return;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
if (!isSlot && this.anchorLabel && currentHydrationNode && !isHydratingSlotFallbackActive() && !isComment(currentHydrationNode, "]")) {
|
|
3174
|
+
const parentNode$3 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
3175
|
+
const anchor = locateNextNode(currentHydrationNode);
|
|
3176
|
+
const reusableAnchor = anchor && anchor.nodeType === 8 && isReusableDynamicFragmentAnchor(anchor, this.anchorLabel) && /* @__PURE__ */ parentNode(anchor) ? anchor : null;
|
|
3177
|
+
if (parentNode$3) {
|
|
3178
|
+
this.nodes = [];
|
|
3179
|
+
if (reusableAnchor) {
|
|
3180
|
+
this.anchor = markHydrationAnchor(reusableAnchor);
|
|
3181
|
+
exitHydrationBoundary = enterHydrationBoundary(this.anchor);
|
|
3182
|
+
advanceAfterRestore = this.anchor;
|
|
3183
|
+
} else {
|
|
3184
|
+
if (anchor) exitHydrationBoundary = enterHydrationBoundary(anchor);
|
|
3185
|
+
else {
|
|
3186
|
+
cleanupHydrationTail(currentHydrationNode);
|
|
3187
|
+
setCurrentHydrationNode(null);
|
|
3188
|
+
}
|
|
3189
|
+
queuePostFlushCb(() => {
|
|
3190
|
+
const nextNode = anchor && anchor.parentNode === parentNode$3 ? anchor : null;
|
|
3191
|
+
parentNode$3.insertBefore(this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode()), nextNode);
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
return;
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
2754
3197
|
}
|
|
2755
3198
|
if (this.anchorLabel && !isValidBlock(this.nodes) && this.nodes instanceof Comment && isReusableDynamicFragmentAnchor(this.nodes, this.anchorLabel) && /* @__PURE__ */ parentNode(this.nodes)) {
|
|
2756
3199
|
this.anchor = markHydrationAnchor(this.nodes);
|
|
@@ -2762,9 +3205,9 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2762
3205
|
return;
|
|
2763
3206
|
}
|
|
2764
3207
|
if (this.anchorLabel && !isValidBlock(this.nodes) && this.nodes instanceof Comment && !/* @__PURE__ */ parentNode(this.nodes) && currentHydrationNode) {
|
|
2765
|
-
const parentNode$
|
|
3208
|
+
const parentNode$4 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
2766
3209
|
const nextNode = locateNextNode(currentHydrationNode);
|
|
2767
|
-
if (parentNode$
|
|
3210
|
+
if (parentNode$4) {
|
|
2768
3211
|
this.nodes = [];
|
|
2769
3212
|
if (nextNode) exitHydrationBoundary = enterHydrationBoundary(nextNode);
|
|
2770
3213
|
else {
|
|
@@ -2772,18 +3215,20 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2772
3215
|
setCurrentHydrationNode(null);
|
|
2773
3216
|
}
|
|
2774
3217
|
queuePostFlushCb(() => {
|
|
2775
|
-
parentNode$
|
|
3218
|
+
parentNode$4.insertBefore(this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode()), nextNode);
|
|
2776
3219
|
});
|
|
2777
3220
|
return;
|
|
2778
3221
|
}
|
|
2779
3222
|
}
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
return;
|
|
2786
|
-
|
|
3223
|
+
const currentSlotEndAnchor = getCurrentSlotEndAnchor();
|
|
3224
|
+
if (this.anchorLabel === "if" && currentSlotEndAnchor && isHydratingSlotFallbackActive() && !isValidBlock(this.nodes)) {
|
|
3225
|
+
const endAnchor = currentSlotEndAnchor;
|
|
3226
|
+
queuePostFlushCb(() => {
|
|
3227
|
+
const parentNode = endAnchor.parentNode;
|
|
3228
|
+
if (!parentNode) return;
|
|
3229
|
+
parentNode.insertBefore(this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode()), endAnchor);
|
|
3230
|
+
});
|
|
3231
|
+
return;
|
|
2787
3232
|
}
|
|
2788
3233
|
const forwardedSlot = this.forwarded;
|
|
2789
3234
|
const slotAnchor = isSlot ? currentSlotEndAnchor : null;
|
|
@@ -2796,20 +3241,23 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2796
3241
|
return;
|
|
2797
3242
|
} else if (!!(process.env.NODE_ENV !== "production")) throw new Error(`Failed to locate ${this.anchorLabel} fragment anchor. this is likely a Vue internal bug.`);
|
|
2798
3243
|
}
|
|
2799
|
-
let parentNode$
|
|
3244
|
+
let parentNode$2;
|
|
2800
3245
|
let nextNode;
|
|
2801
3246
|
if (forwardedSlot) {
|
|
2802
3247
|
const anchor = markHydrationAnchor(slotAnchor);
|
|
2803
|
-
parentNode$
|
|
3248
|
+
parentNode$2 = anchor.parentNode;
|
|
2804
3249
|
nextNode = anchor.nextSibling;
|
|
3250
|
+
} else if (this.anchorLabel === "if" && !isValidBlock(this.nodes) && currentSlotEndAnchor && currentHydrationNode === currentSlotEndAnchor) {
|
|
3251
|
+
parentNode$2 = currentSlotEndAnchor.parentNode;
|
|
3252
|
+
nextNode = currentSlotEndAnchor;
|
|
2805
3253
|
} else {
|
|
2806
3254
|
const node = findBlockNode(this.nodes);
|
|
2807
|
-
parentNode$
|
|
3255
|
+
parentNode$2 = node.parentNode;
|
|
2808
3256
|
nextNode = node.nextNode;
|
|
2809
3257
|
}
|
|
2810
3258
|
queuePostFlushCb(() => {
|
|
2811
|
-
const anchor = nextNode && nextNode.parentNode === parentNode$
|
|
2812
|
-
parentNode$
|
|
3259
|
+
const anchor = nextNode && nextNode.parentNode === parentNode$2 ? nextNode : null;
|
|
3260
|
+
parentNode$2.insertBefore(this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode()), anchor);
|
|
2813
3261
|
});
|
|
2814
3262
|
} finally {
|
|
2815
3263
|
exitHydrationBoundary && exitHydrationBoundary();
|
|
@@ -2817,6 +3265,7 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2817
3265
|
}
|
|
2818
3266
|
};
|
|
2819
3267
|
this.keyed = keyed;
|
|
3268
|
+
if (isTransitionEnabled && currentInstance && isVaporTransition(currentInstance.type)) this.inTransition = true;
|
|
2820
3269
|
if (isHydrating$1) {
|
|
2821
3270
|
this.anchorLabel = anchorLabel;
|
|
2822
3271
|
if (locate) locateHydrationNode();
|
|
@@ -2824,13 +3273,19 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2824
3273
|
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? /* @__PURE__ */ createComment(anchorLabel) : /* @__PURE__ */ createTextNode();
|
|
2825
3274
|
if (!!(process.env.NODE_ENV !== "production")) this.anchorLabel = anchorLabel;
|
|
2826
3275
|
}
|
|
3276
|
+
this.registerSlotBoundaryDirty();
|
|
3277
|
+
}
|
|
3278
|
+
registerSlotBoundaryDirty() {
|
|
3279
|
+
const boundary = this.inheritedSlotBoundary;
|
|
3280
|
+
if (!boundary) return;
|
|
3281
|
+
(this.onUpdated || (this.onUpdated = [])).push(() => boundary.markDirty());
|
|
2827
3282
|
}
|
|
2828
3283
|
update(render, key = render) {
|
|
2829
3284
|
if (key === this.current) {
|
|
2830
3285
|
if (isHydrating$1 && this.anchorLabel !== "slot") this.hydrate(true);
|
|
2831
3286
|
return;
|
|
2832
3287
|
}
|
|
2833
|
-
const transition = this.$transition;
|
|
3288
|
+
const transition = isTransitionEnabled ? this.$transition : void 0;
|
|
2834
3289
|
if (transition && transition.state.isLeaving) {
|
|
2835
3290
|
this.current = key;
|
|
2836
3291
|
this.pending = {
|
|
@@ -2843,14 +3298,18 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2843
3298
|
const prevSub = setActiveSub();
|
|
2844
3299
|
const parent = isHydrating$1 ? null : this.anchor.parentNode;
|
|
2845
3300
|
if (this.scope) {
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
3301
|
+
if (isKeepAliveEnabled) {
|
|
3302
|
+
let retainScope = false;
|
|
3303
|
+
const keepAliveCtx = this.keepAliveCtx;
|
|
3304
|
+
if (keepAliveCtx) {
|
|
3305
|
+
const cacheKey = this.keyed ? withCurrentCacheKey(this.current, () => keepAliveCtx.processShapeFlag(this.nodes)) : keepAliveCtx.processShapeFlag(this.nodes);
|
|
3306
|
+
if (cacheKey !== false) {
|
|
3307
|
+
keepAliveCtx.cacheScope(cacheKey, this.current, this.scope);
|
|
3308
|
+
retainScope = true;
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
if (!retainScope) this.scope.stop();
|
|
3312
|
+
} else this.scope.stop();
|
|
2854
3313
|
const mode = transition && transition.mode;
|
|
2855
3314
|
if (mode && (mode !== "in-out" || mode === "in-out" && render) && (mode !== "out-in" || isValidBlock(this.nodes))) {
|
|
2856
3315
|
applyTransitionLeaveHooks(this.nodes, transition, () => {
|
|
@@ -2873,7 +3332,8 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2873
3332
|
} else parent && remove(this.nodes, parent);
|
|
2874
3333
|
}
|
|
2875
3334
|
if (isHydrating$1 && render && this.anchorLabel !== "slot" && !isValidBlock(this.nodes)) {
|
|
2876
|
-
|
|
3335
|
+
let slotEndAnchor = null;
|
|
3336
|
+
const anchor = this.anchor || (currentHydrationNode === (slotEndAnchor = getCurrentSlotEndAnchor()) ? slotEndAnchor : null);
|
|
2877
3337
|
if (anchor) setCurrentHydrationNode(markHydrationAnchor(anchor));
|
|
2878
3338
|
}
|
|
2879
3339
|
this.renderBranch(render, transition, parent, key);
|
|
@@ -2883,7 +3343,7 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2883
3343
|
renderBranch(render, transition, parent, key) {
|
|
2884
3344
|
this.current = key;
|
|
2885
3345
|
if (render) {
|
|
2886
|
-
const keepAliveCtx = this.keepAliveCtx;
|
|
3346
|
+
const keepAliveCtx = isKeepAliveEnabled ? this.keepAliveCtx : null;
|
|
2887
3347
|
const scope = keepAliveCtx && keepAliveCtx.getScope(this.current);
|
|
2888
3348
|
if (scope) this.scope = scope;
|
|
2889
3349
|
else this.scope = new EffectScope$1();
|
|
@@ -2892,8 +3352,8 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2892
3352
|
this.nodes = this.runWithRenderCtx(() => this.scope.run(render) || []);
|
|
2893
3353
|
} finally {
|
|
2894
3354
|
const key = this.keyed ? this.current : this.$key;
|
|
2895
|
-
if (key !== void 0) setBlockKey(this.nodes, key);
|
|
2896
|
-
if (transition) this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
3355
|
+
if (key !== void 0 && (transition || this.inTransition || keepAliveCtx)) setBlockKey(this.nodes, key);
|
|
3356
|
+
if (isTransitionEnabled && transition) this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
2897
3357
|
if (keepAliveCtx) keepAliveCtx.processShapeFlag(this.nodes);
|
|
2898
3358
|
}
|
|
2899
3359
|
};
|
|
@@ -2908,461 +3368,438 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2908
3368
|
}
|
|
2909
3369
|
insert(this.nodes, parent, this.anchor);
|
|
2910
3370
|
if (keepAliveCtx && transition && transition.mode === "out-in") keepAliveCtx.cacheBlock();
|
|
2911
|
-
if (this.onUpdated) this.onUpdated.forEach((hook) => hook(this.nodes));
|
|
2912
3371
|
}
|
|
2913
3372
|
} else {
|
|
2914
3373
|
this.scope = void 0;
|
|
2915
3374
|
this.nodes = [];
|
|
2916
3375
|
}
|
|
3376
|
+
if (parent && this.onUpdated) this.onUpdated.forEach((hook) => hook(this.nodes));
|
|
2917
3377
|
}
|
|
2918
3378
|
};
|
|
2919
|
-
|
|
2920
|
-
|
|
3379
|
+
let currentSlotBoundary = null;
|
|
3380
|
+
function getCurrentSlotBoundary() {
|
|
3381
|
+
return currentSlotBoundary;
|
|
2921
3382
|
}
|
|
2922
|
-
|
|
2923
|
-
function setCurrentSlotEndAnchor(end) {
|
|
3383
|
+
function setCurrentSlotBoundary(b) {
|
|
2924
3384
|
try {
|
|
2925
|
-
return
|
|
3385
|
+
return currentSlotBoundary;
|
|
2926
3386
|
} finally {
|
|
2927
|
-
|
|
3387
|
+
currentSlotBoundary = b;
|
|
2928
3388
|
}
|
|
2929
3389
|
}
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
3390
|
+
function withOwnedSlotBoundary(boundary, fn) {
|
|
3391
|
+
const prev = setCurrentSlotBoundary(boundary);
|
|
3392
|
+
try {
|
|
3393
|
+
return fn();
|
|
3394
|
+
} finally {
|
|
3395
|
+
setCurrentSlotBoundary(prev);
|
|
2935
3396
|
}
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
if (!isValidBlock(block)) {
|
|
2961
|
-
if (isHydrating$1 && emptyFrag instanceof DynamicFragment) currentEmptyFragment = emptyFrag;
|
|
2962
|
-
block = renderSlotFallback(block, fallback, emptyFrag);
|
|
2963
|
-
}
|
|
2964
|
-
return block;
|
|
2965
|
-
} finally {
|
|
2966
|
-
if (isHydrating$1) currentEmptyFragment = prev;
|
|
2967
|
-
}
|
|
2968
|
-
};
|
|
2969
|
-
this.update(wrapped, key);
|
|
2970
|
-
}
|
|
2971
|
-
if (isHydrating$1) {
|
|
2972
|
-
this.hydrate(render == null, true);
|
|
2973
|
-
deferHydrationBoundary = !!exitHydrationBoundary && currentEmptyFragment !== void 0 && !isValidBlock(this.nodes);
|
|
2974
|
-
}
|
|
2975
|
-
} finally {
|
|
2976
|
-
if (isHydrating$1) {
|
|
2977
|
-
if (pushedEndAnchor) setCurrentSlotEndAnchor(prevEndAnchor);
|
|
2978
|
-
if (deferHydrationBoundary) this.deferredHydrationBoundary = exitHydrationBoundary;
|
|
2979
|
-
else exitHydrationBoundary && exitHydrationBoundary();
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
3397
|
+
}
|
|
3398
|
+
const slotFallbackBoundaryCache = /* @__PURE__ */ new WeakMap();
|
|
3399
|
+
function withSlotFallbackBoundary(boundary, fn) {
|
|
3400
|
+
let fallbackBoundary = slotFallbackBoundaryCache.get(boundary);
|
|
3401
|
+
if (!fallbackBoundary) slotFallbackBoundaryCache.set(boundary, fallbackBoundary = {
|
|
3402
|
+
get parent() {
|
|
3403
|
+
return boundary.parent;
|
|
3404
|
+
},
|
|
3405
|
+
getLocalFallback: () => void 0,
|
|
3406
|
+
markDirty: () => boundary.markDirty()
|
|
3407
|
+
});
|
|
3408
|
+
return withOwnedSlotBoundary(fallbackBoundary, fn);
|
|
3409
|
+
}
|
|
3410
|
+
function trackSlotBoundaryDirtying(fragment) {
|
|
3411
|
+
const boundary = currentSlotBoundary;
|
|
3412
|
+
if (!boundary) return;
|
|
3413
|
+
(fragment.onUpdated || (fragment.onUpdated = [])).push(() => boundary.markDirty());
|
|
3414
|
+
}
|
|
3415
|
+
function walkSlotFallbackBlock(block, node, fragment) {
|
|
3416
|
+
if (block instanceof Node) return node(block);
|
|
3417
|
+
if (isVaporComponent(block)) return walkSlotFallbackBlock(block.block, node, fragment);
|
|
3418
|
+
if (isArray(block)) {
|
|
3419
|
+
for (const child of block) if (walkSlotFallbackBlock(child, node, fragment)) return true;
|
|
3420
|
+
return false;
|
|
2982
3421
|
}
|
|
2983
|
-
|
|
2984
|
-
function isFragment(val) {
|
|
2985
|
-
return val instanceof VaporFragment;
|
|
3422
|
+
return fragment(block, (block) => walkSlotFallbackBlock(block, node, fragment));
|
|
2986
3423
|
}
|
|
2987
|
-
function
|
|
2988
|
-
|
|
3424
|
+
function resolveSlotFallbackCarrierOwner(block) {
|
|
3425
|
+
let owner = null;
|
|
3426
|
+
walkSlotFallbackBlock(block, () => false, (block) => {
|
|
3427
|
+
owner = block;
|
|
3428
|
+
return true;
|
|
3429
|
+
});
|
|
3430
|
+
return owner;
|
|
2989
3431
|
}
|
|
2990
|
-
function
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
deferredHydrationBoundary();
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3432
|
+
function findFirstSlotFallbackCarrierNode(block) {
|
|
3433
|
+
let node = null;
|
|
3434
|
+
walkSlotFallbackBlock(block, (value) => {
|
|
3435
|
+
node = value;
|
|
3436
|
+
return true;
|
|
3437
|
+
}, (block, walk) => {
|
|
3438
|
+
if (walk(block.nodes)) return true;
|
|
3439
|
+
if (block.anchor) {
|
|
3440
|
+
node = block.anchor;
|
|
3441
|
+
return true;
|
|
3003
3442
|
}
|
|
3004
|
-
return
|
|
3005
|
-
}
|
|
3006
|
-
return
|
|
3443
|
+
return false;
|
|
3444
|
+
});
|
|
3445
|
+
return node;
|
|
3007
3446
|
}
|
|
3008
|
-
function
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3447
|
+
function collectBlockNodes(block, nodes = [], includeComments = false) {
|
|
3448
|
+
walkSlotFallbackBlock(block, (block) => {
|
|
3449
|
+
if (includeComments || !(block instanceof Comment)) nodes.push(block);
|
|
3450
|
+
return false;
|
|
3451
|
+
}, (block) => {
|
|
3452
|
+
collectBlockNodes(block.nodes, nodes, true);
|
|
3453
|
+
if (block.anchor) nodes.push(block.anchor);
|
|
3454
|
+
return false;
|
|
3455
|
+
});
|
|
3456
|
+
return nodes;
|
|
3012
3457
|
}
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3458
|
+
function mutateSlotFallbackCarrier(block, apply) {
|
|
3459
|
+
walkSlotFallbackBlock(block, (block) => {
|
|
3460
|
+
if (!(block instanceof Comment)) apply(block);
|
|
3461
|
+
return false;
|
|
3462
|
+
}, (block) => {
|
|
3463
|
+
apply(block);
|
|
3464
|
+
return false;
|
|
3465
|
+
});
|
|
3466
|
+
}
|
|
3467
|
+
function hasSlotFallback(boundary) {
|
|
3468
|
+
while (boundary) {
|
|
3469
|
+
if (boundary.getLocalFallback()) return true;
|
|
3470
|
+
boundary = boundary.parent;
|
|
3018
3471
|
}
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3472
|
+
return false;
|
|
3473
|
+
}
|
|
3474
|
+
function renderSlotFallback(boundary, ...args) {
|
|
3475
|
+
const [block, hasFallback] = renderSlotFallbackBlock(boundary || null, args);
|
|
3476
|
+
return hasFallback ? block : void 0;
|
|
3477
|
+
}
|
|
3478
|
+
function renderSlotFallbackBlock(boundary, args) {
|
|
3479
|
+
if (!boundary) return [[], false];
|
|
3480
|
+
const localFallback = boundary.getLocalFallback();
|
|
3481
|
+
if (!localFallback) return renderSlotFallbackBlock(boundary.parent, args);
|
|
3482
|
+
const local = withSlotFallbackBoundary(boundary, () => localFallback(...args));
|
|
3483
|
+
if (isValidBlock(local)) return [local, true];
|
|
3484
|
+
const [inherited] = renderSlotFallbackBlock(boundary.parent, args);
|
|
3485
|
+
return [resolveSlotFallbackCarrierOwner(local) ? [inherited, local] : inherited, true];
|
|
3486
|
+
}
|
|
3487
|
+
var SlotFallbackController = class {
|
|
3488
|
+
constructor(host) {
|
|
3489
|
+
this.host = host;
|
|
3490
|
+
this.activeFallback = null;
|
|
3491
|
+
this.pendingRecheck = false;
|
|
3492
|
+
this.isRenderingFallback = false;
|
|
3493
|
+
this.rerunRecheckAfterFallbackRender = host.rerunRecheckAfterFallbackRender !== false;
|
|
3494
|
+
this.boundary = {
|
|
3495
|
+
get parent() {
|
|
3496
|
+
return host.getParentBoundary();
|
|
3497
|
+
},
|
|
3498
|
+
getLocalFallback: host.getLocalFallback,
|
|
3499
|
+
markDirty: () => {
|
|
3500
|
+
if (host.isDisposed && host.isDisposed()) return;
|
|
3501
|
+
if (this.isRenderingFallback) {
|
|
3502
|
+
if (isHydrating$1) this.pendingRecheck = true;
|
|
3503
|
+
return;
|
|
3504
|
+
}
|
|
3505
|
+
if (host.isBusy && host.isBusy()) {
|
|
3506
|
+
this.pendingRecheck = true;
|
|
3507
|
+
return;
|
|
3508
|
+
}
|
|
3509
|
+
this.recheck(true);
|
|
3510
|
+
}
|
|
3511
|
+
};
|
|
3022
3512
|
}
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
if (!isValidBlock(block.nodes)) state.emptyFrag = block;
|
|
3026
|
-
traverseForFallback(block.nodes, fallback, state, block);
|
|
3027
|
-
return;
|
|
3513
|
+
getEffectiveOutput() {
|
|
3514
|
+
return this.activeFallback || this.host.getContent();
|
|
3028
3515
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
return;
|
|
3516
|
+
getActiveFallback() {
|
|
3517
|
+
return this.activeFallback;
|
|
3032
3518
|
}
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
if (!isValidBlock(block.nodes)) state.emptyFrag = block;
|
|
3036
|
-
traverseForFallback(block.nodes, fallback, state, forOwner);
|
|
3037
|
-
return;
|
|
3519
|
+
hasFallback() {
|
|
3520
|
+
return hasSlotFallback(this.boundary);
|
|
3038
3521
|
}
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
if (slotState) slotState.fallback = chainFallback(slotState.fallback, fallback);
|
|
3042
|
-
else slotFallbackState.set(block, slotState = {
|
|
3043
|
-
fallback,
|
|
3044
|
-
wrapped: false,
|
|
3045
|
-
forOwner
|
|
3046
|
-
});
|
|
3047
|
-
slotState.forOwner = forOwner || slotState.forOwner;
|
|
3048
|
-
if (!slotState.wrapped) {
|
|
3049
|
-
slotState.wrapped = true;
|
|
3050
|
-
const original = block.update.bind(block);
|
|
3051
|
-
block.update = (render, key) => {
|
|
3052
|
-
original(render, key);
|
|
3053
|
-
const emptyFrag = attachSlotFallback(block.nodes, slotState.fallback);
|
|
3054
|
-
if (render !== slotState.fallback && !isValidBlock(block.nodes) && (!slotState.forOwner || !isValidBlock(slotState.forOwner.nodes))) renderSlotFallback(block, slotState.fallback, emptyFrag);
|
|
3055
|
-
};
|
|
3056
|
-
}
|
|
3057
|
-
if (!isValidBlock(block.nodes)) state.emptyFrag = block;
|
|
3058
|
-
traverseForFallback(block.nodes, fallback, state, forOwner);
|
|
3522
|
+
wrapFallback(fallback) {
|
|
3523
|
+
return (...args) => this.host.runWithRenderCtx(() => withSlotFallbackBoundary(this.boundary, () => fallback(...args)));
|
|
3059
3524
|
}
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
let emptyFrag = null;
|
|
3063
|
-
traverseForEmptyFragment(block, (frag) => emptyFrag = frag);
|
|
3064
|
-
return emptyFrag;
|
|
3065
|
-
}
|
|
3066
|
-
function traverseForEmptyFragment(block, onFound) {
|
|
3067
|
-
if (isVaporComponent(block)) {
|
|
3068
|
-
if (block.block) traverseForEmptyFragment(block.block, onFound);
|
|
3069
|
-
return;
|
|
3525
|
+
clearPendingRecheck() {
|
|
3526
|
+
this.pendingRecheck = false;
|
|
3070
3527
|
}
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3528
|
+
takePendingRecheck() {
|
|
3529
|
+
const shouldRecheck = this.pendingRecheck;
|
|
3530
|
+
this.pendingRecheck = false;
|
|
3531
|
+
return shouldRecheck;
|
|
3074
3532
|
}
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3533
|
+
dispose() {
|
|
3534
|
+
this.clearActiveFallback();
|
|
3535
|
+
this.pendingRecheck = false;
|
|
3078
3536
|
}
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3085
|
-
};
|
|
3086
|
-
}
|
|
3087
|
-
//#endregion
|
|
3088
|
-
//#region packages/runtime-vapor/src/components/Teleport.ts
|
|
3089
|
-
const VaporTeleportImpl = {
|
|
3090
|
-
name: "VaporTeleport",
|
|
3091
|
-
__isTeleport: true,
|
|
3092
|
-
__vapor: true,
|
|
3093
|
-
process(props, slots) {
|
|
3094
|
-
return new TeleportFragment(props, slots);
|
|
3537
|
+
relocate() {
|
|
3538
|
+
if (isHydrating$1 || !this.activeFallback) return;
|
|
3539
|
+
const parentNode = this.host.getParentNode();
|
|
3540
|
+
if (!parentNode) return;
|
|
3541
|
+
const carrierAnchor = findFirstSlotFallbackCarrierNode(this.host.getContent());
|
|
3542
|
+
insert(this.activeFallback, parentNode, carrierAnchor && carrierAnchor.parentNode === parentNode ? carrierAnchor : this.host.getAnchor());
|
|
3095
3543
|
}
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
this.isMounted = false;
|
|
3102
|
-
this.childrenInitialized = false;
|
|
3103
|
-
this.ownerInstance = currentInstance$1;
|
|
3104
|
-
this.insert = (container, anchor) => {
|
|
3105
|
-
if (isHydrating$1) return;
|
|
3106
|
-
if (!this.placeholder) this.placeholder = !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport start") : /* @__PURE__ */ createTextNode();
|
|
3107
|
-
insert(this.placeholder, container, anchor);
|
|
3108
|
-
insert(this.anchor, container, anchor);
|
|
3109
|
-
this.handlePropsUpdate();
|
|
3110
|
-
};
|
|
3111
|
-
this.remove = (parent = this.parent) => {
|
|
3112
|
-
if (this.mountToTargetJob) {
|
|
3113
|
-
this.mountToTargetJob.flags |= 4;
|
|
3114
|
-
this.mountToTargetJob = void 0;
|
|
3115
|
-
}
|
|
3116
|
-
if (this.nodes && this.mountContainer) {
|
|
3117
|
-
remove(this.nodes, this.mountContainer);
|
|
3118
|
-
this.nodes = [];
|
|
3119
|
-
}
|
|
3120
|
-
this.isMounted = false;
|
|
3121
|
-
if (this.targetStart) {
|
|
3122
|
-
remove(this.targetStart, /* @__PURE__ */ parentNode(this.targetStart));
|
|
3123
|
-
this.targetStart = void 0;
|
|
3124
|
-
}
|
|
3125
|
-
if (this.targetAnchor) {
|
|
3126
|
-
remove(this.targetAnchor, /* @__PURE__ */ parentNode(this.targetAnchor));
|
|
3127
|
-
this.targetAnchor = void 0;
|
|
3128
|
-
}
|
|
3129
|
-
if (this.anchor) {
|
|
3130
|
-
remove(this.anchor, /* @__PURE__ */ parentNode(this.anchor));
|
|
3131
|
-
this.anchor = void 0;
|
|
3132
|
-
}
|
|
3133
|
-
if (this.placeholder) {
|
|
3134
|
-
remove(this.placeholder, parent);
|
|
3135
|
-
this.placeholder = void 0;
|
|
3136
|
-
}
|
|
3137
|
-
this.mountContainer = void 0;
|
|
3138
|
-
this.mountAnchor = void 0;
|
|
3139
|
-
};
|
|
3140
|
-
this.hydrate = () => {
|
|
3141
|
-
if (!isHydrating$1) return;
|
|
3142
|
-
const target = this.target = resolveTeleportTarget(this.resolvedProps, querySelector);
|
|
3143
|
-
const disabled = isTeleportDisabled(this.resolvedProps);
|
|
3144
|
-
this.placeholder = currentHydrationNode;
|
|
3145
|
-
if (target) {
|
|
3146
|
-
const targetNode = target._lpa || target.firstChild;
|
|
3147
|
-
if (disabled) this.hydrateDisabledTeleport(target, targetNode);
|
|
3148
|
-
else {
|
|
3149
|
-
this.anchor = markHydrationAnchor(locateTeleportEndAnchor(currentHydrationNode.nextSibling));
|
|
3150
|
-
this.mountContainer = target;
|
|
3151
|
-
this.hydrateTargetAnchors(target, targetNode);
|
|
3152
|
-
this.mountAnchor = this.targetAnchor;
|
|
3153
|
-
if (targetNode) setCurrentHydrationNode(targetNode.nextSibling);
|
|
3154
|
-
if (!this.targetAnchor) this.mountChildren(target);
|
|
3155
|
-
else this.initChildren();
|
|
3156
|
-
}
|
|
3157
|
-
} else if (disabled) this.hydrateDisabledTeleport(null, null);
|
|
3158
|
-
else this.anchor = markHydrationAnchor(locateTeleportEndAnchor(currentHydrationNode.nextSibling));
|
|
3159
|
-
if (target || disabled) updateCssVars(this);
|
|
3160
|
-
advanceHydrationNode(this.anchor);
|
|
3161
|
-
};
|
|
3162
|
-
this.rawProps = props;
|
|
3163
|
-
this.rawSlots = slots;
|
|
3164
|
-
this.parentComponent = getScopeOwner();
|
|
3165
|
-
this.anchor = isHydrating$1 ? void 0 : !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport end") : /* @__PURE__ */ createTextNode();
|
|
3166
|
-
renderEffect(() => {
|
|
3167
|
-
const prevTo = this.resolvedProps && this.resolvedProps.to;
|
|
3168
|
-
const wasDisabled = this.isDisabled;
|
|
3169
|
-
this.resolvedProps = extend({}, new Proxy(this.rawProps, rawPropsProxyHandlers));
|
|
3170
|
-
this.isDisabled = isTeleportDisabled(this.resolvedProps);
|
|
3171
|
-
if (wasDisabled !== this.isDisabled || !this.isDisabled && prevTo !== this.resolvedProps.to) this.handlePropsUpdate();
|
|
3544
|
+
syncActiveFallback() {
|
|
3545
|
+
if (!this.activeFallback) return;
|
|
3546
|
+
const activeFallback = this.activeFallback;
|
|
3547
|
+
queuePostFlushCb(() => {
|
|
3548
|
+
this.syncActiveFallbackOrder(activeFallback);
|
|
3172
3549
|
});
|
|
3173
3550
|
}
|
|
3174
|
-
|
|
3175
|
-
|
|
3551
|
+
recheck(force = false) {
|
|
3552
|
+
const prevValid = this.activeFallback ? isValidBlock(this.activeFallback) : this.isContentValid();
|
|
3553
|
+
if (this.isContentValid()) this.clearActiveFallback();
|
|
3554
|
+
else if (!this.ensureFallback(force)) this.clearActiveFallback();
|
|
3555
|
+
const nextValid = this.activeFallback ? isValidBlock(this.activeFallback) : this.isContentValid();
|
|
3556
|
+
if (this.host.syncEffectiveOutput) this.host.syncEffectiveOutput();
|
|
3557
|
+
if (prevValid !== nextValid) this.host.onValidityChange();
|
|
3558
|
+
}
|
|
3559
|
+
isContentValid() {
|
|
3560
|
+
return this.host.isContentValid ? this.host.isContentValid() : isValidBlock(this.host.getContent());
|
|
3561
|
+
}
|
|
3562
|
+
clearActiveFallback() {
|
|
3563
|
+
if (this.activeFallback) {
|
|
3564
|
+
const parentNode = this.host.getParentNode();
|
|
3565
|
+
if (parentNode) remove(this.activeFallback, parentNode);
|
|
3566
|
+
this.activeFallback = null;
|
|
3567
|
+
}
|
|
3568
|
+
if (this.fallbackScope) {
|
|
3569
|
+
this.fallbackScope.stop();
|
|
3570
|
+
this.fallbackScope = void 0;
|
|
3571
|
+
}
|
|
3176
3572
|
}
|
|
3177
|
-
|
|
3178
|
-
|
|
3573
|
+
ensureFallback(force) {
|
|
3574
|
+
if (force) this.clearActiveFallback();
|
|
3575
|
+
if (this.activeFallback) return true;
|
|
3576
|
+
const scope = new EffectScope$1();
|
|
3577
|
+
let renderedFallback;
|
|
3578
|
+
this.isRenderingFallback = true;
|
|
3179
3579
|
try {
|
|
3180
|
-
this.
|
|
3181
|
-
|
|
3182
|
-
|
|
3580
|
+
renderedFallback = this.host.runWithRenderCtx(() => scope.run(() => renderSlotFallback(this.boundary)) || void 0) || void 0;
|
|
3581
|
+
} catch (err) {
|
|
3582
|
+
scope.stop();
|
|
3583
|
+
throw err;
|
|
3183
3584
|
} finally {
|
|
3184
|
-
|
|
3585
|
+
this.isRenderingFallback = false;
|
|
3586
|
+
}
|
|
3587
|
+
if (!renderedFallback) {
|
|
3588
|
+
scope.stop();
|
|
3589
|
+
return false;
|
|
3590
|
+
}
|
|
3591
|
+
this.fallbackScope = scope;
|
|
3592
|
+
this.activeFallback = renderedFallback;
|
|
3593
|
+
this.ensureActiveFallbackOrderHook(renderedFallback);
|
|
3594
|
+
if (this.pendingRecheck && this.rerunRecheckAfterFallbackRender) {
|
|
3595
|
+
this.pendingRecheck = false;
|
|
3596
|
+
this.recheck(true);
|
|
3597
|
+
return true;
|
|
3185
3598
|
}
|
|
3599
|
+
this.relocate();
|
|
3600
|
+
return true;
|
|
3186
3601
|
}
|
|
3187
|
-
|
|
3188
|
-
if (!
|
|
3602
|
+
syncActiveFallbackOrder(block) {
|
|
3603
|
+
if (!isFragment(block) || !isArray(block.nodes) || block.nodes.length < 2) return;
|
|
3604
|
+
const carrierNodes = collectBlockNodes(this.host.getContent(), [], true);
|
|
3605
|
+
const fallbackNodes = collectBlockNodes(block, [], true);
|
|
3606
|
+
const lastNode = fallbackNodes[fallbackNodes.length - 1];
|
|
3607
|
+
if (!carrierNodes.length || !lastNode) return;
|
|
3608
|
+
const parentNode = carrierNodes[0].parentNode;
|
|
3609
|
+
if (!parentNode || lastNode.parentNode !== parentNode) return;
|
|
3610
|
+
let inOrder = true;
|
|
3611
|
+
let nextNode = lastNode.nextSibling;
|
|
3612
|
+
for (const carrierNode of carrierNodes) {
|
|
3613
|
+
if (carrierNode.parentNode !== parentNode) return;
|
|
3614
|
+
if (carrierNode !== nextNode) {
|
|
3615
|
+
inOrder = false;
|
|
3616
|
+
break;
|
|
3617
|
+
}
|
|
3618
|
+
nextNode = carrierNode.nextSibling;
|
|
3619
|
+
}
|
|
3620
|
+
if (inOrder) return;
|
|
3621
|
+
let anchor = lastNode.nextSibling;
|
|
3622
|
+
for (let i = carrierNodes.length - 1; i >= 0; i--) {
|
|
3623
|
+
const carrierNode = carrierNodes[i];
|
|
3624
|
+
parentNode.insertBefore(carrierNode, anchor);
|
|
3625
|
+
anchor = carrierNode;
|
|
3626
|
+
}
|
|
3189
3627
|
}
|
|
3190
|
-
|
|
3191
|
-
if (isFragment(block))
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3628
|
+
ensureActiveFallbackOrderHook(block) {
|
|
3629
|
+
if (!isFragment(block)) return;
|
|
3630
|
+
const fragment = block;
|
|
3631
|
+
if (fragment.hasSlotFallbackOrderHook) return;
|
|
3632
|
+
(fragment.onUpdated || (fragment.onUpdated = [])).push(() => this.syncActiveFallbackOrder(fragment));
|
|
3633
|
+
fragment.hasSlotFallbackOrderHook = true;
|
|
3196
3634
|
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3635
|
+
};
|
|
3636
|
+
let currentHydratingSlotBoundaryState = null;
|
|
3637
|
+
function setCurrentHydratingSlotBoundaryState(state) {
|
|
3638
|
+
try {
|
|
3639
|
+
return currentHydratingSlotBoundaryState;
|
|
3640
|
+
} finally {
|
|
3641
|
+
currentHydratingSlotBoundaryState = state;
|
|
3203
3642
|
}
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3643
|
+
}
|
|
3644
|
+
function getCurrentSlotEndAnchor() {
|
|
3645
|
+
return currentHydratingSlotBoundaryState ? currentHydratingSlotBoundaryState.endAnchor : null;
|
|
3646
|
+
}
|
|
3647
|
+
function withHydratingSlotBoundary(fn) {
|
|
3648
|
+
let endAnchor = getCurrentSlotEndAnchor();
|
|
3649
|
+
let exitHydrationBoundary;
|
|
3650
|
+
locateHydrationNode();
|
|
3651
|
+
if (isComment(currentHydrationNode, "[")) {
|
|
3652
|
+
endAnchor = locateEndAnchor(currentHydrationNode);
|
|
3653
|
+
setCurrentHydrationNode(currentHydrationNode.nextSibling);
|
|
3654
|
+
exitHydrationBoundary = enterHydrationBoundary(endAnchor);
|
|
3655
|
+
}
|
|
3656
|
+
const prevState = setCurrentHydratingSlotBoundaryState({
|
|
3657
|
+
endAnchor,
|
|
3658
|
+
fallbackActive: false
|
|
3659
|
+
});
|
|
3660
|
+
try {
|
|
3661
|
+
return fn();
|
|
3662
|
+
} finally {
|
|
3663
|
+
setCurrentHydratingSlotBoundaryState(prevState);
|
|
3664
|
+
exitHydrationBoundary && exitHydrationBoundary();
|
|
3213
3665
|
}
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3666
|
+
}
|
|
3667
|
+
function isHydratingSlotFallbackActive() {
|
|
3668
|
+
return !!(currentHydratingSlotBoundaryState && currentHydratingSlotBoundaryState.fallbackActive);
|
|
3669
|
+
}
|
|
3670
|
+
function setCurrentHydratingSlotFallbackActive(active) {
|
|
3671
|
+
try {
|
|
3672
|
+
return isHydratingSlotFallbackActive();
|
|
3673
|
+
} finally {
|
|
3674
|
+
if (currentHydratingSlotBoundaryState) currentHydratingSlotBoundaryState.fallbackActive = active;
|
|
3222
3675
|
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3676
|
+
}
|
|
3677
|
+
function withHydratingSlotFallbackActive(fn) {
|
|
3678
|
+
const prevState = setCurrentHydratingSlotFallbackActive(true);
|
|
3679
|
+
try {
|
|
3680
|
+
return fn();
|
|
3681
|
+
} finally {
|
|
3682
|
+
setCurrentHydratingSlotFallbackActive(prevState);
|
|
3683
|
+
}
|
|
3684
|
+
}
|
|
3685
|
+
function isReusableDynamicFragmentAnchor(node, anchorLabel) {
|
|
3686
|
+
return isComment(node, anchorLabel) || isComment(node, "") && (anchorLabel === "dynamic-component" || anchorLabel === "async component" || anchorLabel === "keyed");
|
|
3687
|
+
}
|
|
3688
|
+
var SlotFragment = class extends DynamicFragment {
|
|
3689
|
+
constructor() {
|
|
3690
|
+
super(isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? "slot" : void 0, false, false);
|
|
3691
|
+
this.forwarded = false;
|
|
3692
|
+
this.parentSlotBoundary = getCurrentSlotBoundary();
|
|
3693
|
+
this.isUpdatingSlot = false;
|
|
3694
|
+
this.controller = new SlotFallbackController({
|
|
3695
|
+
getParentBoundary: () => this.parentSlotBoundary,
|
|
3696
|
+
getLocalFallback: () => this.localFallback,
|
|
3697
|
+
getContent: () => this.nodes,
|
|
3698
|
+
getParentNode: () => this.anchor ? this.anchor.parentNode : null,
|
|
3699
|
+
getAnchor: () => this.anchor || null,
|
|
3700
|
+
runWithRenderCtx: (fn) => this.runWithRenderCtx(fn),
|
|
3701
|
+
isBusy: () => this.isUpdatingSlot,
|
|
3702
|
+
rerunRecheckAfterFallbackRender: false,
|
|
3703
|
+
onValidityChange: () => {
|
|
3704
|
+
if (this.parentSlotBoundary) this.parentSlotBoundary.markDirty();
|
|
3231
3705
|
}
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3706
|
+
});
|
|
3707
|
+
this.slotFallbackBoundary = this.controller.boundary;
|
|
3708
|
+
if (!isHydrating$1) this.insert = (parent, anchor) => this.insertSlot(parent, anchor);
|
|
3709
|
+
this.remove = (parent) => this.removeSlot(parent);
|
|
3236
3710
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
while (node && node !== this.anchor) {
|
|
3241
|
-
const next = node.nextSibling;
|
|
3242
|
-
remove(node, /* @__PURE__ */ parentNode(node));
|
|
3243
|
-
node = next;
|
|
3244
|
-
}
|
|
3245
|
-
this.isMounted = false;
|
|
3246
|
-
this.mountContainer = null;
|
|
3711
|
+
registerSlotBoundaryDirty() {}
|
|
3712
|
+
get fallbackBlock() {
|
|
3713
|
+
return this.controller.getActiveFallback();
|
|
3247
3714
|
}
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
if (this.isDisabled) {
|
|
3251
|
-
this.ensureChildrenInitialized();
|
|
3252
|
-
this.mount(this.parent, this.anchor);
|
|
3253
|
-
} else {
|
|
3254
|
-
if (this.placeholder && this.anchor && this.placeholder.nextSibling !== this.anchor) this.clearMainViewChildren();
|
|
3255
|
-
if (isTeleportDeferred(this.resolvedProps) || !this.parent.isConnected) {
|
|
3256
|
-
if (!this.mountToTargetJob || this.mountToTargetJob.flags & 4) this.mountToTargetJob = () => {
|
|
3257
|
-
this.mountToTargetJob = void 0;
|
|
3258
|
-
if (this.isDisabled || !this.anchor) return;
|
|
3259
|
-
this.mountToTarget();
|
|
3260
|
-
};
|
|
3261
|
-
queuePostFlushCb(this.mountToTargetJob);
|
|
3262
|
-
} else this.mountToTarget();
|
|
3263
|
-
}
|
|
3715
|
+
getEffectiveOutput() {
|
|
3716
|
+
return this.controller.getEffectiveOutput();
|
|
3264
3717
|
}
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
else if (targetAnchor.data === "teleport anchor") {
|
|
3271
|
-
this.targetAnchor = markHydrationAnchor(targetAnchor);
|
|
3272
|
-
target._lpa = this.targetAnchor.nextSibling;
|
|
3273
|
-
break;
|
|
3274
|
-
}
|
|
3275
|
-
}
|
|
3276
|
-
targetAnchor = targetAnchor.nextSibling;
|
|
3718
|
+
insertSlot(parent, anchor) {
|
|
3719
|
+
if (this.fallbackBlock) {
|
|
3720
|
+
insert(this.fallbackBlock, parent, anchor);
|
|
3721
|
+
mutateSlotFallbackCarrier(this.nodes, (block) => insert(block, parent, anchor));
|
|
3722
|
+
return;
|
|
3277
3723
|
}
|
|
3724
|
+
insert(this.nodes, parent, anchor);
|
|
3278
3725
|
}
|
|
3279
|
-
|
|
3280
|
-
if (
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
this.mountAnchor = this.anchor = markHydrationAnchor(locateTeleportEndAnchor(nextNode));
|
|
3284
|
-
this.mountContainer = /* @__PURE__ */ parentNode(this.anchor);
|
|
3285
|
-
if (target) this.hydrateTargetAnchors(target, targetNode);
|
|
3286
|
-
else {
|
|
3287
|
-
this.targetStart = targetNode;
|
|
3288
|
-
this.targetAnchor = targetNode && targetNode.nextSibling;
|
|
3289
|
-
}
|
|
3290
|
-
this.initChildren();
|
|
3726
|
+
removeSlot(parent) {
|
|
3727
|
+
if (this.fallbackBlock) mutateSlotFallbackCarrier(this.nodes, (block) => remove(block, parent));
|
|
3728
|
+
else remove(this.nodes, parent);
|
|
3729
|
+
this.controller.dispose();
|
|
3291
3730
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3731
|
+
updateSlot(render, fallback, key = render || fallback) {
|
|
3732
|
+
const prevLocalFallback = this.localFallback;
|
|
3733
|
+
this.localFallback = fallback;
|
|
3734
|
+
const fallbackChanged = prevLocalFallback !== fallback;
|
|
3735
|
+
const slotRender = render ? () => withOwnedSlotBoundary(this.slotFallbackBoundary, render) : () => [];
|
|
3736
|
+
const slotKey = key === void 0 ? slotRender : key;
|
|
3737
|
+
this.isUpdatingSlot = true;
|
|
3738
|
+
this.controller.clearPendingRecheck();
|
|
3739
|
+
try {
|
|
3740
|
+
const shouldForce = fallbackChanged || this.controller.takePendingRecheck();
|
|
3741
|
+
if (isHydrating$1) withHydratingSlotBoundary(() => {
|
|
3742
|
+
const prev = isHydratingSlotFallbackActive();
|
|
3743
|
+
try {
|
|
3744
|
+
if (this.controller.hasFallback()) setCurrentHydratingSlotFallbackActive(true);
|
|
3745
|
+
this.update(slotRender, slotKey);
|
|
3746
|
+
const contentValid = isValidBlock(this.nodes);
|
|
3747
|
+
this.controller.recheck(shouldForce);
|
|
3748
|
+
if (!this.controller.hasFallback() || contentValid) setCurrentHydratingSlotFallbackActive(prev);
|
|
3749
|
+
this.hydrate(!isValidBlock(this.getEffectiveOutput()), true);
|
|
3750
|
+
} finally {
|
|
3751
|
+
setCurrentHydratingSlotFallbackActive(prev);
|
|
3752
|
+
}
|
|
3753
|
+
});
|
|
3754
|
+
else {
|
|
3755
|
+
this.update(slotRender, slotKey);
|
|
3756
|
+
this.controller.recheck(shouldForce);
|
|
3757
|
+
}
|
|
3758
|
+
} finally {
|
|
3759
|
+
this.controller.clearPendingRecheck();
|
|
3760
|
+
this.isUpdatingSlot = false;
|
|
3299
3761
|
}
|
|
3300
|
-
runWithoutHydration(this.initChildren.bind(this));
|
|
3301
3762
|
}
|
|
3302
3763
|
};
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3764
|
+
function isFragment(val) {
|
|
3765
|
+
return val instanceof VaporFragment;
|
|
3766
|
+
}
|
|
3767
|
+
function isDynamicFragment(val) {
|
|
3768
|
+
return val instanceof DynamicFragment;
|
|
3769
|
+
}
|
|
3770
|
+
//#endregion
|
|
3771
|
+
//#region packages/runtime-vapor/src/teleport.ts
|
|
3772
|
+
let isTeleportEnabled = false;
|
|
3773
|
+
function enableTeleport(value) {
|
|
3774
|
+
isTeleportEnabled = true;
|
|
3775
|
+
return value;
|
|
3776
|
+
}
|
|
3308
3777
|
function isVaporTeleport(value) {
|
|
3309
3778
|
return !!(value && value.__isTeleport && value.__vapor);
|
|
3310
3779
|
}
|
|
3311
|
-
/**
|
|
3312
|
-
* Use duck typing to check for TeleportFragment instead of instanceof,
|
|
3313
|
-
* allowing tree-shaking when Teleport is not used.
|
|
3314
|
-
*/
|
|
3315
3780
|
function isTeleportFragment(value) {
|
|
3316
3781
|
return !!(value && value.__isTeleportFragment);
|
|
3317
3782
|
}
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
else if (isComment(node, "teleport end")) if (depth === 0) return node;
|
|
3323
|
-
else depth--;
|
|
3324
|
-
node = node.nextSibling;
|
|
3325
|
-
}
|
|
3326
|
-
return null;
|
|
3327
|
-
}
|
|
3328
|
-
function updateCssVars(frag) {
|
|
3329
|
-
const ctx = frag.parentComponent;
|
|
3330
|
-
if (ctx && ctx.ut) {
|
|
3331
|
-
let node, anchor;
|
|
3332
|
-
if (frag.isDisabled) {
|
|
3333
|
-
node = frag.placeholder;
|
|
3334
|
-
anchor = frag.anchor;
|
|
3335
|
-
} else {
|
|
3336
|
-
node = frag.targetStart;
|
|
3337
|
-
anchor = frag.targetAnchor;
|
|
3338
|
-
}
|
|
3339
|
-
while (node && node !== anchor) {
|
|
3340
|
-
if (node.nodeType === 1) node.setAttribute("data-v-owner", String(ctx.uid));
|
|
3341
|
-
node = node.nextSibling;
|
|
3342
|
-
}
|
|
3343
|
-
pauseTracking();
|
|
3344
|
-
try {
|
|
3345
|
-
ctx.ut();
|
|
3346
|
-
} finally {
|
|
3347
|
-
resetTracking();
|
|
3348
|
-
}
|
|
3349
|
-
}
|
|
3350
|
-
}
|
|
3351
|
-
//#endregion
|
|
3352
|
-
//#region packages/runtime-vapor/src/block.ts
|
|
3353
|
-
function isBlock(val) {
|
|
3354
|
-
return val instanceof Node || isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
3783
|
+
//#endregion
|
|
3784
|
+
//#region packages/runtime-vapor/src/block.ts
|
|
3785
|
+
function isBlock(val) {
|
|
3786
|
+
return val instanceof Node || isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
3355
3787
|
}
|
|
3356
3788
|
function isValidBlock(block) {
|
|
3357
|
-
if (block
|
|
3789
|
+
if (!block) return false;
|
|
3790
|
+
else if (block instanceof Node) return !(block instanceof Comment);
|
|
3358
3791
|
else if (isVaporComponent(block)) return isValidBlock(block.block);
|
|
3359
3792
|
else if (isArray(block)) return block.length > 0 && block.some(isValidBlock);
|
|
3360
|
-
else
|
|
3793
|
+
else if (block.validityPending) return true;
|
|
3794
|
+
else {
|
|
3795
|
+
const getEffectiveOutput = block.getEffectiveOutput;
|
|
3796
|
+
return isValidBlock(getEffectiveOutput ? getEffectiveOutput.call(block) : block.nodes);
|
|
3797
|
+
}
|
|
3361
3798
|
}
|
|
3362
3799
|
function insert(block, parent, anchor = null, parentSuspense) {
|
|
3363
3800
|
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
3364
3801
|
if (block instanceof Node) {
|
|
3365
|
-
if (!isHydrating$1) if (block instanceof Element && block.$transition && !block.$transition.disabled) performTransitionEnter(block, block.$transition, () => parent.insertBefore(block, anchor), parentSuspense);
|
|
3802
|
+
if (!isHydrating$1) if (isTransitionEnabled && block instanceof Element && block.$transition && !block.$transition.disabled) performTransitionEnter(block, block.$transition, () => parent.insertBefore(block, anchor), parentSuspense);
|
|
3366
3803
|
else parent.insertBefore(block, anchor);
|
|
3367
3804
|
} else if (isVaporComponent(block)) if (block.isMounted && !block.isDeactivated) insert(block.block, parent, anchor);
|
|
3368
3805
|
else mountComponent(block, parent, anchor);
|
|
@@ -3378,7 +3815,7 @@ function insert(block, parent, anchor = null, parentSuspense) {
|
|
|
3378
3815
|
}
|
|
3379
3816
|
function move(block, parent, anchor = null, moveType = 1, parentComponent, parentSuspense) {
|
|
3380
3817
|
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
3381
|
-
if (block instanceof Node) if (block instanceof Element && block.$transition && !block.$transition.disabled && moveType !== 2) if (moveType === 0) performTransitionEnter(block, block.$transition, () => parent.insertBefore(block, anchor), parentSuspense, true);
|
|
3818
|
+
if (block instanceof Node) if (isTransitionEnabled && block instanceof Element && block.$transition && !block.$transition.disabled && moveType !== 2) if (moveType === 0) performTransitionEnter(block, block.$transition, () => parent.insertBefore(block, anchor), parentSuspense, true);
|
|
3382
3819
|
else performTransitionLeave(block, block.$transition, () => {
|
|
3383
3820
|
if (moveType === 1 && parentComponent && parentComponent.isUnmounted) block.remove();
|
|
3384
3821
|
else parent.insertBefore(block, anchor);
|
|
@@ -3401,7 +3838,7 @@ function prepend(parent, ...blocks) {
|
|
|
3401
3838
|
while (i--) insert(blocks[i], parent, 0);
|
|
3402
3839
|
}
|
|
3403
3840
|
function remove(block, parent) {
|
|
3404
|
-
if (block instanceof Node) if (block.$transition && block instanceof Element) performTransitionLeave(block, block.$transition, () => parent && parent.removeChild(block));
|
|
3841
|
+
if (block instanceof Node) if (isTransitionEnabled && block.$transition && block instanceof Element) performTransitionLeave(block, block.$transition, () => parent && parent.removeChild(block));
|
|
3405
3842
|
else parent && parent.removeChild(block);
|
|
3406
3843
|
else if (isVaporComponent(block)) unmountComponent(block, parent);
|
|
3407
3844
|
else if (isArray(block)) for (let i = 0; i < block.length; i++) remove(block[i], parent);
|
|
@@ -3421,7 +3858,7 @@ function normalizeBlock(block) {
|
|
|
3421
3858
|
if (block instanceof Node) nodes.push(block);
|
|
3422
3859
|
else if (isArray(block)) block.forEach((child) => nodes.push(...normalizeBlock(child)));
|
|
3423
3860
|
else if (isVaporComponent(block)) nodes.push(...normalizeBlock(block.block));
|
|
3424
|
-
else if (isTeleportFragment(block)) nodes.push(block.placeholder, block.anchor);
|
|
3861
|
+
else if (isTeleportEnabled && isTeleportFragment(block)) nodes.push(block.placeholder, block.anchor);
|
|
3425
3862
|
else {
|
|
3426
3863
|
nodes.push(...normalizeBlock(block.nodes));
|
|
3427
3864
|
block.anchor && nodes.push(block.anchor);
|
|
@@ -3468,7 +3905,7 @@ function hmrRerender(instance) {
|
|
|
3468
3905
|
insert(instance.block, parent, anchor);
|
|
3469
3906
|
}
|
|
3470
3907
|
function hmrReload(instance, newComp) {
|
|
3471
|
-
if (instance.parent && isKeepAlive(instance.parent)) {
|
|
3908
|
+
if (isKeepAliveEnabled && instance.parent && isKeepAlive(instance.parent)) {
|
|
3472
3909
|
instance.parent.hmrRerender();
|
|
3473
3910
|
return;
|
|
3474
3911
|
}
|
|
@@ -3528,8 +3965,8 @@ function replaceBlockInstance(block, instance, newInstance) {
|
|
|
3528
3965
|
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext, managedMount = false) {
|
|
3529
3966
|
const _insertionParent = insertionParent;
|
|
3530
3967
|
const _insertionAnchor = insertionAnchor;
|
|
3531
|
-
const _isLastInsertion = isLastInsertion;
|
|
3532
3968
|
let hydrationClose = null;
|
|
3969
|
+
let hydrationCursor = null;
|
|
3533
3970
|
let exitHydrationBoundary;
|
|
3534
3971
|
let deferHydrationBoundary = false;
|
|
3535
3972
|
const finalizeHydrationBoundary = () => {
|
|
@@ -3537,7 +3974,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3537
3974
|
if (hydrationClose && currentHydrationNode === hydrationClose) advanceHydrationNode(hydrationClose);
|
|
3538
3975
|
};
|
|
3539
3976
|
if (isHydrating$1) {
|
|
3540
|
-
|
|
3977
|
+
hydrationCursor = enterHydrationCursor();
|
|
3541
3978
|
if (component.__multiRoot && isComment(currentHydrationNode, "[")) {
|
|
3542
3979
|
hydrationClose = locateEndAnchor(currentHydrationNode);
|
|
3543
3980
|
exitHydrationBoundary = enterHydrationBoundary(hydrationClose && markHydrationAnchor(hydrationClose));
|
|
@@ -3546,13 +3983,13 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3546
3983
|
} else resetInsertionState();
|
|
3547
3984
|
try {
|
|
3548
3985
|
let prevSuspense = null;
|
|
3549
|
-
if (currentInstance && currentInstance.suspense) prevSuspense = setParentSuspense(currentInstance.suspense);
|
|
3550
|
-
if ((isSingleRoot || currentInstance && isVaporTransition(currentInstance.type)) && component.inheritAttrs !== false && isVaporComponent(currentInstance) && currentInstance.hasFallthrough) {
|
|
3986
|
+
if (isSuspenseEnabled && currentInstance && currentInstance.suspense) prevSuspense = setParentSuspense(currentInstance.suspense);
|
|
3987
|
+
if ((isSingleRoot || (isTransitionEnabled ? currentInstance && isVaporTransition(currentInstance.type) : false)) && component.inheritAttrs !== false && isVaporComponent(currentInstance) && currentInstance.hasFallthrough) {
|
|
3551
3988
|
const attrs = currentInstance.attrs;
|
|
3552
3989
|
if (rawProps && rawProps !== EMPTY_OBJ) (rawProps.$ || (rawProps.$ = [])).push(() => attrs);
|
|
3553
3990
|
else rawProps = { $: [() => attrs] };
|
|
3554
3991
|
}
|
|
3555
|
-
if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
3992
|
+
if (isKeepAliveEnabled && currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
3556
3993
|
const cached = currentInstance.ctx.getCachedComponent(component);
|
|
3557
3994
|
if (cached) return cached;
|
|
3558
3995
|
}
|
|
@@ -3560,24 +3997,19 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3560
3997
|
const frag = appContext.vapor.vdomMount(component, currentInstance, rawProps, rawSlots);
|
|
3561
3998
|
if (!isHydrating$1) {
|
|
3562
3999
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3563
|
-
} else
|
|
3564
|
-
frag.hydrate();
|
|
3565
|
-
if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
3566
|
-
}
|
|
4000
|
+
} else frag.hydrate();
|
|
3567
4001
|
return frag;
|
|
3568
4002
|
}
|
|
3569
|
-
if (isVaporTeleport(component)) {
|
|
4003
|
+
if (isTeleportEnabled && isVaporTeleport(component)) {
|
|
3570
4004
|
const frag = component.process(rawProps, rawSlots);
|
|
4005
|
+
if (_insertionParent) onScopeDispose$1(() => frag.dispose(), true);
|
|
3571
4006
|
if (!isHydrating$1) {
|
|
3572
4007
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3573
|
-
} else
|
|
3574
|
-
frag.hydrate();
|
|
3575
|
-
if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
3576
|
-
}
|
|
4008
|
+
} else frag.hydrate();
|
|
3577
4009
|
return frag;
|
|
3578
4010
|
}
|
|
3579
4011
|
const instance = new VaporComponentInstance(component, rawProps, rawSlots, appContext, once);
|
|
3580
|
-
if (currentKeepAliveCtx && !isAsyncWrapper(instance)) {
|
|
4012
|
+
if (isKeepAliveEnabled && currentKeepAliveCtx && !isAsyncWrapper(instance)) {
|
|
3581
4013
|
currentKeepAliveCtx.processShapeFlag(instance);
|
|
3582
4014
|
setCurrentKeepAliveCtx(null);
|
|
3583
4015
|
}
|
|
@@ -3598,21 +4030,24 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3598
4030
|
popWarningContext();
|
|
3599
4031
|
endMeasure(instance, "init");
|
|
3600
4032
|
}
|
|
3601
|
-
if (currentInstance && currentInstance.suspense) setParentSuspense(prevSuspense);
|
|
4033
|
+
if (isSuspenseEnabled && currentInstance && currentInstance.suspense) setParentSuspense(prevSuspense);
|
|
3602
4034
|
setCurrentSlotOwner(prevSlotOwner);
|
|
3603
4035
|
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
3604
4036
|
if (!managedMount && (_insertionParent || isHydrating$1)) mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
3605
|
-
if (isHydrating$1 &&
|
|
3606
|
-
if (isHydrating$1 && hydrationClose && instance.suspense && instance.asyncDep && !instance.asyncResolved && instance.restoreAsyncContext) {
|
|
4037
|
+
if (isSuspenseEnabled && isHydrating$1 && hydrationClose && instance.suspense && instance.asyncDep && !instance.asyncResolved && instance.restoreAsyncContext) {
|
|
3607
4038
|
deferHydrationBoundary = true;
|
|
3608
4039
|
instance.deferredHydrationBoundary = () => {
|
|
3609
4040
|
if (instance.block && hydrationClose && findBlockNode(instance.block).nextNode === hydrationClose.nextSibling) setCurrentHydrationNode(hydrationClose);
|
|
3610
4041
|
finalizeHydrationBoundary();
|
|
3611
4042
|
};
|
|
4043
|
+
exitHydrationCursor(hydrationCursor);
|
|
3612
4044
|
}
|
|
3613
4045
|
return instance;
|
|
3614
4046
|
} finally {
|
|
3615
|
-
if (isHydrating$1 && !deferHydrationBoundary)
|
|
4047
|
+
if (isHydrating$1 && !deferHydrationBoundary) {
|
|
4048
|
+
finalizeHydrationBoundary();
|
|
4049
|
+
exitHydrationCursor(hydrationCursor);
|
|
4050
|
+
}
|
|
3616
4051
|
}
|
|
3617
4052
|
}
|
|
3618
4053
|
function setupComponent(instance, component) {
|
|
@@ -3649,22 +4084,30 @@ function createDevSetupStateProxy(instance) {
|
|
|
3649
4084
|
return Reflect.get(target, key, receiver);
|
|
3650
4085
|
} });
|
|
3651
4086
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
function devRender(instance) {
|
|
3656
|
-
instance.block = (instance.type.render ? callWithErrorHandling(instance.type.render, instance, 1, [
|
|
3657
|
-
instance.setupState,
|
|
4087
|
+
function callRender(render, instance, setupState) {
|
|
4088
|
+
return callWithErrorHandling(render, instance, 1, [
|
|
4089
|
+
setupState,
|
|
3658
4090
|
instance.props,
|
|
3659
4091
|
instance.emit,
|
|
3660
4092
|
instance.attrs,
|
|
3661
4093
|
instance.slots
|
|
3662
|
-
])
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
4094
|
+
]);
|
|
4095
|
+
}
|
|
4096
|
+
/**
|
|
4097
|
+
* dev only
|
|
4098
|
+
*/
|
|
4099
|
+
function devRender(instance) {
|
|
4100
|
+
const prev = setCurrentRenderingInstance(instance);
|
|
4101
|
+
try {
|
|
4102
|
+
instance.block = (instance.type.render ? callRender(instance.type.render, instance, instance.setupState) : callWithErrorHandling(isFunction(instance.type) ? instance.type : instance.type.setup, instance, 0, [instance.props, {
|
|
4103
|
+
slots: instance.slots,
|
|
4104
|
+
attrs: instance.attrs,
|
|
4105
|
+
emit: instance.emit,
|
|
4106
|
+
expose: instance.expose
|
|
4107
|
+
}])) || [];
|
|
4108
|
+
} finally {
|
|
4109
|
+
setCurrentRenderingInstance(prev);
|
|
4110
|
+
}
|
|
3668
4111
|
}
|
|
3669
4112
|
const emptyContext = {
|
|
3670
4113
|
app: null,
|
|
@@ -3699,8 +4142,12 @@ var VaporComponentInstance = class {
|
|
|
3699
4142
|
this.expose = expose.bind(null, this);
|
|
3700
4143
|
this.refs = EMPTY_OBJ;
|
|
3701
4144
|
this.emitted = this.exposed = this.exposeProxy = this.propsDefaults = null;
|
|
3702
|
-
this.suspense =
|
|
3703
|
-
this.suspenseId =
|
|
4145
|
+
this.suspense = null;
|
|
4146
|
+
this.suspenseId = 0;
|
|
4147
|
+
if (isSuspenseEnabled) {
|
|
4148
|
+
this.suspense = parentSuspense;
|
|
4149
|
+
this.suspenseId = parentSuspense ? parentSuspense.pendingId : 0;
|
|
4150
|
+
}
|
|
3704
4151
|
this.asyncDep = null;
|
|
3705
4152
|
this.asyncResolved = false;
|
|
3706
4153
|
this.isMounted = this.isUnmounted = this.isUpdating = this.isDeactivated = false;
|
|
@@ -3763,8 +4210,8 @@ function isReusableNullComponentAnchor(node) {
|
|
|
3763
4210
|
function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
3764
4211
|
const _insertionParent = insertionParent;
|
|
3765
4212
|
const _insertionAnchor = insertionAnchor;
|
|
3766
|
-
|
|
3767
|
-
if (isHydrating$1)
|
|
4213
|
+
let hydrationCursor = null;
|
|
4214
|
+
if (isHydrating$1) hydrationCursor = enterHydrationCursor();
|
|
3768
4215
|
else resetInsertionState();
|
|
3769
4216
|
const el = isHydrating$1 ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : /* @__PURE__ */ createElement(comp);
|
|
3770
4217
|
el.$root = isSingleRoot;
|
|
@@ -3798,11 +4245,11 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
3798
4245
|
}
|
|
3799
4246
|
if (!isHydrating$1) {
|
|
3800
4247
|
if (_insertionParent) insert(el, _insertionParent, _insertionAnchor);
|
|
3801
|
-
} else
|
|
4248
|
+
} else exitHydrationCursor(hydrationCursor);
|
|
3802
4249
|
return el;
|
|
3803
4250
|
}
|
|
3804
4251
|
function mountComponent(instance, parent, anchor) {
|
|
3805
|
-
if (instance.suspense && instance.asyncDep && !instance.asyncResolved) {
|
|
4252
|
+
if (isSuspenseEnabled && instance.suspense && instance.asyncDep && !instance.asyncResolved) {
|
|
3806
4253
|
const component = instance.type;
|
|
3807
4254
|
instance.suspense.registerDep(instance, (setupResult) => {
|
|
3808
4255
|
const reset = instance.restoreAsyncContext && instance.restoreAsyncContext();
|
|
@@ -3818,7 +4265,7 @@ function mountComponent(instance, parent, anchor) {
|
|
|
3818
4265
|
});
|
|
3819
4266
|
return;
|
|
3820
4267
|
}
|
|
3821
|
-
if (instance.shapeFlag & 512) {
|
|
4268
|
+
if (isKeepAliveEnabled && instance.shapeFlag & 512) {
|
|
3822
4269
|
instance.parent.ctx.activate(instance, parent, anchor);
|
|
3823
4270
|
return;
|
|
3824
4271
|
}
|
|
@@ -3831,12 +4278,12 @@ function mountComponent(instance, parent, anchor) {
|
|
|
3831
4278
|
setComponentScopeId(instance);
|
|
3832
4279
|
}
|
|
3833
4280
|
if (instance.m) queuePostFlushCb(instance.m);
|
|
3834
|
-
if (instance.shapeFlag & 256 && instance.a) queuePostFlushCb(instance.a);
|
|
4281
|
+
if (isKeepAliveEnabled && instance.shapeFlag & 256 && instance.a) queuePostFlushCb(instance.a);
|
|
3835
4282
|
instance.isMounted = true;
|
|
3836
4283
|
if (!!(process.env.NODE_ENV !== "production")) endMeasure(instance, `mount`);
|
|
3837
4284
|
}
|
|
3838
4285
|
function unmountComponent(instance, parentNode) {
|
|
3839
|
-
if (instance.shapeFlag & 256 && instance.parent && instance.parent.vapor && instance.parent.ctx) {
|
|
4286
|
+
if (isKeepAliveEnabled && instance.shapeFlag & 256 && instance.parent && instance.parent.vapor && instance.parent.ctx) {
|
|
3840
4287
|
if (parentNode) instance.parent.ctx.deactivate(instance);
|
|
3841
4288
|
return;
|
|
3842
4289
|
}
|
|
@@ -3857,7 +4304,7 @@ function getExposed(instance) {
|
|
|
3857
4304
|
function getRootElement(block, onDynamicFragment, recurse = true) {
|
|
3858
4305
|
if (block instanceof Element) return block;
|
|
3859
4306
|
if (recurse && isVaporComponent(block)) return getRootElement(block.block, onDynamicFragment, recurse);
|
|
3860
|
-
if (isFragment(block) && !isTeleportFragment(block)) {
|
|
4307
|
+
if (isFragment(block) && !(isTeleportEnabled && isTeleportFragment(block))) {
|
|
3861
4308
|
if (block instanceof DynamicFragment && onDynamicFragment) onDynamicFragment(block);
|
|
3862
4309
|
const { nodes } = block;
|
|
3863
4310
|
if (nodes instanceof Element && nodes.$root) return nodes;
|
|
@@ -3878,9 +4325,6 @@ function getRootElement(block, onDynamicFragment, recurse = true) {
|
|
|
3878
4325
|
return hasComment ? singleRoot : void 0;
|
|
3879
4326
|
}
|
|
3880
4327
|
}
|
|
3881
|
-
function isVaporTransition(component) {
|
|
3882
|
-
return getComponentName(component) === "VaporTransition";
|
|
3883
|
-
}
|
|
3884
4328
|
function handleSetupResult(setupResult, component, instance) {
|
|
3885
4329
|
if (!!(process.env.NODE_ENV !== "production")) pushWarningContext(instance);
|
|
3886
4330
|
if (!!(process.env.NODE_ENV !== "production") && !isBlock(setupResult)) if (isFunction(component)) {
|
|
@@ -3895,158 +4339,413 @@ function handleSetupResult(setupResult, component, instance) {
|
|
|
3895
4339
|
if (!!(process.env.NODE_ENV !== "production")) instance.setupState = createDevSetupStateProxy(instance);
|
|
3896
4340
|
devRender(instance);
|
|
3897
4341
|
}
|
|
3898
|
-
else if (setupResult === EMPTY_OBJ && component.render) instance.block =
|
|
3899
|
-
else instance.block = setupResult;
|
|
3900
|
-
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
3901
|
-
const root = getRootElement(instance.block, (frag) => frag.attrs = instance.attrs, false);
|
|
3902
|
-
if (root) renderEffect(() => {
|
|
3903
|
-
const attrs = isFunction(component) && !isVaporTransition(component) ? getFunctionalFallthrough(instance.attrs) : instance.attrs;
|
|
3904
|
-
if (attrs) applyFallthroughProps(root, attrs);
|
|
3905
|
-
});
|
|
3906
|
-
else if (!!(process.env.NODE_ENV !== "production") && (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || isTeleportFragment(instance.block))) warnExtraneousAttributes(instance.attrs);
|
|
4342
|
+
else if (setupResult === EMPTY_OBJ && component.render) instance.block = callRender(component.render, instance, setupResult);
|
|
4343
|
+
else instance.block = setupResult;
|
|
4344
|
+
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
4345
|
+
const root = getRootElement(instance.block, (frag) => frag.attrs = instance.attrs, false);
|
|
4346
|
+
if (root) renderEffect(() => {
|
|
4347
|
+
const attrs = isFunction(component) && !(isTransitionEnabled ? isVaporTransition(component) : false) ? getFunctionalFallthrough(instance.attrs) : instance.attrs;
|
|
4348
|
+
if (attrs) applyFallthroughProps(root, attrs);
|
|
4349
|
+
});
|
|
4350
|
+
else if (!!(process.env.NODE_ENV !== "production") && (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || isTeleportEnabled && isTeleportFragment(instance.block))) warnExtraneousAttributes(instance.attrs);
|
|
4351
|
+
}
|
|
4352
|
+
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
|
|
4353
|
+
}
|
|
4354
|
+
function getCurrentScopeId() {
|
|
4355
|
+
const scopeOwner = getScopeOwner();
|
|
4356
|
+
return scopeOwner ? scopeOwner.type.__scopeId : void 0;
|
|
4357
|
+
}
|
|
4358
|
+
//#endregion
|
|
4359
|
+
//#region packages/runtime-vapor/src/apiCreateApp.ts
|
|
4360
|
+
let _createApp;
|
|
4361
|
+
const mountApp = (app, container) => {
|
|
4362
|
+
optimizePropertyLookup();
|
|
4363
|
+
if (container.nodeType === 1) {
|
|
4364
|
+
if (!!(process.env.NODE_ENV !== "production") && container.childNodes.length) warn("mount target container is not empty and will be cleared.");
|
|
4365
|
+
container.textContent = "";
|
|
4366
|
+
}
|
|
4367
|
+
const instance = app._ceComponent || createComponent(app._component, app._props, null, false, false, app._context);
|
|
4368
|
+
mountComponent(instance, container);
|
|
4369
|
+
flushOnAppMount();
|
|
4370
|
+
return instance;
|
|
4371
|
+
};
|
|
4372
|
+
let _hydrateApp;
|
|
4373
|
+
const hydrateApp = (app, container) => {
|
|
4374
|
+
optimizePropertyLookup();
|
|
4375
|
+
let instance;
|
|
4376
|
+
withHydration(container, () => {
|
|
4377
|
+
instance = app._ceComponent || createComponent(app._component, app._props, null, false, false, app._context, true);
|
|
4378
|
+
mountComponent(instance, container);
|
|
4379
|
+
flushOnAppMount();
|
|
4380
|
+
});
|
|
4381
|
+
return instance;
|
|
4382
|
+
};
|
|
4383
|
+
const unmountApp = (app) => {
|
|
4384
|
+
unmountComponent(app._instance, app._container);
|
|
4385
|
+
};
|
|
4386
|
+
function prepareApp() {
|
|
4387
|
+
initFeatureFlags();
|
|
4388
|
+
const target = getGlobalThis();
|
|
4389
|
+
target.__VUE__ = true;
|
|
4390
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
|
4391
|
+
}
|
|
4392
|
+
function postPrepareApp(app) {
|
|
4393
|
+
app.vapor = true;
|
|
4394
|
+
const mount = app.mount;
|
|
4395
|
+
app.mount = (container, ...args) => {
|
|
4396
|
+
container = normalizeContainer(container);
|
|
4397
|
+
const proxy = mount(container, ...args);
|
|
4398
|
+
if (container instanceof Element) {
|
|
4399
|
+
container.removeAttribute("v-cloak");
|
|
4400
|
+
container.setAttribute("data-v-app", "");
|
|
4401
|
+
}
|
|
4402
|
+
return proxy;
|
|
4403
|
+
};
|
|
4404
|
+
}
|
|
4405
|
+
const createVaporApp = (comp, props) => {
|
|
4406
|
+
prepareApp();
|
|
4407
|
+
if (!_createApp) _createApp = createAppAPI(mountApp, unmountApp, getExposed);
|
|
4408
|
+
const app = _createApp(comp, props);
|
|
4409
|
+
postPrepareApp(app);
|
|
4410
|
+
return app;
|
|
4411
|
+
};
|
|
4412
|
+
const createVaporSSRApp = (comp, props) => {
|
|
4413
|
+
setIsHydratingEnabled(true);
|
|
4414
|
+
prepareApp();
|
|
4415
|
+
if (!_hydrateApp) _hydrateApp = createAppAPI(hydrateApp, unmountApp, getExposed);
|
|
4416
|
+
const app = _hydrateApp(comp, props);
|
|
4417
|
+
postPrepareApp(app);
|
|
4418
|
+
return app;
|
|
4419
|
+
};
|
|
4420
|
+
//#endregion
|
|
4421
|
+
//#region packages/runtime-vapor/src/apiDefineAsyncComponent.ts
|
|
4422
|
+
function defineVaporAsyncComponent(source) {
|
|
4423
|
+
const { load, getResolvedComp, setPendingRequest, source: { loadingComponent, errorComponent, delay, hydrate: hydrateStrategy, timeout, suspensible = true } } = createAsyncComponentContext(source);
|
|
4424
|
+
return /* @__PURE__ */ defineVaporComponent({
|
|
4425
|
+
name: "VaporAsyncComponentWrapper",
|
|
4426
|
+
__asyncLoader: load,
|
|
4427
|
+
__asyncHydrate(el, instance, hydrate) {
|
|
4428
|
+
if (!isHydrating$1) return;
|
|
4429
|
+
if (isComment(el, "[")) {
|
|
4430
|
+
const end = /* @__PURE__ */ _next(locateEndAnchor(el));
|
|
4431
|
+
const block = instance.block = [el];
|
|
4432
|
+
let cur = el;
|
|
4433
|
+
while (true) {
|
|
4434
|
+
let n = /* @__PURE__ */ _next(cur);
|
|
4435
|
+
if (n && n !== end) block.push(cur = n);
|
|
4436
|
+
else break;
|
|
4437
|
+
}
|
|
4438
|
+
} else instance.block = el;
|
|
4439
|
+
instance.isMounted = true;
|
|
4440
|
+
setCurrentHydrationNode(isComment(el, "[") ? locateEndAnchor(el) : el.nextSibling);
|
|
4441
|
+
performAsyncHydrate(el, instance, () => hydrateNode(el, hydrate), getResolvedComp, load, hydrateStrategy);
|
|
4442
|
+
},
|
|
4443
|
+
get __asyncResolved() {
|
|
4444
|
+
return getResolvedComp();
|
|
4445
|
+
},
|
|
4446
|
+
setup() {
|
|
4447
|
+
const instance = currentInstance;
|
|
4448
|
+
markAsyncBoundary(instance);
|
|
4449
|
+
const frag = !!(process.env.NODE_ENV !== "production") || isHydrating$1 ? new DynamicFragment("async component") : new DynamicFragment();
|
|
4450
|
+
let resolvedComp = getResolvedComp();
|
|
4451
|
+
if (resolvedComp) {
|
|
4452
|
+
frag.update(() => createInnerComp(resolvedComp, instance));
|
|
4453
|
+
return frag;
|
|
4454
|
+
}
|
|
4455
|
+
const onError = (err) => {
|
|
4456
|
+
setPendingRequest(null);
|
|
4457
|
+
handleError(err, instance, 13, !errorComponent);
|
|
4458
|
+
};
|
|
4459
|
+
if (suspensible && instance.suspense) return load().then(() => {
|
|
4460
|
+
resolvedComp = getResolvedComp();
|
|
4461
|
+
if (resolvedComp) frag.update(() => createInnerComp(resolvedComp, instance));
|
|
4462
|
+
return frag;
|
|
4463
|
+
}).catch((err) => {
|
|
4464
|
+
onError(err);
|
|
4465
|
+
if (errorComponent) frag.update(() => createInnerComp(errorComponent, instance, { error: () => err }, {}));
|
|
4466
|
+
return frag;
|
|
4467
|
+
});
|
|
4468
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
4469
|
+
load().then(() => {
|
|
4470
|
+
loaded.value = true;
|
|
4471
|
+
}).catch((err) => {
|
|
4472
|
+
onError(err);
|
|
4473
|
+
error.value = err;
|
|
4474
|
+
});
|
|
4475
|
+
renderEffect(() => {
|
|
4476
|
+
resolvedComp = getResolvedComp();
|
|
4477
|
+
let render;
|
|
4478
|
+
if (loaded.value && resolvedComp) render = () => createInnerComp(resolvedComp, instance);
|
|
4479
|
+
else if (error.value && errorComponent) render = () => createComponent(errorComponent, { error: () => error.value });
|
|
4480
|
+
else if (loadingComponent && !delayed.value) render = () => createComponent(loadingComponent);
|
|
4481
|
+
frag.update(render);
|
|
4482
|
+
if (isKeepAliveEnabled && frag.keepAliveCtx) frag.keepAliveCtx.cacheBlock();
|
|
4483
|
+
});
|
|
4484
|
+
return frag;
|
|
4485
|
+
}
|
|
4486
|
+
});
|
|
4487
|
+
}
|
|
4488
|
+
function createInnerComp(comp, parent, rawProps = parent.rawProps, rawSlots = parent.rawSlots) {
|
|
4489
|
+
const prevInstance = setCurrentInstance(parent);
|
|
4490
|
+
try {
|
|
4491
|
+
return createComponent(comp, rawProps, rawSlots, void 0, void 0, parent.appContext);
|
|
4492
|
+
} finally {
|
|
4493
|
+
setCurrentInstance(...prevInstance);
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
//#endregion
|
|
4497
|
+
//#region packages/runtime-vapor/src/components/Teleport.ts
|
|
4498
|
+
const VaporTeleportImpl = {
|
|
4499
|
+
name: "VaporTeleport",
|
|
4500
|
+
__isTeleport: true,
|
|
4501
|
+
__vapor: true,
|
|
4502
|
+
process(props, slots) {
|
|
4503
|
+
return new TeleportFragment(props, slots);
|
|
4504
|
+
}
|
|
4505
|
+
};
|
|
4506
|
+
var TeleportFragment = class extends VaporFragment {
|
|
4507
|
+
constructor(props, slots) {
|
|
4508
|
+
super([]);
|
|
4509
|
+
this.__isTeleportFragment = true;
|
|
4510
|
+
this.isMounted = false;
|
|
4511
|
+
this.childrenInitialized = false;
|
|
4512
|
+
this.ownerInstance = currentInstance$1;
|
|
4513
|
+
this.childrenScope = getCurrentScope();
|
|
4514
|
+
this.insert = (container, anchor) => {
|
|
4515
|
+
if (isHydrating$1) return;
|
|
4516
|
+
if (!this.placeholder) this.placeholder = !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport start") : /* @__PURE__ */ createTextNode();
|
|
4517
|
+
insert(this.placeholder, container, anchor);
|
|
4518
|
+
insert(this.anchor, container, anchor);
|
|
4519
|
+
this.handlePropsUpdate();
|
|
4520
|
+
};
|
|
4521
|
+
this.dispose = () => {
|
|
4522
|
+
if (this.mountToTargetJob) {
|
|
4523
|
+
this.mountToTargetJob.flags |= 4;
|
|
4524
|
+
this.mountToTargetJob = void 0;
|
|
4525
|
+
}
|
|
4526
|
+
if (this.nodes && this.mountContainer) {
|
|
4527
|
+
remove(this.nodes, this.mountContainer);
|
|
4528
|
+
this.nodes = [];
|
|
4529
|
+
}
|
|
4530
|
+
this.isMounted = false;
|
|
4531
|
+
if (this.targetStart) {
|
|
4532
|
+
remove(this.targetStart, /* @__PURE__ */ parentNode(this.targetStart));
|
|
4533
|
+
this.targetStart = void 0;
|
|
4534
|
+
}
|
|
4535
|
+
if (this.targetAnchor) {
|
|
4536
|
+
remove(this.targetAnchor, /* @__PURE__ */ parentNode(this.targetAnchor));
|
|
4537
|
+
this.targetAnchor = void 0;
|
|
4538
|
+
}
|
|
4539
|
+
this.target = void 0;
|
|
4540
|
+
this.mountContainer = void 0;
|
|
4541
|
+
this.mountAnchor = void 0;
|
|
4542
|
+
};
|
|
4543
|
+
this.remove = (_parent) => {
|
|
4544
|
+
this.dispose();
|
|
4545
|
+
if (this.anchor) {
|
|
4546
|
+
remove(this.anchor, /* @__PURE__ */ parentNode(this.anchor));
|
|
4547
|
+
this.anchor = void 0;
|
|
4548
|
+
}
|
|
4549
|
+
if (this.placeholder) {
|
|
4550
|
+
remove(this.placeholder, /* @__PURE__ */ parentNode(this.placeholder));
|
|
4551
|
+
this.placeholder = void 0;
|
|
4552
|
+
}
|
|
4553
|
+
};
|
|
4554
|
+
this.hydrate = () => {
|
|
4555
|
+
if (!isHydrating$1) return;
|
|
4556
|
+
const target = this.target = resolveTeleportTarget(this.resolvedProps, querySelector);
|
|
4557
|
+
const disabled = isTeleportDisabled(this.resolvedProps);
|
|
4558
|
+
this.placeholder = currentHydrationNode;
|
|
4559
|
+
if (target) {
|
|
4560
|
+
const targetNode = target._lpa || target.firstChild;
|
|
4561
|
+
if (disabled) this.hydrateDisabledTeleport(target, targetNode);
|
|
4562
|
+
else {
|
|
4563
|
+
this.anchor = markHydrationAnchor(locateTeleportEndAnchor(currentHydrationNode.nextSibling));
|
|
4564
|
+
this.mountContainer = target;
|
|
4565
|
+
this.hydrateTargetAnchors(target, targetNode);
|
|
4566
|
+
this.mountAnchor = this.targetAnchor;
|
|
4567
|
+
if (targetNode) setCurrentHydrationNode(targetNode.nextSibling);
|
|
4568
|
+
if (!this.targetAnchor) this.mountChildren(target);
|
|
4569
|
+
else this.initChildren();
|
|
4570
|
+
}
|
|
4571
|
+
} else if (disabled) this.hydrateDisabledTeleport(null, null);
|
|
4572
|
+
else this.anchor = markHydrationAnchor(locateTeleportEndAnchor(currentHydrationNode.nextSibling));
|
|
4573
|
+
if (target || disabled) updateCssVars(this);
|
|
4574
|
+
advanceHydrationNode(this.anchor);
|
|
4575
|
+
};
|
|
4576
|
+
this.rawProps = props;
|
|
4577
|
+
this.rawSlots = slots;
|
|
4578
|
+
this.parentComponent = getScopeOwner();
|
|
4579
|
+
this.anchor = isHydrating$1 ? void 0 : !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("teleport end") : /* @__PURE__ */ createTextNode();
|
|
4580
|
+
renderEffect(() => {
|
|
4581
|
+
const prevTo = this.resolvedProps && this.resolvedProps.to;
|
|
4582
|
+
const wasDisabled = this.isDisabled;
|
|
4583
|
+
this.resolvedProps = extend({}, new Proxy(this.rawProps, rawPropsProxyHandlers));
|
|
4584
|
+
this.isDisabled = isTeleportDisabled(this.resolvedProps);
|
|
4585
|
+
if (wasDisabled !== this.isDisabled || !this.isDisabled && prevTo !== this.resolvedProps.to) this.handlePropsUpdate();
|
|
4586
|
+
});
|
|
4587
|
+
}
|
|
4588
|
+
get parent() {
|
|
4589
|
+
return this.anchor ? /* @__PURE__ */ parentNode(this.anchor) : null;
|
|
4590
|
+
}
|
|
4591
|
+
initChildren() {
|
|
4592
|
+
const prevInstance = setCurrentInstance(this.ownerInstance, this.childrenScope);
|
|
4593
|
+
try {
|
|
4594
|
+
this.childrenInitialized = true;
|
|
4595
|
+
renderEffect(() => this.runWithRenderCtx(() => this.handleChildrenUpdate(this.rawSlots && this.rawSlots.default ? this.rawSlots.default() : []), this.childrenScope));
|
|
4596
|
+
this.bindChildren(this.nodes);
|
|
4597
|
+
} finally {
|
|
4598
|
+
setCurrentInstance(...prevInstance);
|
|
4599
|
+
}
|
|
4600
|
+
}
|
|
4601
|
+
ensureChildrenInitialized() {
|
|
4602
|
+
if (!this.childrenInitialized) this.initChildren();
|
|
4603
|
+
}
|
|
4604
|
+
registerUpdateCssVars(block) {
|
|
4605
|
+
if (isFragment(block)) {
|
|
4606
|
+
(block.onUpdated || (block.onUpdated = [])).push(() => updateCssVars(this));
|
|
4607
|
+
this.registerUpdateCssVars(block.nodes);
|
|
4608
|
+
} else if (isVaporComponent(block)) this.registerUpdateCssVars(block.block);
|
|
4609
|
+
else if (isArray(block)) block.forEach((node) => this.registerUpdateCssVars(node));
|
|
4610
|
+
}
|
|
4611
|
+
bindChildren(block) {
|
|
4612
|
+
if (this.parentComponent && this.parentComponent.ut) this.registerUpdateCssVars(block);
|
|
4613
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4614
|
+
if (isVaporComponent(block)) block.parentTeleport = this;
|
|
4615
|
+
else if (isArray(block)) block.forEach((node) => isVaporComponent(node) && (node.parentTeleport = this));
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
handleChildrenUpdate(children) {
|
|
4619
|
+
if (isHydrating$1 || !this.parent || !this.mountContainer) {
|
|
4620
|
+
this.nodes = children;
|
|
4621
|
+
return;
|
|
4622
|
+
}
|
|
4623
|
+
remove(this.nodes, this.mountContainer);
|
|
4624
|
+
insert(this.nodes = children, this.mountContainer, this.mountAnchor);
|
|
4625
|
+
this.bindChildren(this.nodes);
|
|
4626
|
+
updateCssVars(this);
|
|
4627
|
+
}
|
|
4628
|
+
mount(parent, anchor) {
|
|
4629
|
+
if (isTransitionEnabled && this.$transition && !this.isMounted) applyTransitionHooks(this.nodes, this.$transition);
|
|
4630
|
+
if (this.isMounted) move(this.nodes, this.mountContainer = parent, this.mountAnchor = anchor, 2);
|
|
4631
|
+
else {
|
|
4632
|
+
insert(this.nodes, this.mountContainer = parent, this.mountAnchor = anchor);
|
|
4633
|
+
this.isMounted = true;
|
|
4634
|
+
}
|
|
4635
|
+
updateCssVars(this);
|
|
4636
|
+
}
|
|
4637
|
+
mountToTarget() {
|
|
4638
|
+
const target = this.target = resolveTeleportTarget(this.resolvedProps, querySelector);
|
|
4639
|
+
if (target) {
|
|
4640
|
+
if (!this.targetAnchor || /* @__PURE__ */ parentNode(this.targetAnchor) !== target) {
|
|
4641
|
+
if (this.targetStart) remove(this.targetStart, /* @__PURE__ */ parentNode(this.targetStart));
|
|
4642
|
+
if (this.targetAnchor) remove(this.targetAnchor, /* @__PURE__ */ parentNode(this.targetAnchor));
|
|
4643
|
+
insert(this.targetStart = /* @__PURE__ */ createTextNode(""), target);
|
|
4644
|
+
insert(this.targetAnchor = /* @__PURE__ */ createTextNode(""), target);
|
|
4645
|
+
}
|
|
4646
|
+
this.ensureChildrenInitialized();
|
|
4647
|
+
if (this.parentComponent && this.parentComponent.isCE) (this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
4648
|
+
this.mount(target, this.targetAnchor);
|
|
4649
|
+
} else if (!!(process.env.NODE_ENV !== "production")) warn(`Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`, target, `(${typeof target})`);
|
|
4650
|
+
}
|
|
4651
|
+
clearMainViewChildren() {
|
|
4652
|
+
if (!this.placeholder || !this.anchor) return;
|
|
4653
|
+
let node = this.placeholder.nextSibling;
|
|
4654
|
+
while (node && node !== this.anchor) {
|
|
4655
|
+
const next = node.nextSibling;
|
|
4656
|
+
remove(node, /* @__PURE__ */ parentNode(node));
|
|
4657
|
+
node = next;
|
|
4658
|
+
}
|
|
4659
|
+
this.isMounted = false;
|
|
4660
|
+
this.mountContainer = null;
|
|
4661
|
+
}
|
|
4662
|
+
handlePropsUpdate() {
|
|
4663
|
+
if (!this.parent || isHydrating$1) return;
|
|
4664
|
+
if (this.isDisabled) {
|
|
4665
|
+
this.ensureChildrenInitialized();
|
|
4666
|
+
this.mount(this.parent, this.anchor);
|
|
4667
|
+
} else {
|
|
4668
|
+
if (this.placeholder && this.anchor && this.placeholder.nextSibling !== this.anchor) this.clearMainViewChildren();
|
|
4669
|
+
if (isTeleportDeferred(this.resolvedProps) || !this.parent.isConnected) {
|
|
4670
|
+
if (!this.mountToTargetJob || this.mountToTargetJob.flags & 4) this.mountToTargetJob = () => {
|
|
4671
|
+
this.mountToTargetJob = void 0;
|
|
4672
|
+
if (this.isDisabled || !this.anchor) return;
|
|
4673
|
+
this.mountToTarget();
|
|
4674
|
+
};
|
|
4675
|
+
queuePostFlushCb(this.mountToTargetJob);
|
|
4676
|
+
} else this.mountToTarget();
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
hydrateTargetAnchors(target, targetNode) {
|
|
4680
|
+
let targetAnchor = targetNode;
|
|
4681
|
+
while (targetAnchor) {
|
|
4682
|
+
if (targetAnchor.nodeType === 8) {
|
|
4683
|
+
if (targetAnchor.data === "teleport start anchor") this.targetStart = targetAnchor;
|
|
4684
|
+
else if (targetAnchor.data === "teleport anchor") {
|
|
4685
|
+
this.targetAnchor = markHydrationAnchor(targetAnchor);
|
|
4686
|
+
target._lpa = this.targetAnchor.nextSibling;
|
|
4687
|
+
break;
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
targetAnchor = targetAnchor.nextSibling;
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
hydrateDisabledTeleport(target, targetNode) {
|
|
4694
|
+
if (!isHydrating$1) return;
|
|
4695
|
+
let nextNode = this.placeholder.nextSibling;
|
|
4696
|
+
setCurrentHydrationNode(nextNode);
|
|
4697
|
+
this.mountAnchor = this.anchor = markHydrationAnchor(locateTeleportEndAnchor(nextNode));
|
|
4698
|
+
this.mountContainer = /* @__PURE__ */ parentNode(this.anchor);
|
|
4699
|
+
if (target) this.hydrateTargetAnchors(target, targetNode);
|
|
4700
|
+
else {
|
|
4701
|
+
this.targetStart = targetNode;
|
|
4702
|
+
this.targetAnchor = targetNode && targetNode.nextSibling;
|
|
4703
|
+
}
|
|
4704
|
+
this.initChildren();
|
|
3907
4705
|
}
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
const mountApp = (app, container) => {
|
|
3918
|
-
optimizePropertyLookup();
|
|
3919
|
-
if (container.nodeType === 1) {
|
|
3920
|
-
if (!!(process.env.NODE_ENV !== "production") && container.childNodes.length) warn("mount target container is not empty and will be cleared.");
|
|
3921
|
-
container.textContent = "";
|
|
4706
|
+
mountChildren(target) {
|
|
4707
|
+
if (!isHydrating$1) return;
|
|
4708
|
+
target.appendChild(this.targetStart = /* @__PURE__ */ createTextNode(""));
|
|
4709
|
+
target.appendChild(this.mountAnchor = this.targetAnchor = markHydrationAnchor(/* @__PURE__ */ createTextNode("")));
|
|
4710
|
+
if (!isMismatchAllowed(target, 1)) {
|
|
4711
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) warn(`Hydration children mismatch on`, target, `\nServer rendered element contains fewer child nodes than client nodes.`);
|
|
4712
|
+
logMismatchError();
|
|
4713
|
+
}
|
|
4714
|
+
runWithoutHydration(this.initChildren.bind(this));
|
|
3922
4715
|
}
|
|
3923
|
-
const instance = app._ceComponent || createComponent(app._component, app._props, null, false, false, app._context);
|
|
3924
|
-
mountComponent(instance, container);
|
|
3925
|
-
flushOnAppMount();
|
|
3926
|
-
return instance;
|
|
3927
|
-
};
|
|
3928
|
-
let _hydrateApp;
|
|
3929
|
-
const hydrateApp = (app, container) => {
|
|
3930
|
-
optimizePropertyLookup();
|
|
3931
|
-
let instance;
|
|
3932
|
-
withHydration(container, () => {
|
|
3933
|
-
instance = app._ceComponent || createComponent(app._component, app._props, null, false, false, app._context, true);
|
|
3934
|
-
mountComponent(instance, container);
|
|
3935
|
-
flushOnAppMount();
|
|
3936
|
-
});
|
|
3937
|
-
return instance;
|
|
3938
|
-
};
|
|
3939
|
-
const unmountApp = (app) => {
|
|
3940
|
-
unmountComponent(app._instance, app._container);
|
|
3941
4716
|
};
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
4717
|
+
const VaporTeleport = /* @__PURE__ */ enableTeleport(VaporTeleportImpl);
|
|
4718
|
+
function locateTeleportEndAnchor(node = currentHydrationNode) {
|
|
4719
|
+
let depth = 0;
|
|
4720
|
+
while (node) {
|
|
4721
|
+
if (isComment(node, "teleport start")) depth++;
|
|
4722
|
+
else if (isComment(node, "teleport end")) if (depth === 0) return node;
|
|
4723
|
+
else depth--;
|
|
4724
|
+
node = node.nextSibling;
|
|
4725
|
+
}
|
|
4726
|
+
return null;
|
|
3947
4727
|
}
|
|
3948
|
-
function
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
4728
|
+
function updateCssVars(frag) {
|
|
4729
|
+
const ctx = frag.parentComponent;
|
|
4730
|
+
if (ctx && ctx.ut) {
|
|
4731
|
+
let node, anchor;
|
|
4732
|
+
if (frag.isDisabled) {
|
|
4733
|
+
node = frag.placeholder;
|
|
4734
|
+
anchor = frag.anchor;
|
|
4735
|
+
} else {
|
|
4736
|
+
node = frag.targetStart;
|
|
4737
|
+
anchor = frag.targetAnchor;
|
|
3957
4738
|
}
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
};
|
|
3968
|
-
const createVaporSSRApp = (comp, props) => {
|
|
3969
|
-
setIsHydratingEnabled(true);
|
|
3970
|
-
prepareApp();
|
|
3971
|
-
if (!_hydrateApp) _hydrateApp = createAppAPI(hydrateApp, unmountApp, getExposed);
|
|
3972
|
-
const app = _hydrateApp(comp, props);
|
|
3973
|
-
postPrepareApp(app);
|
|
3974
|
-
return app;
|
|
3975
|
-
};
|
|
3976
|
-
//#endregion
|
|
3977
|
-
//#region packages/runtime-vapor/src/apiDefineAsyncComponent.ts
|
|
3978
|
-
function defineVaporAsyncComponent(source) {
|
|
3979
|
-
const { load, getResolvedComp, setPendingRequest, source: { loadingComponent, errorComponent, delay, hydrate: hydrateStrategy, timeout, suspensible = true } } = createAsyncComponentContext(source);
|
|
3980
|
-
return /* @__PURE__ */ defineVaporComponent({
|
|
3981
|
-
name: "VaporAsyncComponentWrapper",
|
|
3982
|
-
__asyncLoader: load,
|
|
3983
|
-
__asyncHydrate(el, instance, hydrate) {
|
|
3984
|
-
if (!isHydrating$1) return;
|
|
3985
|
-
if (isComment(el, "[")) {
|
|
3986
|
-
const end = /* @__PURE__ */ _next(locateEndAnchor(el));
|
|
3987
|
-
const block = instance.block = [el];
|
|
3988
|
-
let cur = el;
|
|
3989
|
-
while (true) {
|
|
3990
|
-
let n = /* @__PURE__ */ _next(cur);
|
|
3991
|
-
if (n && n !== end) block.push(cur = n);
|
|
3992
|
-
else break;
|
|
3993
|
-
}
|
|
3994
|
-
} else instance.block = el;
|
|
3995
|
-
instance.isMounted = true;
|
|
3996
|
-
setCurrentHydrationNode(isComment(el, "[") ? locateEndAnchor(el) : el.nextSibling);
|
|
3997
|
-
performAsyncHydrate(el, instance, () => hydrateNode(el, hydrate), getResolvedComp, load, hydrateStrategy);
|
|
3998
|
-
},
|
|
3999
|
-
get __asyncResolved() {
|
|
4000
|
-
return getResolvedComp();
|
|
4001
|
-
},
|
|
4002
|
-
setup() {
|
|
4003
|
-
const instance = currentInstance;
|
|
4004
|
-
markAsyncBoundary(instance);
|
|
4005
|
-
const frag = !!(process.env.NODE_ENV !== "production") || isHydrating$1 ? new DynamicFragment("async component") : new DynamicFragment();
|
|
4006
|
-
let resolvedComp = getResolvedComp();
|
|
4007
|
-
if (resolvedComp) {
|
|
4008
|
-
frag.update(() => createInnerComp(resolvedComp, instance));
|
|
4009
|
-
return frag;
|
|
4010
|
-
}
|
|
4011
|
-
const onError = (err) => {
|
|
4012
|
-
setPendingRequest(null);
|
|
4013
|
-
handleError(err, instance, 13, !errorComponent);
|
|
4014
|
-
};
|
|
4015
|
-
if (suspensible && instance.suspense) return load().then(() => {
|
|
4016
|
-
resolvedComp = getResolvedComp();
|
|
4017
|
-
if (resolvedComp) frag.update(() => createInnerComp(resolvedComp, instance));
|
|
4018
|
-
return frag;
|
|
4019
|
-
}).catch((err) => {
|
|
4020
|
-
onError(err);
|
|
4021
|
-
if (errorComponent) frag.update(() => createInnerComp(errorComponent, instance, { error: () => err }, {}));
|
|
4022
|
-
return frag;
|
|
4023
|
-
});
|
|
4024
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
4025
|
-
load().then(() => {
|
|
4026
|
-
loaded.value = true;
|
|
4027
|
-
}).catch((err) => {
|
|
4028
|
-
onError(err);
|
|
4029
|
-
error.value = err;
|
|
4030
|
-
});
|
|
4031
|
-
renderEffect(() => {
|
|
4032
|
-
resolvedComp = getResolvedComp();
|
|
4033
|
-
let render;
|
|
4034
|
-
if (loaded.value && resolvedComp) render = () => createInnerComp(resolvedComp, instance);
|
|
4035
|
-
else if (error.value && errorComponent) render = () => createComponent(errorComponent, { error: () => error.value });
|
|
4036
|
-
else if (loadingComponent && !delayed.value) render = () => createComponent(loadingComponent);
|
|
4037
|
-
frag.update(render);
|
|
4038
|
-
if (frag.keepAliveCtx) frag.keepAliveCtx.cacheBlock();
|
|
4039
|
-
});
|
|
4040
|
-
return frag;
|
|
4739
|
+
while (node && node !== anchor) {
|
|
4740
|
+
if (node.nodeType === 1) node.setAttribute("data-v-owner", String(ctx.uid));
|
|
4741
|
+
node = node.nextSibling;
|
|
4742
|
+
}
|
|
4743
|
+
pauseTracking();
|
|
4744
|
+
try {
|
|
4745
|
+
ctx.ut();
|
|
4746
|
+
} finally {
|
|
4747
|
+
resetTracking();
|
|
4041
4748
|
}
|
|
4042
|
-
});
|
|
4043
|
-
}
|
|
4044
|
-
function createInnerComp(comp, parent, rawProps = parent.rawProps, rawSlots = parent.rawSlots) {
|
|
4045
|
-
const prevInstance = setCurrentInstance(parent);
|
|
4046
|
-
try {
|
|
4047
|
-
return createComponent(comp, rawProps, rawSlots, void 0, void 0, parent.appContext);
|
|
4048
|
-
} finally {
|
|
4049
|
-
setCurrentInstance(...prevInstance);
|
|
4050
4749
|
}
|
|
4051
4750
|
}
|
|
4052
4751
|
//#endregion
|
|
@@ -4116,15 +4815,14 @@ var VaporElement = class extends VueElementBase {
|
|
|
4116
4815
|
}
|
|
4117
4816
|
if (!isFragment(block)) return;
|
|
4118
4817
|
const { nodes } = block;
|
|
4119
|
-
if (
|
|
4120
|
-
const
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
this._updateFragmentNodes(
|
|
4124
|
-
|
|
4125
|
-
}
|
|
4126
|
-
|
|
4127
|
-
} else if (nodes instanceof HTMLSlotElement) block.nodes = replacements.get(nodes);
|
|
4818
|
+
if (nodes instanceof HTMLSlotElement) {
|
|
4819
|
+
const replacement = replacements.get(nodes);
|
|
4820
|
+
if (!replacement) return;
|
|
4821
|
+
if (replacement.usedFallback && block instanceof SlotFragment && block.customElementFallback) {
|
|
4822
|
+
this._updateFragmentNodes(block.customElementFallback, replacements);
|
|
4823
|
+
block.nodes = block.customElementFallback;
|
|
4824
|
+
} else block.nodes = replacement.nodes;
|
|
4825
|
+
} else if (Array.isArray(nodes)) nodes.forEach((item) => this._updateFragmentNodes(item, replacements));
|
|
4128
4826
|
else this._updateFragmentNodes(nodes, replacements);
|
|
4129
4827
|
}
|
|
4130
4828
|
_createComponent() {
|
|
@@ -4140,25 +4838,33 @@ var VaporElement = class extends VueElementBase {
|
|
|
4140
4838
|
//#region packages/runtime-vapor/src/dom/template.ts
|
|
4141
4839
|
let t;
|
|
4142
4840
|
/* @__NO_SIDE_EFFECTS__ */
|
|
4143
|
-
function template(html, root, ns) {
|
|
4841
|
+
function template(html, root, isStatic, ns) {
|
|
4144
4842
|
let node;
|
|
4145
4843
|
return () => {
|
|
4146
4844
|
if (isHydrating$1) {
|
|
4147
|
-
|
|
4845
|
+
let adopted = null;
|
|
4846
|
+
if (isStatic) {
|
|
4847
|
+
adopted = resolveHydrationTarget(currentHydrationNode);
|
|
4848
|
+
node = adopted.cloneNode(true);
|
|
4849
|
+
advanceHydrationNode(adopted);
|
|
4850
|
+
} else adopted = adoptTemplate(currentHydrationNode, html);
|
|
4148
4851
|
if (root) adopted.$root = true;
|
|
4149
4852
|
return adopted;
|
|
4150
4853
|
}
|
|
4854
|
+
if (node) {
|
|
4855
|
+
const ret = node.cloneNode(true);
|
|
4856
|
+
if (root) ret.$root = true;
|
|
4857
|
+
return ret;
|
|
4858
|
+
}
|
|
4151
4859
|
if (html[0] !== "<") return /* @__PURE__ */ createTextNode(html);
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
node = /* @__PURE__ */ _child(t.content);
|
|
4161
|
-
}
|
|
4860
|
+
t = t || document.createElement("template");
|
|
4861
|
+
if (ns) {
|
|
4862
|
+
const tag = ns === 1 ? "svg" : "math";
|
|
4863
|
+
t.innerHTML = `<${tag}>${html}</${tag}>`;
|
|
4864
|
+
node = /* @__PURE__ */ _child(/* @__PURE__ */ _child(t.content));
|
|
4865
|
+
} else {
|
|
4866
|
+
t.innerHTML = html;
|
|
4867
|
+
node = /* @__PURE__ */ _child(t.content);
|
|
4162
4868
|
}
|
|
4163
4869
|
const ret = node.cloneNode(true);
|
|
4164
4870
|
if (root) ret.$root = true;
|
|
@@ -4170,25 +4876,38 @@ function template(html, root, ns) {
|
|
|
4170
4876
|
function createIf(condition, b1, b2, blockShape, once, index) {
|
|
4171
4877
|
const _insertionParent = insertionParent;
|
|
4172
4878
|
const _insertionAnchor = insertionAnchor;
|
|
4173
|
-
const _isLastInsertion = isLastInsertion;
|
|
4174
4879
|
if (!isHydrating$1) resetInsertionState();
|
|
4880
|
+
let hydrationCursor = null;
|
|
4881
|
+
let branchShape;
|
|
4175
4882
|
let frag;
|
|
4176
4883
|
if (once) {
|
|
4177
4884
|
const ok = condition();
|
|
4178
|
-
if (isHydrating$1)
|
|
4885
|
+
if (isHydrating$1) {
|
|
4886
|
+
branchShape = decodeIfShape(blockShape, ok);
|
|
4887
|
+
hydrationCursor = enterHydrationCursor(branchShape === 2);
|
|
4888
|
+
}
|
|
4179
4889
|
frag = ok ? b1() : b2 ? b2() : [!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("if") : /* @__PURE__ */ createTextNode()];
|
|
4180
4890
|
} else {
|
|
4181
4891
|
const keyed = index != null;
|
|
4182
4892
|
frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if", keyed, false) : new DynamicFragment(void 0, keyed, false);
|
|
4183
4893
|
renderEffect(() => {
|
|
4184
4894
|
const ok = condition();
|
|
4185
|
-
if (isHydrating$1)
|
|
4895
|
+
if (isHydrating$1) {
|
|
4896
|
+
branchShape = decodeIfShape(blockShape, ok);
|
|
4897
|
+
hydrationCursor = enterHydrationCursor(branchShape === 2);
|
|
4898
|
+
}
|
|
4186
4899
|
frag.update(ok ? b1 : b2, keyed ? `${index}${ok ? 0 : 1}` : void 0);
|
|
4187
4900
|
});
|
|
4188
4901
|
}
|
|
4189
4902
|
if (!isHydrating$1) {
|
|
4190
4903
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4191
|
-
} else
|
|
4904
|
+
} else {
|
|
4905
|
+
if (branchShape === 0 && hydrationCursor) {
|
|
4906
|
+
const start = hydrationCursor.start;
|
|
4907
|
+
if (start && currentHydrationNode === start && start.nodeType === 8 && start.data === "") advanceHydrationNode(start);
|
|
4908
|
+
}
|
|
4909
|
+
exitHydrationCursor(hydrationCursor);
|
|
4910
|
+
}
|
|
4192
4911
|
return frag;
|
|
4193
4912
|
}
|
|
4194
4913
|
function decodeIfShape(shape, ok) {
|
|
@@ -4209,23 +4928,27 @@ function decodeIfShape(shape, ok) {
|
|
|
4209
4928
|
function createKeyedFragment(key, render) {
|
|
4210
4929
|
const _insertionParent = insertionParent;
|
|
4211
4930
|
const _insertionAnchor = insertionAnchor;
|
|
4212
|
-
const _isLastInsertion = isLastInsertion;
|
|
4213
4931
|
if (!isHydrating$1) resetInsertionState();
|
|
4932
|
+
const hydrationCursor = isHydrating$1 ? captureHydrationCursor() : null;
|
|
4214
4933
|
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed", true) : new DynamicFragment(void 0, true);
|
|
4215
4934
|
renderEffect(() => frag.update(render, key()));
|
|
4216
4935
|
if (!isHydrating$1) {
|
|
4217
4936
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4218
|
-
} else
|
|
4937
|
+
} else exitHydrationCursor(hydrationCursor);
|
|
4219
4938
|
return frag;
|
|
4220
4939
|
}
|
|
4221
4940
|
//#endregion
|
|
4222
4941
|
//#region packages/runtime-vapor/src/apiCreateFor.ts
|
|
4942
|
+
let resolveForHydrationAnchor;
|
|
4943
|
+
function setForHydrationAnchorResolver(resolver) {
|
|
4944
|
+
resolveForHydrationAnchor = resolver;
|
|
4945
|
+
}
|
|
4223
4946
|
const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
4224
4947
|
const _insertionParent = insertionParent;
|
|
4225
4948
|
const _insertionAnchor = insertionAnchor;
|
|
4226
4949
|
const _insertionIndex = insertionIndex;
|
|
4227
|
-
|
|
4228
|
-
if (isHydrating$1)
|
|
4950
|
+
let hydrationCursor = null;
|
|
4951
|
+
if (isHydrating$1) hydrationCursor = enterHydrationCursor(true);
|
|
4229
4952
|
else resetInsertionState();
|
|
4230
4953
|
let isMounted = false;
|
|
4231
4954
|
let oldBlocks = [];
|
|
@@ -4247,57 +4970,15 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4247
4970
|
const newLength = source.values.length;
|
|
4248
4971
|
const oldLength = oldBlocks.length;
|
|
4249
4972
|
newBlocks = new Array(newLength);
|
|
4250
|
-
let isFallback = false;
|
|
4251
4973
|
const prevSub = setActiveSub();
|
|
4252
4974
|
if (!isMounted) {
|
|
4253
4975
|
isMounted = true;
|
|
4254
|
-
if (isHydrating$1)
|
|
4255
|
-
|
|
4256
|
-
let exitHydrationBoundary;
|
|
4257
|
-
let nextNode;
|
|
4258
|
-
const emptyLocalRange = isComment(hydrationStart, "]") && isComment(hydrationStart.previousSibling, "[");
|
|
4259
|
-
const slotFallbackRange = currentEmptyFragment !== void 0 && currentSlotEndAnchor;
|
|
4260
|
-
try {
|
|
4261
|
-
if (emptyLocalRange && newLength) {
|
|
4262
|
-
parentAnchor = markHydrationAnchor(hydrationStart);
|
|
4263
|
-
exitHydrationBoundary = enterHydrationBoundary(parentAnchor);
|
|
4264
|
-
for (let i = 0; i < newLength; i++) mount(source, i);
|
|
4265
|
-
setCurrentHydrationNode(parentAnchor);
|
|
4266
|
-
} else {
|
|
4267
|
-
for (let i = 0; i < newLength; i++) {
|
|
4268
|
-
if (isComment(currentHydrationNode, "]")) {
|
|
4269
|
-
nextNode = markHydrationAnchor(currentHydrationNode);
|
|
4270
|
-
setCurrentHydrationNode(nextNode);
|
|
4271
|
-
} else nextNode = locateNextNode(currentHydrationNode);
|
|
4272
|
-
mount(source, i);
|
|
4273
|
-
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
4274
|
-
}
|
|
4275
|
-
if (slotFallbackRange && !isValidBlock(newBlocks)) {
|
|
4276
|
-
const anchor = currentHydrationNode !== hydrationStart ? currentHydrationNode : hydrationStart !== currentSlotEndAnchor ? hydrationStart.nextSibling : currentSlotEndAnchor;
|
|
4277
|
-
parentAnchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("for") : /* @__PURE__ */ createTextNode());
|
|
4278
|
-
pendingHydrationAnchor = true;
|
|
4279
|
-
if (currentHydrationNode === hydrationStart || currentHydrationNode === currentSlotEndAnchor) setCurrentHydrationNode(hydrationStart);
|
|
4280
|
-
queuePostFlushCb(() => anchor.parentNode.insertBefore(parentAnchor, anchor));
|
|
4281
|
-
} else {
|
|
4282
|
-
parentAnchor = markHydrationAnchor(locateHydrationBoundaryClose(currentHydrationNode));
|
|
4283
|
-
exitHydrationBoundary = enterHydrationBoundary(parentAnchor);
|
|
4284
|
-
if (!!(process.env.NODE_ENV !== "production") && !isComment(parentAnchor, "]")) throw new Error(`v-for fragment anchor node was not found. this is likely a Vue internal bug.`);
|
|
4285
|
-
if (_insertionParent && isComment(parentAnchor, "]")) {
|
|
4286
|
-
parentAnchor.$idx = _insertionIndex || 0;
|
|
4287
|
-
_insertionParent.$llc = parentAnchor;
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4290
|
-
}
|
|
4291
|
-
} finally {
|
|
4292
|
-
exitHydrationBoundary && exitHydrationBoundary();
|
|
4293
|
-
}
|
|
4294
|
-
} else for (let i = 0; i < newLength; i++) mount(source, i);
|
|
4976
|
+
if (isHydrating$1) hydrateList(source, newLength);
|
|
4977
|
+
else for (let i = 0; i < newLength; i++) mount(source, i);
|
|
4295
4978
|
} else {
|
|
4296
|
-
parent =
|
|
4297
|
-
if (!oldLength)
|
|
4298
|
-
|
|
4299
|
-
for (let i = 0; i < newLength; i++) mount(source, i);
|
|
4300
|
-
} else if (!newLength) {
|
|
4979
|
+
parent = parentAnchor.parentNode;
|
|
4980
|
+
if (!oldLength) for (let i = 0; i < newLength; i++) mount(source, i);
|
|
4981
|
+
else if (!newLength) {
|
|
4301
4982
|
for (const selector of selectors) selector.cleanup();
|
|
4302
4983
|
const doRemove = !canUseFastRemove;
|
|
4303
4984
|
for (let i = 0; i < oldLength; i++) unmount(oldBlocks[i], doRemove, false);
|
|
@@ -4305,10 +4986,6 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4305
4986
|
parent.textContent = "";
|
|
4306
4987
|
parent.appendChild(parentAnchor);
|
|
4307
4988
|
}
|
|
4308
|
-
if (frag.fallback) {
|
|
4309
|
-
insert(frag.nodes[0] = frag.fallback(), parent, parentAnchor);
|
|
4310
|
-
isFallback = true;
|
|
4311
|
-
}
|
|
4312
4989
|
} else if (!getKey) {
|
|
4313
4990
|
const commonLength = Math.min(newLength, oldLength);
|
|
4314
4991
|
for (let i = 0; i < commonLength; i++) update(newBlocks[i] = oldBlocks[i], getItem(source, i)[0]);
|
|
@@ -4450,10 +5127,8 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4450
5127
|
}
|
|
4451
5128
|
}
|
|
4452
5129
|
}
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
if (parentAnchor) frag.nodes.push(parentAnchor);
|
|
4456
|
-
} else oldBlocks = [];
|
|
5130
|
+
frag.nodes = [oldBlocks = newBlocks];
|
|
5131
|
+
if (parentAnchor) frag.nodes.push(parentAnchor);
|
|
4457
5132
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
4458
5133
|
setActiveSub(prevSub);
|
|
4459
5134
|
};
|
|
@@ -4472,10 +5147,59 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4472
5147
|
nodes = scope.run(() => renderItem(itemRef, keyRef, indexRef));
|
|
4473
5148
|
}
|
|
4474
5149
|
const block = newBlocks[idx] = new ForBlock(nodes, scope, itemRef, keyRef, indexRef, key2);
|
|
4475
|
-
if (frag.$transition) applyTransitionHooks(block.nodes, frag.$transition);
|
|
5150
|
+
if (isTransitionEnabled && frag.$transition) applyTransitionHooks(block.nodes, frag.$transition);
|
|
4476
5151
|
if (parent) insert(block.nodes, parent, anchor);
|
|
4477
5152
|
return block;
|
|
4478
5153
|
};
|
|
5154
|
+
function hydrateList(source, newLength) {
|
|
5155
|
+
const hydrationStart = currentHydrationNode;
|
|
5156
|
+
let exitHydrationBoundary;
|
|
5157
|
+
let nextNode;
|
|
5158
|
+
const emptyLocalRange = isComment(hydrationStart, "]") && isComment(hydrationStart.previousSibling, "[");
|
|
5159
|
+
const slotEndAnchor = getCurrentSlotEndAnchor();
|
|
5160
|
+
const slotFallbackRange = isHydratingSlotFallbackActive() && slotEndAnchor;
|
|
5161
|
+
try {
|
|
5162
|
+
if (emptyLocalRange && newLength) {
|
|
5163
|
+
parentAnchor = markHydrationAnchor(hydrationStart);
|
|
5164
|
+
exitHydrationBoundary = enterHydrationBoundary(parentAnchor);
|
|
5165
|
+
for (let i = 0; i < newLength; i++) mount(source, i);
|
|
5166
|
+
setCurrentHydrationNode(parentAnchor);
|
|
5167
|
+
} else {
|
|
5168
|
+
for (let i = 0; i < newLength; i++) {
|
|
5169
|
+
if (isComment(currentHydrationNode, "]")) {
|
|
5170
|
+
nextNode = markHydrationAnchor(currentHydrationNode);
|
|
5171
|
+
setCurrentHydrationNode(nextNode);
|
|
5172
|
+
} else nextNode = locateNextNode(currentHydrationNode);
|
|
5173
|
+
mount(source, i);
|
|
5174
|
+
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
5175
|
+
}
|
|
5176
|
+
const resolvedAnchor = resolveForHydrationAnchor && resolveForHydrationAnchor(hydrationStart, newLength ? nextNode : currentHydrationNode);
|
|
5177
|
+
if (resolvedAnchor) {
|
|
5178
|
+
parentAnchor = resolvedAnchor;
|
|
5179
|
+
pendingHydrationAnchor = true;
|
|
5180
|
+
} else if (slotFallbackRange && !isValidBlock(newBlocks)) {
|
|
5181
|
+
const anchor = currentHydrationNode !== hydrationStart ? currentHydrationNode : hydrationStart !== slotEndAnchor ? hydrationStart.nextSibling : slotEndAnchor;
|
|
5182
|
+
parentAnchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("for") : /* @__PURE__ */ createTextNode());
|
|
5183
|
+
pendingHydrationAnchor = true;
|
|
5184
|
+
if (currentHydrationNode === hydrationStart || currentHydrationNode === slotEndAnchor) setCurrentHydrationNode(hydrationStart);
|
|
5185
|
+
queuePostFlushCb(() => {
|
|
5186
|
+
const parentNode = anchor.parentNode;
|
|
5187
|
+
if (parentNode) parentNode.insertBefore(parentAnchor, anchor);
|
|
5188
|
+
});
|
|
5189
|
+
} else {
|
|
5190
|
+
parentAnchor = markHydrationAnchor(locateHydrationBoundaryClose(currentHydrationNode));
|
|
5191
|
+
exitHydrationBoundary = enterHydrationBoundary(parentAnchor);
|
|
5192
|
+
if (!!(process.env.NODE_ENV !== "production") && !isComment(parentAnchor, "]")) throw new Error(`v-for fragment anchor node was not found. this is likely a Vue internal bug.`);
|
|
5193
|
+
if (_insertionParent && isComment(parentAnchor, "]")) {
|
|
5194
|
+
parentAnchor.$idx = _insertionIndex || 0;
|
|
5195
|
+
_insertionParent.$llc = parentAnchor;
|
|
5196
|
+
}
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
} finally {
|
|
5200
|
+
exitHydrationBoundary && exitHydrationBoundary();
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
4479
5203
|
const update = ({ itemRef, keyRef, indexRef }, newItem, newKey, newIndex) => {
|
|
4480
5204
|
if (newItem !== itemRef.value) itemRef.value = newItem;
|
|
4481
5205
|
if (keyRef && newKey !== void 0 && newKey !== keyRef.value) keyRef.value = newKey;
|
|
@@ -4499,7 +5223,10 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4499
5223
|
});
|
|
4500
5224
|
if (!isHydrating$1) {
|
|
4501
5225
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4502
|
-
} else
|
|
5226
|
+
} else {
|
|
5227
|
+
if (!pendingHydrationAnchor && currentHydrationNode === parentAnchor) advanceHydrationNode(parentAnchor);
|
|
5228
|
+
exitHydrationCursor(hydrationCursor);
|
|
5229
|
+
}
|
|
4503
5230
|
return frag;
|
|
4504
5231
|
function createSelector(source) {
|
|
4505
5232
|
let operMap = /* @__PURE__ */ new Map();
|
|
@@ -4755,7 +5482,7 @@ const getRefValue = (el) => {
|
|
|
4755
5482
|
return getRefValue(el.block.nodes);
|
|
4756
5483
|
}
|
|
4757
5484
|
return getExposed(el) || el;
|
|
4758
|
-
} else if (isTeleportFragment(el)) return null;
|
|
5485
|
+
} else if (isTeleportEnabled && isTeleportFragment(el)) return null;
|
|
4759
5486
|
else if (isDynamicFragment(el)) {
|
|
4760
5487
|
if (isArray(el.nodes)) return null;
|
|
4761
5488
|
return getRefValue(el.nodes);
|
|
@@ -4782,7 +5509,7 @@ function setVarsOnBlock(block, vars) {
|
|
|
4782
5509
|
if (block instanceof Node) setVarsOnNode(block, vars);
|
|
4783
5510
|
else if (isArray(block)) block.forEach((child) => setVarsOnBlock(child, vars));
|
|
4784
5511
|
else if (isVaporComponent(block)) setVarsOnBlock(block.block, vars);
|
|
4785
|
-
else if (isTeleportFragment(block)) return;
|
|
5512
|
+
else if (isTeleportEnabled && isTeleportFragment(block)) return;
|
|
4786
5513
|
else setVarsOnBlock(block.nodes, vars);
|
|
4787
5514
|
}
|
|
4788
5515
|
//#endregion
|
|
@@ -4790,8 +5517,8 @@ function setVarsOnBlock(block, vars) {
|
|
|
4790
5517
|
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once) {
|
|
4791
5518
|
const _insertionParent = insertionParent;
|
|
4792
5519
|
const _insertionAnchor = insertionAnchor;
|
|
4793
|
-
const _isLastInsertion = isLastInsertion;
|
|
4794
5520
|
if (!isHydrating$1) resetInsertionState();
|
|
5521
|
+
const hydrationCursor = isHydrating$1 ? captureHydrationCursor() : null;
|
|
4795
5522
|
const frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
4796
5523
|
const scopeOwner = getScopeOwner();
|
|
4797
5524
|
const renderFn = () => {
|
|
@@ -4801,6 +5528,7 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
4801
5528
|
if (isBlock(value)) return value;
|
|
4802
5529
|
if (isInteropEnabled && appContext.vapor && isVNode(value)) {
|
|
4803
5530
|
if (isKeepAlive(currentInstance)) {
|
|
5531
|
+
enableKeepAlive();
|
|
4804
5532
|
const frag = currentInstance.ctx.getCachedComponent(value.type, value.key);
|
|
4805
5533
|
if (frag) return frag;
|
|
4806
5534
|
}
|
|
@@ -4808,7 +5536,6 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
4808
5536
|
if (isHydrating$1) {
|
|
4809
5537
|
locateHydrationNode(shouldConsumeFragmentStart(value));
|
|
4810
5538
|
frag.hydrate();
|
|
4811
|
-
if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
4812
5539
|
}
|
|
4813
5540
|
return frag;
|
|
4814
5541
|
}
|
|
@@ -4819,7 +5546,7 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
4819
5546
|
else renderEffect(renderFn);
|
|
4820
5547
|
if (!isHydrating$1) {
|
|
4821
5548
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4822
|
-
} else
|
|
5549
|
+
} else exitHydrationCursor(hydrationCursor);
|
|
4823
5550
|
return frag;
|
|
4824
5551
|
}
|
|
4825
5552
|
function withScopeOwner(owner, fn) {
|
|
@@ -4912,6 +5639,21 @@ function withVaporDirectives(node, dirs) {
|
|
|
4912
5639
|
//#region packages/runtime-vapor/src/components/TransitionGroup.ts
|
|
4913
5640
|
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
4914
5641
|
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
5642
|
+
let isForHydrationAnchorResolverRegistered = false;
|
|
5643
|
+
let currentForHydrationContainer;
|
|
5644
|
+
function ensureForHydrationAnchorResolver() {
|
|
5645
|
+
if (isForHydrationAnchorResolverRegistered) return;
|
|
5646
|
+
isForHydrationAnchorResolverRegistered = true;
|
|
5647
|
+
setForHydrationAnchorResolver((hydrationStart, anchorNode) => {
|
|
5648
|
+
const container = currentForHydrationContainer;
|
|
5649
|
+
if (!container) return;
|
|
5650
|
+
if (hydrationStart !== container && hydrationStart.parentNode !== container) return;
|
|
5651
|
+
const anchor = anchorNode && anchorNode !== container && anchorNode.parentNode === container ? anchorNode : null;
|
|
5652
|
+
const parentAnchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("for") : /* @__PURE__ */ createTextNode());
|
|
5653
|
+
container.insertBefore(parentAnchor, anchor);
|
|
5654
|
+
return parentAnchor;
|
|
5655
|
+
});
|
|
5656
|
+
}
|
|
4915
5657
|
const decorate = (t) => {
|
|
4916
5658
|
delete t.props.mode;
|
|
4917
5659
|
return t;
|
|
@@ -4975,17 +5717,35 @@ const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVapo
|
|
|
4975
5717
|
const tag = props.tag;
|
|
4976
5718
|
const slot = slots.default;
|
|
4977
5719
|
if (isMounted && tag === currentTag && slot === currentSlot) return;
|
|
4978
|
-
const container = tag ? /* @__PURE__ */ createElement(tag) : void 0;
|
|
5720
|
+
const container = tag ? isHydrating$1 ? adoptTemplate(currentHydrationNode, `<${tag}/>`) : /* @__PURE__ */ createElement(tag) : void 0;
|
|
5721
|
+
let nextNode = null;
|
|
5722
|
+
let prevForHydrationContainer;
|
|
5723
|
+
if (isHydrating$1 && container) {
|
|
5724
|
+
ensureForHydrationAnchorResolver();
|
|
5725
|
+
prevForHydrationContainer = currentForHydrationContainer;
|
|
5726
|
+
currentForHydrationContainer = container;
|
|
5727
|
+
nextNode = locateNextNode(container);
|
|
5728
|
+
setCurrentHydrationNode(container.firstChild || container);
|
|
5729
|
+
}
|
|
4979
5730
|
let block = slottedBlock;
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
5731
|
+
let transitionBlocks = [];
|
|
5732
|
+
try {
|
|
5733
|
+
frag.update(() => {
|
|
5734
|
+
block = slot && slot() || [];
|
|
5735
|
+
transitionBlocks = applyGroupTransitionHooks(block, propsProxy, state, instance);
|
|
5736
|
+
if (container) {
|
|
5737
|
+
if (!isHydrating$1) insert(block, container);
|
|
5738
|
+
return container;
|
|
5739
|
+
}
|
|
5740
|
+
return block;
|
|
5741
|
+
});
|
|
5742
|
+
if (isHydrating$1 && container && currentHydrationNode && currentHydrationNode.parentNode === container && !transitionBlocks.some((child) => child === currentHydrationNode)) cleanupHydrationTail(currentHydrationNode, container);
|
|
5743
|
+
} finally {
|
|
5744
|
+
if (isHydrating$1 && container) {
|
|
5745
|
+
currentForHydrationContainer = prevForHydrationContainer;
|
|
5746
|
+
setCurrentHydrationNode(nextNode);
|
|
4986
5747
|
}
|
|
4987
|
-
|
|
4988
|
-
});
|
|
5748
|
+
}
|
|
4989
5749
|
slottedBlock = block;
|
|
4990
5750
|
currentTag = tag;
|
|
4991
5751
|
currentSlot = slot;
|
|
@@ -5009,6 +5769,7 @@ function applyGroupTransitionHooks(block, props, state, instance) {
|
|
|
5009
5769
|
hooks.applyGroup = applyGroupTransitionHooks;
|
|
5010
5770
|
frag.$transition = hooks;
|
|
5011
5771
|
});
|
|
5772
|
+
return children;
|
|
5012
5773
|
}
|
|
5013
5774
|
function inheritKey(children, key) {
|
|
5014
5775
|
if (key === void 0 || children.length === 0) return;
|