@vue/runtime-vapor 3.6.0-alpha.2 → 3.6.0-alpha.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 +153 -34
- package/dist/runtime-vapor.esm-bundler.js +2719 -568
- package/package.json +4 -4
|
@@ -1,247 +1,339 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-alpha.3
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, patchStyle, mergeProps, shouldSetAsProp, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue,
|
|
7
|
-
import { isArray,
|
|
8
|
-
import { setActiveSub, EffectScope,
|
|
9
|
-
|
|
10
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
11
|
-
// @__NO_SIDE_EFFECTS__
|
|
12
|
-
function createTextNode(value = "") {
|
|
13
|
-
return document.createTextNode(value);
|
|
14
|
-
}
|
|
15
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
16
|
-
// @__NO_SIDE_EFFECTS__
|
|
17
|
-
function createComment(data) {
|
|
18
|
-
return document.createComment(data);
|
|
19
|
-
}
|
|
20
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
21
|
-
// @__NO_SIDE_EFFECTS__
|
|
22
|
-
function child(node) {
|
|
23
|
-
return node.firstChild;
|
|
24
|
-
}
|
|
25
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
26
|
-
// @__NO_SIDE_EFFECTS__
|
|
27
|
-
function nthChild(node, i) {
|
|
28
|
-
return node.childNodes[i];
|
|
29
|
-
}
|
|
30
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
31
|
-
// @__NO_SIDE_EFFECTS__
|
|
32
|
-
function next(node) {
|
|
33
|
-
return node.nextSibling;
|
|
34
|
-
}
|
|
6
|
+
import { isMismatchAllowed, warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, TransitionPropsValidators, leaveCbKey, isAsyncWrapper, getComponentName, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, isKeepAlive, isRef, unsafeToTrustedHTML, patchStyle, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, onMounted, onUpdated, onBeforeUnmount, resetShapeFlag, watch, matches, devtoolsComponentAdded, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, isVNode, Fragment, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, markAsyncBoundary, useAsyncComponentState, performAsyncHydrate, handleError, createCanSetSetupRefChecker, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
|
|
7
|
+
import { invokeArrayFns, isArray, extend, EMPTY_OBJ, isFunction, NO, hasOwn, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, stringifyStyle, isReservedProp, EMPTY_ARR, camelize, YES, getGlobalThis, isObject, remove as remove$1, looseEqual } from '@vue/shared';
|
|
8
|
+
import { ReactiveEffect, setActiveSub, EffectScope, onEffectCleanup, pauseTracking, resetTracking, onScopeDispose as onScopeDispose$1, markRaw, unref, proxyRefs, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
|
|
35
9
|
|
|
36
10
|
let insertionParent;
|
|
37
11
|
let insertionAnchor;
|
|
38
|
-
|
|
12
|
+
let isLastInsertion;
|
|
13
|
+
function setInsertionState(parent, anchor, last) {
|
|
39
14
|
insertionParent = parent;
|
|
40
|
-
|
|
15
|
+
isLastInsertion = last;
|
|
16
|
+
if (anchor !== void 0) {
|
|
17
|
+
if (isHydrating) {
|
|
18
|
+
insertionAnchor = anchor;
|
|
19
|
+
} else {
|
|
20
|
+
insertionAnchor = typeof anchor === "number" && anchor > 0 ? null : anchor;
|
|
21
|
+
if (anchor === 0 && !parent.$fc) {
|
|
22
|
+
parent.$fc = parent.firstChild;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
insertionAnchor = void 0;
|
|
27
|
+
}
|
|
41
28
|
}
|
|
42
29
|
function resetInsertionState() {
|
|
43
|
-
insertionParent = insertionAnchor = void 0;
|
|
30
|
+
insertionParent = insertionAnchor = isLastInsertion = void 0;
|
|
44
31
|
}
|
|
45
32
|
|
|
33
|
+
const isHydratingStack = [];
|
|
46
34
|
let isHydrating = false;
|
|
47
35
|
let currentHydrationNode = null;
|
|
36
|
+
function pushIsHydrating(value) {
|
|
37
|
+
isHydratingStack.push(isHydrating = value);
|
|
38
|
+
}
|
|
39
|
+
function popIsHydrating() {
|
|
40
|
+
isHydratingStack.pop();
|
|
41
|
+
isHydrating = isHydratingStack[isHydratingStack.length - 1] || false;
|
|
42
|
+
}
|
|
43
|
+
function runWithoutHydration(fn) {
|
|
44
|
+
try {
|
|
45
|
+
pushIsHydrating(false);
|
|
46
|
+
return fn();
|
|
47
|
+
} finally {
|
|
48
|
+
popIsHydrating();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
48
51
|
let isOptimized$1 = false;
|
|
49
|
-
function
|
|
50
|
-
adoptTemplate = adoptTemplateImpl;
|
|
51
|
-
locateHydrationNode = locateHydrationNodeImpl;
|
|
52
|
+
function performHydration(fn, setup, cleanup) {
|
|
52
53
|
if (!isOptimized$1) {
|
|
53
|
-
|
|
54
|
+
adoptTemplate = adoptTemplateImpl;
|
|
55
|
+
locateHydrationNode = locateHydrationNodeImpl;
|
|
56
|
+
Comment.prototype.$fe = void 0;
|
|
57
|
+
Node.prototype.$pns = void 0;
|
|
58
|
+
Node.prototype.$idx = void 0;
|
|
59
|
+
Node.prototype.$llc = void 0;
|
|
60
|
+
Node.prototype.$lpn = void 0;
|
|
61
|
+
Node.prototype.$lan = void 0;
|
|
62
|
+
Node.prototype.$lin = void 0;
|
|
63
|
+
Node.prototype.$curIdx = void 0;
|
|
54
64
|
isOptimized$1 = true;
|
|
55
65
|
}
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
enableHydrationNodeLookup();
|
|
67
|
+
pushIsHydrating(true);
|
|
68
|
+
setup();
|
|
58
69
|
const res = fn();
|
|
59
|
-
|
|
70
|
+
cleanup();
|
|
60
71
|
currentHydrationNode = null;
|
|
61
|
-
|
|
72
|
+
popIsHydrating();
|
|
73
|
+
if (!isHydrating) disableHydrationNodeLookup();
|
|
62
74
|
return res;
|
|
63
75
|
}
|
|
76
|
+
function withHydration(container, fn) {
|
|
77
|
+
const setup = () => setInsertionState(container);
|
|
78
|
+
const cleanup = () => resetInsertionState();
|
|
79
|
+
return performHydration(fn, setup, cleanup);
|
|
80
|
+
}
|
|
81
|
+
function hydrateNode(node, fn) {
|
|
82
|
+
const setup = () => currentHydrationNode = node;
|
|
83
|
+
const cleanup = () => {
|
|
84
|
+
};
|
|
85
|
+
return performHydration(fn, setup, cleanup);
|
|
86
|
+
}
|
|
64
87
|
let adoptTemplate;
|
|
65
88
|
let locateHydrationNode;
|
|
66
89
|
const isComment = (node, data) => node.nodeType === 8 && node.data === data;
|
|
90
|
+
function setCurrentHydrationNode(node) {
|
|
91
|
+
currentHydrationNode = node;
|
|
92
|
+
}
|
|
93
|
+
function locateNextSiblingOfParent(n) {
|
|
94
|
+
if (!n.parentNode) return null;
|
|
95
|
+
return n.parentNode.nextSibling || locateNextSiblingOfParent(n.parentNode);
|
|
96
|
+
}
|
|
97
|
+
function advanceHydrationNode(node) {
|
|
98
|
+
const ret = node.nextSibling || // pns is short for "parent next sibling"
|
|
99
|
+
node.$pns || (node.$pns = locateNextSiblingOfParent(node));
|
|
100
|
+
if (ret) setCurrentHydrationNode(ret);
|
|
101
|
+
}
|
|
67
102
|
function adoptTemplateImpl(node, template) {
|
|
68
103
|
if (!(template[0] === "<" && template[1] === "!")) {
|
|
69
|
-
while (node.nodeType === 8)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
warn(`template: ${template}`);
|
|
76
|
-
warn("hydration mismatch!");
|
|
104
|
+
while (node.nodeType === 8) {
|
|
105
|
+
node = node.nextSibling;
|
|
106
|
+
if (template.trim() === "" && isComment(node, "]") && isComment(node.previousSibling, "[")) {
|
|
107
|
+
node.before(node = createTextNode());
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
77
110
|
}
|
|
78
111
|
}
|
|
79
|
-
|
|
112
|
+
const type = node.nodeType;
|
|
113
|
+
if (
|
|
114
|
+
// comment node
|
|
115
|
+
type === 8 && !template.startsWith("<!") || // element node
|
|
116
|
+
type === 1 && !template.startsWith(`<` + node.tagName.toLowerCase())
|
|
117
|
+
) {
|
|
118
|
+
node = handleMismatch(node, template);
|
|
119
|
+
}
|
|
120
|
+
currentHydrationNode = node.nextSibling;
|
|
80
121
|
return node;
|
|
81
122
|
}
|
|
123
|
+
function locateNextNode(node) {
|
|
124
|
+
return isComment(node, "[") ? _next(locateEndAnchor(node)) : isComment(node, "teleport start") ? _next(locateEndAnchor(node, "teleport start", "teleport end")) : _next(node);
|
|
125
|
+
}
|
|
82
126
|
function locateHydrationNodeImpl() {
|
|
83
127
|
let node;
|
|
84
|
-
if (insertionAnchor
|
|
85
|
-
|
|
128
|
+
if (insertionAnchor !== void 0) {
|
|
129
|
+
const { $lpn: lastPrepend, $lan: lastAppend, firstChild } = insertionParent;
|
|
130
|
+
if (insertionAnchor === 0) {
|
|
131
|
+
node = insertionParent.$lpn = lastPrepend ? locateNextNode(lastPrepend) : firstChild;
|
|
132
|
+
} else if (insertionAnchor instanceof Node) {
|
|
133
|
+
const { $lin: lastInsertedNode } = insertionAnchor;
|
|
134
|
+
node = insertionAnchor.$lin = lastInsertedNode ? locateNextNode(lastInsertedNode) : insertionAnchor;
|
|
135
|
+
} else {
|
|
136
|
+
node = insertionParent.$lan = lastAppend ? locateNextNode(lastAppend) : insertionAnchor === null ? firstChild : locateChildByLogicalIndex(insertionParent, insertionAnchor);
|
|
137
|
+
}
|
|
138
|
+
insertionParent.$llc = node;
|
|
139
|
+
node.$idx = insertionParent.$curIdx = insertionParent.$curIdx === void 0 ? 0 : insertionParent.$curIdx + 1;
|
|
86
140
|
} else {
|
|
87
|
-
node =
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
node = node.$fs;
|
|
91
|
-
} else {
|
|
92
|
-
let cur = node;
|
|
93
|
-
let curFragEnd = node;
|
|
94
|
-
let fragDepth = 0;
|
|
95
|
-
node = null;
|
|
96
|
-
while (cur) {
|
|
97
|
-
cur = cur.previousSibling;
|
|
98
|
-
if (cur) {
|
|
99
|
-
if (isComment(cur, "[")) {
|
|
100
|
-
curFragEnd.$fs = cur;
|
|
101
|
-
if (!fragDepth) {
|
|
102
|
-
node = cur;
|
|
103
|
-
break;
|
|
104
|
-
} else {
|
|
105
|
-
fragDepth--;
|
|
106
|
-
}
|
|
107
|
-
} else if (isComment(cur, "]")) {
|
|
108
|
-
curFragEnd = cur;
|
|
109
|
-
fragDepth++;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
141
|
+
node = currentHydrationNode;
|
|
142
|
+
if (insertionParent && (!node || node.parentNode !== insertionParent)) {
|
|
143
|
+
node = insertionParent.firstChild;
|
|
114
144
|
}
|
|
115
145
|
}
|
|
116
146
|
if (!!(process.env.NODE_ENV !== "production") && !node) {
|
|
117
|
-
|
|
147
|
+
throw new Error(
|
|
148
|
+
`No current hydration node was found.
|
|
149
|
+
this is likely a Vue internal bug.`
|
|
150
|
+
);
|
|
118
151
|
}
|
|
119
152
|
resetInsertionState();
|
|
120
153
|
currentHydrationNode = node;
|
|
121
154
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.nodes = nodes;
|
|
155
|
+
function locateEndAnchor(node, open = "[", close = "]") {
|
|
156
|
+
if (node.$fe) {
|
|
157
|
+
return node.$fe;
|
|
126
158
|
}
|
|
159
|
+
const stack = [node];
|
|
160
|
+
while ((node = node.nextSibling) && stack.length > 0) {
|
|
161
|
+
if (node.nodeType === 8) {
|
|
162
|
+
if (node.data === open) {
|
|
163
|
+
stack.push(node);
|
|
164
|
+
} else if (node.data === close) {
|
|
165
|
+
const matchingOpen = stack.pop();
|
|
166
|
+
matchingOpen.$fe = node;
|
|
167
|
+
if (stack.length === 0) return node;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
127
172
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
173
|
+
function locateFragmentEndAnchor(label = "]") {
|
|
174
|
+
let node = currentHydrationNode;
|
|
175
|
+
while (node) {
|
|
176
|
+
if (isComment(node, label)) return node;
|
|
177
|
+
node = node.nextSibling;
|
|
132
178
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
function handleMismatch(node, template) {
|
|
182
|
+
if (!isMismatchAllowed(node.parentElement, 1)) {
|
|
183
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
184
|
+
`Hydration node mismatch:
|
|
185
|
+
- rendered on server:`,
|
|
186
|
+
node,
|
|
187
|
+
node.nodeType === 3 ? `(text)` : isComment(node, "[[") ? `(start of block node)` : ``,
|
|
188
|
+
`
|
|
189
|
+
- expected on client:`,
|
|
190
|
+
template
|
|
191
|
+
);
|
|
192
|
+
logMismatchError();
|
|
193
|
+
}
|
|
194
|
+
if (isComment(node, "[")) {
|
|
195
|
+
removeFragmentNodes(node);
|
|
196
|
+
}
|
|
197
|
+
const next = _next(node);
|
|
198
|
+
const container = parentNode(node);
|
|
199
|
+
remove(node, container);
|
|
200
|
+
if (template[0] !== "<") {
|
|
201
|
+
return container.insertBefore(createTextNode(template), next);
|
|
202
|
+
}
|
|
203
|
+
const t = createElement("template");
|
|
204
|
+
t.innerHTML = template;
|
|
205
|
+
const newNode = _child(t.content).cloneNode(true);
|
|
206
|
+
newNode.innerHTML = node.innerHTML;
|
|
207
|
+
Array.from(node.attributes).forEach((attr) => {
|
|
208
|
+
newNode.setAttribute(attr.name, attr.value);
|
|
209
|
+
});
|
|
210
|
+
container.insertBefore(newNode, next);
|
|
211
|
+
return newNode;
|
|
212
|
+
}
|
|
213
|
+
let hasLoggedMismatchError = false;
|
|
214
|
+
const logMismatchError = () => {
|
|
215
|
+
if (hasLoggedMismatchError) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
console.error("Hydration completed but contains mismatches.");
|
|
219
|
+
hasLoggedMismatchError = true;
|
|
220
|
+
};
|
|
221
|
+
function removeFragmentNodes(node, endAnchor) {
|
|
222
|
+
const end = endAnchor || locateEndAnchor(node);
|
|
223
|
+
while (true) {
|
|
224
|
+
const next = _next(node);
|
|
225
|
+
if (next && next !== end) {
|
|
226
|
+
remove(next, parentNode(node));
|
|
148
227
|
} else {
|
|
149
|
-
|
|
150
|
-
this.nodes = [];
|
|
151
|
-
}
|
|
152
|
-
if (this.fallback && !isValidBlock(this.nodes)) {
|
|
153
|
-
parent && remove(this.nodes, parent);
|
|
154
|
-
this.nodes = (this.scope || (this.scope = new EffectScope())).run(this.fallback) || [];
|
|
155
|
-
parent && insert(this.nodes, parent, this.anchor);
|
|
228
|
+
break;
|
|
156
229
|
}
|
|
157
|
-
setActiveSub(prevSub);
|
|
158
230
|
}
|
|
159
231
|
}
|
|
160
|
-
|
|
161
|
-
|
|
232
|
+
|
|
233
|
+
// @__NO_SIDE_EFFECTS__
|
|
234
|
+
function createElement(tagName) {
|
|
235
|
+
return document.createElement(tagName);
|
|
162
236
|
}
|
|
163
|
-
|
|
164
|
-
|
|
237
|
+
// @__NO_SIDE_EFFECTS__
|
|
238
|
+
function createTextNode(value = "") {
|
|
239
|
+
return document.createTextNode(value);
|
|
165
240
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
} else if (isVaporComponent(block)) {
|
|
170
|
-
return isValidBlock(block.block);
|
|
171
|
-
} else if (isArray(block)) {
|
|
172
|
-
return block.length > 0 && block.every(isValidBlock);
|
|
173
|
-
} else {
|
|
174
|
-
return isValidBlock(block.nodes);
|
|
175
|
-
}
|
|
241
|
+
// @__NO_SIDE_EFFECTS__
|
|
242
|
+
function createComment(data) {
|
|
243
|
+
return document.createComment(data);
|
|
176
244
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
insert(b, parent, anchor);
|
|
192
|
-
}
|
|
193
|
-
} else {
|
|
194
|
-
if (block.insert) {
|
|
195
|
-
block.insert(parent, anchor);
|
|
196
|
-
} else {
|
|
197
|
-
insert(block.nodes, parent, anchor);
|
|
198
|
-
}
|
|
199
|
-
if (block.anchor) insert(block.anchor, parent, anchor);
|
|
245
|
+
// @__NO_SIDE_EFFECTS__
|
|
246
|
+
function querySelector(selectors) {
|
|
247
|
+
return document.querySelector(selectors);
|
|
248
|
+
}
|
|
249
|
+
/*! @__NO_SIDE_EFFECTS__ */
|
|
250
|
+
// @__NO_SIDE_EFFECTS__
|
|
251
|
+
function parentNode(node) {
|
|
252
|
+
return node.parentNode;
|
|
253
|
+
}
|
|
254
|
+
const _txt = _child;
|
|
255
|
+
const __txt = /* @__NO_SIDE_EFFECTS__ */ (node) => {
|
|
256
|
+
let n = node.firstChild;
|
|
257
|
+
if (!n) {
|
|
258
|
+
return node.appendChild(/* @__PURE__ */ createTextNode());
|
|
200
259
|
}
|
|
260
|
+
return n;
|
|
261
|
+
};
|
|
262
|
+
// @__NO_SIDE_EFFECTS__
|
|
263
|
+
function _child(node) {
|
|
264
|
+
return node.firstChild;
|
|
201
265
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
266
|
+
// @__NO_SIDE_EFFECTS__
|
|
267
|
+
function __child(node, logicalIndex = 0) {
|
|
268
|
+
return locateChildByLogicalIndex(node, logicalIndex);
|
|
205
269
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
270
|
+
// @__NO_SIDE_EFFECTS__
|
|
271
|
+
function _nthChild(node, i) {
|
|
272
|
+
return node.childNodes[i];
|
|
273
|
+
}
|
|
274
|
+
// @__NO_SIDE_EFFECTS__
|
|
275
|
+
function __nthChild(node, logicalIndex) {
|
|
276
|
+
return locateChildByLogicalIndex(node, logicalIndex);
|
|
277
|
+
}
|
|
278
|
+
// @__NO_SIDE_EFFECTS__
|
|
279
|
+
function _next(node) {
|
|
280
|
+
return node.nextSibling;
|
|
281
|
+
}
|
|
282
|
+
// @__NO_SIDE_EFFECTS__
|
|
283
|
+
function __next(node, logicalIndex) {
|
|
284
|
+
return locateChildByLogicalIndex(
|
|
285
|
+
node.parentNode,
|
|
286
|
+
logicalIndex
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
const txt = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
290
|
+
return txt.impl(...args);
|
|
291
|
+
};
|
|
292
|
+
txt.impl = _txt;
|
|
293
|
+
const child = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
294
|
+
return child.impl(...args);
|
|
295
|
+
};
|
|
296
|
+
child.impl = _child;
|
|
297
|
+
const next = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
298
|
+
return next.impl(...args);
|
|
299
|
+
};
|
|
300
|
+
next.impl = _next;
|
|
301
|
+
const nthChild = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
302
|
+
return nthChild.impl(...args);
|
|
303
|
+
};
|
|
304
|
+
nthChild.impl = _nthChild;
|
|
305
|
+
function enableHydrationNodeLookup() {
|
|
306
|
+
txt.impl = __txt;
|
|
307
|
+
child.impl = __child;
|
|
308
|
+
next.impl = __next;
|
|
309
|
+
nthChild.impl = __nthChild;
|
|
310
|
+
}
|
|
311
|
+
function disableHydrationNodeLookup() {
|
|
312
|
+
txt.impl = _txt;
|
|
313
|
+
child.impl = _child;
|
|
314
|
+
next.impl = _next;
|
|
315
|
+
nthChild.impl = _nthChild;
|
|
316
|
+
}
|
|
317
|
+
function locateChildByLogicalIndex(parent, logicalIndex) {
|
|
318
|
+
let child2 = parent.$llc || parent.firstChild;
|
|
319
|
+
let fromIndex = child2.$idx || 0;
|
|
320
|
+
while (child2) {
|
|
321
|
+
if (fromIndex === logicalIndex) {
|
|
322
|
+
child2.$idx = logicalIndex;
|
|
323
|
+
return parent.$llc = child2;
|
|
224
324
|
}
|
|
325
|
+
child2 = isComment(child2, "[") ? (
|
|
326
|
+
// fragment start: jump to the node after the matching end anchor
|
|
327
|
+
locateEndAnchor(child2).nextSibling
|
|
328
|
+
) : child2.nextSibling;
|
|
329
|
+
fromIndex++;
|
|
225
330
|
}
|
|
331
|
+
return null;
|
|
226
332
|
}
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
const nodes = [];
|
|
234
|
-
if (block instanceof Node) {
|
|
235
|
-
nodes.push(block);
|
|
236
|
-
} else if (isArray(block)) {
|
|
237
|
-
block.forEach((child) => nodes.push(...normalizeBlock(child)));
|
|
238
|
-
} else if (isVaporComponent(block)) {
|
|
239
|
-
nodes.push(...normalizeBlock(block.block));
|
|
240
|
-
} else {
|
|
241
|
-
nodes.push(...normalizeBlock(block.nodes));
|
|
242
|
-
block.anchor && nodes.push(block.anchor);
|
|
243
|
-
}
|
|
244
|
-
return nodes;
|
|
333
|
+
function updateLastLogicalChild(parent, child2) {
|
|
334
|
+
if (!isComment(child2, "]")) return;
|
|
335
|
+
child2.$idx = parent.$curIdx || 0;
|
|
336
|
+
parent.$llc = child2;
|
|
245
337
|
}
|
|
246
338
|
|
|
247
339
|
class RenderEffect extends ReactiveEffect {
|
|
@@ -265,6 +357,7 @@ class RenderEffect extends ReactiveEffect {
|
|
|
265
357
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
266
358
|
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
267
359
|
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
360
|
+
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
268
361
|
}
|
|
269
362
|
job.i = instance;
|
|
270
363
|
}
|
|
@@ -307,6 +400,592 @@ function renderEffect(fn, noLifecycle = false) {
|
|
|
307
400
|
effect.run();
|
|
308
401
|
}
|
|
309
402
|
|
|
403
|
+
const displayName = "VaporTransition";
|
|
404
|
+
const decorate$1 = (t) => {
|
|
405
|
+
t.displayName = displayName;
|
|
406
|
+
t.props = TransitionPropsValidators;
|
|
407
|
+
t.__vapor = true;
|
|
408
|
+
return t;
|
|
409
|
+
};
|
|
410
|
+
const VaporTransition = /* @__PURE__ */ decorate$1(
|
|
411
|
+
(props, { slots, attrs }) => {
|
|
412
|
+
let resetDisplay;
|
|
413
|
+
if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
|
|
414
|
+
const {
|
|
415
|
+
content: { firstChild },
|
|
416
|
+
parentNode
|
|
417
|
+
} = currentHydrationNode;
|
|
418
|
+
if (firstChild) {
|
|
419
|
+
if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
|
|
420
|
+
const originalDisplay = firstChild.style.display;
|
|
421
|
+
firstChild.style.display = "none";
|
|
422
|
+
resetDisplay = () => firstChild.style.display = originalDisplay;
|
|
423
|
+
}
|
|
424
|
+
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
425
|
+
setCurrentHydrationNode(firstChild);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const children = slots.default && slots.default();
|
|
429
|
+
if (!children) return;
|
|
430
|
+
const instance = currentInstance;
|
|
431
|
+
const { mode } = props;
|
|
432
|
+
checkTransitionMode(mode);
|
|
433
|
+
let resolvedProps;
|
|
434
|
+
let isMounted = false;
|
|
435
|
+
renderEffect(() => {
|
|
436
|
+
resolvedProps = resolveTransitionProps(props);
|
|
437
|
+
if (isMounted) {
|
|
438
|
+
if (isFragment(children)) {
|
|
439
|
+
children.$transition.props = resolvedProps;
|
|
440
|
+
} else {
|
|
441
|
+
const child = findTransitionBlock(children);
|
|
442
|
+
if (child) {
|
|
443
|
+
child.$transition.props = resolvedProps;
|
|
444
|
+
applyTransitionHooks(child, child.$transition, void 0, true);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
} else {
|
|
448
|
+
isMounted = true;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
let fallthroughAttrs = true;
|
|
452
|
+
if (instance.hasFallthrough) {
|
|
453
|
+
renderEffect(() => {
|
|
454
|
+
const resolvedAttrs = extend({}, attrs);
|
|
455
|
+
const child = findTransitionBlock(children);
|
|
456
|
+
if (child) {
|
|
457
|
+
child.$root = true;
|
|
458
|
+
applyFallthroughProps(child, resolvedAttrs);
|
|
459
|
+
fallthroughAttrs = false;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
const hooks = applyTransitionHooks(
|
|
464
|
+
children,
|
|
465
|
+
{
|
|
466
|
+
state: useTransitionState(),
|
|
467
|
+
props: resolvedProps,
|
|
468
|
+
instance
|
|
469
|
+
},
|
|
470
|
+
fallthroughAttrs
|
|
471
|
+
);
|
|
472
|
+
if (resetDisplay && resolvedProps.appear) {
|
|
473
|
+
const child = findTransitionBlock(children);
|
|
474
|
+
hooks.beforeEnter(child);
|
|
475
|
+
resetDisplay();
|
|
476
|
+
queuePostFlushCb(() => hooks.enter(child));
|
|
477
|
+
}
|
|
478
|
+
return children;
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
482
|
+
const { leavingNodes } = state;
|
|
483
|
+
const context = {
|
|
484
|
+
setLeavingNodeCache: (el) => {
|
|
485
|
+
leavingNodes.set(key, el);
|
|
486
|
+
},
|
|
487
|
+
unsetLeavingNodeCache: (el) => {
|
|
488
|
+
const leavingNode = leavingNodes.get(key);
|
|
489
|
+
if (leavingNode === el) {
|
|
490
|
+
leavingNodes.delete(key);
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
earlyRemove: () => {
|
|
494
|
+
const leavingNode = leavingNodes.get(key);
|
|
495
|
+
if (leavingNode && leavingNode[leaveCbKey]) {
|
|
496
|
+
leavingNode[leaveCbKey]();
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
cloneHooks: (block) => {
|
|
500
|
+
const hooks = resolveTransitionHooks(
|
|
501
|
+
block,
|
|
502
|
+
props,
|
|
503
|
+
state,
|
|
504
|
+
instance,
|
|
505
|
+
postClone
|
|
506
|
+
);
|
|
507
|
+
if (postClone) postClone(hooks);
|
|
508
|
+
return hooks;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
return context;
|
|
512
|
+
};
|
|
513
|
+
function resolveTransitionHooks(block, props, state, instance, postClone) {
|
|
514
|
+
const context = getTransitionHooksContext(
|
|
515
|
+
String(block.$key),
|
|
516
|
+
props,
|
|
517
|
+
state,
|
|
518
|
+
instance,
|
|
519
|
+
postClone
|
|
520
|
+
);
|
|
521
|
+
const hooks = baseResolveTransitionHooks(
|
|
522
|
+
context,
|
|
523
|
+
props,
|
|
524
|
+
state,
|
|
525
|
+
instance
|
|
526
|
+
);
|
|
527
|
+
hooks.state = state;
|
|
528
|
+
hooks.props = props;
|
|
529
|
+
hooks.instance = instance;
|
|
530
|
+
return hooks;
|
|
531
|
+
}
|
|
532
|
+
function applyTransitionHooks(block, hooks, fallthroughAttrs = true, isResolved = false) {
|
|
533
|
+
if (isArray(block)) {
|
|
534
|
+
block = block.filter((b) => !(b instanceof Comment));
|
|
535
|
+
if (block.length === 1) {
|
|
536
|
+
block = block[0];
|
|
537
|
+
} else if (block.length === 0) {
|
|
538
|
+
return hooks;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
const isFrag = isFragment(block);
|
|
542
|
+
const child = isResolved ? block : findTransitionBlock(block, isFrag);
|
|
543
|
+
if (!child) {
|
|
544
|
+
if (isFrag) setTransitionHooksOnFragment(block, hooks);
|
|
545
|
+
return hooks;
|
|
546
|
+
}
|
|
547
|
+
const { props, instance, state, delayedLeave } = hooks;
|
|
548
|
+
let resolvedHooks = resolveTransitionHooks(
|
|
549
|
+
child,
|
|
550
|
+
props,
|
|
551
|
+
state,
|
|
552
|
+
instance,
|
|
553
|
+
(hooks2) => resolvedHooks = hooks2
|
|
554
|
+
);
|
|
555
|
+
resolvedHooks.delayedLeave = delayedLeave;
|
|
556
|
+
child.$transition = resolvedHooks;
|
|
557
|
+
if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
|
|
558
|
+
if (fallthroughAttrs && instance.hasFallthrough) {
|
|
559
|
+
child.$root = true;
|
|
560
|
+
applyFallthroughProps(child, instance.attrs);
|
|
561
|
+
}
|
|
562
|
+
return resolvedHooks;
|
|
563
|
+
}
|
|
564
|
+
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
565
|
+
const leavingBlock = findTransitionBlock(block);
|
|
566
|
+
if (!leavingBlock) return void 0;
|
|
567
|
+
const { props, state, instance } = enterHooks;
|
|
568
|
+
const leavingHooks = resolveTransitionHooks(
|
|
569
|
+
leavingBlock,
|
|
570
|
+
props,
|
|
571
|
+
state,
|
|
572
|
+
instance
|
|
573
|
+
);
|
|
574
|
+
leavingBlock.$transition = leavingHooks;
|
|
575
|
+
const { mode } = props;
|
|
576
|
+
if (mode === "out-in") {
|
|
577
|
+
state.isLeaving = true;
|
|
578
|
+
leavingHooks.afterLeave = () => {
|
|
579
|
+
state.isLeaving = false;
|
|
580
|
+
afterLeaveCb();
|
|
581
|
+
leavingBlock.$transition = void 0;
|
|
582
|
+
delete leavingHooks.afterLeave;
|
|
583
|
+
};
|
|
584
|
+
} else if (mode === "in-out") {
|
|
585
|
+
leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
|
|
586
|
+
state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
|
|
587
|
+
block2[leaveCbKey] = () => {
|
|
588
|
+
earlyRemove();
|
|
589
|
+
block2[leaveCbKey] = void 0;
|
|
590
|
+
leavingBlock.$transition = void 0;
|
|
591
|
+
delete enterHooks.delayedLeave;
|
|
592
|
+
};
|
|
593
|
+
enterHooks.delayedLeave = () => {
|
|
594
|
+
delayedLeave();
|
|
595
|
+
leavingBlock.$transition = void 0;
|
|
596
|
+
delete enterHooks.delayedLeave;
|
|
597
|
+
};
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function findTransitionBlock(block, inFragment = false) {
|
|
602
|
+
let child;
|
|
603
|
+
if (block instanceof Node) {
|
|
604
|
+
if (block instanceof Element) child = block;
|
|
605
|
+
} else if (isVaporComponent(block)) {
|
|
606
|
+
if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
|
|
607
|
+
child = block;
|
|
608
|
+
} else {
|
|
609
|
+
if (getComponentName(block.type) === displayName) return void 0;
|
|
610
|
+
child = findTransitionBlock(block.block, inFragment);
|
|
611
|
+
if (child && child.$key === void 0) child.$key = block.uid;
|
|
612
|
+
}
|
|
613
|
+
} else if (isArray(block)) {
|
|
614
|
+
let hasFound = false;
|
|
615
|
+
for (const c of block) {
|
|
616
|
+
if (c instanceof Comment) continue;
|
|
617
|
+
if (isFragment(c)) inFragment = true;
|
|
618
|
+
const item = findTransitionBlock(c, inFragment);
|
|
619
|
+
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
620
|
+
warn(
|
|
621
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
622
|
+
);
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
child = item;
|
|
626
|
+
hasFound = true;
|
|
627
|
+
if (!!!(process.env.NODE_ENV !== "production")) break;
|
|
628
|
+
}
|
|
629
|
+
} else if (isFragment(block)) {
|
|
630
|
+
inFragment = true;
|
|
631
|
+
if (block.insert) {
|
|
632
|
+
child = block;
|
|
633
|
+
} else {
|
|
634
|
+
child = findTransitionBlock(block.nodes, true);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
|
|
638
|
+
warn("Transition component has no valid child element");
|
|
639
|
+
}
|
|
640
|
+
return child;
|
|
641
|
+
}
|
|
642
|
+
function setTransitionHooksOnFragment(block, hooks) {
|
|
643
|
+
if (isFragment(block)) {
|
|
644
|
+
block.$transition = hooks;
|
|
645
|
+
} else if (isArray(block)) {
|
|
646
|
+
for (let i = 0; i < block.length; i++) {
|
|
647
|
+
setTransitionHooksOnFragment(block[i], hooks);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
function setTransitionHooks(block, hooks) {
|
|
652
|
+
if (isVaporComponent(block)) {
|
|
653
|
+
block = findTransitionBlock(block.block);
|
|
654
|
+
if (!block) return;
|
|
655
|
+
}
|
|
656
|
+
block.$transition = hooks;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
class VaporFragment {
|
|
660
|
+
constructor(nodes) {
|
|
661
|
+
this.vnode = null;
|
|
662
|
+
this.nodes = nodes;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
class ForFragment extends VaporFragment {
|
|
666
|
+
constructor(nodes) {
|
|
667
|
+
super(nodes);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
class DynamicFragment extends VaporFragment {
|
|
671
|
+
constructor(anchorLabel) {
|
|
672
|
+
super([]);
|
|
673
|
+
this.hydrate = (isEmpty = false) => {
|
|
674
|
+
if (this.anchor) return;
|
|
675
|
+
if (this.anchorLabel === "if") {
|
|
676
|
+
if (isEmpty) {
|
|
677
|
+
this.anchor = locateFragmentEndAnchor("");
|
|
678
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
679
|
+
throw new Error(
|
|
680
|
+
"Failed to locate if anchor. this is likely a Vue internal bug."
|
|
681
|
+
);
|
|
682
|
+
} else {
|
|
683
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
684
|
+
this.anchor.data = this.anchorLabel;
|
|
685
|
+
}
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
} else if (this.anchorLabel === "slot") {
|
|
690
|
+
if (isEmpty && isComment(currentHydrationNode, "")) {
|
|
691
|
+
this.anchor = currentHydrationNode;
|
|
692
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
693
|
+
this.anchor.data = this.anchorLabel;
|
|
694
|
+
}
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
this.anchor = locateFragmentEndAnchor();
|
|
698
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
699
|
+
throw new Error(
|
|
700
|
+
"Failed to locate slot anchor. this is likely a Vue internal bug."
|
|
701
|
+
);
|
|
702
|
+
} else {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
const { parentNode, nextNode } = findBlockNode(this.nodes);
|
|
707
|
+
queuePostFlushCb(() => {
|
|
708
|
+
parentNode.insertBefore(
|
|
709
|
+
this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
|
|
710
|
+
nextNode
|
|
711
|
+
);
|
|
712
|
+
});
|
|
713
|
+
};
|
|
714
|
+
if (isHydrating) {
|
|
715
|
+
this.anchorLabel = anchorLabel;
|
|
716
|
+
locateHydrationNode();
|
|
717
|
+
} else {
|
|
718
|
+
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? createComment(anchorLabel) : createTextNode();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
update(render, key = render) {
|
|
722
|
+
if (key === this.current) {
|
|
723
|
+
if (isHydrating) this.hydrate(true);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
this.current = key;
|
|
727
|
+
const prevSub = setActiveSub();
|
|
728
|
+
const parent = isHydrating ? null : this.anchor.parentNode;
|
|
729
|
+
const transition = this.$transition;
|
|
730
|
+
const instance = currentInstance;
|
|
731
|
+
this.inKeepAlive = isKeepAlive(instance);
|
|
732
|
+
if (this.scope) {
|
|
733
|
+
if (this.inKeepAlive) {
|
|
734
|
+
instance.processFragment(this);
|
|
735
|
+
if (!this.keptAliveScopes) this.keptAliveScopes = /* @__PURE__ */ new Map();
|
|
736
|
+
this.keptAliveScopes.set(this.current, this.scope);
|
|
737
|
+
} else {
|
|
738
|
+
this.scope.stop();
|
|
739
|
+
}
|
|
740
|
+
const mode = transition && transition.mode;
|
|
741
|
+
if (mode) {
|
|
742
|
+
applyTransitionLeaveHooks(
|
|
743
|
+
this.nodes,
|
|
744
|
+
transition,
|
|
745
|
+
() => this.render(render, instance, transition, parent)
|
|
746
|
+
);
|
|
747
|
+
parent && remove(this.nodes, parent);
|
|
748
|
+
if (mode === "out-in") {
|
|
749
|
+
setActiveSub(prevSub);
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
} else {
|
|
753
|
+
parent && remove(this.nodes, parent);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
this.render(render, instance, transition, parent);
|
|
757
|
+
if (this.fallback) {
|
|
758
|
+
const hasNestedFragment = isFragment(this.nodes);
|
|
759
|
+
if (hasNestedFragment) {
|
|
760
|
+
setFragmentFallback(this.nodes, this.fallback);
|
|
761
|
+
}
|
|
762
|
+
const invalidFragment = findInvalidFragment(this);
|
|
763
|
+
if (invalidFragment) {
|
|
764
|
+
parent && remove(this.nodes, parent);
|
|
765
|
+
const scope = this.scope || (this.scope = new EffectScope());
|
|
766
|
+
scope.run(() => {
|
|
767
|
+
if (hasNestedFragment) {
|
|
768
|
+
renderFragmentFallback(invalidFragment);
|
|
769
|
+
} else {
|
|
770
|
+
this.nodes = this.fallback() || [];
|
|
771
|
+
}
|
|
772
|
+
});
|
|
773
|
+
parent && insert(this.nodes, parent, this.anchor);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
setActiveSub(prevSub);
|
|
777
|
+
if (isHydrating) this.hydrate();
|
|
778
|
+
}
|
|
779
|
+
render(render, instance, transition, parent) {
|
|
780
|
+
if (render) {
|
|
781
|
+
const scope = this.inKeepAlive && this.keptAliveScopes ? this.keptAliveScopes.get(this.current) : void 0;
|
|
782
|
+
if (scope) {
|
|
783
|
+
this.scope = scope;
|
|
784
|
+
this.keptAliveScopes.delete(this.current);
|
|
785
|
+
this.scope.resume();
|
|
786
|
+
} else {
|
|
787
|
+
this.scope = new EffectScope();
|
|
788
|
+
}
|
|
789
|
+
this.nodes = this.scope.run(render) || [];
|
|
790
|
+
if (this.inKeepAlive) {
|
|
791
|
+
instance.cacheFragment(this);
|
|
792
|
+
}
|
|
793
|
+
if (transition) {
|
|
794
|
+
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
795
|
+
}
|
|
796
|
+
if (parent) insert(this.nodes, parent, this.anchor);
|
|
797
|
+
} else {
|
|
798
|
+
this.scope = void 0;
|
|
799
|
+
this.nodes = [];
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
function setFragmentFallback(fragment, fallback) {
|
|
804
|
+
if (fragment.fallback) {
|
|
805
|
+
const originalFallback = fragment.fallback;
|
|
806
|
+
fragment.fallback = () => {
|
|
807
|
+
const fallbackNodes = originalFallback();
|
|
808
|
+
if (isValidBlock(fallbackNodes)) {
|
|
809
|
+
return fallbackNodes;
|
|
810
|
+
}
|
|
811
|
+
return fallback();
|
|
812
|
+
};
|
|
813
|
+
} else {
|
|
814
|
+
fragment.fallback = fallback;
|
|
815
|
+
}
|
|
816
|
+
if (isFragment(fragment.nodes)) {
|
|
817
|
+
setFragmentFallback(fragment.nodes, fragment.fallback);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function renderFragmentFallback(fragment) {
|
|
821
|
+
if (fragment instanceof ForFragment) {
|
|
822
|
+
fragment.nodes[0] = [fragment.fallback() || []];
|
|
823
|
+
} else if (fragment instanceof DynamicFragment) {
|
|
824
|
+
fragment.update(fragment.fallback);
|
|
825
|
+
} else ;
|
|
826
|
+
}
|
|
827
|
+
function findInvalidFragment(fragment) {
|
|
828
|
+
if (isValidBlock(fragment.nodes)) return null;
|
|
829
|
+
return isFragment(fragment.nodes) ? findInvalidFragment(fragment.nodes) || fragment : fragment;
|
|
830
|
+
}
|
|
831
|
+
function isFragment(val) {
|
|
832
|
+
return val instanceof VaporFragment;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
let currentSlotScopeIds = null;
|
|
836
|
+
function setCurrentSlotScopeIds(scopeIds) {
|
|
837
|
+
const prev = currentSlotScopeIds;
|
|
838
|
+
currentSlotScopeIds = scopeIds;
|
|
839
|
+
return prev;
|
|
840
|
+
}
|
|
841
|
+
const dynamicSlotsProxyHandlers = {
|
|
842
|
+
get: getSlot,
|
|
843
|
+
has: (target, key) => !!getSlot(target, key),
|
|
844
|
+
getOwnPropertyDescriptor(target, key) {
|
|
845
|
+
const slot = getSlot(target, key);
|
|
846
|
+
if (slot) {
|
|
847
|
+
return {
|
|
848
|
+
configurable: true,
|
|
849
|
+
enumerable: true,
|
|
850
|
+
value: slot
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
ownKeys(target) {
|
|
855
|
+
let keys = Object.keys(target);
|
|
856
|
+
const dynamicSources = target.$;
|
|
857
|
+
if (dynamicSources) {
|
|
858
|
+
keys = keys.filter((k) => k !== "$");
|
|
859
|
+
for (const source of dynamicSources) {
|
|
860
|
+
if (isFunction(source)) {
|
|
861
|
+
const slot = source();
|
|
862
|
+
if (isArray(slot)) {
|
|
863
|
+
for (const s of slot) keys.push(String(s.name));
|
|
864
|
+
} else {
|
|
865
|
+
keys.push(String(slot.name));
|
|
866
|
+
}
|
|
867
|
+
} else {
|
|
868
|
+
keys.push(...Object.keys(source));
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return keys;
|
|
873
|
+
},
|
|
874
|
+
set: NO,
|
|
875
|
+
deleteProperty: NO
|
|
876
|
+
};
|
|
877
|
+
function getSlot(target, key) {
|
|
878
|
+
if (key === "$") return;
|
|
879
|
+
const dynamicSources = target.$;
|
|
880
|
+
if (dynamicSources) {
|
|
881
|
+
let i = dynamicSources.length;
|
|
882
|
+
let source;
|
|
883
|
+
while (i--) {
|
|
884
|
+
source = dynamicSources[i];
|
|
885
|
+
if (isFunction(source)) {
|
|
886
|
+
const slot = source();
|
|
887
|
+
if (slot) {
|
|
888
|
+
if (isArray(slot)) {
|
|
889
|
+
for (const s of slot) {
|
|
890
|
+
if (String(s.name) === key) return s.fn;
|
|
891
|
+
}
|
|
892
|
+
} else if (String(slot.name) === key) {
|
|
893
|
+
return slot.fn;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
} else if (hasOwn(source, key)) {
|
|
897
|
+
return source[key];
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (hasOwn(target, key)) {
|
|
902
|
+
return target[key];
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
function withVaporCtx(fn) {
|
|
906
|
+
const instance = currentInstance;
|
|
907
|
+
return (...args) => {
|
|
908
|
+
const prev = setCurrentInstance(instance);
|
|
909
|
+
try {
|
|
910
|
+
return fn(...args);
|
|
911
|
+
} finally {
|
|
912
|
+
setCurrentInstance(...prev);
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function createSlot(name, rawProps, fallback, noSlotted) {
|
|
917
|
+
const _insertionParent = insertionParent;
|
|
918
|
+
const _insertionAnchor = insertionAnchor;
|
|
919
|
+
const _isLastInsertion = isLastInsertion;
|
|
920
|
+
if (!isHydrating) resetInsertionState();
|
|
921
|
+
const instance = currentInstance;
|
|
922
|
+
const rawSlots = instance.rawSlots;
|
|
923
|
+
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
924
|
+
let fragment;
|
|
925
|
+
if (isRef(rawSlots._)) {
|
|
926
|
+
if (isHydrating) locateHydrationNode();
|
|
927
|
+
fragment = instance.appContext.vapor.vdomSlot(
|
|
928
|
+
rawSlots._,
|
|
929
|
+
name,
|
|
930
|
+
slotProps,
|
|
931
|
+
instance,
|
|
932
|
+
fallback
|
|
933
|
+
);
|
|
934
|
+
} else {
|
|
935
|
+
fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
|
|
936
|
+
const isDynamicName = isFunction(name);
|
|
937
|
+
const slotScopeIds = [];
|
|
938
|
+
if (!noSlotted) {
|
|
939
|
+
const scopeId = instance.type.__scopeId;
|
|
940
|
+
if (scopeId) {
|
|
941
|
+
slotScopeIds.push(`${scopeId}-s`);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
const renderSlot = () => {
|
|
945
|
+
const slot = getSlot(rawSlots, isFunction(name) ? name() : name);
|
|
946
|
+
if (slot) {
|
|
947
|
+
fragment.fallback = fallback;
|
|
948
|
+
fragment.update(
|
|
949
|
+
slot._bound || (slot._bound = () => {
|
|
950
|
+
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
951
|
+
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
952
|
+
);
|
|
953
|
+
try {
|
|
954
|
+
return slot(slotProps);
|
|
955
|
+
} finally {
|
|
956
|
+
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
957
|
+
}
|
|
958
|
+
})
|
|
959
|
+
);
|
|
960
|
+
} else {
|
|
961
|
+
fragment.update(fallback);
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
if (isDynamicName || rawSlots.$) {
|
|
965
|
+
renderEffect(renderSlot);
|
|
966
|
+
} else {
|
|
967
|
+
renderSlot();
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
if (!isHydrating) {
|
|
971
|
+
if (!noSlotted) {
|
|
972
|
+
const scopeId = instance.type.__scopeId;
|
|
973
|
+
if (scopeId) {
|
|
974
|
+
setScopeId(fragment, [`${scopeId}-s`]);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
978
|
+
} else {
|
|
979
|
+
if (fragment.insert) {
|
|
980
|
+
fragment.hydrate();
|
|
981
|
+
}
|
|
982
|
+
if (_isLastInsertion) {
|
|
983
|
+
advanceHydrationNode(_insertionParent);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return fragment;
|
|
987
|
+
}
|
|
988
|
+
|
|
310
989
|
function addEventListener(el, event, handler, options) {
|
|
311
990
|
el.addEventListener(event, handler, options);
|
|
312
991
|
return () => el.removeEventListener(event, handler, options);
|
|
@@ -396,6 +1075,10 @@ function setAttr(el, key, value) {
|
|
|
396
1075
|
} else if (key === "false-value") {
|
|
397
1076
|
el._falseValue = value;
|
|
398
1077
|
}
|
|
1078
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value)) {
|
|
1079
|
+
el[`$${key}`] = value;
|
|
1080
|
+
return;
|
|
1081
|
+
}
|
|
399
1082
|
if (value !== el[`$${key}`]) {
|
|
400
1083
|
el[`$${key}`] = value;
|
|
401
1084
|
if (value != null) {
|
|
@@ -405,10 +1088,13 @@ function setAttr(el, key, value) {
|
|
|
405
1088
|
}
|
|
406
1089
|
}
|
|
407
1090
|
}
|
|
408
|
-
function setDOMProp(el, key, value) {
|
|
1091
|
+
function setDOMProp(el, key, value, forceHydrate = false) {
|
|
409
1092
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
410
1093
|
return;
|
|
411
1094
|
}
|
|
1095
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value) && !shouldForceHydrate(el, key) && !forceHydrate) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
412
1098
|
const prev = el[key];
|
|
413
1099
|
if (value === prev) {
|
|
414
1100
|
return;
|
|
@@ -416,7 +1102,9 @@ function setDOMProp(el, key, value) {
|
|
|
416
1102
|
let needRemove = false;
|
|
417
1103
|
if (value === "" || value == null) {
|
|
418
1104
|
const type = typeof prev;
|
|
419
|
-
if (
|
|
1105
|
+
if (type === "boolean") {
|
|
1106
|
+
value = includeBooleanAttr(value);
|
|
1107
|
+
} else if (value == null && type === "string") {
|
|
420
1108
|
value = "";
|
|
421
1109
|
needRemove = true;
|
|
422
1110
|
} else if (type === "number") {
|
|
@@ -439,14 +1127,26 @@ function setDOMProp(el, key, value) {
|
|
|
439
1127
|
function setClass(el, value) {
|
|
440
1128
|
if (el.$root) {
|
|
441
1129
|
setClassIncremental(el, value);
|
|
442
|
-
} else
|
|
443
|
-
|
|
1130
|
+
} else {
|
|
1131
|
+
value = normalizeClass(value);
|
|
1132
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, value, false)) {
|
|
1133
|
+
el.$cls = value;
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (value !== el.$cls) {
|
|
1137
|
+
el.className = el.$cls = value;
|
|
1138
|
+
}
|
|
444
1139
|
}
|
|
445
1140
|
}
|
|
446
1141
|
function setClassIncremental(el, value) {
|
|
447
1142
|
const cacheKey = `$clsi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1143
|
+
const normalizedValue = normalizeClass(value);
|
|
1144
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, normalizedValue, true)) {
|
|
1145
|
+
el[cacheKey] = normalizedValue;
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
448
1148
|
const prev = el[cacheKey];
|
|
449
|
-
if ((value = el[cacheKey] =
|
|
1149
|
+
if ((value = el[cacheKey] = normalizedValue) !== prev) {
|
|
450
1150
|
const nextList = value.split(/\s+/);
|
|
451
1151
|
if (value) {
|
|
452
1152
|
el.classList.add(...nextList);
|
|
@@ -462,23 +1162,31 @@ function setStyle(el, value) {
|
|
|
462
1162
|
if (el.$root) {
|
|
463
1163
|
setStyleIncremental(el, value);
|
|
464
1164
|
} else {
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
1165
|
+
const normalizedValue = normalizeStyle(value);
|
|
1166
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !styleHasMismatch(el, value, normalizedValue, false)) {
|
|
1167
|
+
el.$sty = normalizedValue;
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
468
1171
|
}
|
|
469
1172
|
}
|
|
470
1173
|
function setStyleIncremental(el, value) {
|
|
471
1174
|
const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
1175
|
+
const normalizedValue = isString(value) ? parseStringStyle(value) : normalizeStyle(value);
|
|
1176
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !styleHasMismatch(el, value, normalizedValue, true)) {
|
|
1177
|
+
el[cacheKey] = normalizedValue;
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
476
1181
|
}
|
|
477
|
-
function setValue(el, value) {
|
|
1182
|
+
function setValue(el, value, forceHydrate = false) {
|
|
478
1183
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
479
1184
|
return;
|
|
480
1185
|
}
|
|
481
1186
|
el._value = value;
|
|
1187
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, "value", getClientText(el, value)) && !shouldForceHydrate(el, "value") && !forceHydrate) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
482
1190
|
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
483
1191
|
const newValue = value == null ? "" : value;
|
|
484
1192
|
if (oldValue !== newValue) {
|
|
@@ -489,21 +1197,105 @@ function setValue(el, value) {
|
|
|
489
1197
|
}
|
|
490
1198
|
}
|
|
491
1199
|
function setText(el, value) {
|
|
1200
|
+
if (isHydrating) {
|
|
1201
|
+
const clientText = getClientText(el.parentNode, value);
|
|
1202
|
+
if (el.nodeValue == clientText) {
|
|
1203
|
+
el.$txt = clientText;
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1207
|
+
`Hydration text mismatch in`,
|
|
1208
|
+
el.parentNode,
|
|
1209
|
+
`
|
|
1210
|
+
- rendered on server: ${JSON.stringify(el.data)}
|
|
1211
|
+
- expected on client: ${JSON.stringify(value)}`
|
|
1212
|
+
);
|
|
1213
|
+
logMismatchError();
|
|
1214
|
+
}
|
|
492
1215
|
if (el.$txt !== value) {
|
|
493
1216
|
el.nodeValue = el.$txt = value;
|
|
494
1217
|
}
|
|
495
1218
|
}
|
|
496
1219
|
function setElementText(el, value) {
|
|
497
|
-
|
|
1220
|
+
value = toDisplayString(value);
|
|
1221
|
+
if (isHydrating) {
|
|
1222
|
+
let clientText = getClientText(el, value);
|
|
1223
|
+
if (el.textContent === clientText) {
|
|
1224
|
+
el.$txt = clientText;
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
if (!isMismatchAllowed(el, 0)) {
|
|
1228
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1229
|
+
`Hydration text content mismatch on`,
|
|
1230
|
+
el,
|
|
1231
|
+
`
|
|
1232
|
+
- rendered on server: ${el.textContent}
|
|
1233
|
+
- expected on client: ${clientText}`
|
|
1234
|
+
);
|
|
1235
|
+
logMismatchError();
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
if (el.$txt !== value) {
|
|
498
1239
|
el.textContent = el.$txt = value;
|
|
499
1240
|
}
|
|
500
1241
|
}
|
|
501
|
-
function
|
|
1242
|
+
function setBlockText(block, value) {
|
|
502
1243
|
value = value == null ? "" : value;
|
|
1244
|
+
if (block.$txt !== value) {
|
|
1245
|
+
setTextToBlock(block, block.$txt = value);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
function warnCannotSetProp(prop) {
|
|
1249
|
+
warn(
|
|
1250
|
+
`Extraneous non-props attributes (${prop}) were passed to component but could not be automatically inherited because component renders text or multiple root nodes.`
|
|
1251
|
+
);
|
|
1252
|
+
}
|
|
1253
|
+
function setTextToBlock(block, value) {
|
|
1254
|
+
if (block instanceof Node) {
|
|
1255
|
+
if (block instanceof Element) {
|
|
1256
|
+
block.textContent = value;
|
|
1257
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1258
|
+
warnCannotSetProp("textContent");
|
|
1259
|
+
}
|
|
1260
|
+
} else if (isVaporComponent(block)) {
|
|
1261
|
+
setTextToBlock(block.block, value);
|
|
1262
|
+
} else if (isArray(block)) {
|
|
1263
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1264
|
+
warnCannotSetProp("textContent");
|
|
1265
|
+
}
|
|
1266
|
+
} else {
|
|
1267
|
+
setTextToBlock(block.nodes, value);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
function setHtml(el, value) {
|
|
1271
|
+
value = value == null ? "" : unsafeToTrustedHTML(value);
|
|
503
1272
|
if (el.$html !== value) {
|
|
504
1273
|
el.innerHTML = el.$html = value;
|
|
505
1274
|
}
|
|
506
1275
|
}
|
|
1276
|
+
function setBlockHtml(block, value) {
|
|
1277
|
+
value = value == null ? "" : unsafeToTrustedHTML(value);
|
|
1278
|
+
if (block.$html !== value) {
|
|
1279
|
+
setHtmlToBlock(block, block.$html = value);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
function setHtmlToBlock(block, value) {
|
|
1283
|
+
if (block instanceof Node) {
|
|
1284
|
+
if (block instanceof Element) {
|
|
1285
|
+
block.innerHTML = value;
|
|
1286
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1287
|
+
warnCannotSetProp("innerHTML");
|
|
1288
|
+
}
|
|
1289
|
+
} else if (isVaporComponent(block)) {
|
|
1290
|
+
setHtmlToBlock(block.block, value);
|
|
1291
|
+
} else if (isArray(block)) {
|
|
1292
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1293
|
+
warnCannotSetProp("innerHTML");
|
|
1294
|
+
}
|
|
1295
|
+
} else {
|
|
1296
|
+
setHtmlToBlock(block.nodes, value);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
507
1299
|
function setDynamicProps(el, args) {
|
|
508
1300
|
const props = args.length > 1 ? mergeProps(...args) : args[0];
|
|
509
1301
|
const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
|
|
@@ -521,21 +1313,25 @@ function setDynamicProps(el, args) {
|
|
|
521
1313
|
}
|
|
522
1314
|
function setDynamicProp(el, key, value) {
|
|
523
1315
|
const isSVG = false;
|
|
1316
|
+
let forceHydrate = false;
|
|
524
1317
|
if (key === "class") {
|
|
525
1318
|
setClass(el, value);
|
|
526
1319
|
} else if (key === "style") {
|
|
527
1320
|
setStyle(el, value);
|
|
528
1321
|
} else if (isOn(key)) {
|
|
529
1322
|
on(el, key[2].toLowerCase() + key.slice(3), value, { effect: true });
|
|
530
|
-
} else if (
|
|
1323
|
+
} else if (
|
|
1324
|
+
// force hydrate v-bind with .prop modifiers
|
|
1325
|
+
(forceHydrate = key[0] === ".") ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, value, isSVG)
|
|
1326
|
+
) {
|
|
531
1327
|
if (key === "innerHTML") {
|
|
532
1328
|
setHtml(el, value);
|
|
533
1329
|
} else if (key === "textContent") {
|
|
534
1330
|
setElementText(el, value);
|
|
535
1331
|
} else if (key === "value" && canSetValueDirectly(el.tagName)) {
|
|
536
|
-
setValue(el, value);
|
|
1332
|
+
setValue(el, value, forceHydrate);
|
|
537
1333
|
} else {
|
|
538
|
-
setDOMProp(el, key, value);
|
|
1334
|
+
setDOMProp(el, key, value, forceHydrate);
|
|
539
1335
|
}
|
|
540
1336
|
} else {
|
|
541
1337
|
setAttr(el, key, value);
|
|
@@ -547,19 +1343,352 @@ function optimizePropertyLookup() {
|
|
|
547
1343
|
if (isOptimized) return;
|
|
548
1344
|
isOptimized = true;
|
|
549
1345
|
const proto = Element.prototype;
|
|
550
|
-
proto.$
|
|
1346
|
+
proto.$transition = void 0;
|
|
1347
|
+
proto.$key = void 0;
|
|
1348
|
+
proto.$fc = proto.$evtclick = void 0;
|
|
551
1349
|
proto.$root = false;
|
|
552
1350
|
proto.$html = proto.$txt = proto.$cls = proto.$sty = Text.prototype.$txt = "";
|
|
553
1351
|
}
|
|
1352
|
+
function classHasMismatch(el, expected, isIncremental) {
|
|
1353
|
+
const actual = el.getAttribute("class");
|
|
1354
|
+
const actualClassSet = toClassSet(actual || "");
|
|
1355
|
+
const expectedClassSet = toClassSet(expected);
|
|
1356
|
+
let hasMismatch = false;
|
|
1357
|
+
if (isIncremental) {
|
|
1358
|
+
if (expected) {
|
|
1359
|
+
hasMismatch = Array.from(expectedClassSet).some(
|
|
1360
|
+
(cls) => !actualClassSet.has(cls)
|
|
1361
|
+
);
|
|
1362
|
+
}
|
|
1363
|
+
} else {
|
|
1364
|
+
hasMismatch = !isSetEqual(actualClassSet, expectedClassSet);
|
|
1365
|
+
}
|
|
1366
|
+
if (hasMismatch) {
|
|
1367
|
+
warnPropMismatch(el, "class", 2, actual, expected);
|
|
1368
|
+
logMismatchError();
|
|
1369
|
+
return true;
|
|
1370
|
+
}
|
|
1371
|
+
return false;
|
|
1372
|
+
}
|
|
1373
|
+
function styleHasMismatch(el, value, normalizedValue, isIncremental) {
|
|
1374
|
+
const actual = el.getAttribute("style");
|
|
1375
|
+
const actualStyleMap = toStyleMap(actual || "");
|
|
1376
|
+
const expected = isString(value) ? value : stringifyStyle(normalizedValue);
|
|
1377
|
+
const expectedStyleMap = toStyleMap(expected);
|
|
1378
|
+
if (el[vShowHidden]) {
|
|
1379
|
+
expectedStyleMap.set("display", "none");
|
|
1380
|
+
}
|
|
1381
|
+
let hasMismatch = false;
|
|
1382
|
+
if (isIncremental) {
|
|
1383
|
+
if (expected) {
|
|
1384
|
+
hasMismatch = Array.from(expectedStyleMap.entries()).some(
|
|
1385
|
+
([key, val]) => actualStyleMap.get(key) !== val
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
} else {
|
|
1389
|
+
hasMismatch = !isMapEqual(actualStyleMap, expectedStyleMap);
|
|
1390
|
+
}
|
|
1391
|
+
if (hasMismatch) {
|
|
1392
|
+
warnPropMismatch(el, "style", 3, actual, expected);
|
|
1393
|
+
logMismatchError();
|
|
1394
|
+
return true;
|
|
1395
|
+
}
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
function attributeHasMismatch(el, key, value) {
|
|
1399
|
+
if (isValidHtmlOrSvgAttribute(el, key)) {
|
|
1400
|
+
const { actual, expected } = getAttributeMismatch(el, key, value);
|
|
1401
|
+
if (actual !== expected) {
|
|
1402
|
+
warnPropMismatch(el, key, 4, actual, expected);
|
|
1403
|
+
logMismatchError();
|
|
1404
|
+
return true;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
return false;
|
|
1408
|
+
}
|
|
1409
|
+
function getClientText(el, value) {
|
|
1410
|
+
if (value[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
|
|
1411
|
+
value = value.slice(1);
|
|
1412
|
+
}
|
|
1413
|
+
return value;
|
|
1414
|
+
}
|
|
1415
|
+
function shouldForceHydrate(el, key) {
|
|
1416
|
+
const { tagName } = el;
|
|
1417
|
+
return (tagName === "INPUT" || tagName === "OPTION") && (key.endsWith("value") || key === "indeterminate") || // force hydrate custom element dynamic props
|
|
1418
|
+
tagName.includes("-");
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
1422
|
+
// @__NO_SIDE_EFFECTS__
|
|
1423
|
+
function defineVaporComponent(comp, extraOptions) {
|
|
1424
|
+
if (isFunction(comp)) {
|
|
1425
|
+
return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
|
|
1426
|
+
setup: comp,
|
|
1427
|
+
__vapor: true
|
|
1428
|
+
}))();
|
|
1429
|
+
}
|
|
1430
|
+
comp.__vapor = true;
|
|
1431
|
+
return comp;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
const VaporKeepAliveImpl = defineVaporComponent({
|
|
1435
|
+
name: "VaporKeepAlive",
|
|
1436
|
+
__isKeepAlive: true,
|
|
1437
|
+
props: {
|
|
1438
|
+
include: [String, RegExp, Array],
|
|
1439
|
+
exclude: [String, RegExp, Array],
|
|
1440
|
+
max: [String, Number]
|
|
1441
|
+
},
|
|
1442
|
+
setup(props, { slots }) {
|
|
1443
|
+
if (!slots.default) {
|
|
1444
|
+
return void 0;
|
|
1445
|
+
}
|
|
1446
|
+
const keepAliveInstance = currentInstance;
|
|
1447
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1448
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1449
|
+
const storageContainer = createElement("div");
|
|
1450
|
+
let current;
|
|
1451
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1452
|
+
keepAliveInstance.__v_cache = cache;
|
|
1453
|
+
}
|
|
1454
|
+
function shouldCache(instance) {
|
|
1455
|
+
if (isAsyncWrapper(instance) && !instance.type.__asyncResolved) {
|
|
1456
|
+
return false;
|
|
1457
|
+
}
|
|
1458
|
+
const { include, exclude } = props;
|
|
1459
|
+
const name = getComponentName(
|
|
1460
|
+
isAsyncWrapper(instance) ? instance.type.__asyncResolved : instance.type
|
|
1461
|
+
);
|
|
1462
|
+
return !(include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name));
|
|
1463
|
+
}
|
|
1464
|
+
function innerCacheBlock(key, instance) {
|
|
1465
|
+
const { max } = props;
|
|
1466
|
+
if (cache.has(key)) {
|
|
1467
|
+
keys.delete(key);
|
|
1468
|
+
keys.add(key);
|
|
1469
|
+
} else {
|
|
1470
|
+
keys.add(key);
|
|
1471
|
+
if (max && keys.size > parseInt(max, 10)) {
|
|
1472
|
+
pruneCacheEntry(keys.values().next().value);
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
cache.set(key, instance);
|
|
1476
|
+
current = instance;
|
|
1477
|
+
}
|
|
1478
|
+
function cacheBlock() {
|
|
1479
|
+
const block = keepAliveInstance.block;
|
|
1480
|
+
const innerBlock = getInnerBlock(block);
|
|
1481
|
+
if (!innerBlock || !shouldCache(innerBlock)) return;
|
|
1482
|
+
let toCache;
|
|
1483
|
+
let key;
|
|
1484
|
+
let frag;
|
|
1485
|
+
if (isFragment(block) && (frag = findInteropFragment(block))) {
|
|
1486
|
+
toCache = frag;
|
|
1487
|
+
key = frag.vnode.type;
|
|
1488
|
+
} else {
|
|
1489
|
+
toCache = innerBlock;
|
|
1490
|
+
key = innerBlock.type;
|
|
1491
|
+
}
|
|
1492
|
+
innerCacheBlock(key, toCache);
|
|
1493
|
+
}
|
|
1494
|
+
onMounted(cacheBlock);
|
|
1495
|
+
onUpdated(cacheBlock);
|
|
1496
|
+
onBeforeUnmount(() => {
|
|
1497
|
+
cache.forEach((cached, key) => {
|
|
1498
|
+
const instance = getInstanceFromCache(cached);
|
|
1499
|
+
if (!instance) return;
|
|
1500
|
+
resetCachedShapeFlag(cached);
|
|
1501
|
+
cache.delete(key);
|
|
1502
|
+
if (current) {
|
|
1503
|
+
const currentKey = isVaporComponent(current) ? current.type : current.vnode.type;
|
|
1504
|
+
if (currentKey === key) {
|
|
1505
|
+
const da = instance.da;
|
|
1506
|
+
da && queuePostFlushCb(da);
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
remove(cached, storageContainer);
|
|
1511
|
+
});
|
|
1512
|
+
});
|
|
1513
|
+
keepAliveInstance.getStorageContainer = () => storageContainer;
|
|
1514
|
+
keepAliveInstance.getCachedComponent = (comp) => {
|
|
1515
|
+
return cache.get(comp);
|
|
1516
|
+
};
|
|
1517
|
+
keepAliveInstance.cacheComponent = (instance) => {
|
|
1518
|
+
if (!shouldCache(instance)) return;
|
|
1519
|
+
instance.shapeFlag |= 256;
|
|
1520
|
+
innerCacheBlock(instance.type, instance);
|
|
1521
|
+
};
|
|
1522
|
+
keepAliveInstance.processFragment = (frag) => {
|
|
1523
|
+
const innerBlock = getInnerBlock(frag.nodes);
|
|
1524
|
+
if (!innerBlock) return;
|
|
1525
|
+
const fragment = findInteropFragment(frag.nodes);
|
|
1526
|
+
if (fragment) {
|
|
1527
|
+
if (cache.has(fragment.vnode.type)) {
|
|
1528
|
+
fragment.vnode.shapeFlag |= 512;
|
|
1529
|
+
}
|
|
1530
|
+
if (shouldCache(innerBlock)) {
|
|
1531
|
+
fragment.vnode.shapeFlag |= 256;
|
|
1532
|
+
}
|
|
1533
|
+
} else {
|
|
1534
|
+
if (cache.has(innerBlock.type)) {
|
|
1535
|
+
innerBlock.shapeFlag |= 512;
|
|
1536
|
+
}
|
|
1537
|
+
if (shouldCache(innerBlock)) {
|
|
1538
|
+
innerBlock.shapeFlag |= 256;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
keepAliveInstance.cacheFragment = (fragment) => {
|
|
1543
|
+
const innerBlock = getInnerBlock(fragment.nodes);
|
|
1544
|
+
if (!innerBlock || !shouldCache(innerBlock)) return;
|
|
1545
|
+
let toCache;
|
|
1546
|
+
let key;
|
|
1547
|
+
const frag = findInteropFragment(fragment);
|
|
1548
|
+
if (frag) {
|
|
1549
|
+
frag.vnode.shapeFlag |= 256;
|
|
1550
|
+
toCache = frag;
|
|
1551
|
+
key = frag.vnode.type;
|
|
1552
|
+
} else {
|
|
1553
|
+
innerBlock.shapeFlag |= 256;
|
|
1554
|
+
toCache = innerBlock;
|
|
1555
|
+
key = innerBlock.type;
|
|
1556
|
+
}
|
|
1557
|
+
innerCacheBlock(key, toCache);
|
|
1558
|
+
};
|
|
1559
|
+
keepAliveInstance.activate = (instance, parentNode, anchor) => {
|
|
1560
|
+
current = instance;
|
|
1561
|
+
activate(instance, parentNode, anchor);
|
|
1562
|
+
};
|
|
1563
|
+
keepAliveInstance.deactivate = (instance) => {
|
|
1564
|
+
current = void 0;
|
|
1565
|
+
deactivate(instance, storageContainer);
|
|
1566
|
+
};
|
|
1567
|
+
function resetCachedShapeFlag(cached) {
|
|
1568
|
+
if (isVaporComponent(cached)) {
|
|
1569
|
+
resetShapeFlag(cached);
|
|
1570
|
+
} else {
|
|
1571
|
+
resetShapeFlag(cached.vnode);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
let children = slots.default();
|
|
1575
|
+
if (isArray(children) && children.length > 1) {
|
|
1576
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1577
|
+
warn(`KeepAlive should contain exactly one component child.`);
|
|
1578
|
+
}
|
|
1579
|
+
return children;
|
|
1580
|
+
}
|
|
1581
|
+
if (isVaporComponent(children)) {
|
|
1582
|
+
children.shapeFlag |= 256;
|
|
1583
|
+
} else if (isInteropFragment(children)) {
|
|
1584
|
+
children.vnode.shapeFlag |= 256;
|
|
1585
|
+
}
|
|
1586
|
+
function pruneCache(filter) {
|
|
1587
|
+
cache.forEach((cached, key) => {
|
|
1588
|
+
const instance = getInstanceFromCache(cached);
|
|
1589
|
+
if (!instance) return;
|
|
1590
|
+
const name = getComponentName(instance.type);
|
|
1591
|
+
if (name && !filter(name)) {
|
|
1592
|
+
pruneCacheEntry(key);
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
function pruneCacheEntry(key) {
|
|
1597
|
+
const cached = cache.get(key);
|
|
1598
|
+
resetCachedShapeFlag(cached);
|
|
1599
|
+
if (cached !== current) {
|
|
1600
|
+
remove(cached);
|
|
1601
|
+
}
|
|
1602
|
+
cache.delete(key);
|
|
1603
|
+
keys.delete(key);
|
|
1604
|
+
}
|
|
1605
|
+
watch(
|
|
1606
|
+
() => [props.include, props.exclude],
|
|
1607
|
+
([include, exclude]) => {
|
|
1608
|
+
include && pruneCache((name) => matches(include, name));
|
|
1609
|
+
exclude && pruneCache((name) => !matches(exclude, name));
|
|
1610
|
+
},
|
|
1611
|
+
// prune post-render after `current` has been updated
|
|
1612
|
+
{ flush: "post", deep: true }
|
|
1613
|
+
);
|
|
1614
|
+
return children;
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
function getInnerBlock(block) {
|
|
1618
|
+
if (isVaporComponent(block)) {
|
|
1619
|
+
return block;
|
|
1620
|
+
} else if (isInteropFragment(block)) {
|
|
1621
|
+
return block.vnode;
|
|
1622
|
+
} else if (isFragment(block)) {
|
|
1623
|
+
return getInnerBlock(block.nodes);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
function isInteropFragment(block) {
|
|
1627
|
+
return !!(isFragment(block) && block.vnode);
|
|
1628
|
+
}
|
|
1629
|
+
function findInteropFragment(block) {
|
|
1630
|
+
if (isInteropFragment(block)) {
|
|
1631
|
+
return block;
|
|
1632
|
+
}
|
|
1633
|
+
if (isFragment(block)) {
|
|
1634
|
+
return findInteropFragment(block.nodes);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
function getInstanceFromCache(cached) {
|
|
1638
|
+
if (isVaporComponent(cached)) {
|
|
1639
|
+
return cached;
|
|
1640
|
+
}
|
|
1641
|
+
return cached.vnode.component;
|
|
1642
|
+
}
|
|
1643
|
+
function activate(instance, parentNode, anchor) {
|
|
1644
|
+
insert(instance.block, parentNode, anchor);
|
|
1645
|
+
queuePostFlushCb(() => {
|
|
1646
|
+
instance.isDeactivated = false;
|
|
1647
|
+
if (instance.a) invokeArrayFns(instance.a);
|
|
1648
|
+
});
|
|
1649
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1650
|
+
devtoolsComponentAdded(instance);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
function deactivate(instance, container) {
|
|
1654
|
+
insert(instance.block, container);
|
|
1655
|
+
queuePostFlushCb(() => {
|
|
1656
|
+
if (instance.da) invokeArrayFns(instance.da);
|
|
1657
|
+
instance.isDeactivated = true;
|
|
1658
|
+
});
|
|
1659
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1660
|
+
devtoolsComponentAdded(instance);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
function findParentKeepAlive(instance) {
|
|
1664
|
+
let parent = instance;
|
|
1665
|
+
while (parent) {
|
|
1666
|
+
if (isKeepAlive(parent)) {
|
|
1667
|
+
return parent;
|
|
1668
|
+
}
|
|
1669
|
+
parent = parent.parent;
|
|
1670
|
+
}
|
|
1671
|
+
return null;
|
|
1672
|
+
}
|
|
554
1673
|
|
|
555
1674
|
const interopKey = Symbol(`interop`);
|
|
556
1675
|
const vaporInteropImpl = {
|
|
557
1676
|
mount(vnode, container, anchor, parentComponent) {
|
|
558
|
-
|
|
559
|
-
|
|
1677
|
+
let selfAnchor = vnode.el = vnode.anchor = createTextNode();
|
|
1678
|
+
if (isHydrating) {
|
|
1679
|
+
queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
1680
|
+
} else {
|
|
1681
|
+
container.insertBefore(selfAnchor, anchor);
|
|
1682
|
+
}
|
|
560
1683
|
const prev = currentInstance;
|
|
561
1684
|
simpleSetCurrentInstance(parentComponent);
|
|
562
|
-
const
|
|
1685
|
+
const props = {};
|
|
1686
|
+
for (const key in vnode.props) {
|
|
1687
|
+
if (!isReservedProp(key)) {
|
|
1688
|
+
props[key] = vnode.props[key];
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
const propsRef = shallowRef(props);
|
|
563
1692
|
const slotsRef = shallowRef(vnode.children);
|
|
564
1693
|
const dynamicPropSource = [
|
|
565
1694
|
() => propsRef.value
|
|
@@ -573,10 +1702,20 @@ const vaporInteropImpl = {
|
|
|
573
1702
|
{
|
|
574
1703
|
_: slotsRef
|
|
575
1704
|
// pass the slots ref
|
|
576
|
-
}
|
|
1705
|
+
},
|
|
1706
|
+
void 0,
|
|
1707
|
+
void 0,
|
|
1708
|
+
parentComponent ? parentComponent.appContext : vnode.appContext
|
|
577
1709
|
);
|
|
578
1710
|
instance.rawPropsRef = propsRef;
|
|
579
1711
|
instance.rawSlotsRef = slotsRef;
|
|
1712
|
+
if (isKeepAlive(parentComponent)) instance.shapeFlag = vnode.shapeFlag;
|
|
1713
|
+
if (vnode.transition) {
|
|
1714
|
+
setTransitionHooks(
|
|
1715
|
+
instance,
|
|
1716
|
+
vnode.transition
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
580
1719
|
mountComponent(instance, container, selfAnchor);
|
|
581
1720
|
simpleSetCurrentInstance(prev);
|
|
582
1721
|
return instance;
|
|
@@ -604,11 +1743,16 @@ const vaporInteropImpl = {
|
|
|
604
1743
|
*/
|
|
605
1744
|
slot(n1, n2, container, anchor) {
|
|
606
1745
|
if (!n1) {
|
|
607
|
-
|
|
608
|
-
insert(selfAnchor, container, anchor);
|
|
1746
|
+
let selfAnchor;
|
|
609
1747
|
const { slot, fallback } = n2.vs;
|
|
610
1748
|
const propsRef = n2.vs.ref = shallowRef(n2.props);
|
|
611
1749
|
const slotBlock = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
|
|
1750
|
+
if (fallback && isFragment(slotBlock)) {
|
|
1751
|
+
setFragmentFallback(slotBlock, createFallback(fallback));
|
|
1752
|
+
selfAnchor = slotBlock.anchor;
|
|
1753
|
+
}
|
|
1754
|
+
if (!selfAnchor) selfAnchor = createTextNode();
|
|
1755
|
+
insert(n2.el = n2.anchor = selfAnchor, container, anchor);
|
|
612
1756
|
insert(n2.vb = slotBlock, container, selfAnchor);
|
|
613
1757
|
} else {
|
|
614
1758
|
n2.el = n2.anchor = n1.anchor;
|
|
@@ -619,6 +1763,44 @@ const vaporInteropImpl = {
|
|
|
619
1763
|
move(vnode, container, anchor) {
|
|
620
1764
|
insert(vnode.vb || vnode.component, container, anchor);
|
|
621
1765
|
insert(vnode.anchor, container, anchor);
|
|
1766
|
+
},
|
|
1767
|
+
hydrate(vnode, node, container, anchor, parentComponent) {
|
|
1768
|
+
hydrateNode(
|
|
1769
|
+
node,
|
|
1770
|
+
() => this.mount(vnode, container, anchor, parentComponent)
|
|
1771
|
+
);
|
|
1772
|
+
return _next(node);
|
|
1773
|
+
},
|
|
1774
|
+
hydrateSlot(vnode, node) {
|
|
1775
|
+
const { slot } = vnode.vs;
|
|
1776
|
+
const propsRef = vnode.vs.ref = shallowRef(vnode.props);
|
|
1777
|
+
hydrateNode(node, () => {
|
|
1778
|
+
vnode.vb = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
|
|
1779
|
+
vnode.anchor = vnode.el = currentHydrationNode;
|
|
1780
|
+
if (!!(process.env.NODE_ENV !== "production") && !vnode.anchor) {
|
|
1781
|
+
throw new Error(
|
|
1782
|
+
`Failed to locate slot anchor. this is likely a Vue internal bug.`
|
|
1783
|
+
);
|
|
1784
|
+
}
|
|
1785
|
+
});
|
|
1786
|
+
return _next(vnode.anchor);
|
|
1787
|
+
},
|
|
1788
|
+
setTransitionHooks(component, hooks) {
|
|
1789
|
+
setTransitionHooks(component, hooks);
|
|
1790
|
+
},
|
|
1791
|
+
activate(vnode, container, anchor, parentComponent) {
|
|
1792
|
+
const cached = parentComponent.ctx.getCachedComponent(
|
|
1793
|
+
vnode
|
|
1794
|
+
);
|
|
1795
|
+
vnode.el = cached.el;
|
|
1796
|
+
vnode.component = cached.component;
|
|
1797
|
+
vnode.anchor = cached.anchor;
|
|
1798
|
+
activate(vnode.component, container, anchor);
|
|
1799
|
+
insert(vnode.anchor, container, anchor);
|
|
1800
|
+
},
|
|
1801
|
+
deactivate(vnode, container) {
|
|
1802
|
+
deactivate(vnode.component, container);
|
|
1803
|
+
insert(vnode.anchor, container);
|
|
622
1804
|
}
|
|
623
1805
|
};
|
|
624
1806
|
const vaporSlotPropsProxyHandler = {
|
|
@@ -641,11 +1823,13 @@ const vaporSlotsProxyHandler = {
|
|
|
641
1823
|
return slot;
|
|
642
1824
|
}
|
|
643
1825
|
};
|
|
1826
|
+
let vdomHydrateNode;
|
|
644
1827
|
function createVDOMComponent(internals, component, rawProps, rawSlots) {
|
|
1828
|
+
const parentInstance = currentInstance;
|
|
645
1829
|
const frag = new VaporFragment([]);
|
|
646
|
-
const vnode = createVNode(
|
|
1830
|
+
const vnode = frag.vnode = createVNode(
|
|
647
1831
|
component,
|
|
648
|
-
rawProps && new Proxy(rawProps, rawPropsProxyHandlers)
|
|
1832
|
+
rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers))
|
|
649
1833
|
);
|
|
650
1834
|
const wrapper = new VaporComponentInstance(
|
|
651
1835
|
{ props: component.props },
|
|
@@ -662,35 +1846,85 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
|
|
|
662
1846
|
}
|
|
663
1847
|
instance.slots = wrapper.slots === EMPTY_OBJ ? EMPTY_OBJ : new Proxy(wrapper.slots, vaporSlotsProxyHandler);
|
|
664
1848
|
};
|
|
1849
|
+
let rawRef = null;
|
|
665
1850
|
let isMounted = false;
|
|
666
|
-
const
|
|
667
|
-
|
|
1851
|
+
const unmount = (parentNode, transition) => {
|
|
1852
|
+
if (rawRef) setRef$1(rawRef, null, null, vnode, true);
|
|
1853
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1854
|
+
if (vnode.shapeFlag & 256) {
|
|
1855
|
+
deactivate$1(
|
|
1856
|
+
vnode,
|
|
1857
|
+
findParentKeepAlive(parentInstance).getStorageContainer(),
|
|
1858
|
+
internals,
|
|
1859
|
+
parentInstance,
|
|
1860
|
+
null
|
|
1861
|
+
);
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
668
1864
|
internals.umt(vnode.component, null, !!parentNode);
|
|
669
1865
|
};
|
|
670
|
-
frag.
|
|
671
|
-
|
|
672
|
-
|
|
1866
|
+
frag.hydrate = () => {
|
|
1867
|
+
hydrateVNode(vnode, parentInstance);
|
|
1868
|
+
onScopeDispose(unmount, true);
|
|
1869
|
+
isMounted = true;
|
|
1870
|
+
frag.nodes = vnode.el;
|
|
1871
|
+
};
|
|
1872
|
+
vnode.scopeId = parentInstance && parentInstance.type.__scopeId;
|
|
1873
|
+
vnode.slotScopeIds = currentSlotScopeIds;
|
|
1874
|
+
frag.insert = (parentNode, anchor, transition) => {
|
|
1875
|
+
if (isHydrating) return;
|
|
1876
|
+
if (vnode.shapeFlag & 512) {
|
|
1877
|
+
activate$1(
|
|
673
1878
|
vnode,
|
|
674
1879
|
parentNode,
|
|
675
1880
|
anchor,
|
|
1881
|
+
internals,
|
|
676
1882
|
parentInstance,
|
|
677
1883
|
null,
|
|
678
1884
|
void 0,
|
|
679
1885
|
false
|
|
680
1886
|
);
|
|
681
|
-
onScopeDispose(unmount, true);
|
|
682
|
-
isMounted = true;
|
|
683
1887
|
} else {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
1888
|
+
const prev = currentInstance;
|
|
1889
|
+
simpleSetCurrentInstance(parentInstance);
|
|
1890
|
+
if (!isMounted) {
|
|
1891
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1892
|
+
internals.mt(
|
|
1893
|
+
vnode,
|
|
1894
|
+
parentNode,
|
|
1895
|
+
anchor,
|
|
1896
|
+
parentInstance,
|
|
1897
|
+
null,
|
|
1898
|
+
void 0,
|
|
1899
|
+
false
|
|
1900
|
+
);
|
|
1901
|
+
if (rawRef) setRef$1(rawRef, null, null, vnode);
|
|
1902
|
+
onScopeDispose(unmount, true);
|
|
1903
|
+
isMounted = true;
|
|
1904
|
+
} else {
|
|
1905
|
+
internals.m(
|
|
1906
|
+
vnode,
|
|
1907
|
+
parentNode,
|
|
1908
|
+
anchor,
|
|
1909
|
+
2,
|
|
1910
|
+
parentInstance
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
simpleSetCurrentInstance(prev);
|
|
691
1914
|
}
|
|
1915
|
+
frag.nodes = vnode.el;
|
|
692
1916
|
};
|
|
693
1917
|
frag.remove = unmount;
|
|
1918
|
+
frag.setRef = (instance, ref, refFor, refKey) => {
|
|
1919
|
+
rawRef = normalizeRef(
|
|
1920
|
+
{
|
|
1921
|
+
ref,
|
|
1922
|
+
ref_for: refFor,
|
|
1923
|
+
ref_key: refKey
|
|
1924
|
+
},
|
|
1925
|
+
instance
|
|
1926
|
+
);
|
|
1927
|
+
};
|
|
694
1928
|
return frag;
|
|
695
1929
|
}
|
|
696
1930
|
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
@@ -698,37 +1932,11 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
698
1932
|
let isMounted = false;
|
|
699
1933
|
let fallbackNodes;
|
|
700
1934
|
let oldVNode = null;
|
|
1935
|
+
frag.fallback = fallback;
|
|
701
1936
|
frag.insert = (parentNode, anchor) => {
|
|
1937
|
+
if (isHydrating) return;
|
|
702
1938
|
if (!isMounted) {
|
|
703
|
-
|
|
704
|
-
const vnode = renderSlot(
|
|
705
|
-
slotsRef.value,
|
|
706
|
-
isFunction(name) ? name() : name,
|
|
707
|
-
props
|
|
708
|
-
);
|
|
709
|
-
if (vnode.children.length) {
|
|
710
|
-
if (fallbackNodes) {
|
|
711
|
-
remove(fallbackNodes, parentNode);
|
|
712
|
-
fallbackNodes = void 0;
|
|
713
|
-
}
|
|
714
|
-
internals.p(
|
|
715
|
-
oldVNode,
|
|
716
|
-
vnode,
|
|
717
|
-
parentNode,
|
|
718
|
-
anchor,
|
|
719
|
-
parentComponent
|
|
720
|
-
);
|
|
721
|
-
oldVNode = vnode;
|
|
722
|
-
} else {
|
|
723
|
-
if (fallback && !fallbackNodes) {
|
|
724
|
-
if (oldVNode) {
|
|
725
|
-
internals.um(oldVNode, parentComponent, null, true);
|
|
726
|
-
}
|
|
727
|
-
insert(fallbackNodes = fallback(props), parentNode, anchor);
|
|
728
|
-
}
|
|
729
|
-
oldVNode = null;
|
|
730
|
-
}
|
|
731
|
-
});
|
|
1939
|
+
render(parentNode, anchor);
|
|
732
1940
|
isMounted = true;
|
|
733
1941
|
} else {
|
|
734
1942
|
internals.m(
|
|
@@ -745,7 +1953,74 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
745
1953
|
} else if (oldVNode) {
|
|
746
1954
|
internals.um(oldVNode, parentComponent, null);
|
|
747
1955
|
}
|
|
748
|
-
};
|
|
1956
|
+
};
|
|
1957
|
+
};
|
|
1958
|
+
const render = (parentNode, anchor) => {
|
|
1959
|
+
renderEffect(() => {
|
|
1960
|
+
let vnode;
|
|
1961
|
+
let isValidSlot = false;
|
|
1962
|
+
if (slotsRef.value) {
|
|
1963
|
+
vnode = renderSlot(
|
|
1964
|
+
slotsRef.value,
|
|
1965
|
+
isFunction(name) ? name() : name,
|
|
1966
|
+
props
|
|
1967
|
+
);
|
|
1968
|
+
let children = vnode.children;
|
|
1969
|
+
ensureVaporSlotFallback(children, fallback);
|
|
1970
|
+
isValidSlot = children.length > 0;
|
|
1971
|
+
}
|
|
1972
|
+
if (isValidSlot) {
|
|
1973
|
+
if (isHydrating) {
|
|
1974
|
+
if (isVNode(vnode)) {
|
|
1975
|
+
hydrateVNode(vnode, parentComponent);
|
|
1976
|
+
oldVNode = vnode;
|
|
1977
|
+
frag.nodes = vnode.el;
|
|
1978
|
+
}
|
|
1979
|
+
} else {
|
|
1980
|
+
if (fallbackNodes) {
|
|
1981
|
+
remove(fallbackNodes, parentNode);
|
|
1982
|
+
fallbackNodes = void 0;
|
|
1983
|
+
}
|
|
1984
|
+
internals.p(
|
|
1985
|
+
oldVNode,
|
|
1986
|
+
vnode,
|
|
1987
|
+
parentNode,
|
|
1988
|
+
anchor,
|
|
1989
|
+
parentComponent,
|
|
1990
|
+
null,
|
|
1991
|
+
// parentSuspense
|
|
1992
|
+
void 0,
|
|
1993
|
+
// namespace
|
|
1994
|
+
vnode.slotScopeIds
|
|
1995
|
+
// pass slotScopeIds for :slotted styles
|
|
1996
|
+
);
|
|
1997
|
+
oldVNode = vnode;
|
|
1998
|
+
frag.nodes = vnode.el;
|
|
1999
|
+
}
|
|
2000
|
+
} else {
|
|
2001
|
+
fallback = frag.fallback;
|
|
2002
|
+
if (fallback && !fallbackNodes) {
|
|
2003
|
+
fallbackNodes = fallback(internals, parentComponent);
|
|
2004
|
+
if (isHydrating) {
|
|
2005
|
+
if (isVNode(fallbackNodes)) {
|
|
2006
|
+
hydrateVNode(fallbackNodes, parentComponent);
|
|
2007
|
+
frag.nodes = fallbackNodes.el;
|
|
2008
|
+
}
|
|
2009
|
+
} else {
|
|
2010
|
+
if (oldVNode) {
|
|
2011
|
+
internals.um(oldVNode, parentComponent, null, true);
|
|
2012
|
+
}
|
|
2013
|
+
insert(fallbackNodes, parentNode, anchor);
|
|
2014
|
+
frag.nodes = fallbackNodes;
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
oldVNode = null;
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
};
|
|
2021
|
+
frag.hydrate = () => {
|
|
2022
|
+
render();
|
|
2023
|
+
isMounted = true;
|
|
749
2024
|
};
|
|
750
2025
|
return frag;
|
|
751
2026
|
}
|
|
@@ -757,10 +2032,49 @@ const vaporInteropPlugin = (app) => {
|
|
|
757
2032
|
vdomSlot: renderVDOMSlot.bind(null, internals)
|
|
758
2033
|
});
|
|
759
2034
|
const mount = app.mount;
|
|
760
|
-
app.mount = (...args) => {
|
|
2035
|
+
app.mount = ((...args) => {
|
|
761
2036
|
optimizePropertyLookup();
|
|
762
2037
|
return mount(...args);
|
|
763
|
-
};
|
|
2038
|
+
});
|
|
2039
|
+
};
|
|
2040
|
+
function hydrateVNode(vnode, parentComponent) {
|
|
2041
|
+
locateHydrationNode();
|
|
2042
|
+
let node = currentHydrationNode;
|
|
2043
|
+
while (isComment(node, "[") && // vnode is not a fragment
|
|
2044
|
+
vnode.type !== Fragment && // not inside vdom slot
|
|
2045
|
+
!(isVaporComponent(parentComponent) && isRef(parentComponent.rawSlots._))) {
|
|
2046
|
+
node = node.nextSibling;
|
|
2047
|
+
}
|
|
2048
|
+
if (currentHydrationNode !== node) setCurrentHydrationNode(node);
|
|
2049
|
+
if (!vdomHydrateNode) vdomHydrateNode = ensureHydrationRenderer().hydrateNode;
|
|
2050
|
+
const nextNode = vdomHydrateNode(
|
|
2051
|
+
currentHydrationNode,
|
|
2052
|
+
vnode,
|
|
2053
|
+
parentComponent,
|
|
2054
|
+
null,
|
|
2055
|
+
null,
|
|
2056
|
+
false
|
|
2057
|
+
);
|
|
2058
|
+
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
2059
|
+
else advanceHydrationNode(node);
|
|
2060
|
+
}
|
|
2061
|
+
const createFallback = (fallback) => (internals, parentComponent) => {
|
|
2062
|
+
const fallbackNodes = fallback();
|
|
2063
|
+
if (isArray(fallbackNodes) && fallbackNodes.every(isVNode)) {
|
|
2064
|
+
const frag = new VaporFragment([]);
|
|
2065
|
+
frag.insert = (parentNode, anchor) => {
|
|
2066
|
+
fallbackNodes.forEach((vnode) => {
|
|
2067
|
+
internals.p(null, vnode, parentNode, anchor, parentComponent);
|
|
2068
|
+
});
|
|
2069
|
+
};
|
|
2070
|
+
frag.remove = (parentNode) => {
|
|
2071
|
+
fallbackNodes.forEach((vnode) => {
|
|
2072
|
+
internals.um(vnode, parentComponent, null, true);
|
|
2073
|
+
});
|
|
2074
|
+
};
|
|
2075
|
+
return frag;
|
|
2076
|
+
}
|
|
2077
|
+
return fallbackNodes;
|
|
764
2078
|
};
|
|
765
2079
|
|
|
766
2080
|
function normalizeEmitsOptions(comp) {
|
|
@@ -802,7 +2116,7 @@ function propGetter(rawProps, key) {
|
|
|
802
2116
|
function resolveSource(source) {
|
|
803
2117
|
return isFunction(source) ? source() : source;
|
|
804
2118
|
}
|
|
805
|
-
function getPropsProxyHandlers(comp) {
|
|
2119
|
+
function getPropsProxyHandlers(comp, once) {
|
|
806
2120
|
if (comp.__propsHandlers) {
|
|
807
2121
|
return comp.__propsHandlers;
|
|
808
2122
|
}
|
|
@@ -855,8 +2169,14 @@ function getPropsProxyHandlers(comp) {
|
|
|
855
2169
|
true
|
|
856
2170
|
);
|
|
857
2171
|
};
|
|
2172
|
+
const getPropValue = once ? (...args) => {
|
|
2173
|
+
pauseTracking();
|
|
2174
|
+
const value = getProp(...args);
|
|
2175
|
+
resetTracking();
|
|
2176
|
+
return value;
|
|
2177
|
+
} : getProp;
|
|
858
2178
|
const propsHandlers = propsOptions ? {
|
|
859
|
-
get: (target, key) =>
|
|
2179
|
+
get: (target, key) => getPropValue(target, key),
|
|
860
2180
|
has: (_, key) => isProp(key),
|
|
861
2181
|
ownKeys: () => Object.keys(propsOptions),
|
|
862
2182
|
getOwnPropertyDescriptor(target, key) {
|
|
@@ -864,7 +2184,7 @@ function getPropsProxyHandlers(comp) {
|
|
|
864
2184
|
return {
|
|
865
2185
|
configurable: true,
|
|
866
2186
|
enumerable: true,
|
|
867
|
-
get: () =>
|
|
2187
|
+
get: () => getPropValue(target, key)
|
|
868
2188
|
};
|
|
869
2189
|
}
|
|
870
2190
|
}
|
|
@@ -887,8 +2207,14 @@ function getPropsProxyHandlers(comp) {
|
|
|
887
2207
|
return false;
|
|
888
2208
|
}
|
|
889
2209
|
};
|
|
2210
|
+
const getAttrValue = once ? (...args) => {
|
|
2211
|
+
pauseTracking();
|
|
2212
|
+
const value = getAttr(...args);
|
|
2213
|
+
resetTracking();
|
|
2214
|
+
return value;
|
|
2215
|
+
} : getAttr;
|
|
890
2216
|
const attrsHandlers = {
|
|
891
|
-
get: (target, key) =>
|
|
2217
|
+
get: (target, key) => getAttrValue(target.rawProps, key),
|
|
892
2218
|
has: (target, key) => hasAttr(target.rawProps, key),
|
|
893
2219
|
ownKeys: (target) => getKeysFromRawProps(target.rawProps).filter(isAttr),
|
|
894
2220
|
getOwnPropertyDescriptor(target, key) {
|
|
@@ -896,7 +2222,7 @@ function getPropsProxyHandlers(comp) {
|
|
|
896
2222
|
return {
|
|
897
2223
|
configurable: true,
|
|
898
2224
|
enumerable: true,
|
|
899
|
-
get: () =>
|
|
2225
|
+
get: () => getAttrValue(target.rawProps, key)
|
|
900
2226
|
};
|
|
901
2227
|
}
|
|
902
2228
|
}
|
|
@@ -1076,119 +2402,394 @@ const rawPropsProxyHandlers = {
|
|
|
1076
2402
|
}
|
|
1077
2403
|
};
|
|
1078
2404
|
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
2405
|
+
const VaporTeleportImpl = {
|
|
2406
|
+
name: "VaporTeleport",
|
|
2407
|
+
__isTeleport: true,
|
|
2408
|
+
__vapor: true,
|
|
2409
|
+
process(props, slots) {
|
|
2410
|
+
return new TeleportFragment(props, slots);
|
|
2411
|
+
}
|
|
2412
|
+
};
|
|
2413
|
+
class TeleportFragment extends VaporFragment {
|
|
2414
|
+
constructor(props, slots) {
|
|
2415
|
+
super([]);
|
|
2416
|
+
this.insert = (container, anchor) => {
|
|
2417
|
+
if (isHydrating) return;
|
|
2418
|
+
this.placeholder = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createTextNode();
|
|
2419
|
+
insert(this.placeholder, container, anchor);
|
|
2420
|
+
insert(this.anchor, container, anchor);
|
|
2421
|
+
this.handlePropsUpdate();
|
|
2422
|
+
};
|
|
2423
|
+
this.remove = (parent = this.parent) => {
|
|
2424
|
+
if (this.nodes) {
|
|
2425
|
+
remove(this.nodes, this.mountContainer);
|
|
2426
|
+
this.nodes = [];
|
|
2427
|
+
}
|
|
2428
|
+
if (this.targetStart) {
|
|
2429
|
+
remove(this.targetStart, this.target);
|
|
2430
|
+
this.targetStart = void 0;
|
|
2431
|
+
remove(this.targetAnchor, this.target);
|
|
2432
|
+
this.targetAnchor = void 0;
|
|
2433
|
+
}
|
|
2434
|
+
if (this.anchor) {
|
|
2435
|
+
remove(this.anchor, this.anchor.parentNode);
|
|
2436
|
+
this.anchor = void 0;
|
|
2437
|
+
}
|
|
2438
|
+
if (this.placeholder) {
|
|
2439
|
+
remove(this.placeholder, parent);
|
|
2440
|
+
this.placeholder = void 0;
|
|
2441
|
+
}
|
|
2442
|
+
this.mountContainer = void 0;
|
|
2443
|
+
this.mountAnchor = void 0;
|
|
2444
|
+
};
|
|
2445
|
+
this.hydrate = () => {
|
|
2446
|
+
const target = this.target = resolveTeleportTarget(
|
|
2447
|
+
this.resolvedProps,
|
|
2448
|
+
querySelector
|
|
2449
|
+
);
|
|
2450
|
+
const disabled = isTeleportDisabled(this.resolvedProps);
|
|
2451
|
+
this.placeholder = currentHydrationNode;
|
|
2452
|
+
if (target) {
|
|
2453
|
+
const targetNode = target._lpa || target.firstChild;
|
|
2454
|
+
if (disabled) {
|
|
2455
|
+
this.hydrateDisabledTeleport(targetNode);
|
|
2456
|
+
} else {
|
|
2457
|
+
this.anchor = locateTeleportEndAnchor();
|
|
2458
|
+
this.mountContainer = target;
|
|
2459
|
+
let targetAnchor = targetNode;
|
|
2460
|
+
while (targetAnchor) {
|
|
2461
|
+
if (targetAnchor && targetAnchor.nodeType === 8) {
|
|
2462
|
+
if (targetAnchor.data === "teleport start anchor") {
|
|
2463
|
+
this.targetStart = targetAnchor;
|
|
2464
|
+
} else if (targetAnchor.data === "teleport anchor") {
|
|
2465
|
+
this.mountAnchor = this.targetAnchor = targetAnchor;
|
|
2466
|
+
target._lpa = this.targetAnchor && this.targetAnchor.nextSibling;
|
|
2467
|
+
break;
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
targetAnchor = targetAnchor.nextSibling;
|
|
2471
|
+
}
|
|
2472
|
+
if (targetNode) {
|
|
2473
|
+
setCurrentHydrationNode(targetNode.nextSibling);
|
|
2474
|
+
}
|
|
2475
|
+
if (!this.targetAnchor) {
|
|
2476
|
+
this.mount(target);
|
|
1102
2477
|
} else {
|
|
1103
|
-
|
|
2478
|
+
this.initChildren();
|
|
1104
2479
|
}
|
|
1105
|
-
} else {
|
|
1106
|
-
keys.push(...Object.keys(source));
|
|
1107
2480
|
}
|
|
2481
|
+
} else if (disabled) {
|
|
2482
|
+
this.hydrateDisabledTeleport(currentHydrationNode);
|
|
1108
2483
|
}
|
|
2484
|
+
advanceHydrationNode(this.anchor);
|
|
2485
|
+
};
|
|
2486
|
+
this.rawProps = props;
|
|
2487
|
+
this.rawSlots = slots;
|
|
2488
|
+
this.anchor = isHydrating ? void 0 : !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createTextNode();
|
|
2489
|
+
renderEffect(() => {
|
|
2490
|
+
this.resolvedProps = extend(
|
|
2491
|
+
{},
|
|
2492
|
+
new Proxy(
|
|
2493
|
+
this.rawProps,
|
|
2494
|
+
rawPropsProxyHandlers
|
|
2495
|
+
)
|
|
2496
|
+
);
|
|
2497
|
+
this.handlePropsUpdate();
|
|
2498
|
+
});
|
|
2499
|
+
if (!isHydrating) {
|
|
2500
|
+
this.initChildren();
|
|
1109
2501
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
2502
|
+
}
|
|
2503
|
+
get parent() {
|
|
2504
|
+
return this.anchor ? this.anchor.parentNode : null;
|
|
2505
|
+
}
|
|
2506
|
+
initChildren() {
|
|
2507
|
+
renderEffect(() => {
|
|
2508
|
+
this.handleChildrenUpdate(
|
|
2509
|
+
this.rawSlots.default && this.rawSlots.default()
|
|
2510
|
+
);
|
|
2511
|
+
});
|
|
2512
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2513
|
+
const nodes = this.nodes;
|
|
2514
|
+
if (isVaporComponent(nodes)) {
|
|
2515
|
+
nodes.parentTeleport = this;
|
|
2516
|
+
} else if (isArray(nodes)) {
|
|
2517
|
+
nodes.forEach(
|
|
2518
|
+
(node) => isVaporComponent(node) && (node.parentTeleport = this)
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
}
|
|
2523
|
+
handleChildrenUpdate(children) {
|
|
2524
|
+
if (!this.parent || isHydrating) {
|
|
2525
|
+
this.nodes = children;
|
|
2526
|
+
return;
|
|
2527
|
+
}
|
|
2528
|
+
remove(this.nodes, this.mountContainer);
|
|
2529
|
+
insert(this.nodes = children, this.mountContainer, this.mountAnchor);
|
|
2530
|
+
}
|
|
2531
|
+
handlePropsUpdate() {
|
|
2532
|
+
if (!this.parent || isHydrating) return;
|
|
2533
|
+
const mount = (parent, anchor) => {
|
|
2534
|
+
if (this.$transition) {
|
|
2535
|
+
applyTransitionHooks(this.nodes, this.$transition);
|
|
2536
|
+
}
|
|
2537
|
+
insert(
|
|
2538
|
+
this.nodes,
|
|
2539
|
+
this.mountContainer = parent,
|
|
2540
|
+
this.mountAnchor = anchor
|
|
2541
|
+
);
|
|
2542
|
+
};
|
|
2543
|
+
const mountToTarget = () => {
|
|
2544
|
+
const target = this.target = resolveTeleportTarget(
|
|
2545
|
+
this.resolvedProps,
|
|
2546
|
+
querySelector
|
|
2547
|
+
);
|
|
2548
|
+
if (target) {
|
|
2549
|
+
if (
|
|
2550
|
+
// initial mount into target
|
|
2551
|
+
!this.targetAnchor || // target changed
|
|
2552
|
+
this.targetAnchor.parentNode !== target
|
|
2553
|
+
) {
|
|
2554
|
+
insert(this.targetStart = createTextNode(""), target);
|
|
2555
|
+
insert(this.targetAnchor = createTextNode(""), target);
|
|
1133
2556
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
2557
|
+
mount(target, this.targetAnchor);
|
|
2558
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2559
|
+
warn(
|
|
2560
|
+
`Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`,
|
|
2561
|
+
target,
|
|
2562
|
+
`(${typeof target})`
|
|
2563
|
+
);
|
|
2564
|
+
}
|
|
2565
|
+
};
|
|
2566
|
+
if (isTeleportDisabled(this.resolvedProps)) {
|
|
2567
|
+
mount(this.parent, this.anchor);
|
|
2568
|
+
} else {
|
|
2569
|
+
if (isTeleportDeferred(this.resolvedProps)) {
|
|
2570
|
+
queuePostFlushCb(mountToTarget);
|
|
2571
|
+
} else {
|
|
2572
|
+
mountToTarget();
|
|
1136
2573
|
}
|
|
1137
2574
|
}
|
|
1138
2575
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
2576
|
+
hydrateDisabledTeleport(targetNode) {
|
|
2577
|
+
let nextNode = this.placeholder.nextSibling;
|
|
2578
|
+
setCurrentHydrationNode(nextNode);
|
|
2579
|
+
this.mountAnchor = this.anchor = locateTeleportEndAnchor(nextNode);
|
|
2580
|
+
this.mountContainer = this.anchor.parentNode;
|
|
2581
|
+
this.targetStart = targetNode;
|
|
2582
|
+
this.targetAnchor = targetNode && targetNode.nextSibling;
|
|
2583
|
+
this.initChildren();
|
|
2584
|
+
}
|
|
2585
|
+
mount(target) {
|
|
2586
|
+
target.appendChild(this.targetStart = createTextNode(""));
|
|
2587
|
+
target.appendChild(
|
|
2588
|
+
this.mountAnchor = this.targetAnchor = createTextNode("")
|
|
2589
|
+
);
|
|
2590
|
+
if (!isMismatchAllowed(target, 1)) {
|
|
2591
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) {
|
|
2592
|
+
warn(
|
|
2593
|
+
`Hydration children mismatch on`,
|
|
2594
|
+
target,
|
|
2595
|
+
`
|
|
2596
|
+
Server rendered element contains fewer child nodes than client nodes.`
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
logMismatchError();
|
|
2600
|
+
}
|
|
2601
|
+
runWithoutHydration(this.initChildren.bind(this));
|
|
1141
2602
|
}
|
|
1142
2603
|
}
|
|
1143
|
-
function
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
2604
|
+
function isVaporTeleport(value) {
|
|
2605
|
+
return value === VaporTeleportImpl;
|
|
2606
|
+
}
|
|
2607
|
+
function locateTeleportEndAnchor(node = currentHydrationNode) {
|
|
2608
|
+
while (node) {
|
|
2609
|
+
if (isComment(node, "teleport end")) {
|
|
2610
|
+
return node;
|
|
2611
|
+
}
|
|
2612
|
+
node = node.nextSibling;
|
|
1150
2613
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
2614
|
+
return null;
|
|
2615
|
+
}
|
|
2616
|
+
|
|
2617
|
+
function isBlock(val) {
|
|
2618
|
+
return val instanceof Node || isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
2619
|
+
}
|
|
2620
|
+
function isValidBlock(block) {
|
|
2621
|
+
if (block instanceof Node) {
|
|
2622
|
+
return !(block instanceof Comment);
|
|
2623
|
+
} else if (isVaporComponent(block)) {
|
|
2624
|
+
return isValidBlock(block.block);
|
|
2625
|
+
} else if (isArray(block)) {
|
|
2626
|
+
return block.length > 0 && block.some(isValidBlock);
|
|
1163
2627
|
} else {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
2628
|
+
return isValidBlock(block.nodes);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
function insert(block, parent, anchor = null, parentSuspense) {
|
|
2632
|
+
anchor = anchor === 0 ? parent.$fc || _child(parent) : anchor;
|
|
2633
|
+
if (block instanceof Node) {
|
|
2634
|
+
if (!isHydrating) {
|
|
2635
|
+
if (block instanceof Element && block.$transition && !block.$transition.disabled) {
|
|
2636
|
+
performTransitionEnter(
|
|
2637
|
+
block,
|
|
2638
|
+
block.$transition,
|
|
2639
|
+
() => parent.insertBefore(block, anchor),
|
|
2640
|
+
parentSuspense
|
|
1177
2641
|
);
|
|
1178
2642
|
} else {
|
|
1179
|
-
|
|
2643
|
+
parent.insertBefore(block, anchor);
|
|
1180
2644
|
}
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
|
|
2645
|
+
}
|
|
2646
|
+
} else if (isVaporComponent(block)) {
|
|
2647
|
+
if (block.isMounted && !block.isDeactivated) {
|
|
2648
|
+
insert(block.block, parent, anchor);
|
|
1184
2649
|
} else {
|
|
1185
|
-
|
|
2650
|
+
mountComponent(block, parent, anchor);
|
|
2651
|
+
}
|
|
2652
|
+
} else if (isArray(block)) {
|
|
2653
|
+
for (const b of block) {
|
|
2654
|
+
insert(b, parent, anchor);
|
|
2655
|
+
}
|
|
2656
|
+
} else {
|
|
2657
|
+
if (block.anchor) {
|
|
2658
|
+
insert(block.anchor, parent, anchor);
|
|
2659
|
+
anchor = block.anchor;
|
|
2660
|
+
}
|
|
2661
|
+
if (block.insert) {
|
|
2662
|
+
block.insert(parent, anchor, block.$transition);
|
|
2663
|
+
} else {
|
|
2664
|
+
insert(block.nodes, parent, anchor, parentSuspense);
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
function prepend(parent, ...blocks) {
|
|
2669
|
+
let i = blocks.length;
|
|
2670
|
+
while (i--) insert(blocks[i], parent, 0);
|
|
2671
|
+
}
|
|
2672
|
+
function remove(block, parent) {
|
|
2673
|
+
if (block instanceof Node) {
|
|
2674
|
+
if (block.$transition && block instanceof Element) {
|
|
2675
|
+
performTransitionLeave(
|
|
2676
|
+
block,
|
|
2677
|
+
block.$transition,
|
|
2678
|
+
() => parent && parent.removeChild(block)
|
|
2679
|
+
);
|
|
2680
|
+
} else {
|
|
2681
|
+
parent && parent.removeChild(block);
|
|
2682
|
+
}
|
|
2683
|
+
} else if (isVaporComponent(block)) {
|
|
2684
|
+
unmountComponent(block, parent);
|
|
2685
|
+
} else if (isArray(block)) {
|
|
2686
|
+
for (let i = 0; i < block.length; i++) {
|
|
2687
|
+
remove(block[i], parent);
|
|
2688
|
+
}
|
|
2689
|
+
} else {
|
|
2690
|
+
if (block.remove) {
|
|
2691
|
+
block.remove(parent, block.$transition);
|
|
2692
|
+
} else {
|
|
2693
|
+
remove(block.nodes, parent);
|
|
2694
|
+
}
|
|
2695
|
+
if (block.anchor) remove(block.anchor, parent);
|
|
2696
|
+
if (block.scope) {
|
|
2697
|
+
block.scope.stop();
|
|
2698
|
+
const scopes = block.keptAliveScopes;
|
|
2699
|
+
if (scopes) {
|
|
2700
|
+
scopes.forEach((scope) => scope.stop());
|
|
2701
|
+
scopes.clear();
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
function normalizeBlock(block) {
|
|
2707
|
+
if (!!!(process.env.NODE_ENV !== "production") && true) {
|
|
2708
|
+
throw new Error(
|
|
2709
|
+
"normalizeBlock should not be used in production code paths"
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
const nodes = [];
|
|
2713
|
+
if (block instanceof Node) {
|
|
2714
|
+
nodes.push(block);
|
|
2715
|
+
} else if (isArray(block)) {
|
|
2716
|
+
block.forEach((child) => nodes.push(...normalizeBlock(child)));
|
|
2717
|
+
} else if (isVaporComponent(block)) {
|
|
2718
|
+
nodes.push(...normalizeBlock(block.block));
|
|
2719
|
+
} else {
|
|
2720
|
+
if (block instanceof TeleportFragment) {
|
|
2721
|
+
nodes.push(block.placeholder, block.anchor);
|
|
2722
|
+
} else {
|
|
2723
|
+
nodes.push(...normalizeBlock(block.nodes));
|
|
2724
|
+
block.anchor && nodes.push(block.anchor);
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
return nodes;
|
|
2728
|
+
}
|
|
2729
|
+
function findBlockNode(block) {
|
|
2730
|
+
let { parentNode, nextSibling: nextNode } = findLastChild(block);
|
|
2731
|
+
if (nextNode && isComment(nextNode, "]") && isFragmentBlock(block)) {
|
|
2732
|
+
nextNode = nextNode.nextSibling;
|
|
2733
|
+
}
|
|
2734
|
+
return {
|
|
2735
|
+
parentNode,
|
|
2736
|
+
nextNode
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2739
|
+
function findLastChild(node) {
|
|
2740
|
+
if (node && node instanceof Node) {
|
|
2741
|
+
return node;
|
|
2742
|
+
} else if (isArray(node)) {
|
|
2743
|
+
return findLastChild(node[node.length - 1]);
|
|
2744
|
+
} else if (isVaporComponent(node)) {
|
|
2745
|
+
return findLastChild(node.block);
|
|
2746
|
+
} else {
|
|
2747
|
+
if (node.anchor) return node.anchor;
|
|
2748
|
+
return findLastChild(node.nodes);
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
function isFragmentBlock(block) {
|
|
2752
|
+
if (isArray(block)) {
|
|
2753
|
+
return true;
|
|
2754
|
+
} else if (isVaporComponent(block)) {
|
|
2755
|
+
return isFragmentBlock(block.block);
|
|
2756
|
+
} else if (isFragment(block)) {
|
|
2757
|
+
return isFragmentBlock(block.nodes);
|
|
2758
|
+
}
|
|
2759
|
+
return false;
|
|
2760
|
+
}
|
|
2761
|
+
function setScopeId(block, scopeIds) {
|
|
2762
|
+
if (block instanceof Element) {
|
|
2763
|
+
for (const id of scopeIds) {
|
|
2764
|
+
block.setAttribute(id, "");
|
|
2765
|
+
}
|
|
2766
|
+
} else if (isVaporComponent(block)) {
|
|
2767
|
+
setScopeId(block.block, scopeIds);
|
|
2768
|
+
} else if (isArray(block)) {
|
|
2769
|
+
for (const b of block) {
|
|
2770
|
+
setScopeId(b, scopeIds);
|
|
1186
2771
|
}
|
|
2772
|
+
} else if (isFragment(block)) {
|
|
2773
|
+
setScopeId(block.nodes, scopeIds);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
function setComponentScopeId(instance) {
|
|
2777
|
+
const parent = instance.parent;
|
|
2778
|
+
if (!parent) return;
|
|
2779
|
+
if (isArray(instance.block) && instance.block.length > 1) return;
|
|
2780
|
+
const scopeIds = [];
|
|
2781
|
+
const scopeId = parent.type.__scopeId;
|
|
2782
|
+
if (scopeId) {
|
|
2783
|
+
scopeIds.push(scopeId);
|
|
1187
2784
|
}
|
|
1188
|
-
if (
|
|
1189
|
-
|
|
2785
|
+
if (parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
|
|
2786
|
+
scopeIds.push(parent.vnode.scopeId);
|
|
2787
|
+
const inheritedScopeIds = getInheritedScopeIds(parent.vnode, parent.parent);
|
|
2788
|
+
scopeIds.push(...inheritedScopeIds);
|
|
2789
|
+
}
|
|
2790
|
+
if (scopeIds.length > 0) {
|
|
2791
|
+
setScopeId(instance.block, scopeIds);
|
|
1190
2792
|
}
|
|
1191
|
-
return fragment;
|
|
1192
2793
|
}
|
|
1193
2794
|
|
|
1194
2795
|
function hmrRerender(instance) {
|
|
@@ -1197,6 +2798,10 @@ function hmrRerender(instance) {
|
|
|
1197
2798
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
1198
2799
|
remove(instance.block, parent);
|
|
1199
2800
|
const prev = setCurrentInstance(instance);
|
|
2801
|
+
if (instance.renderEffects) {
|
|
2802
|
+
instance.renderEffects.forEach((e) => e.stop());
|
|
2803
|
+
instance.renderEffects = [];
|
|
2804
|
+
}
|
|
1200
2805
|
pushWarningContext(instance);
|
|
1201
2806
|
devRender(instance);
|
|
1202
2807
|
popWarningContext();
|
|
@@ -1208,7 +2813,8 @@ function hmrReload(instance, newComp) {
|
|
|
1208
2813
|
const parent = normalized[0].parentNode;
|
|
1209
2814
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
1210
2815
|
unmountComponent(instance, parent);
|
|
1211
|
-
const
|
|
2816
|
+
const parentInstance = instance.parent;
|
|
2817
|
+
const prev = setCurrentInstance(parentInstance);
|
|
1212
2818
|
const newInstance = createComponent(
|
|
1213
2819
|
newComp,
|
|
1214
2820
|
instance.rawProps,
|
|
@@ -1217,42 +2823,99 @@ function hmrReload(instance, newComp) {
|
|
|
1217
2823
|
);
|
|
1218
2824
|
setCurrentInstance(...prev);
|
|
1219
2825
|
mountComponent(newInstance, parent, anchor);
|
|
2826
|
+
updateParentBlockOnHmrReload(parentInstance, instance, newInstance);
|
|
2827
|
+
updateParentTeleportOnHmrReload(instance, newInstance);
|
|
2828
|
+
}
|
|
2829
|
+
function updateParentBlockOnHmrReload(parentInstance, instance, newInstance) {
|
|
2830
|
+
if (parentInstance) {
|
|
2831
|
+
if (parentInstance.block === instance) {
|
|
2832
|
+
parentInstance.block = newInstance;
|
|
2833
|
+
} else if (isArray(parentInstance.block)) {
|
|
2834
|
+
for (let i = 0; i < parentInstance.block.length; i++) {
|
|
2835
|
+
if (parentInstance.block[i] === instance) {
|
|
2836
|
+
parentInstance.block[i] = newInstance;
|
|
2837
|
+
break;
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
function updateParentTeleportOnHmrReload(instance, newInstance) {
|
|
2844
|
+
const teleport = instance.parentTeleport;
|
|
2845
|
+
if (teleport) {
|
|
2846
|
+
newInstance.parentTeleport = teleport;
|
|
2847
|
+
if (teleport.nodes === instance) {
|
|
2848
|
+
teleport.nodes = newInstance;
|
|
2849
|
+
} else if (isArray(teleport.nodes)) {
|
|
2850
|
+
for (let i = 0; i < teleport.nodes.length; i++) {
|
|
2851
|
+
if (teleport.nodes[i] === instance) {
|
|
2852
|
+
teleport.nodes[i] = newInstance;
|
|
2853
|
+
break;
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
1220
2858
|
}
|
|
1221
2859
|
|
|
1222
|
-
function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
2860
|
+
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
1223
2861
|
const _insertionParent = insertionParent;
|
|
1224
2862
|
const _insertionAnchor = insertionAnchor;
|
|
2863
|
+
const _isLastInsertion = isLastInsertion;
|
|
1225
2864
|
if (isHydrating) {
|
|
1226
2865
|
locateHydrationNode();
|
|
1227
2866
|
} else {
|
|
1228
2867
|
resetInsertionState();
|
|
1229
2868
|
}
|
|
2869
|
+
if (isSingleRoot && component.inheritAttrs !== false && isVaporComponent(currentInstance) && currentInstance.hasFallthrough) {
|
|
2870
|
+
const attrs = currentInstance.attrs;
|
|
2871
|
+
if (rawProps) {
|
|
2872
|
+
(rawProps.$ || (rawProps.$ = [])).push(
|
|
2873
|
+
() => attrs
|
|
2874
|
+
);
|
|
2875
|
+
} else {
|
|
2876
|
+
rawProps = { $: [() => attrs] };
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
2880
|
+
const cached = currentInstance.getCachedComponent(
|
|
2881
|
+
component
|
|
2882
|
+
);
|
|
2883
|
+
if (cached) return cached;
|
|
2884
|
+
}
|
|
1230
2885
|
if (appContext.vapor && !component.__vapor) {
|
|
1231
2886
|
const frag = appContext.vapor.vdomMount(
|
|
1232
2887
|
component,
|
|
1233
2888
|
rawProps,
|
|
1234
2889
|
rawSlots
|
|
1235
2890
|
);
|
|
1236
|
-
if (!isHydrating
|
|
1237
|
-
insert(frag, _insertionParent, _insertionAnchor);
|
|
2891
|
+
if (!isHydrating) {
|
|
2892
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
2893
|
+
} else {
|
|
2894
|
+
frag.hydrate();
|
|
2895
|
+
if (_isLastInsertion) {
|
|
2896
|
+
advanceHydrationNode(_insertionParent);
|
|
2897
|
+
}
|
|
1238
2898
|
}
|
|
1239
2899
|
return frag;
|
|
1240
2900
|
}
|
|
1241
|
-
if (
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1244
|
-
(
|
|
1245
|
-
() => attrs
|
|
1246
|
-
);
|
|
2901
|
+
if (isVaporTeleport(component)) {
|
|
2902
|
+
const frag = component.process(rawProps, rawSlots);
|
|
2903
|
+
if (!isHydrating) {
|
|
2904
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
1247
2905
|
} else {
|
|
1248
|
-
|
|
2906
|
+
frag.hydrate();
|
|
2907
|
+
if (_isLastInsertion) {
|
|
2908
|
+
advanceHydrationNode(_insertionParent);
|
|
2909
|
+
}
|
|
1249
2910
|
}
|
|
2911
|
+
return frag;
|
|
1250
2912
|
}
|
|
1251
2913
|
const instance = new VaporComponentInstance(
|
|
1252
2914
|
component,
|
|
1253
2915
|
rawProps,
|
|
1254
2916
|
rawSlots,
|
|
1255
|
-
appContext
|
|
2917
|
+
appContext,
|
|
2918
|
+
once
|
|
1256
2919
|
);
|
|
1257
2920
|
if (!!(process.env.NODE_ENV !== "production") && component.__hmrId) {
|
|
1258
2921
|
registerHMR(instance);
|
|
@@ -1266,6 +2929,45 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1266
2929
|
instance.propsOptions = normalizePropsOptions(component);
|
|
1267
2930
|
instance.emitsOptions = normalizeEmitsOptions(component);
|
|
1268
2931
|
}
|
|
2932
|
+
if (isHydrating && isAsyncWrapper(instance) && component.__asyncHydrate && !component.__asyncResolved) {
|
|
2933
|
+
const el = currentHydrationNode;
|
|
2934
|
+
if (isComment(el, "[")) {
|
|
2935
|
+
const end = _next(locateEndAnchor(el));
|
|
2936
|
+
const block = instance.block = [el];
|
|
2937
|
+
let cur = el;
|
|
2938
|
+
while (true) {
|
|
2939
|
+
let n = _next(cur);
|
|
2940
|
+
if (n && n !== end) {
|
|
2941
|
+
block.push(cur = n);
|
|
2942
|
+
} else {
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
} else {
|
|
2947
|
+
instance.block = el;
|
|
2948
|
+
}
|
|
2949
|
+
instance.isMounted = true;
|
|
2950
|
+
setCurrentHydrationNode(
|
|
2951
|
+
isComment(el, "[") ? locateEndAnchor(el) : el.nextSibling
|
|
2952
|
+
);
|
|
2953
|
+
component.__asyncHydrate(
|
|
2954
|
+
el,
|
|
2955
|
+
instance,
|
|
2956
|
+
() => setupComponent(instance, component)
|
|
2957
|
+
);
|
|
2958
|
+
} else {
|
|
2959
|
+
setupComponent(instance, component);
|
|
2960
|
+
}
|
|
2961
|
+
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
2962
|
+
if (_insertionParent || isHydrating) {
|
|
2963
|
+
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
2964
|
+
}
|
|
2965
|
+
if (isHydrating && _insertionAnchor !== void 0) {
|
|
2966
|
+
advanceHydrationNode(_insertionParent);
|
|
2967
|
+
}
|
|
2968
|
+
return instance;
|
|
2969
|
+
}
|
|
2970
|
+
function setupComponent(instance, component) {
|
|
1269
2971
|
const prevInstance = setCurrentInstance(instance);
|
|
1270
2972
|
const prevSub = setActiveSub();
|
|
1271
2973
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -1302,14 +3004,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1302
3004
|
}
|
|
1303
3005
|
}
|
|
1304
3006
|
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
1305
|
-
|
|
1306
|
-
if (el) {
|
|
1307
|
-
renderEffect(() => {
|
|
1308
|
-
isApplyingFallthroughProps = true;
|
|
1309
|
-
setDynamicProps(el, [instance.attrs]);
|
|
1310
|
-
isApplyingFallthroughProps = false;
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
3007
|
+
renderEffect(() => applyFallthroughProps(instance.block, instance.attrs));
|
|
1313
3008
|
}
|
|
1314
3009
|
setActiveSub(prevSub);
|
|
1315
3010
|
setCurrentInstance(...prevInstance);
|
|
@@ -1317,13 +3012,16 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1317
3012
|
popWarningContext();
|
|
1318
3013
|
endMeasure(instance, "init");
|
|
1319
3014
|
}
|
|
1320
|
-
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
1321
|
-
if (!isHydrating && _insertionParent) {
|
|
1322
|
-
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
1323
|
-
}
|
|
1324
|
-
return instance;
|
|
1325
3015
|
}
|
|
1326
3016
|
let isApplyingFallthroughProps = false;
|
|
3017
|
+
function applyFallthroughProps(block, attrs) {
|
|
3018
|
+
const el = getRootElement(block);
|
|
3019
|
+
if (el) {
|
|
3020
|
+
isApplyingFallthroughProps = true;
|
|
3021
|
+
setDynamicProps(el, [attrs]);
|
|
3022
|
+
isApplyingFallthroughProps = false;
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
1327
3025
|
function devRender(instance) {
|
|
1328
3026
|
instance.block = (instance.type.render ? callWithErrorHandling(
|
|
1329
3027
|
instance.type.render,
|
|
@@ -1357,7 +3055,7 @@ const emptyContext = {
|
|
|
1357
3055
|
provides: /* @__PURE__ */ Object.create(null)
|
|
1358
3056
|
};
|
|
1359
3057
|
class VaporComponentInstance {
|
|
1360
|
-
constructor(comp, rawProps, rawSlots, appContext) {
|
|
3058
|
+
constructor(comp, rawProps, rawSlots, appContext, once) {
|
|
1361
3059
|
this.vapor = true;
|
|
1362
3060
|
this.uid = nextUid();
|
|
1363
3061
|
this.type = comp;
|
|
@@ -1382,7 +3080,7 @@ class VaporComponentInstance {
|
|
|
1382
3080
|
this.rawProps = rawProps || EMPTY_OBJ;
|
|
1383
3081
|
this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
|
|
1384
3082
|
if (rawProps || comp.props) {
|
|
1385
|
-
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp);
|
|
3083
|
+
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp, once);
|
|
1386
3084
|
this.attrs = new Proxy(this, attrsHandlers);
|
|
1387
3085
|
this.props = comp.props ? new Proxy(this, propsHandlers) : isFunction(comp) ? this.attrs : EMPTY_OBJ;
|
|
1388
3086
|
} else {
|
|
@@ -1402,47 +3100,85 @@ class VaporComponentInstance {
|
|
|
1402
3100
|
function isVaporComponent(value) {
|
|
1403
3101
|
return value instanceof VaporComponentInstance;
|
|
1404
3102
|
}
|
|
1405
|
-
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot) {
|
|
3103
|
+
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, once, appContext) {
|
|
1406
3104
|
if (!isString(comp)) {
|
|
1407
|
-
return createComponent(
|
|
3105
|
+
return createComponent(
|
|
3106
|
+
comp,
|
|
3107
|
+
rawProps,
|
|
3108
|
+
rawSlots,
|
|
3109
|
+
isSingleRoot,
|
|
3110
|
+
once,
|
|
3111
|
+
appContext
|
|
3112
|
+
);
|
|
1408
3113
|
}
|
|
1409
3114
|
const _insertionParent = insertionParent;
|
|
1410
3115
|
const _insertionAnchor = insertionAnchor;
|
|
3116
|
+
const _isLastInsertion = isLastInsertion;
|
|
1411
3117
|
if (isHydrating) {
|
|
1412
3118
|
locateHydrationNode();
|
|
1413
3119
|
} else {
|
|
1414
3120
|
resetInsertionState();
|
|
1415
3121
|
}
|
|
1416
|
-
const el =
|
|
3122
|
+
const el = isHydrating ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : createElement(comp);
|
|
1417
3123
|
el.$root = isSingleRoot;
|
|
3124
|
+
if (!isHydrating) {
|
|
3125
|
+
const scopeId = currentInstance.type.__scopeId;
|
|
3126
|
+
if (scopeId) setScopeId(el, [scopeId]);
|
|
3127
|
+
}
|
|
1418
3128
|
if (rawProps) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
3129
|
+
const setFn = () => setDynamicProps(el, [resolveDynamicProps(rawProps)]);
|
|
3130
|
+
if (once) setFn();
|
|
3131
|
+
else renderEffect(setFn);
|
|
1422
3132
|
}
|
|
1423
3133
|
if (rawSlots) {
|
|
3134
|
+
let nextNode = null;
|
|
3135
|
+
if (isHydrating) {
|
|
3136
|
+
nextNode = locateNextNode(el);
|
|
3137
|
+
setCurrentHydrationNode(el.firstChild);
|
|
3138
|
+
}
|
|
1424
3139
|
if (rawSlots.$) ; else {
|
|
1425
3140
|
insert(getSlot(rawSlots, "default")(), el);
|
|
1426
3141
|
}
|
|
3142
|
+
if (isHydrating) {
|
|
3143
|
+
setCurrentHydrationNode(nextNode);
|
|
3144
|
+
}
|
|
1427
3145
|
}
|
|
1428
|
-
if (!isHydrating
|
|
1429
|
-
insert(el, _insertionParent, _insertionAnchor);
|
|
3146
|
+
if (!isHydrating) {
|
|
3147
|
+
if (_insertionParent) insert(el, _insertionParent, _insertionAnchor);
|
|
3148
|
+
} else {
|
|
3149
|
+
if (_isLastInsertion) {
|
|
3150
|
+
advanceHydrationNode(_insertionParent);
|
|
3151
|
+
}
|
|
1430
3152
|
}
|
|
1431
3153
|
return el;
|
|
1432
3154
|
}
|
|
1433
3155
|
function mountComponent(instance, parent, anchor) {
|
|
3156
|
+
if (instance.shapeFlag & 512) {
|
|
3157
|
+
findParentKeepAlive(instance).activate(instance, parent, anchor);
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
1434
3160
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1435
3161
|
startMeasure(instance, `mount`);
|
|
1436
3162
|
}
|
|
1437
3163
|
if (instance.bm) invokeArrayFns(instance.bm);
|
|
1438
|
-
|
|
1439
|
-
|
|
3164
|
+
if (!isHydrating) {
|
|
3165
|
+
insert(instance.block, parent, anchor);
|
|
3166
|
+
setComponentScopeId(instance);
|
|
3167
|
+
}
|
|
3168
|
+
if (instance.m) queuePostFlushCb(instance.m);
|
|
3169
|
+
if (instance.shapeFlag & 256 && instance.a) {
|
|
3170
|
+
queuePostFlushCb(instance.a);
|
|
3171
|
+
}
|
|
1440
3172
|
instance.isMounted = true;
|
|
1441
3173
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1442
3174
|
endMeasure(instance, `mount`);
|
|
1443
3175
|
}
|
|
1444
3176
|
}
|
|
1445
3177
|
function unmountComponent(instance, parentNode) {
|
|
3178
|
+
if (parentNode && instance.parent && instance.parent.vapor && instance.shapeFlag & 256) {
|
|
3179
|
+
findParentKeepAlive(instance).deactivate(instance);
|
|
3180
|
+
return;
|
|
3181
|
+
}
|
|
1446
3182
|
if (instance.isMounted && !instance.isUnmounted) {
|
|
1447
3183
|
if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
|
|
1448
3184
|
unregisterHMR(instance);
|
|
@@ -1452,7 +3188,7 @@ function unmountComponent(instance, parentNode) {
|
|
|
1452
3188
|
}
|
|
1453
3189
|
instance.scope.stop();
|
|
1454
3190
|
if (instance.um) {
|
|
1455
|
-
queuePostFlushCb(
|
|
3191
|
+
queuePostFlushCb(instance.um);
|
|
1456
3192
|
}
|
|
1457
3193
|
instance.isUnmounted = true;
|
|
1458
3194
|
}
|
|
@@ -1467,9 +3203,7 @@ function getExposed(instance) {
|
|
|
1467
3203
|
}));
|
|
1468
3204
|
}
|
|
1469
3205
|
}
|
|
1470
|
-
function getRootElement({
|
|
1471
|
-
block
|
|
1472
|
-
}) {
|
|
3206
|
+
function getRootElement(block) {
|
|
1473
3207
|
if (block instanceof Element) {
|
|
1474
3208
|
return block;
|
|
1475
3209
|
}
|
|
@@ -1495,6 +3229,7 @@ const mountApp = (app, container) => {
|
|
|
1495
3229
|
app._props,
|
|
1496
3230
|
null,
|
|
1497
3231
|
false,
|
|
3232
|
+
false,
|
|
1498
3233
|
app._context
|
|
1499
3234
|
);
|
|
1500
3235
|
mountComponent(instance, container);
|
|
@@ -1511,6 +3246,7 @@ const hydrateApp = (app, container) => {
|
|
|
1511
3246
|
app._props,
|
|
1512
3247
|
null,
|
|
1513
3248
|
false,
|
|
3249
|
+
false,
|
|
1514
3250
|
app._context
|
|
1515
3251
|
);
|
|
1516
3252
|
mountComponent(instance, container);
|
|
@@ -1536,7 +3272,12 @@ function postPrepareApp(app) {
|
|
|
1536
3272
|
const mount = app.mount;
|
|
1537
3273
|
app.mount = (container, ...args) => {
|
|
1538
3274
|
container = normalizeContainer(container);
|
|
1539
|
-
|
|
3275
|
+
const proxy = mount(container, ...args);
|
|
3276
|
+
if (container instanceof Element) {
|
|
3277
|
+
container.removeAttribute("v-cloak");
|
|
3278
|
+
container.setAttribute("data-v-app", "");
|
|
3279
|
+
}
|
|
3280
|
+
return proxy;
|
|
1540
3281
|
};
|
|
1541
3282
|
}
|
|
1542
3283
|
const createVaporApp = (comp, props) => {
|
|
@@ -1555,17 +3296,128 @@ const createVaporSSRApp = (comp, props) => {
|
|
|
1555
3296
|
return app;
|
|
1556
3297
|
};
|
|
1557
3298
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
3299
|
+
function defineVaporAsyncComponent(source) {
|
|
3300
|
+
const {
|
|
3301
|
+
load,
|
|
3302
|
+
getResolvedComp,
|
|
3303
|
+
setPendingRequest,
|
|
3304
|
+
source: {
|
|
3305
|
+
loadingComponent,
|
|
3306
|
+
errorComponent,
|
|
3307
|
+
delay,
|
|
3308
|
+
hydrate: hydrateStrategy,
|
|
3309
|
+
timeout,
|
|
3310
|
+
suspensible = true
|
|
3311
|
+
}
|
|
3312
|
+
} = createAsyncComponentContext(source);
|
|
3313
|
+
return defineVaporComponent({
|
|
3314
|
+
name: "VaporAsyncComponentWrapper",
|
|
3315
|
+
__asyncLoader: load,
|
|
3316
|
+
__asyncHydrate(el, instance, hydrate) {
|
|
3317
|
+
let isHydrated = false;
|
|
3318
|
+
watch(
|
|
3319
|
+
() => instance.attrs,
|
|
3320
|
+
() => {
|
|
3321
|
+
if (isHydrated) return;
|
|
3322
|
+
instance.bu && invokeArrayFns(instance.bu);
|
|
3323
|
+
const parent = parentNode(el);
|
|
3324
|
+
load().then(() => {
|
|
3325
|
+
if (instance.isUnmounted) return;
|
|
3326
|
+
hydrate();
|
|
3327
|
+
if (isComment(el, "[")) {
|
|
3328
|
+
const endAnchor = locateEndAnchor(el);
|
|
3329
|
+
removeFragmentNodes(el, endAnchor);
|
|
3330
|
+
insert(instance.block, parent, endAnchor);
|
|
3331
|
+
} else {
|
|
3332
|
+
insert(instance.block, parent, el);
|
|
3333
|
+
remove(el, parent);
|
|
3334
|
+
}
|
|
3335
|
+
});
|
|
3336
|
+
},
|
|
3337
|
+
{ deep: true, once: true }
|
|
3338
|
+
);
|
|
3339
|
+
performAsyncHydrate(
|
|
3340
|
+
el,
|
|
3341
|
+
instance,
|
|
3342
|
+
() => {
|
|
3343
|
+
hydrateNode(el, () => {
|
|
3344
|
+
hydrate();
|
|
3345
|
+
insert(instance.block, parentNode(el), el);
|
|
3346
|
+
isHydrated = true;
|
|
3347
|
+
});
|
|
3348
|
+
},
|
|
3349
|
+
getResolvedComp,
|
|
3350
|
+
load,
|
|
3351
|
+
hydrateStrategy
|
|
3352
|
+
);
|
|
3353
|
+
},
|
|
3354
|
+
get __asyncResolved() {
|
|
3355
|
+
return getResolvedComp();
|
|
3356
|
+
},
|
|
3357
|
+
setup() {
|
|
3358
|
+
const instance = currentInstance;
|
|
3359
|
+
markAsyncBoundary(instance);
|
|
3360
|
+
const frag = !!(process.env.NODE_ENV !== "production") || isHydrating ? new DynamicFragment("async component") : new DynamicFragment();
|
|
3361
|
+
let resolvedComp = getResolvedComp();
|
|
3362
|
+
if (resolvedComp) {
|
|
3363
|
+
frag.update(() => createInnerComp(resolvedComp, instance, frag));
|
|
3364
|
+
return frag;
|
|
3365
|
+
}
|
|
3366
|
+
const onError = (err) => {
|
|
3367
|
+
setPendingRequest(null);
|
|
3368
|
+
handleError(
|
|
3369
|
+
err,
|
|
3370
|
+
instance,
|
|
3371
|
+
13,
|
|
3372
|
+
!errorComponent
|
|
3373
|
+
);
|
|
3374
|
+
};
|
|
3375
|
+
if (suspensible && instance.suspense) ;
|
|
3376
|
+
const { loaded, error, delayed } = useAsyncComponentState(
|
|
3377
|
+
delay,
|
|
3378
|
+
timeout,
|
|
3379
|
+
onError
|
|
3380
|
+
);
|
|
3381
|
+
load().then(() => {
|
|
3382
|
+
loaded.value = true;
|
|
3383
|
+
}).catch((err) => {
|
|
3384
|
+
onError(err);
|
|
3385
|
+
error.value = err;
|
|
3386
|
+
});
|
|
3387
|
+
renderEffect(() => {
|
|
3388
|
+
resolvedComp = getResolvedComp();
|
|
3389
|
+
let render;
|
|
3390
|
+
if (loaded.value && resolvedComp) {
|
|
3391
|
+
render = () => createInnerComp(resolvedComp, instance, frag);
|
|
3392
|
+
} else if (error.value && errorComponent) {
|
|
3393
|
+
render = () => createComponent(errorComponent, { error: () => error.value });
|
|
3394
|
+
} else if (loadingComponent && !delayed.value) {
|
|
3395
|
+
render = () => createComponent(loadingComponent);
|
|
3396
|
+
}
|
|
3397
|
+
if (instance.$transition) frag.$transition = instance.$transition;
|
|
3398
|
+
frag.update(render);
|
|
3399
|
+
});
|
|
3400
|
+
return frag;
|
|
3401
|
+
}
|
|
3402
|
+
});
|
|
3403
|
+
}
|
|
3404
|
+
function createInnerComp(comp, parent, frag) {
|
|
3405
|
+
const { rawProps, rawSlots, isSingleRoot, appContext, $transition } = parent;
|
|
3406
|
+
const instance = createComponent(
|
|
3407
|
+
comp,
|
|
3408
|
+
rawProps,
|
|
3409
|
+
rawSlots,
|
|
3410
|
+
isSingleRoot,
|
|
3411
|
+
void 0,
|
|
3412
|
+
appContext
|
|
3413
|
+
);
|
|
3414
|
+
if (parent.parent && isKeepAlive(parent.parent)) {
|
|
3415
|
+
parent.parent.cacheComponent(instance);
|
|
3416
|
+
parent.parent.cacheComponent(parent);
|
|
1566
3417
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
3418
|
+
if ($transition) setTransitionHooks(instance, $transition);
|
|
3419
|
+
frag && frag.setRef && frag.setRef(instance);
|
|
3420
|
+
return instance;
|
|
1569
3421
|
}
|
|
1570
3422
|
|
|
1571
3423
|
let t;
|
|
@@ -1575,18 +3427,17 @@ function template(html, root) {
|
|
|
1575
3427
|
let node;
|
|
1576
3428
|
return () => {
|
|
1577
3429
|
if (isHydrating) {
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
return adoptTemplate(currentHydrationNode, html);
|
|
3430
|
+
const adopted = adoptTemplate(currentHydrationNode, html);
|
|
3431
|
+
if (root) adopted.$root = true;
|
|
3432
|
+
return adopted;
|
|
1582
3433
|
}
|
|
1583
3434
|
if (html[0] !== "<") {
|
|
1584
3435
|
return createTextNode(html);
|
|
1585
3436
|
}
|
|
1586
3437
|
if (!node) {
|
|
1587
|
-
t = t ||
|
|
3438
|
+
t = t || createElement("template");
|
|
1588
3439
|
t.innerHTML = html;
|
|
1589
|
-
node =
|
|
3440
|
+
node = _child(t.content);
|
|
1590
3441
|
}
|
|
1591
3442
|
const ret = node.cloneNode(true);
|
|
1592
3443
|
if (root) ret.$root = true;
|
|
@@ -1597,20 +3448,40 @@ function template(html, root) {
|
|
|
1597
3448
|
function createIf(condition, b1, b2, once) {
|
|
1598
3449
|
const _insertionParent = insertionParent;
|
|
1599
3450
|
const _insertionAnchor = insertionAnchor;
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
} else {
|
|
1603
|
-
resetInsertionState();
|
|
1604
|
-
}
|
|
3451
|
+
const _isLastInsertion = isLastInsertion;
|
|
3452
|
+
if (!isHydrating) resetInsertionState();
|
|
1605
3453
|
let frag;
|
|
1606
3454
|
if (once) {
|
|
1607
3455
|
frag = condition() ? b1() : b2 ? b2() : [];
|
|
1608
3456
|
} else {
|
|
1609
|
-
frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
3457
|
+
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
1610
3458
|
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
1611
3459
|
}
|
|
1612
|
-
if (!isHydrating
|
|
1613
|
-
insert(frag, _insertionParent, _insertionAnchor);
|
|
3460
|
+
if (!isHydrating) {
|
|
3461
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3462
|
+
} else {
|
|
3463
|
+
if (_isLastInsertion) {
|
|
3464
|
+
advanceHydrationNode(_insertionParent);
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
return frag;
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3470
|
+
function createKeyedFragment(key, render) {
|
|
3471
|
+
const _insertionParent = insertionParent;
|
|
3472
|
+
const _insertionAnchor = insertionAnchor;
|
|
3473
|
+
const _isLastInsertion = isLastInsertion;
|
|
3474
|
+
if (!isHydrating) resetInsertionState();
|
|
3475
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
3476
|
+
renderEffect(() => {
|
|
3477
|
+
frag.update(render, key());
|
|
3478
|
+
});
|
|
3479
|
+
if (!isHydrating) {
|
|
3480
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3481
|
+
} else {
|
|
3482
|
+
if (_isLastInsertion) {
|
|
3483
|
+
advanceHydrationNode(_insertionParent);
|
|
3484
|
+
}
|
|
1614
3485
|
}
|
|
1615
3486
|
return frag;
|
|
1616
3487
|
}
|
|
@@ -1628,6 +3499,7 @@ class ForBlock extends VaporFragment {
|
|
|
1628
3499
|
const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
1629
3500
|
const _insertionParent = insertionParent;
|
|
1630
3501
|
const _insertionAnchor = insertionAnchor;
|
|
3502
|
+
const _isLastInsertion = isLastInsertion;
|
|
1631
3503
|
if (isHydrating) {
|
|
1632
3504
|
locateHydrationNode();
|
|
1633
3505
|
} else {
|
|
@@ -1638,8 +3510,11 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1638
3510
|
let newBlocks;
|
|
1639
3511
|
let parent;
|
|
1640
3512
|
let currentKey;
|
|
1641
|
-
|
|
1642
|
-
|
|
3513
|
+
let parentAnchor;
|
|
3514
|
+
if (!isHydrating) {
|
|
3515
|
+
parentAnchor = !!(process.env.NODE_ENV !== "production") ? createComment("for") : createTextNode();
|
|
3516
|
+
}
|
|
3517
|
+
const frag = new ForFragment(oldBlocks);
|
|
1643
3518
|
const instance = currentInstance;
|
|
1644
3519
|
const canUseFastRemove = !!(flags & 1);
|
|
1645
3520
|
const isComponent = !!(flags & 2);
|
|
@@ -1652,15 +3527,33 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1652
3527
|
const newLength = source.values.length;
|
|
1653
3528
|
const oldLength = oldBlocks.length;
|
|
1654
3529
|
newBlocks = new Array(newLength);
|
|
3530
|
+
let isFallback = false;
|
|
1655
3531
|
const prevSub = setActiveSub();
|
|
1656
3532
|
if (!isMounted) {
|
|
1657
3533
|
isMounted = true;
|
|
1658
3534
|
for (let i = 0; i < newLength; i++) {
|
|
1659
|
-
mount(source, i);
|
|
3535
|
+
const nodes = mount(source, i).nodes;
|
|
3536
|
+
if (isHydrating) {
|
|
3537
|
+
setCurrentHydrationNode(findBlockNode(nodes).nextNode);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
if (isHydrating) {
|
|
3541
|
+
parentAnchor = newLength === 0 ? currentHydrationNode.nextSibling : currentHydrationNode;
|
|
3542
|
+
if (!!(process.env.NODE_ENV !== "production") && (!parentAnchor || parentAnchor && !isComment(parentAnchor, "]"))) {
|
|
3543
|
+
throw new Error(
|
|
3544
|
+
`v-for fragment anchor node was not found. this is likely a Vue internal bug.`
|
|
3545
|
+
);
|
|
3546
|
+
}
|
|
3547
|
+
if (_insertionParent) {
|
|
3548
|
+
updateLastLogicalChild(_insertionParent, parentAnchor);
|
|
3549
|
+
}
|
|
1660
3550
|
}
|
|
1661
3551
|
} else {
|
|
1662
3552
|
parent = parent || parentAnchor.parentNode;
|
|
1663
3553
|
if (!oldLength) {
|
|
3554
|
+
if (frag.fallback && frag.nodes[0].length > 0) {
|
|
3555
|
+
remove(frag.nodes[0], parent);
|
|
3556
|
+
}
|
|
1664
3557
|
for (let i = 0; i < newLength; i++) {
|
|
1665
3558
|
mount(source, i);
|
|
1666
3559
|
}
|
|
@@ -1676,6 +3569,10 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1676
3569
|
parent.textContent = "";
|
|
1677
3570
|
parent.appendChild(parentAnchor);
|
|
1678
3571
|
}
|
|
3572
|
+
if (frag.fallback) {
|
|
3573
|
+
insert(frag.nodes[0] = frag.fallback(), parent, parentAnchor);
|
|
3574
|
+
isFallback = true;
|
|
3575
|
+
}
|
|
1679
3576
|
} else if (!getKey) {
|
|
1680
3577
|
const commonLength = Math.min(newLength, oldLength);
|
|
1681
3578
|
for (let i = 0; i < commonLength; i++) {
|
|
@@ -1688,147 +3585,163 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1688
3585
|
unmount(oldBlocks[i]);
|
|
1689
3586
|
}
|
|
1690
3587
|
} else {
|
|
1691
|
-
|
|
1692
|
-
|
|
3588
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3589
|
+
const keyToIndexMap = /* @__PURE__ */ new Map();
|
|
3590
|
+
for (let i = 0; i < newLength; i++) {
|
|
3591
|
+
const item = getItem(source, i);
|
|
3592
|
+
const key = getKey(...item);
|
|
3593
|
+
if (key != null) {
|
|
3594
|
+
if (keyToIndexMap.has(key)) {
|
|
3595
|
+
warn(
|
|
3596
|
+
`Duplicate keys found during update:`,
|
|
3597
|
+
JSON.stringify(key),
|
|
3598
|
+
`Make sure keys are unique.`
|
|
3599
|
+
);
|
|
3600
|
+
}
|
|
3601
|
+
keyToIndexMap.set(key, i);
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
const commonLength = Math.min(oldLength, newLength);
|
|
3606
|
+
const oldKeyIndexPairs = new Array(oldLength);
|
|
1693
3607
|
const queuedBlocks = new Array(newLength);
|
|
1694
|
-
let anchorFallback = parentAnchor;
|
|
1695
3608
|
let endOffset = 0;
|
|
1696
|
-
let
|
|
1697
|
-
let
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
const
|
|
1701
|
-
const
|
|
1702
|
-
const currentKey2 = getKey(...currentItem);
|
|
3609
|
+
let queuedBlocksLength = 0;
|
|
3610
|
+
let oldKeyIndexPairsLength = 0;
|
|
3611
|
+
while (endOffset < commonLength) {
|
|
3612
|
+
const index = newLength - endOffset - 1;
|
|
3613
|
+
const item = getItem(source, index);
|
|
3614
|
+
const key = getKey(...item);
|
|
1703
3615
|
const existingBlock = oldBlocks[oldLength - endOffset - 1];
|
|
1704
|
-
if (existingBlock.key
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
continue;
|
|
1709
|
-
}
|
|
1710
|
-
if (endOffset !== 0) {
|
|
1711
|
-
anchorFallback = normalizeAnchor(newBlocks[currentIndex + 1].nodes);
|
|
1712
|
-
}
|
|
1713
|
-
break;
|
|
3616
|
+
if (existingBlock.key !== key) break;
|
|
3617
|
+
update(existingBlock, ...item);
|
|
3618
|
+
newBlocks[index] = existingBlock;
|
|
3619
|
+
endOffset++;
|
|
1714
3620
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
3621
|
+
const e1 = commonLength - endOffset;
|
|
3622
|
+
const e2 = oldLength - endOffset;
|
|
3623
|
+
const e3 = newLength - endOffset;
|
|
3624
|
+
for (let i = 0; i < e1; i++) {
|
|
3625
|
+
const currentItem = getItem(source, i);
|
|
1717
3626
|
const currentKey2 = getKey(...currentItem);
|
|
1718
|
-
const
|
|
1719
|
-
const
|
|
1720
|
-
if (
|
|
1721
|
-
update(newBlocks[
|
|
3627
|
+
const oldBlock = oldBlocks[i];
|
|
3628
|
+
const oldKey = oldBlock.key;
|
|
3629
|
+
if (oldKey === currentKey2) {
|
|
3630
|
+
update(newBlocks[i] = oldBlock, currentItem[0]);
|
|
1722
3631
|
} else {
|
|
1723
|
-
queuedBlocks[
|
|
1724
|
-
|
|
1725
|
-
currentItem,
|
|
1726
|
-
currentKey2
|
|
1727
|
-
];
|
|
1728
|
-
previousKeyIndexPairs[previousKeyIndexInsertIndex++] = [
|
|
1729
|
-
previousKey,
|
|
1730
|
-
startOffset
|
|
1731
|
-
];
|
|
3632
|
+
queuedBlocks[queuedBlocksLength++] = [i, currentItem, currentKey2];
|
|
3633
|
+
oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldKey, i];
|
|
1732
3634
|
}
|
|
1733
|
-
startOffset++;
|
|
1734
3635
|
}
|
|
1735
|
-
for (let i =
|
|
1736
|
-
|
|
1737
|
-
oldBlocks[i].key,
|
|
1738
|
-
i
|
|
1739
|
-
];
|
|
3636
|
+
for (let i = e1; i < e2; i++) {
|
|
3637
|
+
oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldBlocks[i].key, i];
|
|
1740
3638
|
}
|
|
1741
|
-
|
|
1742
|
-
newLength - endOffset,
|
|
1743
|
-
sharedBlockCount
|
|
1744
|
-
);
|
|
1745
|
-
for (let i = startOffset; i < preparationBlockCount; i++) {
|
|
3639
|
+
for (let i = e1; i < e3; i++) {
|
|
1746
3640
|
const blockItem = getItem(source, i);
|
|
1747
3641
|
const blockKey = getKey(...blockItem);
|
|
1748
|
-
queuedBlocks[
|
|
3642
|
+
queuedBlocks[queuedBlocksLength++] = [i, blockItem, blockKey];
|
|
1749
3643
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
3644
|
+
queuedBlocks.length = queuedBlocksLength;
|
|
3645
|
+
oldKeyIndexPairs.length = oldKeyIndexPairsLength;
|
|
3646
|
+
const oldKeyIndexMap = new Map(oldKeyIndexPairs);
|
|
3647
|
+
const opers = new Array(queuedBlocks.length);
|
|
3648
|
+
let mountCounter = 0;
|
|
3649
|
+
let opersLength = 0;
|
|
3650
|
+
for (let i = queuedBlocks.length - 1; i >= 0; i--) {
|
|
3651
|
+
const [index, item, key] = queuedBlocks[i];
|
|
3652
|
+
const oldIndex = oldKeyIndexMap.get(key);
|
|
3653
|
+
if (oldIndex !== void 0) {
|
|
3654
|
+
oldKeyIndexMap.delete(key);
|
|
3655
|
+
const reusedBlock = newBlocks[index] = oldBlocks[oldIndex];
|
|
3656
|
+
update(reusedBlock, ...item);
|
|
3657
|
+
opers[opersLength++] = { index, block: reusedBlock };
|
|
3658
|
+
} else {
|
|
3659
|
+
mountCounter++;
|
|
3660
|
+
opers[opersLength++] = { source, index, item, key };
|
|
1755
3661
|
}
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
parent,
|
|
1769
|
-
anchorOffset === -1 ? anchorFallback : normalizeAnchor(newBlocks[anchorOffset].nodes)
|
|
1770
|
-
);
|
|
1771
|
-
previousKeyIndexMap.delete(blockKey);
|
|
1772
|
-
} else {
|
|
1773
|
-
blocksToMount.push([
|
|
1774
|
-
blockIndex,
|
|
1775
|
-
blockItem,
|
|
1776
|
-
blockKey,
|
|
1777
|
-
anchorOffset
|
|
1778
|
-
]);
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
for (let i = queuedBlocks.length - 1; i >= 0; i--) {
|
|
1782
|
-
const [blockIndex, blockItem, blockKey] = queuedBlocks[i];
|
|
1783
|
-
relocateOrMountBlock(
|
|
1784
|
-
blockIndex,
|
|
1785
|
-
blockItem,
|
|
1786
|
-
blockKey,
|
|
1787
|
-
blockIndex < preparationBlockCount - 1 ? blockIndex + 1 : -1
|
|
1788
|
-
);
|
|
3662
|
+
}
|
|
3663
|
+
const useFastRemove = mountCounter === newLength;
|
|
3664
|
+
for (const leftoverIndex of oldKeyIndexMap.values()) {
|
|
3665
|
+
unmount(
|
|
3666
|
+
oldBlocks[leftoverIndex],
|
|
3667
|
+
!(useFastRemove && canUseFastRemove),
|
|
3668
|
+
!useFastRemove
|
|
3669
|
+
);
|
|
3670
|
+
}
|
|
3671
|
+
if (useFastRemove) {
|
|
3672
|
+
for (const selector of selectors) {
|
|
3673
|
+
selector.cleanup();
|
|
1789
3674
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
relocateOrMountBlock(i, blockItem, blockKey, -1);
|
|
3675
|
+
if (canUseFastRemove) {
|
|
3676
|
+
parent.textContent = "";
|
|
3677
|
+
parent.appendChild(parentAnchor);
|
|
1794
3678
|
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
3679
|
+
}
|
|
3680
|
+
if (opers.length === mountCounter) {
|
|
3681
|
+
for (const { source: source2, index, item, key } of opers) {
|
|
3682
|
+
mount(
|
|
3683
|
+
source2,
|
|
3684
|
+
index,
|
|
3685
|
+
index < newLength - 1 ? normalizeAnchor(newBlocks[index + 1].nodes) : parentAnchor,
|
|
3686
|
+
item,
|
|
3687
|
+
key
|
|
1801
3688
|
);
|
|
1802
3689
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
3690
|
+
} else if (opers.length) {
|
|
3691
|
+
let anchor = oldBlocks[0];
|
|
3692
|
+
let blocksTail;
|
|
3693
|
+
for (let i = 0; i < oldLength; i++) {
|
|
3694
|
+
const block = oldBlocks[i];
|
|
3695
|
+
if (oldKeyIndexMap.has(block.key)) {
|
|
3696
|
+
continue;
|
|
1806
3697
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
3698
|
+
block.prevAnchor = anchor;
|
|
3699
|
+
anchor = oldBlocks[i + 1];
|
|
3700
|
+
if (blocksTail !== void 0) {
|
|
3701
|
+
blocksTail.next = block;
|
|
3702
|
+
block.prev = blocksTail;
|
|
1810
3703
|
}
|
|
3704
|
+
blocksTail = block;
|
|
1811
3705
|
}
|
|
1812
|
-
for (const
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
source
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
3706
|
+
for (const action of opers) {
|
|
3707
|
+
const { index } = action;
|
|
3708
|
+
if (index < newLength - 1) {
|
|
3709
|
+
const nextBlock = newBlocks[index + 1];
|
|
3710
|
+
let anchorNode = normalizeAnchor(nextBlock.prevAnchor.nodes);
|
|
3711
|
+
if (!anchorNode.parentNode)
|
|
3712
|
+
anchorNode = normalizeAnchor(nextBlock.nodes);
|
|
3713
|
+
if ("source" in action) {
|
|
3714
|
+
const { item, key } = action;
|
|
3715
|
+
const block = mount(source, index, anchorNode, item, key);
|
|
3716
|
+
moveLink(block, nextBlock.prev, nextBlock);
|
|
3717
|
+
} else if (action.block.next !== nextBlock) {
|
|
3718
|
+
insert(action.block, parent, anchorNode);
|
|
3719
|
+
moveLink(action.block, nextBlock.prev, nextBlock);
|
|
3720
|
+
}
|
|
3721
|
+
} else if ("source" in action) {
|
|
3722
|
+
const { item, key } = action;
|
|
3723
|
+
const block = mount(source, index, parentAnchor, item, key);
|
|
3724
|
+
moveLink(block, blocksTail);
|
|
3725
|
+
blocksTail = block;
|
|
3726
|
+
} else if (action.block.next !== void 0) {
|
|
3727
|
+
let anchorNode = anchor ? normalizeAnchor(anchor.nodes) : parentAnchor;
|
|
3728
|
+
if (!anchorNode.parentNode) anchorNode = parentAnchor;
|
|
3729
|
+
insert(action.block, parent, anchorNode);
|
|
3730
|
+
moveLink(action.block, blocksTail);
|
|
3731
|
+
blocksTail = action.block;
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
for (const block of newBlocks) {
|
|
3735
|
+
block.prevAnchor = block.next = block.prev = void 0;
|
|
1825
3736
|
}
|
|
1826
3737
|
}
|
|
1827
3738
|
}
|
|
1828
3739
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
frag.nodes.push(parentAnchor);
|
|
3740
|
+
if (!isFallback) {
|
|
3741
|
+
frag.nodes = [oldBlocks = newBlocks];
|
|
3742
|
+
if (parentAnchor) frag.nodes.push(parentAnchor);
|
|
3743
|
+
} else {
|
|
3744
|
+
oldBlocks = [];
|
|
1832
3745
|
}
|
|
1833
3746
|
setActiveSub(prevSub);
|
|
1834
3747
|
};
|
|
@@ -1857,6 +3770,9 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1857
3770
|
indexRef,
|
|
1858
3771
|
key2
|
|
1859
3772
|
);
|
|
3773
|
+
if (frag.$transition) {
|
|
3774
|
+
applyTransitionHooks(block.nodes, frag.$transition, false);
|
|
3775
|
+
}
|
|
1860
3776
|
if (parent) insert(block.nodes, parent, anchor);
|
|
1861
3777
|
return block;
|
|
1862
3778
|
};
|
|
@@ -1892,15 +3808,17 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1892
3808
|
} else {
|
|
1893
3809
|
renderEffect(renderList);
|
|
1894
3810
|
}
|
|
1895
|
-
if (!isHydrating
|
|
1896
|
-
insert(frag, _insertionParent, _insertionAnchor);
|
|
3811
|
+
if (!isHydrating) {
|
|
3812
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3813
|
+
} else {
|
|
3814
|
+
advanceHydrationNode(_isLastInsertion ? _insertionParent : parentAnchor);
|
|
1897
3815
|
}
|
|
1898
3816
|
return frag;
|
|
1899
3817
|
function createSelector(source) {
|
|
1900
3818
|
let operMap = /* @__PURE__ */ new Map();
|
|
1901
3819
|
let activeKey = source();
|
|
1902
3820
|
let activeOpers;
|
|
1903
|
-
watch(source, (newValue) => {
|
|
3821
|
+
watch$1(source, (newValue) => {
|
|
1904
3822
|
if (activeOpers !== void 0) {
|
|
1905
3823
|
for (const oper of activeOpers) {
|
|
1906
3824
|
oper();
|
|
@@ -1940,6 +3858,21 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1940
3858
|
}
|
|
1941
3859
|
}
|
|
1942
3860
|
};
|
|
3861
|
+
function moveLink(block, newPrev, newNext) {
|
|
3862
|
+
const { prev: oldPrev, next: oldNext } = block;
|
|
3863
|
+
if (oldPrev) oldPrev.next = oldNext;
|
|
3864
|
+
if (oldNext) {
|
|
3865
|
+
oldNext.prev = oldPrev;
|
|
3866
|
+
if (block.prevAnchor !== block) {
|
|
3867
|
+
oldNext.prevAnchor = block.prevAnchor;
|
|
3868
|
+
}
|
|
3869
|
+
}
|
|
3870
|
+
if (newPrev) newPrev.next = block;
|
|
3871
|
+
if (newNext) newNext.prev = block;
|
|
3872
|
+
block.prev = newPrev;
|
|
3873
|
+
block.next = newNext;
|
|
3874
|
+
block.prevAnchor = block;
|
|
3875
|
+
}
|
|
1943
3876
|
function createForSlots(rawSource, getSlot) {
|
|
1944
3877
|
const source = normalizeSource(rawSource);
|
|
1945
3878
|
const sourceLength = source.values.length;
|
|
@@ -2015,16 +3948,34 @@ function getRestElement(val, keys) {
|
|
|
2015
3948
|
function getDefaultValue(val, defaultVal) {
|
|
2016
3949
|
return val === void 0 ? defaultVal : val;
|
|
2017
3950
|
}
|
|
3951
|
+
function isForBlock(block) {
|
|
3952
|
+
return block instanceof ForBlock;
|
|
3953
|
+
}
|
|
2018
3954
|
|
|
2019
3955
|
function createTemplateRefSetter() {
|
|
2020
3956
|
const instance = currentInstance;
|
|
2021
3957
|
return (...args) => setRef(instance, ...args);
|
|
2022
3958
|
}
|
|
2023
|
-
function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
3959
|
+
function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
2024
3960
|
if (!instance || instance.isUnmounted) return;
|
|
3961
|
+
if (isFragment(el) && el.setRef) {
|
|
3962
|
+
el.setRef(instance, ref, refFor, refKey);
|
|
3963
|
+
return;
|
|
3964
|
+
}
|
|
3965
|
+
const isVaporComp = isVaporComponent(el);
|
|
3966
|
+
if (isVaporComp && isAsyncWrapper(el)) {
|
|
3967
|
+
const i = el;
|
|
3968
|
+
const frag = i.block;
|
|
3969
|
+
if (!i.type.__asyncResolved) {
|
|
3970
|
+
frag.setRef = (i2) => setRef(instance, i2, ref, oldRef, refFor);
|
|
3971
|
+
return;
|
|
3972
|
+
}
|
|
3973
|
+
el = frag.nodes;
|
|
3974
|
+
}
|
|
2025
3975
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
2026
3976
|
const refValue = getRefValue(el);
|
|
2027
3977
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
3978
|
+
const canSetSetupRef = createCanSetSetupRefChecker(setupState);
|
|
2028
3979
|
if (oldRef != null && oldRef !== ref) {
|
|
2029
3980
|
if (isString(oldRef)) {
|
|
2030
3981
|
refs[oldRef] = null;
|
|
@@ -2051,28 +4002,30 @@ function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
|
2051
4002
|
if (_isString || _isRef) {
|
|
2052
4003
|
const doSet = () => {
|
|
2053
4004
|
if (refFor) {
|
|
2054
|
-
existing = _isString ? !!(process.env.NODE_ENV !== "production") &&
|
|
4005
|
+
existing = _isString ? !!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
2055
4006
|
if (!isArray(existing)) {
|
|
2056
4007
|
existing = [refValue];
|
|
2057
4008
|
if (_isString) {
|
|
2058
4009
|
refs[ref] = existing;
|
|
2059
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4010
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2060
4011
|
setupState[ref] = refs[ref];
|
|
2061
4012
|
existing = setupState[ref];
|
|
2062
4013
|
}
|
|
2063
4014
|
} else {
|
|
2064
4015
|
ref.value = existing;
|
|
4016
|
+
if (refKey) refs[refKey] = existing;
|
|
2065
4017
|
}
|
|
2066
4018
|
} else if (!existing.includes(refValue)) {
|
|
2067
4019
|
existing.push(refValue);
|
|
2068
4020
|
}
|
|
2069
4021
|
} else if (_isString) {
|
|
2070
4022
|
refs[ref] = refValue;
|
|
2071
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4023
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2072
4024
|
setupState[ref] = refValue;
|
|
2073
4025
|
}
|
|
2074
4026
|
} else if (_isRef) {
|
|
2075
4027
|
ref.value = refValue;
|
|
4028
|
+
if (refKey) refs[refKey] = refValue;
|
|
2076
4029
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2077
4030
|
warn("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
2078
4031
|
}
|
|
@@ -2084,11 +4037,12 @@ function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
|
2084
4037
|
remove$1(existing, refValue);
|
|
2085
4038
|
} else if (_isString) {
|
|
2086
4039
|
refs[ref] = null;
|
|
2087
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4040
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2088
4041
|
setupState[ref] = null;
|
|
2089
4042
|
}
|
|
2090
4043
|
} else if (_isRef) {
|
|
2091
4044
|
ref.value = null;
|
|
4045
|
+
if (refKey) refs[refKey] = null;
|
|
2092
4046
|
}
|
|
2093
4047
|
});
|
|
2094
4048
|
});
|
|
@@ -2107,29 +4061,35 @@ const getRefValue = (el) => {
|
|
|
2107
4061
|
return el;
|
|
2108
4062
|
};
|
|
2109
4063
|
|
|
2110
|
-
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot) {
|
|
4064
|
+
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once) {
|
|
2111
4065
|
const _insertionParent = insertionParent;
|
|
2112
4066
|
const _insertionAnchor = insertionAnchor;
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
}
|
|
2118
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
2119
|
-
renderEffect(() => {
|
|
4067
|
+
const _isLastInsertion = isLastInsertion;
|
|
4068
|
+
if (!isHydrating) resetInsertionState();
|
|
4069
|
+
const frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
4070
|
+
const renderFn = () => {
|
|
2120
4071
|
const value = getter();
|
|
4072
|
+
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
2121
4073
|
frag.update(
|
|
2122
4074
|
() => createComponentWithFallback(
|
|
2123
4075
|
resolveDynamicComponent(value),
|
|
2124
4076
|
rawProps,
|
|
2125
4077
|
rawSlots,
|
|
2126
|
-
isSingleRoot
|
|
4078
|
+
isSingleRoot,
|
|
4079
|
+
once,
|
|
4080
|
+
appContext
|
|
2127
4081
|
),
|
|
2128
4082
|
value
|
|
2129
4083
|
);
|
|
2130
|
-
}
|
|
2131
|
-
if (
|
|
2132
|
-
|
|
4084
|
+
};
|
|
4085
|
+
if (once) renderFn();
|
|
4086
|
+
else renderEffect(renderFn);
|
|
4087
|
+
if (!isHydrating) {
|
|
4088
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4089
|
+
} else {
|
|
4090
|
+
if (_isLastInsertion) {
|
|
4091
|
+
advanceHydrationNode(_insertionParent);
|
|
4092
|
+
}
|
|
2133
4093
|
}
|
|
2134
4094
|
return frag;
|
|
2135
4095
|
}
|
|
@@ -2147,6 +4107,12 @@ function applyVShow(target, source) {
|
|
|
2147
4107
|
update.call(target, render, key);
|
|
2148
4108
|
setDisplay(target, source());
|
|
2149
4109
|
};
|
|
4110
|
+
} else if (target instanceof VaporFragment && target.insert) {
|
|
4111
|
+
const insert = target.insert;
|
|
4112
|
+
target.insert = (parent, anchor) => {
|
|
4113
|
+
insert.call(target, parent, anchor);
|
|
4114
|
+
setDisplay(target, source());
|
|
4115
|
+
};
|
|
2150
4116
|
}
|
|
2151
4117
|
renderEffect(() => setDisplay(target, source()));
|
|
2152
4118
|
}
|
|
@@ -2154,18 +4120,54 @@ function setDisplay(target, value) {
|
|
|
2154
4120
|
if (isVaporComponent(target)) {
|
|
2155
4121
|
return setDisplay(target, value);
|
|
2156
4122
|
}
|
|
2157
|
-
if (isArray(target)
|
|
2158
|
-
|
|
4123
|
+
if (isArray(target)) {
|
|
4124
|
+
if (target.length === 0) return;
|
|
4125
|
+
if (target.length === 1) return setDisplay(target[0], value);
|
|
2159
4126
|
}
|
|
2160
4127
|
if (target instanceof DynamicFragment) {
|
|
2161
4128
|
return setDisplay(target.nodes, value);
|
|
2162
4129
|
}
|
|
4130
|
+
if (target instanceof VaporFragment && target.insert) {
|
|
4131
|
+
return setDisplay(target.nodes, value);
|
|
4132
|
+
}
|
|
4133
|
+
const { $transition } = target;
|
|
2163
4134
|
if (target instanceof Element) {
|
|
2164
4135
|
const el = target;
|
|
2165
4136
|
if (!(vShowOriginalDisplay in el)) {
|
|
2166
4137
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
2167
4138
|
}
|
|
2168
|
-
|
|
4139
|
+
if ($transition) {
|
|
4140
|
+
if (value) {
|
|
4141
|
+
$transition.beforeEnter(target);
|
|
4142
|
+
el.style.display = el[vShowOriginalDisplay];
|
|
4143
|
+
$transition.enter(target);
|
|
4144
|
+
} else {
|
|
4145
|
+
if (target.isConnected) {
|
|
4146
|
+
$transition.leave(target, () => {
|
|
4147
|
+
el.style.display = "none";
|
|
4148
|
+
});
|
|
4149
|
+
} else {
|
|
4150
|
+
el.style.display = "none";
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
} else {
|
|
4154
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating) {
|
|
4155
|
+
if (!value && el.style.display !== "none") {
|
|
4156
|
+
warnPropMismatch(
|
|
4157
|
+
el,
|
|
4158
|
+
"style",
|
|
4159
|
+
3,
|
|
4160
|
+
`display: ${el.style.display}`,
|
|
4161
|
+
"display: none"
|
|
4162
|
+
);
|
|
4163
|
+
logMismatchError();
|
|
4164
|
+
el.style.display = "none";
|
|
4165
|
+
el[vShowOriginalDisplay] = "";
|
|
4166
|
+
}
|
|
4167
|
+
} else {
|
|
4168
|
+
el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
2169
4171
|
el[vShowHidden] = !value;
|
|
2170
4172
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2171
4173
|
warn(
|
|
@@ -2244,4 +4246,153 @@ function withVaporDirectives(node, dirs) {
|
|
|
2244
4246
|
}
|
|
2245
4247
|
}
|
|
2246
4248
|
|
|
2247
|
-
|
|
4249
|
+
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
4250
|
+
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
4251
|
+
const decorate = (t) => {
|
|
4252
|
+
delete t.props.mode;
|
|
4253
|
+
t.__vapor = true;
|
|
4254
|
+
return t;
|
|
4255
|
+
};
|
|
4256
|
+
const VaporTransitionGroup = decorate({
|
|
4257
|
+
name: "VaporTransitionGroup",
|
|
4258
|
+
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
4259
|
+
tag: String,
|
|
4260
|
+
moveClass: String
|
|
4261
|
+
}),
|
|
4262
|
+
setup(props, { slots }) {
|
|
4263
|
+
const instance = currentInstance;
|
|
4264
|
+
const state = useTransitionState();
|
|
4265
|
+
const cssTransitionProps = resolveTransitionProps(props);
|
|
4266
|
+
let prevChildren;
|
|
4267
|
+
let children;
|
|
4268
|
+
const slottedBlock = slots.default && slots.default();
|
|
4269
|
+
onBeforeUpdate(() => {
|
|
4270
|
+
prevChildren = [];
|
|
4271
|
+
children = getTransitionBlocks(slottedBlock);
|
|
4272
|
+
if (children) {
|
|
4273
|
+
for (let i = 0; i < children.length; i++) {
|
|
4274
|
+
const child = children[i];
|
|
4275
|
+
if (isValidTransitionBlock(child)) {
|
|
4276
|
+
prevChildren.push(child);
|
|
4277
|
+
child.$transition.disabled = true;
|
|
4278
|
+
positionMap.set(
|
|
4279
|
+
child,
|
|
4280
|
+
getTransitionElement(child).getBoundingClientRect()
|
|
4281
|
+
);
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
});
|
|
4286
|
+
onUpdated(() => {
|
|
4287
|
+
if (!prevChildren.length) {
|
|
4288
|
+
return;
|
|
4289
|
+
}
|
|
4290
|
+
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
4291
|
+
const firstChild = getFirstConnectedChild(prevChildren);
|
|
4292
|
+
if (!firstChild || !hasCSSTransform(
|
|
4293
|
+
firstChild,
|
|
4294
|
+
firstChild.parentNode,
|
|
4295
|
+
moveClass
|
|
4296
|
+
)) {
|
|
4297
|
+
prevChildren = [];
|
|
4298
|
+
return;
|
|
4299
|
+
}
|
|
4300
|
+
prevChildren.forEach(callPendingCbs);
|
|
4301
|
+
prevChildren.forEach((child) => {
|
|
4302
|
+
child.$transition.disabled = false;
|
|
4303
|
+
recordPosition(child);
|
|
4304
|
+
});
|
|
4305
|
+
const movedChildren = prevChildren.filter(applyTranslation);
|
|
4306
|
+
forceReflow();
|
|
4307
|
+
movedChildren.forEach(
|
|
4308
|
+
(c) => handleMovedChildren(
|
|
4309
|
+
getTransitionElement(c),
|
|
4310
|
+
moveClass
|
|
4311
|
+
)
|
|
4312
|
+
);
|
|
4313
|
+
prevChildren = [];
|
|
4314
|
+
});
|
|
4315
|
+
setTransitionHooksOnFragment(slottedBlock, {
|
|
4316
|
+
props: cssTransitionProps,
|
|
4317
|
+
state,
|
|
4318
|
+
instance
|
|
4319
|
+
});
|
|
4320
|
+
children = getTransitionBlocks(slottedBlock);
|
|
4321
|
+
for (let i = 0; i < children.length; i++) {
|
|
4322
|
+
const child = children[i];
|
|
4323
|
+
if (isValidTransitionBlock(child)) {
|
|
4324
|
+
if (child.$key != null) {
|
|
4325
|
+
setTransitionHooks(
|
|
4326
|
+
child,
|
|
4327
|
+
resolveTransitionHooks(child, cssTransitionProps, state, instance)
|
|
4328
|
+
);
|
|
4329
|
+
} else if (!!(process.env.NODE_ENV !== "production") && child.$key == null) {
|
|
4330
|
+
warn(`<transition-group> children must be keyed`);
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
const tag = props.tag;
|
|
4335
|
+
if (tag) {
|
|
4336
|
+
const container = createElement(tag);
|
|
4337
|
+
insert(slottedBlock, container);
|
|
4338
|
+
if (instance.hasFallthrough) {
|
|
4339
|
+
container.$root = true;
|
|
4340
|
+
renderEffect(() => applyFallthroughProps(container, instance.attrs));
|
|
4341
|
+
}
|
|
4342
|
+
return container;
|
|
4343
|
+
} else {
|
|
4344
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("transition-group") : new DynamicFragment();
|
|
4345
|
+
renderEffect(() => frag.update(() => slottedBlock));
|
|
4346
|
+
return frag;
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
});
|
|
4350
|
+
function getTransitionBlocks(block) {
|
|
4351
|
+
let children = [];
|
|
4352
|
+
if (block instanceof Node) {
|
|
4353
|
+
children.push(block);
|
|
4354
|
+
} else if (isVaporComponent(block)) {
|
|
4355
|
+
children.push(...getTransitionBlocks(block.block));
|
|
4356
|
+
} else if (isArray(block)) {
|
|
4357
|
+
for (let i = 0; i < block.length; i++) {
|
|
4358
|
+
const b = block[i];
|
|
4359
|
+
const blocks = getTransitionBlocks(b);
|
|
4360
|
+
if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
|
|
4361
|
+
children.push(...blocks);
|
|
4362
|
+
}
|
|
4363
|
+
} else if (isFragment(block)) {
|
|
4364
|
+
if (block.insert) {
|
|
4365
|
+
children.push(block);
|
|
4366
|
+
} else {
|
|
4367
|
+
children.push(...getTransitionBlocks(block.nodes));
|
|
4368
|
+
}
|
|
4369
|
+
}
|
|
4370
|
+
return children;
|
|
4371
|
+
}
|
|
4372
|
+
function isValidTransitionBlock(block) {
|
|
4373
|
+
return !!(block instanceof Element || isFragment(block) && block.insert);
|
|
4374
|
+
}
|
|
4375
|
+
function getTransitionElement(c) {
|
|
4376
|
+
return isFragment(c) ? c.nodes : c;
|
|
4377
|
+
}
|
|
4378
|
+
function recordPosition(c) {
|
|
4379
|
+
newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
|
|
4380
|
+
}
|
|
4381
|
+
function applyTranslation(c) {
|
|
4382
|
+
if (baseApplyTranslation(
|
|
4383
|
+
positionMap.get(c),
|
|
4384
|
+
newPositionMap.get(c),
|
|
4385
|
+
getTransitionElement(c)
|
|
4386
|
+
)) {
|
|
4387
|
+
return c;
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
function getFirstConnectedChild(children) {
|
|
4391
|
+
for (let i = 0; i < children.length; i++) {
|
|
4392
|
+
const child = children[i];
|
|
4393
|
+
const el = getTransitionElement(child);
|
|
4394
|
+
if (el.isConnected) return el;
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
|
|
4398
|
+
export { VaporFragment, VaporKeepAliveImpl as VaporKeepAlive, VaporTeleportImpl as VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createKeyedFragment, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockText, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
|