@vue/runtime-vapor 3.6.0-alpha.1 → 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 +160 -36
- package/dist/runtime-vapor.esm-bundler.js +3158 -1010
- package/package.json +4 -4
|
@@ -1,282 +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 {
|
|
7
|
-
import { isArray, EMPTY_OBJ, hasOwn,
|
|
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;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
class DynamicFragment extends VaporFragment {
|
|
129
|
-
constructor(anchorLabel) {
|
|
130
|
-
super([]);
|
|
131
|
-
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? createComment(anchorLabel) : createTextNode();
|
|
155
|
+
function locateEndAnchor(node, open = "[", close = "]") {
|
|
156
|
+
if (node.$fe) {
|
|
157
|
+
return node.$fe;
|
|
132
158
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
if (render) {
|
|
145
|
-
this.scope = new EffectScope();
|
|
146
|
-
this.nodes = this.scope.run(render) || [];
|
|
147
|
-
if (parent) insert(this.nodes, parent, this.anchor);
|
|
148
|
-
} else {
|
|
149
|
-
this.scope = void 0;
|
|
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);
|
|
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
|
+
}
|
|
156
169
|
}
|
|
157
|
-
setActiveSub(prevSub);
|
|
158
170
|
}
|
|
171
|
+
return null;
|
|
159
172
|
}
|
|
160
|
-
function
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
173
|
+
function locateFragmentEndAnchor(label = "]") {
|
|
174
|
+
let node = currentHydrationNode;
|
|
175
|
+
while (node) {
|
|
176
|
+
if (isComment(node, label)) return node;
|
|
177
|
+
node = node.nextSibling;
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
165
180
|
}
|
|
166
|
-
function
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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);
|
|
175
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;
|
|
176
212
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if (
|
|
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);
|
|
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));
|
|
196
227
|
} else {
|
|
197
|
-
|
|
228
|
+
break;
|
|
198
229
|
}
|
|
199
|
-
if (block.anchor) insert(block.anchor, parent, anchor);
|
|
200
230
|
}
|
|
201
231
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
232
|
+
|
|
233
|
+
// @__NO_SIDE_EFFECTS__
|
|
234
|
+
function createElement(tagName) {
|
|
235
|
+
return document.createElement(tagName);
|
|
205
236
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
} else if (isVaporComponent(block)) {
|
|
210
|
-
unmountComponent(block, parent);
|
|
211
|
-
} else if (isArray(block)) {
|
|
212
|
-
for (let i = 0; i < block.length; i++) {
|
|
213
|
-
remove(block[i], parent);
|
|
214
|
-
}
|
|
215
|
-
} else {
|
|
216
|
-
if (block.remove) {
|
|
217
|
-
block.remove(parent);
|
|
218
|
-
} else {
|
|
219
|
-
remove(block.nodes, parent);
|
|
220
|
-
}
|
|
221
|
-
if (block.anchor) remove(block.anchor, parent);
|
|
222
|
-
if (block.scope) {
|
|
223
|
-
block.scope.stop();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
237
|
+
// @__NO_SIDE_EFFECTS__
|
|
238
|
+
function createTextNode(value = "") {
|
|
239
|
+
return document.createTextNode(value);
|
|
226
240
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
"normalizeBlock should not be used in production code paths"
|
|
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;
|
|
241
|
+
// @__NO_SIDE_EFFECTS__
|
|
242
|
+
function createComment(data) {
|
|
243
|
+
return document.createComment(data);
|
|
245
244
|
}
|
|
246
|
-
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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());
|
|
258
259
|
}
|
|
259
|
-
return
|
|
260
|
+
return n;
|
|
261
|
+
};
|
|
262
|
+
// @__NO_SIDE_EFFECTS__
|
|
263
|
+
function _child(node) {
|
|
264
|
+
return node.firstChild;
|
|
260
265
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
// @__NO_SIDE_EFFECTS__
|
|
267
|
+
function __child(node, logicalIndex = 0) {
|
|
268
|
+
return locateChildByLogicalIndex(node, logicalIndex);
|
|
269
|
+
}
|
|
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
|
|
268
287
|
);
|
|
269
288
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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;
|
|
277
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++;
|
|
278
330
|
}
|
|
279
|
-
return
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
function updateLastLogicalChild(parent, child2) {
|
|
334
|
+
if (!isComment(child2, "]")) return;
|
|
335
|
+
child2.$idx = parent.$curIdx || 0;
|
|
336
|
+
parent.$llc = child2;
|
|
280
337
|
}
|
|
281
338
|
|
|
282
339
|
class RenderEffect extends ReactiveEffect {
|
|
@@ -300,6 +357,7 @@ class RenderEffect extends ReactiveEffect {
|
|
|
300
357
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
301
358
|
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
302
359
|
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
360
|
+
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
303
361
|
}
|
|
304
362
|
job.i = instance;
|
|
305
363
|
}
|
|
@@ -342,282 +400,591 @@ function renderEffect(fn, noLifecycle = false) {
|
|
|
342
400
|
effect.run();
|
|
343
401
|
}
|
|
344
402
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
source = dynamicSources[i];
|
|
366
|
-
isDynamic = isFunction(source);
|
|
367
|
-
source = isDynamic ? source() : source;
|
|
368
|
-
for (rawKey in source) {
|
|
369
|
-
if (camelize(rawKey) === key) {
|
|
370
|
-
return resolvePropValue(
|
|
371
|
-
propsOptions,
|
|
372
|
-
key,
|
|
373
|
-
isDynamic ? source[rawKey] : source[rawKey](),
|
|
374
|
-
instance,
|
|
375
|
-
resolveDefault
|
|
376
|
-
);
|
|
377
|
-
}
|
|
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;
|
|
378
423
|
}
|
|
424
|
+
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
425
|
+
setCurrentHydrationNode(firstChild);
|
|
379
426
|
}
|
|
380
427
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
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;
|
|
390
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
|
+
});
|
|
391
462
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
463
|
+
const hooks = applyTransitionHooks(
|
|
464
|
+
children,
|
|
465
|
+
{
|
|
466
|
+
state: useTransitionState(),
|
|
467
|
+
props: resolvedProps,
|
|
468
|
+
instance
|
|
469
|
+
},
|
|
470
|
+
fallthroughAttrs
|
|
399
471
|
);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
getOwnPropertyDescriptor(target, key) {
|
|
406
|
-
if (isProp(key)) {
|
|
407
|
-
return {
|
|
408
|
-
configurable: true,
|
|
409
|
-
enumerable: true,
|
|
410
|
-
get: () => getProp(target, key)
|
|
411
|
-
};
|
|
412
|
-
}
|
|
472
|
+
if (resetDisplay && resolvedProps.appear) {
|
|
473
|
+
const child = findTransitionBlock(children);
|
|
474
|
+
hooks.beforeEnter(child);
|
|
475
|
+
resetDisplay();
|
|
476
|
+
queuePostFlushCb(() => hooks.enter(child));
|
|
413
477
|
}
|
|
414
|
-
|
|
415
|
-
if (!!(process.env.NODE_ENV !== "production") && propsOptions) {
|
|
416
|
-
Object.assign(propsHandlers, {
|
|
417
|
-
set: propsSetDevTrap,
|
|
418
|
-
deleteProperty: propsDeleteDevTrap
|
|
419
|
-
});
|
|
478
|
+
return children;
|
|
420
479
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
if (hasAttr(target.rawProps, key)) {
|
|
439
|
-
return {
|
|
440
|
-
configurable: true,
|
|
441
|
-
enumerable: true,
|
|
442
|
-
get: () => getAttr(target.rawProps, key)
|
|
443
|
-
};
|
|
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]();
|
|
444
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;
|
|
445
509
|
}
|
|
446
510
|
};
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
+
}
|
|
452
540
|
}
|
|
453
|
-
|
|
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;
|
|
454
563
|
}
|
|
455
|
-
function
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
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;
|
|
473
624
|
}
|
|
625
|
+
child = item;
|
|
626
|
+
hasFound = true;
|
|
627
|
+
if (!!!(process.env.NODE_ENV !== "production")) break;
|
|
474
628
|
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
if (
|
|
478
|
-
|
|
629
|
+
} else if (isFragment(block)) {
|
|
630
|
+
inFragment = true;
|
|
631
|
+
if (block.insert) {
|
|
632
|
+
child = block;
|
|
479
633
|
} else {
|
|
480
|
-
|
|
634
|
+
child = findTransitionBlock(block.nodes, true);
|
|
481
635
|
}
|
|
482
636
|
}
|
|
483
|
-
if (
|
|
484
|
-
|
|
637
|
+
if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
|
|
638
|
+
warn("Transition component has no valid child element");
|
|
485
639
|
}
|
|
640
|
+
return child;
|
|
486
641
|
}
|
|
487
|
-
function
|
|
488
|
-
if (
|
|
489
|
-
|
|
490
|
-
if (
|
|
491
|
-
let i =
|
|
492
|
-
|
|
493
|
-
const source = resolveSource(dynamicSources[i]);
|
|
494
|
-
if (source && hasOwn(source, key)) {
|
|
495
|
-
return true;
|
|
496
|
-
}
|
|
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);
|
|
497
648
|
}
|
|
498
649
|
}
|
|
499
|
-
return hasOwn(rawProps, key);
|
|
500
650
|
}
|
|
501
|
-
function
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
if (
|
|
505
|
-
}
|
|
506
|
-
const dynamicSources = rawProps.$;
|
|
507
|
-
if (dynamicSources) {
|
|
508
|
-
let i = dynamicSources.length;
|
|
509
|
-
let source;
|
|
510
|
-
while (i--) {
|
|
511
|
-
source = resolveSource(dynamicSources[i]);
|
|
512
|
-
for (const key in source) {
|
|
513
|
-
keys.push(key);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
651
|
+
function setTransitionHooks(block, hooks) {
|
|
652
|
+
if (isVaporComponent(block)) {
|
|
653
|
+
block = findTransitionBlock(block.block);
|
|
654
|
+
if (!block) return;
|
|
516
655
|
}
|
|
517
|
-
|
|
656
|
+
block.$transition = hooks;
|
|
518
657
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
const needCastKeys = [];
|
|
526
|
-
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
527
|
-
return comp.__propsOptions = [normalized, needCastKeys];
|
|
658
|
+
|
|
659
|
+
class VaporFragment {
|
|
660
|
+
constructor(nodes) {
|
|
661
|
+
this.vnode = null;
|
|
662
|
+
this.nodes = nodes;
|
|
663
|
+
}
|
|
528
664
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return res;
|
|
665
|
+
class ForFragment extends VaporFragment {
|
|
666
|
+
constructor(nodes) {
|
|
667
|
+
super(nodes);
|
|
668
|
+
}
|
|
534
669
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
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;
|
|
544
704
|
}
|
|
545
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();
|
|
546
719
|
}
|
|
547
720
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
if (!rawProps) return;
|
|
553
|
-
renderEffect(
|
|
554
|
-
() => {
|
|
555
|
-
pushWarningContext(instance);
|
|
556
|
-
validateProps(
|
|
557
|
-
resolveDynamicProps(rawProps),
|
|
558
|
-
instance.props,
|
|
559
|
-
normalizePropsOptions(instance.type)[0]
|
|
560
|
-
);
|
|
561
|
-
popWarningContext();
|
|
562
|
-
},
|
|
563
|
-
true
|
|
564
|
-
/* noLifecycle */
|
|
565
|
-
);
|
|
566
|
-
}
|
|
567
|
-
function resolveDynamicProps(props) {
|
|
568
|
-
const mergedRawProps = {};
|
|
569
|
-
for (const key in props) {
|
|
570
|
-
if (key !== "$") {
|
|
571
|
-
mergedRawProps[key] = props[key]();
|
|
721
|
+
update(render, key = render) {
|
|
722
|
+
if (key === this.current) {
|
|
723
|
+
if (isHydrating) this.hydrate(true);
|
|
724
|
+
return;
|
|
572
725
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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);
|
|
584
769
|
} else {
|
|
585
|
-
|
|
770
|
+
this.nodes = this.fallback() || [];
|
|
586
771
|
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
}
|
|
772
|
+
});
|
|
773
|
+
parent && insert(this.nodes, parent, this.anchor);
|
|
590
774
|
}
|
|
591
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
|
+
}
|
|
592
801
|
}
|
|
593
|
-
return mergedRawProps;
|
|
594
802
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
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
|
+
}
|
|
600
819
|
}
|
|
601
|
-
function
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
)
|
|
605
|
-
|
|
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 ;
|
|
606
826
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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),
|
|
611
844
|
getOwnPropertyDescriptor(target, key) {
|
|
612
|
-
|
|
845
|
+
const slot = getSlot(target, key);
|
|
846
|
+
if (slot) {
|
|
613
847
|
return {
|
|
614
848
|
configurable: true,
|
|
615
849
|
enumerable: true,
|
|
616
|
-
|
|
850
|
+
value: slot
|
|
617
851
|
};
|
|
618
852
|
}
|
|
619
|
-
}
|
|
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
|
|
620
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
|
+
}
|
|
621
988
|
|
|
622
989
|
function addEventListener(el, event, handler, options) {
|
|
623
990
|
el.addEventListener(event, handler, options);
|
|
@@ -708,6 +1075,10 @@ function setAttr(el, key, value) {
|
|
|
708
1075
|
} else if (key === "false-value") {
|
|
709
1076
|
el._falseValue = value;
|
|
710
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
|
+
}
|
|
711
1082
|
if (value !== el[`$${key}`]) {
|
|
712
1083
|
el[`$${key}`] = value;
|
|
713
1084
|
if (value != null) {
|
|
@@ -717,10 +1088,13 @@ function setAttr(el, key, value) {
|
|
|
717
1088
|
}
|
|
718
1089
|
}
|
|
719
1090
|
}
|
|
720
|
-
function setDOMProp(el, key, value) {
|
|
1091
|
+
function setDOMProp(el, key, value, forceHydrate = false) {
|
|
721
1092
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
722
1093
|
return;
|
|
723
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
|
+
}
|
|
724
1098
|
const prev = el[key];
|
|
725
1099
|
if (value === prev) {
|
|
726
1100
|
return;
|
|
@@ -728,7 +1102,9 @@ function setDOMProp(el, key, value) {
|
|
|
728
1102
|
let needRemove = false;
|
|
729
1103
|
if (value === "" || value == null) {
|
|
730
1104
|
const type = typeof prev;
|
|
731
|
-
if (
|
|
1105
|
+
if (type === "boolean") {
|
|
1106
|
+
value = includeBooleanAttr(value);
|
|
1107
|
+
} else if (value == null && type === "string") {
|
|
732
1108
|
value = "";
|
|
733
1109
|
needRemove = true;
|
|
734
1110
|
} else if (type === "number") {
|
|
@@ -751,14 +1127,26 @@ function setDOMProp(el, key, value) {
|
|
|
751
1127
|
function setClass(el, value) {
|
|
752
1128
|
if (el.$root) {
|
|
753
1129
|
setClassIncremental(el, value);
|
|
754
|
-
} else
|
|
755
|
-
|
|
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
|
+
}
|
|
756
1139
|
}
|
|
757
1140
|
}
|
|
758
1141
|
function setClassIncremental(el, value) {
|
|
759
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
|
+
}
|
|
760
1148
|
const prev = el[cacheKey];
|
|
761
|
-
if ((value = el[cacheKey] =
|
|
1149
|
+
if ((value = el[cacheKey] = normalizedValue) !== prev) {
|
|
762
1150
|
const nextList = value.split(/\s+/);
|
|
763
1151
|
if (value) {
|
|
764
1152
|
el.classList.add(...nextList);
|
|
@@ -774,23 +1162,31 @@ function setStyle(el, value) {
|
|
|
774
1162
|
if (el.$root) {
|
|
775
1163
|
setStyleIncremental(el, value);
|
|
776
1164
|
} else {
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
|
|
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);
|
|
780
1171
|
}
|
|
781
1172
|
}
|
|
782
1173
|
function setStyleIncremental(el, value) {
|
|
783
1174
|
const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
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);
|
|
788
1181
|
}
|
|
789
|
-
function setValue(el, value) {
|
|
1182
|
+
function setValue(el, value, forceHydrate = false) {
|
|
790
1183
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
791
1184
|
return;
|
|
792
1185
|
}
|
|
793
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
|
+
}
|
|
794
1190
|
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
795
1191
|
const newValue = value == null ? "" : value;
|
|
796
1192
|
if (oldValue !== newValue) {
|
|
@@ -801,21 +1197,105 @@ function setValue(el, value) {
|
|
|
801
1197
|
}
|
|
802
1198
|
}
|
|
803
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
|
+
}
|
|
804
1215
|
if (el.$txt !== value) {
|
|
805
1216
|
el.nodeValue = el.$txt = value;
|
|
806
1217
|
}
|
|
807
1218
|
}
|
|
808
1219
|
function setElementText(el, value) {
|
|
809
|
-
|
|
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) {
|
|
810
1239
|
el.textContent = el.$txt = value;
|
|
811
1240
|
}
|
|
812
1241
|
}
|
|
813
|
-
function
|
|
1242
|
+
function setBlockText(block, value) {
|
|
814
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);
|
|
815
1272
|
if (el.$html !== value) {
|
|
816
1273
|
el.innerHTML = el.$html = value;
|
|
817
1274
|
}
|
|
818
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
|
+
}
|
|
819
1299
|
function setDynamicProps(el, args) {
|
|
820
1300
|
const props = args.length > 1 ? mergeProps(...args) : args[0];
|
|
821
1301
|
const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
|
|
@@ -833,21 +1313,25 @@ function setDynamicProps(el, args) {
|
|
|
833
1313
|
}
|
|
834
1314
|
function setDynamicProp(el, key, value) {
|
|
835
1315
|
const isSVG = false;
|
|
1316
|
+
let forceHydrate = false;
|
|
836
1317
|
if (key === "class") {
|
|
837
1318
|
setClass(el, value);
|
|
838
1319
|
} else if (key === "style") {
|
|
839
1320
|
setStyle(el, value);
|
|
840
1321
|
} else if (isOn(key)) {
|
|
841
1322
|
on(el, key[2].toLowerCase() + key.slice(3), value, { effect: true });
|
|
842
|
-
} 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
|
+
) {
|
|
843
1327
|
if (key === "innerHTML") {
|
|
844
1328
|
setHtml(el, value);
|
|
845
1329
|
} else if (key === "textContent") {
|
|
846
1330
|
setElementText(el, value);
|
|
847
1331
|
} else if (key === "value" && canSetValueDirectly(el.tagName)) {
|
|
848
|
-
setValue(el, value);
|
|
1332
|
+
setValue(el, value, forceHydrate);
|
|
849
1333
|
} else {
|
|
850
|
-
setDOMProp(el, key, value);
|
|
1334
|
+
setDOMProp(el, key, value, forceHydrate);
|
|
851
1335
|
}
|
|
852
1336
|
} else {
|
|
853
1337
|
setAttr(el, key, value);
|
|
@@ -859,124 +1343,1453 @@ function optimizePropertyLookup() {
|
|
|
859
1343
|
if (isOptimized) return;
|
|
860
1344
|
isOptimized = true;
|
|
861
1345
|
const proto = Element.prototype;
|
|
862
|
-
proto.$
|
|
1346
|
+
proto.$transition = void 0;
|
|
1347
|
+
proto.$key = void 0;
|
|
1348
|
+
proto.$fc = proto.$evtclick = void 0;
|
|
863
1349
|
proto.$root = false;
|
|
864
1350
|
proto.$html = proto.$txt = proto.$cls = proto.$sty = Text.prototype.$txt = "";
|
|
865
1351
|
}
|
|
866
|
-
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
if (
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
value: slot
|
|
877
|
-
};
|
|
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
|
+
);
|
|
878
1362
|
}
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
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
|
+
);
|
|
897
1387
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
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
|
+
}
|
|
1673
|
+
|
|
1674
|
+
const interopKey = Symbol(`interop`);
|
|
1675
|
+
const vaporInteropImpl = {
|
|
1676
|
+
mount(vnode, container, anchor, parentComponent) {
|
|
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
|
+
}
|
|
1683
|
+
const prev = currentInstance;
|
|
1684
|
+
simpleSetCurrentInstance(parentComponent);
|
|
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);
|
|
1692
|
+
const slotsRef = shallowRef(vnode.children);
|
|
1693
|
+
const dynamicPropSource = [
|
|
1694
|
+
() => propsRef.value
|
|
1695
|
+
];
|
|
1696
|
+
dynamicPropSource[interopKey] = true;
|
|
1697
|
+
const instance = vnode.component = createComponent(
|
|
1698
|
+
vnode.type,
|
|
1699
|
+
{
|
|
1700
|
+
$: dynamicPropSource
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
_: slotsRef
|
|
1704
|
+
// pass the slots ref
|
|
1705
|
+
},
|
|
1706
|
+
void 0,
|
|
1707
|
+
void 0,
|
|
1708
|
+
parentComponent ? parentComponent.appContext : vnode.appContext
|
|
1709
|
+
);
|
|
1710
|
+
instance.rawPropsRef = propsRef;
|
|
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
|
+
}
|
|
1719
|
+
mountComponent(instance, container, selfAnchor);
|
|
1720
|
+
simpleSetCurrentInstance(prev);
|
|
1721
|
+
return instance;
|
|
1722
|
+
},
|
|
1723
|
+
update(n1, n2, shouldUpdate) {
|
|
1724
|
+
n2.component = n1.component;
|
|
1725
|
+
n2.el = n2.anchor = n1.anchor;
|
|
1726
|
+
if (shouldUpdate) {
|
|
1727
|
+
const instance = n2.component;
|
|
1728
|
+
instance.rawPropsRef.value = n2.props;
|
|
1729
|
+
instance.rawSlotsRef.value = n2.children;
|
|
1730
|
+
}
|
|
1731
|
+
},
|
|
1732
|
+
unmount(vnode, doRemove) {
|
|
1733
|
+
const container = doRemove ? vnode.anchor.parentNode : void 0;
|
|
1734
|
+
if (vnode.component) {
|
|
1735
|
+
unmountComponent(vnode.component, container);
|
|
1736
|
+
} else if (vnode.vb) {
|
|
1737
|
+
remove(vnode.vb, container);
|
|
1738
|
+
}
|
|
1739
|
+
remove(vnode.anchor, container);
|
|
1740
|
+
},
|
|
1741
|
+
/**
|
|
1742
|
+
* vapor slot in vdom
|
|
1743
|
+
*/
|
|
1744
|
+
slot(n1, n2, container, anchor) {
|
|
1745
|
+
if (!n1) {
|
|
1746
|
+
let selfAnchor;
|
|
1747
|
+
const { slot, fallback } = n2.vs;
|
|
1748
|
+
const propsRef = n2.vs.ref = shallowRef(n2.props);
|
|
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);
|
|
1756
|
+
insert(n2.vb = slotBlock, container, selfAnchor);
|
|
1757
|
+
} else {
|
|
1758
|
+
n2.el = n2.anchor = n1.anchor;
|
|
1759
|
+
n2.vb = n1.vb;
|
|
1760
|
+
(n2.vs.ref = n1.vs.ref).value = n2.props;
|
|
1761
|
+
}
|
|
1762
|
+
},
|
|
1763
|
+
move(vnode, container, anchor) {
|
|
1764
|
+
insert(vnode.vb || vnode.component, container, anchor);
|
|
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);
|
|
1804
|
+
}
|
|
1805
|
+
};
|
|
1806
|
+
const vaporSlotPropsProxyHandler = {
|
|
1807
|
+
get(target, key) {
|
|
1808
|
+
return target.value[key];
|
|
1809
|
+
},
|
|
1810
|
+
has(target, key) {
|
|
1811
|
+
return target.value[key];
|
|
1812
|
+
},
|
|
1813
|
+
ownKeys(target) {
|
|
1814
|
+
return Object.keys(target.value);
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
const vaporSlotsProxyHandler = {
|
|
1818
|
+
get(target, key) {
|
|
1819
|
+
const slot = target[key];
|
|
1820
|
+
if (isFunction(slot)) {
|
|
1821
|
+
slot.__vapor = true;
|
|
1822
|
+
}
|
|
1823
|
+
return slot;
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
let vdomHydrateNode;
|
|
1827
|
+
function createVDOMComponent(internals, component, rawProps, rawSlots) {
|
|
1828
|
+
const parentInstance = currentInstance;
|
|
1829
|
+
const frag = new VaporFragment([]);
|
|
1830
|
+
const vnode = frag.vnode = createVNode(
|
|
1831
|
+
component,
|
|
1832
|
+
rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers))
|
|
1833
|
+
);
|
|
1834
|
+
const wrapper = new VaporComponentInstance(
|
|
1835
|
+
{ props: component.props },
|
|
1836
|
+
rawProps,
|
|
1837
|
+
rawSlots
|
|
1838
|
+
);
|
|
1839
|
+
vnode.vi = (instance) => {
|
|
1840
|
+
instance.props = shallowReactive(wrapper.props);
|
|
1841
|
+
const attrs = instance.attrs = createInternalObject();
|
|
1842
|
+
for (const key in wrapper.attrs) {
|
|
1843
|
+
if (!isEmitListener(instance.emitsOptions, key)) {
|
|
1844
|
+
attrs[key] = wrapper.attrs[key];
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
instance.slots = wrapper.slots === EMPTY_OBJ ? EMPTY_OBJ : new Proxy(wrapper.slots, vaporSlotsProxyHandler);
|
|
1848
|
+
};
|
|
1849
|
+
let rawRef = null;
|
|
1850
|
+
let isMounted = false;
|
|
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
|
+
}
|
|
1864
|
+
internals.umt(vnode.component, null, !!parentNode);
|
|
1865
|
+
};
|
|
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(
|
|
1878
|
+
vnode,
|
|
1879
|
+
parentNode,
|
|
1880
|
+
anchor,
|
|
1881
|
+
internals,
|
|
1882
|
+
parentInstance,
|
|
1883
|
+
null,
|
|
1884
|
+
void 0,
|
|
1885
|
+
false
|
|
1886
|
+
);
|
|
1887
|
+
} else {
|
|
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);
|
|
1914
|
+
}
|
|
1915
|
+
frag.nodes = vnode.el;
|
|
1916
|
+
};
|
|
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
|
+
};
|
|
1928
|
+
return frag;
|
|
1929
|
+
}
|
|
1930
|
+
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
1931
|
+
const frag = new VaporFragment([]);
|
|
1932
|
+
let isMounted = false;
|
|
1933
|
+
let fallbackNodes;
|
|
1934
|
+
let oldVNode = null;
|
|
1935
|
+
frag.fallback = fallback;
|
|
1936
|
+
frag.insert = (parentNode, anchor) => {
|
|
1937
|
+
if (isHydrating) return;
|
|
1938
|
+
if (!isMounted) {
|
|
1939
|
+
render(parentNode, anchor);
|
|
1940
|
+
isMounted = true;
|
|
1941
|
+
} else {
|
|
1942
|
+
internals.m(
|
|
1943
|
+
oldVNode,
|
|
1944
|
+
parentNode,
|
|
1945
|
+
anchor,
|
|
1946
|
+
2,
|
|
1947
|
+
parentComponent
|
|
1948
|
+
);
|
|
1949
|
+
}
|
|
1950
|
+
frag.remove = (parentNode2) => {
|
|
1951
|
+
if (fallbackNodes) {
|
|
1952
|
+
remove(fallbackNodes, parentNode2);
|
|
1953
|
+
} else if (oldVNode) {
|
|
1954
|
+
internals.um(oldVNode, parentComponent, null);
|
|
1955
|
+
}
|
|
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;
|
|
2024
|
+
};
|
|
2025
|
+
return frag;
|
|
2026
|
+
}
|
|
2027
|
+
const vaporInteropPlugin = (app) => {
|
|
2028
|
+
const internals = ensureRenderer().internals;
|
|
2029
|
+
app._context.vapor = extend(vaporInteropImpl, {
|
|
2030
|
+
vdomMount: createVDOMComponent.bind(null, internals),
|
|
2031
|
+
vdomUnmount: internals.umt,
|
|
2032
|
+
vdomSlot: renderVDOMSlot.bind(null, internals)
|
|
2033
|
+
});
|
|
2034
|
+
const mount = app.mount;
|
|
2035
|
+
app.mount = ((...args) => {
|
|
2036
|
+
optimizePropertyLookup();
|
|
2037
|
+
return mount(...args);
|
|
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;
|
|
2078
|
+
};
|
|
2079
|
+
|
|
2080
|
+
function normalizeEmitsOptions(comp) {
|
|
2081
|
+
const cached = comp.__emitsOptions;
|
|
2082
|
+
if (cached) return cached;
|
|
2083
|
+
const raw = comp.emits;
|
|
2084
|
+
if (!raw) return null;
|
|
2085
|
+
let normalized;
|
|
2086
|
+
if (isArray(raw)) {
|
|
2087
|
+
normalized = {};
|
|
2088
|
+
for (const key of raw) normalized[key] = null;
|
|
2089
|
+
} else {
|
|
2090
|
+
normalized = raw;
|
|
2091
|
+
}
|
|
2092
|
+
return comp.__emitsOptions = normalized;
|
|
2093
|
+
}
|
|
2094
|
+
function emit(instance, event, ...rawArgs) {
|
|
2095
|
+
baseEmit(
|
|
2096
|
+
instance,
|
|
2097
|
+
instance.rawProps || EMPTY_OBJ,
|
|
2098
|
+
propGetter,
|
|
2099
|
+
event,
|
|
2100
|
+
...rawArgs
|
|
2101
|
+
);
|
|
2102
|
+
}
|
|
2103
|
+
function propGetter(rawProps, key) {
|
|
2104
|
+
const dynamicSources = rawProps.$;
|
|
2105
|
+
if (dynamicSources) {
|
|
2106
|
+
let i = dynamicSources.length;
|
|
2107
|
+
while (i--) {
|
|
2108
|
+
const source = resolveSource(dynamicSources[i]);
|
|
2109
|
+
if (hasOwn(source, key))
|
|
2110
|
+
return dynamicSources[interopKey] ? source[key] : resolveSource(source[key]);
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
return rawProps[key] && resolveSource(rawProps[key]);
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
function resolveSource(source) {
|
|
2117
|
+
return isFunction(source) ? source() : source;
|
|
2118
|
+
}
|
|
2119
|
+
function getPropsProxyHandlers(comp, once) {
|
|
2120
|
+
if (comp.__propsHandlers) {
|
|
2121
|
+
return comp.__propsHandlers;
|
|
2122
|
+
}
|
|
2123
|
+
const propsOptions = normalizePropsOptions(comp)[0];
|
|
2124
|
+
const emitsOptions = normalizeEmitsOptions(comp);
|
|
2125
|
+
const isProp = propsOptions ? (key) => isString(key) && hasOwn(propsOptions, camelize(key)) : NO;
|
|
2126
|
+
const isAttr = propsOptions ? (key) => key !== "$" && !isProp(key) && !isEmitListener(emitsOptions, key) : YES;
|
|
2127
|
+
const getProp = (instance, key) => {
|
|
2128
|
+
if (key === "__v_isReactive") return true;
|
|
2129
|
+
if (!isProp(key)) return;
|
|
2130
|
+
const rawProps = instance.rawProps;
|
|
2131
|
+
const dynamicSources = rawProps.$;
|
|
2132
|
+
if (dynamicSources) {
|
|
2133
|
+
let i = dynamicSources.length;
|
|
2134
|
+
let source, isDynamic, rawKey;
|
|
2135
|
+
while (i--) {
|
|
2136
|
+
source = dynamicSources[i];
|
|
2137
|
+
isDynamic = isFunction(source);
|
|
2138
|
+
source = isDynamic ? source() : source;
|
|
2139
|
+
for (rawKey in source) {
|
|
2140
|
+
if (camelize(rawKey) === key) {
|
|
2141
|
+
return resolvePropValue(
|
|
2142
|
+
propsOptions,
|
|
2143
|
+
key,
|
|
2144
|
+
isDynamic ? source[rawKey] : source[rawKey](),
|
|
2145
|
+
instance,
|
|
2146
|
+
resolveDefault
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
for (const rawKey in rawProps) {
|
|
2153
|
+
if (camelize(rawKey) === key) {
|
|
2154
|
+
return resolvePropValue(
|
|
2155
|
+
propsOptions,
|
|
2156
|
+
key,
|
|
2157
|
+
rawProps[rawKey](),
|
|
2158
|
+
instance,
|
|
2159
|
+
resolveDefault
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
return resolvePropValue(
|
|
2164
|
+
propsOptions,
|
|
2165
|
+
key,
|
|
2166
|
+
void 0,
|
|
2167
|
+
instance,
|
|
2168
|
+
resolveDefault,
|
|
2169
|
+
true
|
|
2170
|
+
);
|
|
2171
|
+
};
|
|
2172
|
+
const getPropValue = once ? (...args) => {
|
|
2173
|
+
pauseTracking();
|
|
2174
|
+
const value = getProp(...args);
|
|
2175
|
+
resetTracking();
|
|
2176
|
+
return value;
|
|
2177
|
+
} : getProp;
|
|
2178
|
+
const propsHandlers = propsOptions ? {
|
|
2179
|
+
get: (target, key) => getPropValue(target, key),
|
|
2180
|
+
has: (_, key) => isProp(key),
|
|
2181
|
+
ownKeys: () => Object.keys(propsOptions),
|
|
2182
|
+
getOwnPropertyDescriptor(target, key) {
|
|
2183
|
+
if (isProp(key)) {
|
|
2184
|
+
return {
|
|
2185
|
+
configurable: true,
|
|
2186
|
+
enumerable: true,
|
|
2187
|
+
get: () => getPropValue(target, key)
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
}
|
|
2191
|
+
} : null;
|
|
2192
|
+
if (!!(process.env.NODE_ENV !== "production") && propsOptions) {
|
|
2193
|
+
Object.assign(propsHandlers, {
|
|
2194
|
+
set: propsSetDevTrap,
|
|
2195
|
+
deleteProperty: propsDeleteDevTrap
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
const getAttr = (target, key) => {
|
|
2199
|
+
if (!isProp(key) && !isEmitListener(emitsOptions, key)) {
|
|
2200
|
+
return getAttrFromRawProps(target, key);
|
|
2201
|
+
}
|
|
2202
|
+
};
|
|
2203
|
+
const hasAttr = (target, key) => {
|
|
2204
|
+
if (isAttr(key)) {
|
|
2205
|
+
return hasAttrFromRawProps(target, key);
|
|
2206
|
+
} else {
|
|
2207
|
+
return false;
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
const getAttrValue = once ? (...args) => {
|
|
2211
|
+
pauseTracking();
|
|
2212
|
+
const value = getAttr(...args);
|
|
2213
|
+
resetTracking();
|
|
2214
|
+
return value;
|
|
2215
|
+
} : getAttr;
|
|
2216
|
+
const attrsHandlers = {
|
|
2217
|
+
get: (target, key) => getAttrValue(target.rawProps, key),
|
|
2218
|
+
has: (target, key) => hasAttr(target.rawProps, key),
|
|
2219
|
+
ownKeys: (target) => getKeysFromRawProps(target.rawProps).filter(isAttr),
|
|
2220
|
+
getOwnPropertyDescriptor(target, key) {
|
|
2221
|
+
if (hasAttr(target.rawProps, key)) {
|
|
2222
|
+
return {
|
|
2223
|
+
configurable: true,
|
|
2224
|
+
enumerable: true,
|
|
2225
|
+
get: () => getAttrValue(target.rawProps, key)
|
|
2226
|
+
};
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
};
|
|
2230
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2231
|
+
Object.assign(attrsHandlers, {
|
|
2232
|
+
set: propsSetDevTrap,
|
|
2233
|
+
deleteProperty: propsDeleteDevTrap
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
return comp.__propsHandlers = [propsHandlers, attrsHandlers];
|
|
2237
|
+
}
|
|
2238
|
+
function getAttrFromRawProps(rawProps, key) {
|
|
2239
|
+
if (key === "$") return;
|
|
2240
|
+
const merged = key === "class" || key === "style" ? [] : void 0;
|
|
2241
|
+
const dynamicSources = rawProps.$;
|
|
2242
|
+
if (dynamicSources) {
|
|
2243
|
+
let i = dynamicSources.length;
|
|
2244
|
+
let source, isDynamic;
|
|
909
2245
|
while (i--) {
|
|
910
2246
|
source = dynamicSources[i];
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
2247
|
+
isDynamic = isFunction(source);
|
|
2248
|
+
source = isDynamic ? source() : source;
|
|
2249
|
+
if (source && hasOwn(source, key)) {
|
|
2250
|
+
const value = isDynamic ? source[key] : source[key]();
|
|
2251
|
+
if (merged) {
|
|
2252
|
+
merged.push(value);
|
|
2253
|
+
} else {
|
|
2254
|
+
return value;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
if (hasOwn(rawProps, key)) {
|
|
2260
|
+
if (merged) {
|
|
2261
|
+
merged.push(rawProps[key]());
|
|
2262
|
+
} else {
|
|
2263
|
+
return rawProps[key]();
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
if (merged && merged.length) {
|
|
2267
|
+
return merged;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
function hasAttrFromRawProps(rawProps, key) {
|
|
2271
|
+
if (key === "$") return false;
|
|
2272
|
+
const dynamicSources = rawProps.$;
|
|
2273
|
+
if (dynamicSources) {
|
|
2274
|
+
let i = dynamicSources.length;
|
|
2275
|
+
while (i--) {
|
|
2276
|
+
const source = resolveSource(dynamicSources[i]);
|
|
2277
|
+
if (source && hasOwn(source, key)) {
|
|
2278
|
+
return true;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
return hasOwn(rawProps, key);
|
|
2283
|
+
}
|
|
2284
|
+
function getKeysFromRawProps(rawProps) {
|
|
2285
|
+
const keys = [];
|
|
2286
|
+
for (const key in rawProps) {
|
|
2287
|
+
if (key !== "$") keys.push(key);
|
|
2288
|
+
}
|
|
2289
|
+
const dynamicSources = rawProps.$;
|
|
2290
|
+
if (dynamicSources) {
|
|
2291
|
+
let i = dynamicSources.length;
|
|
2292
|
+
let source;
|
|
2293
|
+
while (i--) {
|
|
2294
|
+
source = resolveSource(dynamicSources[i]);
|
|
2295
|
+
for (const key in source) {
|
|
2296
|
+
keys.push(key);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
return Array.from(new Set(keys));
|
|
2301
|
+
}
|
|
2302
|
+
function normalizePropsOptions(comp) {
|
|
2303
|
+
const cached = comp.__propsOptions;
|
|
2304
|
+
if (cached) return cached;
|
|
2305
|
+
const raw = comp.props;
|
|
2306
|
+
if (!raw) return EMPTY_ARR;
|
|
2307
|
+
const normalized = {};
|
|
2308
|
+
const needCastKeys = [];
|
|
2309
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
2310
|
+
return comp.__propsOptions = [normalized, needCastKeys];
|
|
2311
|
+
}
|
|
2312
|
+
function resolveDefault(factory, instance) {
|
|
2313
|
+
const prev = setCurrentInstance(instance);
|
|
2314
|
+
const res = factory.call(null, instance.props);
|
|
2315
|
+
setCurrentInstance(...prev);
|
|
2316
|
+
return res;
|
|
2317
|
+
}
|
|
2318
|
+
function hasFallthroughAttrs(comp, rawProps) {
|
|
2319
|
+
if (rawProps) {
|
|
2320
|
+
if (rawProps.$ || !comp.props) {
|
|
2321
|
+
return true;
|
|
2322
|
+
} else {
|
|
2323
|
+
const propsOptions = normalizePropsOptions(comp)[0];
|
|
2324
|
+
for (const key in rawProps) {
|
|
2325
|
+
if (!hasOwn(propsOptions, camelize(key))) {
|
|
2326
|
+
return true;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
return false;
|
|
2332
|
+
}
|
|
2333
|
+
function setupPropsValidation(instance) {
|
|
2334
|
+
const rawProps = instance.rawProps;
|
|
2335
|
+
if (!rawProps) return;
|
|
2336
|
+
renderEffect(
|
|
2337
|
+
() => {
|
|
2338
|
+
pushWarningContext(instance);
|
|
2339
|
+
validateProps(
|
|
2340
|
+
resolveDynamicProps(rawProps),
|
|
2341
|
+
instance.props,
|
|
2342
|
+
normalizePropsOptions(instance.type)[0]
|
|
2343
|
+
);
|
|
2344
|
+
popWarningContext();
|
|
2345
|
+
},
|
|
2346
|
+
true
|
|
2347
|
+
/* noLifecycle */
|
|
2348
|
+
);
|
|
2349
|
+
}
|
|
2350
|
+
function resolveDynamicProps(props) {
|
|
2351
|
+
const mergedRawProps = {};
|
|
2352
|
+
for (const key in props) {
|
|
2353
|
+
if (key !== "$") {
|
|
2354
|
+
mergedRawProps[key] = props[key]();
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
if (props.$) {
|
|
2358
|
+
for (const source of props.$) {
|
|
2359
|
+
const isDynamic = isFunction(source);
|
|
2360
|
+
const resolved = isDynamic ? source() : source;
|
|
2361
|
+
for (const key in resolved) {
|
|
2362
|
+
const value = isDynamic ? resolved[key] : resolved[key]();
|
|
2363
|
+
if (key === "class" || key === "style") {
|
|
2364
|
+
const existing = mergedRawProps[key];
|
|
2365
|
+
if (isArray(existing)) {
|
|
2366
|
+
existing.push(value);
|
|
2367
|
+
} else {
|
|
2368
|
+
mergedRawProps[key] = [existing, value];
|
|
2369
|
+
}
|
|
2370
|
+
} else {
|
|
2371
|
+
mergedRawProps[key] = value;
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
return mergedRawProps;
|
|
2377
|
+
}
|
|
2378
|
+
function propsSetDevTrap(_, key) {
|
|
2379
|
+
warn(
|
|
2380
|
+
`Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
2381
|
+
);
|
|
2382
|
+
return true;
|
|
2383
|
+
}
|
|
2384
|
+
function propsDeleteDevTrap(_, key) {
|
|
2385
|
+
warn(
|
|
2386
|
+
`Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
2387
|
+
);
|
|
2388
|
+
return true;
|
|
2389
|
+
}
|
|
2390
|
+
const rawPropsProxyHandlers = {
|
|
2391
|
+
get: getAttrFromRawProps,
|
|
2392
|
+
has: hasAttrFromRawProps,
|
|
2393
|
+
ownKeys: getKeysFromRawProps,
|
|
2394
|
+
getOwnPropertyDescriptor(target, key) {
|
|
2395
|
+
if (hasAttrFromRawProps(target, key)) {
|
|
2396
|
+
return {
|
|
2397
|
+
configurable: true,
|
|
2398
|
+
enumerable: true,
|
|
2399
|
+
get: () => getAttrFromRawProps(target, key)
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
|
|
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
|
+
}
|
|
917
2469
|
}
|
|
918
|
-
|
|
919
|
-
|
|
2470
|
+
targetAnchor = targetAnchor.nextSibling;
|
|
2471
|
+
}
|
|
2472
|
+
if (targetNode) {
|
|
2473
|
+
setCurrentHydrationNode(targetNode.nextSibling);
|
|
2474
|
+
}
|
|
2475
|
+
if (!this.targetAnchor) {
|
|
2476
|
+
this.mount(target);
|
|
2477
|
+
} else {
|
|
2478
|
+
this.initChildren();
|
|
920
2479
|
}
|
|
921
2480
|
}
|
|
922
|
-
} else if (
|
|
923
|
-
|
|
2481
|
+
} else if (disabled) {
|
|
2482
|
+
this.hydrateDisabledTeleport(currentHydrationNode);
|
|
924
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();
|
|
925
2501
|
}
|
|
926
2502
|
}
|
|
927
|
-
|
|
928
|
-
return
|
|
2503
|
+
get parent() {
|
|
2504
|
+
return this.anchor ? this.anchor.parentNode : null;
|
|
929
2505
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
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
|
+
}
|
|
938
2522
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
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);
|
|
2556
|
+
}
|
|
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();
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
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("")
|
|
950
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));
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
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;
|
|
2613
|
+
}
|
|
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);
|
|
951
2627
|
} else {
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
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
|
|
965
2641
|
);
|
|
966
2642
|
} else {
|
|
967
|
-
|
|
2643
|
+
parent.insertBefore(block, anchor);
|
|
968
2644
|
}
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
|
|
2645
|
+
}
|
|
2646
|
+
} else if (isVaporComponent(block)) {
|
|
2647
|
+
if (block.isMounted && !block.isDeactivated) {
|
|
2648
|
+
insert(block.block, parent, anchor);
|
|
2649
|
+
} else {
|
|
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);
|
|
972
2722
|
} else {
|
|
973
|
-
|
|
2723
|
+
nodes.push(...normalizeBlock(block.nodes));
|
|
2724
|
+
block.anchor && nodes.push(block.anchor);
|
|
974
2725
|
}
|
|
975
2726
|
}
|
|
976
|
-
|
|
977
|
-
|
|
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);
|
|
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);
|
|
2784
|
+
}
|
|
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);
|
|
978
2792
|
}
|
|
979
|
-
return fragment;
|
|
980
2793
|
}
|
|
981
2794
|
|
|
982
2795
|
function hmrRerender(instance) {
|
|
@@ -985,6 +2798,10 @@ function hmrRerender(instance) {
|
|
|
985
2798
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
986
2799
|
remove(instance.block, parent);
|
|
987
2800
|
const prev = setCurrentInstance(instance);
|
|
2801
|
+
if (instance.renderEffects) {
|
|
2802
|
+
instance.renderEffects.forEach((e) => e.stop());
|
|
2803
|
+
instance.renderEffects = [];
|
|
2804
|
+
}
|
|
988
2805
|
pushWarningContext(instance);
|
|
989
2806
|
devRender(instance);
|
|
990
2807
|
popWarningContext();
|
|
@@ -996,7 +2813,8 @@ function hmrReload(instance, newComp) {
|
|
|
996
2813
|
const parent = normalized[0].parentNode;
|
|
997
2814
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
998
2815
|
unmountComponent(instance, parent);
|
|
999
|
-
const
|
|
2816
|
+
const parentInstance = instance.parent;
|
|
2817
|
+
const prev = setCurrentInstance(parentInstance);
|
|
1000
2818
|
const newInstance = createComponent(
|
|
1001
2819
|
newComp,
|
|
1002
2820
|
instance.rawProps,
|
|
@@ -1005,42 +2823,99 @@ function hmrReload(instance, newComp) {
|
|
|
1005
2823
|
);
|
|
1006
2824
|
setCurrentInstance(...prev);
|
|
1007
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
|
+
}
|
|
1008
2858
|
}
|
|
1009
2859
|
|
|
1010
|
-
function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
2860
|
+
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
1011
2861
|
const _insertionParent = insertionParent;
|
|
1012
2862
|
const _insertionAnchor = insertionAnchor;
|
|
2863
|
+
const _isLastInsertion = isLastInsertion;
|
|
1013
2864
|
if (isHydrating) {
|
|
1014
2865
|
locateHydrationNode();
|
|
1015
2866
|
} else {
|
|
1016
2867
|
resetInsertionState();
|
|
1017
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
|
+
}
|
|
1018
2885
|
if (appContext.vapor && !component.__vapor) {
|
|
1019
2886
|
const frag = appContext.vapor.vdomMount(
|
|
1020
2887
|
component,
|
|
1021
2888
|
rawProps,
|
|
1022
2889
|
rawSlots
|
|
1023
2890
|
);
|
|
1024
|
-
if (!isHydrating
|
|
1025
|
-
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
|
+
}
|
|
1026
2898
|
}
|
|
1027
2899
|
return frag;
|
|
1028
2900
|
}
|
|
1029
|
-
if (
|
|
1030
|
-
const
|
|
1031
|
-
if (
|
|
1032
|
-
(
|
|
1033
|
-
() => attrs
|
|
1034
|
-
);
|
|
2901
|
+
if (isVaporTeleport(component)) {
|
|
2902
|
+
const frag = component.process(rawProps, rawSlots);
|
|
2903
|
+
if (!isHydrating) {
|
|
2904
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
1035
2905
|
} else {
|
|
1036
|
-
|
|
2906
|
+
frag.hydrate();
|
|
2907
|
+
if (_isLastInsertion) {
|
|
2908
|
+
advanceHydrationNode(_insertionParent);
|
|
2909
|
+
}
|
|
1037
2910
|
}
|
|
2911
|
+
return frag;
|
|
1038
2912
|
}
|
|
1039
2913
|
const instance = new VaporComponentInstance(
|
|
1040
2914
|
component,
|
|
1041
2915
|
rawProps,
|
|
1042
2916
|
rawSlots,
|
|
1043
|
-
appContext
|
|
2917
|
+
appContext,
|
|
2918
|
+
once
|
|
1044
2919
|
);
|
|
1045
2920
|
if (!!(process.env.NODE_ENV !== "production") && component.__hmrId) {
|
|
1046
2921
|
registerHMR(instance);
|
|
@@ -1054,6 +2929,45 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1054
2929
|
instance.propsOptions = normalizePropsOptions(component);
|
|
1055
2930
|
instance.emitsOptions = normalizeEmitsOptions(component);
|
|
1056
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) {
|
|
1057
2971
|
const prevInstance = setCurrentInstance(instance);
|
|
1058
2972
|
const prevSub = setActiveSub();
|
|
1059
2973
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -1090,14 +3004,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1090
3004
|
}
|
|
1091
3005
|
}
|
|
1092
3006
|
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
1093
|
-
|
|
1094
|
-
if (el) {
|
|
1095
|
-
renderEffect(() => {
|
|
1096
|
-
isApplyingFallthroughProps = true;
|
|
1097
|
-
setDynamicProps(el, [instance.attrs]);
|
|
1098
|
-
isApplyingFallthroughProps = false;
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
3007
|
+
renderEffect(() => applyFallthroughProps(instance.block, instance.attrs));
|
|
1101
3008
|
}
|
|
1102
3009
|
setActiveSub(prevSub);
|
|
1103
3010
|
setCurrentInstance(...prevInstance);
|
|
@@ -1105,13 +3012,16 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1105
3012
|
popWarningContext();
|
|
1106
3013
|
endMeasure(instance, "init");
|
|
1107
3014
|
}
|
|
1108
|
-
onScopeDispose(() => unmountComponent(instance), true);
|
|
1109
|
-
if (!isHydrating && _insertionParent) {
|
|
1110
|
-
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
1111
|
-
}
|
|
1112
|
-
return instance;
|
|
1113
3015
|
}
|
|
1114
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
|
+
}
|
|
1115
3025
|
function devRender(instance) {
|
|
1116
3026
|
instance.block = (instance.type.render ? callWithErrorHandling(
|
|
1117
3027
|
instance.type.render,
|
|
@@ -1145,7 +3055,7 @@ const emptyContext = {
|
|
|
1145
3055
|
provides: /* @__PURE__ */ Object.create(null)
|
|
1146
3056
|
};
|
|
1147
3057
|
class VaporComponentInstance {
|
|
1148
|
-
constructor(comp, rawProps, rawSlots, appContext) {
|
|
3058
|
+
constructor(comp, rawProps, rawSlots, appContext, once) {
|
|
1149
3059
|
this.vapor = true;
|
|
1150
3060
|
this.uid = nextUid();
|
|
1151
3061
|
this.type = comp;
|
|
@@ -1170,7 +3080,7 @@ class VaporComponentInstance {
|
|
|
1170
3080
|
this.rawProps = rawProps || EMPTY_OBJ;
|
|
1171
3081
|
this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
|
|
1172
3082
|
if (rawProps || comp.props) {
|
|
1173
|
-
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp);
|
|
3083
|
+
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp, once);
|
|
1174
3084
|
this.attrs = new Proxy(this, attrsHandlers);
|
|
1175
3085
|
this.props = comp.props ? new Proxy(this, propsHandlers) : isFunction(comp) ? this.attrs : EMPTY_OBJ;
|
|
1176
3086
|
} else {
|
|
@@ -1190,47 +3100,85 @@ class VaporComponentInstance {
|
|
|
1190
3100
|
function isVaporComponent(value) {
|
|
1191
3101
|
return value instanceof VaporComponentInstance;
|
|
1192
3102
|
}
|
|
1193
|
-
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot) {
|
|
3103
|
+
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, once, appContext) {
|
|
1194
3104
|
if (!isString(comp)) {
|
|
1195
|
-
return createComponent(
|
|
3105
|
+
return createComponent(
|
|
3106
|
+
comp,
|
|
3107
|
+
rawProps,
|
|
3108
|
+
rawSlots,
|
|
3109
|
+
isSingleRoot,
|
|
3110
|
+
once,
|
|
3111
|
+
appContext
|
|
3112
|
+
);
|
|
1196
3113
|
}
|
|
1197
3114
|
const _insertionParent = insertionParent;
|
|
1198
3115
|
const _insertionAnchor = insertionAnchor;
|
|
3116
|
+
const _isLastInsertion = isLastInsertion;
|
|
1199
3117
|
if (isHydrating) {
|
|
1200
3118
|
locateHydrationNode();
|
|
1201
3119
|
} else {
|
|
1202
3120
|
resetInsertionState();
|
|
1203
3121
|
}
|
|
1204
|
-
const el =
|
|
3122
|
+
const el = isHydrating ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : createElement(comp);
|
|
1205
3123
|
el.$root = isSingleRoot;
|
|
3124
|
+
if (!isHydrating) {
|
|
3125
|
+
const scopeId = currentInstance.type.__scopeId;
|
|
3126
|
+
if (scopeId) setScopeId(el, [scopeId]);
|
|
3127
|
+
}
|
|
1206
3128
|
if (rawProps) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
3129
|
+
const setFn = () => setDynamicProps(el, [resolveDynamicProps(rawProps)]);
|
|
3130
|
+
if (once) setFn();
|
|
3131
|
+
else renderEffect(setFn);
|
|
1210
3132
|
}
|
|
1211
3133
|
if (rawSlots) {
|
|
3134
|
+
let nextNode = null;
|
|
3135
|
+
if (isHydrating) {
|
|
3136
|
+
nextNode = locateNextNode(el);
|
|
3137
|
+
setCurrentHydrationNode(el.firstChild);
|
|
3138
|
+
}
|
|
1212
3139
|
if (rawSlots.$) ; else {
|
|
1213
3140
|
insert(getSlot(rawSlots, "default")(), el);
|
|
1214
3141
|
}
|
|
3142
|
+
if (isHydrating) {
|
|
3143
|
+
setCurrentHydrationNode(nextNode);
|
|
3144
|
+
}
|
|
1215
3145
|
}
|
|
1216
|
-
if (!isHydrating
|
|
1217
|
-
insert(el, _insertionParent, _insertionAnchor);
|
|
3146
|
+
if (!isHydrating) {
|
|
3147
|
+
if (_insertionParent) insert(el, _insertionParent, _insertionAnchor);
|
|
3148
|
+
} else {
|
|
3149
|
+
if (_isLastInsertion) {
|
|
3150
|
+
advanceHydrationNode(_insertionParent);
|
|
3151
|
+
}
|
|
1218
3152
|
}
|
|
1219
3153
|
return el;
|
|
1220
3154
|
}
|
|
1221
3155
|
function mountComponent(instance, parent, anchor) {
|
|
3156
|
+
if (instance.shapeFlag & 512) {
|
|
3157
|
+
findParentKeepAlive(instance).activate(instance, parent, anchor);
|
|
3158
|
+
return;
|
|
3159
|
+
}
|
|
1222
3160
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1223
3161
|
startMeasure(instance, `mount`);
|
|
1224
3162
|
}
|
|
1225
3163
|
if (instance.bm) invokeArrayFns(instance.bm);
|
|
1226
|
-
|
|
1227
|
-
|
|
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
|
+
}
|
|
1228
3172
|
instance.isMounted = true;
|
|
1229
3173
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1230
3174
|
endMeasure(instance, `mount`);
|
|
1231
3175
|
}
|
|
1232
3176
|
}
|
|
1233
3177
|
function unmountComponent(instance, parentNode) {
|
|
3178
|
+
if (parentNode && instance.parent && instance.parent.vapor && instance.shapeFlag & 256) {
|
|
3179
|
+
findParentKeepAlive(instance).deactivate(instance);
|
|
3180
|
+
return;
|
|
3181
|
+
}
|
|
1234
3182
|
if (instance.isMounted && !instance.isUnmounted) {
|
|
1235
3183
|
if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
|
|
1236
3184
|
unregisterHMR(instance);
|
|
@@ -1240,7 +3188,7 @@ function unmountComponent(instance, parentNode) {
|
|
|
1240
3188
|
}
|
|
1241
3189
|
instance.scope.stop();
|
|
1242
3190
|
if (instance.um) {
|
|
1243
|
-
queuePostFlushCb(
|
|
3191
|
+
queuePostFlushCb(instance.um);
|
|
1244
3192
|
}
|
|
1245
3193
|
instance.isUnmounted = true;
|
|
1246
3194
|
}
|
|
@@ -1255,9 +3203,7 @@ function getExposed(instance) {
|
|
|
1255
3203
|
}));
|
|
1256
3204
|
}
|
|
1257
3205
|
}
|
|
1258
|
-
function getRootElement({
|
|
1259
|
-
block
|
|
1260
|
-
}) {
|
|
3206
|
+
function getRootElement(block) {
|
|
1261
3207
|
if (block instanceof Element) {
|
|
1262
3208
|
return block;
|
|
1263
3209
|
}
|
|
@@ -1283,6 +3229,7 @@ const mountApp = (app, container) => {
|
|
|
1283
3229
|
app._props,
|
|
1284
3230
|
null,
|
|
1285
3231
|
false,
|
|
3232
|
+
false,
|
|
1286
3233
|
app._context
|
|
1287
3234
|
);
|
|
1288
3235
|
mountComponent(instance, container);
|
|
@@ -1299,6 +3246,7 @@ const hydrateApp = (app, container) => {
|
|
|
1299
3246
|
app._props,
|
|
1300
3247
|
null,
|
|
1301
3248
|
false,
|
|
3249
|
+
false,
|
|
1302
3250
|
app._context
|
|
1303
3251
|
);
|
|
1304
3252
|
mountComponent(instance, container);
|
|
@@ -1317,261 +3265,160 @@ function prepareApp() {
|
|
|
1317
3265
|
target.__VUE__ = true;
|
|
1318
3266
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1319
3267
|
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
function postPrepareApp(app) {
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
}
|
|
1332
|
-
);
|
|
1333
|
-
}
|
|
1334
|
-
app.vapor = true;
|
|
1335
|
-
const mount = app.mount;
|
|
1336
|
-
app.mount = (container, ...args) => {
|
|
1337
|
-
container = normalizeContainer(container);
|
|
1338
|
-
return mount(container, ...args);
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
|
-
const createVaporApp = (comp, props) => {
|
|
1342
|
-
prepareApp();
|
|
1343
|
-
if (!_createApp) _createApp = createAppAPI(mountApp, unmountApp, getExposed);
|
|
1344
|
-
const app = _createApp(comp, props);
|
|
1345
|
-
postPrepareApp(app);
|
|
1346
|
-
return app;
|
|
1347
|
-
};
|
|
1348
|
-
const createVaporSSRApp = (comp, props) => {
|
|
1349
|
-
prepareApp();
|
|
1350
|
-
if (!_hydrateApp)
|
|
1351
|
-
_hydrateApp = createAppAPI(hydrateApp, unmountApp, getExposed);
|
|
1352
|
-
const app = _hydrateApp(comp, props);
|
|
1353
|
-
postPrepareApp(app);
|
|
1354
|
-
return app;
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1358
|
-
// @__NO_SIDE_EFFECTS__
|
|
1359
|
-
function defineVaporComponent(comp, extraOptions) {
|
|
1360
|
-
if (isFunction(comp)) {
|
|
1361
|
-
return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
|
|
1362
|
-
setup: comp,
|
|
1363
|
-
__vapor: true
|
|
1364
|
-
}))();
|
|
1365
|
-
}
|
|
1366
|
-
comp.__vapor = true;
|
|
1367
|
-
return comp;
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
const vaporInteropImpl = {
|
|
1371
|
-
mount(vnode, container, anchor, parentComponent) {
|
|
1372
|
-
const selfAnchor = vnode.el = vnode.anchor = createTextNode();
|
|
1373
|
-
container.insertBefore(selfAnchor, anchor);
|
|
1374
|
-
const prev = currentInstance;
|
|
1375
|
-
simpleSetCurrentInstance(parentComponent);
|
|
1376
|
-
const propsRef = shallowRef(vnode.props);
|
|
1377
|
-
const slotsRef = shallowRef(vnode.children);
|
|
1378
|
-
const instance = vnode.component = createComponent(
|
|
1379
|
-
vnode.type,
|
|
1380
|
-
{
|
|
1381
|
-
$: [() => propsRef.value]
|
|
1382
|
-
},
|
|
1383
|
-
{
|
|
1384
|
-
_: slotsRef
|
|
1385
|
-
// pass the slots ref
|
|
1386
|
-
}
|
|
1387
|
-
);
|
|
1388
|
-
instance.rawPropsRef = propsRef;
|
|
1389
|
-
instance.rawSlotsRef = slotsRef;
|
|
1390
|
-
mountComponent(instance, container, selfAnchor);
|
|
1391
|
-
simpleSetCurrentInstance(prev);
|
|
1392
|
-
return instance;
|
|
1393
|
-
},
|
|
1394
|
-
update(n1, n2, shouldUpdate) {
|
|
1395
|
-
n2.component = n1.component;
|
|
1396
|
-
n2.el = n2.anchor = n1.anchor;
|
|
1397
|
-
if (shouldUpdate) {
|
|
1398
|
-
const instance = n2.component;
|
|
1399
|
-
instance.rawPropsRef.value = n2.props;
|
|
1400
|
-
instance.rawSlotsRef.value = n2.children;
|
|
1401
|
-
}
|
|
1402
|
-
},
|
|
1403
|
-
unmount(vnode, doRemove) {
|
|
1404
|
-
const container = doRemove ? vnode.anchor.parentNode : void 0;
|
|
1405
|
-
if (vnode.component) {
|
|
1406
|
-
unmountComponent(vnode.component, container);
|
|
1407
|
-
} else if (vnode.vb) {
|
|
1408
|
-
remove(vnode.vb, container);
|
|
1409
|
-
}
|
|
1410
|
-
remove(vnode.anchor, container);
|
|
1411
|
-
},
|
|
1412
|
-
/**
|
|
1413
|
-
* vapor slot in vdom
|
|
1414
|
-
*/
|
|
1415
|
-
slot(n1, n2, container, anchor) {
|
|
1416
|
-
if (!n1) {
|
|
1417
|
-
const selfAnchor = n2.el = n2.anchor = createTextNode();
|
|
1418
|
-
insert(selfAnchor, container, anchor);
|
|
1419
|
-
const { slot, fallback } = n2.vs;
|
|
1420
|
-
const propsRef = n2.vs.ref = shallowRef(n2.props);
|
|
1421
|
-
const slotBlock = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
|
|
1422
|
-
insert(n2.vb = slotBlock, container, selfAnchor);
|
|
1423
|
-
} else {
|
|
1424
|
-
n2.el = n2.anchor = n1.anchor;
|
|
1425
|
-
n2.vb = n1.vb;
|
|
1426
|
-
(n2.vs.ref = n1.vs.ref).value = n2.props;
|
|
1427
|
-
}
|
|
1428
|
-
},
|
|
1429
|
-
move(vnode, container, anchor) {
|
|
1430
|
-
insert(vnode.vb || vnode.component, container, anchor);
|
|
1431
|
-
insert(vnode.anchor, container, anchor);
|
|
1432
|
-
}
|
|
1433
|
-
};
|
|
1434
|
-
const vaporSlotPropsProxyHandler = {
|
|
1435
|
-
get(target, key) {
|
|
1436
|
-
return target.value[key];
|
|
1437
|
-
},
|
|
1438
|
-
has(target, key) {
|
|
1439
|
-
return target.value[key];
|
|
1440
|
-
},
|
|
1441
|
-
ownKeys(target) {
|
|
1442
|
-
return Object.keys(target.value);
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
|
-
const vaporSlotsProxyHandler = {
|
|
1446
|
-
get(target, key) {
|
|
1447
|
-
const slot = target[key];
|
|
1448
|
-
if (isFunction(slot)) {
|
|
1449
|
-
slot.__vapor = true;
|
|
1450
|
-
}
|
|
1451
|
-
return slot;
|
|
1452
|
-
}
|
|
1453
|
-
};
|
|
1454
|
-
function createVDOMComponent(internals, component, rawProps, rawSlots) {
|
|
1455
|
-
const frag = new VaporFragment([]);
|
|
1456
|
-
const vnode = createVNode(
|
|
1457
|
-
component,
|
|
1458
|
-
rawProps && new Proxy(rawProps, rawPropsProxyHandlers)
|
|
1459
|
-
);
|
|
1460
|
-
const wrapper = new VaporComponentInstance(
|
|
1461
|
-
{ props: component.props },
|
|
1462
|
-
rawProps,
|
|
1463
|
-
rawSlots
|
|
1464
|
-
);
|
|
1465
|
-
vnode.vi = (instance) => {
|
|
1466
|
-
instance.props = shallowReactive(wrapper.props);
|
|
1467
|
-
const attrs = instance.attrs = createInternalObject();
|
|
1468
|
-
for (const key in wrapper.attrs) {
|
|
1469
|
-
if (!isEmitListener(instance.emitsOptions, key)) {
|
|
1470
|
-
attrs[key] = wrapper.attrs[key];
|
|
1471
|
-
}
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
function postPrepareApp(app) {
|
|
3271
|
+
app.vapor = true;
|
|
3272
|
+
const mount = app.mount;
|
|
3273
|
+
app.mount = (container, ...args) => {
|
|
3274
|
+
container = normalizeContainer(container);
|
|
3275
|
+
const proxy = mount(container, ...args);
|
|
3276
|
+
if (container instanceof Element) {
|
|
3277
|
+
container.removeAttribute("v-cloak");
|
|
3278
|
+
container.setAttribute("data-v-app", "");
|
|
1472
3279
|
}
|
|
1473
|
-
|
|
3280
|
+
return proxy;
|
|
1474
3281
|
};
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
3282
|
+
}
|
|
3283
|
+
const createVaporApp = (comp, props) => {
|
|
3284
|
+
prepareApp();
|
|
3285
|
+
if (!_createApp) _createApp = createAppAPI(mountApp, unmountApp, getExposed);
|
|
3286
|
+
const app = _createApp(comp, props);
|
|
3287
|
+
postPrepareApp(app);
|
|
3288
|
+
return app;
|
|
3289
|
+
};
|
|
3290
|
+
const createVaporSSRApp = (comp, props) => {
|
|
3291
|
+
prepareApp();
|
|
3292
|
+
if (!_hydrateApp)
|
|
3293
|
+
_hydrateApp = createAppAPI(hydrateApp, unmountApp, getExposed);
|
|
3294
|
+
const app = _hydrateApp(comp, props);
|
|
3295
|
+
postPrepareApp(app);
|
|
3296
|
+
return app;
|
|
3297
|
+
};
|
|
3298
|
+
|
|
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 }
|
|
1490
3338
|
);
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
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
|
|
1500
3352
|
);
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
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
|
|
1518
3373
|
);
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
}
|
|
1539
|
-
|
|
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);
|
|
1540
3396
|
}
|
|
3397
|
+
if (instance.$transition) frag.$transition = instance.$transition;
|
|
3398
|
+
frag.update(render);
|
|
1541
3399
|
});
|
|
1542
|
-
|
|
1543
|
-
} else {
|
|
1544
|
-
internals.m(
|
|
1545
|
-
oldVNode,
|
|
1546
|
-
parentNode,
|
|
1547
|
-
anchor,
|
|
1548
|
-
2,
|
|
1549
|
-
parentComponent
|
|
1550
|
-
);
|
|
3400
|
+
return frag;
|
|
1551
3401
|
}
|
|
1552
|
-
frag.remove = (parentNode2) => {
|
|
1553
|
-
if (fallbackNodes) {
|
|
1554
|
-
remove(fallbackNodes, parentNode2);
|
|
1555
|
-
} else if (oldVNode) {
|
|
1556
|
-
internals.um(oldVNode, parentComponent, null);
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
};
|
|
1560
|
-
return frag;
|
|
1561
|
-
}
|
|
1562
|
-
const vaporInteropPlugin = (app) => {
|
|
1563
|
-
const internals = ensureRenderer().internals;
|
|
1564
|
-
app._context.vapor = extend(vaporInteropImpl, {
|
|
1565
|
-
vdomMount: createVDOMComponent.bind(null, internals),
|
|
1566
|
-
vdomUnmount: internals.umt,
|
|
1567
|
-
vdomSlot: renderVDOMSlot.bind(null, internals)
|
|
1568
3402
|
});
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
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);
|
|
3417
|
+
}
|
|
3418
|
+
if ($transition) setTransitionHooks(instance, $transition);
|
|
3419
|
+
frag && frag.setRef && frag.setRef(instance);
|
|
3420
|
+
return instance;
|
|
3421
|
+
}
|
|
1575
3422
|
|
|
1576
3423
|
let t;
|
|
1577
3424
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
@@ -1580,18 +3427,17 @@ function template(html, root) {
|
|
|
1580
3427
|
let node;
|
|
1581
3428
|
return () => {
|
|
1582
3429
|
if (isHydrating) {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
return adoptTemplate(currentHydrationNode, html);
|
|
3430
|
+
const adopted = adoptTemplate(currentHydrationNode, html);
|
|
3431
|
+
if (root) adopted.$root = true;
|
|
3432
|
+
return adopted;
|
|
1587
3433
|
}
|
|
1588
3434
|
if (html[0] !== "<") {
|
|
1589
3435
|
return createTextNode(html);
|
|
1590
3436
|
}
|
|
1591
3437
|
if (!node) {
|
|
1592
|
-
t = t ||
|
|
3438
|
+
t = t || createElement("template");
|
|
1593
3439
|
t.innerHTML = html;
|
|
1594
|
-
node =
|
|
3440
|
+
node = _child(t.content);
|
|
1595
3441
|
}
|
|
1596
3442
|
const ret = node.cloneNode(true);
|
|
1597
3443
|
if (root) ret.$root = true;
|
|
@@ -1602,20 +3448,40 @@ function template(html, root) {
|
|
|
1602
3448
|
function createIf(condition, b1, b2, once) {
|
|
1603
3449
|
const _insertionParent = insertionParent;
|
|
1604
3450
|
const _insertionAnchor = insertionAnchor;
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
} else {
|
|
1608
|
-
resetInsertionState();
|
|
1609
|
-
}
|
|
3451
|
+
const _isLastInsertion = isLastInsertion;
|
|
3452
|
+
if (!isHydrating) resetInsertionState();
|
|
1610
3453
|
let frag;
|
|
1611
3454
|
if (once) {
|
|
1612
3455
|
frag = condition() ? b1() : b2 ? b2() : [];
|
|
1613
3456
|
} else {
|
|
1614
|
-
frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
3457
|
+
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
1615
3458
|
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
1616
3459
|
}
|
|
1617
|
-
if (!isHydrating
|
|
1618
|
-
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
|
+
}
|
|
1619
3485
|
}
|
|
1620
3486
|
return frag;
|
|
1621
3487
|
}
|
|
@@ -1630,9 +3496,10 @@ class ForBlock extends VaporFragment {
|
|
|
1630
3496
|
this.key = renderKey;
|
|
1631
3497
|
}
|
|
1632
3498
|
}
|
|
1633
|
-
const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
3499
|
+
const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
1634
3500
|
const _insertionParent = insertionParent;
|
|
1635
3501
|
const _insertionAnchor = insertionAnchor;
|
|
3502
|
+
const _isLastInsertion = isLastInsertion;
|
|
1636
3503
|
if (isHydrating) {
|
|
1637
3504
|
locateHydrationNode();
|
|
1638
3505
|
} else {
|
|
@@ -1643,8 +3510,11 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1643
3510
|
let newBlocks;
|
|
1644
3511
|
let parent;
|
|
1645
3512
|
let currentKey;
|
|
1646
|
-
|
|
1647
|
-
|
|
3513
|
+
let parentAnchor;
|
|
3514
|
+
if (!isHydrating) {
|
|
3515
|
+
parentAnchor = !!(process.env.NODE_ENV !== "production") ? createComment("for") : createTextNode();
|
|
3516
|
+
}
|
|
3517
|
+
const frag = new ForFragment(oldBlocks);
|
|
1648
3518
|
const instance = currentInstance;
|
|
1649
3519
|
const canUseFastRemove = !!(flags & 1);
|
|
1650
3520
|
const isComponent = !!(flags & 2);
|
|
@@ -1657,15 +3527,33 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1657
3527
|
const newLength = source.values.length;
|
|
1658
3528
|
const oldLength = oldBlocks.length;
|
|
1659
3529
|
newBlocks = new Array(newLength);
|
|
3530
|
+
let isFallback = false;
|
|
1660
3531
|
const prevSub = setActiveSub();
|
|
1661
3532
|
if (!isMounted) {
|
|
1662
3533
|
isMounted = true;
|
|
1663
3534
|
for (let i = 0; i < newLength; i++) {
|
|
1664
|
-
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
|
+
}
|
|
1665
3550
|
}
|
|
1666
3551
|
} else {
|
|
1667
3552
|
parent = parent || parentAnchor.parentNode;
|
|
1668
3553
|
if (!oldLength) {
|
|
3554
|
+
if (frag.fallback && frag.nodes[0].length > 0) {
|
|
3555
|
+
remove(frag.nodes[0], parent);
|
|
3556
|
+
}
|
|
1669
3557
|
for (let i = 0; i < newLength; i++) {
|
|
1670
3558
|
mount(source, i);
|
|
1671
3559
|
}
|
|
@@ -1681,6 +3569,10 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1681
3569
|
parent.textContent = "";
|
|
1682
3570
|
parent.appendChild(parentAnchor);
|
|
1683
3571
|
}
|
|
3572
|
+
if (frag.fallback) {
|
|
3573
|
+
insert(frag.nodes[0] = frag.fallback(), parent, parentAnchor);
|
|
3574
|
+
isFallback = true;
|
|
3575
|
+
}
|
|
1684
3576
|
} else if (!getKey) {
|
|
1685
3577
|
const commonLength = Math.min(newLength, oldLength);
|
|
1686
3578
|
for (let i = 0; i < commonLength; i++) {
|
|
@@ -1693,147 +3585,163 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1693
3585
|
unmount(oldBlocks[i]);
|
|
1694
3586
|
}
|
|
1695
3587
|
} else {
|
|
1696
|
-
|
|
1697
|
-
|
|
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);
|
|
1698
3607
|
const queuedBlocks = new Array(newLength);
|
|
1699
|
-
let anchorFallback = parentAnchor;
|
|
1700
3608
|
let endOffset = 0;
|
|
1701
|
-
let
|
|
1702
|
-
let
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1706
|
-
const
|
|
1707
|
-
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);
|
|
1708
3615
|
const existingBlock = oldBlocks[oldLength - endOffset - 1];
|
|
1709
|
-
if (existingBlock.key
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
continue;
|
|
1714
|
-
}
|
|
1715
|
-
if (endOffset !== 0) {
|
|
1716
|
-
anchorFallback = normalizeAnchor(newBlocks[currentIndex + 1].nodes);
|
|
1717
|
-
}
|
|
1718
|
-
break;
|
|
3616
|
+
if (existingBlock.key !== key) break;
|
|
3617
|
+
update(existingBlock, ...item);
|
|
3618
|
+
newBlocks[index] = existingBlock;
|
|
3619
|
+
endOffset++;
|
|
1719
3620
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
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);
|
|
1722
3626
|
const currentKey2 = getKey(...currentItem);
|
|
1723
|
-
const
|
|
1724
|
-
const
|
|
1725
|
-
if (
|
|
1726
|
-
update(newBlocks[
|
|
3627
|
+
const oldBlock = oldBlocks[i];
|
|
3628
|
+
const oldKey = oldBlock.key;
|
|
3629
|
+
if (oldKey === currentKey2) {
|
|
3630
|
+
update(newBlocks[i] = oldBlock, currentItem[0]);
|
|
1727
3631
|
} else {
|
|
1728
|
-
queuedBlocks[
|
|
1729
|
-
|
|
1730
|
-
currentItem,
|
|
1731
|
-
currentKey2
|
|
1732
|
-
];
|
|
1733
|
-
previousKeyIndexPairs[previousKeyIndexInsertIndex++] = [
|
|
1734
|
-
previousKey,
|
|
1735
|
-
startOffset
|
|
1736
|
-
];
|
|
3632
|
+
queuedBlocks[queuedBlocksLength++] = [i, currentItem, currentKey2];
|
|
3633
|
+
oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldKey, i];
|
|
1737
3634
|
}
|
|
1738
|
-
startOffset++;
|
|
1739
3635
|
}
|
|
1740
|
-
for (let i =
|
|
1741
|
-
|
|
1742
|
-
oldBlocks[i].key,
|
|
1743
|
-
i
|
|
1744
|
-
];
|
|
3636
|
+
for (let i = e1; i < e2; i++) {
|
|
3637
|
+
oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldBlocks[i].key, i];
|
|
1745
3638
|
}
|
|
1746
|
-
|
|
1747
|
-
newLength - endOffset,
|
|
1748
|
-
sharedBlockCount
|
|
1749
|
-
);
|
|
1750
|
-
for (let i = startOffset; i < preparationBlockCount; i++) {
|
|
3639
|
+
for (let i = e1; i < e3; i++) {
|
|
1751
3640
|
const blockItem = getItem(source, i);
|
|
1752
3641
|
const blockKey = getKey(...blockItem);
|
|
1753
|
-
queuedBlocks[
|
|
3642
|
+
queuedBlocks[queuedBlocksLength++] = [i, blockItem, blockKey];
|
|
1754
3643
|
}
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
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 };
|
|
1760
3661
|
}
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
parent,
|
|
1774
|
-
anchorOffset === -1 ? anchorFallback : normalizeAnchor(newBlocks[anchorOffset].nodes)
|
|
1775
|
-
);
|
|
1776
|
-
previousKeyIndexMap.delete(blockKey);
|
|
1777
|
-
} else {
|
|
1778
|
-
blocksToMount.push([
|
|
1779
|
-
blockIndex,
|
|
1780
|
-
blockItem,
|
|
1781
|
-
blockKey,
|
|
1782
|
-
anchorOffset
|
|
1783
|
-
]);
|
|
1784
|
-
}
|
|
1785
|
-
};
|
|
1786
|
-
for (let i = queuedBlocks.length - 1; i >= 0; i--) {
|
|
1787
|
-
const [blockIndex, blockItem, blockKey] = queuedBlocks[i];
|
|
1788
|
-
relocateOrMountBlock(
|
|
1789
|
-
blockIndex,
|
|
1790
|
-
blockItem,
|
|
1791
|
-
blockKey,
|
|
1792
|
-
blockIndex < preparationBlockCount - 1 ? blockIndex + 1 : -1
|
|
1793
|
-
);
|
|
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();
|
|
1794
3674
|
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
relocateOrMountBlock(i, blockItem, blockKey, -1);
|
|
3675
|
+
if (canUseFastRemove) {
|
|
3676
|
+
parent.textContent = "";
|
|
3677
|
+
parent.appendChild(parentAnchor);
|
|
1799
3678
|
}
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
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
|
|
1806
3688
|
);
|
|
1807
3689
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
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;
|
|
1811
3697
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
3698
|
+
block.prevAnchor = anchor;
|
|
3699
|
+
anchor = oldBlocks[i + 1];
|
|
3700
|
+
if (blocksTail !== void 0) {
|
|
3701
|
+
blocksTail.next = block;
|
|
3702
|
+
block.prev = blocksTail;
|
|
1815
3703
|
}
|
|
3704
|
+
blocksTail = block;
|
|
1816
3705
|
}
|
|
1817
|
-
for (const
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
source
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
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;
|
|
1830
3736
|
}
|
|
1831
3737
|
}
|
|
1832
3738
|
}
|
|
1833
3739
|
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
frag.nodes.push(parentAnchor);
|
|
3740
|
+
if (!isFallback) {
|
|
3741
|
+
frag.nodes = [oldBlocks = newBlocks];
|
|
3742
|
+
if (parentAnchor) frag.nodes.push(parentAnchor);
|
|
3743
|
+
} else {
|
|
3744
|
+
oldBlocks = [];
|
|
1837
3745
|
}
|
|
1838
3746
|
setActiveSub(prevSub);
|
|
1839
3747
|
};
|
|
@@ -1862,6 +3770,9 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1862
3770
|
indexRef,
|
|
1863
3771
|
key2
|
|
1864
3772
|
);
|
|
3773
|
+
if (frag.$transition) {
|
|
3774
|
+
applyTransitionHooks(block.nodes, frag.$transition, false);
|
|
3775
|
+
}
|
|
1865
3776
|
if (parent) insert(block.nodes, parent, anchor);
|
|
1866
3777
|
return block;
|
|
1867
3778
|
};
|
|
@@ -1889,21 +3800,25 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1889
3800
|
}
|
|
1890
3801
|
}
|
|
1891
3802
|
};
|
|
3803
|
+
if (setup) {
|
|
3804
|
+
setup({ createSelector });
|
|
3805
|
+
}
|
|
1892
3806
|
if (flags & 4) {
|
|
1893
3807
|
renderList();
|
|
1894
3808
|
} else {
|
|
1895
3809
|
renderEffect(renderList);
|
|
1896
3810
|
}
|
|
1897
|
-
if (!isHydrating
|
|
1898
|
-
insert(frag, _insertionParent, _insertionAnchor);
|
|
3811
|
+
if (!isHydrating) {
|
|
3812
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3813
|
+
} else {
|
|
3814
|
+
advanceHydrationNode(_isLastInsertion ? _insertionParent : parentAnchor);
|
|
1899
3815
|
}
|
|
1900
|
-
frag.useSelector = useSelector;
|
|
1901
3816
|
return frag;
|
|
1902
|
-
function
|
|
3817
|
+
function createSelector(source) {
|
|
1903
3818
|
let operMap = /* @__PURE__ */ new Map();
|
|
1904
3819
|
let activeKey = source();
|
|
1905
3820
|
let activeOpers;
|
|
1906
|
-
watch(source, (newValue) => {
|
|
3821
|
+
watch$1(source, (newValue) => {
|
|
1907
3822
|
if (activeOpers !== void 0) {
|
|
1908
3823
|
for (const oper of activeOpers) {
|
|
1909
3824
|
oper();
|
|
@@ -1943,6 +3858,21 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
1943
3858
|
}
|
|
1944
3859
|
}
|
|
1945
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
|
+
}
|
|
1946
3876
|
function createForSlots(rawSource, getSlot) {
|
|
1947
3877
|
const source = normalizeSource(rawSource);
|
|
1948
3878
|
const sourceLength = source.values.length;
|
|
@@ -2018,16 +3948,34 @@ function getRestElement(val, keys) {
|
|
|
2018
3948
|
function getDefaultValue(val, defaultVal) {
|
|
2019
3949
|
return val === void 0 ? defaultVal : val;
|
|
2020
3950
|
}
|
|
3951
|
+
function isForBlock(block) {
|
|
3952
|
+
return block instanceof ForBlock;
|
|
3953
|
+
}
|
|
2021
3954
|
|
|
2022
3955
|
function createTemplateRefSetter() {
|
|
2023
3956
|
const instance = currentInstance;
|
|
2024
3957
|
return (...args) => setRef(instance, ...args);
|
|
2025
3958
|
}
|
|
2026
|
-
function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
3959
|
+
function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
2027
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
|
+
}
|
|
2028
3975
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
2029
3976
|
const refValue = getRefValue(el);
|
|
2030
3977
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
3978
|
+
const canSetSetupRef = createCanSetSetupRefChecker(setupState);
|
|
2031
3979
|
if (oldRef != null && oldRef !== ref) {
|
|
2032
3980
|
if (isString(oldRef)) {
|
|
2033
3981
|
refs[oldRef] = null;
|
|
@@ -2046,7 +3994,7 @@ function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
|
2046
3994
|
]);
|
|
2047
3995
|
};
|
|
2048
3996
|
invokeRefSetter(refValue);
|
|
2049
|
-
onScopeDispose(() => invokeRefSetter());
|
|
3997
|
+
onScopeDispose$1(() => invokeRefSetter());
|
|
2050
3998
|
} else {
|
|
2051
3999
|
const _isString = isString(ref);
|
|
2052
4000
|
const _isRef = isRef$1(ref);
|
|
@@ -2054,44 +4002,47 @@ function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
|
2054
4002
|
if (_isString || _isRef) {
|
|
2055
4003
|
const doSet = () => {
|
|
2056
4004
|
if (refFor) {
|
|
2057
|
-
existing = _isString ? !!(process.env.NODE_ENV !== "production") &&
|
|
4005
|
+
existing = _isString ? !!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
2058
4006
|
if (!isArray(existing)) {
|
|
2059
4007
|
existing = [refValue];
|
|
2060
4008
|
if (_isString) {
|
|
2061
4009
|
refs[ref] = existing;
|
|
2062
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4010
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2063
4011
|
setupState[ref] = refs[ref];
|
|
2064
4012
|
existing = setupState[ref];
|
|
2065
4013
|
}
|
|
2066
4014
|
} else {
|
|
2067
4015
|
ref.value = existing;
|
|
4016
|
+
if (refKey) refs[refKey] = existing;
|
|
2068
4017
|
}
|
|
2069
4018
|
} else if (!existing.includes(refValue)) {
|
|
2070
4019
|
existing.push(refValue);
|
|
2071
4020
|
}
|
|
2072
4021
|
} else if (_isString) {
|
|
2073
4022
|
refs[ref] = refValue;
|
|
2074
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4023
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2075
4024
|
setupState[ref] = refValue;
|
|
2076
4025
|
}
|
|
2077
4026
|
} else if (_isRef) {
|
|
2078
4027
|
ref.value = refValue;
|
|
4028
|
+
if (refKey) refs[refKey] = refValue;
|
|
2079
4029
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2080
4030
|
warn("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
2081
4031
|
}
|
|
2082
4032
|
};
|
|
2083
4033
|
queuePostFlushCb(doSet, -1);
|
|
2084
|
-
onScopeDispose(() => {
|
|
4034
|
+
onScopeDispose$1(() => {
|
|
2085
4035
|
queuePostFlushCb(() => {
|
|
2086
4036
|
if (isArray(existing)) {
|
|
2087
4037
|
remove$1(existing, refValue);
|
|
2088
4038
|
} else if (_isString) {
|
|
2089
4039
|
refs[ref] = null;
|
|
2090
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4040
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2091
4041
|
setupState[ref] = null;
|
|
2092
4042
|
}
|
|
2093
4043
|
} else if (_isRef) {
|
|
2094
4044
|
ref.value = null;
|
|
4045
|
+
if (refKey) refs[refKey] = null;
|
|
2095
4046
|
}
|
|
2096
4047
|
});
|
|
2097
4048
|
});
|
|
@@ -2110,29 +4061,35 @@ const getRefValue = (el) => {
|
|
|
2110
4061
|
return el;
|
|
2111
4062
|
};
|
|
2112
4063
|
|
|
2113
|
-
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot) {
|
|
4064
|
+
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once) {
|
|
2114
4065
|
const _insertionParent = insertionParent;
|
|
2115
4066
|
const _insertionAnchor = insertionAnchor;
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
}
|
|
2121
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
2122
|
-
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 = () => {
|
|
2123
4071
|
const value = getter();
|
|
4072
|
+
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
2124
4073
|
frag.update(
|
|
2125
4074
|
() => createComponentWithFallback(
|
|
2126
4075
|
resolveDynamicComponent(value),
|
|
2127
4076
|
rawProps,
|
|
2128
4077
|
rawSlots,
|
|
2129
|
-
isSingleRoot
|
|
4078
|
+
isSingleRoot,
|
|
4079
|
+
once,
|
|
4080
|
+
appContext
|
|
2130
4081
|
),
|
|
2131
4082
|
value
|
|
2132
4083
|
);
|
|
2133
|
-
}
|
|
2134
|
-
if (
|
|
2135
|
-
|
|
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
|
+
}
|
|
2136
4093
|
}
|
|
2137
4094
|
return frag;
|
|
2138
4095
|
}
|
|
@@ -2150,6 +4107,12 @@ function applyVShow(target, source) {
|
|
|
2150
4107
|
update.call(target, render, key);
|
|
2151
4108
|
setDisplay(target, source());
|
|
2152
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
|
+
};
|
|
2153
4116
|
}
|
|
2154
4117
|
renderEffect(() => setDisplay(target, source()));
|
|
2155
4118
|
}
|
|
@@ -2157,18 +4120,54 @@ function setDisplay(target, value) {
|
|
|
2157
4120
|
if (isVaporComponent(target)) {
|
|
2158
4121
|
return setDisplay(target, value);
|
|
2159
4122
|
}
|
|
2160
|
-
if (isArray(target)
|
|
2161
|
-
|
|
4123
|
+
if (isArray(target)) {
|
|
4124
|
+
if (target.length === 0) return;
|
|
4125
|
+
if (target.length === 1) return setDisplay(target[0], value);
|
|
2162
4126
|
}
|
|
2163
4127
|
if (target instanceof DynamicFragment) {
|
|
2164
4128
|
return setDisplay(target.nodes, value);
|
|
2165
4129
|
}
|
|
4130
|
+
if (target instanceof VaporFragment && target.insert) {
|
|
4131
|
+
return setDisplay(target.nodes, value);
|
|
4132
|
+
}
|
|
4133
|
+
const { $transition } = target;
|
|
2166
4134
|
if (target instanceof Element) {
|
|
2167
4135
|
const el = target;
|
|
2168
4136
|
if (!(vShowOriginalDisplay in el)) {
|
|
2169
4137
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
2170
4138
|
}
|
|
2171
|
-
|
|
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
|
+
}
|
|
2172
4171
|
el[vShowHidden] = !value;
|
|
2173
4172
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2174
4173
|
warn(
|
|
@@ -2242,9 +4241,158 @@ function withVaporDirectives(node, dirs) {
|
|
|
2242
4241
|
for (const [dir, value, argument, modifiers] of dirs) {
|
|
2243
4242
|
if (dir) {
|
|
2244
4243
|
const ret = dir(node, value, argument, modifiers);
|
|
2245
|
-
if (ret) onScopeDispose
|
|
4244
|
+
if (ret) onScopeDispose(ret);
|
|
4245
|
+
}
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
|
|
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;
|
|
2246
4347
|
}
|
|
2247
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
|
+
}
|
|
2248
4396
|
}
|
|
2249
4397
|
|
|
2250
|
-
export { VaporFragment, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporComponent, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, vaporInteropPlugin, withVaporDirectives };
|
|
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 };
|