@vue/runtime-vapor 3.6.0-beta.1 → 3.6.0-beta.3
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 +6 -5
- package/dist/runtime-vapor.esm-bundler.js +644 -479
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp,
|
|
6
|
+
import { queuePostFlushCb, isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, TransitionPropsValidators, isAsyncWrapper, getComponentName, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, baseResolveTransitionHooks, leaveCbKey, watch, onMounted, onUpdated, onBeforeUnmount, matches, devtoolsComponentAdded, resetShapeFlag, ensureRenderer, shallowRef, simpleSetCurrentInstance, isKeepAlive, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, normalizeRef, setRef as setRef$1, ensureHydrationRenderer, deactivate as deactivate$1, isVNode, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, setCurrentInstance, resolvePropValue, isRef, startMeasure, queueJob, warnExtraneousAttributes, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, NULL_DYNAMIC_COMPONENT, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, markAsyncBoundary, getFunctionalFallthrough, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, createCanSetSetupRefChecker, baseUseCssVars, setVarsOnNode, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
|
|
7
7
|
import { isArray, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, normalizeCssVarValue, getEscapedCssVarName, isFunction, extend, invokeArrayFns, isReservedProp, EMPTY_OBJ, hasOwn, EMPTY_ARR, NO, YES, isPromise, getGlobalThis, isPlainObject, isObject, remove as remove$1, NOOP, looseEqual } from '@vue/shared';
|
|
8
8
|
import { onEffectCleanup, computed, onScopeDispose as onScopeDispose$1, pauseTracking, resetTracking, ReactiveEffect, setActiveSub, EffectScope, markRaw, unref, proxyRefs, toRaw, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
|
|
9
9
|
|
|
@@ -30,22 +30,22 @@ function resetInsertionState() {
|
|
|
30
30
|
insertionParent = insertionAnchor = isLastInsertion = void 0;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const isHydratingStack = [];
|
|
34
|
-
let isHydrating = false;
|
|
35
33
|
let currentHydrationNode = null;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
let _hydrateDynamicFragment;
|
|
35
|
+
let isHydrating = false;
|
|
36
|
+
function setIsHydrating(value) {
|
|
37
|
+
try {
|
|
38
|
+
return isHydrating;
|
|
39
|
+
} finally {
|
|
40
|
+
isHydrating = value;
|
|
41
|
+
}
|
|
42
42
|
}
|
|
43
43
|
function runWithoutHydration(fn) {
|
|
44
|
+
const prev = setIsHydrating(false);
|
|
44
45
|
try {
|
|
45
|
-
pushIsHydrating(false);
|
|
46
46
|
return fn();
|
|
47
47
|
} finally {
|
|
48
|
-
|
|
48
|
+
setIsHydrating(prev);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
let isOptimized$1 = false;
|
|
@@ -53,6 +53,7 @@ function performHydration(fn, setup, cleanup) {
|
|
|
53
53
|
if (!isOptimized$1) {
|
|
54
54
|
adoptTemplate = adoptTemplateImpl;
|
|
55
55
|
locateHydrationNode = locateHydrationNodeImpl;
|
|
56
|
+
_hydrateDynamicFragment = hydrateDynamicFragmentImpl;
|
|
56
57
|
Comment.prototype.$fe = void 0;
|
|
57
58
|
Node.prototype.$pns = void 0;
|
|
58
59
|
Node.prototype.$idx = void 0;
|
|
@@ -64,12 +65,12 @@ function performHydration(fn, setup, cleanup) {
|
|
|
64
65
|
isOptimized$1 = true;
|
|
65
66
|
}
|
|
66
67
|
enableHydrationNodeLookup();
|
|
67
|
-
|
|
68
|
+
const prev = setIsHydrating(true);
|
|
68
69
|
setup();
|
|
69
70
|
const res = fn();
|
|
70
71
|
cleanup();
|
|
71
72
|
currentHydrationNode = null;
|
|
72
|
-
|
|
73
|
+
setIsHydrating(prev);
|
|
73
74
|
if (!isHydrating) disableHydrationNodeLookup();
|
|
74
75
|
return res;
|
|
75
76
|
}
|
|
@@ -229,6 +230,50 @@ function removeFragmentNodes(node, endAnchor) {
|
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
}
|
|
233
|
+
function hydrateDynamicFragment(frag, isEmpty) {
|
|
234
|
+
_hydrateDynamicFragment && _hydrateDynamicFragment(frag, isEmpty);
|
|
235
|
+
}
|
|
236
|
+
function hydrateDynamicFragmentImpl(frag, isEmpty) {
|
|
237
|
+
if (frag.anchor) return;
|
|
238
|
+
if (frag.anchorLabel === "if") {
|
|
239
|
+
if (isEmpty) {
|
|
240
|
+
frag.anchor = locateFragmentEndAnchor("");
|
|
241
|
+
if (!!(process.env.NODE_ENV !== "production") && !frag.anchor) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
"Failed to locate if anchor. this is likely a Vue internal bug."
|
|
244
|
+
);
|
|
245
|
+
} else {
|
|
246
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
247
|
+
frag.anchor.data = frag.anchorLabel;
|
|
248
|
+
}
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
} else if (frag.anchorLabel === "slot") {
|
|
253
|
+
if (isEmpty && isComment(currentHydrationNode, "")) {
|
|
254
|
+
frag.anchor = currentHydrationNode;
|
|
255
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
256
|
+
frag.anchor.data = frag.anchorLabel;
|
|
257
|
+
}
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
frag.anchor = locateFragmentEndAnchor();
|
|
261
|
+
if (!!(process.env.NODE_ENV !== "production") && !frag.anchor) {
|
|
262
|
+
throw new Error(
|
|
263
|
+
"Failed to locate slot anchor. this is likely a Vue internal bug."
|
|
264
|
+
);
|
|
265
|
+
} else {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const { parentNode: pn, nextNode } = findBlockNode(frag.nodes);
|
|
270
|
+
queuePostFlushCb(() => {
|
|
271
|
+
pn.insertBefore(
|
|
272
|
+
frag.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(frag.anchorLabel) : createTextNode(),
|
|
273
|
+
nextNode
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
232
277
|
|
|
233
278
|
// @__NO_SIDE_EFFECTS__
|
|
234
279
|
function createElement(tagName) {
|
|
@@ -847,7 +892,242 @@ function shouldForceHydrate(el, key) {
|
|
|
847
892
|
tagName.includes("-");
|
|
848
893
|
}
|
|
849
894
|
|
|
850
|
-
|
|
895
|
+
const displayName = "VaporTransition";
|
|
896
|
+
let registered = false;
|
|
897
|
+
const ensureTransitionHooksRegistered = () => {
|
|
898
|
+
if (!registered) {
|
|
899
|
+
registered = true;
|
|
900
|
+
registerTransitionHooks(
|
|
901
|
+
applyTransitionHooksImpl,
|
|
902
|
+
applyTransitionLeaveHooksImpl
|
|
903
|
+
);
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
const decorate$1 = (t) => {
|
|
907
|
+
t.displayName = displayName;
|
|
908
|
+
t.props = TransitionPropsValidators;
|
|
909
|
+
t.__vapor = true;
|
|
910
|
+
return t;
|
|
911
|
+
};
|
|
912
|
+
const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
|
|
913
|
+
ensureTransitionHooksRegistered();
|
|
914
|
+
let resetDisplay;
|
|
915
|
+
if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
|
|
916
|
+
const {
|
|
917
|
+
content: { firstChild },
|
|
918
|
+
parentNode
|
|
919
|
+
} = currentHydrationNode;
|
|
920
|
+
if (firstChild) {
|
|
921
|
+
if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
|
|
922
|
+
const originalDisplay = firstChild.style.display;
|
|
923
|
+
firstChild.style.display = "none";
|
|
924
|
+
resetDisplay = () => firstChild.style.display = originalDisplay;
|
|
925
|
+
}
|
|
926
|
+
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
927
|
+
setCurrentHydrationNode(firstChild);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
const children = slots.default && slots.default();
|
|
931
|
+
if (!children) return [];
|
|
932
|
+
const instance = currentInstance;
|
|
933
|
+
const { mode } = props;
|
|
934
|
+
checkTransitionMode(mode);
|
|
935
|
+
let resolvedProps;
|
|
936
|
+
renderEffect(() => resolvedProps = resolveTransitionProps(props));
|
|
937
|
+
const hooks = applyTransitionHooksImpl(children, {
|
|
938
|
+
state: useTransitionState(),
|
|
939
|
+
// use proxy to keep props reference stable
|
|
940
|
+
props: new Proxy({}, {
|
|
941
|
+
get(_, key) {
|
|
942
|
+
return resolvedProps[key];
|
|
943
|
+
}
|
|
944
|
+
}),
|
|
945
|
+
instance
|
|
946
|
+
});
|
|
947
|
+
if (resetDisplay && resolvedProps.appear) {
|
|
948
|
+
const child = findTransitionBlock(children);
|
|
949
|
+
hooks.beforeEnter(child);
|
|
950
|
+
resetDisplay();
|
|
951
|
+
queuePostFlushCb(() => hooks.enter(child));
|
|
952
|
+
}
|
|
953
|
+
return children;
|
|
954
|
+
});
|
|
955
|
+
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
956
|
+
const { leavingNodes } = state;
|
|
957
|
+
const context = {
|
|
958
|
+
setLeavingNodeCache: (el) => {
|
|
959
|
+
leavingNodes.set(key, el);
|
|
960
|
+
},
|
|
961
|
+
unsetLeavingNodeCache: (el) => {
|
|
962
|
+
const leavingNode = leavingNodes.get(key);
|
|
963
|
+
if (leavingNode === el) {
|
|
964
|
+
leavingNodes.delete(key);
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
earlyRemove: () => {
|
|
968
|
+
const leavingNode = leavingNodes.get(key);
|
|
969
|
+
if (leavingNode && leavingNode[leaveCbKey]) {
|
|
970
|
+
leavingNode[leaveCbKey]();
|
|
971
|
+
}
|
|
972
|
+
},
|
|
973
|
+
cloneHooks: (block) => {
|
|
974
|
+
const hooks = resolveTransitionHooks(
|
|
975
|
+
block,
|
|
976
|
+
props,
|
|
977
|
+
state,
|
|
978
|
+
instance,
|
|
979
|
+
postClone
|
|
980
|
+
);
|
|
981
|
+
if (postClone) postClone(hooks);
|
|
982
|
+
return hooks;
|
|
983
|
+
}
|
|
984
|
+
};
|
|
985
|
+
return context;
|
|
986
|
+
};
|
|
987
|
+
function resolveTransitionHooks(block, props, state, instance, postClone) {
|
|
988
|
+
const context = getTransitionHooksContext(
|
|
989
|
+
String(block.$key),
|
|
990
|
+
props,
|
|
991
|
+
state,
|
|
992
|
+
instance,
|
|
993
|
+
postClone
|
|
994
|
+
);
|
|
995
|
+
const hooks = baseResolveTransitionHooks(
|
|
996
|
+
context,
|
|
997
|
+
props,
|
|
998
|
+
state,
|
|
999
|
+
instance
|
|
1000
|
+
);
|
|
1001
|
+
hooks.state = state;
|
|
1002
|
+
hooks.props = props;
|
|
1003
|
+
hooks.instance = instance;
|
|
1004
|
+
return hooks;
|
|
1005
|
+
}
|
|
1006
|
+
function applyTransitionHooksImpl(block, hooks) {
|
|
1007
|
+
if (isArray(block)) {
|
|
1008
|
+
block = block.filter((b) => !(b instanceof Comment));
|
|
1009
|
+
if (block.length === 1) {
|
|
1010
|
+
block = block[0];
|
|
1011
|
+
} else if (block.length === 0) {
|
|
1012
|
+
return hooks;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
const fragments = [];
|
|
1016
|
+
const child = findTransitionBlock(block, (frag) => fragments.push(frag));
|
|
1017
|
+
if (!child) {
|
|
1018
|
+
fragments.forEach((f) => f.$transition = hooks);
|
|
1019
|
+
if (!!(process.env.NODE_ENV !== "production") && fragments.length === 0) {
|
|
1020
|
+
warn("Transition component has no valid child element");
|
|
1021
|
+
}
|
|
1022
|
+
return hooks;
|
|
1023
|
+
}
|
|
1024
|
+
const { props, instance, state, delayedLeave } = hooks;
|
|
1025
|
+
let resolvedHooks = resolveTransitionHooks(
|
|
1026
|
+
child,
|
|
1027
|
+
props,
|
|
1028
|
+
state,
|
|
1029
|
+
instance,
|
|
1030
|
+
(hooks2) => resolvedHooks = hooks2
|
|
1031
|
+
);
|
|
1032
|
+
resolvedHooks.delayedLeave = delayedLeave;
|
|
1033
|
+
child.$transition = resolvedHooks;
|
|
1034
|
+
fragments.forEach((f) => f.$transition = resolvedHooks);
|
|
1035
|
+
return resolvedHooks;
|
|
1036
|
+
}
|
|
1037
|
+
function applyTransitionLeaveHooksImpl(block, enterHooks, afterLeaveCb) {
|
|
1038
|
+
const leavingBlock = findTransitionBlock(block);
|
|
1039
|
+
if (!leavingBlock) return void 0;
|
|
1040
|
+
const { props, state, instance } = enterHooks;
|
|
1041
|
+
const leavingHooks = resolveTransitionHooks(
|
|
1042
|
+
leavingBlock,
|
|
1043
|
+
props,
|
|
1044
|
+
state,
|
|
1045
|
+
instance
|
|
1046
|
+
);
|
|
1047
|
+
leavingBlock.$transition = leavingHooks;
|
|
1048
|
+
const { mode } = props;
|
|
1049
|
+
if (mode === "out-in") {
|
|
1050
|
+
state.isLeaving = true;
|
|
1051
|
+
leavingHooks.afterLeave = () => {
|
|
1052
|
+
state.isLeaving = false;
|
|
1053
|
+
afterLeaveCb();
|
|
1054
|
+
leavingBlock.$transition = void 0;
|
|
1055
|
+
delete leavingHooks.afterLeave;
|
|
1056
|
+
};
|
|
1057
|
+
} else if (mode === "in-out") {
|
|
1058
|
+
leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
|
|
1059
|
+
state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
|
|
1060
|
+
block2[leaveCbKey] = () => {
|
|
1061
|
+
earlyRemove();
|
|
1062
|
+
block2[leaveCbKey] = void 0;
|
|
1063
|
+
leavingBlock.$transition = void 0;
|
|
1064
|
+
delete enterHooks.delayedLeave;
|
|
1065
|
+
};
|
|
1066
|
+
enterHooks.delayedLeave = () => {
|
|
1067
|
+
delayedLeave();
|
|
1068
|
+
leavingBlock.$transition = void 0;
|
|
1069
|
+
delete enterHooks.delayedLeave;
|
|
1070
|
+
};
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
function findTransitionBlock(block, onFragment) {
|
|
1075
|
+
let child;
|
|
1076
|
+
if (block instanceof Node) {
|
|
1077
|
+
if (block instanceof Element) child = block;
|
|
1078
|
+
} else if (isVaporComponent(block)) {
|
|
1079
|
+
if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
|
|
1080
|
+
child = block;
|
|
1081
|
+
} else {
|
|
1082
|
+
if (getComponentName(block.type) === displayName) return void 0;
|
|
1083
|
+
child = findTransitionBlock(block.block, onFragment);
|
|
1084
|
+
if (child && child.$key === void 0) child.$key = block.uid;
|
|
1085
|
+
}
|
|
1086
|
+
} else if (isArray(block)) {
|
|
1087
|
+
let hasFound = false;
|
|
1088
|
+
for (const c of block) {
|
|
1089
|
+
if (c instanceof Comment) continue;
|
|
1090
|
+
const item = findTransitionBlock(c, onFragment);
|
|
1091
|
+
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
1092
|
+
warn(
|
|
1093
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
1094
|
+
);
|
|
1095
|
+
break;
|
|
1096
|
+
}
|
|
1097
|
+
child = item;
|
|
1098
|
+
hasFound = true;
|
|
1099
|
+
if (!!!(process.env.NODE_ENV !== "production")) break;
|
|
1100
|
+
}
|
|
1101
|
+
} else if (isFragment(block)) {
|
|
1102
|
+
if (block.insert) {
|
|
1103
|
+
child = block;
|
|
1104
|
+
} else {
|
|
1105
|
+
if (onFragment) onFragment(block);
|
|
1106
|
+
child = findTransitionBlock(block.nodes, onFragment);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
return child;
|
|
1110
|
+
}
|
|
1111
|
+
function setTransitionHooksOnFragment(block, hooks) {
|
|
1112
|
+
if (isFragment(block)) {
|
|
1113
|
+
block.$transition = hooks;
|
|
1114
|
+
if (block.nodes && isFragment(block.nodes)) {
|
|
1115
|
+
setTransitionHooksOnFragment(block.nodes, hooks);
|
|
1116
|
+
}
|
|
1117
|
+
} else if (isArray(block)) {
|
|
1118
|
+
for (let i = 0; i < block.length; i++) {
|
|
1119
|
+
setTransitionHooksOnFragment(block[i], hooks);
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
function setTransitionHooks(block, hooks) {
|
|
1124
|
+
if (isVaporComponent(block)) {
|
|
1125
|
+
block = findTransitionBlock(block.block);
|
|
1126
|
+
if (!block) return;
|
|
1127
|
+
}
|
|
1128
|
+
block.$transition = hooks;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
851
1131
|
// @__NO_SIDE_EFFECTS__
|
|
852
1132
|
function defineVaporComponent(comp, extraOptions) {
|
|
853
1133
|
if (isFunction(comp)) {
|
|
@@ -860,7 +1140,7 @@ function defineVaporComponent(comp, extraOptions) {
|
|
|
860
1140
|
return comp;
|
|
861
1141
|
}
|
|
862
1142
|
|
|
863
|
-
const
|
|
1143
|
+
const KeepAliveImpl = defineVaporComponent({
|
|
864
1144
|
name: "VaporKeepAlive",
|
|
865
1145
|
__isKeepAlive: true,
|
|
866
1146
|
props: {
|
|
@@ -881,18 +1161,27 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
881
1161
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
882
1162
|
keepAliveInstance.__v_cache = cache;
|
|
883
1163
|
}
|
|
884
|
-
keepAliveInstance.
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1164
|
+
keepAliveInstance.ctx = {
|
|
1165
|
+
getStorageContainer: () => storageContainer,
|
|
1166
|
+
getCachedComponent: (comp) => cache.get(comp),
|
|
1167
|
+
activate: (instance, parentNode, anchor) => {
|
|
1168
|
+
current = instance;
|
|
1169
|
+
activate(instance, parentNode, anchor);
|
|
1170
|
+
},
|
|
1171
|
+
deactivate: (instance) => {
|
|
1172
|
+
current = void 0;
|
|
1173
|
+
deactivate(instance, storageContainer);
|
|
1174
|
+
},
|
|
1175
|
+
// called when async component resolves to evaluate caching
|
|
1176
|
+
onAsyncResolve: (asyncWrapper) => {
|
|
1177
|
+
if (shouldCache(asyncWrapper, props, false)) {
|
|
1178
|
+
asyncWrapper.shapeFlag |= 256;
|
|
1179
|
+
innerCacheBlock(asyncWrapper.type, asyncWrapper);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
const innerCacheBlock = (key, block) => {
|
|
1184
|
+
const { max } = props;
|
|
896
1185
|
if (cache.has(key)) {
|
|
897
1186
|
keys.delete(key);
|
|
898
1187
|
keys.add(key);
|
|
@@ -902,8 +1191,8 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
902
1191
|
pruneCacheEntry(keys.values().next().value);
|
|
903
1192
|
}
|
|
904
1193
|
}
|
|
905
|
-
cache.set(key,
|
|
906
|
-
current =
|
|
1194
|
+
cache.set(key, block);
|
|
1195
|
+
current = block;
|
|
907
1196
|
};
|
|
908
1197
|
const cacheBlock = () => {
|
|
909
1198
|
const block = keepAliveInstance.block;
|
|
@@ -930,19 +1219,6 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
930
1219
|
}
|
|
931
1220
|
return true;
|
|
932
1221
|
};
|
|
933
|
-
const cacheFragment = (fragment) => {
|
|
934
|
-
const [innerBlock, interop] = getInnerBlock(fragment.nodes);
|
|
935
|
-
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
936
|
-
let key;
|
|
937
|
-
if (interop) {
|
|
938
|
-
innerBlock.vnode.shapeFlag |= 256;
|
|
939
|
-
key = innerBlock.vnode.type;
|
|
940
|
-
} else {
|
|
941
|
-
innerBlock.shapeFlag |= 256;
|
|
942
|
-
key = innerBlock.type;
|
|
943
|
-
}
|
|
944
|
-
innerCacheBlock(key, innerBlock);
|
|
945
|
-
};
|
|
946
1222
|
const pruneCache = (filter) => {
|
|
947
1223
|
cache.forEach((cached, key) => {
|
|
948
1224
|
const instance = getInstanceFromCache(cached);
|
|
@@ -1013,7 +1289,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1013
1289
|
}
|
|
1014
1290
|
);
|
|
1015
1291
|
(frag.onBeforeMount || (frag.onBeforeMount = [])).push(
|
|
1016
|
-
() =>
|
|
1292
|
+
() => processFragment(frag)
|
|
1017
1293
|
);
|
|
1018
1294
|
frag.getScope = (key) => {
|
|
1019
1295
|
const scope = keptAliveScopes.get(key);
|
|
@@ -1040,11 +1316,12 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1040
1316
|
return children;
|
|
1041
1317
|
}
|
|
1042
1318
|
});
|
|
1319
|
+
const VaporKeepAliveImpl = KeepAliveImpl;
|
|
1043
1320
|
const shouldCache = (block, props, interop = false) => {
|
|
1044
1321
|
const isAsync = !interop && isAsyncWrapper(block);
|
|
1045
1322
|
const type = interop ? block.vnode.type : block.type;
|
|
1046
1323
|
if (isAsync && !type.__asyncResolved) {
|
|
1047
|
-
return
|
|
1324
|
+
return false;
|
|
1048
1325
|
}
|
|
1049
1326
|
const { include, exclude } = props;
|
|
1050
1327
|
const name = getComponentName(isAsync ? type.__asyncResolved : type);
|
|
@@ -1096,16 +1373,6 @@ function deactivate(instance, container) {
|
|
|
1096
1373
|
devtoolsComponentAdded(instance);
|
|
1097
1374
|
}
|
|
1098
1375
|
}
|
|
1099
|
-
function findParentKeepAlive(instance) {
|
|
1100
|
-
let parent = instance;
|
|
1101
|
-
while (parent) {
|
|
1102
|
-
if (isKeepAlive(parent)) {
|
|
1103
|
-
return parent;
|
|
1104
|
-
}
|
|
1105
|
-
parent = parent.parent;
|
|
1106
|
-
}
|
|
1107
|
-
return null;
|
|
1108
|
-
}
|
|
1109
1376
|
|
|
1110
1377
|
let parentSuspense = null;
|
|
1111
1378
|
function setParentSuspense(suspense) {
|
|
@@ -1119,10 +1386,11 @@ function setParentSuspense(suspense) {
|
|
|
1119
1386
|
const interopKey = /* @__PURE__ */ Symbol(`interop`);
|
|
1120
1387
|
const vaporInteropImpl = {
|
|
1121
1388
|
mount(vnode, container, anchor, parentComponent, parentSuspense) {
|
|
1122
|
-
let selfAnchor = vnode.
|
|
1389
|
+
let selfAnchor = vnode.anchor = createTextNode();
|
|
1123
1390
|
if (isHydrating) {
|
|
1124
1391
|
queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
1125
1392
|
} else {
|
|
1393
|
+
vnode.el = selfAnchor;
|
|
1126
1394
|
container.insertBefore(selfAnchor, anchor);
|
|
1127
1395
|
}
|
|
1128
1396
|
const prev = currentInstance;
|
|
@@ -1241,7 +1509,7 @@ const vaporInteropImpl = {
|
|
|
1241
1509
|
);
|
|
1242
1510
|
}
|
|
1243
1511
|
});
|
|
1244
|
-
return
|
|
1512
|
+
return vnode.anchor;
|
|
1245
1513
|
},
|
|
1246
1514
|
setTransitionHooks(component, hooks) {
|
|
1247
1515
|
setTransitionHooks(component, hooks);
|
|
@@ -1277,12 +1545,102 @@ const vaporSlotsProxyHandler = {
|
|
|
1277
1545
|
const slot = target[key];
|
|
1278
1546
|
if (isFunction(slot)) {
|
|
1279
1547
|
slot.__vapor = true;
|
|
1548
|
+
const wrapped = (props) => [
|
|
1549
|
+
renderSlot({ [key]: slot }, key, props)
|
|
1550
|
+
];
|
|
1551
|
+
wrapped.__vs = slot;
|
|
1552
|
+
return wrapped;
|
|
1280
1553
|
}
|
|
1281
1554
|
return slot;
|
|
1282
1555
|
}
|
|
1283
1556
|
};
|
|
1284
1557
|
let vdomHydrateNode;
|
|
1285
|
-
function
|
|
1558
|
+
function mountVNode(internals, vnode, parentComponent) {
|
|
1559
|
+
const frag = new VaporFragment([]);
|
|
1560
|
+
frag.vnode = vnode;
|
|
1561
|
+
let isMounted = false;
|
|
1562
|
+
const unmount = (parentNode, transition) => {
|
|
1563
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1564
|
+
if (vnode.shapeFlag & 256) {
|
|
1565
|
+
if (vnode.type.__vapor) {
|
|
1566
|
+
deactivate(
|
|
1567
|
+
vnode.component,
|
|
1568
|
+
parentComponent.ctx.getStorageContainer()
|
|
1569
|
+
);
|
|
1570
|
+
} else {
|
|
1571
|
+
deactivate$1(
|
|
1572
|
+
vnode,
|
|
1573
|
+
parentComponent.ctx.getStorageContainer(),
|
|
1574
|
+
internals,
|
|
1575
|
+
parentComponent,
|
|
1576
|
+
null
|
|
1577
|
+
);
|
|
1578
|
+
}
|
|
1579
|
+
} else {
|
|
1580
|
+
internals.um(vnode, parentComponent, null, !!parentNode);
|
|
1581
|
+
}
|
|
1582
|
+
};
|
|
1583
|
+
frag.hydrate = () => {
|
|
1584
|
+
hydrateVNode(vnode, parentComponent);
|
|
1585
|
+
onScopeDispose(unmount, true);
|
|
1586
|
+
isMounted = true;
|
|
1587
|
+
frag.nodes = vnode.el;
|
|
1588
|
+
};
|
|
1589
|
+
frag.insert = (parentNode, anchor, transition) => {
|
|
1590
|
+
if (isHydrating) return;
|
|
1591
|
+
if (vnode.shapeFlag & 512) {
|
|
1592
|
+
if (vnode.type.__vapor) {
|
|
1593
|
+
activate(vnode.component, parentNode, anchor);
|
|
1594
|
+
} else {
|
|
1595
|
+
activate$1(
|
|
1596
|
+
vnode,
|
|
1597
|
+
parentNode,
|
|
1598
|
+
anchor,
|
|
1599
|
+
internals,
|
|
1600
|
+
parentComponent,
|
|
1601
|
+
null,
|
|
1602
|
+
void 0,
|
|
1603
|
+
false
|
|
1604
|
+
);
|
|
1605
|
+
}
|
|
1606
|
+
return;
|
|
1607
|
+
} else {
|
|
1608
|
+
const prev = currentInstance;
|
|
1609
|
+
simpleSetCurrentInstance(parentComponent);
|
|
1610
|
+
if (!isMounted) {
|
|
1611
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1612
|
+
internals.p(
|
|
1613
|
+
null,
|
|
1614
|
+
vnode,
|
|
1615
|
+
parentNode,
|
|
1616
|
+
anchor,
|
|
1617
|
+
parentComponent,
|
|
1618
|
+
null,
|
|
1619
|
+
// parentSuspense
|
|
1620
|
+
void 0,
|
|
1621
|
+
// namespace
|
|
1622
|
+
vnode.slotScopeIds
|
|
1623
|
+
);
|
|
1624
|
+
onScopeDispose(unmount, true);
|
|
1625
|
+
isMounted = true;
|
|
1626
|
+
} else {
|
|
1627
|
+
internals.m(
|
|
1628
|
+
vnode,
|
|
1629
|
+
parentNode,
|
|
1630
|
+
anchor,
|
|
1631
|
+
2,
|
|
1632
|
+
parentComponent
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
simpleSetCurrentInstance(prev);
|
|
1636
|
+
}
|
|
1637
|
+
frag.nodes = vnode.el;
|
|
1638
|
+
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1639
|
+
};
|
|
1640
|
+
frag.remove = unmount;
|
|
1641
|
+
return frag;
|
|
1642
|
+
}
|
|
1643
|
+
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots, isSingleRoot) {
|
|
1286
1644
|
const frag = new VaporFragment([]);
|
|
1287
1645
|
const vnode = frag.vnode = createVNode(
|
|
1288
1646
|
component,
|
|
@@ -1313,7 +1671,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1313
1671
|
if (vnode.shapeFlag & 256) {
|
|
1314
1672
|
deactivate$1(
|
|
1315
1673
|
vnode,
|
|
1316
|
-
|
|
1674
|
+
parentComponent.ctx.getStorageContainer(),
|
|
1317
1675
|
internals,
|
|
1318
1676
|
parentComponent,
|
|
1319
1677
|
null
|
|
@@ -1323,7 +1681,13 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1323
1681
|
internals.umt(vnode.component, null, !!parentNode);
|
|
1324
1682
|
};
|
|
1325
1683
|
frag.hydrate = () => {
|
|
1326
|
-
hydrateVNode(
|
|
1684
|
+
hydrateVNode(
|
|
1685
|
+
vnode,
|
|
1686
|
+
parentComponent,
|
|
1687
|
+
// skip fragment start anchor for multi-root component
|
|
1688
|
+
// to avoid mismatch
|
|
1689
|
+
!isSingleRoot
|
|
1690
|
+
);
|
|
1327
1691
|
onScopeDispose(unmount, true);
|
|
1328
1692
|
isMounted = true;
|
|
1329
1693
|
frag.nodes = vnode.el;
|
|
@@ -1384,6 +1748,9 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1384
1748
|
},
|
|
1385
1749
|
instance
|
|
1386
1750
|
);
|
|
1751
|
+
if (isMounted && rawRef) {
|
|
1752
|
+
setRef$1(rawRef, null, null, vnode);
|
|
1753
|
+
}
|
|
1387
1754
|
};
|
|
1388
1755
|
return frag;
|
|
1389
1756
|
}
|
|
@@ -1490,7 +1857,8 @@ const vaporInteropPlugin = (app) => {
|
|
|
1490
1857
|
app._context.vapor = extend(vaporInteropImpl, {
|
|
1491
1858
|
vdomMount: createVDOMComponent.bind(null, internals),
|
|
1492
1859
|
vdomUnmount: internals.umt,
|
|
1493
|
-
vdomSlot: renderVDOMSlot.bind(null, internals)
|
|
1860
|
+
vdomSlot: renderVDOMSlot.bind(null, internals),
|
|
1861
|
+
vdomMountVNode: mountVNode.bind(null, internals)
|
|
1494
1862
|
});
|
|
1495
1863
|
const mount = app.mount;
|
|
1496
1864
|
app.mount = ((...args) => {
|
|
@@ -1498,18 +1866,15 @@ const vaporInteropPlugin = (app) => {
|
|
|
1498
1866
|
return mount(...args);
|
|
1499
1867
|
});
|
|
1500
1868
|
};
|
|
1501
|
-
function hydrateVNode(vnode, parentComponent) {
|
|
1869
|
+
function hydrateVNode(vnode, parentComponent, skipFragmentAnchor = false) {
|
|
1502
1870
|
locateHydrationNode();
|
|
1503
1871
|
let node = currentHydrationNode;
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
!(isVaporComponent(parentComponent) && isRef(parentComponent.rawSlots._))) {
|
|
1507
|
-
node = node.nextSibling;
|
|
1872
|
+
if (skipFragmentAnchor && isComment(node, "[")) {
|
|
1873
|
+
setCurrentHydrationNode(node = node.nextSibling);
|
|
1508
1874
|
}
|
|
1509
|
-
if (currentHydrationNode !== node) setCurrentHydrationNode(node);
|
|
1510
1875
|
if (!vdomHydrateNode) vdomHydrateNode = ensureHydrationRenderer().hydrateNode;
|
|
1511
1876
|
const nextNode = vdomHydrateNode(
|
|
1512
|
-
|
|
1877
|
+
node,
|
|
1513
1878
|
vnode,
|
|
1514
1879
|
parentComponent,
|
|
1515
1880
|
null,
|
|
@@ -1568,7 +1933,7 @@ function propGetter(rawProps, key) {
|
|
|
1568
1933
|
while (i--) {
|
|
1569
1934
|
const source = resolveSource(dynamicSources[i]);
|
|
1570
1935
|
if (hasOwn(source, key))
|
|
1571
|
-
return dynamicSources[interopKey] ? source[key] : resolveSource(source[key]);
|
|
1936
|
+
return dynamicSources[interopKey] || isOn(key) ? source[key] : resolveSource(source[key]);
|
|
1572
1937
|
}
|
|
1573
1938
|
}
|
|
1574
1939
|
return rawProps[key] && resolveSource(rawProps[key]);
|
|
@@ -1923,10 +2288,12 @@ const dynamicSlotsProxyHandlers = {
|
|
|
1923
2288
|
for (const source of dynamicSources) {
|
|
1924
2289
|
if (isFunction(source)) {
|
|
1925
2290
|
const slot = resolveFunctionSource(source);
|
|
1926
|
-
if (
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
2291
|
+
if (slot) {
|
|
2292
|
+
if (isArray(slot)) {
|
|
2293
|
+
for (const s of slot) keys.push(String(s.name));
|
|
2294
|
+
} else {
|
|
2295
|
+
keys.push(String(slot.name));
|
|
2296
|
+
}
|
|
1930
2297
|
}
|
|
1931
2298
|
} else {
|
|
1932
2299
|
keys.push(...Object.keys(source));
|
|
@@ -2030,343 +2397,118 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
2030
2397
|
fragment.nodes = el;
|
|
2031
2398
|
return;
|
|
2032
2399
|
}
|
|
2033
|
-
const slot = getSlot(rawSlots, slotName);
|
|
2034
|
-
if (slot) {
|
|
2035
|
-
fragment.fallback = fallback;
|
|
2036
|
-
fragment.update(
|
|
2037
|
-
slot._bound || (slot._bound = () => {
|
|
2038
|
-
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
2039
|
-
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
2040
|
-
);
|
|
2041
|
-
const prev = inOnceSlot;
|
|
2042
|
-
try {
|
|
2043
|
-
if (once) inOnceSlot = true;
|
|
2044
|
-
return slot(slotProps);
|
|
2045
|
-
} finally {
|
|
2046
|
-
inOnceSlot = prev;
|
|
2047
|
-
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
2048
|
-
}
|
|
2049
|
-
})
|
|
2050
|
-
);
|
|
2051
|
-
} else {
|
|
2052
|
-
fragment.update(fallback);
|
|
2053
|
-
}
|
|
2054
|
-
};
|
|
2055
|
-
if (!once && (isDynamicName || rawSlots.$)) {
|
|
2056
|
-
renderEffect(renderSlot);
|
|
2057
|
-
} else {
|
|
2058
|
-
renderSlot();
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
if (!isHydrating) {
|
|
2062
|
-
if (!noSlotted) {
|
|
2063
|
-
const scopeId = instance.type.__scopeId;
|
|
2064
|
-
if (scopeId) {
|
|
2065
|
-
setScopeId(fragment, [`${scopeId}-s`]);
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
2069
|
-
} else {
|
|
2070
|
-
if (fragment.insert) {
|
|
2071
|
-
fragment.hydrate();
|
|
2072
|
-
}
|
|
2073
|
-
if (_isLastInsertion) {
|
|
2074
|
-
advanceHydrationNode(_insertionParent);
|
|
2075
|
-
}
|
|
2076
|
-
}
|
|
2077
|
-
return fragment;
|
|
2078
|
-
}
|
|
2079
|
-
|
|
2080
|
-
class RenderEffect extends ReactiveEffect {
|
|
2081
|
-
constructor(render) {
|
|
2082
|
-
super();
|
|
2083
|
-
this.render = render;
|
|
2084
|
-
const instance = currentInstance;
|
|
2085
|
-
if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
|
|
2086
|
-
warn("renderEffect called without active EffectScope or Vapor instance.");
|
|
2087
|
-
}
|
|
2088
|
-
const job = () => {
|
|
2089
|
-
if (this.dirty) {
|
|
2090
|
-
this.run();
|
|
2091
|
-
}
|
|
2092
|
-
};
|
|
2093
|
-
this.updateJob = () => {
|
|
2094
|
-
instance.isUpdating = false;
|
|
2095
|
-
instance.u && invokeArrayFns(instance.u);
|
|
2096
|
-
};
|
|
2097
|
-
if (instance) {
|
|
2098
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2099
|
-
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
2100
|
-
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
2101
|
-
}
|
|
2102
|
-
if (instance.type.ce) {
|
|
2103
|
-
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
2104
|
-
}
|
|
2105
|
-
job.i = instance;
|
|
2106
|
-
}
|
|
2107
|
-
this.job = job;
|
|
2108
|
-
this.i = instance;
|
|
2109
|
-
}
|
|
2110
|
-
fn() {
|
|
2111
|
-
const instance = this.i;
|
|
2112
|
-
const scope = this.subs ? this.subs.sub : void 0;
|
|
2113
|
-
const hasUpdateHooks = instance && (instance.bu || instance.u);
|
|
2114
|
-
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
2115
|
-
startMeasure(instance, `renderEffect`);
|
|
2116
|
-
}
|
|
2117
|
-
const prev = setCurrentInstance(instance, scope);
|
|
2118
|
-
if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
|
|
2119
|
-
instance.isUpdating = true;
|
|
2120
|
-
instance.bu && invokeArrayFns(instance.bu);
|
|
2121
|
-
this.render();
|
|
2122
|
-
queuePostFlushCb(this.updateJob);
|
|
2123
|
-
} else {
|
|
2124
|
-
this.render();
|
|
2125
|
-
}
|
|
2126
|
-
setCurrentInstance(...prev);
|
|
2127
|
-
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
2128
|
-
startMeasure(instance, `renderEffect`);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
notify() {
|
|
2132
|
-
const flags = this.flags;
|
|
2133
|
-
if (!(flags & 256)) {
|
|
2134
|
-
queueJob(this.job, this.i ? this.i.uid : void 0);
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
function renderEffect(fn, noLifecycle = false) {
|
|
2139
|
-
if (inOnceSlot) return fn();
|
|
2140
|
-
const effect = new RenderEffect(fn);
|
|
2141
|
-
if (noLifecycle) {
|
|
2142
|
-
effect.fn = fn;
|
|
2143
|
-
}
|
|
2144
|
-
effect.run();
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
const displayName = "VaporTransition";
|
|
2148
|
-
const decorate$1 = (t) => {
|
|
2149
|
-
t.displayName = displayName;
|
|
2150
|
-
t.props = TransitionPropsValidators;
|
|
2151
|
-
t.__vapor = true;
|
|
2152
|
-
return t;
|
|
2153
|
-
};
|
|
2154
|
-
const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
|
|
2155
|
-
let resetDisplay;
|
|
2156
|
-
if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
|
|
2157
|
-
const {
|
|
2158
|
-
content: { firstChild },
|
|
2159
|
-
parentNode
|
|
2160
|
-
} = currentHydrationNode;
|
|
2161
|
-
if (firstChild) {
|
|
2162
|
-
if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
|
|
2163
|
-
const originalDisplay = firstChild.style.display;
|
|
2164
|
-
firstChild.style.display = "none";
|
|
2165
|
-
resetDisplay = () => firstChild.style.display = originalDisplay;
|
|
2166
|
-
}
|
|
2167
|
-
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
2168
|
-
setCurrentHydrationNode(firstChild);
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
const children = slots.default && slots.default();
|
|
2172
|
-
if (!children) return [];
|
|
2173
|
-
const instance = currentInstance;
|
|
2174
|
-
const { mode } = props;
|
|
2175
|
-
checkTransitionMode(mode);
|
|
2176
|
-
let resolvedProps;
|
|
2177
|
-
renderEffect(() => resolvedProps = resolveTransitionProps(props));
|
|
2178
|
-
const hooks = applyTransitionHooks(children, {
|
|
2179
|
-
state: useTransitionState(),
|
|
2180
|
-
// use proxy to keep props reference stable
|
|
2181
|
-
props: new Proxy({}, {
|
|
2182
|
-
get(_, key) {
|
|
2183
|
-
return resolvedProps[key];
|
|
2184
|
-
}
|
|
2185
|
-
}),
|
|
2186
|
-
instance
|
|
2187
|
-
});
|
|
2188
|
-
if (resetDisplay && resolvedProps.appear) {
|
|
2189
|
-
const child = findTransitionBlock(children);
|
|
2190
|
-
hooks.beforeEnter(child);
|
|
2191
|
-
resetDisplay();
|
|
2192
|
-
queuePostFlushCb(() => hooks.enter(child));
|
|
2193
|
-
}
|
|
2194
|
-
return children;
|
|
2195
|
-
});
|
|
2196
|
-
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
2197
|
-
const { leavingNodes } = state;
|
|
2198
|
-
const context = {
|
|
2199
|
-
setLeavingNodeCache: (el) => {
|
|
2200
|
-
leavingNodes.set(key, el);
|
|
2201
|
-
},
|
|
2202
|
-
unsetLeavingNodeCache: (el) => {
|
|
2203
|
-
const leavingNode = leavingNodes.get(key);
|
|
2204
|
-
if (leavingNode === el) {
|
|
2205
|
-
leavingNodes.delete(key);
|
|
2206
|
-
}
|
|
2207
|
-
},
|
|
2208
|
-
earlyRemove: () => {
|
|
2209
|
-
const leavingNode = leavingNodes.get(key);
|
|
2210
|
-
if (leavingNode && leavingNode[leaveCbKey]) {
|
|
2211
|
-
leavingNode[leaveCbKey]();
|
|
2212
|
-
}
|
|
2213
|
-
},
|
|
2214
|
-
cloneHooks: (block) => {
|
|
2215
|
-
const hooks = resolveTransitionHooks(
|
|
2216
|
-
block,
|
|
2217
|
-
props,
|
|
2218
|
-
state,
|
|
2219
|
-
instance,
|
|
2220
|
-
postClone
|
|
2221
|
-
);
|
|
2222
|
-
if (postClone) postClone(hooks);
|
|
2223
|
-
return hooks;
|
|
2224
|
-
}
|
|
2225
|
-
};
|
|
2226
|
-
return context;
|
|
2227
|
-
};
|
|
2228
|
-
function resolveTransitionHooks(block, props, state, instance, postClone) {
|
|
2229
|
-
const context = getTransitionHooksContext(
|
|
2230
|
-
String(block.$key),
|
|
2231
|
-
props,
|
|
2232
|
-
state,
|
|
2233
|
-
instance,
|
|
2234
|
-
postClone
|
|
2235
|
-
);
|
|
2236
|
-
const hooks = baseResolveTransitionHooks(
|
|
2237
|
-
context,
|
|
2238
|
-
props,
|
|
2239
|
-
state,
|
|
2240
|
-
instance
|
|
2241
|
-
);
|
|
2242
|
-
hooks.state = state;
|
|
2243
|
-
hooks.props = props;
|
|
2244
|
-
hooks.instance = instance;
|
|
2245
|
-
return hooks;
|
|
2246
|
-
}
|
|
2247
|
-
function applyTransitionHooks(block, hooks) {
|
|
2248
|
-
if (isArray(block)) {
|
|
2249
|
-
block = block.filter((b) => !(b instanceof Comment));
|
|
2250
|
-
if (block.length === 1) {
|
|
2251
|
-
block = block[0];
|
|
2252
|
-
} else if (block.length === 0) {
|
|
2253
|
-
return hooks;
|
|
2400
|
+
const slot = getSlot(rawSlots, slotName);
|
|
2401
|
+
if (slot) {
|
|
2402
|
+
fragment.fallback = fallback;
|
|
2403
|
+
fragment.update(
|
|
2404
|
+
slot._bound || (slot._bound = () => {
|
|
2405
|
+
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
2406
|
+
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
2407
|
+
);
|
|
2408
|
+
const prev = inOnceSlot;
|
|
2409
|
+
try {
|
|
2410
|
+
if (once) inOnceSlot = true;
|
|
2411
|
+
return slot(slotProps);
|
|
2412
|
+
} finally {
|
|
2413
|
+
inOnceSlot = prev;
|
|
2414
|
+
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
2415
|
+
}
|
|
2416
|
+
})
|
|
2417
|
+
);
|
|
2418
|
+
} else {
|
|
2419
|
+
fragment.update(fallback);
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2422
|
+
if (!once && (isDynamicName || rawSlots.$)) {
|
|
2423
|
+
renderEffect(renderSlot);
|
|
2424
|
+
} else {
|
|
2425
|
+
renderSlot();
|
|
2254
2426
|
}
|
|
2255
2427
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2428
|
+
if (!isHydrating) {
|
|
2429
|
+
if (!noSlotted) {
|
|
2430
|
+
const scopeId = instance.type.__scopeId;
|
|
2431
|
+
if (scopeId) {
|
|
2432
|
+
setScopeId(fragment, [`${scopeId}-s`]);
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
2436
|
+
} else {
|
|
2437
|
+
if (fragment.insert) {
|
|
2438
|
+
fragment.hydrate();
|
|
2439
|
+
}
|
|
2440
|
+
if (_isLastInsertion) {
|
|
2441
|
+
advanceHydrationNode(_insertionParent);
|
|
2262
2442
|
}
|
|
2263
|
-
return hooks;
|
|
2264
2443
|
}
|
|
2265
|
-
|
|
2266
|
-
let resolvedHooks = resolveTransitionHooks(
|
|
2267
|
-
child,
|
|
2268
|
-
props,
|
|
2269
|
-
state,
|
|
2270
|
-
instance,
|
|
2271
|
-
(hooks2) => resolvedHooks = hooks2
|
|
2272
|
-
);
|
|
2273
|
-
resolvedHooks.delayedLeave = delayedLeave;
|
|
2274
|
-
child.$transition = resolvedHooks;
|
|
2275
|
-
fragments.forEach((f) => f.$transition = resolvedHooks);
|
|
2276
|
-
return resolvedHooks;
|
|
2444
|
+
return fragment;
|
|
2277
2445
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
state.isLeaving = true;
|
|
2292
|
-
leavingHooks.afterLeave = () => {
|
|
2293
|
-
state.isLeaving = false;
|
|
2294
|
-
afterLeaveCb();
|
|
2295
|
-
leavingBlock.$transition = void 0;
|
|
2296
|
-
delete leavingHooks.afterLeave;
|
|
2446
|
+
|
|
2447
|
+
class RenderEffect extends ReactiveEffect {
|
|
2448
|
+
constructor(render) {
|
|
2449
|
+
super();
|
|
2450
|
+
this.render = render;
|
|
2451
|
+
const instance = currentInstance;
|
|
2452
|
+
if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
|
|
2453
|
+
warn("renderEffect called without active EffectScope or Vapor instance.");
|
|
2454
|
+
}
|
|
2455
|
+
const job = () => {
|
|
2456
|
+
if (this.dirty) {
|
|
2457
|
+
this.run();
|
|
2458
|
+
}
|
|
2297
2459
|
};
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
block2[leaveCbKey] = () => {
|
|
2302
|
-
earlyRemove();
|
|
2303
|
-
block2[leaveCbKey] = void 0;
|
|
2304
|
-
leavingBlock.$transition = void 0;
|
|
2305
|
-
delete enterHooks.delayedLeave;
|
|
2306
|
-
};
|
|
2307
|
-
enterHooks.delayedLeave = () => {
|
|
2308
|
-
delayedLeave();
|
|
2309
|
-
leavingBlock.$transition = void 0;
|
|
2310
|
-
delete enterHooks.delayedLeave;
|
|
2311
|
-
};
|
|
2460
|
+
this.updateJob = () => {
|
|
2461
|
+
instance.isUpdating = false;
|
|
2462
|
+
instance.u && invokeArrayFns(instance.u);
|
|
2312
2463
|
};
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
if (block instanceof Node) {
|
|
2318
|
-
if (block instanceof Element) child = block;
|
|
2319
|
-
} else if (isVaporComponent(block)) {
|
|
2320
|
-
if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
|
|
2321
|
-
child = block;
|
|
2322
|
-
} else {
|
|
2323
|
-
if (getComponentName(block.type) === displayName) return void 0;
|
|
2324
|
-
child = findTransitionBlock(block.block, onFragment);
|
|
2325
|
-
if (child && child.$key === void 0) child.$key = block.uid;
|
|
2326
|
-
}
|
|
2327
|
-
} else if (isArray(block)) {
|
|
2328
|
-
let hasFound = false;
|
|
2329
|
-
for (const c of block) {
|
|
2330
|
-
if (c instanceof Comment) continue;
|
|
2331
|
-
const item = findTransitionBlock(c, onFragment);
|
|
2332
|
-
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
2333
|
-
warn(
|
|
2334
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
2335
|
-
);
|
|
2336
|
-
break;
|
|
2464
|
+
if (instance) {
|
|
2465
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2466
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
2467
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
2337
2468
|
}
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2469
|
+
if (instance.type.ce) {
|
|
2470
|
+
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
2471
|
+
}
|
|
2472
|
+
job.i = instance;
|
|
2341
2473
|
}
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2474
|
+
this.job = job;
|
|
2475
|
+
this.i = instance;
|
|
2476
|
+
}
|
|
2477
|
+
fn() {
|
|
2478
|
+
const instance = this.i;
|
|
2479
|
+
const scope = this.subs ? this.subs.sub : void 0;
|
|
2480
|
+
const hasUpdateHooks = instance && (instance.bu || instance.u);
|
|
2481
|
+
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
2482
|
+
startMeasure(instance, `renderEffect`);
|
|
2483
|
+
}
|
|
2484
|
+
const prev = setCurrentInstance(instance, scope);
|
|
2485
|
+
if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
|
|
2486
|
+
instance.isUpdating = true;
|
|
2487
|
+
instance.bu && invokeArrayFns(instance.bu);
|
|
2488
|
+
this.render();
|
|
2489
|
+
queuePostFlushCb(this.updateJob);
|
|
2345
2490
|
} else {
|
|
2346
|
-
|
|
2347
|
-
child = findTransitionBlock(block.nodes, onFragment);
|
|
2491
|
+
this.render();
|
|
2348
2492
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
function setTransitionHooksOnFragment(block, hooks) {
|
|
2353
|
-
if (isFragment(block)) {
|
|
2354
|
-
block.$transition = hooks;
|
|
2355
|
-
if (block.nodes && isFragment(block.nodes)) {
|
|
2356
|
-
setTransitionHooksOnFragment(block.nodes, hooks);
|
|
2493
|
+
setCurrentInstance(...prev);
|
|
2494
|
+
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
2495
|
+
startMeasure(instance, `renderEffect`);
|
|
2357
2496
|
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
|
|
2497
|
+
}
|
|
2498
|
+
notify() {
|
|
2499
|
+
const flags = this.flags;
|
|
2500
|
+
if (!(flags & 256)) {
|
|
2501
|
+
queueJob(this.job, this.i ? this.i.uid : void 0);
|
|
2361
2502
|
}
|
|
2362
2503
|
}
|
|
2363
2504
|
}
|
|
2364
|
-
function
|
|
2365
|
-
if (
|
|
2366
|
-
|
|
2367
|
-
|
|
2505
|
+
function renderEffect(fn, noLifecycle = false) {
|
|
2506
|
+
if (inOnceSlot) return fn();
|
|
2507
|
+
const effect = new RenderEffect(fn);
|
|
2508
|
+
if (noLifecycle) {
|
|
2509
|
+
effect.fn = fn;
|
|
2368
2510
|
}
|
|
2369
|
-
|
|
2511
|
+
effect.run();
|
|
2370
2512
|
}
|
|
2371
2513
|
|
|
2372
2514
|
class VaporFragment {
|
|
@@ -2381,49 +2523,12 @@ class ForFragment extends VaporFragment {
|
|
|
2381
2523
|
}
|
|
2382
2524
|
}
|
|
2383
2525
|
class DynamicFragment extends VaporFragment {
|
|
2384
|
-
constructor(anchorLabel) {
|
|
2526
|
+
constructor(anchorLabel, keyed = false) {
|
|
2385
2527
|
super([]);
|
|
2386
2528
|
this.hydrate = (isEmpty = false) => {
|
|
2387
|
-
|
|
2388
|
-
if (this.anchorLabel === "if") {
|
|
2389
|
-
if (isEmpty) {
|
|
2390
|
-
this.anchor = locateFragmentEndAnchor("");
|
|
2391
|
-
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
2392
|
-
throw new Error(
|
|
2393
|
-
"Failed to locate if anchor. this is likely a Vue internal bug."
|
|
2394
|
-
);
|
|
2395
|
-
} else {
|
|
2396
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2397
|
-
this.anchor.data = this.anchorLabel;
|
|
2398
|
-
}
|
|
2399
|
-
return;
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
} else if (this.anchorLabel === "slot") {
|
|
2403
|
-
if (isEmpty && isComment(currentHydrationNode, "")) {
|
|
2404
|
-
this.anchor = currentHydrationNode;
|
|
2405
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2406
|
-
this.anchor.data = this.anchorLabel;
|
|
2407
|
-
}
|
|
2408
|
-
return;
|
|
2409
|
-
}
|
|
2410
|
-
this.anchor = locateFragmentEndAnchor();
|
|
2411
|
-
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
2412
|
-
throw new Error(
|
|
2413
|
-
"Failed to locate slot anchor. this is likely a Vue internal bug."
|
|
2414
|
-
);
|
|
2415
|
-
} else {
|
|
2416
|
-
return;
|
|
2417
|
-
}
|
|
2418
|
-
}
|
|
2419
|
-
const { parentNode, nextNode } = findBlockNode(this.nodes);
|
|
2420
|
-
queuePostFlushCb(() => {
|
|
2421
|
-
parentNode.insertBefore(
|
|
2422
|
-
this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
|
|
2423
|
-
nextNode
|
|
2424
|
-
);
|
|
2425
|
-
});
|
|
2529
|
+
hydrateDynamicFragment(this, isEmpty);
|
|
2426
2530
|
};
|
|
2531
|
+
this.keyed = keyed;
|
|
2427
2532
|
this.slotOwner = currentSlotOwner;
|
|
2428
2533
|
if (isHydrating) {
|
|
2429
2534
|
this.anchorLabel = anchorLabel;
|
|
@@ -2528,6 +2633,7 @@ class DynamicFragment extends VaporFragment {
|
|
|
2528
2633
|
this.nodes = this.scope.run(render) || [];
|
|
2529
2634
|
if (prev !== void 0) setCurrentInstance(...prev);
|
|
2530
2635
|
setCurrentSlotOwner(prevOwner);
|
|
2636
|
+
if (this.keyed) setKey(this.nodes, this.current);
|
|
2531
2637
|
if (transition) {
|
|
2532
2638
|
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
2533
2639
|
}
|
|
@@ -2592,6 +2698,19 @@ function isFragment(val) {
|
|
|
2592
2698
|
function isDynamicFragment(val) {
|
|
2593
2699
|
return val instanceof DynamicFragment;
|
|
2594
2700
|
}
|
|
2701
|
+
function setKey(block, key) {
|
|
2702
|
+
if (block instanceof Node) {
|
|
2703
|
+
block.$key = key;
|
|
2704
|
+
} else if (isVaporComponent(block)) {
|
|
2705
|
+
setKey(block.block, key);
|
|
2706
|
+
} else if (isArray(block)) {
|
|
2707
|
+
for (const b of block) {
|
|
2708
|
+
setKey(b, key);
|
|
2709
|
+
}
|
|
2710
|
+
} else {
|
|
2711
|
+
setKey(block.nodes, key);
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2595
2714
|
|
|
2596
2715
|
const VaporTeleportImpl = {
|
|
2597
2716
|
name: "VaporTeleport",
|
|
@@ -2604,6 +2723,11 @@ const VaporTeleportImpl = {
|
|
|
2604
2723
|
class TeleportFragment extends VaporFragment {
|
|
2605
2724
|
constructor(props, slots) {
|
|
2606
2725
|
super([]);
|
|
2726
|
+
/**
|
|
2727
|
+
* @internal marker for duck typing to avoid direct instanceof check
|
|
2728
|
+
* which prevents tree-shaking of TeleportFragment
|
|
2729
|
+
*/
|
|
2730
|
+
this.__isTeleportFragment = true;
|
|
2607
2731
|
this.insert = (container, anchor) => {
|
|
2608
2732
|
if (isHydrating) return;
|
|
2609
2733
|
this.placeholder = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createTextNode();
|
|
@@ -2704,19 +2828,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2704
2828
|
});
|
|
2705
2829
|
const nodes = this.nodes;
|
|
2706
2830
|
if (this.parentComponent && this.parentComponent.ut) {
|
|
2707
|
-
|
|
2708
|
-
(nodes.onUpdated || (nodes.onUpdated = [])).push(
|
|
2709
|
-
() => updateCssVars(this)
|
|
2710
|
-
);
|
|
2711
|
-
} else if (isArray(nodes)) {
|
|
2712
|
-
nodes.forEach((node) => {
|
|
2713
|
-
if (isFragment(node)) {
|
|
2714
|
-
(node.onUpdated || (node.onUpdated = [])).push(
|
|
2715
|
-
() => updateCssVars(this)
|
|
2716
|
-
);
|
|
2717
|
-
}
|
|
2718
|
-
});
|
|
2719
|
-
}
|
|
2831
|
+
this.registerUpdateCssVars(nodes);
|
|
2720
2832
|
}
|
|
2721
2833
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2722
2834
|
if (isVaporComponent(nodes)) {
|
|
@@ -2728,6 +2840,18 @@ class TeleportFragment extends VaporFragment {
|
|
|
2728
2840
|
}
|
|
2729
2841
|
}
|
|
2730
2842
|
}
|
|
2843
|
+
registerUpdateCssVars(block) {
|
|
2844
|
+
if (isFragment(block)) {
|
|
2845
|
+
(block.onUpdated || (block.onUpdated = [])).push(
|
|
2846
|
+
() => updateCssVars(this)
|
|
2847
|
+
);
|
|
2848
|
+
this.registerUpdateCssVars(block.nodes);
|
|
2849
|
+
} else if (isVaporComponent(block)) {
|
|
2850
|
+
this.registerUpdateCssVars(block.block);
|
|
2851
|
+
} else if (isArray(block)) {
|
|
2852
|
+
block.forEach((node) => this.registerUpdateCssVars(node));
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2731
2855
|
handleChildrenUpdate(children) {
|
|
2732
2856
|
if (!this.parent || isHydrating) {
|
|
2733
2857
|
this.nodes = children;
|
|
@@ -2817,7 +2941,10 @@ Server rendered element contains fewer child nodes than client nodes.`
|
|
|
2817
2941
|
}
|
|
2818
2942
|
}
|
|
2819
2943
|
function isVaporTeleport(value) {
|
|
2820
|
-
return value
|
|
2944
|
+
return !!(value && value.__isTeleport && value.__vapor);
|
|
2945
|
+
}
|
|
2946
|
+
function isTeleportFragment(value) {
|
|
2947
|
+
return !!(value && value.__isTeleportFragment);
|
|
2821
2948
|
}
|
|
2822
2949
|
function locateTeleportEndAnchor(node = currentHydrationNode) {
|
|
2823
2950
|
while (node) {
|
|
@@ -3019,7 +3146,7 @@ function normalizeBlock(block) {
|
|
|
3019
3146
|
} else if (isVaporComponent(block)) {
|
|
3020
3147
|
nodes.push(...normalizeBlock(block.block));
|
|
3021
3148
|
} else {
|
|
3022
|
-
if (block
|
|
3149
|
+
if (isTeleportFragment(block)) {
|
|
3023
3150
|
nodes.push(block.placeholder, block.anchor);
|
|
3024
3151
|
} else {
|
|
3025
3152
|
nodes.push(...normalizeBlock(block.nodes));
|
|
@@ -3095,6 +3222,18 @@ function setComponentScopeId(instance) {
|
|
|
3095
3222
|
setScopeId(instance.block, scopeIds);
|
|
3096
3223
|
}
|
|
3097
3224
|
}
|
|
3225
|
+
let _applyTransitionHooks;
|
|
3226
|
+
let _applyTransitionLeaveHooks;
|
|
3227
|
+
function registerTransitionHooks(applyHooks, applyLeaveHooks) {
|
|
3228
|
+
_applyTransitionHooks = applyHooks;
|
|
3229
|
+
_applyTransitionLeaveHooks = applyLeaveHooks;
|
|
3230
|
+
}
|
|
3231
|
+
function applyTransitionHooks(block, hooks) {
|
|
3232
|
+
return _applyTransitionHooks ? _applyTransitionHooks(block, hooks) : hooks;
|
|
3233
|
+
}
|
|
3234
|
+
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
3235
|
+
_applyTransitionLeaveHooks && _applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb);
|
|
3236
|
+
}
|
|
3098
3237
|
|
|
3099
3238
|
function hmrRerender(instance) {
|
|
3100
3239
|
const normalized = normalizeBlock(instance.block);
|
|
@@ -3187,9 +3326,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3187
3326
|
}
|
|
3188
3327
|
}
|
|
3189
3328
|
if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
3190
|
-
const cached = currentInstance.getCachedComponent(
|
|
3191
|
-
component
|
|
3192
|
-
);
|
|
3329
|
+
const cached = currentInstance.ctx.getCachedComponent(component);
|
|
3193
3330
|
if (cached) return cached;
|
|
3194
3331
|
}
|
|
3195
3332
|
if (appContext.vapor && !component.__vapor) {
|
|
@@ -3197,7 +3334,8 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3197
3334
|
component,
|
|
3198
3335
|
currentInstance,
|
|
3199
3336
|
rawProps,
|
|
3200
|
-
rawSlots
|
|
3337
|
+
rawSlots,
|
|
3338
|
+
isSingleRoot
|
|
3201
3339
|
);
|
|
3202
3340
|
if (!isHydrating) {
|
|
3203
3341
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
@@ -3444,6 +3582,9 @@ function isVaporComponent(value) {
|
|
|
3444
3582
|
return value instanceof VaporComponentInstance;
|
|
3445
3583
|
}
|
|
3446
3584
|
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, once, appContext) {
|
|
3585
|
+
if (comp === NULL_DYNAMIC_COMPONENT) {
|
|
3586
|
+
return !!(process.env.NODE_ENV !== "production") ? createComment("ndc") : createTextNode("");
|
|
3587
|
+
}
|
|
3447
3588
|
if (!isString(comp)) {
|
|
3448
3589
|
return createComponent(
|
|
3449
3590
|
comp,
|
|
@@ -3515,7 +3656,11 @@ function mountComponent(instance, parent, anchor) {
|
|
|
3515
3656
|
return;
|
|
3516
3657
|
}
|
|
3517
3658
|
if (instance.shapeFlag & 512) {
|
|
3518
|
-
|
|
3659
|
+
instance.parent.ctx.activate(
|
|
3660
|
+
instance,
|
|
3661
|
+
parent,
|
|
3662
|
+
anchor
|
|
3663
|
+
);
|
|
3519
3664
|
return;
|
|
3520
3665
|
}
|
|
3521
3666
|
const { root, type } = instance;
|
|
@@ -3542,7 +3687,7 @@ function mountComponent(instance, parent, anchor) {
|
|
|
3542
3687
|
}
|
|
3543
3688
|
function unmountComponent(instance, parentNode) {
|
|
3544
3689
|
if (parentNode && instance.parent && instance.parent.vapor && instance.shapeFlag & 256) {
|
|
3545
|
-
|
|
3690
|
+
instance.parent.ctx.deactivate(instance);
|
|
3546
3691
|
return;
|
|
3547
3692
|
}
|
|
3548
3693
|
if (instance.isMounted && !instance.isUnmounted) {
|
|
@@ -3576,7 +3721,7 @@ function getRootElement(block, onDynamicFragment, recurse = true) {
|
|
|
3576
3721
|
if (recurse && isVaporComponent(block)) {
|
|
3577
3722
|
return getRootElement(block.block, onDynamicFragment, recurse);
|
|
3578
3723
|
}
|
|
3579
|
-
if (isFragment(block) && !(block
|
|
3724
|
+
if (isFragment(block) && !isTeleportFragment(block)) {
|
|
3580
3725
|
if (block instanceof DynamicFragment && onDynamicFragment) {
|
|
3581
3726
|
onDynamicFragment(block);
|
|
3582
3727
|
}
|
|
@@ -3654,7 +3799,7 @@ function handleSetupResult(setupResult, component, instance) {
|
|
|
3654
3799
|
});
|
|
3655
3800
|
} else if (!!(process.env.NODE_ENV !== "production") && (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || // preventing attrs fallthrough on Teleport
|
|
3656
3801
|
// consistent with VDOM Teleport behavior
|
|
3657
|
-
instance.block
|
|
3802
|
+
isTeleportFragment(instance.block))) {
|
|
3658
3803
|
warnExtraneousAttributes(instance.attrs);
|
|
3659
3804
|
}
|
|
3660
3805
|
}
|
|
@@ -3832,6 +3977,9 @@ function defineVaporAsyncComponent(source) {
|
|
|
3832
3977
|
);
|
|
3833
3978
|
load().then(() => {
|
|
3834
3979
|
loaded.value = true;
|
|
3980
|
+
if (instance.parent && isKeepAlive(instance.parent)) {
|
|
3981
|
+
instance.parent.ctx.onAsyncResolve(instance);
|
|
3982
|
+
}
|
|
3835
3983
|
}).catch((err) => {
|
|
3836
3984
|
onError(err);
|
|
3837
3985
|
error.value = err;
|
|
@@ -3991,7 +4139,6 @@ class VaporElement extends VueElementBase {
|
|
|
3991
4139
|
}
|
|
3992
4140
|
|
|
3993
4141
|
let t;
|
|
3994
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
3995
4142
|
// @__NO_SIDE_EFFECTS__
|
|
3996
4143
|
function template(html, root, ns) {
|
|
3997
4144
|
let node;
|
|
@@ -4028,7 +4175,7 @@ function createIf(condition, b1, b2, once) {
|
|
|
4028
4175
|
if (!isHydrating) resetInsertionState();
|
|
4029
4176
|
let frag;
|
|
4030
4177
|
if (once) {
|
|
4031
|
-
frag = condition() ? b1() : b2 ? b2() : [];
|
|
4178
|
+
frag = condition() ? b1() : b2 ? b2() : [!!(process.env.NODE_ENV !== "production") ? createComment("if") : createTextNode()];
|
|
4032
4179
|
} else {
|
|
4033
4180
|
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
4034
4181
|
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
@@ -4048,7 +4195,7 @@ function createKeyedFragment(key, render) {
|
|
|
4048
4195
|
const _insertionAnchor = insertionAnchor;
|
|
4049
4196
|
const _isLastInsertion = isLastInsertion;
|
|
4050
4197
|
if (!isHydrating) resetInsertionState();
|
|
4051
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
4198
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed", true) : new DynamicFragment(void 0, true);
|
|
4052
4199
|
renderEffect(() => frag.update(render, key()));
|
|
4053
4200
|
if (!isHydrating) {
|
|
4054
4201
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
@@ -4541,7 +4688,12 @@ function ensureCleanup(el) {
|
|
|
4541
4688
|
}
|
|
4542
4689
|
function createTemplateRefSetter() {
|
|
4543
4690
|
const instance = currentInstance;
|
|
4544
|
-
|
|
4691
|
+
const oldRefMap = /* @__PURE__ */ new WeakMap();
|
|
4692
|
+
return (el, ref, refFor, refKey) => {
|
|
4693
|
+
const oldRef = setRef(instance, el, ref, oldRefMap.get(el), refFor, refKey);
|
|
4694
|
+
oldRefMap.set(el, oldRef);
|
|
4695
|
+
return oldRef;
|
|
4696
|
+
};
|
|
4545
4697
|
}
|
|
4546
4698
|
function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
4547
4699
|
if (!instance || instance.isUnmounted) return;
|
|
@@ -4659,11 +4811,11 @@ function resolveParentNode(block) {
|
|
|
4659
4811
|
if (block instanceof Node) {
|
|
4660
4812
|
return block.parentNode;
|
|
4661
4813
|
} else if (isArray(block)) {
|
|
4662
|
-
return resolveParentNode(block[
|
|
4814
|
+
return resolveParentNode(block[block.length - 1]);
|
|
4663
4815
|
} else if (isVaporComponent(block)) {
|
|
4664
4816
|
return resolveParentNode(block.block);
|
|
4665
4817
|
} else {
|
|
4666
|
-
return resolveParentNode(block.nodes);
|
|
4818
|
+
return resolveParentNode(block.anchor || block.nodes);
|
|
4667
4819
|
}
|
|
4668
4820
|
}
|
|
4669
4821
|
function setVars(instance, vars) {
|
|
@@ -4694,20 +4846,31 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
4694
4846
|
const renderFn = () => {
|
|
4695
4847
|
const value = getter();
|
|
4696
4848
|
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
4697
|
-
frag.update(
|
|
4698
|
-
()
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4849
|
+
frag.update(() => {
|
|
4850
|
+
if (isBlock(value)) return value;
|
|
4851
|
+
if (appContext.vapor && isVNode(value)) {
|
|
4852
|
+
if (isKeepAlive(currentInstance)) {
|
|
4853
|
+
const frag3 = currentInstance.ctx.getCachedComponent(value.type);
|
|
4854
|
+
if (frag3) return frag3;
|
|
4855
|
+
}
|
|
4856
|
+
const frag2 = appContext.vapor.vdomMountVNode(value, currentInstance);
|
|
4857
|
+
if (isHydrating) {
|
|
4858
|
+
frag2.hydrate();
|
|
4859
|
+
if (_isLastInsertion) {
|
|
4860
|
+
advanceHydrationNode(_insertionParent);
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
return frag2;
|
|
4864
|
+
}
|
|
4865
|
+
return createComponentWithFallback(
|
|
4866
|
+
resolveDynamicComponent(value),
|
|
4867
|
+
rawProps,
|
|
4868
|
+
rawSlots,
|
|
4869
|
+
isSingleRoot,
|
|
4870
|
+
once,
|
|
4871
|
+
appContext
|
|
4872
|
+
);
|
|
4873
|
+
}, value);
|
|
4711
4874
|
};
|
|
4712
4875
|
if (once) renderFn();
|
|
4713
4876
|
else renderEffect(renderFn);
|
|
@@ -4886,13 +5049,14 @@ const decorate = (t) => {
|
|
|
4886
5049
|
t.__vapor = true;
|
|
4887
5050
|
return t;
|
|
4888
5051
|
};
|
|
4889
|
-
const
|
|
5052
|
+
const VaporTransitionGroupImpl = {
|
|
4890
5053
|
name: "VaporTransitionGroup",
|
|
4891
5054
|
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
4892
5055
|
tag: String,
|
|
4893
5056
|
moveClass: String
|
|
4894
5057
|
}),
|
|
4895
5058
|
setup(props, { slots }) {
|
|
5059
|
+
ensureTransitionHooksRegistered();
|
|
4896
5060
|
const instance = currentInstance;
|
|
4897
5061
|
const state = useTransitionState();
|
|
4898
5062
|
let cssTransitionProps = resolveTransitionProps(props);
|
|
@@ -4984,7 +5148,8 @@ const VaporTransitionGroup = decorate({
|
|
|
4984
5148
|
return slottedBlock;
|
|
4985
5149
|
}
|
|
4986
5150
|
}
|
|
4987
|
-
}
|
|
5151
|
+
};
|
|
5152
|
+
const VaporTransitionGroup = /* @__PURE__ */ decorate(VaporTransitionGroupImpl);
|
|
4988
5153
|
function getTransitionBlocks(block) {
|
|
4989
5154
|
let children = [];
|
|
4990
5155
|
if (block instanceof Node) {
|