@vue/runtime-vapor 3.6.0-alpha.2 → 3.6.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-vapor.d.ts +177 -39
- package/dist/runtime-vapor.esm-bundler.js +3088 -693
- package/package.json +4 -4
|
@@ -1,247 +1,339 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-alpha.4
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, patchStyle, mergeProps, shouldSetAsProp, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue,
|
|
7
|
-
import { isArray,
|
|
8
|
-
import { setActiveSub, EffectScope,
|
|
9
|
-
|
|
10
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
11
|
-
// @__NO_SIDE_EFFECTS__
|
|
12
|
-
function createTextNode(value = "") {
|
|
13
|
-
return document.createTextNode(value);
|
|
14
|
-
}
|
|
15
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
16
|
-
// @__NO_SIDE_EFFECTS__
|
|
17
|
-
function createComment(data) {
|
|
18
|
-
return document.createComment(data);
|
|
19
|
-
}
|
|
20
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
21
|
-
// @__NO_SIDE_EFFECTS__
|
|
22
|
-
function child(node) {
|
|
23
|
-
return node.firstChild;
|
|
24
|
-
}
|
|
25
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
26
|
-
// @__NO_SIDE_EFFECTS__
|
|
27
|
-
function nthChild(node, i) {
|
|
28
|
-
return node.childNodes[i];
|
|
29
|
-
}
|
|
30
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
31
|
-
// @__NO_SIDE_EFFECTS__
|
|
32
|
-
function next(node) {
|
|
33
|
-
return node.nextSibling;
|
|
34
|
-
}
|
|
6
|
+
import { isMismatchAllowed, warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, TransitionPropsValidators, leaveCbKey, isAsyncWrapper, getComponentName, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, isKeepAlive, callWithAsyncErrorHandling, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, isRef, onMounted, onUpdated, onBeforeUnmount, resetShapeFlag, watch, matches, devtoolsComponentAdded, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, isVNode, Fragment, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, markAsyncBoundary, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation, createCanSetSetupRefChecker, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected } from '@vue/runtime-dom';
|
|
7
|
+
import { invokeArrayFns, isArray, extend, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, EMPTY_OBJ, isFunction, NO, hasOwn, isReservedProp, EMPTY_ARR, YES, getGlobalThis, isPlainObject, isObject, remove as remove$1, looseEqual } from '@vue/shared';
|
|
8
|
+
import { ReactiveEffect, setActiveSub, EffectScope, onEffectCleanup, pauseTracking, resetTracking, onScopeDispose as onScopeDispose$1, markRaw, unref, proxyRefs, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
|
|
35
9
|
|
|
36
10
|
let insertionParent;
|
|
37
11
|
let insertionAnchor;
|
|
38
|
-
|
|
12
|
+
let isLastInsertion;
|
|
13
|
+
function setInsertionState(parent, anchor, last) {
|
|
39
14
|
insertionParent = parent;
|
|
40
|
-
|
|
15
|
+
isLastInsertion = last;
|
|
16
|
+
if (anchor !== void 0) {
|
|
17
|
+
if (isHydrating) {
|
|
18
|
+
insertionAnchor = anchor;
|
|
19
|
+
} else {
|
|
20
|
+
insertionAnchor = typeof anchor === "number" && anchor > 0 ? null : anchor;
|
|
21
|
+
if (anchor === 0 && !parent.$fc) {
|
|
22
|
+
parent.$fc = parent.firstChild;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
insertionAnchor = void 0;
|
|
27
|
+
}
|
|
41
28
|
}
|
|
42
29
|
function resetInsertionState() {
|
|
43
|
-
insertionParent = insertionAnchor = void 0;
|
|
30
|
+
insertionParent = insertionAnchor = isLastInsertion = void 0;
|
|
44
31
|
}
|
|
45
32
|
|
|
33
|
+
const isHydratingStack = [];
|
|
46
34
|
let isHydrating = false;
|
|
47
35
|
let currentHydrationNode = null;
|
|
36
|
+
function pushIsHydrating(value) {
|
|
37
|
+
isHydratingStack.push(isHydrating = value);
|
|
38
|
+
}
|
|
39
|
+
function popIsHydrating() {
|
|
40
|
+
isHydratingStack.pop();
|
|
41
|
+
isHydrating = isHydratingStack[isHydratingStack.length - 1] || false;
|
|
42
|
+
}
|
|
43
|
+
function runWithoutHydration(fn) {
|
|
44
|
+
try {
|
|
45
|
+
pushIsHydrating(false);
|
|
46
|
+
return fn();
|
|
47
|
+
} finally {
|
|
48
|
+
popIsHydrating();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
48
51
|
let isOptimized$1 = false;
|
|
49
|
-
function
|
|
50
|
-
adoptTemplate = adoptTemplateImpl;
|
|
51
|
-
locateHydrationNode = locateHydrationNodeImpl;
|
|
52
|
+
function performHydration(fn, setup, cleanup) {
|
|
52
53
|
if (!isOptimized$1) {
|
|
53
|
-
|
|
54
|
+
adoptTemplate = adoptTemplateImpl;
|
|
55
|
+
locateHydrationNode = locateHydrationNodeImpl;
|
|
56
|
+
Comment.prototype.$fe = void 0;
|
|
57
|
+
Node.prototype.$pns = void 0;
|
|
58
|
+
Node.prototype.$idx = void 0;
|
|
59
|
+
Node.prototype.$llc = void 0;
|
|
60
|
+
Node.prototype.$lpn = void 0;
|
|
61
|
+
Node.prototype.$lan = void 0;
|
|
62
|
+
Node.prototype.$lin = void 0;
|
|
63
|
+
Node.prototype.$curIdx = void 0;
|
|
54
64
|
isOptimized$1 = true;
|
|
55
65
|
}
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
enableHydrationNodeLookup();
|
|
67
|
+
pushIsHydrating(true);
|
|
68
|
+
setup();
|
|
58
69
|
const res = fn();
|
|
59
|
-
|
|
70
|
+
cleanup();
|
|
60
71
|
currentHydrationNode = null;
|
|
61
|
-
|
|
72
|
+
popIsHydrating();
|
|
73
|
+
if (!isHydrating) disableHydrationNodeLookup();
|
|
62
74
|
return res;
|
|
63
75
|
}
|
|
76
|
+
function withHydration(container, fn) {
|
|
77
|
+
const setup = () => setInsertionState(container);
|
|
78
|
+
const cleanup = () => resetInsertionState();
|
|
79
|
+
return performHydration(fn, setup, cleanup);
|
|
80
|
+
}
|
|
81
|
+
function hydrateNode(node, fn) {
|
|
82
|
+
const setup = () => currentHydrationNode = node;
|
|
83
|
+
const cleanup = () => {
|
|
84
|
+
};
|
|
85
|
+
return performHydration(fn, setup, cleanup);
|
|
86
|
+
}
|
|
64
87
|
let adoptTemplate;
|
|
65
88
|
let locateHydrationNode;
|
|
66
89
|
const isComment = (node, data) => node.nodeType === 8 && node.data === data;
|
|
90
|
+
function setCurrentHydrationNode(node) {
|
|
91
|
+
currentHydrationNode = node;
|
|
92
|
+
}
|
|
93
|
+
function locateNextSiblingOfParent(n) {
|
|
94
|
+
if (!n.parentNode) return null;
|
|
95
|
+
return n.parentNode.nextSibling || locateNextSiblingOfParent(n.parentNode);
|
|
96
|
+
}
|
|
97
|
+
function advanceHydrationNode(node) {
|
|
98
|
+
const ret = node.nextSibling || // pns is short for "parent next sibling"
|
|
99
|
+
node.$pns || (node.$pns = locateNextSiblingOfParent(node));
|
|
100
|
+
if (ret) setCurrentHydrationNode(ret);
|
|
101
|
+
}
|
|
67
102
|
function adoptTemplateImpl(node, template) {
|
|
68
103
|
if (!(template[0] === "<" && template[1] === "!")) {
|
|
69
|
-
while (node.nodeType === 8)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
warn(`template: ${template}`);
|
|
76
|
-
warn("hydration mismatch!");
|
|
104
|
+
while (node.nodeType === 8) {
|
|
105
|
+
node = node.nextSibling;
|
|
106
|
+
if (template.trim() === "" && isComment(node, "]") && isComment(node.previousSibling, "[")) {
|
|
107
|
+
node.before(node = createTextNode());
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
77
110
|
}
|
|
78
111
|
}
|
|
79
|
-
|
|
112
|
+
const type = node.nodeType;
|
|
113
|
+
if (
|
|
114
|
+
// comment node
|
|
115
|
+
type === 8 && !template.startsWith("<!") || // element node
|
|
116
|
+
type === 1 && !template.startsWith(`<` + node.tagName.toLowerCase())
|
|
117
|
+
) {
|
|
118
|
+
node = handleMismatch(node, template);
|
|
119
|
+
}
|
|
120
|
+
currentHydrationNode = node.nextSibling;
|
|
80
121
|
return node;
|
|
81
122
|
}
|
|
123
|
+
function locateNextNode(node) {
|
|
124
|
+
return isComment(node, "[") ? _next(locateEndAnchor(node)) : isComment(node, "teleport start") ? _next(locateEndAnchor(node, "teleport start", "teleport end")) : _next(node);
|
|
125
|
+
}
|
|
82
126
|
function locateHydrationNodeImpl() {
|
|
83
127
|
let node;
|
|
84
|
-
if (insertionAnchor
|
|
85
|
-
|
|
128
|
+
if (insertionAnchor !== void 0) {
|
|
129
|
+
const { $lpn: lastPrepend, $lan: lastAppend, firstChild } = insertionParent;
|
|
130
|
+
if (insertionAnchor === 0) {
|
|
131
|
+
node = insertionParent.$lpn = lastPrepend ? locateNextNode(lastPrepend) : firstChild;
|
|
132
|
+
} else if (insertionAnchor instanceof Node) {
|
|
133
|
+
const { $lin: lastInsertedNode } = insertionAnchor;
|
|
134
|
+
node = insertionAnchor.$lin = lastInsertedNode ? locateNextNode(lastInsertedNode) : insertionAnchor;
|
|
135
|
+
} else {
|
|
136
|
+
node = insertionParent.$lan = lastAppend ? locateNextNode(lastAppend) : insertionAnchor === null ? firstChild : locateChildByLogicalIndex(insertionParent, insertionAnchor);
|
|
137
|
+
}
|
|
138
|
+
insertionParent.$llc = node;
|
|
139
|
+
node.$idx = insertionParent.$curIdx = insertionParent.$curIdx === void 0 ? 0 : insertionParent.$curIdx + 1;
|
|
86
140
|
} else {
|
|
87
|
-
node =
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
node = node.$fs;
|
|
91
|
-
} else {
|
|
92
|
-
let cur = node;
|
|
93
|
-
let curFragEnd = node;
|
|
94
|
-
let fragDepth = 0;
|
|
95
|
-
node = null;
|
|
96
|
-
while (cur) {
|
|
97
|
-
cur = cur.previousSibling;
|
|
98
|
-
if (cur) {
|
|
99
|
-
if (isComment(cur, "[")) {
|
|
100
|
-
curFragEnd.$fs = cur;
|
|
101
|
-
if (!fragDepth) {
|
|
102
|
-
node = cur;
|
|
103
|
-
break;
|
|
104
|
-
} else {
|
|
105
|
-
fragDepth--;
|
|
106
|
-
}
|
|
107
|
-
} else if (isComment(cur, "]")) {
|
|
108
|
-
curFragEnd = cur;
|
|
109
|
-
fragDepth++;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
141
|
+
node = currentHydrationNode;
|
|
142
|
+
if (insertionParent && (!node || node.parentNode !== insertionParent)) {
|
|
143
|
+
node = insertionParent.firstChild;
|
|
114
144
|
}
|
|
115
145
|
}
|
|
116
146
|
if (!!(process.env.NODE_ENV !== "production") && !node) {
|
|
117
|
-
|
|
147
|
+
throw new Error(
|
|
148
|
+
`No current hydration node was found.
|
|
149
|
+
this is likely a Vue internal bug.`
|
|
150
|
+
);
|
|
118
151
|
}
|
|
119
152
|
resetInsertionState();
|
|
120
153
|
currentHydrationNode = node;
|
|
121
154
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.nodes = nodes;
|
|
155
|
+
function locateEndAnchor(node, open = "[", close = "]") {
|
|
156
|
+
if (node.$fe) {
|
|
157
|
+
return node.$fe;
|
|
126
158
|
}
|
|
159
|
+
const stack = [node];
|
|
160
|
+
while ((node = node.nextSibling) && stack.length > 0) {
|
|
161
|
+
if (node.nodeType === 8) {
|
|
162
|
+
if (node.data === open) {
|
|
163
|
+
stack.push(node);
|
|
164
|
+
} else if (node.data === close) {
|
|
165
|
+
const matchingOpen = stack.pop();
|
|
166
|
+
matchingOpen.$fe = node;
|
|
167
|
+
if (stack.length === 0) return node;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
127
172
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
173
|
+
function locateFragmentEndAnchor(label = "]") {
|
|
174
|
+
let node = currentHydrationNode;
|
|
175
|
+
while (node) {
|
|
176
|
+
if (isComment(node, label)) return node;
|
|
177
|
+
node = node.nextSibling;
|
|
132
178
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
function handleMismatch(node, template) {
|
|
182
|
+
if (!isMismatchAllowed(node.parentElement, 1)) {
|
|
183
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
184
|
+
`Hydration node mismatch:
|
|
185
|
+
- rendered on server:`,
|
|
186
|
+
node,
|
|
187
|
+
node.nodeType === 3 ? `(text)` : isComment(node, "[[") ? `(start of block node)` : ``,
|
|
188
|
+
`
|
|
189
|
+
- expected on client:`,
|
|
190
|
+
template
|
|
191
|
+
);
|
|
192
|
+
logMismatchError();
|
|
193
|
+
}
|
|
194
|
+
if (isComment(node, "[")) {
|
|
195
|
+
removeFragmentNodes(node);
|
|
196
|
+
}
|
|
197
|
+
const next = _next(node);
|
|
198
|
+
const container = parentNode(node);
|
|
199
|
+
remove(node, container);
|
|
200
|
+
if (template[0] !== "<") {
|
|
201
|
+
return container.insertBefore(createTextNode(template), next);
|
|
202
|
+
}
|
|
203
|
+
const t = createElement("template");
|
|
204
|
+
t.innerHTML = template;
|
|
205
|
+
const newNode = _child(t.content).cloneNode(true);
|
|
206
|
+
newNode.innerHTML = node.innerHTML;
|
|
207
|
+
Array.from(node.attributes).forEach((attr) => {
|
|
208
|
+
newNode.setAttribute(attr.name, attr.value);
|
|
209
|
+
});
|
|
210
|
+
container.insertBefore(newNode, next);
|
|
211
|
+
return newNode;
|
|
212
|
+
}
|
|
213
|
+
let hasLoggedMismatchError = false;
|
|
214
|
+
const logMismatchError = () => {
|
|
215
|
+
if (hasLoggedMismatchError) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
console.error("Hydration completed but contains mismatches.");
|
|
219
|
+
hasLoggedMismatchError = true;
|
|
220
|
+
};
|
|
221
|
+
function removeFragmentNodes(node, endAnchor) {
|
|
222
|
+
const end = endAnchor || locateEndAnchor(node);
|
|
223
|
+
while (true) {
|
|
224
|
+
const next = _next(node);
|
|
225
|
+
if (next && next !== end) {
|
|
226
|
+
remove(next, parentNode(node));
|
|
148
227
|
} else {
|
|
149
|
-
|
|
150
|
-
this.nodes = [];
|
|
151
|
-
}
|
|
152
|
-
if (this.fallback && !isValidBlock(this.nodes)) {
|
|
153
|
-
parent && remove(this.nodes, parent);
|
|
154
|
-
this.nodes = (this.scope || (this.scope = new EffectScope())).run(this.fallback) || [];
|
|
155
|
-
parent && insert(this.nodes, parent, this.anchor);
|
|
228
|
+
break;
|
|
156
229
|
}
|
|
157
|
-
setActiveSub(prevSub);
|
|
158
230
|
}
|
|
159
231
|
}
|
|
160
|
-
|
|
161
|
-
|
|
232
|
+
|
|
233
|
+
// @__NO_SIDE_EFFECTS__
|
|
234
|
+
function createElement(tagName) {
|
|
235
|
+
return document.createElement(tagName);
|
|
162
236
|
}
|
|
163
|
-
|
|
164
|
-
|
|
237
|
+
// @__NO_SIDE_EFFECTS__
|
|
238
|
+
function createTextNode(value = "") {
|
|
239
|
+
return document.createTextNode(value);
|
|
165
240
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
} else if (isVaporComponent(block)) {
|
|
170
|
-
return isValidBlock(block.block);
|
|
171
|
-
} else if (isArray(block)) {
|
|
172
|
-
return block.length > 0 && block.every(isValidBlock);
|
|
173
|
-
} else {
|
|
174
|
-
return isValidBlock(block.nodes);
|
|
175
|
-
}
|
|
241
|
+
// @__NO_SIDE_EFFECTS__
|
|
242
|
+
function createComment(data) {
|
|
243
|
+
return document.createComment(data);
|
|
176
244
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
insert(b, parent, anchor);
|
|
192
|
-
}
|
|
193
|
-
} else {
|
|
194
|
-
if (block.insert) {
|
|
195
|
-
block.insert(parent, anchor);
|
|
196
|
-
} else {
|
|
197
|
-
insert(block.nodes, parent, anchor);
|
|
198
|
-
}
|
|
199
|
-
if (block.anchor) insert(block.anchor, parent, anchor);
|
|
245
|
+
// @__NO_SIDE_EFFECTS__
|
|
246
|
+
function querySelector(selectors) {
|
|
247
|
+
return document.querySelector(selectors);
|
|
248
|
+
}
|
|
249
|
+
/*! @__NO_SIDE_EFFECTS__ */
|
|
250
|
+
// @__NO_SIDE_EFFECTS__
|
|
251
|
+
function parentNode(node) {
|
|
252
|
+
return node.parentNode;
|
|
253
|
+
}
|
|
254
|
+
const _txt = _child;
|
|
255
|
+
const __txt = /* @__NO_SIDE_EFFECTS__ */ (node) => {
|
|
256
|
+
let n = node.firstChild;
|
|
257
|
+
if (!n) {
|
|
258
|
+
return node.appendChild(/* @__PURE__ */ createTextNode());
|
|
200
259
|
}
|
|
260
|
+
return n;
|
|
261
|
+
};
|
|
262
|
+
// @__NO_SIDE_EFFECTS__
|
|
263
|
+
function _child(node) {
|
|
264
|
+
return node.firstChild;
|
|
201
265
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
266
|
+
// @__NO_SIDE_EFFECTS__
|
|
267
|
+
function __child(node, logicalIndex = 0) {
|
|
268
|
+
return locateChildByLogicalIndex(node, logicalIndex);
|
|
205
269
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
270
|
+
// @__NO_SIDE_EFFECTS__
|
|
271
|
+
function _nthChild(node, i) {
|
|
272
|
+
return node.childNodes[i];
|
|
273
|
+
}
|
|
274
|
+
// @__NO_SIDE_EFFECTS__
|
|
275
|
+
function __nthChild(node, logicalIndex) {
|
|
276
|
+
return locateChildByLogicalIndex(node, logicalIndex);
|
|
277
|
+
}
|
|
278
|
+
// @__NO_SIDE_EFFECTS__
|
|
279
|
+
function _next(node) {
|
|
280
|
+
return node.nextSibling;
|
|
281
|
+
}
|
|
282
|
+
// @__NO_SIDE_EFFECTS__
|
|
283
|
+
function __next(node, logicalIndex) {
|
|
284
|
+
return locateChildByLogicalIndex(
|
|
285
|
+
node.parentNode,
|
|
286
|
+
logicalIndex
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
const txt = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
290
|
+
return txt.impl(...args);
|
|
291
|
+
};
|
|
292
|
+
txt.impl = _txt;
|
|
293
|
+
const child = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
294
|
+
return child.impl(...args);
|
|
295
|
+
};
|
|
296
|
+
child.impl = _child;
|
|
297
|
+
const next = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
298
|
+
return next.impl(...args);
|
|
299
|
+
};
|
|
300
|
+
next.impl = _next;
|
|
301
|
+
const nthChild = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
302
|
+
return nthChild.impl(...args);
|
|
303
|
+
};
|
|
304
|
+
nthChild.impl = _nthChild;
|
|
305
|
+
function enableHydrationNodeLookup() {
|
|
306
|
+
txt.impl = __txt;
|
|
307
|
+
child.impl = __child;
|
|
308
|
+
next.impl = __next;
|
|
309
|
+
nthChild.impl = __nthChild;
|
|
310
|
+
}
|
|
311
|
+
function disableHydrationNodeLookup() {
|
|
312
|
+
txt.impl = _txt;
|
|
313
|
+
child.impl = _child;
|
|
314
|
+
next.impl = _next;
|
|
315
|
+
nthChild.impl = _nthChild;
|
|
316
|
+
}
|
|
317
|
+
function locateChildByLogicalIndex(parent, logicalIndex) {
|
|
318
|
+
let child2 = parent.$llc || parent.firstChild;
|
|
319
|
+
let fromIndex = child2.$idx || 0;
|
|
320
|
+
while (child2) {
|
|
321
|
+
if (fromIndex === logicalIndex) {
|
|
322
|
+
child2.$idx = logicalIndex;
|
|
323
|
+
return parent.$llc = child2;
|
|
224
324
|
}
|
|
325
|
+
child2 = isComment(child2, "[") ? (
|
|
326
|
+
// fragment start: jump to the node after the matching end anchor
|
|
327
|
+
locateEndAnchor(child2).nextSibling
|
|
328
|
+
) : child2.nextSibling;
|
|
329
|
+
fromIndex++;
|
|
225
330
|
}
|
|
331
|
+
return null;
|
|
226
332
|
}
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
const nodes = [];
|
|
234
|
-
if (block instanceof Node) {
|
|
235
|
-
nodes.push(block);
|
|
236
|
-
} else if (isArray(block)) {
|
|
237
|
-
block.forEach((child) => nodes.push(...normalizeBlock(child)));
|
|
238
|
-
} else if (isVaporComponent(block)) {
|
|
239
|
-
nodes.push(...normalizeBlock(block.block));
|
|
240
|
-
} else {
|
|
241
|
-
nodes.push(...normalizeBlock(block.nodes));
|
|
242
|
-
block.anchor && nodes.push(block.anchor);
|
|
243
|
-
}
|
|
244
|
-
return nodes;
|
|
333
|
+
function updateLastLogicalChild(parent, child2) {
|
|
334
|
+
if (!isComment(child2, "]")) return;
|
|
335
|
+
child2.$idx = parent.$curIdx || 0;
|
|
336
|
+
parent.$llc = child2;
|
|
245
337
|
}
|
|
246
338
|
|
|
247
339
|
class RenderEffect extends ReactiveEffect {
|
|
@@ -266,6 +358,9 @@ class RenderEffect extends ReactiveEffect {
|
|
|
266
358
|
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
267
359
|
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
268
360
|
}
|
|
361
|
+
if (!!(process.env.NODE_ENV !== "production") || instance.type.ce) {
|
|
362
|
+
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
363
|
+
}
|
|
269
364
|
job.i = instance;
|
|
270
365
|
}
|
|
271
366
|
this.job = job;
|
|
@@ -307,70 +402,506 @@ function renderEffect(fn, noLifecycle = false) {
|
|
|
307
402
|
effect.run();
|
|
308
403
|
}
|
|
309
404
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (options.effect) {
|
|
317
|
-
onEffectCleanup(() => {
|
|
318
|
-
el.removeEventListener(event, handler, options);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
function delegate(el, event, handler) {
|
|
323
|
-
const key = `$evt${event}`;
|
|
324
|
-
const existing = el[key];
|
|
325
|
-
if (existing) {
|
|
326
|
-
if (isArray(existing)) {
|
|
327
|
-
existing.push(handler);
|
|
328
|
-
} else {
|
|
329
|
-
el[key] = [existing, handler];
|
|
330
|
-
}
|
|
331
|
-
} else {
|
|
332
|
-
el[key] = handler;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
const delegatedEvents = /* @__PURE__ */ Object.create(null);
|
|
336
|
-
const delegateEvents = (...names) => {
|
|
337
|
-
for (const name of names) {
|
|
338
|
-
if (!delegatedEvents[name]) {
|
|
339
|
-
delegatedEvents[name] = true;
|
|
340
|
-
document.addEventListener(name, delegatedEventHandler);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
405
|
+
const displayName = "VaporTransition";
|
|
406
|
+
const decorate$1 = (t) => {
|
|
407
|
+
t.displayName = displayName;
|
|
408
|
+
t.props = TransitionPropsValidators;
|
|
409
|
+
t.__vapor = true;
|
|
410
|
+
return t;
|
|
343
411
|
};
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
412
|
+
const VaporTransition = /* @__PURE__ */ decorate$1(
|
|
413
|
+
(props, { slots, attrs }) => {
|
|
414
|
+
let resetDisplay;
|
|
415
|
+
if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
|
|
416
|
+
const {
|
|
417
|
+
content: { firstChild },
|
|
418
|
+
parentNode
|
|
419
|
+
} = currentHydrationNode;
|
|
420
|
+
if (firstChild) {
|
|
421
|
+
if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
|
|
422
|
+
const originalDisplay = firstChild.style.display;
|
|
423
|
+
firstChild.style.display = "none";
|
|
424
|
+
resetDisplay = () => firstChild.style.display = originalDisplay;
|
|
425
|
+
}
|
|
426
|
+
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
427
|
+
setCurrentHydrationNode(firstChild);
|
|
428
|
+
}
|
|
356
429
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
430
|
+
const children = slots.default && slots.default();
|
|
431
|
+
if (!children) return;
|
|
432
|
+
const instance = currentInstance;
|
|
433
|
+
const { mode } = props;
|
|
434
|
+
checkTransitionMode(mode);
|
|
435
|
+
let resolvedProps;
|
|
436
|
+
let isMounted = false;
|
|
437
|
+
renderEffect(() => {
|
|
438
|
+
resolvedProps = resolveTransitionProps(props);
|
|
439
|
+
if (isMounted) {
|
|
440
|
+
if (isFragment(children)) {
|
|
441
|
+
children.$transition.props = resolvedProps;
|
|
442
|
+
} else {
|
|
443
|
+
const child = findTransitionBlock(children);
|
|
444
|
+
if (child) {
|
|
445
|
+
child.$transition.props = resolvedProps;
|
|
446
|
+
applyTransitionHooks(child, child.$transition, void 0, true);
|
|
366
447
|
}
|
|
367
448
|
}
|
|
368
449
|
} else {
|
|
369
|
-
|
|
370
|
-
if (e.cancelBubble) return;
|
|
450
|
+
isMounted = true;
|
|
371
451
|
}
|
|
372
|
-
}
|
|
373
|
-
|
|
452
|
+
});
|
|
453
|
+
let fallthroughAttrs = true;
|
|
454
|
+
if (instance.hasFallthrough) {
|
|
455
|
+
renderEffect(() => {
|
|
456
|
+
const resolvedAttrs = extend({}, attrs);
|
|
457
|
+
const child = findTransitionBlock(children);
|
|
458
|
+
if (child) {
|
|
459
|
+
child.$root = true;
|
|
460
|
+
applyFallthroughProps(child, resolvedAttrs);
|
|
461
|
+
fallthroughAttrs = false;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
const hooks = applyTransitionHooks(
|
|
466
|
+
children,
|
|
467
|
+
{
|
|
468
|
+
state: useTransitionState(),
|
|
469
|
+
props: resolvedProps,
|
|
470
|
+
instance
|
|
471
|
+
},
|
|
472
|
+
fallthroughAttrs
|
|
473
|
+
);
|
|
474
|
+
if (resetDisplay && resolvedProps.appear) {
|
|
475
|
+
const child = findTransitionBlock(children);
|
|
476
|
+
hooks.beforeEnter(child);
|
|
477
|
+
resetDisplay();
|
|
478
|
+
queuePostFlushCb(() => hooks.enter(child));
|
|
479
|
+
}
|
|
480
|
+
return children;
|
|
481
|
+
}
|
|
482
|
+
);
|
|
483
|
+
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
484
|
+
const { leavingNodes } = state;
|
|
485
|
+
const context = {
|
|
486
|
+
setLeavingNodeCache: (el) => {
|
|
487
|
+
leavingNodes.set(key, el);
|
|
488
|
+
},
|
|
489
|
+
unsetLeavingNodeCache: (el) => {
|
|
490
|
+
const leavingNode = leavingNodes.get(key);
|
|
491
|
+
if (leavingNode === el) {
|
|
492
|
+
leavingNodes.delete(key);
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
earlyRemove: () => {
|
|
496
|
+
const leavingNode = leavingNodes.get(key);
|
|
497
|
+
if (leavingNode && leavingNode[leaveCbKey]) {
|
|
498
|
+
leavingNode[leaveCbKey]();
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
cloneHooks: (block) => {
|
|
502
|
+
const hooks = resolveTransitionHooks(
|
|
503
|
+
block,
|
|
504
|
+
props,
|
|
505
|
+
state,
|
|
506
|
+
instance,
|
|
507
|
+
postClone
|
|
508
|
+
);
|
|
509
|
+
if (postClone) postClone(hooks);
|
|
510
|
+
return hooks;
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
return context;
|
|
514
|
+
};
|
|
515
|
+
function resolveTransitionHooks(block, props, state, instance, postClone) {
|
|
516
|
+
const context = getTransitionHooksContext(
|
|
517
|
+
String(block.$key),
|
|
518
|
+
props,
|
|
519
|
+
state,
|
|
520
|
+
instance,
|
|
521
|
+
postClone
|
|
522
|
+
);
|
|
523
|
+
const hooks = baseResolveTransitionHooks(
|
|
524
|
+
context,
|
|
525
|
+
props,
|
|
526
|
+
state,
|
|
527
|
+
instance
|
|
528
|
+
);
|
|
529
|
+
hooks.state = state;
|
|
530
|
+
hooks.props = props;
|
|
531
|
+
hooks.instance = instance;
|
|
532
|
+
return hooks;
|
|
533
|
+
}
|
|
534
|
+
function applyTransitionHooks(block, hooks, fallthroughAttrs = true, isResolved = false) {
|
|
535
|
+
if (isArray(block)) {
|
|
536
|
+
block = block.filter((b) => !(b instanceof Comment));
|
|
537
|
+
if (block.length === 1) {
|
|
538
|
+
block = block[0];
|
|
539
|
+
} else if (block.length === 0) {
|
|
540
|
+
return hooks;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const isFrag = isFragment(block);
|
|
544
|
+
const child = isResolved ? block : findTransitionBlock(block, isFrag);
|
|
545
|
+
if (!child) {
|
|
546
|
+
if (isFrag) setTransitionHooksOnFragment(block, hooks);
|
|
547
|
+
return hooks;
|
|
548
|
+
}
|
|
549
|
+
const { props, instance, state, delayedLeave, group } = hooks;
|
|
550
|
+
let resolvedHooks = resolveTransitionHooks(
|
|
551
|
+
child,
|
|
552
|
+
props,
|
|
553
|
+
state,
|
|
554
|
+
instance,
|
|
555
|
+
(hooks2) => resolvedHooks = hooks2
|
|
556
|
+
);
|
|
557
|
+
resolvedHooks.delayedLeave = delayedLeave;
|
|
558
|
+
resolvedHooks.group = group;
|
|
559
|
+
child.$transition = resolvedHooks;
|
|
560
|
+
if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
|
|
561
|
+
if (fallthroughAttrs && instance.hasFallthrough) {
|
|
562
|
+
child.$root = true;
|
|
563
|
+
applyFallthroughProps(child, instance.attrs);
|
|
564
|
+
}
|
|
565
|
+
return resolvedHooks;
|
|
566
|
+
}
|
|
567
|
+
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
568
|
+
const leavingBlock = findTransitionBlock(block);
|
|
569
|
+
if (!leavingBlock) return void 0;
|
|
570
|
+
const { props, state, instance } = enterHooks;
|
|
571
|
+
const leavingHooks = resolveTransitionHooks(
|
|
572
|
+
leavingBlock,
|
|
573
|
+
props,
|
|
574
|
+
state,
|
|
575
|
+
instance
|
|
576
|
+
);
|
|
577
|
+
leavingBlock.$transition = leavingHooks;
|
|
578
|
+
const { mode } = props;
|
|
579
|
+
if (mode === "out-in") {
|
|
580
|
+
state.isLeaving = true;
|
|
581
|
+
leavingHooks.afterLeave = () => {
|
|
582
|
+
state.isLeaving = false;
|
|
583
|
+
afterLeaveCb();
|
|
584
|
+
leavingBlock.$transition = void 0;
|
|
585
|
+
delete leavingHooks.afterLeave;
|
|
586
|
+
};
|
|
587
|
+
} else if (mode === "in-out") {
|
|
588
|
+
leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
|
|
589
|
+
state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
|
|
590
|
+
block2[leaveCbKey] = () => {
|
|
591
|
+
earlyRemove();
|
|
592
|
+
block2[leaveCbKey] = void 0;
|
|
593
|
+
leavingBlock.$transition = void 0;
|
|
594
|
+
delete enterHooks.delayedLeave;
|
|
595
|
+
};
|
|
596
|
+
enterHooks.delayedLeave = () => {
|
|
597
|
+
delayedLeave();
|
|
598
|
+
leavingBlock.$transition = void 0;
|
|
599
|
+
delete enterHooks.delayedLeave;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function findTransitionBlock(block, inFragment = false) {
|
|
605
|
+
let child;
|
|
606
|
+
if (block instanceof Node) {
|
|
607
|
+
if (block instanceof Element) child = block;
|
|
608
|
+
} else if (isVaporComponent(block)) {
|
|
609
|
+
if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
|
|
610
|
+
child = block;
|
|
611
|
+
} else {
|
|
612
|
+
if (getComponentName(block.type) === displayName) return void 0;
|
|
613
|
+
child = findTransitionBlock(block.block, inFragment);
|
|
614
|
+
if (child && child.$key === void 0) child.$key = block.uid;
|
|
615
|
+
}
|
|
616
|
+
} else if (isArray(block)) {
|
|
617
|
+
let hasFound = false;
|
|
618
|
+
for (const c of block) {
|
|
619
|
+
if (c instanceof Comment) continue;
|
|
620
|
+
if (isFragment(c)) inFragment = true;
|
|
621
|
+
const item = findTransitionBlock(c, inFragment);
|
|
622
|
+
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
623
|
+
warn(
|
|
624
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
625
|
+
);
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
child = item;
|
|
629
|
+
hasFound = true;
|
|
630
|
+
if (!!!(process.env.NODE_ENV !== "production")) break;
|
|
631
|
+
}
|
|
632
|
+
} else if (isFragment(block)) {
|
|
633
|
+
inFragment = true;
|
|
634
|
+
if (block.insert) {
|
|
635
|
+
child = block;
|
|
636
|
+
} else {
|
|
637
|
+
child = findTransitionBlock(block.nodes, true);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
|
|
641
|
+
warn("Transition component has no valid child element");
|
|
642
|
+
}
|
|
643
|
+
return child;
|
|
644
|
+
}
|
|
645
|
+
function setTransitionHooksOnFragment(block, hooks) {
|
|
646
|
+
if (isFragment(block)) {
|
|
647
|
+
block.$transition = hooks;
|
|
648
|
+
if (block.nodes && isFragment(block.nodes)) {
|
|
649
|
+
setTransitionHooksOnFragment(block.nodes, hooks);
|
|
650
|
+
}
|
|
651
|
+
} else if (isArray(block)) {
|
|
652
|
+
for (let i = 0; i < block.length; i++) {
|
|
653
|
+
setTransitionHooksOnFragment(block[i], hooks);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
function setTransitionHooks(block, hooks) {
|
|
658
|
+
if (isVaporComponent(block)) {
|
|
659
|
+
block = findTransitionBlock(block.block);
|
|
660
|
+
if (!block) return;
|
|
661
|
+
}
|
|
662
|
+
block.$transition = hooks;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
class VaporFragment {
|
|
666
|
+
constructor(nodes) {
|
|
667
|
+
this.vnode = null;
|
|
668
|
+
this.nodes = nodes;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
class ForFragment extends VaporFragment {
|
|
672
|
+
constructor(nodes) {
|
|
673
|
+
super(nodes);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
class DynamicFragment extends VaporFragment {
|
|
677
|
+
constructor(anchorLabel) {
|
|
678
|
+
super([]);
|
|
679
|
+
this.hydrate = (isEmpty = false) => {
|
|
680
|
+
if (this.anchor) return;
|
|
681
|
+
if (this.anchorLabel === "if") {
|
|
682
|
+
if (isEmpty) {
|
|
683
|
+
this.anchor = locateFragmentEndAnchor("");
|
|
684
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
685
|
+
throw new Error(
|
|
686
|
+
"Failed to locate if anchor. this is likely a Vue internal bug."
|
|
687
|
+
);
|
|
688
|
+
} else {
|
|
689
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
690
|
+
this.anchor.data = this.anchorLabel;
|
|
691
|
+
}
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
} else if (this.anchorLabel === "slot") {
|
|
696
|
+
if (isEmpty && isComment(currentHydrationNode, "")) {
|
|
697
|
+
this.anchor = currentHydrationNode;
|
|
698
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
699
|
+
this.anchor.data = this.anchorLabel;
|
|
700
|
+
}
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
this.anchor = locateFragmentEndAnchor();
|
|
704
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
705
|
+
throw new Error(
|
|
706
|
+
"Failed to locate slot anchor. this is likely a Vue internal bug."
|
|
707
|
+
);
|
|
708
|
+
} else {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
const { parentNode, nextNode } = findBlockNode(this.nodes);
|
|
713
|
+
queuePostFlushCb(() => {
|
|
714
|
+
parentNode.insertBefore(
|
|
715
|
+
this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
|
|
716
|
+
nextNode
|
|
717
|
+
);
|
|
718
|
+
});
|
|
719
|
+
};
|
|
720
|
+
if (isHydrating) {
|
|
721
|
+
this.anchorLabel = anchorLabel;
|
|
722
|
+
locateHydrationNode();
|
|
723
|
+
} else {
|
|
724
|
+
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? createComment(anchorLabel) : createTextNode();
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
update(render, key = render) {
|
|
728
|
+
if (key === this.current) {
|
|
729
|
+
if (isHydrating) this.hydrate(true);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
this.current = key;
|
|
733
|
+
const prevSub = setActiveSub();
|
|
734
|
+
const parent = isHydrating ? null : this.anchor.parentNode;
|
|
735
|
+
const transition = this.$transition;
|
|
736
|
+
const instance = currentInstance;
|
|
737
|
+
this.inKeepAlive = isKeepAlive(instance);
|
|
738
|
+
if (this.scope) {
|
|
739
|
+
if (this.inKeepAlive) {
|
|
740
|
+
instance.processFragment(this);
|
|
741
|
+
if (!this.keptAliveScopes) this.keptAliveScopes = /* @__PURE__ */ new Map();
|
|
742
|
+
this.keptAliveScopes.set(this.current, this.scope);
|
|
743
|
+
} else {
|
|
744
|
+
this.scope.stop();
|
|
745
|
+
}
|
|
746
|
+
const mode = transition && transition.mode;
|
|
747
|
+
if (mode) {
|
|
748
|
+
applyTransitionLeaveHooks(
|
|
749
|
+
this.nodes,
|
|
750
|
+
transition,
|
|
751
|
+
() => this.render(render, instance, transition, parent)
|
|
752
|
+
);
|
|
753
|
+
parent && remove(this.nodes, parent);
|
|
754
|
+
if (mode === "out-in") {
|
|
755
|
+
setActiveSub(prevSub);
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
} else {
|
|
759
|
+
parent && remove(this.nodes, parent);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
this.render(render, instance, transition, parent);
|
|
763
|
+
if (this.fallback) {
|
|
764
|
+
const hasNestedFragment = isFragment(this.nodes);
|
|
765
|
+
if (hasNestedFragment) {
|
|
766
|
+
setFragmentFallback(this.nodes, this.fallback);
|
|
767
|
+
}
|
|
768
|
+
const invalidFragment = findInvalidFragment(this);
|
|
769
|
+
if (invalidFragment) {
|
|
770
|
+
parent && remove(this.nodes, parent);
|
|
771
|
+
const scope = this.scope || (this.scope = new EffectScope());
|
|
772
|
+
scope.run(() => {
|
|
773
|
+
if (hasNestedFragment) {
|
|
774
|
+
renderFragmentFallback(invalidFragment);
|
|
775
|
+
} else {
|
|
776
|
+
this.nodes = this.fallback() || [];
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
parent && insert(this.nodes, parent, this.anchor);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
setActiveSub(prevSub);
|
|
783
|
+
if (isHydrating) this.hydrate();
|
|
784
|
+
}
|
|
785
|
+
render(render, instance, transition, parent) {
|
|
786
|
+
if (render) {
|
|
787
|
+
const scope = this.inKeepAlive && this.keptAliveScopes ? this.keptAliveScopes.get(this.current) : void 0;
|
|
788
|
+
if (scope) {
|
|
789
|
+
this.scope = scope;
|
|
790
|
+
this.keptAliveScopes.delete(this.current);
|
|
791
|
+
this.scope.resume();
|
|
792
|
+
} else {
|
|
793
|
+
this.scope = new EffectScope();
|
|
794
|
+
}
|
|
795
|
+
this.nodes = this.scope.run(render) || [];
|
|
796
|
+
if (this.inKeepAlive) {
|
|
797
|
+
instance.cacheFragment(this);
|
|
798
|
+
}
|
|
799
|
+
if (transition) {
|
|
800
|
+
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
801
|
+
}
|
|
802
|
+
if (parent) insert(this.nodes, parent, this.anchor);
|
|
803
|
+
} else {
|
|
804
|
+
this.scope = void 0;
|
|
805
|
+
this.nodes = [];
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
function setFragmentFallback(fragment, fallback) {
|
|
810
|
+
if (fragment.fallback) {
|
|
811
|
+
const originalFallback = fragment.fallback;
|
|
812
|
+
fragment.fallback = () => {
|
|
813
|
+
const fallbackNodes = originalFallback();
|
|
814
|
+
if (isValidBlock(fallbackNodes)) {
|
|
815
|
+
return fallbackNodes;
|
|
816
|
+
}
|
|
817
|
+
return fallback();
|
|
818
|
+
};
|
|
819
|
+
} else {
|
|
820
|
+
fragment.fallback = fallback;
|
|
821
|
+
}
|
|
822
|
+
if (isFragment(fragment.nodes)) {
|
|
823
|
+
setFragmentFallback(fragment.nodes, fragment.fallback);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
function renderFragmentFallback(fragment) {
|
|
827
|
+
if (fragment instanceof ForFragment) {
|
|
828
|
+
fragment.nodes[0] = [fragment.fallback() || []];
|
|
829
|
+
} else if (fragment instanceof DynamicFragment) {
|
|
830
|
+
fragment.update(fragment.fallback);
|
|
831
|
+
} else ;
|
|
832
|
+
}
|
|
833
|
+
function findInvalidFragment(fragment) {
|
|
834
|
+
if (isValidBlock(fragment.nodes)) return null;
|
|
835
|
+
return isFragment(fragment.nodes) ? findInvalidFragment(fragment.nodes) || fragment : fragment;
|
|
836
|
+
}
|
|
837
|
+
function isFragment(val) {
|
|
838
|
+
return val instanceof VaporFragment;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function addEventListener(el, event, handler, options) {
|
|
842
|
+
el.addEventListener(event, handler, options);
|
|
843
|
+
return () => el.removeEventListener(event, handler, options);
|
|
844
|
+
}
|
|
845
|
+
function on(el, event, handler, options = {}) {
|
|
846
|
+
addEventListener(el, event, handler, options);
|
|
847
|
+
if (options.effect) {
|
|
848
|
+
onEffectCleanup(() => {
|
|
849
|
+
el.removeEventListener(event, handler, options);
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
function delegate(el, event, handler) {
|
|
854
|
+
const key = `$evt${event}`;
|
|
855
|
+
const existing = el[key];
|
|
856
|
+
if (existing) {
|
|
857
|
+
if (isArray(existing)) {
|
|
858
|
+
existing.push(handler);
|
|
859
|
+
} else {
|
|
860
|
+
el[key] = [existing, handler];
|
|
861
|
+
}
|
|
862
|
+
} else {
|
|
863
|
+
el[key] = handler;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const delegatedEvents = /* @__PURE__ */ Object.create(null);
|
|
867
|
+
const delegateEvents = (...names) => {
|
|
868
|
+
for (const name of names) {
|
|
869
|
+
if (!delegatedEvents[name]) {
|
|
870
|
+
delegatedEvents[name] = true;
|
|
871
|
+
document.addEventListener(name, delegatedEventHandler);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
const delegatedEventHandler = (e) => {
|
|
876
|
+
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
877
|
+
if (e.target !== node) {
|
|
878
|
+
Object.defineProperty(e, "target", {
|
|
879
|
+
configurable: true,
|
|
880
|
+
value: node
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
Object.defineProperty(e, "currentTarget", {
|
|
884
|
+
configurable: true,
|
|
885
|
+
get() {
|
|
886
|
+
return node || document;
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
while (node !== null) {
|
|
890
|
+
const handlers = node[`$evt${e.type}`];
|
|
891
|
+
if (handlers) {
|
|
892
|
+
if (isArray(handlers)) {
|
|
893
|
+
for (const handler of handlers) {
|
|
894
|
+
if (!node.disabled) {
|
|
895
|
+
handler(e);
|
|
896
|
+
if (e.cancelBubble) return;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
} else {
|
|
900
|
+
handlers(e);
|
|
901
|
+
if (e.cancelBubble) return;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
374
905
|
}
|
|
375
906
|
};
|
|
376
907
|
function setDynamicEvents(el, events) {
|
|
@@ -378,6 +909,15 @@ function setDynamicEvents(el, events) {
|
|
|
378
909
|
on(el, name, events[name], { effect: true });
|
|
379
910
|
}
|
|
380
911
|
}
|
|
912
|
+
function createInvoker(handler) {
|
|
913
|
+
const i = currentInstance;
|
|
914
|
+
return (...args) => callWithAsyncErrorHandling(
|
|
915
|
+
handler,
|
|
916
|
+
i,
|
|
917
|
+
5,
|
|
918
|
+
args
|
|
919
|
+
);
|
|
920
|
+
}
|
|
381
921
|
|
|
382
922
|
const hasFallthroughKey = (key) => currentInstance.hasFallthrough && key in currentInstance.attrs;
|
|
383
923
|
function setProp(el, key, value) {
|
|
@@ -387,7 +927,7 @@ function setProp(el, key, value) {
|
|
|
387
927
|
setAttr(el, key, value);
|
|
388
928
|
}
|
|
389
929
|
}
|
|
390
|
-
function setAttr(el, key, value) {
|
|
930
|
+
function setAttr(el, key, value, isSVG = false) {
|
|
391
931
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
392
932
|
return;
|
|
393
933
|
}
|
|
@@ -396,19 +936,34 @@ function setAttr(el, key, value) {
|
|
|
396
936
|
} else if (key === "false-value") {
|
|
397
937
|
el._falseValue = value;
|
|
398
938
|
}
|
|
939
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value)) {
|
|
940
|
+
el[`$${key}`] = value;
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
399
943
|
if (value !== el[`$${key}`]) {
|
|
400
944
|
el[`$${key}`] = value;
|
|
401
|
-
if (
|
|
402
|
-
|
|
945
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
946
|
+
if (value != null) {
|
|
947
|
+
el.setAttributeNS(xlinkNS, key, value);
|
|
948
|
+
} else {
|
|
949
|
+
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
950
|
+
}
|
|
403
951
|
} else {
|
|
404
|
-
|
|
952
|
+
if (value != null) {
|
|
953
|
+
el.setAttribute(key, value);
|
|
954
|
+
} else {
|
|
955
|
+
el.removeAttribute(key);
|
|
956
|
+
}
|
|
405
957
|
}
|
|
406
958
|
}
|
|
407
959
|
}
|
|
408
|
-
function setDOMProp(el, key, value) {
|
|
960
|
+
function setDOMProp(el, key, value, forceHydrate = false, attrName) {
|
|
409
961
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
410
962
|
return;
|
|
411
963
|
}
|
|
964
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value) && !shouldForceHydrate(el, key) && !forceHydrate) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
412
967
|
const prev = el[key];
|
|
413
968
|
if (value === prev) {
|
|
414
969
|
return;
|
|
@@ -416,7 +971,9 @@ function setDOMProp(el, key, value) {
|
|
|
416
971
|
let needRemove = false;
|
|
417
972
|
if (value === "" || value == null) {
|
|
418
973
|
const type = typeof prev;
|
|
419
|
-
if (
|
|
974
|
+
if (type === "boolean") {
|
|
975
|
+
value = includeBooleanAttr(value);
|
|
976
|
+
} else if (value == null && type === "string") {
|
|
420
977
|
value = "";
|
|
421
978
|
needRemove = true;
|
|
422
979
|
} else if (type === "number") {
|
|
@@ -434,19 +991,35 @@ function setDOMProp(el, key, value) {
|
|
|
434
991
|
);
|
|
435
992
|
}
|
|
436
993
|
}
|
|
437
|
-
needRemove && el.removeAttribute(key);
|
|
994
|
+
needRemove && el.removeAttribute(attrName || key);
|
|
438
995
|
}
|
|
439
|
-
function setClass(el, value) {
|
|
996
|
+
function setClass(el, value, isSVG = false) {
|
|
440
997
|
if (el.$root) {
|
|
441
998
|
setClassIncremental(el, value);
|
|
442
|
-
} else
|
|
443
|
-
|
|
999
|
+
} else {
|
|
1000
|
+
value = normalizeClass(value);
|
|
1001
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, value, false)) {
|
|
1002
|
+
el.$cls = value;
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
if (value !== el.$cls) {
|
|
1006
|
+
if (isSVG) {
|
|
1007
|
+
el.setAttribute("class", el.$cls = value);
|
|
1008
|
+
} else {
|
|
1009
|
+
el.className = el.$cls = value;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
444
1012
|
}
|
|
445
1013
|
}
|
|
446
1014
|
function setClassIncremental(el, value) {
|
|
447
1015
|
const cacheKey = `$clsi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1016
|
+
const normalizedValue = normalizeClass(value);
|
|
1017
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, normalizedValue, true)) {
|
|
1018
|
+
el[cacheKey] = normalizedValue;
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
448
1021
|
const prev = el[cacheKey];
|
|
449
|
-
if ((value = el[cacheKey] =
|
|
1022
|
+
if ((value = el[cacheKey] = normalizedValue) !== prev) {
|
|
450
1023
|
const nextList = value.split(/\s+/);
|
|
451
1024
|
if (value) {
|
|
452
1025
|
el.classList.add(...nextList);
|
|
@@ -462,23 +1035,31 @@ function setStyle(el, value) {
|
|
|
462
1035
|
if (el.$root) {
|
|
463
1036
|
setStyleIncremental(el, value);
|
|
464
1037
|
} else {
|
|
465
|
-
const
|
|
466
|
-
|
|
467
|
-
|
|
1038
|
+
const normalizedValue = normalizeStyle(value);
|
|
1039
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !styleHasMismatch(el, value, normalizedValue, false)) {
|
|
1040
|
+
el.$sty = normalizedValue;
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
468
1044
|
}
|
|
469
1045
|
}
|
|
470
1046
|
function setStyleIncremental(el, value) {
|
|
471
1047
|
const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
1048
|
+
const normalizedValue = isString(value) ? parseStringStyle(value) : normalizeStyle(value);
|
|
1049
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !styleHasMismatch(el, value, normalizedValue, true)) {
|
|
1050
|
+
el[cacheKey] = normalizedValue;
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
476
1054
|
}
|
|
477
|
-
function setValue(el, value) {
|
|
1055
|
+
function setValue(el, value, forceHydrate = false) {
|
|
478
1056
|
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
479
1057
|
return;
|
|
480
1058
|
}
|
|
481
1059
|
el._value = value;
|
|
1060
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, "value", getClientText(el, value)) && !shouldForceHydrate(el, "value") && !forceHydrate) {
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
482
1063
|
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
483
1064
|
const newValue = value == null ? "" : value;
|
|
484
1065
|
if (oldValue !== newValue) {
|
|
@@ -489,56 +1070,149 @@ function setValue(el, value) {
|
|
|
489
1070
|
}
|
|
490
1071
|
}
|
|
491
1072
|
function setText(el, value) {
|
|
1073
|
+
if (isHydrating) {
|
|
1074
|
+
const clientText = getClientText(el.parentNode, value);
|
|
1075
|
+
if (el.nodeValue == clientText) {
|
|
1076
|
+
el.$txt = clientText;
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1080
|
+
`Hydration text mismatch in`,
|
|
1081
|
+
el.parentNode,
|
|
1082
|
+
`
|
|
1083
|
+
- rendered on server: ${JSON.stringify(el.data)}
|
|
1084
|
+
- expected on client: ${JSON.stringify(value)}`
|
|
1085
|
+
);
|
|
1086
|
+
logMismatchError();
|
|
1087
|
+
}
|
|
492
1088
|
if (el.$txt !== value) {
|
|
493
1089
|
el.nodeValue = el.$txt = value;
|
|
494
1090
|
}
|
|
495
1091
|
}
|
|
496
1092
|
function setElementText(el, value) {
|
|
497
|
-
|
|
1093
|
+
value = toDisplayString(value);
|
|
1094
|
+
if (isHydrating) {
|
|
1095
|
+
let clientText = getClientText(el, value);
|
|
1096
|
+
if (el.textContent === clientText) {
|
|
1097
|
+
el.$txt = clientText;
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
if (!isMismatchAllowed(el, 0)) {
|
|
1101
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1102
|
+
`Hydration text content mismatch on`,
|
|
1103
|
+
el,
|
|
1104
|
+
`
|
|
1105
|
+
- rendered on server: ${el.textContent}
|
|
1106
|
+
- expected on client: ${clientText}`
|
|
1107
|
+
);
|
|
1108
|
+
logMismatchError();
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
if (el.$txt !== value) {
|
|
498
1112
|
el.textContent = el.$txt = value;
|
|
499
1113
|
}
|
|
500
1114
|
}
|
|
501
|
-
function
|
|
1115
|
+
function setBlockText(block, value) {
|
|
502
1116
|
value = value == null ? "" : value;
|
|
503
|
-
if (
|
|
504
|
-
|
|
1117
|
+
if (block.$txt !== value) {
|
|
1118
|
+
setTextToBlock(block, block.$txt = value);
|
|
505
1119
|
}
|
|
506
1120
|
}
|
|
507
|
-
function
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
1121
|
+
function warnCannotSetProp(prop) {
|
|
1122
|
+
warn(
|
|
1123
|
+
`Extraneous non-props attributes (${prop}) were passed to component but could not be automatically inherited because component renders text or multiple root nodes.`
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
function setTextToBlock(block, value) {
|
|
1127
|
+
if (block instanceof Node) {
|
|
1128
|
+
if (block instanceof Element) {
|
|
1129
|
+
block.textContent = value;
|
|
1130
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1131
|
+
warnCannotSetProp("textContent");
|
|
1132
|
+
}
|
|
1133
|
+
} else if (isVaporComponent(block)) {
|
|
1134
|
+
setTextToBlock(block.block, value);
|
|
1135
|
+
} else if (isArray(block)) {
|
|
1136
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1137
|
+
warnCannotSetProp("textContent");
|
|
1138
|
+
}
|
|
1139
|
+
} else {
|
|
1140
|
+
setTextToBlock(block.nodes, value);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
function setHtml(el, value) {
|
|
1144
|
+
value = value == null ? "" : unsafeToTrustedHTML(value);
|
|
1145
|
+
if (el.$html !== value) {
|
|
1146
|
+
el.innerHTML = el.$html = value;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
function setBlockHtml(block, value) {
|
|
1150
|
+
value = value == null ? "" : unsafeToTrustedHTML(value);
|
|
1151
|
+
if (block.$html !== value) {
|
|
1152
|
+
setHtmlToBlock(block, block.$html = value);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
function setHtmlToBlock(block, value) {
|
|
1156
|
+
if (block instanceof Node) {
|
|
1157
|
+
if (block instanceof Element) {
|
|
1158
|
+
block.innerHTML = value;
|
|
1159
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1160
|
+
warnCannotSetProp("innerHTML");
|
|
1161
|
+
}
|
|
1162
|
+
} else if (isVaporComponent(block)) {
|
|
1163
|
+
setHtmlToBlock(block.block, value);
|
|
1164
|
+
} else if (isArray(block)) {
|
|
1165
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1166
|
+
warnCannotSetProp("innerHTML");
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
setHtmlToBlock(block.nodes, value);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
function setDynamicProps(el, args, root, isSVG) {
|
|
1173
|
+
const props = args.length > 1 ? mergeProps(...args) : args[0];
|
|
1174
|
+
const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1175
|
+
const prevKeys = el[cacheKey];
|
|
1176
|
+
if (root) el.$root = root;
|
|
1177
|
+
if (prevKeys) {
|
|
1178
|
+
for (const key of prevKeys) {
|
|
1179
|
+
if (!(key in props)) {
|
|
1180
|
+
setDynamicProp(el, key, null, isSVG);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
517
1183
|
}
|
|
518
1184
|
for (const key of el[cacheKey] = Object.keys(props)) {
|
|
519
|
-
setDynamicProp(el, key, props[key]);
|
|
1185
|
+
setDynamicProp(el, key, props[key], isSVG);
|
|
520
1186
|
}
|
|
521
1187
|
}
|
|
522
|
-
function setDynamicProp(el, key, value) {
|
|
523
|
-
|
|
1188
|
+
function setDynamicProp(el, key, value, isSVG = false) {
|
|
1189
|
+
let forceHydrate = false;
|
|
524
1190
|
if (key === "class") {
|
|
525
|
-
setClass(el, value);
|
|
1191
|
+
setClass(el, value, isSVG);
|
|
526
1192
|
} else if (key === "style") {
|
|
527
1193
|
setStyle(el, value);
|
|
528
1194
|
} else if (isOn(key)) {
|
|
529
1195
|
on(el, key[2].toLowerCase() + key.slice(3), value, { effect: true });
|
|
530
|
-
} else if (
|
|
1196
|
+
} else if (
|
|
1197
|
+
// force hydrate v-bind with .prop modifiers
|
|
1198
|
+
(forceHydrate = key[0] === ".") ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, value, isSVG)
|
|
1199
|
+
) {
|
|
531
1200
|
if (key === "innerHTML") {
|
|
532
1201
|
setHtml(el, value);
|
|
533
1202
|
} else if (key === "textContent") {
|
|
534
1203
|
setElementText(el, value);
|
|
535
1204
|
} else if (key === "value" && canSetValueDirectly(el.tagName)) {
|
|
536
|
-
setValue(el, value);
|
|
1205
|
+
setValue(el, value, forceHydrate);
|
|
537
1206
|
} else {
|
|
538
|
-
setDOMProp(el, key, value);
|
|
1207
|
+
setDOMProp(el, key, value, forceHydrate);
|
|
539
1208
|
}
|
|
1209
|
+
} else if (
|
|
1210
|
+
// custom elements
|
|
1211
|
+
el._isVueCE && (/[A-Z]/.test(key) || !isString(value))
|
|
1212
|
+
) {
|
|
1213
|
+
setDOMProp(el, camelize(key), value, forceHydrate, key);
|
|
540
1214
|
} else {
|
|
541
|
-
setAttr(el, key, value);
|
|
1215
|
+
setAttr(el, key, value, isSVG);
|
|
542
1216
|
}
|
|
543
1217
|
return value;
|
|
544
1218
|
}
|
|
@@ -547,19 +1221,535 @@ function optimizePropertyLookup() {
|
|
|
547
1221
|
if (isOptimized) return;
|
|
548
1222
|
isOptimized = true;
|
|
549
1223
|
const proto = Element.prototype;
|
|
550
|
-
proto.$
|
|
1224
|
+
proto.$transition = void 0;
|
|
1225
|
+
proto.$key = void 0;
|
|
1226
|
+
proto.$fc = proto.$evtclick = void 0;
|
|
551
1227
|
proto.$root = false;
|
|
552
|
-
proto.$html = proto.$
|
|
1228
|
+
proto.$html = proto.$cls = proto.$sty = "";
|
|
1229
|
+
Text.prototype.$txt = void 0;
|
|
1230
|
+
}
|
|
1231
|
+
function classHasMismatch(el, expected, isIncremental) {
|
|
1232
|
+
const actual = el.getAttribute("class");
|
|
1233
|
+
const actualClassSet = toClassSet(actual || "");
|
|
1234
|
+
const expectedClassSet = toClassSet(expected);
|
|
1235
|
+
let hasMismatch = false;
|
|
1236
|
+
if (isIncremental) {
|
|
1237
|
+
if (expected) {
|
|
1238
|
+
hasMismatch = Array.from(expectedClassSet).some(
|
|
1239
|
+
(cls) => !actualClassSet.has(cls)
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
} else {
|
|
1243
|
+
hasMismatch = !isSetEqual(actualClassSet, expectedClassSet);
|
|
1244
|
+
}
|
|
1245
|
+
if (hasMismatch) {
|
|
1246
|
+
warnPropMismatch(el, "class", 2, actual, expected);
|
|
1247
|
+
logMismatchError();
|
|
1248
|
+
return true;
|
|
1249
|
+
}
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
function styleHasMismatch(el, value, normalizedValue, isIncremental) {
|
|
1253
|
+
const actual = el.getAttribute("style");
|
|
1254
|
+
const actualStyleMap = toStyleMap(actual || "");
|
|
1255
|
+
const expected = isString(value) ? value : stringifyStyle(normalizedValue);
|
|
1256
|
+
const expectedStyleMap = toStyleMap(expected);
|
|
1257
|
+
if (el[vShowHidden]) {
|
|
1258
|
+
expectedStyleMap.set("display", "none");
|
|
1259
|
+
}
|
|
1260
|
+
let hasMismatch = false;
|
|
1261
|
+
if (isIncremental) {
|
|
1262
|
+
if (expected) {
|
|
1263
|
+
hasMismatch = Array.from(expectedStyleMap.entries()).some(
|
|
1264
|
+
([key, val]) => actualStyleMap.get(key) !== val
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
} else {
|
|
1268
|
+
hasMismatch = !isMapEqual(actualStyleMap, expectedStyleMap);
|
|
1269
|
+
}
|
|
1270
|
+
if (hasMismatch) {
|
|
1271
|
+
warnPropMismatch(el, "style", 3, actual, expected);
|
|
1272
|
+
logMismatchError();
|
|
1273
|
+
return true;
|
|
1274
|
+
}
|
|
1275
|
+
return false;
|
|
1276
|
+
}
|
|
1277
|
+
function attributeHasMismatch(el, key, value) {
|
|
1278
|
+
if (isValidHtmlOrSvgAttribute(el, key)) {
|
|
1279
|
+
const { actual, expected } = getAttributeMismatch(el, key, value);
|
|
1280
|
+
if (actual !== expected) {
|
|
1281
|
+
warnPropMismatch(el, key, 4, actual, expected);
|
|
1282
|
+
logMismatchError();
|
|
1283
|
+
return true;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return false;
|
|
1287
|
+
}
|
|
1288
|
+
function getClientText(el, value) {
|
|
1289
|
+
if (value[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
|
|
1290
|
+
value = value.slice(1);
|
|
1291
|
+
}
|
|
1292
|
+
return value;
|
|
1293
|
+
}
|
|
1294
|
+
function shouldForceHydrate(el, key) {
|
|
1295
|
+
const { tagName } = el;
|
|
1296
|
+
return (tagName === "INPUT" || tagName === "OPTION") && (key.endsWith("value") || key === "indeterminate") || // force hydrate custom element dynamic props
|
|
1297
|
+
tagName.includes("-");
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
let currentSlotScopeIds = null;
|
|
1301
|
+
function setCurrentSlotScopeIds(scopeIds) {
|
|
1302
|
+
try {
|
|
1303
|
+
return currentSlotScopeIds;
|
|
1304
|
+
} finally {
|
|
1305
|
+
currentSlotScopeIds = scopeIds;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
const dynamicSlotsProxyHandlers = {
|
|
1309
|
+
get: getSlot,
|
|
1310
|
+
has: (target, key) => !!getSlot(target, key),
|
|
1311
|
+
getOwnPropertyDescriptor(target, key) {
|
|
1312
|
+
const slot = getSlot(target, key);
|
|
1313
|
+
if (slot) {
|
|
1314
|
+
return {
|
|
1315
|
+
configurable: true,
|
|
1316
|
+
enumerable: true,
|
|
1317
|
+
value: slot
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
ownKeys(target) {
|
|
1322
|
+
let keys = Object.keys(target);
|
|
1323
|
+
const dynamicSources = target.$;
|
|
1324
|
+
if (dynamicSources) {
|
|
1325
|
+
keys = keys.filter((k) => k !== "$");
|
|
1326
|
+
for (const source of dynamicSources) {
|
|
1327
|
+
if (isFunction(source)) {
|
|
1328
|
+
const slot = source();
|
|
1329
|
+
if (isArray(slot)) {
|
|
1330
|
+
for (const s of slot) keys.push(String(s.name));
|
|
1331
|
+
} else {
|
|
1332
|
+
keys.push(String(slot.name));
|
|
1333
|
+
}
|
|
1334
|
+
} else {
|
|
1335
|
+
keys.push(...Object.keys(source));
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
return keys;
|
|
1340
|
+
},
|
|
1341
|
+
set: NO,
|
|
1342
|
+
deleteProperty: NO
|
|
1343
|
+
};
|
|
1344
|
+
function getSlot(target, key) {
|
|
1345
|
+
if (key === "$") return;
|
|
1346
|
+
const dynamicSources = target.$;
|
|
1347
|
+
if (dynamicSources) {
|
|
1348
|
+
let i = dynamicSources.length;
|
|
1349
|
+
let source;
|
|
1350
|
+
while (i--) {
|
|
1351
|
+
source = dynamicSources[i];
|
|
1352
|
+
if (isFunction(source)) {
|
|
1353
|
+
const slot = source();
|
|
1354
|
+
if (slot) {
|
|
1355
|
+
if (isArray(slot)) {
|
|
1356
|
+
for (const s of slot) {
|
|
1357
|
+
if (String(s.name) === key) return s.fn;
|
|
1358
|
+
}
|
|
1359
|
+
} else if (String(slot.name) === key) {
|
|
1360
|
+
return slot.fn;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
} else if (hasOwn(source, key)) {
|
|
1364
|
+
return source[key];
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
if (hasOwn(target, key)) {
|
|
1369
|
+
return target[key];
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
let currentSlotConsumer = null;
|
|
1373
|
+
function setCurrentSlotConsumer(consumer) {
|
|
1374
|
+
try {
|
|
1375
|
+
return currentSlotConsumer;
|
|
1376
|
+
} finally {
|
|
1377
|
+
currentSlotConsumer = consumer;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
function getParentInstance() {
|
|
1381
|
+
return currentSlotConsumer || currentInstance;
|
|
1382
|
+
}
|
|
1383
|
+
function withVaporCtx(fn) {
|
|
1384
|
+
const owner = currentInstance;
|
|
1385
|
+
return (...args) => {
|
|
1386
|
+
const prev = setCurrentInstance(owner);
|
|
1387
|
+
const prevConsumer = setCurrentSlotConsumer(prev[0]);
|
|
1388
|
+
try {
|
|
1389
|
+
return fn(...args);
|
|
1390
|
+
} finally {
|
|
1391
|
+
setCurrentInstance(...prev);
|
|
1392
|
+
setCurrentSlotConsumer(prevConsumer);
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
function createSlot(name, rawProps, fallback, noSlotted) {
|
|
1397
|
+
const _insertionParent = insertionParent;
|
|
1398
|
+
const _insertionAnchor = insertionAnchor;
|
|
1399
|
+
const _isLastInsertion = isLastInsertion;
|
|
1400
|
+
if (!isHydrating) resetInsertionState();
|
|
1401
|
+
const instance = currentInstance;
|
|
1402
|
+
const rawSlots = instance.rawSlots;
|
|
1403
|
+
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
1404
|
+
let fragment;
|
|
1405
|
+
if (isRef(rawSlots._)) {
|
|
1406
|
+
if (isHydrating) locateHydrationNode();
|
|
1407
|
+
fragment = instance.appContext.vapor.vdomSlot(
|
|
1408
|
+
rawSlots._,
|
|
1409
|
+
name,
|
|
1410
|
+
slotProps,
|
|
1411
|
+
instance,
|
|
1412
|
+
fallback
|
|
1413
|
+
);
|
|
1414
|
+
} else {
|
|
1415
|
+
fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
|
|
1416
|
+
const isDynamicName = isFunction(name);
|
|
1417
|
+
const slotScopeIds = [];
|
|
1418
|
+
if (!noSlotted) {
|
|
1419
|
+
const scopeId = instance.type.__scopeId;
|
|
1420
|
+
if (scopeId) {
|
|
1421
|
+
slotScopeIds.push(`${scopeId}-s`);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
const renderSlot = () => {
|
|
1425
|
+
const slotName = isFunction(name) ? name() : name;
|
|
1426
|
+
if (instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce) {
|
|
1427
|
+
const el = createElement("slot");
|
|
1428
|
+
renderEffect(() => {
|
|
1429
|
+
setDynamicProps(el, [
|
|
1430
|
+
slotProps,
|
|
1431
|
+
slotName !== "default" ? { name: slotName } : {}
|
|
1432
|
+
]);
|
|
1433
|
+
});
|
|
1434
|
+
if (fallback) insert(fallback(), el);
|
|
1435
|
+
fragment.nodes = el;
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
const slot = getSlot(rawSlots, slotName);
|
|
1439
|
+
if (slot) {
|
|
1440
|
+
fragment.fallback = fallback;
|
|
1441
|
+
fragment.update(
|
|
1442
|
+
slot._bound || (slot._bound = () => {
|
|
1443
|
+
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
1444
|
+
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
1445
|
+
);
|
|
1446
|
+
try {
|
|
1447
|
+
return slot(slotProps);
|
|
1448
|
+
} finally {
|
|
1449
|
+
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
1450
|
+
}
|
|
1451
|
+
})
|
|
1452
|
+
);
|
|
1453
|
+
} else {
|
|
1454
|
+
fragment.update(fallback);
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
if (isDynamicName || rawSlots.$) {
|
|
1458
|
+
renderEffect(renderSlot);
|
|
1459
|
+
} else {
|
|
1460
|
+
renderSlot();
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
if (!isHydrating) {
|
|
1464
|
+
if (!noSlotted) {
|
|
1465
|
+
const scopeId = instance.type.__scopeId;
|
|
1466
|
+
if (scopeId) {
|
|
1467
|
+
setScopeId(fragment, [`${scopeId}-s`]);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
1471
|
+
} else {
|
|
1472
|
+
if (fragment.insert) {
|
|
1473
|
+
fragment.hydrate();
|
|
1474
|
+
}
|
|
1475
|
+
if (_isLastInsertion) {
|
|
1476
|
+
advanceHydrationNode(_insertionParent);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
return fragment;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
1483
|
+
// @__NO_SIDE_EFFECTS__
|
|
1484
|
+
function defineVaporComponent(comp, extraOptions) {
|
|
1485
|
+
if (isFunction(comp)) {
|
|
1486
|
+
return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
|
|
1487
|
+
setup: comp,
|
|
1488
|
+
__vapor: true
|
|
1489
|
+
}))();
|
|
1490
|
+
}
|
|
1491
|
+
comp.__vapor = true;
|
|
1492
|
+
return comp;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
const VaporKeepAliveImpl = defineVaporComponent({
|
|
1496
|
+
name: "VaporKeepAlive",
|
|
1497
|
+
__isKeepAlive: true,
|
|
1498
|
+
props: {
|
|
1499
|
+
include: [String, RegExp, Array],
|
|
1500
|
+
exclude: [String, RegExp, Array],
|
|
1501
|
+
max: [String, Number]
|
|
1502
|
+
},
|
|
1503
|
+
setup(props, { slots }) {
|
|
1504
|
+
if (!slots.default) {
|
|
1505
|
+
return void 0;
|
|
1506
|
+
}
|
|
1507
|
+
const keepAliveInstance = currentInstance;
|
|
1508
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1509
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1510
|
+
const storageContainer = createElement("div");
|
|
1511
|
+
let current;
|
|
1512
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1513
|
+
keepAliveInstance.__v_cache = cache;
|
|
1514
|
+
}
|
|
1515
|
+
function shouldCache(instance) {
|
|
1516
|
+
if (isAsyncWrapper(instance) && !instance.type.__asyncResolved) {
|
|
1517
|
+
return false;
|
|
1518
|
+
}
|
|
1519
|
+
const { include, exclude } = props;
|
|
1520
|
+
const name = getComponentName(
|
|
1521
|
+
isAsyncWrapper(instance) ? instance.type.__asyncResolved : instance.type
|
|
1522
|
+
);
|
|
1523
|
+
return !(include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name));
|
|
1524
|
+
}
|
|
1525
|
+
function innerCacheBlock(key, instance) {
|
|
1526
|
+
const { max } = props;
|
|
1527
|
+
if (cache.has(key)) {
|
|
1528
|
+
keys.delete(key);
|
|
1529
|
+
keys.add(key);
|
|
1530
|
+
} else {
|
|
1531
|
+
keys.add(key);
|
|
1532
|
+
if (max && keys.size > parseInt(max, 10)) {
|
|
1533
|
+
pruneCacheEntry(keys.values().next().value);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
cache.set(key, instance);
|
|
1537
|
+
current = instance;
|
|
1538
|
+
}
|
|
1539
|
+
function cacheBlock() {
|
|
1540
|
+
const block = keepAliveInstance.block;
|
|
1541
|
+
const innerBlock = getInnerBlock(block);
|
|
1542
|
+
if (!innerBlock || !shouldCache(innerBlock)) return;
|
|
1543
|
+
let toCache;
|
|
1544
|
+
let key;
|
|
1545
|
+
let frag;
|
|
1546
|
+
if (isFragment(block) && (frag = findInteropFragment(block))) {
|
|
1547
|
+
toCache = frag;
|
|
1548
|
+
key = frag.vnode.type;
|
|
1549
|
+
} else {
|
|
1550
|
+
toCache = innerBlock;
|
|
1551
|
+
key = innerBlock.type;
|
|
1552
|
+
}
|
|
1553
|
+
innerCacheBlock(key, toCache);
|
|
1554
|
+
}
|
|
1555
|
+
onMounted(cacheBlock);
|
|
1556
|
+
onUpdated(cacheBlock);
|
|
1557
|
+
onBeforeUnmount(() => {
|
|
1558
|
+
cache.forEach((cached, key) => {
|
|
1559
|
+
const instance = getInstanceFromCache(cached);
|
|
1560
|
+
if (!instance) return;
|
|
1561
|
+
resetCachedShapeFlag(cached);
|
|
1562
|
+
cache.delete(key);
|
|
1563
|
+
if (current) {
|
|
1564
|
+
const currentKey = isVaporComponent(current) ? current.type : current.vnode.type;
|
|
1565
|
+
if (currentKey === key) {
|
|
1566
|
+
const da = instance.da;
|
|
1567
|
+
da && queuePostFlushCb(da);
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
remove(cached, storageContainer);
|
|
1572
|
+
});
|
|
1573
|
+
});
|
|
1574
|
+
keepAliveInstance.getStorageContainer = () => storageContainer;
|
|
1575
|
+
keepAliveInstance.getCachedComponent = (comp) => {
|
|
1576
|
+
return cache.get(comp);
|
|
1577
|
+
};
|
|
1578
|
+
keepAliveInstance.cacheComponent = (instance) => {
|
|
1579
|
+
if (!shouldCache(instance)) return;
|
|
1580
|
+
instance.shapeFlag |= 256;
|
|
1581
|
+
innerCacheBlock(instance.type, instance);
|
|
1582
|
+
};
|
|
1583
|
+
keepAliveInstance.processFragment = (frag) => {
|
|
1584
|
+
const innerBlock = getInnerBlock(frag.nodes);
|
|
1585
|
+
if (!innerBlock) return;
|
|
1586
|
+
const fragment = findInteropFragment(frag.nodes);
|
|
1587
|
+
if (fragment) {
|
|
1588
|
+
if (cache.has(fragment.vnode.type)) {
|
|
1589
|
+
fragment.vnode.shapeFlag |= 512;
|
|
1590
|
+
}
|
|
1591
|
+
if (shouldCache(innerBlock)) {
|
|
1592
|
+
fragment.vnode.shapeFlag |= 256;
|
|
1593
|
+
}
|
|
1594
|
+
} else {
|
|
1595
|
+
if (cache.has(innerBlock.type)) {
|
|
1596
|
+
innerBlock.shapeFlag |= 512;
|
|
1597
|
+
}
|
|
1598
|
+
if (shouldCache(innerBlock)) {
|
|
1599
|
+
innerBlock.shapeFlag |= 256;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
keepAliveInstance.cacheFragment = (fragment) => {
|
|
1604
|
+
const innerBlock = getInnerBlock(fragment.nodes);
|
|
1605
|
+
if (!innerBlock || !shouldCache(innerBlock)) return;
|
|
1606
|
+
let toCache;
|
|
1607
|
+
let key;
|
|
1608
|
+
const frag = findInteropFragment(fragment);
|
|
1609
|
+
if (frag) {
|
|
1610
|
+
frag.vnode.shapeFlag |= 256;
|
|
1611
|
+
toCache = frag;
|
|
1612
|
+
key = frag.vnode.type;
|
|
1613
|
+
} else {
|
|
1614
|
+
innerBlock.shapeFlag |= 256;
|
|
1615
|
+
toCache = innerBlock;
|
|
1616
|
+
key = innerBlock.type;
|
|
1617
|
+
}
|
|
1618
|
+
innerCacheBlock(key, toCache);
|
|
1619
|
+
};
|
|
1620
|
+
keepAliveInstance.activate = (instance, parentNode, anchor) => {
|
|
1621
|
+
current = instance;
|
|
1622
|
+
activate(instance, parentNode, anchor);
|
|
1623
|
+
};
|
|
1624
|
+
keepAliveInstance.deactivate = (instance) => {
|
|
1625
|
+
current = void 0;
|
|
1626
|
+
deactivate(instance, storageContainer);
|
|
1627
|
+
};
|
|
1628
|
+
function resetCachedShapeFlag(cached) {
|
|
1629
|
+
if (isVaporComponent(cached)) {
|
|
1630
|
+
resetShapeFlag(cached);
|
|
1631
|
+
} else {
|
|
1632
|
+
resetShapeFlag(cached.vnode);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
let children = slots.default();
|
|
1636
|
+
if (isArray(children) && children.length > 1) {
|
|
1637
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1638
|
+
warn(`KeepAlive should contain exactly one component child.`);
|
|
1639
|
+
}
|
|
1640
|
+
return children;
|
|
1641
|
+
}
|
|
1642
|
+
if (isVaporComponent(children)) {
|
|
1643
|
+
children.shapeFlag |= 256;
|
|
1644
|
+
} else if (isInteropFragment(children)) {
|
|
1645
|
+
children.vnode.shapeFlag |= 256;
|
|
1646
|
+
}
|
|
1647
|
+
function pruneCache(filter) {
|
|
1648
|
+
cache.forEach((cached, key) => {
|
|
1649
|
+
const instance = getInstanceFromCache(cached);
|
|
1650
|
+
if (!instance) return;
|
|
1651
|
+
const name = getComponentName(instance.type);
|
|
1652
|
+
if (name && !filter(name)) {
|
|
1653
|
+
pruneCacheEntry(key);
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
function pruneCacheEntry(key) {
|
|
1658
|
+
const cached = cache.get(key);
|
|
1659
|
+
resetCachedShapeFlag(cached);
|
|
1660
|
+
if (cached !== current) {
|
|
1661
|
+
remove(cached);
|
|
1662
|
+
}
|
|
1663
|
+
cache.delete(key);
|
|
1664
|
+
keys.delete(key);
|
|
1665
|
+
}
|
|
1666
|
+
watch(
|
|
1667
|
+
() => [props.include, props.exclude],
|
|
1668
|
+
([include, exclude]) => {
|
|
1669
|
+
include && pruneCache((name) => matches(include, name));
|
|
1670
|
+
exclude && pruneCache((name) => !matches(exclude, name));
|
|
1671
|
+
},
|
|
1672
|
+
// prune post-render after `current` has been updated
|
|
1673
|
+
{ flush: "post", deep: true }
|
|
1674
|
+
);
|
|
1675
|
+
return children;
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
function getInnerBlock(block) {
|
|
1679
|
+
if (isVaporComponent(block)) {
|
|
1680
|
+
return block;
|
|
1681
|
+
} else if (isInteropFragment(block)) {
|
|
1682
|
+
return block.vnode;
|
|
1683
|
+
} else if (isFragment(block)) {
|
|
1684
|
+
return getInnerBlock(block.nodes);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function isInteropFragment(block) {
|
|
1688
|
+
return !!(isFragment(block) && block.vnode);
|
|
1689
|
+
}
|
|
1690
|
+
function findInteropFragment(block) {
|
|
1691
|
+
if (isInteropFragment(block)) {
|
|
1692
|
+
return block;
|
|
1693
|
+
}
|
|
1694
|
+
if (isFragment(block)) {
|
|
1695
|
+
return findInteropFragment(block.nodes);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
function getInstanceFromCache(cached) {
|
|
1699
|
+
if (isVaporComponent(cached)) {
|
|
1700
|
+
return cached;
|
|
1701
|
+
}
|
|
1702
|
+
return cached.vnode.component;
|
|
1703
|
+
}
|
|
1704
|
+
function activate(instance, parentNode, anchor) {
|
|
1705
|
+
insert(instance.block, parentNode, anchor);
|
|
1706
|
+
queuePostFlushCb(() => {
|
|
1707
|
+
instance.isDeactivated = false;
|
|
1708
|
+
if (instance.a) invokeArrayFns(instance.a);
|
|
1709
|
+
});
|
|
1710
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1711
|
+
devtoolsComponentAdded(instance);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
function deactivate(instance, container) {
|
|
1715
|
+
insert(instance.block, container);
|
|
1716
|
+
queuePostFlushCb(() => {
|
|
1717
|
+
if (instance.da) invokeArrayFns(instance.da);
|
|
1718
|
+
instance.isDeactivated = true;
|
|
1719
|
+
});
|
|
1720
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1721
|
+
devtoolsComponentAdded(instance);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
function findParentKeepAlive(instance) {
|
|
1725
|
+
let parent = instance;
|
|
1726
|
+
while (parent) {
|
|
1727
|
+
if (isKeepAlive(parent)) {
|
|
1728
|
+
return parent;
|
|
1729
|
+
}
|
|
1730
|
+
parent = parent.parent;
|
|
1731
|
+
}
|
|
1732
|
+
return null;
|
|
553
1733
|
}
|
|
554
1734
|
|
|
555
1735
|
const interopKey = Symbol(`interop`);
|
|
556
1736
|
const vaporInteropImpl = {
|
|
557
1737
|
mount(vnode, container, anchor, parentComponent) {
|
|
558
|
-
|
|
559
|
-
|
|
1738
|
+
let selfAnchor = vnode.el = vnode.anchor = createTextNode();
|
|
1739
|
+
if (isHydrating) {
|
|
1740
|
+
queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
1741
|
+
} else {
|
|
1742
|
+
container.insertBefore(selfAnchor, anchor);
|
|
1743
|
+
}
|
|
560
1744
|
const prev = currentInstance;
|
|
561
1745
|
simpleSetCurrentInstance(parentComponent);
|
|
562
|
-
const
|
|
1746
|
+
const props = {};
|
|
1747
|
+
for (const key in vnode.props) {
|
|
1748
|
+
if (!isReservedProp(key)) {
|
|
1749
|
+
props[key] = vnode.props[key];
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
const propsRef = shallowRef(props);
|
|
563
1753
|
const slotsRef = shallowRef(vnode.children);
|
|
564
1754
|
const dynamicPropSource = [
|
|
565
1755
|
() => propsRef.value
|
|
@@ -573,10 +1763,20 @@ const vaporInteropImpl = {
|
|
|
573
1763
|
{
|
|
574
1764
|
_: slotsRef
|
|
575
1765
|
// pass the slots ref
|
|
576
|
-
}
|
|
1766
|
+
},
|
|
1767
|
+
void 0,
|
|
1768
|
+
void 0,
|
|
1769
|
+
parentComponent ? parentComponent.appContext : vnode.appContext
|
|
577
1770
|
);
|
|
578
1771
|
instance.rawPropsRef = propsRef;
|
|
579
1772
|
instance.rawSlotsRef = slotsRef;
|
|
1773
|
+
if (isKeepAlive(parentComponent)) instance.shapeFlag = vnode.shapeFlag;
|
|
1774
|
+
if (vnode.transition) {
|
|
1775
|
+
setTransitionHooks(
|
|
1776
|
+
instance,
|
|
1777
|
+
vnode.transition
|
|
1778
|
+
);
|
|
1779
|
+
}
|
|
580
1780
|
mountComponent(instance, container, selfAnchor);
|
|
581
1781
|
simpleSetCurrentInstance(prev);
|
|
582
1782
|
return instance;
|
|
@@ -604,11 +1804,16 @@ const vaporInteropImpl = {
|
|
|
604
1804
|
*/
|
|
605
1805
|
slot(n1, n2, container, anchor) {
|
|
606
1806
|
if (!n1) {
|
|
607
|
-
|
|
608
|
-
insert(selfAnchor, container, anchor);
|
|
1807
|
+
let selfAnchor;
|
|
609
1808
|
const { slot, fallback } = n2.vs;
|
|
610
1809
|
const propsRef = n2.vs.ref = shallowRef(n2.props);
|
|
611
1810
|
const slotBlock = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
|
|
1811
|
+
if (fallback && isFragment(slotBlock)) {
|
|
1812
|
+
setFragmentFallback(slotBlock, createFallback(fallback));
|
|
1813
|
+
selfAnchor = slotBlock.anchor;
|
|
1814
|
+
}
|
|
1815
|
+
if (!selfAnchor) selfAnchor = createTextNode();
|
|
1816
|
+
insert(n2.el = n2.anchor = selfAnchor, container, anchor);
|
|
612
1817
|
insert(n2.vb = slotBlock, container, selfAnchor);
|
|
613
1818
|
} else {
|
|
614
1819
|
n2.el = n2.anchor = n1.anchor;
|
|
@@ -619,6 +1824,44 @@ const vaporInteropImpl = {
|
|
|
619
1824
|
move(vnode, container, anchor) {
|
|
620
1825
|
insert(vnode.vb || vnode.component, container, anchor);
|
|
621
1826
|
insert(vnode.anchor, container, anchor);
|
|
1827
|
+
},
|
|
1828
|
+
hydrate(vnode, node, container, anchor, parentComponent) {
|
|
1829
|
+
hydrateNode(
|
|
1830
|
+
node,
|
|
1831
|
+
() => this.mount(vnode, container, anchor, parentComponent)
|
|
1832
|
+
);
|
|
1833
|
+
return _next(node);
|
|
1834
|
+
},
|
|
1835
|
+
hydrateSlot(vnode, node) {
|
|
1836
|
+
const { slot } = vnode.vs;
|
|
1837
|
+
const propsRef = vnode.vs.ref = shallowRef(vnode.props);
|
|
1838
|
+
hydrateNode(node, () => {
|
|
1839
|
+
vnode.vb = slot(new Proxy(propsRef, vaporSlotPropsProxyHandler));
|
|
1840
|
+
vnode.anchor = vnode.el = currentHydrationNode;
|
|
1841
|
+
if (!!(process.env.NODE_ENV !== "production") && !vnode.anchor) {
|
|
1842
|
+
throw new Error(
|
|
1843
|
+
`Failed to locate slot anchor. this is likely a Vue internal bug.`
|
|
1844
|
+
);
|
|
1845
|
+
}
|
|
1846
|
+
});
|
|
1847
|
+
return _next(vnode.anchor);
|
|
1848
|
+
},
|
|
1849
|
+
setTransitionHooks(component, hooks) {
|
|
1850
|
+
setTransitionHooks(component, hooks);
|
|
1851
|
+
},
|
|
1852
|
+
activate(vnode, container, anchor, parentComponent) {
|
|
1853
|
+
const cached = parentComponent.ctx.getCachedComponent(
|
|
1854
|
+
vnode
|
|
1855
|
+
);
|
|
1856
|
+
vnode.el = cached.el;
|
|
1857
|
+
vnode.component = cached.component;
|
|
1858
|
+
vnode.anchor = cached.anchor;
|
|
1859
|
+
activate(vnode.component, container, anchor);
|
|
1860
|
+
insert(vnode.anchor, container, anchor);
|
|
1861
|
+
},
|
|
1862
|
+
deactivate(vnode, container) {
|
|
1863
|
+
deactivate(vnode.component, container);
|
|
1864
|
+
insert(vnode.anchor, container);
|
|
622
1865
|
}
|
|
623
1866
|
};
|
|
624
1867
|
const vaporSlotPropsProxyHandler = {
|
|
@@ -641,16 +1884,20 @@ const vaporSlotsProxyHandler = {
|
|
|
641
1884
|
return slot;
|
|
642
1885
|
}
|
|
643
1886
|
};
|
|
644
|
-
|
|
1887
|
+
let vdomHydrateNode;
|
|
1888
|
+
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots) {
|
|
645
1889
|
const frag = new VaporFragment([]);
|
|
646
|
-
const vnode = createVNode(
|
|
1890
|
+
const vnode = frag.vnode = createVNode(
|
|
647
1891
|
component,
|
|
648
|
-
rawProps && new Proxy(rawProps, rawPropsProxyHandlers)
|
|
1892
|
+
rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers))
|
|
649
1893
|
);
|
|
650
1894
|
const wrapper = new VaporComponentInstance(
|
|
651
1895
|
{ props: component.props },
|
|
652
1896
|
rawProps,
|
|
653
|
-
rawSlots
|
|
1897
|
+
rawSlots,
|
|
1898
|
+
parentComponent ? parentComponent.appContext : void 0,
|
|
1899
|
+
void 0,
|
|
1900
|
+
parentComponent
|
|
654
1901
|
);
|
|
655
1902
|
vnode.vi = (instance) => {
|
|
656
1903
|
instance.props = shallowReactive(wrapper.props);
|
|
@@ -662,35 +1909,85 @@ function createVDOMComponent(internals, component, rawProps, rawSlots) {
|
|
|
662
1909
|
}
|
|
663
1910
|
instance.slots = wrapper.slots === EMPTY_OBJ ? EMPTY_OBJ : new Proxy(wrapper.slots, vaporSlotsProxyHandler);
|
|
664
1911
|
};
|
|
1912
|
+
let rawRef = null;
|
|
665
1913
|
let isMounted = false;
|
|
666
|
-
const
|
|
667
|
-
|
|
1914
|
+
const unmount = (parentNode, transition) => {
|
|
1915
|
+
if (rawRef) setRef$1(rawRef, null, null, vnode, true);
|
|
1916
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1917
|
+
if (vnode.shapeFlag & 256) {
|
|
1918
|
+
deactivate$1(
|
|
1919
|
+
vnode,
|
|
1920
|
+
findParentKeepAlive(parentComponent).getStorageContainer(),
|
|
1921
|
+
internals,
|
|
1922
|
+
parentComponent,
|
|
1923
|
+
null
|
|
1924
|
+
);
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
668
1927
|
internals.umt(vnode.component, null, !!parentNode);
|
|
669
1928
|
};
|
|
670
|
-
frag.
|
|
671
|
-
|
|
672
|
-
|
|
1929
|
+
frag.hydrate = () => {
|
|
1930
|
+
hydrateVNode(vnode, parentComponent);
|
|
1931
|
+
onScopeDispose(unmount, true);
|
|
1932
|
+
isMounted = true;
|
|
1933
|
+
frag.nodes = vnode.el;
|
|
1934
|
+
};
|
|
1935
|
+
vnode.scopeId = currentInstance && currentInstance.type.__scopeId || null;
|
|
1936
|
+
vnode.slotScopeIds = currentSlotScopeIds;
|
|
1937
|
+
frag.insert = (parentNode, anchor, transition) => {
|
|
1938
|
+
if (isHydrating) return;
|
|
1939
|
+
if (vnode.shapeFlag & 512) {
|
|
1940
|
+
activate$1(
|
|
673
1941
|
vnode,
|
|
674
1942
|
parentNode,
|
|
675
1943
|
anchor,
|
|
676
|
-
|
|
1944
|
+
internals,
|
|
1945
|
+
parentComponent,
|
|
677
1946
|
null,
|
|
678
1947
|
void 0,
|
|
679
1948
|
false
|
|
680
1949
|
);
|
|
681
|
-
onScopeDispose(unmount, true);
|
|
682
|
-
isMounted = true;
|
|
683
1950
|
} else {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
1951
|
+
const prev = currentInstance;
|
|
1952
|
+
simpleSetCurrentInstance(parentComponent);
|
|
1953
|
+
if (!isMounted) {
|
|
1954
|
+
if (transition) setTransitionHooks$1(vnode, transition);
|
|
1955
|
+
internals.mt(
|
|
1956
|
+
vnode,
|
|
1957
|
+
parentNode,
|
|
1958
|
+
anchor,
|
|
1959
|
+
parentComponent,
|
|
1960
|
+
null,
|
|
1961
|
+
void 0,
|
|
1962
|
+
false
|
|
1963
|
+
);
|
|
1964
|
+
if (rawRef) setRef$1(rawRef, null, null, vnode);
|
|
1965
|
+
onScopeDispose(unmount, true);
|
|
1966
|
+
isMounted = true;
|
|
1967
|
+
} else {
|
|
1968
|
+
internals.m(
|
|
1969
|
+
vnode,
|
|
1970
|
+
parentNode,
|
|
1971
|
+
anchor,
|
|
1972
|
+
2,
|
|
1973
|
+
parentComponent
|
|
1974
|
+
);
|
|
1975
|
+
}
|
|
1976
|
+
simpleSetCurrentInstance(prev);
|
|
691
1977
|
}
|
|
1978
|
+
frag.nodes = vnode.el;
|
|
692
1979
|
};
|
|
693
1980
|
frag.remove = unmount;
|
|
1981
|
+
frag.setRef = (instance, ref, refFor, refKey) => {
|
|
1982
|
+
rawRef = normalizeRef(
|
|
1983
|
+
{
|
|
1984
|
+
ref,
|
|
1985
|
+
ref_for: refFor,
|
|
1986
|
+
ref_key: refKey
|
|
1987
|
+
},
|
|
1988
|
+
instance
|
|
1989
|
+
);
|
|
1990
|
+
};
|
|
694
1991
|
return frag;
|
|
695
1992
|
}
|
|
696
1993
|
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
@@ -698,15 +1995,51 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
698
1995
|
let isMounted = false;
|
|
699
1996
|
let fallbackNodes;
|
|
700
1997
|
let oldVNode = null;
|
|
1998
|
+
frag.fallback = fallback;
|
|
701
1999
|
frag.insert = (parentNode, anchor) => {
|
|
2000
|
+
if (isHydrating) return;
|
|
702
2001
|
if (!isMounted) {
|
|
703
|
-
|
|
704
|
-
|
|
2002
|
+
render(parentNode, anchor);
|
|
2003
|
+
isMounted = true;
|
|
2004
|
+
} else {
|
|
2005
|
+
internals.m(
|
|
2006
|
+
oldVNode,
|
|
2007
|
+
parentNode,
|
|
2008
|
+
anchor,
|
|
2009
|
+
2,
|
|
2010
|
+
parentComponent
|
|
2011
|
+
);
|
|
2012
|
+
}
|
|
2013
|
+
frag.remove = (parentNode2) => {
|
|
2014
|
+
if (fallbackNodes) {
|
|
2015
|
+
remove(fallbackNodes, parentNode2);
|
|
2016
|
+
} else if (oldVNode) {
|
|
2017
|
+
internals.um(oldVNode, parentComponent, null);
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
};
|
|
2021
|
+
const render = (parentNode, anchor) => {
|
|
2022
|
+
renderEffect(() => {
|
|
2023
|
+
let vnode;
|
|
2024
|
+
let isValidSlot = false;
|
|
2025
|
+
if (slotsRef.value) {
|
|
2026
|
+
vnode = renderSlot(
|
|
705
2027
|
slotsRef.value,
|
|
706
2028
|
isFunction(name) ? name() : name,
|
|
707
2029
|
props
|
|
708
2030
|
);
|
|
709
|
-
|
|
2031
|
+
let children = vnode.children;
|
|
2032
|
+
ensureVaporSlotFallback(children, fallback);
|
|
2033
|
+
isValidSlot = children.length > 0;
|
|
2034
|
+
}
|
|
2035
|
+
if (isValidSlot) {
|
|
2036
|
+
if (isHydrating) {
|
|
2037
|
+
if (isVNode(vnode)) {
|
|
2038
|
+
hydrateVNode(vnode, parentComponent);
|
|
2039
|
+
oldVNode = vnode;
|
|
2040
|
+
frag.nodes = vnode.el;
|
|
2041
|
+
}
|
|
2042
|
+
} else {
|
|
710
2043
|
if (fallbackNodes) {
|
|
711
2044
|
remove(fallbackNodes, parentNode);
|
|
712
2045
|
fallbackNodes = void 0;
|
|
@@ -716,36 +2049,41 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
716
2049
|
vnode,
|
|
717
2050
|
parentNode,
|
|
718
2051
|
anchor,
|
|
719
|
-
parentComponent
|
|
2052
|
+
parentComponent,
|
|
2053
|
+
null,
|
|
2054
|
+
// parentSuspense
|
|
2055
|
+
void 0,
|
|
2056
|
+
// namespace
|
|
2057
|
+
vnode.slotScopeIds
|
|
2058
|
+
// pass slotScopeIds for :slotted styles
|
|
720
2059
|
);
|
|
721
2060
|
oldVNode = vnode;
|
|
722
|
-
|
|
723
|
-
|
|
2061
|
+
frag.nodes = vnode.el;
|
|
2062
|
+
}
|
|
2063
|
+
} else {
|
|
2064
|
+
fallback = frag.fallback;
|
|
2065
|
+
if (fallback && !fallbackNodes) {
|
|
2066
|
+
fallbackNodes = fallback(internals, parentComponent);
|
|
2067
|
+
if (isHydrating) {
|
|
2068
|
+
if (isVNode(fallbackNodes)) {
|
|
2069
|
+
hydrateVNode(fallbackNodes, parentComponent);
|
|
2070
|
+
frag.nodes = fallbackNodes.el;
|
|
2071
|
+
}
|
|
2072
|
+
} else {
|
|
724
2073
|
if (oldVNode) {
|
|
725
2074
|
internals.um(oldVNode, parentComponent, null, true);
|
|
726
2075
|
}
|
|
727
|
-
insert(fallbackNodes
|
|
2076
|
+
insert(fallbackNodes, parentNode, anchor);
|
|
2077
|
+
frag.nodes = fallbackNodes;
|
|
728
2078
|
}
|
|
729
|
-
oldVNode = null;
|
|
730
2079
|
}
|
|
731
|
-
|
|
732
|
-
isMounted = true;
|
|
733
|
-
} else {
|
|
734
|
-
internals.m(
|
|
735
|
-
oldVNode,
|
|
736
|
-
parentNode,
|
|
737
|
-
anchor,
|
|
738
|
-
2,
|
|
739
|
-
parentComponent
|
|
740
|
-
);
|
|
741
|
-
}
|
|
742
|
-
frag.remove = (parentNode2) => {
|
|
743
|
-
if (fallbackNodes) {
|
|
744
|
-
remove(fallbackNodes, parentNode2);
|
|
745
|
-
} else if (oldVNode) {
|
|
746
|
-
internals.um(oldVNode, parentComponent, null);
|
|
2080
|
+
oldVNode = null;
|
|
747
2081
|
}
|
|
748
|
-
};
|
|
2082
|
+
});
|
|
2083
|
+
};
|
|
2084
|
+
frag.hydrate = () => {
|
|
2085
|
+
render();
|
|
2086
|
+
isMounted = true;
|
|
749
2087
|
};
|
|
750
2088
|
return frag;
|
|
751
2089
|
}
|
|
@@ -757,10 +2095,49 @@ const vaporInteropPlugin = (app) => {
|
|
|
757
2095
|
vdomSlot: renderVDOMSlot.bind(null, internals)
|
|
758
2096
|
});
|
|
759
2097
|
const mount = app.mount;
|
|
760
|
-
app.mount = (...args) => {
|
|
2098
|
+
app.mount = ((...args) => {
|
|
761
2099
|
optimizePropertyLookup();
|
|
762
2100
|
return mount(...args);
|
|
763
|
-
};
|
|
2101
|
+
});
|
|
2102
|
+
};
|
|
2103
|
+
function hydrateVNode(vnode, parentComponent) {
|
|
2104
|
+
locateHydrationNode();
|
|
2105
|
+
let node = currentHydrationNode;
|
|
2106
|
+
while (isComment(node, "[") && // vnode is not a fragment
|
|
2107
|
+
vnode.type !== Fragment && // not inside vdom slot
|
|
2108
|
+
!(isVaporComponent(parentComponent) && isRef(parentComponent.rawSlots._))) {
|
|
2109
|
+
node = node.nextSibling;
|
|
2110
|
+
}
|
|
2111
|
+
if (currentHydrationNode !== node) setCurrentHydrationNode(node);
|
|
2112
|
+
if (!vdomHydrateNode) vdomHydrateNode = ensureHydrationRenderer().hydrateNode;
|
|
2113
|
+
const nextNode = vdomHydrateNode(
|
|
2114
|
+
currentHydrationNode,
|
|
2115
|
+
vnode,
|
|
2116
|
+
parentComponent,
|
|
2117
|
+
null,
|
|
2118
|
+
null,
|
|
2119
|
+
false
|
|
2120
|
+
);
|
|
2121
|
+
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
2122
|
+
else advanceHydrationNode(node);
|
|
2123
|
+
}
|
|
2124
|
+
const createFallback = (fallback) => (internals, parentComponent) => {
|
|
2125
|
+
const fallbackNodes = fallback();
|
|
2126
|
+
if (isArray(fallbackNodes) && fallbackNodes.every(isVNode)) {
|
|
2127
|
+
const frag = new VaporFragment([]);
|
|
2128
|
+
frag.insert = (parentNode, anchor) => {
|
|
2129
|
+
fallbackNodes.forEach((vnode) => {
|
|
2130
|
+
internals.p(null, vnode, parentNode, anchor, parentComponent);
|
|
2131
|
+
});
|
|
2132
|
+
};
|
|
2133
|
+
frag.remove = (parentNode) => {
|
|
2134
|
+
fallbackNodes.forEach((vnode) => {
|
|
2135
|
+
internals.um(vnode, parentComponent, null, true);
|
|
2136
|
+
});
|
|
2137
|
+
};
|
|
2138
|
+
return frag;
|
|
2139
|
+
}
|
|
2140
|
+
return fallbackNodes;
|
|
764
2141
|
};
|
|
765
2142
|
|
|
766
2143
|
function normalizeEmitsOptions(comp) {
|
|
@@ -802,7 +2179,7 @@ function propGetter(rawProps, key) {
|
|
|
802
2179
|
function resolveSource(source) {
|
|
803
2180
|
return isFunction(source) ? source() : source;
|
|
804
2181
|
}
|
|
805
|
-
function getPropsProxyHandlers(comp) {
|
|
2182
|
+
function getPropsProxyHandlers(comp, once) {
|
|
806
2183
|
if (comp.__propsHandlers) {
|
|
807
2184
|
return comp.__propsHandlers;
|
|
808
2185
|
}
|
|
@@ -840,7 +2217,7 @@ function getPropsProxyHandlers(comp) {
|
|
|
840
2217
|
return resolvePropValue(
|
|
841
2218
|
propsOptions,
|
|
842
2219
|
key,
|
|
843
|
-
rawProps[rawKey]
|
|
2220
|
+
resolveSource(rawProps[rawKey]),
|
|
844
2221
|
instance,
|
|
845
2222
|
resolveDefault
|
|
846
2223
|
);
|
|
@@ -855,8 +2232,14 @@ function getPropsProxyHandlers(comp) {
|
|
|
855
2232
|
true
|
|
856
2233
|
);
|
|
857
2234
|
};
|
|
2235
|
+
const getPropValue = once ? (...args) => {
|
|
2236
|
+
pauseTracking();
|
|
2237
|
+
const value = getProp(...args);
|
|
2238
|
+
resetTracking();
|
|
2239
|
+
return value;
|
|
2240
|
+
} : getProp;
|
|
858
2241
|
const propsHandlers = propsOptions ? {
|
|
859
|
-
get: (target, key) =>
|
|
2242
|
+
get: (target, key) => getPropValue(target, key),
|
|
860
2243
|
has: (_, key) => isProp(key),
|
|
861
2244
|
ownKeys: () => Object.keys(propsOptions),
|
|
862
2245
|
getOwnPropertyDescriptor(target, key) {
|
|
@@ -864,7 +2247,7 @@ function getPropsProxyHandlers(comp) {
|
|
|
864
2247
|
return {
|
|
865
2248
|
configurable: true,
|
|
866
2249
|
enumerable: true,
|
|
867
|
-
get: () =>
|
|
2250
|
+
get: () => getPropValue(target, key)
|
|
868
2251
|
};
|
|
869
2252
|
}
|
|
870
2253
|
}
|
|
@@ -887,8 +2270,14 @@ function getPropsProxyHandlers(comp) {
|
|
|
887
2270
|
return false;
|
|
888
2271
|
}
|
|
889
2272
|
};
|
|
2273
|
+
const getAttrValue = once ? (...args) => {
|
|
2274
|
+
pauseTracking();
|
|
2275
|
+
const value = getAttr(...args);
|
|
2276
|
+
resetTracking();
|
|
2277
|
+
return value;
|
|
2278
|
+
} : getAttr;
|
|
890
2279
|
const attrsHandlers = {
|
|
891
|
-
get: (target, key) =>
|
|
2280
|
+
get: (target, key) => getAttrValue(target.rawProps, key),
|
|
892
2281
|
has: (target, key) => hasAttr(target.rawProps, key),
|
|
893
2282
|
ownKeys: (target) => getKeysFromRawProps(target.rawProps).filter(isAttr),
|
|
894
2283
|
getOwnPropertyDescriptor(target, key) {
|
|
@@ -896,7 +2285,7 @@ function getPropsProxyHandlers(comp) {
|
|
|
896
2285
|
return {
|
|
897
2286
|
configurable: true,
|
|
898
2287
|
enumerable: true,
|
|
899
|
-
get: () =>
|
|
2288
|
+
get: () => getAttrValue(target.rawProps, key)
|
|
900
2289
|
};
|
|
901
2290
|
}
|
|
902
2291
|
}
|
|
@@ -931,10 +2320,11 @@ function getAttrFromRawProps(rawProps, key) {
|
|
|
931
2320
|
}
|
|
932
2321
|
}
|
|
933
2322
|
if (hasOwn(rawProps, key)) {
|
|
2323
|
+
const value = resolveSource(rawProps[key]);
|
|
934
2324
|
if (merged) {
|
|
935
|
-
merged.push(
|
|
2325
|
+
merged.push(value);
|
|
936
2326
|
} else {
|
|
937
|
-
return
|
|
2327
|
+
return value;
|
|
938
2328
|
}
|
|
939
2329
|
}
|
|
940
2330
|
if (merged && merged.length) {
|
|
@@ -1025,7 +2415,7 @@ function resolveDynamicProps(props) {
|
|
|
1025
2415
|
const mergedRawProps = {};
|
|
1026
2416
|
for (const key in props) {
|
|
1027
2417
|
if (key !== "$") {
|
|
1028
|
-
mergedRawProps[key] = props[key]
|
|
2418
|
+
mergedRawProps[key] = resolveSource(props[key]);
|
|
1029
2419
|
}
|
|
1030
2420
|
}
|
|
1031
2421
|
if (props.$) {
|
|
@@ -1047,148 +2437,431 @@ function resolveDynamicProps(props) {
|
|
|
1047
2437
|
}
|
|
1048
2438
|
}
|
|
1049
2439
|
}
|
|
1050
|
-
return mergedRawProps;
|
|
1051
|
-
}
|
|
1052
|
-
function propsSetDevTrap(_, key) {
|
|
1053
|
-
warn(
|
|
1054
|
-
`Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
1055
|
-
);
|
|
1056
|
-
return true;
|
|
2440
|
+
return mergedRawProps;
|
|
2441
|
+
}
|
|
2442
|
+
function propsSetDevTrap(_, key) {
|
|
2443
|
+
warn(
|
|
2444
|
+
`Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
2445
|
+
);
|
|
2446
|
+
return true;
|
|
2447
|
+
}
|
|
2448
|
+
function propsDeleteDevTrap(_, key) {
|
|
2449
|
+
warn(
|
|
2450
|
+
`Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
2451
|
+
);
|
|
2452
|
+
return true;
|
|
2453
|
+
}
|
|
2454
|
+
const rawPropsProxyHandlers = {
|
|
2455
|
+
get: getAttrFromRawProps,
|
|
2456
|
+
has: hasAttrFromRawProps,
|
|
2457
|
+
ownKeys: getKeysFromRawProps,
|
|
2458
|
+
getOwnPropertyDescriptor(target, key) {
|
|
2459
|
+
if (hasAttrFromRawProps(target, key)) {
|
|
2460
|
+
return {
|
|
2461
|
+
configurable: true,
|
|
2462
|
+
enumerable: true,
|
|
2463
|
+
get: () => getAttrFromRawProps(target, key)
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
};
|
|
2468
|
+
|
|
2469
|
+
const VaporTeleportImpl = {
|
|
2470
|
+
name: "VaporTeleport",
|
|
2471
|
+
__isTeleport: true,
|
|
2472
|
+
__vapor: true,
|
|
2473
|
+
process(props, slots) {
|
|
2474
|
+
return new TeleportFragment(props, slots);
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2477
|
+
class TeleportFragment extends VaporFragment {
|
|
2478
|
+
constructor(props, slots) {
|
|
2479
|
+
super([]);
|
|
2480
|
+
this.insert = (container, anchor) => {
|
|
2481
|
+
if (isHydrating) return;
|
|
2482
|
+
this.placeholder = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createTextNode();
|
|
2483
|
+
insert(this.placeholder, container, anchor);
|
|
2484
|
+
insert(this.anchor, container, anchor);
|
|
2485
|
+
this.handlePropsUpdate();
|
|
2486
|
+
};
|
|
2487
|
+
this.remove = (parent = this.parent) => {
|
|
2488
|
+
if (this.nodes) {
|
|
2489
|
+
remove(this.nodes, this.mountContainer);
|
|
2490
|
+
this.nodes = [];
|
|
2491
|
+
}
|
|
2492
|
+
if (this.targetStart) {
|
|
2493
|
+
remove(this.targetStart, this.target);
|
|
2494
|
+
this.targetStart = void 0;
|
|
2495
|
+
remove(this.targetAnchor, this.target);
|
|
2496
|
+
this.targetAnchor = void 0;
|
|
2497
|
+
}
|
|
2498
|
+
if (this.anchor) {
|
|
2499
|
+
remove(this.anchor, this.anchor.parentNode);
|
|
2500
|
+
this.anchor = void 0;
|
|
2501
|
+
}
|
|
2502
|
+
if (this.placeholder) {
|
|
2503
|
+
remove(this.placeholder, parent);
|
|
2504
|
+
this.placeholder = void 0;
|
|
2505
|
+
}
|
|
2506
|
+
this.mountContainer = void 0;
|
|
2507
|
+
this.mountAnchor = void 0;
|
|
2508
|
+
};
|
|
2509
|
+
this.hydrate = () => {
|
|
2510
|
+
const target = this.target = resolveTeleportTarget(
|
|
2511
|
+
this.resolvedProps,
|
|
2512
|
+
querySelector
|
|
2513
|
+
);
|
|
2514
|
+
const disabled = isTeleportDisabled(this.resolvedProps);
|
|
2515
|
+
this.placeholder = currentHydrationNode;
|
|
2516
|
+
if (target) {
|
|
2517
|
+
const targetNode = target._lpa || target.firstChild;
|
|
2518
|
+
if (disabled) {
|
|
2519
|
+
this.hydrateDisabledTeleport(targetNode);
|
|
2520
|
+
} else {
|
|
2521
|
+
this.anchor = locateTeleportEndAnchor();
|
|
2522
|
+
this.mountContainer = target;
|
|
2523
|
+
let targetAnchor = targetNode;
|
|
2524
|
+
while (targetAnchor) {
|
|
2525
|
+
if (targetAnchor && targetAnchor.nodeType === 8) {
|
|
2526
|
+
if (targetAnchor.data === "teleport start anchor") {
|
|
2527
|
+
this.targetStart = targetAnchor;
|
|
2528
|
+
} else if (targetAnchor.data === "teleport anchor") {
|
|
2529
|
+
this.mountAnchor = this.targetAnchor = targetAnchor;
|
|
2530
|
+
target._lpa = this.targetAnchor && this.targetAnchor.nextSibling;
|
|
2531
|
+
break;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
targetAnchor = targetAnchor.nextSibling;
|
|
2535
|
+
}
|
|
2536
|
+
if (targetNode) {
|
|
2537
|
+
setCurrentHydrationNode(targetNode.nextSibling);
|
|
2538
|
+
}
|
|
2539
|
+
if (!this.targetAnchor) {
|
|
2540
|
+
this.mount(target);
|
|
2541
|
+
} else {
|
|
2542
|
+
this.initChildren();
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
} else if (disabled) {
|
|
2546
|
+
this.hydrateDisabledTeleport(currentHydrationNode);
|
|
2547
|
+
}
|
|
2548
|
+
advanceHydrationNode(this.anchor);
|
|
2549
|
+
};
|
|
2550
|
+
this.rawProps = props;
|
|
2551
|
+
this.rawSlots = slots;
|
|
2552
|
+
this.parentComponent = currentInstance;
|
|
2553
|
+
this.anchor = isHydrating ? void 0 : !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createTextNode();
|
|
2554
|
+
renderEffect(() => {
|
|
2555
|
+
this.resolvedProps = extend(
|
|
2556
|
+
{},
|
|
2557
|
+
new Proxy(
|
|
2558
|
+
this.rawProps,
|
|
2559
|
+
rawPropsProxyHandlers
|
|
2560
|
+
)
|
|
2561
|
+
);
|
|
2562
|
+
this.handlePropsUpdate();
|
|
2563
|
+
});
|
|
2564
|
+
if (!isHydrating) {
|
|
2565
|
+
this.initChildren();
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
get parent() {
|
|
2569
|
+
return this.anchor ? this.anchor.parentNode : null;
|
|
2570
|
+
}
|
|
2571
|
+
initChildren() {
|
|
2572
|
+
renderEffect(() => {
|
|
2573
|
+
this.handleChildrenUpdate(
|
|
2574
|
+
this.rawSlots.default && this.rawSlots.default()
|
|
2575
|
+
);
|
|
2576
|
+
});
|
|
2577
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2578
|
+
const nodes = this.nodes;
|
|
2579
|
+
if (isVaporComponent(nodes)) {
|
|
2580
|
+
nodes.parentTeleport = this;
|
|
2581
|
+
} else if (isArray(nodes)) {
|
|
2582
|
+
nodes.forEach(
|
|
2583
|
+
(node) => isVaporComponent(node) && (node.parentTeleport = this)
|
|
2584
|
+
);
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
handleChildrenUpdate(children) {
|
|
2589
|
+
if (!this.parent || isHydrating) {
|
|
2590
|
+
this.nodes = children;
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
remove(this.nodes, this.mountContainer);
|
|
2594
|
+
insert(this.nodes = children, this.mountContainer, this.mountAnchor);
|
|
2595
|
+
}
|
|
2596
|
+
handlePropsUpdate() {
|
|
2597
|
+
if (!this.parent || isHydrating) return;
|
|
2598
|
+
const mount = (parent, anchor) => {
|
|
2599
|
+
if (this.$transition) {
|
|
2600
|
+
applyTransitionHooks(this.nodes, this.$transition);
|
|
2601
|
+
}
|
|
2602
|
+
insert(
|
|
2603
|
+
this.nodes,
|
|
2604
|
+
this.mountContainer = parent,
|
|
2605
|
+
this.mountAnchor = anchor
|
|
2606
|
+
);
|
|
2607
|
+
};
|
|
2608
|
+
const mountToTarget = () => {
|
|
2609
|
+
const target = this.target = resolveTeleportTarget(
|
|
2610
|
+
this.resolvedProps,
|
|
2611
|
+
querySelector
|
|
2612
|
+
);
|
|
2613
|
+
if (target) {
|
|
2614
|
+
if (
|
|
2615
|
+
// initial mount into target
|
|
2616
|
+
!this.targetAnchor || // target changed
|
|
2617
|
+
this.targetAnchor.parentNode !== target
|
|
2618
|
+
) {
|
|
2619
|
+
insert(this.targetStart = createTextNode(""), target);
|
|
2620
|
+
insert(this.targetAnchor = createTextNode(""), target);
|
|
2621
|
+
}
|
|
2622
|
+
if (this.parentComponent && this.parentComponent.isCE) {
|
|
2623
|
+
(this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2624
|
+
}
|
|
2625
|
+
mount(target, this.targetAnchor);
|
|
2626
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2627
|
+
warn(
|
|
2628
|
+
`Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`,
|
|
2629
|
+
target,
|
|
2630
|
+
`(${typeof target})`
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
if (isTeleportDisabled(this.resolvedProps)) {
|
|
2635
|
+
mount(this.parent, this.anchor);
|
|
2636
|
+
} else {
|
|
2637
|
+
if (isTeleportDeferred(this.resolvedProps) || // force defer when the parent is not connected to the DOM,
|
|
2638
|
+
// typically due to an early insertion caused by setInsertionState.
|
|
2639
|
+
!this.parent.isConnected) {
|
|
2640
|
+
queuePostFlushCb(mountToTarget);
|
|
2641
|
+
} else {
|
|
2642
|
+
mountToTarget();
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
hydrateDisabledTeleport(targetNode) {
|
|
2647
|
+
let nextNode = this.placeholder.nextSibling;
|
|
2648
|
+
setCurrentHydrationNode(nextNode);
|
|
2649
|
+
this.mountAnchor = this.anchor = locateTeleportEndAnchor(nextNode);
|
|
2650
|
+
this.mountContainer = this.anchor.parentNode;
|
|
2651
|
+
this.targetStart = targetNode;
|
|
2652
|
+
this.targetAnchor = targetNode && targetNode.nextSibling;
|
|
2653
|
+
this.initChildren();
|
|
2654
|
+
}
|
|
2655
|
+
mount(target) {
|
|
2656
|
+
target.appendChild(this.targetStart = createTextNode(""));
|
|
2657
|
+
target.appendChild(
|
|
2658
|
+
this.mountAnchor = this.targetAnchor = createTextNode("")
|
|
2659
|
+
);
|
|
2660
|
+
if (!isMismatchAllowed(target, 1)) {
|
|
2661
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) {
|
|
2662
|
+
warn(
|
|
2663
|
+
`Hydration children mismatch on`,
|
|
2664
|
+
target,
|
|
2665
|
+
`
|
|
2666
|
+
Server rendered element contains fewer child nodes than client nodes.`
|
|
2667
|
+
);
|
|
2668
|
+
}
|
|
2669
|
+
logMismatchError();
|
|
2670
|
+
}
|
|
2671
|
+
runWithoutHydration(this.initChildren.bind(this));
|
|
2672
|
+
}
|
|
1057
2673
|
}
|
|
1058
|
-
function
|
|
1059
|
-
|
|
1060
|
-
`Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
1061
|
-
);
|
|
1062
|
-
return true;
|
|
2674
|
+
function isVaporTeleport(value) {
|
|
2675
|
+
return value === VaporTeleportImpl;
|
|
1063
2676
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
getOwnPropertyDescriptor(target, key) {
|
|
1069
|
-
if (hasAttrFromRawProps(target, key)) {
|
|
1070
|
-
return {
|
|
1071
|
-
configurable: true,
|
|
1072
|
-
enumerable: true,
|
|
1073
|
-
get: () => getAttrFromRawProps(target, key)
|
|
1074
|
-
};
|
|
2677
|
+
function locateTeleportEndAnchor(node = currentHydrationNode) {
|
|
2678
|
+
while (node) {
|
|
2679
|
+
if (isComment(node, "teleport end")) {
|
|
2680
|
+
return node;
|
|
1075
2681
|
}
|
|
2682
|
+
node = node.nextSibling;
|
|
1076
2683
|
}
|
|
1077
|
-
|
|
2684
|
+
return null;
|
|
2685
|
+
}
|
|
1078
2686
|
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
keys.push(...Object.keys(source));
|
|
1107
|
-
}
|
|
2687
|
+
function isBlock(val) {
|
|
2688
|
+
return val instanceof Node || isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
2689
|
+
}
|
|
2690
|
+
function isValidBlock(block) {
|
|
2691
|
+
if (block instanceof Node) {
|
|
2692
|
+
return !(block instanceof Comment);
|
|
2693
|
+
} else if (isVaporComponent(block)) {
|
|
2694
|
+
return isValidBlock(block.block);
|
|
2695
|
+
} else if (isArray(block)) {
|
|
2696
|
+
return block.length > 0 && block.some(isValidBlock);
|
|
2697
|
+
} else {
|
|
2698
|
+
return isValidBlock(block.nodes);
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
function insert(block, parent, anchor = null, parentSuspense) {
|
|
2702
|
+
anchor = anchor === 0 ? parent.$fc || _child(parent) : anchor;
|
|
2703
|
+
if (block instanceof Node) {
|
|
2704
|
+
if (!isHydrating) {
|
|
2705
|
+
if (block instanceof Element && block.$transition && !block.$transition.disabled) {
|
|
2706
|
+
performTransitionEnter(
|
|
2707
|
+
block,
|
|
2708
|
+
block.$transition,
|
|
2709
|
+
() => parent.insertBefore(block, anchor),
|
|
2710
|
+
parentSuspense
|
|
2711
|
+
);
|
|
2712
|
+
} else {
|
|
2713
|
+
parent.insertBefore(block, anchor);
|
|
1108
2714
|
}
|
|
1109
2715
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
if (
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
}
|
|
1130
|
-
} else if (String(slot.name) === key) {
|
|
1131
|
-
return slot.fn;
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
} else if (hasOwn(source, key)) {
|
|
1135
|
-
return source[key];
|
|
1136
|
-
}
|
|
2716
|
+
} else if (isVaporComponent(block)) {
|
|
2717
|
+
if (block.isMounted && !block.isDeactivated) {
|
|
2718
|
+
insert(block.block, parent, anchor);
|
|
2719
|
+
} else {
|
|
2720
|
+
mountComponent(block, parent, anchor);
|
|
2721
|
+
}
|
|
2722
|
+
} else if (isArray(block)) {
|
|
2723
|
+
for (const b of block) {
|
|
2724
|
+
insert(b, parent, anchor);
|
|
2725
|
+
}
|
|
2726
|
+
} else {
|
|
2727
|
+
if (block.anchor) {
|
|
2728
|
+
insert(block.anchor, parent, anchor);
|
|
2729
|
+
anchor = block.anchor;
|
|
2730
|
+
}
|
|
2731
|
+
if (block.insert) {
|
|
2732
|
+
block.insert(parent, anchor, block.$transition);
|
|
2733
|
+
} else {
|
|
2734
|
+
insert(block.nodes, parent, anchor, parentSuspense);
|
|
1137
2735
|
}
|
|
1138
|
-
}
|
|
1139
|
-
if (hasOwn(target, key)) {
|
|
1140
|
-
return target[key];
|
|
1141
2736
|
}
|
|
1142
2737
|
}
|
|
1143
|
-
function
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
2738
|
+
function prepend(parent, ...blocks) {
|
|
2739
|
+
let i = blocks.length;
|
|
2740
|
+
while (i--) insert(blocks[i], parent, 0);
|
|
2741
|
+
}
|
|
2742
|
+
function remove(block, parent) {
|
|
2743
|
+
if (block instanceof Node) {
|
|
2744
|
+
if (block.$transition && block instanceof Element) {
|
|
2745
|
+
performTransitionLeave(
|
|
2746
|
+
block,
|
|
2747
|
+
block.$transition,
|
|
2748
|
+
() => parent && parent.removeChild(block)
|
|
2749
|
+
);
|
|
2750
|
+
} else {
|
|
2751
|
+
parent && parent.removeChild(block);
|
|
2752
|
+
}
|
|
2753
|
+
} else if (isVaporComponent(block)) {
|
|
2754
|
+
unmountComponent(block, parent);
|
|
2755
|
+
} else if (isArray(block)) {
|
|
2756
|
+
for (let i = 0; i < block.length; i++) {
|
|
2757
|
+
remove(block[i], parent);
|
|
2758
|
+
}
|
|
1148
2759
|
} else {
|
|
1149
|
-
|
|
2760
|
+
if (block.remove) {
|
|
2761
|
+
block.remove(parent, block.$transition);
|
|
2762
|
+
} else {
|
|
2763
|
+
remove(block.nodes, parent);
|
|
2764
|
+
}
|
|
2765
|
+
if (block.anchor) remove(block.anchor, parent);
|
|
2766
|
+
if (block.scope) {
|
|
2767
|
+
block.scope.stop();
|
|
2768
|
+
const scopes = block.keptAliveScopes;
|
|
2769
|
+
if (scopes) {
|
|
2770
|
+
scopes.forEach((scope) => scope.stop());
|
|
2771
|
+
scopes.clear();
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
1150
2774
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
fragment = instance.appContext.vapor.vdomSlot(
|
|
1157
|
-
rawSlots._,
|
|
1158
|
-
name,
|
|
1159
|
-
slotProps,
|
|
1160
|
-
instance,
|
|
1161
|
-
fallback
|
|
2775
|
+
}
|
|
2776
|
+
function normalizeBlock(block) {
|
|
2777
|
+
if (!!!(process.env.NODE_ENV !== "production") && true) {
|
|
2778
|
+
throw new Error(
|
|
2779
|
+
"normalizeBlock should not be used in production code paths"
|
|
1162
2780
|
);
|
|
2781
|
+
}
|
|
2782
|
+
const nodes = [];
|
|
2783
|
+
if (block instanceof Node) {
|
|
2784
|
+
nodes.push(block);
|
|
2785
|
+
} else if (isArray(block)) {
|
|
2786
|
+
block.forEach((child) => nodes.push(...normalizeBlock(child)));
|
|
2787
|
+
} else if (isVaporComponent(block)) {
|
|
2788
|
+
nodes.push(...normalizeBlock(block.block));
|
|
1163
2789
|
} else {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
const renderSlot = () => {
|
|
1167
|
-
const slot = getSlot(rawSlots, isFunction(name) ? name() : name);
|
|
1168
|
-
if (slot) {
|
|
1169
|
-
fragment.update(
|
|
1170
|
-
slot._bound || (slot._bound = () => {
|
|
1171
|
-
const slotContent = slot(slotProps);
|
|
1172
|
-
if (slotContent instanceof DynamicFragment) {
|
|
1173
|
-
slotContent.fallback = fallback;
|
|
1174
|
-
}
|
|
1175
|
-
return slotContent;
|
|
1176
|
-
})
|
|
1177
|
-
);
|
|
1178
|
-
} else {
|
|
1179
|
-
fragment.update(fallback);
|
|
1180
|
-
}
|
|
1181
|
-
};
|
|
1182
|
-
if (isDynamicName || rawSlots.$) {
|
|
1183
|
-
renderEffect(renderSlot);
|
|
2790
|
+
if (block instanceof TeleportFragment) {
|
|
2791
|
+
nodes.push(block.placeholder, block.anchor);
|
|
1184
2792
|
} else {
|
|
1185
|
-
|
|
2793
|
+
nodes.push(...normalizeBlock(block.nodes));
|
|
2794
|
+
block.anchor && nodes.push(block.anchor);
|
|
1186
2795
|
}
|
|
1187
2796
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
2797
|
+
return nodes;
|
|
2798
|
+
}
|
|
2799
|
+
function findBlockNode(block) {
|
|
2800
|
+
let { parentNode, nextSibling: nextNode } = findLastChild(block);
|
|
2801
|
+
if (nextNode && isComment(nextNode, "]") && isFragmentBlock(block)) {
|
|
2802
|
+
nextNode = nextNode.nextSibling;
|
|
2803
|
+
}
|
|
2804
|
+
return {
|
|
2805
|
+
parentNode,
|
|
2806
|
+
nextNode
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
function findLastChild(node) {
|
|
2810
|
+
if (node && node instanceof Node) {
|
|
2811
|
+
return node;
|
|
2812
|
+
} else if (isArray(node)) {
|
|
2813
|
+
return findLastChild(node[node.length - 1]);
|
|
2814
|
+
} else if (isVaporComponent(node)) {
|
|
2815
|
+
return findLastChild(node.block);
|
|
2816
|
+
} else {
|
|
2817
|
+
if (node.anchor) return node.anchor;
|
|
2818
|
+
return findLastChild(node.nodes);
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
function isFragmentBlock(block) {
|
|
2822
|
+
if (isArray(block)) {
|
|
2823
|
+
return true;
|
|
2824
|
+
} else if (isVaporComponent(block)) {
|
|
2825
|
+
return isFragmentBlock(block.block);
|
|
2826
|
+
} else if (isFragment(block)) {
|
|
2827
|
+
return isFragmentBlock(block.nodes);
|
|
2828
|
+
}
|
|
2829
|
+
return false;
|
|
2830
|
+
}
|
|
2831
|
+
function setScopeId(block, scopeIds) {
|
|
2832
|
+
if (block instanceof Element) {
|
|
2833
|
+
for (const id of scopeIds) {
|
|
2834
|
+
block.setAttribute(id, "");
|
|
2835
|
+
}
|
|
2836
|
+
} else if (isVaporComponent(block)) {
|
|
2837
|
+
setScopeId(block.block, scopeIds);
|
|
2838
|
+
} else if (isArray(block)) {
|
|
2839
|
+
for (const b of block) {
|
|
2840
|
+
setScopeId(b, scopeIds);
|
|
2841
|
+
}
|
|
2842
|
+
} else if (isFragment(block)) {
|
|
2843
|
+
setScopeId(block.nodes, scopeIds);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
function setComponentScopeId(instance) {
|
|
2847
|
+
const { parent, scopeId } = instance;
|
|
2848
|
+
if (!parent || !scopeId) return;
|
|
2849
|
+
if (isArray(instance.block) && instance.block.length > 1) return;
|
|
2850
|
+
const scopeIds = [];
|
|
2851
|
+
const parentScopeId = parent && parent.type.__scopeId;
|
|
2852
|
+
if (parentScopeId !== scopeId) {
|
|
2853
|
+
scopeIds.push(scopeId);
|
|
2854
|
+
} else {
|
|
2855
|
+
if (parentScopeId) scopeIds.push(parentScopeId);
|
|
2856
|
+
}
|
|
2857
|
+
if (parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
|
|
2858
|
+
scopeIds.push(parent.vnode.scopeId);
|
|
2859
|
+
const inheritedScopeIds = getInheritedScopeIds(parent.vnode, parent.parent);
|
|
2860
|
+
scopeIds.push(...inheritedScopeIds);
|
|
2861
|
+
}
|
|
2862
|
+
if (scopeIds.length > 0) {
|
|
2863
|
+
setScopeId(instance.block, scopeIds);
|
|
1190
2864
|
}
|
|
1191
|
-
return fragment;
|
|
1192
2865
|
}
|
|
1193
2866
|
|
|
1194
2867
|
function hmrRerender(instance) {
|
|
@@ -1197,6 +2870,10 @@ function hmrRerender(instance) {
|
|
|
1197
2870
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
1198
2871
|
remove(instance.block, parent);
|
|
1199
2872
|
const prev = setCurrentInstance(instance);
|
|
2873
|
+
if (instance.renderEffects) {
|
|
2874
|
+
instance.renderEffects.forEach((e) => e.stop());
|
|
2875
|
+
instance.renderEffects = [];
|
|
2876
|
+
}
|
|
1200
2877
|
pushWarningContext(instance);
|
|
1201
2878
|
devRender(instance);
|
|
1202
2879
|
popWarningContext();
|
|
@@ -1208,7 +2885,8 @@ function hmrReload(instance, newComp) {
|
|
|
1208
2885
|
const parent = normalized[0].parentNode;
|
|
1209
2886
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
1210
2887
|
unmountComponent(instance, parent);
|
|
1211
|
-
const
|
|
2888
|
+
const parentInstance = instance.parent;
|
|
2889
|
+
const prev = setCurrentInstance(parentInstance);
|
|
1212
2890
|
const newInstance = createComponent(
|
|
1213
2891
|
newComp,
|
|
1214
2892
|
instance.rawProps,
|
|
@@ -1217,43 +2895,106 @@ function hmrReload(instance, newComp) {
|
|
|
1217
2895
|
);
|
|
1218
2896
|
setCurrentInstance(...prev);
|
|
1219
2897
|
mountComponent(newInstance, parent, anchor);
|
|
2898
|
+
updateParentBlockOnHmrReload(parentInstance, instance, newInstance);
|
|
2899
|
+
updateParentTeleportOnHmrReload(instance, newInstance);
|
|
2900
|
+
}
|
|
2901
|
+
function updateParentBlockOnHmrReload(parentInstance, instance, newInstance) {
|
|
2902
|
+
if (parentInstance) {
|
|
2903
|
+
if (parentInstance.block === instance) {
|
|
2904
|
+
parentInstance.block = newInstance;
|
|
2905
|
+
} else if (isArray(parentInstance.block)) {
|
|
2906
|
+
for (let i = 0; i < parentInstance.block.length; i++) {
|
|
2907
|
+
if (parentInstance.block[i] === instance) {
|
|
2908
|
+
parentInstance.block[i] = newInstance;
|
|
2909
|
+
break;
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
function updateParentTeleportOnHmrReload(instance, newInstance) {
|
|
2916
|
+
const teleport = instance.parentTeleport;
|
|
2917
|
+
if (teleport) {
|
|
2918
|
+
newInstance.parentTeleport = teleport;
|
|
2919
|
+
if (teleport.nodes === instance) {
|
|
2920
|
+
teleport.nodes = newInstance;
|
|
2921
|
+
} else if (isArray(teleport.nodes)) {
|
|
2922
|
+
for (let i = 0; i < teleport.nodes.length; i++) {
|
|
2923
|
+
if (teleport.nodes[i] === instance) {
|
|
2924
|
+
teleport.nodes[i] = newInstance;
|
|
2925
|
+
break;
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
1220
2930
|
}
|
|
1221
2931
|
|
|
1222
|
-
function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
2932
|
+
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
1223
2933
|
const _insertionParent = insertionParent;
|
|
1224
2934
|
const _insertionAnchor = insertionAnchor;
|
|
2935
|
+
const _isLastInsertion = isLastInsertion;
|
|
1225
2936
|
if (isHydrating) {
|
|
1226
2937
|
locateHydrationNode();
|
|
1227
2938
|
} else {
|
|
1228
2939
|
resetInsertionState();
|
|
1229
2940
|
}
|
|
2941
|
+
const parentInstance = getParentInstance();
|
|
2942
|
+
if (isSingleRoot && component.inheritAttrs !== false && isVaporComponent(parentInstance) && parentInstance.hasFallthrough) {
|
|
2943
|
+
const attrs = parentInstance.attrs;
|
|
2944
|
+
if (rawProps) {
|
|
2945
|
+
(rawProps.$ || (rawProps.$ = [])).push(
|
|
2946
|
+
() => attrs
|
|
2947
|
+
);
|
|
2948
|
+
} else {
|
|
2949
|
+
rawProps = { $: [() => attrs] };
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
if (parentInstance && parentInstance.vapor && isKeepAlive(parentInstance)) {
|
|
2953
|
+
const cached = parentInstance.getCachedComponent(
|
|
2954
|
+
component
|
|
2955
|
+
);
|
|
2956
|
+
if (cached) return cached;
|
|
2957
|
+
}
|
|
1230
2958
|
if (appContext.vapor && !component.__vapor) {
|
|
2959
|
+
const prevSlotConsumer2 = setCurrentSlotConsumer(null);
|
|
1231
2960
|
const frag = appContext.vapor.vdomMount(
|
|
1232
2961
|
component,
|
|
2962
|
+
parentInstance,
|
|
1233
2963
|
rawProps,
|
|
1234
2964
|
rawSlots
|
|
1235
2965
|
);
|
|
1236
|
-
|
|
1237
|
-
|
|
2966
|
+
setCurrentSlotConsumer(prevSlotConsumer2);
|
|
2967
|
+
if (!isHydrating) {
|
|
2968
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
2969
|
+
} else {
|
|
2970
|
+
frag.hydrate();
|
|
2971
|
+
if (_isLastInsertion) {
|
|
2972
|
+
advanceHydrationNode(_insertionParent);
|
|
2973
|
+
}
|
|
1238
2974
|
}
|
|
1239
2975
|
return frag;
|
|
1240
2976
|
}
|
|
1241
|
-
if (
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1244
|
-
(
|
|
1245
|
-
() => attrs
|
|
1246
|
-
);
|
|
2977
|
+
if (isVaporTeleport(component)) {
|
|
2978
|
+
const frag = component.process(rawProps, rawSlots);
|
|
2979
|
+
if (!isHydrating) {
|
|
2980
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
1247
2981
|
} else {
|
|
1248
|
-
|
|
2982
|
+
frag.hydrate();
|
|
2983
|
+
if (_isLastInsertion) {
|
|
2984
|
+
advanceHydrationNode(_insertionParent);
|
|
2985
|
+
}
|
|
1249
2986
|
}
|
|
2987
|
+
return frag;
|
|
1250
2988
|
}
|
|
1251
2989
|
const instance = new VaporComponentInstance(
|
|
1252
2990
|
component,
|
|
1253
2991
|
rawProps,
|
|
1254
2992
|
rawSlots,
|
|
1255
|
-
appContext
|
|
2993
|
+
appContext,
|
|
2994
|
+
once,
|
|
2995
|
+
parentInstance
|
|
1256
2996
|
);
|
|
2997
|
+
const prevSlotConsumer = setCurrentSlotConsumer(null);
|
|
1257
2998
|
if (!!(process.env.NODE_ENV !== "production") && component.__hmrId) {
|
|
1258
2999
|
registerHMR(instance);
|
|
1259
3000
|
instance.isSingleRoot = isSingleRoot;
|
|
@@ -1266,6 +3007,46 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1266
3007
|
instance.propsOptions = normalizePropsOptions(component);
|
|
1267
3008
|
instance.emitsOptions = normalizeEmitsOptions(component);
|
|
1268
3009
|
}
|
|
3010
|
+
if (isHydrating && isAsyncWrapper(instance) && component.__asyncHydrate && !component.__asyncResolved) {
|
|
3011
|
+
const el = currentHydrationNode;
|
|
3012
|
+
if (isComment(el, "[")) {
|
|
3013
|
+
const end = _next(locateEndAnchor(el));
|
|
3014
|
+
const block = instance.block = [el];
|
|
3015
|
+
let cur = el;
|
|
3016
|
+
while (true) {
|
|
3017
|
+
let n = _next(cur);
|
|
3018
|
+
if (n && n !== end) {
|
|
3019
|
+
block.push(cur = n);
|
|
3020
|
+
} else {
|
|
3021
|
+
break;
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
} else {
|
|
3025
|
+
instance.block = el;
|
|
3026
|
+
}
|
|
3027
|
+
instance.isMounted = true;
|
|
3028
|
+
setCurrentHydrationNode(
|
|
3029
|
+
isComment(el, "[") ? locateEndAnchor(el) : el.nextSibling
|
|
3030
|
+
);
|
|
3031
|
+
component.__asyncHydrate(
|
|
3032
|
+
el,
|
|
3033
|
+
instance,
|
|
3034
|
+
() => setupComponent(instance, component)
|
|
3035
|
+
);
|
|
3036
|
+
} else {
|
|
3037
|
+
setupComponent(instance, component);
|
|
3038
|
+
}
|
|
3039
|
+
setCurrentSlotConsumer(prevSlotConsumer);
|
|
3040
|
+
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
3041
|
+
if (_insertionParent || isHydrating) {
|
|
3042
|
+
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
3043
|
+
}
|
|
3044
|
+
if (isHydrating && _insertionAnchor !== void 0) {
|
|
3045
|
+
advanceHydrationNode(_insertionParent);
|
|
3046
|
+
}
|
|
3047
|
+
return instance;
|
|
3048
|
+
}
|
|
3049
|
+
function setupComponent(instance, component) {
|
|
1269
3050
|
const prevInstance = setCurrentInstance(instance);
|
|
1270
3051
|
const prevSub = setActiveSub();
|
|
1271
3052
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -1302,14 +3083,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1302
3083
|
}
|
|
1303
3084
|
}
|
|
1304
3085
|
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
1305
|
-
|
|
1306
|
-
if (el) {
|
|
1307
|
-
renderEffect(() => {
|
|
1308
|
-
isApplyingFallthroughProps = true;
|
|
1309
|
-
setDynamicProps(el, [instance.attrs]);
|
|
1310
|
-
isApplyingFallthroughProps = false;
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
3086
|
+
renderEffect(() => applyFallthroughProps(instance.block, instance.attrs));
|
|
1313
3087
|
}
|
|
1314
3088
|
setActiveSub(prevSub);
|
|
1315
3089
|
setCurrentInstance(...prevInstance);
|
|
@@ -1317,13 +3091,16 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, appContext
|
|
|
1317
3091
|
popWarningContext();
|
|
1318
3092
|
endMeasure(instance, "init");
|
|
1319
3093
|
}
|
|
1320
|
-
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
1321
|
-
if (!isHydrating && _insertionParent) {
|
|
1322
|
-
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
1323
|
-
}
|
|
1324
|
-
return instance;
|
|
1325
3094
|
}
|
|
1326
3095
|
let isApplyingFallthroughProps = false;
|
|
3096
|
+
function applyFallthroughProps(block, attrs) {
|
|
3097
|
+
const el = getRootElement(block);
|
|
3098
|
+
if (el) {
|
|
3099
|
+
isApplyingFallthroughProps = true;
|
|
3100
|
+
setDynamicProps(el, [attrs]);
|
|
3101
|
+
isApplyingFallthroughProps = false;
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
1327
3104
|
function devRender(instance) {
|
|
1328
3105
|
instance.block = (instance.type.render ? callWithErrorHandling(
|
|
1329
3106
|
instance.type.render,
|
|
@@ -1357,16 +3134,16 @@ const emptyContext = {
|
|
|
1357
3134
|
provides: /* @__PURE__ */ Object.create(null)
|
|
1358
3135
|
};
|
|
1359
3136
|
class VaporComponentInstance {
|
|
1360
|
-
constructor(comp, rawProps, rawSlots, appContext) {
|
|
3137
|
+
constructor(comp, rawProps, rawSlots, appContext, once, parent = currentInstance) {
|
|
1361
3138
|
this.vapor = true;
|
|
1362
3139
|
this.uid = nextUid();
|
|
1363
3140
|
this.type = comp;
|
|
1364
|
-
this.parent =
|
|
1365
|
-
this.root =
|
|
1366
|
-
if (
|
|
1367
|
-
this.appContext =
|
|
1368
|
-
this.provides =
|
|
1369
|
-
this.ids =
|
|
3141
|
+
this.parent = parent;
|
|
3142
|
+
this.root = parent ? parent.root : this;
|
|
3143
|
+
if (parent) {
|
|
3144
|
+
this.appContext = parent.appContext;
|
|
3145
|
+
this.provides = parent.provides;
|
|
3146
|
+
this.ids = parent.ids;
|
|
1370
3147
|
} else {
|
|
1371
3148
|
this.appContext = appContext || emptyContext;
|
|
1372
3149
|
this.provides = Object.create(this.appContext.provides);
|
|
@@ -1382,7 +3159,7 @@ class VaporComponentInstance {
|
|
|
1382
3159
|
this.rawProps = rawProps || EMPTY_OBJ;
|
|
1383
3160
|
this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
|
|
1384
3161
|
if (rawProps || comp.props) {
|
|
1385
|
-
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp);
|
|
3162
|
+
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp, once);
|
|
1386
3163
|
this.attrs = new Proxy(this, attrsHandlers);
|
|
1387
3164
|
this.props = comp.props ? new Proxy(this, propsHandlers) : isFunction(comp) ? this.attrs : EMPTY_OBJ;
|
|
1388
3165
|
} else {
|
|
@@ -1390,6 +3167,10 @@ class VaporComponentInstance {
|
|
|
1390
3167
|
}
|
|
1391
3168
|
this.rawSlots = rawSlots || EMPTY_OBJ;
|
|
1392
3169
|
this.slots = rawSlots ? rawSlots.$ ? new Proxy(rawSlots, dynamicSlotsProxyHandlers) : rawSlots : EMPTY_OBJ;
|
|
3170
|
+
this.scopeId = currentInstance && currentInstance.type.__scopeId;
|
|
3171
|
+
if (comp.ce) {
|
|
3172
|
+
comp.ce(this);
|
|
3173
|
+
}
|
|
1393
3174
|
}
|
|
1394
3175
|
/**
|
|
1395
3176
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
@@ -1402,47 +3183,100 @@ class VaporComponentInstance {
|
|
|
1402
3183
|
function isVaporComponent(value) {
|
|
1403
3184
|
return value instanceof VaporComponentInstance;
|
|
1404
3185
|
}
|
|
1405
|
-
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot) {
|
|
3186
|
+
function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, once, appContext) {
|
|
1406
3187
|
if (!isString(comp)) {
|
|
1407
|
-
return createComponent(
|
|
3188
|
+
return createComponent(
|
|
3189
|
+
comp,
|
|
3190
|
+
rawProps,
|
|
3191
|
+
rawSlots,
|
|
3192
|
+
isSingleRoot,
|
|
3193
|
+
once,
|
|
3194
|
+
appContext
|
|
3195
|
+
);
|
|
1408
3196
|
}
|
|
3197
|
+
return createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once);
|
|
3198
|
+
}
|
|
3199
|
+
function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
1409
3200
|
const _insertionParent = insertionParent;
|
|
1410
3201
|
const _insertionAnchor = insertionAnchor;
|
|
3202
|
+
const _isLastInsertion = isLastInsertion;
|
|
1411
3203
|
if (isHydrating) {
|
|
1412
3204
|
locateHydrationNode();
|
|
1413
3205
|
} else {
|
|
1414
3206
|
resetInsertionState();
|
|
1415
3207
|
}
|
|
1416
|
-
const el =
|
|
3208
|
+
const el = isHydrating ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : createElement(comp);
|
|
1417
3209
|
el.$root = isSingleRoot;
|
|
3210
|
+
if (!isHydrating) {
|
|
3211
|
+
const scopeId = currentInstance.type.__scopeId;
|
|
3212
|
+
if (scopeId) setScopeId(el, [scopeId]);
|
|
3213
|
+
}
|
|
1418
3214
|
if (rawProps) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
3215
|
+
const setFn = () => setDynamicProps(el, [resolveDynamicProps(rawProps)]);
|
|
3216
|
+
if (once) setFn();
|
|
3217
|
+
else renderEffect(setFn);
|
|
1422
3218
|
}
|
|
1423
3219
|
if (rawSlots) {
|
|
1424
|
-
|
|
1425
|
-
|
|
3220
|
+
let nextNode = null;
|
|
3221
|
+
if (isHydrating) {
|
|
3222
|
+
nextNode = locateNextNode(el);
|
|
3223
|
+
setCurrentHydrationNode(el.firstChild);
|
|
3224
|
+
}
|
|
3225
|
+
if (rawSlots.$) {
|
|
3226
|
+
const frag = new DynamicFragment(
|
|
3227
|
+
isHydrating ? "" : !!(process.env.NODE_ENV !== "production") ? "slot" : void 0
|
|
3228
|
+
);
|
|
3229
|
+
renderEffect(() => frag.update(getSlot(rawSlots, "default")));
|
|
3230
|
+
if (!isHydrating) insert(frag, el);
|
|
3231
|
+
} else {
|
|
3232
|
+
const block = getSlot(rawSlots, "default")();
|
|
3233
|
+
if (!isHydrating) insert(block, el);
|
|
3234
|
+
}
|
|
3235
|
+
if (isHydrating) {
|
|
3236
|
+
setCurrentHydrationNode(nextNode);
|
|
1426
3237
|
}
|
|
1427
3238
|
}
|
|
1428
|
-
if (!isHydrating
|
|
1429
|
-
insert(el, _insertionParent, _insertionAnchor);
|
|
3239
|
+
if (!isHydrating) {
|
|
3240
|
+
if (_insertionParent) insert(el, _insertionParent, _insertionAnchor);
|
|
3241
|
+
} else {
|
|
3242
|
+
if (_isLastInsertion) {
|
|
3243
|
+
advanceHydrationNode(_insertionParent);
|
|
3244
|
+
}
|
|
1430
3245
|
}
|
|
1431
3246
|
return el;
|
|
1432
3247
|
}
|
|
1433
3248
|
function mountComponent(instance, parent, anchor) {
|
|
3249
|
+
if (instance.shapeFlag & 512) {
|
|
3250
|
+
findParentKeepAlive(instance).activate(instance, parent, anchor);
|
|
3251
|
+
return;
|
|
3252
|
+
}
|
|
3253
|
+
const { root, type } = instance;
|
|
3254
|
+
if (root && root.ce && // @ts-expect-error _def is private
|
|
3255
|
+
root.ce._def.shadowRoot !== false) {
|
|
3256
|
+
root.ce._injectChildStyle(type);
|
|
3257
|
+
}
|
|
1434
3258
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1435
3259
|
startMeasure(instance, `mount`);
|
|
1436
3260
|
}
|
|
1437
3261
|
if (instance.bm) invokeArrayFns(instance.bm);
|
|
1438
|
-
|
|
1439
|
-
|
|
3262
|
+
if (!isHydrating) {
|
|
3263
|
+
insert(instance.block, parent, anchor);
|
|
3264
|
+
setComponentScopeId(instance);
|
|
3265
|
+
}
|
|
3266
|
+
if (instance.m) queuePostFlushCb(instance.m);
|
|
3267
|
+
if (instance.shapeFlag & 256 && instance.a) {
|
|
3268
|
+
queuePostFlushCb(instance.a);
|
|
3269
|
+
}
|
|
1440
3270
|
instance.isMounted = true;
|
|
1441
3271
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1442
3272
|
endMeasure(instance, `mount`);
|
|
1443
3273
|
}
|
|
1444
3274
|
}
|
|
1445
3275
|
function unmountComponent(instance, parentNode) {
|
|
3276
|
+
if (parentNode && instance.parent && instance.parent.vapor && instance.shapeFlag & 256) {
|
|
3277
|
+
findParentKeepAlive(instance).deactivate(instance);
|
|
3278
|
+
return;
|
|
3279
|
+
}
|
|
1446
3280
|
if (instance.isMounted && !instance.isUnmounted) {
|
|
1447
3281
|
if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
|
|
1448
3282
|
unregisterHMR(instance);
|
|
@@ -1452,7 +3286,7 @@ function unmountComponent(instance, parentNode) {
|
|
|
1452
3286
|
}
|
|
1453
3287
|
instance.scope.stop();
|
|
1454
3288
|
if (instance.um) {
|
|
1455
|
-
queuePostFlushCb(
|
|
3289
|
+
queuePostFlushCb(instance.um);
|
|
1456
3290
|
}
|
|
1457
3291
|
instance.isUnmounted = true;
|
|
1458
3292
|
}
|
|
@@ -1467,9 +3301,7 @@ function getExposed(instance) {
|
|
|
1467
3301
|
}));
|
|
1468
3302
|
}
|
|
1469
3303
|
}
|
|
1470
|
-
function getRootElement({
|
|
1471
|
-
block
|
|
1472
|
-
}) {
|
|
3304
|
+
function getRootElement(block) {
|
|
1473
3305
|
if (block instanceof Element) {
|
|
1474
3306
|
return block;
|
|
1475
3307
|
}
|
|
@@ -1490,11 +3322,12 @@ const mountApp = (app, container) => {
|
|
|
1490
3322
|
}
|
|
1491
3323
|
container.textContent = "";
|
|
1492
3324
|
}
|
|
1493
|
-
const instance = createComponent(
|
|
3325
|
+
const instance = app._ceComponent || createComponent(
|
|
1494
3326
|
app._component,
|
|
1495
3327
|
app._props,
|
|
1496
3328
|
null,
|
|
1497
3329
|
false,
|
|
3330
|
+
false,
|
|
1498
3331
|
app._context
|
|
1499
3332
|
);
|
|
1500
3333
|
mountComponent(instance, container);
|
|
@@ -1506,11 +3339,12 @@ const hydrateApp = (app, container) => {
|
|
|
1506
3339
|
optimizePropertyLookup();
|
|
1507
3340
|
let instance;
|
|
1508
3341
|
withHydration(container, () => {
|
|
1509
|
-
instance = createComponent(
|
|
3342
|
+
instance = app._ceComponent || createComponent(
|
|
1510
3343
|
app._component,
|
|
1511
3344
|
app._props,
|
|
1512
3345
|
null,
|
|
1513
3346
|
false,
|
|
3347
|
+
false,
|
|
1514
3348
|
app._context
|
|
1515
3349
|
);
|
|
1516
3350
|
mountComponent(instance, container);
|
|
@@ -1536,7 +3370,12 @@ function postPrepareApp(app) {
|
|
|
1536
3370
|
const mount = app.mount;
|
|
1537
3371
|
app.mount = (container, ...args) => {
|
|
1538
3372
|
container = normalizeContainer(container);
|
|
1539
|
-
|
|
3373
|
+
const proxy = mount(container, ...args);
|
|
3374
|
+
if (container instanceof Element) {
|
|
3375
|
+
container.removeAttribute("v-cloak");
|
|
3376
|
+
container.setAttribute("data-v-app", "");
|
|
3377
|
+
}
|
|
3378
|
+
return proxy;
|
|
1540
3379
|
};
|
|
1541
3380
|
}
|
|
1542
3381
|
const createVaporApp = (comp, props) => {
|
|
@@ -1555,38 +3394,274 @@ const createVaporSSRApp = (comp, props) => {
|
|
|
1555
3394
|
return app;
|
|
1556
3395
|
};
|
|
1557
3396
|
|
|
1558
|
-
|
|
3397
|
+
function defineVaporAsyncComponent(source) {
|
|
3398
|
+
const {
|
|
3399
|
+
load,
|
|
3400
|
+
getResolvedComp,
|
|
3401
|
+
setPendingRequest,
|
|
3402
|
+
source: {
|
|
3403
|
+
loadingComponent,
|
|
3404
|
+
errorComponent,
|
|
3405
|
+
delay,
|
|
3406
|
+
hydrate: hydrateStrategy,
|
|
3407
|
+
timeout,
|
|
3408
|
+
suspensible = true
|
|
3409
|
+
}
|
|
3410
|
+
} = createAsyncComponentContext(source);
|
|
3411
|
+
return defineVaporComponent({
|
|
3412
|
+
name: "VaporAsyncComponentWrapper",
|
|
3413
|
+
__asyncLoader: load,
|
|
3414
|
+
__asyncHydrate(el, instance, hydrate) {
|
|
3415
|
+
let isHydrated = false;
|
|
3416
|
+
watch(
|
|
3417
|
+
() => instance.attrs,
|
|
3418
|
+
() => {
|
|
3419
|
+
if (isHydrated) return;
|
|
3420
|
+
instance.bu && invokeArrayFns(instance.bu);
|
|
3421
|
+
const parent = parentNode(el);
|
|
3422
|
+
load().then(() => {
|
|
3423
|
+
if (instance.isUnmounted) return;
|
|
3424
|
+
hydrate();
|
|
3425
|
+
if (isComment(el, "[")) {
|
|
3426
|
+
const endAnchor = locateEndAnchor(el);
|
|
3427
|
+
removeFragmentNodes(el, endAnchor);
|
|
3428
|
+
insert(instance.block, parent, endAnchor);
|
|
3429
|
+
} else {
|
|
3430
|
+
insert(instance.block, parent, el);
|
|
3431
|
+
remove(el, parent);
|
|
3432
|
+
}
|
|
3433
|
+
});
|
|
3434
|
+
},
|
|
3435
|
+
{ deep: true, once: true }
|
|
3436
|
+
);
|
|
3437
|
+
performAsyncHydrate(
|
|
3438
|
+
el,
|
|
3439
|
+
instance,
|
|
3440
|
+
() => {
|
|
3441
|
+
hydrateNode(el, () => {
|
|
3442
|
+
hydrate();
|
|
3443
|
+
insert(instance.block, parentNode(el), el);
|
|
3444
|
+
isHydrated = true;
|
|
3445
|
+
});
|
|
3446
|
+
},
|
|
3447
|
+
getResolvedComp,
|
|
3448
|
+
load,
|
|
3449
|
+
hydrateStrategy
|
|
3450
|
+
);
|
|
3451
|
+
},
|
|
3452
|
+
get __asyncResolved() {
|
|
3453
|
+
return getResolvedComp();
|
|
3454
|
+
},
|
|
3455
|
+
setup() {
|
|
3456
|
+
const instance = currentInstance;
|
|
3457
|
+
markAsyncBoundary(instance);
|
|
3458
|
+
const frag = !!(process.env.NODE_ENV !== "production") || isHydrating ? new DynamicFragment("async component") : new DynamicFragment();
|
|
3459
|
+
let resolvedComp = getResolvedComp();
|
|
3460
|
+
if (resolvedComp) {
|
|
3461
|
+
frag.update(() => createInnerComp(resolvedComp, instance, frag));
|
|
3462
|
+
return frag;
|
|
3463
|
+
}
|
|
3464
|
+
const onError = (err) => {
|
|
3465
|
+
setPendingRequest(null);
|
|
3466
|
+
handleError(
|
|
3467
|
+
err,
|
|
3468
|
+
instance,
|
|
3469
|
+
13,
|
|
3470
|
+
!errorComponent
|
|
3471
|
+
);
|
|
3472
|
+
};
|
|
3473
|
+
if (suspensible && instance.suspense) ;
|
|
3474
|
+
const { loaded, error, delayed } = useAsyncComponentState(
|
|
3475
|
+
delay,
|
|
3476
|
+
timeout,
|
|
3477
|
+
onError
|
|
3478
|
+
);
|
|
3479
|
+
load().then(() => {
|
|
3480
|
+
loaded.value = true;
|
|
3481
|
+
}).catch((err) => {
|
|
3482
|
+
onError(err);
|
|
3483
|
+
error.value = err;
|
|
3484
|
+
});
|
|
3485
|
+
renderEffect(() => {
|
|
3486
|
+
resolvedComp = getResolvedComp();
|
|
3487
|
+
let render;
|
|
3488
|
+
if (loaded.value && resolvedComp) {
|
|
3489
|
+
render = () => createInnerComp(resolvedComp, instance, frag);
|
|
3490
|
+
} else if (error.value && errorComponent) {
|
|
3491
|
+
render = () => createComponent(errorComponent, { error: () => error.value });
|
|
3492
|
+
} else if (loadingComponent && !delayed.value) {
|
|
3493
|
+
render = () => createComponent(loadingComponent);
|
|
3494
|
+
}
|
|
3495
|
+
if (instance.$transition) frag.$transition = instance.$transition;
|
|
3496
|
+
frag.update(render);
|
|
3497
|
+
});
|
|
3498
|
+
return frag;
|
|
3499
|
+
}
|
|
3500
|
+
});
|
|
3501
|
+
}
|
|
3502
|
+
function createInnerComp(comp, parent, frag) {
|
|
3503
|
+
const { rawProps, rawSlots, isSingleRoot, appContext, $transition } = parent;
|
|
3504
|
+
const instance = createComponent(
|
|
3505
|
+
comp,
|
|
3506
|
+
rawProps,
|
|
3507
|
+
rawSlots,
|
|
3508
|
+
isSingleRoot,
|
|
3509
|
+
void 0,
|
|
3510
|
+
appContext
|
|
3511
|
+
);
|
|
3512
|
+
if (parent.parent && isKeepAlive(parent.parent)) {
|
|
3513
|
+
parent.parent.cacheComponent(instance);
|
|
3514
|
+
parent.parent.cacheComponent(parent);
|
|
3515
|
+
}
|
|
3516
|
+
if ($transition) setTransitionHooks(instance, $transition);
|
|
3517
|
+
frag && frag.setRef && frag.setRef(instance);
|
|
3518
|
+
return instance;
|
|
3519
|
+
}
|
|
3520
|
+
|
|
1559
3521
|
// @__NO_SIDE_EFFECTS__
|
|
1560
|
-
function
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
3522
|
+
function defineVaporCustomElement(options, extraOptions, _createApp) {
|
|
3523
|
+
let Comp = defineVaporComponent(options, extraOptions);
|
|
3524
|
+
if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
|
|
3525
|
+
class VaporCustomElement extends VaporElement {
|
|
3526
|
+
constructor(initialProps) {
|
|
3527
|
+
super(Comp, initialProps, _createApp);
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
VaporCustomElement.def = Comp;
|
|
3531
|
+
return VaporCustomElement;
|
|
3532
|
+
}
|
|
3533
|
+
const defineVaporSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
3534
|
+
return /* @__PURE__ */ defineVaporCustomElement(options, extraOptions, createVaporSSRApp);
|
|
3535
|
+
});
|
|
3536
|
+
class VaporElement extends VueElementBase {
|
|
3537
|
+
constructor(def, props = {}, createAppFn = createVaporApp) {
|
|
3538
|
+
super(def, props, createAppFn);
|
|
3539
|
+
}
|
|
3540
|
+
_needsHydration() {
|
|
3541
|
+
if (this.shadowRoot && this._createApp !== createVaporApp) {
|
|
3542
|
+
return true;
|
|
3543
|
+
} else {
|
|
3544
|
+
if (!!(process.env.NODE_ENV !== "production") && this.shadowRoot) {
|
|
3545
|
+
warn(
|
|
3546
|
+
`Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineVaporSSRCustomElement\`.`
|
|
3547
|
+
);
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
return false;
|
|
3551
|
+
}
|
|
3552
|
+
_mount(def) {
|
|
3553
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) && !def.name) {
|
|
3554
|
+
def.name = "VaporElement";
|
|
3555
|
+
}
|
|
3556
|
+
this._app = this._createApp(this._def);
|
|
3557
|
+
this._inheritParentContext();
|
|
3558
|
+
if (this._def.configureApp) {
|
|
3559
|
+
this._def.configureApp(this._app);
|
|
3560
|
+
}
|
|
3561
|
+
if (this.shadowRoot && this._createApp === createVaporSSRApp) {
|
|
3562
|
+
withHydration(this._root, this._createComponent.bind(this));
|
|
3563
|
+
} else {
|
|
3564
|
+
this._createComponent();
|
|
3565
|
+
}
|
|
3566
|
+
this._app.mount(this._root);
|
|
3567
|
+
if (!this.shadowRoot) {
|
|
3568
|
+
this._renderSlots();
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
_update() {
|
|
3572
|
+
if (!this._app) return;
|
|
3573
|
+
const renderEffects = this._instance.renderEffects;
|
|
3574
|
+
if (renderEffects) renderEffects.forEach((e) => e.run());
|
|
3575
|
+
}
|
|
3576
|
+
_unmount() {
|
|
3577
|
+
{
|
|
3578
|
+
this._app.unmount();
|
|
3579
|
+
}
|
|
3580
|
+
if (this._instance && this._instance.ce) {
|
|
3581
|
+
this._instance.ce = void 0;
|
|
3582
|
+
}
|
|
3583
|
+
this._app = this._instance = null;
|
|
3584
|
+
}
|
|
3585
|
+
/**
|
|
3586
|
+
* Only called when shadowRoot is false
|
|
3587
|
+
*/
|
|
3588
|
+
_updateSlotNodes(replacements) {
|
|
3589
|
+
this._updateFragmentNodes(
|
|
3590
|
+
this._instance.block,
|
|
3591
|
+
replacements
|
|
3592
|
+
);
|
|
3593
|
+
}
|
|
3594
|
+
/**
|
|
3595
|
+
* Replace slot nodes with their replace content
|
|
3596
|
+
* @internal
|
|
3597
|
+
*/
|
|
3598
|
+
_updateFragmentNodes(block, replacements) {
|
|
3599
|
+
if (Array.isArray(block)) {
|
|
3600
|
+
block.forEach((item) => this._updateFragmentNodes(item, replacements));
|
|
3601
|
+
return;
|
|
3602
|
+
}
|
|
3603
|
+
if (!isFragment(block)) return;
|
|
3604
|
+
const { nodes } = block;
|
|
3605
|
+
if (Array.isArray(nodes)) {
|
|
3606
|
+
const newNodes = [];
|
|
3607
|
+
for (const node of nodes) {
|
|
3608
|
+
if (node instanceof HTMLSlotElement) {
|
|
3609
|
+
newNodes.push(...replacements.get(node));
|
|
3610
|
+
} else {
|
|
3611
|
+
this._updateFragmentNodes(node, replacements);
|
|
3612
|
+
newNodes.push(node);
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
block.nodes = newNodes;
|
|
3616
|
+
} else if (nodes instanceof HTMLSlotElement) {
|
|
3617
|
+
block.nodes = replacements.get(nodes);
|
|
3618
|
+
} else {
|
|
3619
|
+
this._updateFragmentNodes(nodes, replacements);
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
_createComponent() {
|
|
3623
|
+
this._def.ce = (instance) => {
|
|
3624
|
+
this._app._ceComponent = this._instance = instance;
|
|
3625
|
+
if (!this.shadowRoot) {
|
|
3626
|
+
this._instance.u = [this._renderSlots.bind(this)];
|
|
3627
|
+
}
|
|
3628
|
+
this._processInstance();
|
|
3629
|
+
};
|
|
3630
|
+
createComponent(
|
|
3631
|
+
this._def,
|
|
3632
|
+
this._props,
|
|
3633
|
+
void 0,
|
|
3634
|
+
void 0,
|
|
3635
|
+
void 0,
|
|
3636
|
+
this._app._context
|
|
3637
|
+
);
|
|
1566
3638
|
}
|
|
1567
|
-
comp.__vapor = true;
|
|
1568
|
-
return comp;
|
|
1569
3639
|
}
|
|
1570
3640
|
|
|
1571
3641
|
let t;
|
|
1572
3642
|
/*! #__NO_SIDE_EFFECTS__ */
|
|
1573
3643
|
// @__NO_SIDE_EFFECTS__
|
|
1574
|
-
function template(html, root) {
|
|
3644
|
+
function template(html, root, ns) {
|
|
1575
3645
|
let node;
|
|
1576
3646
|
return () => {
|
|
1577
3647
|
if (isHydrating) {
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
return adoptTemplate(currentHydrationNode, html);
|
|
3648
|
+
const adopted = adoptTemplate(currentHydrationNode, html);
|
|
3649
|
+
if (root) adopted.$root = true;
|
|
3650
|
+
return adopted;
|
|
1582
3651
|
}
|
|
1583
3652
|
if (html[0] !== "<") {
|
|
1584
3653
|
return createTextNode(html);
|
|
1585
3654
|
}
|
|
1586
3655
|
if (!node) {
|
|
1587
3656
|
t = t || document.createElement("template");
|
|
1588
|
-
|
|
1589
|
-
|
|
3657
|
+
if (ns) {
|
|
3658
|
+
const tag = ns === 1 ? "svg" : "math";
|
|
3659
|
+
t.innerHTML = `<${tag}>${html}</${tag}>`;
|
|
3660
|
+
node = _child(_child(t.content));
|
|
3661
|
+
} else {
|
|
3662
|
+
t.innerHTML = html;
|
|
3663
|
+
node = _child(t.content);
|
|
3664
|
+
}
|
|
1590
3665
|
}
|
|
1591
3666
|
const ret = node.cloneNode(true);
|
|
1592
3667
|
if (root) ret.$root = true;
|
|
@@ -1597,24 +3672,209 @@ function template(html, root) {
|
|
|
1597
3672
|
function createIf(condition, b1, b2, once) {
|
|
1598
3673
|
const _insertionParent = insertionParent;
|
|
1599
3674
|
const _insertionAnchor = insertionAnchor;
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
} else {
|
|
1603
|
-
resetInsertionState();
|
|
1604
|
-
}
|
|
3675
|
+
const _isLastInsertion = isLastInsertion;
|
|
3676
|
+
if (!isHydrating) resetInsertionState();
|
|
1605
3677
|
let frag;
|
|
1606
3678
|
if (once) {
|
|
1607
3679
|
frag = condition() ? b1() : b2 ? b2() : [];
|
|
1608
3680
|
} else {
|
|
1609
|
-
frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
3681
|
+
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
1610
3682
|
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
1611
3683
|
}
|
|
1612
|
-
if (!isHydrating
|
|
1613
|
-
insert(frag, _insertionParent, _insertionAnchor);
|
|
3684
|
+
if (!isHydrating) {
|
|
3685
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3686
|
+
} else {
|
|
3687
|
+
if (_isLastInsertion) {
|
|
3688
|
+
advanceHydrationNode(_insertionParent);
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
return frag;
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
function createKeyedFragment(key, render) {
|
|
3695
|
+
const _insertionParent = insertionParent;
|
|
3696
|
+
const _insertionAnchor = insertionAnchor;
|
|
3697
|
+
const _isLastInsertion = isLastInsertion;
|
|
3698
|
+
if (!isHydrating) resetInsertionState();
|
|
3699
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
3700
|
+
renderEffect(() => {
|
|
3701
|
+
frag.update(render, key());
|
|
3702
|
+
});
|
|
3703
|
+
if (!isHydrating) {
|
|
3704
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3705
|
+
} else {
|
|
3706
|
+
if (_isLastInsertion) {
|
|
3707
|
+
advanceHydrationNode(_insertionParent);
|
|
3708
|
+
}
|
|
1614
3709
|
}
|
|
1615
3710
|
return frag;
|
|
1616
3711
|
}
|
|
1617
3712
|
|
|
3713
|
+
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
3714
|
+
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
3715
|
+
const decorate = (t) => {
|
|
3716
|
+
delete t.props.mode;
|
|
3717
|
+
t.__vapor = true;
|
|
3718
|
+
return t;
|
|
3719
|
+
};
|
|
3720
|
+
const VaporTransitionGroup = decorate({
|
|
3721
|
+
name: "VaporTransitionGroup",
|
|
3722
|
+
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
3723
|
+
tag: String,
|
|
3724
|
+
moveClass: String
|
|
3725
|
+
}),
|
|
3726
|
+
setup(props, { slots }) {
|
|
3727
|
+
const instance = currentInstance;
|
|
3728
|
+
const state = useTransitionState();
|
|
3729
|
+
const cssTransitionProps = resolveTransitionProps(props);
|
|
3730
|
+
let prevChildren;
|
|
3731
|
+
let children;
|
|
3732
|
+
const slottedBlock = slots.default && slots.default();
|
|
3733
|
+
onBeforeUpdate(() => {
|
|
3734
|
+
prevChildren = [];
|
|
3735
|
+
children = getTransitionBlocks(slottedBlock);
|
|
3736
|
+
if (children) {
|
|
3737
|
+
for (let i = 0; i < children.length; i++) {
|
|
3738
|
+
const child = children[i];
|
|
3739
|
+
if (isValidTransitionBlock(child)) {
|
|
3740
|
+
prevChildren.push(child);
|
|
3741
|
+
child.$transition.disabled = true;
|
|
3742
|
+
positionMap.set(
|
|
3743
|
+
child,
|
|
3744
|
+
getTransitionElement(child).getBoundingClientRect()
|
|
3745
|
+
);
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
});
|
|
3750
|
+
onUpdated(() => {
|
|
3751
|
+
if (!prevChildren.length) {
|
|
3752
|
+
return;
|
|
3753
|
+
}
|
|
3754
|
+
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
3755
|
+
const firstChild = getFirstConnectedChild(prevChildren);
|
|
3756
|
+
if (!firstChild || !hasCSSTransform(
|
|
3757
|
+
firstChild,
|
|
3758
|
+
firstChild.parentNode,
|
|
3759
|
+
moveClass
|
|
3760
|
+
)) {
|
|
3761
|
+
prevChildren = [];
|
|
3762
|
+
return;
|
|
3763
|
+
}
|
|
3764
|
+
prevChildren.forEach(callPendingCbs);
|
|
3765
|
+
prevChildren.forEach((child) => {
|
|
3766
|
+
child.$transition.disabled = false;
|
|
3767
|
+
recordPosition(child);
|
|
3768
|
+
});
|
|
3769
|
+
const movedChildren = prevChildren.filter(applyTranslation);
|
|
3770
|
+
forceReflow();
|
|
3771
|
+
movedChildren.forEach(
|
|
3772
|
+
(c) => handleMovedChildren(
|
|
3773
|
+
getTransitionElement(c),
|
|
3774
|
+
moveClass
|
|
3775
|
+
)
|
|
3776
|
+
);
|
|
3777
|
+
prevChildren = [];
|
|
3778
|
+
});
|
|
3779
|
+
setTransitionHooksOnFragment(slottedBlock, {
|
|
3780
|
+
props: cssTransitionProps,
|
|
3781
|
+
state,
|
|
3782
|
+
instance,
|
|
3783
|
+
group: true
|
|
3784
|
+
});
|
|
3785
|
+
children = getTransitionBlocks(slottedBlock);
|
|
3786
|
+
for (let i = 0; i < children.length; i++) {
|
|
3787
|
+
const child = children[i];
|
|
3788
|
+
if (isValidTransitionBlock(child)) {
|
|
3789
|
+
if (child.$key != null) {
|
|
3790
|
+
const hooks = resolveTransitionHooks(
|
|
3791
|
+
child,
|
|
3792
|
+
cssTransitionProps,
|
|
3793
|
+
state,
|
|
3794
|
+
instance
|
|
3795
|
+
);
|
|
3796
|
+
hooks.group = true;
|
|
3797
|
+
setTransitionHooks(child, hooks);
|
|
3798
|
+
} else if (!!(process.env.NODE_ENV !== "production") && child.$key == null) {
|
|
3799
|
+
warn(`<transition-group> children must be keyed`);
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
const tag = props.tag;
|
|
3804
|
+
if (tag) {
|
|
3805
|
+
const container = createElement(tag);
|
|
3806
|
+
insert(slottedBlock, container);
|
|
3807
|
+
if (instance.hasFallthrough) {
|
|
3808
|
+
container.$root = true;
|
|
3809
|
+
renderEffect(() => applyFallthroughProps(container, instance.attrs));
|
|
3810
|
+
}
|
|
3811
|
+
return container;
|
|
3812
|
+
} else {
|
|
3813
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("transition-group") : new DynamicFragment();
|
|
3814
|
+
renderEffect(() => frag.update(() => slottedBlock));
|
|
3815
|
+
return frag;
|
|
3816
|
+
}
|
|
3817
|
+
}
|
|
3818
|
+
});
|
|
3819
|
+
function getTransitionBlocks(block) {
|
|
3820
|
+
let children = [];
|
|
3821
|
+
if (block instanceof Node) {
|
|
3822
|
+
children.push(block);
|
|
3823
|
+
} else if (isVaporComponent(block)) {
|
|
3824
|
+
children.push(...getTransitionBlocks(block.block));
|
|
3825
|
+
} else if (isArray(block)) {
|
|
3826
|
+
for (let i = 0; i < block.length; i++) {
|
|
3827
|
+
const b = block[i];
|
|
3828
|
+
const blocks = getTransitionBlocks(b);
|
|
3829
|
+
if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
|
|
3830
|
+
children.push(...blocks);
|
|
3831
|
+
}
|
|
3832
|
+
} else if (isFragment(block)) {
|
|
3833
|
+
if (block.insert) {
|
|
3834
|
+
children.push(block);
|
|
3835
|
+
} else {
|
|
3836
|
+
children.push(...getTransitionBlocks(block.nodes));
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
return children;
|
|
3840
|
+
}
|
|
3841
|
+
function isValidTransitionBlock(block) {
|
|
3842
|
+
return !!(block instanceof Element || isFragment(block) && block.insert);
|
|
3843
|
+
}
|
|
3844
|
+
function getTransitionElement(c) {
|
|
3845
|
+
return isFragment(c) ? c.nodes : c;
|
|
3846
|
+
}
|
|
3847
|
+
function recordPosition(c) {
|
|
3848
|
+
newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
|
|
3849
|
+
}
|
|
3850
|
+
function applyTranslation(c) {
|
|
3851
|
+
if (baseApplyTranslation(
|
|
3852
|
+
positionMap.get(c),
|
|
3853
|
+
newPositionMap.get(c),
|
|
3854
|
+
getTransitionElement(c)
|
|
3855
|
+
)) {
|
|
3856
|
+
return c;
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
function getFirstConnectedChild(children) {
|
|
3860
|
+
for (let i = 0; i < children.length; i++) {
|
|
3861
|
+
const child = children[i];
|
|
3862
|
+
const el = getTransitionElement(child);
|
|
3863
|
+
if (el.isConnected) return el;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
function triggerTransitionGroupUpdate(transition) {
|
|
3867
|
+
const { instance } = transition;
|
|
3868
|
+
if (!instance.isUpdating) {
|
|
3869
|
+
instance.isUpdating = true;
|
|
3870
|
+
if (instance.bu) invokeArrayFns(instance.bu);
|
|
3871
|
+
queuePostFlushCb(() => {
|
|
3872
|
+
instance.isUpdating = false;
|
|
3873
|
+
if (instance.u) invokeArrayFns(instance.u);
|
|
3874
|
+
});
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
|
|
1618
3878
|
class ForBlock extends VaporFragment {
|
|
1619
3879
|
constructor(nodes, scope, item, key, index, renderKey) {
|
|
1620
3880
|
super(nodes);
|
|
@@ -1628,6 +3888,7 @@ class ForBlock extends VaporFragment {
|
|
|
1628
3888
|
const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
1629
3889
|
const _insertionParent = insertionParent;
|
|
1630
3890
|
const _insertionAnchor = insertionAnchor;
|
|
3891
|
+
const _isLastInsertion = isLastInsertion;
|
|
1631
3892
|
if (isHydrating) {
|
|
1632
3893
|
locateHydrationNode();
|
|
1633
3894
|
} else {
|
|
@@ -1638,8 +3899,11 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1638
3899
|
let newBlocks;
|
|
1639
3900
|
let parent;
|
|
1640
3901
|
let currentKey;
|
|
1641
|
-
|
|
1642
|
-
|
|
3902
|
+
let parentAnchor;
|
|
3903
|
+
if (!isHydrating) {
|
|
3904
|
+
parentAnchor = !!(process.env.NODE_ENV !== "production") ? createComment("for") : createTextNode();
|
|
3905
|
+
}
|
|
3906
|
+
const frag = new ForFragment(oldBlocks);
|
|
1643
3907
|
const instance = currentInstance;
|
|
1644
3908
|
const canUseFastRemove = !!(flags & 1);
|
|
1645
3909
|
const isComponent = !!(flags & 2);
|
|
@@ -1652,15 +3916,37 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1652
3916
|
const newLength = source.values.length;
|
|
1653
3917
|
const oldLength = oldBlocks.length;
|
|
1654
3918
|
newBlocks = new Array(newLength);
|
|
3919
|
+
let isFallback = false;
|
|
3920
|
+
const transitionHooks = frag.$transition;
|
|
3921
|
+
if (transitionHooks && transitionHooks.group) {
|
|
3922
|
+
triggerTransitionGroupUpdate(transitionHooks);
|
|
3923
|
+
}
|
|
1655
3924
|
const prevSub = setActiveSub();
|
|
1656
3925
|
if (!isMounted) {
|
|
1657
3926
|
isMounted = true;
|
|
1658
3927
|
for (let i = 0; i < newLength; i++) {
|
|
1659
|
-
mount(source, i);
|
|
3928
|
+
const nodes = mount(source, i).nodes;
|
|
3929
|
+
if (isHydrating) {
|
|
3930
|
+
setCurrentHydrationNode(findBlockNode(nodes).nextNode);
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
if (isHydrating) {
|
|
3934
|
+
parentAnchor = newLength === 0 ? currentHydrationNode.nextSibling : currentHydrationNode;
|
|
3935
|
+
if (!!(process.env.NODE_ENV !== "production") && (!parentAnchor || parentAnchor && !isComment(parentAnchor, "]"))) {
|
|
3936
|
+
throw new Error(
|
|
3937
|
+
`v-for fragment anchor node was not found. this is likely a Vue internal bug.`
|
|
3938
|
+
);
|
|
3939
|
+
}
|
|
3940
|
+
if (_insertionParent) {
|
|
3941
|
+
updateLastLogicalChild(_insertionParent, parentAnchor);
|
|
3942
|
+
}
|
|
1660
3943
|
}
|
|
1661
3944
|
} else {
|
|
1662
3945
|
parent = parent || parentAnchor.parentNode;
|
|
1663
3946
|
if (!oldLength) {
|
|
3947
|
+
if (frag.fallback && frag.nodes[0].length > 0) {
|
|
3948
|
+
remove(frag.nodes[0], parent);
|
|
3949
|
+
}
|
|
1664
3950
|
for (let i = 0; i < newLength; i++) {
|
|
1665
3951
|
mount(source, i);
|
|
1666
3952
|
}
|
|
@@ -1676,6 +3962,10 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1676
3962
|
parent.textContent = "";
|
|
1677
3963
|
parent.appendChild(parentAnchor);
|
|
1678
3964
|
}
|
|
3965
|
+
if (frag.fallback) {
|
|
3966
|
+
insert(frag.nodes[0] = frag.fallback(), parent, parentAnchor);
|
|
3967
|
+
isFallback = true;
|
|
3968
|
+
}
|
|
1679
3969
|
} else if (!getKey) {
|
|
1680
3970
|
const commonLength = Math.min(newLength, oldLength);
|
|
1681
3971
|
for (let i = 0; i < commonLength; i++) {
|
|
@@ -1688,147 +3978,163 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1688
3978
|
unmount(oldBlocks[i]);
|
|
1689
3979
|
}
|
|
1690
3980
|
} else {
|
|
1691
|
-
|
|
1692
|
-
|
|
3981
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3982
|
+
const keyToIndexMap = /* @__PURE__ */ new Map();
|
|
3983
|
+
for (let i = 0; i < newLength; i++) {
|
|
3984
|
+
const item = getItem(source, i);
|
|
3985
|
+
const key = getKey(...item);
|
|
3986
|
+
if (key != null) {
|
|
3987
|
+
if (keyToIndexMap.has(key)) {
|
|
3988
|
+
warn(
|
|
3989
|
+
`Duplicate keys found during update:`,
|
|
3990
|
+
JSON.stringify(key),
|
|
3991
|
+
`Make sure keys are unique.`
|
|
3992
|
+
);
|
|
3993
|
+
}
|
|
3994
|
+
keyToIndexMap.set(key, i);
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
const commonLength = Math.min(oldLength, newLength);
|
|
3999
|
+
const oldKeyIndexPairs = new Array(oldLength);
|
|
1693
4000
|
const queuedBlocks = new Array(newLength);
|
|
1694
|
-
let anchorFallback = parentAnchor;
|
|
1695
4001
|
let endOffset = 0;
|
|
1696
|
-
let
|
|
1697
|
-
let
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
const
|
|
1701
|
-
const
|
|
1702
|
-
const currentKey2 = getKey(...currentItem);
|
|
4002
|
+
let queuedBlocksLength = 0;
|
|
4003
|
+
let oldKeyIndexPairsLength = 0;
|
|
4004
|
+
while (endOffset < commonLength) {
|
|
4005
|
+
const index = newLength - endOffset - 1;
|
|
4006
|
+
const item = getItem(source, index);
|
|
4007
|
+
const key = getKey(...item);
|
|
1703
4008
|
const existingBlock = oldBlocks[oldLength - endOffset - 1];
|
|
1704
|
-
if (existingBlock.key
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
continue;
|
|
1709
|
-
}
|
|
1710
|
-
if (endOffset !== 0) {
|
|
1711
|
-
anchorFallback = normalizeAnchor(newBlocks[currentIndex + 1].nodes);
|
|
1712
|
-
}
|
|
1713
|
-
break;
|
|
4009
|
+
if (existingBlock.key !== key) break;
|
|
4010
|
+
update(existingBlock, ...item);
|
|
4011
|
+
newBlocks[index] = existingBlock;
|
|
4012
|
+
endOffset++;
|
|
1714
4013
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
4014
|
+
const e1 = commonLength - endOffset;
|
|
4015
|
+
const e2 = oldLength - endOffset;
|
|
4016
|
+
const e3 = newLength - endOffset;
|
|
4017
|
+
for (let i = 0; i < e1; i++) {
|
|
4018
|
+
const currentItem = getItem(source, i);
|
|
1717
4019
|
const currentKey2 = getKey(...currentItem);
|
|
1718
|
-
const
|
|
1719
|
-
const
|
|
1720
|
-
if (
|
|
1721
|
-
update(newBlocks[
|
|
4020
|
+
const oldBlock = oldBlocks[i];
|
|
4021
|
+
const oldKey = oldBlock.key;
|
|
4022
|
+
if (oldKey === currentKey2) {
|
|
4023
|
+
update(newBlocks[i] = oldBlock, currentItem[0]);
|
|
1722
4024
|
} else {
|
|
1723
|
-
queuedBlocks[
|
|
1724
|
-
|
|
1725
|
-
currentItem,
|
|
1726
|
-
currentKey2
|
|
1727
|
-
];
|
|
1728
|
-
previousKeyIndexPairs[previousKeyIndexInsertIndex++] = [
|
|
1729
|
-
previousKey,
|
|
1730
|
-
startOffset
|
|
1731
|
-
];
|
|
4025
|
+
queuedBlocks[queuedBlocksLength++] = [i, currentItem, currentKey2];
|
|
4026
|
+
oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldKey, i];
|
|
1732
4027
|
}
|
|
1733
|
-
startOffset++;
|
|
1734
4028
|
}
|
|
1735
|
-
for (let i =
|
|
1736
|
-
|
|
1737
|
-
oldBlocks[i].key,
|
|
1738
|
-
i
|
|
1739
|
-
];
|
|
4029
|
+
for (let i = e1; i < e2; i++) {
|
|
4030
|
+
oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldBlocks[i].key, i];
|
|
1740
4031
|
}
|
|
1741
|
-
|
|
1742
|
-
newLength - endOffset,
|
|
1743
|
-
sharedBlockCount
|
|
1744
|
-
);
|
|
1745
|
-
for (let i = startOffset; i < preparationBlockCount; i++) {
|
|
4032
|
+
for (let i = e1; i < e3; i++) {
|
|
1746
4033
|
const blockItem = getItem(source, i);
|
|
1747
4034
|
const blockKey = getKey(...blockItem);
|
|
1748
|
-
queuedBlocks[
|
|
4035
|
+
queuedBlocks[queuedBlocksLength++] = [i, blockItem, blockKey];
|
|
1749
4036
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
4037
|
+
queuedBlocks.length = queuedBlocksLength;
|
|
4038
|
+
oldKeyIndexPairs.length = oldKeyIndexPairsLength;
|
|
4039
|
+
const oldKeyIndexMap = new Map(oldKeyIndexPairs);
|
|
4040
|
+
const opers = new Array(queuedBlocks.length);
|
|
4041
|
+
let mountCounter = 0;
|
|
4042
|
+
let opersLength = 0;
|
|
4043
|
+
for (let i = queuedBlocks.length - 1; i >= 0; i--) {
|
|
4044
|
+
const [index, item, key] = queuedBlocks[i];
|
|
4045
|
+
const oldIndex = oldKeyIndexMap.get(key);
|
|
4046
|
+
if (oldIndex !== void 0) {
|
|
4047
|
+
oldKeyIndexMap.delete(key);
|
|
4048
|
+
const reusedBlock = newBlocks[index] = oldBlocks[oldIndex];
|
|
4049
|
+
update(reusedBlock, ...item);
|
|
4050
|
+
opers[opersLength++] = { index, block: reusedBlock };
|
|
4051
|
+
} else {
|
|
4052
|
+
mountCounter++;
|
|
4053
|
+
opers[opersLength++] = { source, index, item, key };
|
|
1755
4054
|
}
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
parent,
|
|
1769
|
-
anchorOffset === -1 ? anchorFallback : normalizeAnchor(newBlocks[anchorOffset].nodes)
|
|
1770
|
-
);
|
|
1771
|
-
previousKeyIndexMap.delete(blockKey);
|
|
1772
|
-
} else {
|
|
1773
|
-
blocksToMount.push([
|
|
1774
|
-
blockIndex,
|
|
1775
|
-
blockItem,
|
|
1776
|
-
blockKey,
|
|
1777
|
-
anchorOffset
|
|
1778
|
-
]);
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
for (let i = queuedBlocks.length - 1; i >= 0; i--) {
|
|
1782
|
-
const [blockIndex, blockItem, blockKey] = queuedBlocks[i];
|
|
1783
|
-
relocateOrMountBlock(
|
|
1784
|
-
blockIndex,
|
|
1785
|
-
blockItem,
|
|
1786
|
-
blockKey,
|
|
1787
|
-
blockIndex < preparationBlockCount - 1 ? blockIndex + 1 : -1
|
|
1788
|
-
);
|
|
4055
|
+
}
|
|
4056
|
+
const useFastRemove = mountCounter === newLength;
|
|
4057
|
+
for (const leftoverIndex of oldKeyIndexMap.values()) {
|
|
4058
|
+
unmount(
|
|
4059
|
+
oldBlocks[leftoverIndex],
|
|
4060
|
+
!(useFastRemove && canUseFastRemove),
|
|
4061
|
+
!useFastRemove
|
|
4062
|
+
);
|
|
4063
|
+
}
|
|
4064
|
+
if (useFastRemove) {
|
|
4065
|
+
for (const selector of selectors) {
|
|
4066
|
+
selector.cleanup();
|
|
1789
4067
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
relocateOrMountBlock(i, blockItem, blockKey, -1);
|
|
4068
|
+
if (canUseFastRemove) {
|
|
4069
|
+
parent.textContent = "";
|
|
4070
|
+
parent.appendChild(parentAnchor);
|
|
1794
4071
|
}
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
4072
|
+
}
|
|
4073
|
+
if (opers.length === mountCounter) {
|
|
4074
|
+
for (const { source: source2, index, item, key } of opers) {
|
|
4075
|
+
mount(
|
|
4076
|
+
source2,
|
|
4077
|
+
index,
|
|
4078
|
+
index < newLength - 1 ? normalizeAnchor(newBlocks[index + 1].nodes) : parentAnchor,
|
|
4079
|
+
item,
|
|
4080
|
+
key
|
|
1801
4081
|
);
|
|
1802
4082
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
4083
|
+
} else if (opers.length) {
|
|
4084
|
+
let anchor = oldBlocks[0];
|
|
4085
|
+
let blocksTail;
|
|
4086
|
+
for (let i = 0; i < oldLength; i++) {
|
|
4087
|
+
const block = oldBlocks[i];
|
|
4088
|
+
if (oldKeyIndexMap.has(block.key)) {
|
|
4089
|
+
continue;
|
|
1806
4090
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
4091
|
+
block.prevAnchor = anchor;
|
|
4092
|
+
anchor = oldBlocks[i + 1];
|
|
4093
|
+
if (blocksTail !== void 0) {
|
|
4094
|
+
blocksTail.next = block;
|
|
4095
|
+
block.prev = blocksTail;
|
|
1810
4096
|
}
|
|
4097
|
+
blocksTail = block;
|
|
1811
4098
|
}
|
|
1812
|
-
for (const
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
source
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
4099
|
+
for (const action of opers) {
|
|
4100
|
+
const { index } = action;
|
|
4101
|
+
if (index < newLength - 1) {
|
|
4102
|
+
const nextBlock = newBlocks[index + 1];
|
|
4103
|
+
let anchorNode = normalizeAnchor(nextBlock.prevAnchor.nodes);
|
|
4104
|
+
if (!anchorNode.parentNode)
|
|
4105
|
+
anchorNode = normalizeAnchor(nextBlock.nodes);
|
|
4106
|
+
if ("source" in action) {
|
|
4107
|
+
const { item, key } = action;
|
|
4108
|
+
const block = mount(source, index, anchorNode, item, key);
|
|
4109
|
+
moveLink(block, nextBlock.prev, nextBlock);
|
|
4110
|
+
} else if (action.block.next !== nextBlock) {
|
|
4111
|
+
insert(action.block, parent, anchorNode);
|
|
4112
|
+
moveLink(action.block, nextBlock.prev, nextBlock);
|
|
4113
|
+
}
|
|
4114
|
+
} else if ("source" in action) {
|
|
4115
|
+
const { item, key } = action;
|
|
4116
|
+
const block = mount(source, index, parentAnchor, item, key);
|
|
4117
|
+
moveLink(block, blocksTail);
|
|
4118
|
+
blocksTail = block;
|
|
4119
|
+
} else if (action.block.next !== void 0) {
|
|
4120
|
+
let anchorNode = anchor ? normalizeAnchor(anchor.nodes) : parentAnchor;
|
|
4121
|
+
if (!anchorNode.parentNode) anchorNode = parentAnchor;
|
|
4122
|
+
insert(action.block, parent, anchorNode);
|
|
4123
|
+
moveLink(action.block, blocksTail);
|
|
4124
|
+
blocksTail = action.block;
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
for (const block of newBlocks) {
|
|
4128
|
+
block.prevAnchor = block.next = block.prev = void 0;
|
|
1825
4129
|
}
|
|
1826
4130
|
}
|
|
1827
4131
|
}
|
|
1828
4132
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
frag.nodes.push(parentAnchor);
|
|
4133
|
+
if (!isFallback) {
|
|
4134
|
+
frag.nodes = [oldBlocks = newBlocks];
|
|
4135
|
+
if (parentAnchor) frag.nodes.push(parentAnchor);
|
|
4136
|
+
} else {
|
|
4137
|
+
oldBlocks = [];
|
|
1832
4138
|
}
|
|
1833
4139
|
setActiveSub(prevSub);
|
|
1834
4140
|
};
|
|
@@ -1857,6 +4163,9 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1857
4163
|
indexRef,
|
|
1858
4164
|
key2
|
|
1859
4165
|
);
|
|
4166
|
+
if (frag.$transition) {
|
|
4167
|
+
applyTransitionHooks(block.nodes, frag.$transition, false);
|
|
4168
|
+
}
|
|
1860
4169
|
if (parent) insert(block.nodes, parent, anchor);
|
|
1861
4170
|
return block;
|
|
1862
4171
|
};
|
|
@@ -1892,15 +4201,17 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1892
4201
|
} else {
|
|
1893
4202
|
renderEffect(renderList);
|
|
1894
4203
|
}
|
|
1895
|
-
if (!isHydrating
|
|
1896
|
-
insert(frag, _insertionParent, _insertionAnchor);
|
|
4204
|
+
if (!isHydrating) {
|
|
4205
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4206
|
+
} else {
|
|
4207
|
+
advanceHydrationNode(_isLastInsertion ? _insertionParent : parentAnchor);
|
|
1897
4208
|
}
|
|
1898
4209
|
return frag;
|
|
1899
4210
|
function createSelector(source) {
|
|
1900
4211
|
let operMap = /* @__PURE__ */ new Map();
|
|
1901
4212
|
let activeKey = source();
|
|
1902
4213
|
let activeOpers;
|
|
1903
|
-
watch(source, (newValue) => {
|
|
4214
|
+
watch$1(source, (newValue) => {
|
|
1904
4215
|
if (activeOpers !== void 0) {
|
|
1905
4216
|
for (const oper of activeOpers) {
|
|
1906
4217
|
oper();
|
|
@@ -1940,6 +4251,21 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
1940
4251
|
}
|
|
1941
4252
|
}
|
|
1942
4253
|
};
|
|
4254
|
+
function moveLink(block, newPrev, newNext) {
|
|
4255
|
+
const { prev: oldPrev, next: oldNext } = block;
|
|
4256
|
+
if (oldPrev) oldPrev.next = oldNext;
|
|
4257
|
+
if (oldNext) {
|
|
4258
|
+
oldNext.prev = oldPrev;
|
|
4259
|
+
if (block.prevAnchor !== block) {
|
|
4260
|
+
oldNext.prevAnchor = block.prevAnchor;
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
if (newPrev) newPrev.next = block;
|
|
4264
|
+
if (newNext) newNext.prev = block;
|
|
4265
|
+
block.prev = newPrev;
|
|
4266
|
+
block.next = newNext;
|
|
4267
|
+
block.prevAnchor = block;
|
|
4268
|
+
}
|
|
1943
4269
|
function createForSlots(rawSource, getSlot) {
|
|
1944
4270
|
const source = normalizeSource(rawSource);
|
|
1945
4271
|
const sourceLength = source.values.length;
|
|
@@ -2015,16 +4341,34 @@ function getRestElement(val, keys) {
|
|
|
2015
4341
|
function getDefaultValue(val, defaultVal) {
|
|
2016
4342
|
return val === void 0 ? defaultVal : val;
|
|
2017
4343
|
}
|
|
4344
|
+
function isForBlock(block) {
|
|
4345
|
+
return block instanceof ForBlock;
|
|
4346
|
+
}
|
|
2018
4347
|
|
|
2019
4348
|
function createTemplateRefSetter() {
|
|
2020
4349
|
const instance = currentInstance;
|
|
2021
4350
|
return (...args) => setRef(instance, ...args);
|
|
2022
4351
|
}
|
|
2023
|
-
function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
4352
|
+
function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
2024
4353
|
if (!instance || instance.isUnmounted) return;
|
|
4354
|
+
if (isFragment(el) && el.setRef) {
|
|
4355
|
+
el.setRef(instance, ref, refFor, refKey);
|
|
4356
|
+
return;
|
|
4357
|
+
}
|
|
4358
|
+
const isVaporComp = isVaporComponent(el);
|
|
4359
|
+
if (isVaporComp && isAsyncWrapper(el)) {
|
|
4360
|
+
const i = el;
|
|
4361
|
+
const frag = i.block;
|
|
4362
|
+
if (!i.type.__asyncResolved) {
|
|
4363
|
+
frag.setRef = (i2) => setRef(instance, i2, ref, oldRef, refFor);
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
el = frag.nodes;
|
|
4367
|
+
}
|
|
2025
4368
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
2026
4369
|
const refValue = getRefValue(el);
|
|
2027
4370
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
4371
|
+
const canSetSetupRef = createCanSetSetupRefChecker(setupState);
|
|
2028
4372
|
if (oldRef != null && oldRef !== ref) {
|
|
2029
4373
|
if (isString(oldRef)) {
|
|
2030
4374
|
refs[oldRef] = null;
|
|
@@ -2051,28 +4395,30 @@ function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
|
2051
4395
|
if (_isString || _isRef) {
|
|
2052
4396
|
const doSet = () => {
|
|
2053
4397
|
if (refFor) {
|
|
2054
|
-
existing = _isString ? !!(process.env.NODE_ENV !== "production") &&
|
|
4398
|
+
existing = _isString ? !!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
2055
4399
|
if (!isArray(existing)) {
|
|
2056
4400
|
existing = [refValue];
|
|
2057
4401
|
if (_isString) {
|
|
2058
4402
|
refs[ref] = existing;
|
|
2059
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4403
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2060
4404
|
setupState[ref] = refs[ref];
|
|
2061
4405
|
existing = setupState[ref];
|
|
2062
4406
|
}
|
|
2063
4407
|
} else {
|
|
2064
4408
|
ref.value = existing;
|
|
4409
|
+
if (refKey) refs[refKey] = existing;
|
|
2065
4410
|
}
|
|
2066
4411
|
} else if (!existing.includes(refValue)) {
|
|
2067
4412
|
existing.push(refValue);
|
|
2068
4413
|
}
|
|
2069
4414
|
} else if (_isString) {
|
|
2070
4415
|
refs[ref] = refValue;
|
|
2071
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4416
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2072
4417
|
setupState[ref] = refValue;
|
|
2073
4418
|
}
|
|
2074
4419
|
} else if (_isRef) {
|
|
2075
4420
|
ref.value = refValue;
|
|
4421
|
+
if (refKey) refs[refKey] = refValue;
|
|
2076
4422
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2077
4423
|
warn("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
2078
4424
|
}
|
|
@@ -2084,11 +4430,12 @@ function setRef(instance, el, ref, oldRef, refFor = false) {
|
|
|
2084
4430
|
remove$1(existing, refValue);
|
|
2085
4431
|
} else if (_isString) {
|
|
2086
4432
|
refs[ref] = null;
|
|
2087
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4433
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(ref)) {
|
|
2088
4434
|
setupState[ref] = null;
|
|
2089
4435
|
}
|
|
2090
4436
|
} else if (_isRef) {
|
|
2091
4437
|
ref.value = null;
|
|
4438
|
+
if (refKey) refs[refKey] = null;
|
|
2092
4439
|
}
|
|
2093
4440
|
});
|
|
2094
4441
|
});
|
|
@@ -2107,29 +4454,35 @@ const getRefValue = (el) => {
|
|
|
2107
4454
|
return el;
|
|
2108
4455
|
};
|
|
2109
4456
|
|
|
2110
|
-
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot) {
|
|
4457
|
+
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once) {
|
|
2111
4458
|
const _insertionParent = insertionParent;
|
|
2112
4459
|
const _insertionAnchor = insertionAnchor;
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
}
|
|
2118
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
2119
|
-
renderEffect(() => {
|
|
4460
|
+
const _isLastInsertion = isLastInsertion;
|
|
4461
|
+
if (!isHydrating) resetInsertionState();
|
|
4462
|
+
const frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
4463
|
+
const renderFn = () => {
|
|
2120
4464
|
const value = getter();
|
|
4465
|
+
const appContext = currentInstance && currentInstance.appContext || emptyContext;
|
|
2121
4466
|
frag.update(
|
|
2122
4467
|
() => createComponentWithFallback(
|
|
2123
4468
|
resolveDynamicComponent(value),
|
|
2124
4469
|
rawProps,
|
|
2125
4470
|
rawSlots,
|
|
2126
|
-
isSingleRoot
|
|
4471
|
+
isSingleRoot,
|
|
4472
|
+
once,
|
|
4473
|
+
appContext
|
|
2127
4474
|
),
|
|
2128
4475
|
value
|
|
2129
4476
|
);
|
|
2130
|
-
}
|
|
2131
|
-
if (
|
|
2132
|
-
|
|
4477
|
+
};
|
|
4478
|
+
if (once) renderFn();
|
|
4479
|
+
else renderEffect(renderFn);
|
|
4480
|
+
if (!isHydrating) {
|
|
4481
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
4482
|
+
} else {
|
|
4483
|
+
if (_isLastInsertion) {
|
|
4484
|
+
advanceHydrationNode(_insertionParent);
|
|
4485
|
+
}
|
|
2133
4486
|
}
|
|
2134
4487
|
return frag;
|
|
2135
4488
|
}
|
|
@@ -2147,6 +4500,12 @@ function applyVShow(target, source) {
|
|
|
2147
4500
|
update.call(target, render, key);
|
|
2148
4501
|
setDisplay(target, source());
|
|
2149
4502
|
};
|
|
4503
|
+
} else if (target instanceof VaporFragment && target.insert) {
|
|
4504
|
+
const insert = target.insert;
|
|
4505
|
+
target.insert = (parent, anchor) => {
|
|
4506
|
+
insert.call(target, parent, anchor);
|
|
4507
|
+
setDisplay(target, source());
|
|
4508
|
+
};
|
|
2150
4509
|
}
|
|
2151
4510
|
renderEffect(() => setDisplay(target, source()));
|
|
2152
4511
|
}
|
|
@@ -2154,18 +4513,54 @@ function setDisplay(target, value) {
|
|
|
2154
4513
|
if (isVaporComponent(target)) {
|
|
2155
4514
|
return setDisplay(target, value);
|
|
2156
4515
|
}
|
|
2157
|
-
if (isArray(target)
|
|
2158
|
-
|
|
4516
|
+
if (isArray(target)) {
|
|
4517
|
+
if (target.length === 0) return;
|
|
4518
|
+
if (target.length === 1) return setDisplay(target[0], value);
|
|
2159
4519
|
}
|
|
2160
4520
|
if (target instanceof DynamicFragment) {
|
|
2161
4521
|
return setDisplay(target.nodes, value);
|
|
2162
4522
|
}
|
|
4523
|
+
if (target instanceof VaporFragment && target.insert) {
|
|
4524
|
+
return setDisplay(target.nodes, value);
|
|
4525
|
+
}
|
|
4526
|
+
const { $transition } = target;
|
|
2163
4527
|
if (target instanceof Element) {
|
|
2164
4528
|
const el = target;
|
|
2165
4529
|
if (!(vShowOriginalDisplay in el)) {
|
|
2166
4530
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
2167
4531
|
}
|
|
2168
|
-
|
|
4532
|
+
if ($transition) {
|
|
4533
|
+
if (value) {
|
|
4534
|
+
$transition.beforeEnter(target);
|
|
4535
|
+
el.style.display = el[vShowOriginalDisplay];
|
|
4536
|
+
$transition.enter(target);
|
|
4537
|
+
} else {
|
|
4538
|
+
if (target.isConnected) {
|
|
4539
|
+
$transition.leave(target, () => {
|
|
4540
|
+
el.style.display = "none";
|
|
4541
|
+
});
|
|
4542
|
+
} else {
|
|
4543
|
+
el.style.display = "none";
|
|
4544
|
+
}
|
|
4545
|
+
}
|
|
4546
|
+
} else {
|
|
4547
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating) {
|
|
4548
|
+
if (!value && el.style.display !== "none") {
|
|
4549
|
+
warnPropMismatch(
|
|
4550
|
+
el,
|
|
4551
|
+
"style",
|
|
4552
|
+
3,
|
|
4553
|
+
`display: ${el.style.display}`,
|
|
4554
|
+
"display: none"
|
|
4555
|
+
);
|
|
4556
|
+
logMismatchError();
|
|
4557
|
+
el.style.display = "none";
|
|
4558
|
+
el[vShowOriginalDisplay] = "";
|
|
4559
|
+
}
|
|
4560
|
+
} else {
|
|
4561
|
+
el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
2169
4564
|
el[vShowHidden] = !value;
|
|
2170
4565
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2171
4566
|
warn(
|
|
@@ -2244,4 +4639,4 @@ function withVaporDirectives(node, dirs) {
|
|
|
2244
4639
|
}
|
|
2245
4640
|
}
|
|
2246
4641
|
|
|
2247
|
-
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 };
|
|
4642
|
+
export { VaporFragment, VaporKeepAliveImpl as VaporKeepAlive, VaporTeleportImpl as VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockText, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
|