@vue/runtime-vapor 3.6.0-beta.7 → 3.6.0-beta.8
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 +8 -14
- package/dist/runtime-vapor.esm-bundler.js +315 -278
- package/package.json +4 -4
package/dist/runtime-vapor.d.ts
CHANGED
|
@@ -115,9 +115,9 @@ export declare class DynamicFragment extends VaporFragment {
|
|
|
115
115
|
attrs?: Record<string, any>;
|
|
116
116
|
keepAliveCtx: VaporKeepAliveContext | null;
|
|
117
117
|
slotOwner: VaporComponentInstance | null;
|
|
118
|
-
constructor(anchorLabel?: string, keyed?: boolean);
|
|
118
|
+
constructor(anchorLabel?: string, keyed?: boolean, locate?: boolean);
|
|
119
119
|
update(render?: BlockFn, key?: any): void;
|
|
120
|
-
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null
|
|
120
|
+
renderBranch(render: BlockFn | undefined, transition: VaporTransitionHooks | undefined, parent: ParentNode | null): void;
|
|
121
121
|
hydrate: (isEmpty?: boolean) => void;
|
|
122
122
|
}
|
|
123
123
|
export declare function isFragment(val: NonNullable<unknown>): val is VaporFragment;
|
|
@@ -128,6 +128,7 @@ export interface VaporTransitionHooks extends TransitionHooks {
|
|
|
128
128
|
props: TransitionProps;
|
|
129
129
|
instance: VaporComponentInstance;
|
|
130
130
|
disabled?: boolean;
|
|
131
|
+
applyGroup?: (block: Block, hooks: VaporTransitionHooks) => void;
|
|
131
132
|
}
|
|
132
133
|
interface TransitionOptions {
|
|
133
134
|
$key?: any;
|
|
@@ -411,17 +412,10 @@ export declare function template(html: string, root?: boolean, ns?: Namespace):
|
|
|
411
412
|
//#endregion
|
|
412
413
|
//#region temp/packages/runtime-vapor/src/dom/node.d.ts
|
|
413
414
|
export declare function createTextNode(value?: string): Text;
|
|
414
|
-
declare
|
|
415
|
-
declare function
|
|
416
|
-
declare function
|
|
417
|
-
declare function
|
|
418
|
-
type DelegatedFunction<T extends (...args: any[]) => any> = T & {
|
|
419
|
-
impl: T;
|
|
420
|
-
};
|
|
421
|
-
export declare const txt: DelegatedFunction<typeof _txt>;
|
|
422
|
-
export declare const child: DelegatedFunction<typeof _child>;
|
|
423
|
-
export declare const next: DelegatedFunction<typeof _next>;
|
|
424
|
-
export declare const nthChild: DelegatedFunction<typeof _nthChild>;
|
|
415
|
+
export declare function txt(node: ParentNode): Node;
|
|
416
|
+
export declare function child(node: InsertionParent, logicalIndex?: number): Node;
|
|
417
|
+
export declare function nthChild(node: InsertionParent, i: number): Node;
|
|
418
|
+
export declare function next(node: Node, logicalIndex?: number): Node;
|
|
425
419
|
//#endregion
|
|
426
420
|
//#region temp/packages/runtime-vapor/src/dom/prop.d.ts
|
|
427
421
|
type TargetElement = Element & {
|
|
@@ -471,7 +465,7 @@ export declare function setDynamicEvents(el: HTMLElement, events: Record<string,
|
|
|
471
465
|
export declare function createInvoker(handler: (...args: any[]) => any): (...args: any[]) => any;
|
|
472
466
|
//#endregion
|
|
473
467
|
//#region temp/packages/runtime-vapor/src/apiCreateIf.d.ts
|
|
474
|
-
export declare function createIf(condition: () => any, b1: BlockFn, b2?: BlockFn, once?: boolean, index?: number): Block;
|
|
468
|
+
export declare function createIf(condition: () => any, b1: BlockFn, b2?: BlockFn, blockShape?: number, once?: boolean, index?: number): Block;
|
|
475
469
|
//#endregion
|
|
476
470
|
//#region temp/packages/runtime-vapor/src/apiCreateFragment.d.ts
|
|
477
471
|
/**
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.8
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { EffectScope, NULL_DYNAMIC_COMPONENT, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, xlinkNS } from "@vue/runtime-dom";
|
|
6
|
+
import { EffectScope, Fragment, NULL_DYNAMIC_COMPONENT, Static, TransitionPropsValidators, VueElementBase, activate, baseApplyTranslation, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, baseUseCssVars, callPendingCbs, callWithAsyncErrorHandling, callWithErrorHandling, checkTransitionMode, createAppAPI, createAsyncComponentContext, createCanSetSetupRefChecker, createInternalObject, createVNode, currentInstance, currentInstance as currentInstance$1, deactivate, devtoolsComponentAdded, endMeasure, ensureHydrationRenderer, ensureRenderer, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, shouldSetAsPropForVueCE, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, xlinkNS } from "@vue/runtime-dom";
|
|
7
7
|
import { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, camelize, canSetValueDirectly, extend, getEscapedCssVarName, getGlobalThis, hasOwn, includeBooleanAttr, invokeArrayFns, isArray, isFunction, isObject, isOn, isPlainObject, isPromise, isReservedProp, isString, looseEqual, normalizeClass, normalizeCssVarValue, normalizeStyle, parseStringStyle, remove as remove$1, stringifyStyle, toDisplayString } from "@vue/shared";
|
|
8
8
|
import { EffectScope as EffectScope$1, ReactiveEffect, computed, isReactive, isReadonly, isRef as isRef$1, isShallow, markRaw, onEffectCleanup, onScopeDispose as onScopeDispose$1, pauseTracking, proxyRefs, resetTracking, setActiveSub, shallowReadArray, shallowRef as shallowRef$1, toRaw, toReactive, toReadonly, traverse, unref, watch as watch$1 } from "@vue/reactivity";
|
|
9
|
-
|
|
10
9
|
//#region packages/runtime-vapor/src/insertionState.ts
|
|
11
10
|
let insertionParent;
|
|
12
11
|
let insertionAnchor;
|
|
@@ -31,7 +30,6 @@ function setInsertionState(parent, anchor, logicalIndex, last) {
|
|
|
31
30
|
function resetInsertionState() {
|
|
32
31
|
insertionParent = insertionAnchor = insertionIndex = isLastInsertion = void 0;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
33
|
//#endregion
|
|
36
34
|
//#region packages/runtime-vapor/src/dom/hydration.ts
|
|
37
35
|
let isHydratingEnabled = false;
|
|
@@ -41,7 +39,7 @@ function setIsHydratingEnabled(value) {
|
|
|
41
39
|
let currentHydrationNode = null;
|
|
42
40
|
let isHydrating$1 = false;
|
|
43
41
|
function setIsHydrating(value) {
|
|
44
|
-
if (!isHydratingEnabled) return false;
|
|
42
|
+
if (!isHydratingEnabled && !isHydrating) return false;
|
|
45
43
|
try {
|
|
46
44
|
return isHydrating$1;
|
|
47
45
|
} finally {
|
|
@@ -66,15 +64,17 @@ function performHydration(fn, setup, cleanup) {
|
|
|
66
64
|
Node.prototype.$llc = void 0;
|
|
67
65
|
isOptimized$1 = true;
|
|
68
66
|
}
|
|
69
|
-
enableHydrationNodeLookup();
|
|
70
67
|
const prev = setIsHydrating(true);
|
|
71
|
-
|
|
72
|
-
const res = fn();
|
|
73
|
-
cleanup();
|
|
68
|
+
const prevHydrationNode = currentHydrationNode;
|
|
74
69
|
currentHydrationNode = null;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
try {
|
|
71
|
+
setup();
|
|
72
|
+
return fn();
|
|
73
|
+
} finally {
|
|
74
|
+
cleanup();
|
|
75
|
+
currentHydrationNode = prevHydrationNode;
|
|
76
|
+
setIsHydrating(prev);
|
|
77
|
+
}
|
|
78
78
|
}
|
|
79
79
|
function withHydration(container, fn) {
|
|
80
80
|
const setup = () => setInsertionState(container);
|
|
@@ -95,10 +95,10 @@ function setCurrentHydrationNode(node) {
|
|
|
95
95
|
/* @__NO_SIDE_EFFECTS__ */
|
|
96
96
|
function locateNextSiblingOfParent(n) {
|
|
97
97
|
if (!n.parentNode) return null;
|
|
98
|
-
return n.parentNode
|
|
98
|
+
return /* @__PURE__ */ _next(n.parentNode) || /* @__PURE__ */ locateNextSiblingOfParent(n.parentNode);
|
|
99
99
|
}
|
|
100
100
|
function advanceHydrationNode(node) {
|
|
101
|
-
const ret = node
|
|
101
|
+
const ret = /* @__PURE__ */ _next(node) || /* @__PURE__ */ locateNextSiblingOfParent(node);
|
|
102
102
|
if (ret) setCurrentHydrationNode(ret);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -106,26 +106,24 @@ function advanceHydrationNode(node) {
|
|
|
106
106
|
* while handling potential fragments.
|
|
107
107
|
*/
|
|
108
108
|
function adoptTemplateImpl(node, template) {
|
|
109
|
-
if (!(template[0] === "<" && template[1] === "!"))
|
|
110
|
-
node
|
|
111
|
-
|
|
112
|
-
node.before(node = /* @__PURE__ */ createTextNode());
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
109
|
+
if (!(template[0] === "<" && template[1] === "!")) {
|
|
110
|
+
if (template.trim() === "" && isComment(node, "]") && isComment(node.previousSibling, "[")) node.before(node = /* @__PURE__ */ createTextNode());
|
|
111
|
+
while (node.nodeType === 8) node = node.nextSibling;
|
|
115
112
|
}
|
|
116
113
|
const type = node.nodeType;
|
|
117
114
|
if (type === 8 && !template.startsWith("<!") || type === 1 && !template.startsWith(`<` + node.tagName.toLowerCase())) node = handleMismatch(node, template);
|
|
118
|
-
|
|
115
|
+
advanceHydrationNode(node);
|
|
119
116
|
return node;
|
|
120
117
|
}
|
|
121
118
|
function locateNextNode(node) {
|
|
122
119
|
return isComment(node, "[") ? /* @__PURE__ */ _next(locateEndAnchor(node)) : isComment(node, "teleport start") ? /* @__PURE__ */ _next(locateEndAnchor(node, "teleport start", "teleport end")) : /* @__PURE__ */ _next(node);
|
|
123
120
|
}
|
|
124
|
-
function locateHydrationNodeImpl() {
|
|
121
|
+
function locateHydrationNodeImpl(consumeFragmentStart = false) {
|
|
125
122
|
let node;
|
|
126
123
|
if (insertionIndex !== void 0) node = locateChildByLogicalIndex(insertionParent, insertionIndex);
|
|
127
124
|
else if (insertionParent) node = insertionParent.firstChild;
|
|
128
125
|
else node = currentHydrationNode;
|
|
126
|
+
if (consumeFragmentStart && node && isComment(node, "[")) node = node.nextSibling;
|
|
129
127
|
if (!!(process.env.NODE_ENV !== "production") && !node) throw new Error("No current hydration node was found.\nthis is likely a Vue internal bug.");
|
|
130
128
|
resetInsertionState();
|
|
131
129
|
currentHydrationNode = node;
|
|
@@ -133,7 +131,7 @@ function locateHydrationNodeImpl() {
|
|
|
133
131
|
function locateEndAnchor(node, open = "[", close = "]") {
|
|
134
132
|
if (node.$fe) return node.$fe;
|
|
135
133
|
const stack = [node];
|
|
136
|
-
while ((node = node
|
|
134
|
+
while ((node = /* @__PURE__ */ _next(node)) && stack.length > 0) if (node.nodeType === 8) {
|
|
137
135
|
if (node.data === open) stack.push(node);
|
|
138
136
|
else if (node.data === close) {
|
|
139
137
|
const matchingOpen = stack.pop();
|
|
@@ -143,14 +141,6 @@ function locateEndAnchor(node, open = "[", close = "]") {
|
|
|
143
141
|
}
|
|
144
142
|
return null;
|
|
145
143
|
}
|
|
146
|
-
function locateFragmentEndAnchor(label = "]") {
|
|
147
|
-
let node = currentHydrationNode;
|
|
148
|
-
while (node) {
|
|
149
|
-
if (isComment(node, label)) return node;
|
|
150
|
-
node = node.nextSibling;
|
|
151
|
-
}
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
144
|
function handleMismatch(node, template) {
|
|
155
145
|
if (!isMismatchAllowed(node.parentElement, 1)) {
|
|
156
146
|
(process.env.NODE_ENV !== "production" || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node, "[[") ? `(start of block node)` : ``, `\n- expected on client:`, template);
|
|
@@ -185,7 +175,6 @@ function removeFragmentNodes(node, endAnchor) {
|
|
|
185
175
|
else break;
|
|
186
176
|
}
|
|
187
177
|
}
|
|
188
|
-
|
|
189
178
|
//#endregion
|
|
190
179
|
//#region packages/runtime-vapor/src/dom/node.ts
|
|
191
180
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -208,83 +197,37 @@ function querySelector(selectors) {
|
|
|
208
197
|
function parentNode(node) {
|
|
209
198
|
return node.parentNode;
|
|
210
199
|
}
|
|
211
|
-
const _txt = _child;
|
|
212
|
-
/**
|
|
213
|
-
* Hydration-specific version of `txt`.
|
|
214
|
-
*/
|
|
215
|
-
const __txt = /* @__NO_SIDE_EFFECTS__ */ (node) => {
|
|
216
|
-
let n = node.firstChild;
|
|
217
|
-
if (!n) return node.appendChild(/* @__PURE__ */ createTextNode());
|
|
218
|
-
return n;
|
|
219
|
-
};
|
|
220
200
|
/* @__NO_SIDE_EFFECTS__ */
|
|
221
|
-
function
|
|
222
|
-
|
|
201
|
+
function txt(node) {
|
|
202
|
+
if (isHydrating$1) {
|
|
203
|
+
let n = /* @__PURE__ */ _child(node);
|
|
204
|
+
if (!n) return node.appendChild(/* @__PURE__ */ createTextNode());
|
|
205
|
+
return n;
|
|
206
|
+
}
|
|
207
|
+
return /* @__PURE__ */ _child(node);
|
|
223
208
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Hydration-specific version of `child`.
|
|
226
|
-
*/
|
|
227
209
|
/* @__NO_SIDE_EFFECTS__ */
|
|
228
|
-
function
|
|
229
|
-
return locateChildByLogicalIndex(node, logicalIndex);
|
|
210
|
+
function child(node, logicalIndex) {
|
|
211
|
+
if (isHydrating$1) return locateChildByLogicalIndex(node, logicalIndex !== null && logicalIndex !== void 0 ? logicalIndex : 0);
|
|
212
|
+
return /* @__PURE__ */ _child(node);
|
|
230
213
|
}
|
|
231
214
|
/* @__NO_SIDE_EFFECTS__ */
|
|
232
|
-
function
|
|
215
|
+
function nthChild(node, i) {
|
|
216
|
+
if (isHydrating$1) return locateChildByLogicalIndex(node, i);
|
|
233
217
|
return node.childNodes[i];
|
|
234
218
|
}
|
|
235
|
-
/**
|
|
236
|
-
* Hydration-specific version of `nthChild`.
|
|
237
|
-
*/
|
|
238
219
|
/* @__NO_SIDE_EFFECTS__ */
|
|
239
|
-
function
|
|
240
|
-
return locateChildByLogicalIndex(node, logicalIndex);
|
|
220
|
+
function next(node, logicalIndex) {
|
|
221
|
+
if (isHydrating$1) return locateChildByLogicalIndex(node.parentNode, logicalIndex);
|
|
222
|
+
return /* @__PURE__ */ _next(node);
|
|
241
223
|
}
|
|
242
224
|
/* @__NO_SIDE_EFFECTS__ */
|
|
243
|
-
function
|
|
244
|
-
return node.
|
|
225
|
+
function _child(node) {
|
|
226
|
+
return node.firstChild;
|
|
245
227
|
}
|
|
246
|
-
/**
|
|
247
|
-
* Hydration-specific version of `next`.
|
|
248
|
-
*/
|
|
249
228
|
/* @__NO_SIDE_EFFECTS__ */
|
|
250
|
-
function
|
|
251
|
-
return
|
|
252
|
-
}
|
|
253
|
-
const txt = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
254
|
-
return txt.impl(...args);
|
|
255
|
-
};
|
|
256
|
-
txt.impl = _txt;
|
|
257
|
-
const child = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
258
|
-
return child.impl(...args);
|
|
259
|
-
};
|
|
260
|
-
child.impl = _child;
|
|
261
|
-
const next = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
262
|
-
return next.impl(...args);
|
|
263
|
-
};
|
|
264
|
-
next.impl = _next;
|
|
265
|
-
const nthChild = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
266
|
-
return nthChild.impl(...args);
|
|
267
|
-
};
|
|
268
|
-
nthChild.impl = _nthChild;
|
|
269
|
-
/**
|
|
270
|
-
* Enables hydration-specific node lookup behavior.
|
|
271
|
-
*
|
|
272
|
-
* Temporarily switches the implementations of the exported
|
|
273
|
-
* `txt`, `child`, `next`, and `nthChild` functions to their hydration-specific
|
|
274
|
-
* versions (`__txt`, `__child`, `__next`, `__nthChild`). This allows traversal
|
|
275
|
-
* logic to correctly handle SSR comment anchors during hydration.
|
|
276
|
-
*/
|
|
277
|
-
function enableHydrationNodeLookup() {
|
|
278
|
-
txt.impl = __txt;
|
|
279
|
-
child.impl = __child;
|
|
280
|
-
next.impl = __next;
|
|
281
|
-
nthChild.impl = __nthChild;
|
|
282
|
-
}
|
|
283
|
-
function disableHydrationNodeLookup() {
|
|
284
|
-
txt.impl = _txt;
|
|
285
|
-
child.impl = _child;
|
|
286
|
-
next.impl = _next;
|
|
287
|
-
nthChild.impl = _nthChild;
|
|
229
|
+
function _next(node) {
|
|
230
|
+
return node.nextSibling;
|
|
288
231
|
}
|
|
289
232
|
function locateChildByLogicalIndex(parent, logicalIndex) {
|
|
290
233
|
let child = parent.$llc || parent.firstChild;
|
|
@@ -303,7 +246,6 @@ function locateChildByLogicalIndex(parent, logicalIndex) {
|
|
|
303
246
|
}
|
|
304
247
|
return null;
|
|
305
248
|
}
|
|
306
|
-
|
|
307
249
|
//#endregion
|
|
308
250
|
//#region packages/runtime-vapor/src/dom/event.ts
|
|
309
251
|
function addEventListener(el, event, handler, options) {
|
|
@@ -370,7 +312,6 @@ function createInvoker(handler) {
|
|
|
370
312
|
const i = currentInstance;
|
|
371
313
|
return (...args) => callWithAsyncErrorHandling(handler, i, 5, args);
|
|
372
314
|
}
|
|
373
|
-
|
|
374
315
|
//#endregion
|
|
375
316
|
//#region packages/runtime-vapor/src/dom/prop.ts
|
|
376
317
|
const hasFallthroughKey = (key) => currentInstance.hasFallthrough && key in currentInstance.attrs;
|
|
@@ -600,7 +541,7 @@ function setDynamicProp(el, key, value, isSVG = false) {
|
|
|
600
541
|
else if (key === "textContent") setElementText(el, value);
|
|
601
542
|
else if (key === "value" && canSetValueDirectly(el.tagName)) setValue(el, value, forceHydrate);
|
|
602
543
|
else setDOMProp(el, key, value, forceHydrate);
|
|
603
|
-
else if (el._isVueCE && (/[A-Z]/.test(key) || !isString(value))) setDOMProp(el, camelize(key), value, forceHydrate, key);
|
|
544
|
+
else if (el._isVueCE && (shouldSetAsPropForVueCE(el, key) || el._def.__asyncLoader && (/[A-Z]/.test(key) || !isString(value)))) setDOMProp(el, camelize(key), value, forceHydrate, key);
|
|
604
545
|
else setAttr(el, key, value, isSVG);
|
|
605
546
|
return value;
|
|
606
547
|
}
|
|
@@ -686,7 +627,20 @@ function shouldForceHydrate(el, key) {
|
|
|
686
627
|
const { tagName } = el;
|
|
687
628
|
return (tagName === "INPUT" || tagName === "OPTION") && (key.endsWith("value") || key === "indeterminate") || tagName.includes("-");
|
|
688
629
|
}
|
|
689
|
-
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region packages/runtime-vapor/src/transition.ts
|
|
632
|
+
let _applyTransitionHooks;
|
|
633
|
+
let _applyTransitionLeaveHooks;
|
|
634
|
+
function registerTransitionHooks(applyHooks, applyLeaveHooks) {
|
|
635
|
+
_applyTransitionHooks = applyHooks;
|
|
636
|
+
_applyTransitionLeaveHooks = applyLeaveHooks;
|
|
637
|
+
}
|
|
638
|
+
function applyTransitionHooks(block, hooks) {
|
|
639
|
+
return _applyTransitionHooks ? _applyTransitionHooks(block, hooks) : hooks;
|
|
640
|
+
}
|
|
641
|
+
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
642
|
+
_applyTransitionLeaveHooks && _applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb);
|
|
643
|
+
}
|
|
690
644
|
//#endregion
|
|
691
645
|
//#region packages/runtime-vapor/src/components/Transition.ts
|
|
692
646
|
const displayName = "VaporTransition";
|
|
@@ -775,6 +729,10 @@ function applyTransitionHooksImpl(block, hooks) {
|
|
|
775
729
|
if (block.length === 1) block = block[0];
|
|
776
730
|
else if (block.length === 0) return hooks;
|
|
777
731
|
}
|
|
732
|
+
if (hooks.applyGroup && block instanceof ForFragment) {
|
|
733
|
+
hooks.applyGroup(block, hooks);
|
|
734
|
+
return hooks;
|
|
735
|
+
}
|
|
778
736
|
const fragments = [];
|
|
779
737
|
const child = findTransitionBlock(block, (frag) => fragments.push(frag));
|
|
780
738
|
if (!child) {
|
|
@@ -805,18 +763,21 @@ function applyTransitionLeaveHooksImpl(block, enterHooks, afterLeaveCb) {
|
|
|
805
763
|
delete leavingHooks.afterLeave;
|
|
806
764
|
};
|
|
807
765
|
} else if (mode === "in-out") leavingHooks.delayLeave = (block, earlyRemove, delayedLeave) => {
|
|
808
|
-
|
|
766
|
+
const leavingKey = String(leavingBlock.$key);
|
|
767
|
+
state.leavingNodes.set(leavingKey, leavingBlock);
|
|
768
|
+
const delayedLeaveCb = () => {
|
|
769
|
+
delayedLeave();
|
|
770
|
+
leavingBlock.$transition = void 0;
|
|
771
|
+
if (enterHooks.delayedLeave === delayedLeaveCb) delete enterHooks.delayedLeave;
|
|
772
|
+
};
|
|
809
773
|
block[leaveCbKey] = () => {
|
|
810
774
|
earlyRemove();
|
|
811
775
|
block[leaveCbKey] = void 0;
|
|
812
776
|
leavingBlock.$transition = void 0;
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
enterHooks.delayedLeave = () => {
|
|
816
|
-
delayedLeave();
|
|
817
|
-
leavingBlock.$transition = void 0;
|
|
818
|
-
delete enterHooks.delayedLeave;
|
|
777
|
+
if (state.leavingNodes.get(leavingKey) === leavingBlock) state.leavingNodes.delete(leavingKey);
|
|
778
|
+
if (enterHooks.delayedLeave === delayedLeaveCb) delete enterHooks.delayedLeave;
|
|
819
779
|
};
|
|
780
|
+
enterHooks.delayedLeave = delayedLeaveCb;
|
|
820
781
|
};
|
|
821
782
|
}
|
|
822
783
|
function findTransitionBlock(block, onFragment) {
|
|
@@ -863,14 +824,12 @@ function setTransitionHooks$1(block, hooks) {
|
|
|
863
824
|
}
|
|
864
825
|
block.$transition = hooks;
|
|
865
826
|
}
|
|
866
|
-
|
|
867
827
|
//#endregion
|
|
868
828
|
//#region packages/runtime-vapor/src/vdomInteropState.ts
|
|
869
829
|
let isInteropEnabled = false;
|
|
870
830
|
function setInteropEnabled() {
|
|
871
831
|
isInteropEnabled = true;
|
|
872
832
|
}
|
|
873
|
-
|
|
874
833
|
//#endregion
|
|
875
834
|
//#region packages/runtime-vapor/src/apiDefineComponent.ts
|
|
876
835
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -882,7 +841,6 @@ function defineVaporComponent(comp, extraOptions) {
|
|
|
882
841
|
comp.__vapor = true;
|
|
883
842
|
return comp;
|
|
884
843
|
}
|
|
885
|
-
|
|
886
844
|
//#endregion
|
|
887
845
|
//#region packages/runtime-vapor/src/components/KeepAlive.ts
|
|
888
846
|
let currentKeepAliveCtx = null;
|
|
@@ -911,7 +869,7 @@ function getCompositeKey(type, branchKey) {
|
|
|
911
869
|
}
|
|
912
870
|
return composite;
|
|
913
871
|
}
|
|
914
|
-
const
|
|
872
|
+
const VaporKeepAlive = /* @__PURE__ */ defineVaporComponent({
|
|
915
873
|
name: "VaporKeepAlive",
|
|
916
874
|
__isKeepAlive: true,
|
|
917
875
|
props: {
|
|
@@ -1081,7 +1039,6 @@ const VaporKeepAliveImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
1081
1039
|
return children;
|
|
1082
1040
|
}
|
|
1083
1041
|
});
|
|
1084
|
-
const VaporKeepAlive = VaporKeepAliveImpl;
|
|
1085
1042
|
const shouldCache = (block, props, interop = false) => {
|
|
1086
1043
|
const isAsync = !interop && isAsyncWrapper(block);
|
|
1087
1044
|
const type = interop && isInteropEnabled ? block.vnode.type : block.type;
|
|
@@ -1136,7 +1093,6 @@ function deactivate$1(instance, container) {
|
|
|
1136
1093
|
});
|
|
1137
1094
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentAdded(instance);
|
|
1138
1095
|
}
|
|
1139
|
-
|
|
1140
1096
|
//#endregion
|
|
1141
1097
|
//#region packages/runtime-vapor/src/components/Suspense.ts
|
|
1142
1098
|
let parentSuspense = null;
|
|
@@ -1147,10 +1103,14 @@ function setParentSuspense(suspense) {
|
|
|
1147
1103
|
parentSuspense = suspense;
|
|
1148
1104
|
}
|
|
1149
1105
|
}
|
|
1150
|
-
|
|
1151
1106
|
//#endregion
|
|
1152
1107
|
//#region packages/runtime-vapor/src/vdomInterop.ts
|
|
1153
1108
|
const interopKey = Symbol(`interop`);
|
|
1109
|
+
function filterReservedProps(props) {
|
|
1110
|
+
const filtered = {};
|
|
1111
|
+
for (const key in props) if (!isReservedProp(key)) filtered[key] = props[key];
|
|
1112
|
+
return filtered;
|
|
1113
|
+
}
|
|
1154
1114
|
const vaporInteropImpl = {
|
|
1155
1115
|
mount(vnode, container, anchor, parentComponent, parentSuspense, onBeforeMount) {
|
|
1156
1116
|
let selfAnchor = vnode.anchor = /* @__PURE__ */ createTextNode();
|
|
@@ -1161,9 +1121,7 @@ const vaporInteropImpl = {
|
|
|
1161
1121
|
}
|
|
1162
1122
|
const prev = currentInstance;
|
|
1163
1123
|
simpleSetCurrentInstance(parentComponent);
|
|
1164
|
-
const
|
|
1165
|
-
for (const key in vnode.props) if (!isReservedProp(key)) props[key] = vnode.props[key];
|
|
1166
|
-
const propsRef = shallowRef(props);
|
|
1124
|
+
const propsRef = shallowRef(filterReservedProps(vnode.props));
|
|
1167
1125
|
const slotsRef = shallowRef(vnode.children);
|
|
1168
1126
|
let prevSuspense = null;
|
|
1169
1127
|
if (parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
@@ -1195,7 +1153,7 @@ const vaporInteropImpl = {
|
|
|
1195
1153
|
if (n2.dirs) if (rootEl) onBeforeUpdate && onBeforeUpdate();
|
|
1196
1154
|
else n2.dirs = null;
|
|
1197
1155
|
if (shouldUpdate) {
|
|
1198
|
-
instance.rawPropsRef.value = n2.props;
|
|
1156
|
+
instance.rawPropsRef.value = filterReservedProps(n2.props);
|
|
1199
1157
|
instance.rawSlotsRef.value = n2.children;
|
|
1200
1158
|
}
|
|
1201
1159
|
},
|
|
@@ -1252,7 +1210,7 @@ const vaporInteropImpl = {
|
|
|
1252
1210
|
vnode.anchor = vnode.el = currentHydrationNode;
|
|
1253
1211
|
if (!!(process.env.NODE_ENV !== "production") && !vnode.anchor) throw new Error(`Failed to locate slot anchor. this is likely a Vue internal bug.`);
|
|
1254
1212
|
});
|
|
1255
|
-
return vnode.anchor;
|
|
1213
|
+
return isComment(node, "[") ? vnode.anchor.nextSibling : vnode.anchor;
|
|
1256
1214
|
},
|
|
1257
1215
|
setTransitionHooks(component, hooks) {
|
|
1258
1216
|
setTransitionHooks$1(component, hooks);
|
|
@@ -1275,10 +1233,16 @@ const vaporSlotPropsProxyHandler = {
|
|
|
1275
1233
|
return target.value[key];
|
|
1276
1234
|
},
|
|
1277
1235
|
has(target, key) {
|
|
1278
|
-
return target.value
|
|
1236
|
+
return key in target.value;
|
|
1279
1237
|
},
|
|
1280
1238
|
ownKeys(target) {
|
|
1281
|
-
return
|
|
1239
|
+
return Reflect.ownKeys(target.value);
|
|
1240
|
+
},
|
|
1241
|
+
getOwnPropertyDescriptor(target, key) {
|
|
1242
|
+
if (key in target.value) return {
|
|
1243
|
+
enumerable: true,
|
|
1244
|
+
configurable: true
|
|
1245
|
+
};
|
|
1282
1246
|
}
|
|
1283
1247
|
};
|
|
1284
1248
|
const vaporSlotsProxyHandler = { get(target, key) {
|
|
@@ -1292,6 +1256,30 @@ const vaporSlotsProxyHandler = { get(target, key) {
|
|
|
1292
1256
|
return slot;
|
|
1293
1257
|
} };
|
|
1294
1258
|
let vdomHydrateNode;
|
|
1259
|
+
function resolveVNodeRange(vnode) {
|
|
1260
|
+
const { type, shapeFlag, el, anchor } = vnode;
|
|
1261
|
+
if (shapeFlag & 64 && el && anchor && anchor !== el) return [el, anchor];
|
|
1262
|
+
if ((type === Static || type === Fragment) && el && anchor && anchor !== el) return [el, anchor];
|
|
1263
|
+
if (!(shapeFlag & 6)) return;
|
|
1264
|
+
const subTree = vnode.component && vnode.component.subTree;
|
|
1265
|
+
const subEl = subTree && subTree.el;
|
|
1266
|
+
const subAnchor = subTree && subTree.anchor;
|
|
1267
|
+
if (subTree && (subTree.type === Static || subTree.type === Fragment) && subEl && subAnchor && subAnchor !== subEl) return [subEl, subAnchor];
|
|
1268
|
+
}
|
|
1269
|
+
function resolveVNodeNodes(vnode) {
|
|
1270
|
+
const vnodeRange = resolveVNodeRange(vnode);
|
|
1271
|
+
if (vnodeRange) {
|
|
1272
|
+
const nodeRange = [];
|
|
1273
|
+
let n = vnodeRange[0];
|
|
1274
|
+
while (n) {
|
|
1275
|
+
nodeRange.push(n);
|
|
1276
|
+
if (n === vnodeRange[1]) break;
|
|
1277
|
+
n = n.nextSibling;
|
|
1278
|
+
}
|
|
1279
|
+
return nodeRange;
|
|
1280
|
+
}
|
|
1281
|
+
return vnode.el;
|
|
1282
|
+
}
|
|
1295
1283
|
/**
|
|
1296
1284
|
* Mount VNode in vapor
|
|
1297
1285
|
*/
|
|
@@ -1311,7 +1299,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1311
1299
|
hydrateVNode(vnode, parentComponent);
|
|
1312
1300
|
onScopeDispose(unmount, true);
|
|
1313
1301
|
isMounted = true;
|
|
1314
|
-
frag.nodes = vnode
|
|
1302
|
+
frag.nodes = resolveVNodeNodes(vnode);
|
|
1315
1303
|
};
|
|
1316
1304
|
frag.insert = (parentNode, anchor, transition) => {
|
|
1317
1305
|
if (isHydrating$1) return;
|
|
@@ -1330,7 +1318,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1330
1318
|
} else internals.m(vnode, parentNode, anchor, 2, parentComponent);
|
|
1331
1319
|
simpleSetCurrentInstance(prev);
|
|
1332
1320
|
}
|
|
1333
|
-
frag.nodes = vnode
|
|
1321
|
+
frag.nodes = resolveVNodeNodes(vnode);
|
|
1334
1322
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1335
1323
|
};
|
|
1336
1324
|
frag.remove = unmount;
|
|
@@ -1339,7 +1327,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
1339
1327
|
/**
|
|
1340
1328
|
* Mount vdom component in vapor
|
|
1341
1329
|
*/
|
|
1342
|
-
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots
|
|
1330
|
+
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots) {
|
|
1343
1331
|
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
1344
1332
|
const useBridge = shouldUseRendererBridge(component);
|
|
1345
1333
|
const comp = useBridge ? ensureRendererBridge(component) : component;
|
|
@@ -1352,8 +1340,26 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1352
1340
|
const wrapper = new VaporComponentInstance(useBridge ? comp : { props: component.props }, rawProps, rawSlots, parentComponent ? parentComponent.appContext : void 0, void 0);
|
|
1353
1341
|
vnode.vi = (instance) => {
|
|
1354
1342
|
instance.props = shallowReactive(wrapper.props);
|
|
1355
|
-
const attrs =
|
|
1356
|
-
|
|
1343
|
+
const attrs = createInternalObject();
|
|
1344
|
+
const isFilteredEmit = (key) => typeof key === "string" && isEmitListener(instance.emitsOptions, key);
|
|
1345
|
+
instance.attrs = new Proxy(attrs, {
|
|
1346
|
+
get(_, key) {
|
|
1347
|
+
if (isFilteredEmit(key)) return;
|
|
1348
|
+
return wrapper.attrs[key];
|
|
1349
|
+
},
|
|
1350
|
+
has(_, key) {
|
|
1351
|
+
return !isFilteredEmit(key) && key in wrapper.attrs;
|
|
1352
|
+
},
|
|
1353
|
+
ownKeys() {
|
|
1354
|
+
return Reflect.ownKeys(wrapper.attrs).filter((key) => !isFilteredEmit(key));
|
|
1355
|
+
},
|
|
1356
|
+
getOwnPropertyDescriptor(_, key) {
|
|
1357
|
+
if (!isFilteredEmit(key) && key in wrapper.attrs) return {
|
|
1358
|
+
enumerable: true,
|
|
1359
|
+
configurable: true
|
|
1360
|
+
};
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1357
1363
|
instance.slots = wrapper.slots === EMPTY_OBJ ? EMPTY_OBJ : new Proxy(wrapper.slots, vaporSlotsProxyHandler);
|
|
1358
1364
|
};
|
|
1359
1365
|
let rawRef = null;
|
|
@@ -1369,10 +1375,10 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1369
1375
|
};
|
|
1370
1376
|
frag.hydrate = () => {
|
|
1371
1377
|
if (!isHydrating$1) return;
|
|
1372
|
-
hydrateVNode(vnode, parentComponent
|
|
1378
|
+
hydrateVNode(vnode, parentComponent);
|
|
1373
1379
|
onScopeDispose(unmount, true);
|
|
1374
1380
|
isMounted = true;
|
|
1375
|
-
frag.nodes = vnode
|
|
1381
|
+
frag.nodes = resolveVNodeNodes(vnode);
|
|
1376
1382
|
};
|
|
1377
1383
|
vnode.scopeId = getCurrentScopeId() || null;
|
|
1378
1384
|
vnode.slotScopeIds = currentSlotScopeIds;
|
|
@@ -1391,17 +1397,21 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1391
1397
|
} else internals.m(vnode, parentNode, anchor, 2, parentComponent);
|
|
1392
1398
|
simpleSetCurrentInstance(prev);
|
|
1393
1399
|
}
|
|
1394
|
-
frag.nodes = vnode
|
|
1400
|
+
frag.nodes = resolveVNodeNodes(vnode);
|
|
1395
1401
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1396
1402
|
};
|
|
1397
1403
|
frag.remove = unmount;
|
|
1398
1404
|
frag.setRef = (instance, ref, refFor, refKey) => {
|
|
1405
|
+
const oldRawRef = rawRef;
|
|
1399
1406
|
rawRef = normalizeRef({
|
|
1400
1407
|
ref,
|
|
1401
1408
|
ref_for: refFor,
|
|
1402
1409
|
ref_key: refKey
|
|
1403
1410
|
}, instance);
|
|
1404
|
-
if (isMounted
|
|
1411
|
+
if (isMounted) {
|
|
1412
|
+
if (rawRef) setRef(rawRef, oldRawRef, null, vnode);
|
|
1413
|
+
else if (oldRawRef) setRef(oldRawRef, null, null, vnode, true);
|
|
1414
|
+
}
|
|
1405
1415
|
};
|
|
1406
1416
|
return frag;
|
|
1407
1417
|
}
|
|
@@ -1440,7 +1450,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
1440
1450
|
else if (currentBlock) insert(currentBlock, parentNode, anchor);
|
|
1441
1451
|
frag.remove = (parentNode) => {
|
|
1442
1452
|
if (currentBlock) remove(currentBlock, parentNode);
|
|
1443
|
-
else if (currentVNode) internals.um(currentVNode, parentComponent, null);
|
|
1453
|
+
else if (currentVNode) internals.um(currentVNode, parentComponent, null, true);
|
|
1444
1454
|
};
|
|
1445
1455
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
1446
1456
|
};
|
|
@@ -1536,10 +1546,8 @@ const vaporInteropPlugin = (app) => {
|
|
|
1536
1546
|
return mount(...args);
|
|
1537
1547
|
});
|
|
1538
1548
|
};
|
|
1539
|
-
function hydrateVNode(vnode, parentComponent
|
|
1540
|
-
|
|
1541
|
-
let node = currentHydrationNode;
|
|
1542
|
-
if (skipFragmentAnchor && isComment(node, "[")) setCurrentHydrationNode(node = node.nextSibling);
|
|
1549
|
+
function hydrateVNode(vnode, parentComponent) {
|
|
1550
|
+
const node = currentHydrationNode;
|
|
1543
1551
|
if (!vdomHydrateNode) vdomHydrateNode = ensureHydrationRenderer().hydrateNode;
|
|
1544
1552
|
const nextNode = vdomHydrateNode(node, vnode, parentComponent, null, null, false);
|
|
1545
1553
|
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
@@ -1567,7 +1575,6 @@ const createFallback = (fallback) => (internals, parentComponent) => {
|
|
|
1567
1575
|
}
|
|
1568
1576
|
return fallbackNodes;
|
|
1569
1577
|
};
|
|
1570
|
-
|
|
1571
1578
|
//#endregion
|
|
1572
1579
|
//#region packages/runtime-vapor/src/componentEmits.ts
|
|
1573
1580
|
/**
|
|
@@ -1594,12 +1601,11 @@ function propGetter(rawProps, key) {
|
|
|
1594
1601
|
let i = dynamicSources.length;
|
|
1595
1602
|
while (i--) {
|
|
1596
1603
|
const source = resolveSource(dynamicSources[i]);
|
|
1597
|
-
if (hasOwn(source, key)) return dynamicSources[interopKey] || isOn(key) ? source[key] : resolveSource(source[key]);
|
|
1604
|
+
if (hasOwn(source, key)) return dynamicSources[interopKey] || isOn(key) && isFunction(dynamicSources[i]) ? source[key] : resolveSource(source[key]);
|
|
1598
1605
|
}
|
|
1599
1606
|
}
|
|
1600
1607
|
return rawProps[key] && resolveSource(rawProps[key]);
|
|
1601
1608
|
}
|
|
1602
|
-
|
|
1603
1609
|
//#endregion
|
|
1604
1610
|
//#region packages/runtime-vapor/src/componentProps.ts
|
|
1605
1611
|
function resolveSource(source) {
|
|
@@ -1827,7 +1833,6 @@ const rawPropsProxyHandlers = {
|
|
|
1827
1833
|
};
|
|
1828
1834
|
}
|
|
1829
1835
|
};
|
|
1830
|
-
|
|
1831
1836
|
//#endregion
|
|
1832
1837
|
//#region packages/runtime-vapor/src/componentSlots.ts
|
|
1833
1838
|
/**
|
|
@@ -1946,6 +1951,7 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1946
1951
|
fragment = instance.appContext.vapor.vdomSlot(rawSlots._, name, slotProps, instance, fallback);
|
|
1947
1952
|
} else {
|
|
1948
1953
|
fragment = new SlotFragment();
|
|
1954
|
+
fragment.forwarded = currentSlotOwner != null && currentSlotOwner !== currentInstance;
|
|
1949
1955
|
const isDynamicName = isFunction(name);
|
|
1950
1956
|
const slotScopeIds = [];
|
|
1951
1957
|
if (!noSlotted) {
|
|
@@ -1999,7 +2005,6 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1999
2005
|
}
|
|
2000
2006
|
return fragment;
|
|
2001
2007
|
}
|
|
2002
|
-
|
|
2003
2008
|
//#endregion
|
|
2004
2009
|
//#region packages/runtime-vapor/src/renderEffect.ts
|
|
2005
2010
|
var RenderEffect = class extends ReactiveEffect {
|
|
@@ -2053,7 +2058,6 @@ function renderEffect(fn, noLifecycle = false) {
|
|
|
2053
2058
|
if (noLifecycle) effect.fn = fn;
|
|
2054
2059
|
effect.run();
|
|
2055
2060
|
}
|
|
2056
|
-
|
|
2057
2061
|
//#endregion
|
|
2058
2062
|
//#region packages/runtime-vapor/src/fragment.ts
|
|
2059
2063
|
var VaporFragment = class {
|
|
@@ -2068,33 +2072,41 @@ var ForFragment = class extends VaporFragment {
|
|
|
2068
2072
|
}
|
|
2069
2073
|
};
|
|
2070
2074
|
var DynamicFragment = class extends VaporFragment {
|
|
2071
|
-
constructor(anchorLabel, keyed = false) {
|
|
2075
|
+
constructor(anchorLabel, keyed = false, locate = true) {
|
|
2072
2076
|
super([]);
|
|
2073
2077
|
this.hydrate = (isEmpty = false) => {
|
|
2074
2078
|
if (!isHydrating$1) return;
|
|
2075
2079
|
if (this.anchor) return;
|
|
2076
|
-
if (
|
|
2077
|
-
if (
|
|
2078
|
-
this.anchor = locateFragmentEndAnchor("");
|
|
2079
|
-
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) throw new Error("Failed to locate if anchor. this is likely a Vue internal bug.");
|
|
2080
|
-
else {
|
|
2081
|
-
if (!!(process.env.NODE_ENV !== "production")) this.anchor.data = this.anchorLabel;
|
|
2082
|
-
return;
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
} else if (this.anchorLabel === "slot") {
|
|
2086
|
-
if (isEmpty && isComment(currentHydrationNode, "")) {
|
|
2080
|
+
if (isEmpty) {
|
|
2081
|
+
if (isComment(currentHydrationNode, "")) {
|
|
2087
2082
|
this.anchor = currentHydrationNode;
|
|
2083
|
+
advanceHydrationNode(currentHydrationNode);
|
|
2088
2084
|
if (!!(process.env.NODE_ENV !== "production")) this.anchor.data = this.anchorLabel;
|
|
2089
2085
|
return;
|
|
2090
2086
|
}
|
|
2091
|
-
this.anchor = locateFragmentEndAnchor();
|
|
2092
|
-
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) throw new Error("Failed to locate slot anchor. this is likely a Vue internal bug.");
|
|
2093
|
-
else return;
|
|
2094
2087
|
}
|
|
2095
|
-
const
|
|
2088
|
+
const forwardedSlot = this.forwarded;
|
|
2089
|
+
let isValidSlot = false;
|
|
2090
|
+
if (forwardedSlot && (isEmpty || !(isValidSlot = isValidBlock(this.nodes))) && this.hasFallback) return;
|
|
2091
|
+
if (this.anchorLabel === "slot" && (!forwardedSlot || isValidSlot && !isInSlotFallback) || this.anchorLabel === "if" && isArray(this.nodes)) {
|
|
2092
|
+
if (isComment(currentHydrationNode, "]")) {
|
|
2093
|
+
this.anchor = currentHydrationNode;
|
|
2094
|
+
advanceHydrationNode(currentHydrationNode);
|
|
2095
|
+
return;
|
|
2096
|
+
} else if (!!(process.env.NODE_ENV !== "production")) throw new Error(`Failed to locate ${this.anchorLabel} fragment anchor. this is likely a Vue internal bug.`);
|
|
2097
|
+
}
|
|
2098
|
+
let parentNode;
|
|
2099
|
+
let nextNode;
|
|
2100
|
+
if (forwardedSlot) {
|
|
2101
|
+
parentNode = currentHydrationNode.parentNode;
|
|
2102
|
+
nextNode = currentHydrationNode.nextSibling;
|
|
2103
|
+
} else {
|
|
2104
|
+
const node = findBlockNode(this.nodes);
|
|
2105
|
+
parentNode = node.parentNode;
|
|
2106
|
+
nextNode = node.nextNode;
|
|
2107
|
+
}
|
|
2096
2108
|
queuePostFlushCb(() => {
|
|
2097
|
-
|
|
2109
|
+
parentNode.insertBefore(this.anchor = !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode(), nextNode);
|
|
2098
2110
|
});
|
|
2099
2111
|
};
|
|
2100
2112
|
this.keyed = keyed;
|
|
@@ -2102,7 +2114,7 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2102
2114
|
this.keepAliveCtx = currentKeepAliveCtx;
|
|
2103
2115
|
if (isHydrating$1) {
|
|
2104
2116
|
this.anchorLabel = anchorLabel;
|
|
2105
|
-
locateHydrationNode();
|
|
2117
|
+
if (locate) locateHydrationNode();
|
|
2106
2118
|
} else {
|
|
2107
2119
|
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? /* @__PURE__ */ createComment(anchorLabel) : /* @__PURE__ */ createTextNode();
|
|
2108
2120
|
if (!!(process.env.NODE_ENV !== "production")) this.anchorLabel = anchorLabel;
|
|
@@ -2136,14 +2148,19 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2136
2148
|
}
|
|
2137
2149
|
if (!retainScope) this.scope.stop();
|
|
2138
2150
|
const mode = transition && transition.mode;
|
|
2139
|
-
if (mode) {
|
|
2151
|
+
if (mode && (mode !== "in-out" || mode === "in-out" && render) && (mode !== "out-in" || isValidBlock(this.nodes))) {
|
|
2140
2152
|
applyTransitionLeaveHooks(this.nodes, transition, () => {
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2153
|
+
const prevInstance = setCurrentInstance(instance);
|
|
2154
|
+
try {
|
|
2155
|
+
const pending = this.pending;
|
|
2156
|
+
if (pending) {
|
|
2157
|
+
this.pending = void 0;
|
|
2158
|
+
this.current = pending.key;
|
|
2159
|
+
this.renderBranch(pending.render, transition, parent);
|
|
2160
|
+
} else this.renderBranch(render, transition, parent);
|
|
2161
|
+
} finally {
|
|
2162
|
+
setCurrentInstance(...prevInstance);
|
|
2163
|
+
}
|
|
2147
2164
|
});
|
|
2148
2165
|
parent && remove(this.nodes, parent);
|
|
2149
2166
|
if (mode === "out-in") {
|
|
@@ -2152,11 +2169,11 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2152
2169
|
}
|
|
2153
2170
|
} else parent && remove(this.nodes, parent);
|
|
2154
2171
|
}
|
|
2155
|
-
this.renderBranch(render, transition, parent
|
|
2172
|
+
this.renderBranch(render, transition, parent);
|
|
2156
2173
|
setActiveSub(prevSub);
|
|
2157
|
-
if (isHydrating$1) this.hydrate();
|
|
2174
|
+
if (isHydrating$1) this.hydrate(render == null);
|
|
2158
2175
|
}
|
|
2159
|
-
renderBranch(render, transition, parent
|
|
2176
|
+
renderBranch(render, transition, parent) {
|
|
2160
2177
|
if (render) {
|
|
2161
2178
|
const keepAliveCtx = this.keepAliveCtx;
|
|
2162
2179
|
const scope = keepAliveCtx && keepAliveCtx.getScope(this.current);
|
|
@@ -2166,11 +2183,9 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2166
2183
|
const prevKeepAliveCtx = setCurrentKeepAliveCtx(keepAliveCtx);
|
|
2167
2184
|
const needBranchKey = keepAliveCtx && this.keyed;
|
|
2168
2185
|
const prevBranchKey = needBranchKey ? keepAliveCtx.setCurrentBranchKey(this.current) : void 0;
|
|
2169
|
-
const prevInstance = setCurrentInstance(instance);
|
|
2170
2186
|
try {
|
|
2171
2187
|
this.nodes = this.scope.run(render) || [];
|
|
2172
2188
|
} finally {
|
|
2173
|
-
setCurrentInstance(...prevInstance);
|
|
2174
2189
|
if (needBranchKey) keepAliveCtx.setCurrentBranchKey(prevBranchKey);
|
|
2175
2190
|
setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
2176
2191
|
setCurrentSlotOwner(prevSlotOwner);
|
|
@@ -2195,17 +2210,32 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
2195
2210
|
}
|
|
2196
2211
|
}
|
|
2197
2212
|
};
|
|
2213
|
+
let currentSlotHasFallback = false;
|
|
2214
|
+
let isInSlotFallback = false;
|
|
2198
2215
|
var SlotFragment = class extends DynamicFragment {
|
|
2199
2216
|
constructor() {
|
|
2200
|
-
super(isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? "slot" : void 0);
|
|
2217
|
+
super(isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? "slot" : void 0, false, false);
|
|
2218
|
+
this.forwarded = false;
|
|
2219
|
+
this.hasFallback = false;
|
|
2201
2220
|
}
|
|
2202
|
-
updateSlot(render, fallback, key = render) {
|
|
2221
|
+
updateSlot(render, fallback, key = render || fallback) {
|
|
2222
|
+
if (isHydrating$1) {
|
|
2223
|
+
locateHydrationNode(true);
|
|
2224
|
+
if (this.forwarded) this.hasFallback = currentSlotHasFallback;
|
|
2225
|
+
}
|
|
2203
2226
|
if (!render || !fallback) {
|
|
2204
2227
|
this.update(render || fallback, key);
|
|
2205
2228
|
return;
|
|
2206
2229
|
}
|
|
2207
2230
|
const wrapped = () => {
|
|
2208
|
-
const
|
|
2231
|
+
const prev = currentSlotHasFallback;
|
|
2232
|
+
currentSlotHasFallback = true;
|
|
2233
|
+
let block;
|
|
2234
|
+
try {
|
|
2235
|
+
block = render();
|
|
2236
|
+
} finally {
|
|
2237
|
+
currentSlotHasFallback = prev;
|
|
2238
|
+
}
|
|
2209
2239
|
const emptyFrag = attachSlotFallback(block, fallback);
|
|
2210
2240
|
if (!isValidBlock(block)) return renderSlotFallback(block, fallback, emptyFrag);
|
|
2211
2241
|
return block;
|
|
@@ -2223,7 +2253,15 @@ function renderSlotFallback(block, fallback, emptyFragment) {
|
|
|
2223
2253
|
const frag = emptyFragment || findDeepestEmptyFragment(block);
|
|
2224
2254
|
if (frag) {
|
|
2225
2255
|
if (frag instanceof ForFragment) frag.nodes[0] = [fallback() || []];
|
|
2226
|
-
else if (frag instanceof DynamicFragment)
|
|
2256
|
+
else if (frag instanceof DynamicFragment) {
|
|
2257
|
+
const prev = isInSlotFallback;
|
|
2258
|
+
isInSlotFallback = true;
|
|
2259
|
+
try {
|
|
2260
|
+
frag.update(fallback);
|
|
2261
|
+
} finally {
|
|
2262
|
+
isInSlotFallback = prev;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2227
2265
|
return block;
|
|
2228
2266
|
}
|
|
2229
2267
|
return fallback();
|
|
@@ -2312,7 +2350,6 @@ function setKey(block, key) {
|
|
|
2312
2350
|
setKey(block.nodes, key);
|
|
2313
2351
|
}
|
|
2314
2352
|
}
|
|
2315
|
-
|
|
2316
2353
|
//#endregion
|
|
2317
2354
|
//#region packages/runtime-vapor/src/components/Teleport.ts
|
|
2318
2355
|
const VaporTeleportImpl = {
|
|
@@ -2520,7 +2557,29 @@ function updateCssVars(frag) {
|
|
|
2520
2557
|
ctx.ut();
|
|
2521
2558
|
}
|
|
2522
2559
|
}
|
|
2523
|
-
|
|
2560
|
+
//#endregion
|
|
2561
|
+
//#region packages/runtime-vapor/src/scopeId.ts
|
|
2562
|
+
function setScopeId(block, scopeIds) {
|
|
2563
|
+
if (block instanceof Element) for (const id of scopeIds) block.setAttribute(id, "");
|
|
2564
|
+
else if (isVaporComponent(block)) setScopeId(block.block, scopeIds);
|
|
2565
|
+
else if (isArray(block)) for (const b of block) setScopeId(b, scopeIds);
|
|
2566
|
+
else if (isFragment(block)) setScopeId(block.nodes, scopeIds);
|
|
2567
|
+
}
|
|
2568
|
+
function setComponentScopeId(instance) {
|
|
2569
|
+
const { parent, scopeId } = instance;
|
|
2570
|
+
if (!parent || !scopeId) return;
|
|
2571
|
+
if (isArray(instance.block) && instance.block.length > 1) return;
|
|
2572
|
+
const scopeIds = [];
|
|
2573
|
+
const parentScopeId = parent && parent.type.__scopeId;
|
|
2574
|
+
if (parentScopeId !== scopeId) scopeIds.push(scopeId);
|
|
2575
|
+
else if (parentScopeId) scopeIds.push(parentScopeId);
|
|
2576
|
+
if (isInteropEnabled && parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
|
|
2577
|
+
scopeIds.push(parent.vnode.scopeId);
|
|
2578
|
+
const inheritedScopeIds = getInheritedScopeIds(parent.vnode, parent.parent);
|
|
2579
|
+
scopeIds.push(...inheritedScopeIds);
|
|
2580
|
+
}
|
|
2581
|
+
if (scopeIds.length > 0) setScopeId(instance.block, scopeIds);
|
|
2582
|
+
}
|
|
2524
2583
|
//#endregion
|
|
2525
2584
|
//#region packages/runtime-vapor/src/block.ts
|
|
2526
2585
|
function isBlock(val) {
|
|
@@ -2602,8 +2661,9 @@ function normalizeBlock(block) {
|
|
|
2602
2661
|
return nodes;
|
|
2603
2662
|
}
|
|
2604
2663
|
function findBlockNode(block) {
|
|
2605
|
-
|
|
2606
|
-
|
|
2664
|
+
const lastChild = findLastChild(block);
|
|
2665
|
+
let { parentNode, nextSibling: nextNode } = lastChild;
|
|
2666
|
+
if (nextNode && isComment(nextNode, "]") && isFragmentBlock(block) && !isComment(lastChild, "]")) nextNode = nextNode.nextSibling;
|
|
2607
2667
|
return {
|
|
2608
2668
|
parentNode,
|
|
2609
2669
|
nextNode
|
|
@@ -2624,40 +2684,6 @@ function isFragmentBlock(block) {
|
|
|
2624
2684
|
else if (isFragment(block)) return isFragmentBlock(block.nodes);
|
|
2625
2685
|
return false;
|
|
2626
2686
|
}
|
|
2627
|
-
function setScopeId(block, scopeIds) {
|
|
2628
|
-
if (block instanceof Element) for (const id of scopeIds) block.setAttribute(id, "");
|
|
2629
|
-
else if (isVaporComponent(block)) setScopeId(block.block, scopeIds);
|
|
2630
|
-
else if (isArray(block)) for (const b of block) setScopeId(b, scopeIds);
|
|
2631
|
-
else if (isFragment(block)) setScopeId(block.nodes, scopeIds);
|
|
2632
|
-
}
|
|
2633
|
-
function setComponentScopeId(instance) {
|
|
2634
|
-
const { parent, scopeId } = instance;
|
|
2635
|
-
if (!parent || !scopeId) return;
|
|
2636
|
-
if (isArray(instance.block) && instance.block.length > 1) return;
|
|
2637
|
-
const scopeIds = [];
|
|
2638
|
-
const parentScopeId = parent && parent.type.__scopeId;
|
|
2639
|
-
if (parentScopeId !== scopeId) scopeIds.push(scopeId);
|
|
2640
|
-
else if (parentScopeId) scopeIds.push(parentScopeId);
|
|
2641
|
-
if (parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
|
|
2642
|
-
scopeIds.push(parent.vnode.scopeId);
|
|
2643
|
-
const inheritedScopeIds = getInheritedScopeIds(parent.vnode, parent.parent);
|
|
2644
|
-
scopeIds.push(...inheritedScopeIds);
|
|
2645
|
-
}
|
|
2646
|
-
if (scopeIds.length > 0) setScopeId(instance.block, scopeIds);
|
|
2647
|
-
}
|
|
2648
|
-
let _applyTransitionHooks;
|
|
2649
|
-
let _applyTransitionLeaveHooks;
|
|
2650
|
-
function registerTransitionHooks(applyHooks, applyLeaveHooks) {
|
|
2651
|
-
_applyTransitionHooks = applyHooks;
|
|
2652
|
-
_applyTransitionLeaveHooks = applyLeaveHooks;
|
|
2653
|
-
}
|
|
2654
|
-
function applyTransitionHooks(block, hooks) {
|
|
2655
|
-
return _applyTransitionHooks ? _applyTransitionHooks(block, hooks) : hooks;
|
|
2656
|
-
}
|
|
2657
|
-
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
2658
|
-
_applyTransitionLeaveHooks && _applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb);
|
|
2659
|
-
}
|
|
2660
|
-
|
|
2661
2687
|
//#endregion
|
|
2662
2688
|
//#region packages/runtime-vapor/src/hmr.ts
|
|
2663
2689
|
function hmrRerender(instance) {
|
|
@@ -2684,7 +2710,7 @@ function hmrReload(instance, newComp) {
|
|
|
2684
2710
|
unmountComponent(instance, parent);
|
|
2685
2711
|
const parentInstance = instance.parent;
|
|
2686
2712
|
const prev = setCurrentInstance(parentInstance);
|
|
2687
|
-
const newInstance = createComponent(newComp, instance.rawProps, instance.rawSlots, instance.isSingleRoot);
|
|
2713
|
+
const newInstance = createComponent(newComp, instance.rawProps, instance.rawSlots, instance.isSingleRoot, void 0, instance.appContext);
|
|
2688
2714
|
setCurrentInstance(...prev);
|
|
2689
2715
|
mountComponent(newInstance, parent, anchor);
|
|
2690
2716
|
updateParentBlockOnHmrReload(parentInstance, instance, newInstance);
|
|
@@ -2697,15 +2723,7 @@ function hmrReload(instance, newComp) {
|
|
|
2697
2723
|
* `normalizeBlock` relies on the current instance.block
|
|
2698
2724
|
*/
|
|
2699
2725
|
function updateParentBlockOnHmrReload(parentInstance, instance, newInstance) {
|
|
2700
|
-
if (parentInstance)
|
|
2701
|
-
if (parentInstance.block === instance) parentInstance.block = newInstance;
|
|
2702
|
-
else if (isArray(parentInstance.block)) {
|
|
2703
|
-
for (let i = 0; i < parentInstance.block.length; i++) if (parentInstance.block[i] === instance) {
|
|
2704
|
-
parentInstance.block[i] = newInstance;
|
|
2705
|
-
break;
|
|
2706
|
-
}
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2726
|
+
if (parentInstance) parentInstance.block = replaceBlockInstance(parentInstance.block, instance, newInstance);
|
|
2709
2727
|
}
|
|
2710
2728
|
/**
|
|
2711
2729
|
* dev only
|
|
@@ -2718,23 +2736,32 @@ function updateParentTeleportOnHmrReload(instance, newInstance) {
|
|
|
2718
2736
|
const teleport = instance.parentTeleport;
|
|
2719
2737
|
if (teleport) {
|
|
2720
2738
|
newInstance.parentTeleport = teleport;
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2739
|
+
teleport.nodes = replaceBlockInstance(teleport.nodes, instance, newInstance);
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
function replaceBlockInstance(block, instance, newInstance) {
|
|
2743
|
+
if (block === instance) return newInstance;
|
|
2744
|
+
if (isArray(block)) {
|
|
2745
|
+
for (let i = 0; i < block.length; i++) block[i] = replaceBlockInstance(block[i], instance, newInstance);
|
|
2746
|
+
return block;
|
|
2747
|
+
}
|
|
2748
|
+
if (isVaporComponent(block)) {
|
|
2749
|
+
block.block = replaceBlockInstance(block.block, instance, newInstance);
|
|
2750
|
+
return block;
|
|
2751
|
+
}
|
|
2752
|
+
if (isFragment(block)) {
|
|
2753
|
+
block.nodes = replaceBlockInstance(block.nodes, instance, newInstance);
|
|
2754
|
+
return block;
|
|
2728
2755
|
}
|
|
2756
|
+
return block;
|
|
2729
2757
|
}
|
|
2730
|
-
|
|
2731
2758
|
//#endregion
|
|
2732
2759
|
//#region packages/runtime-vapor/src/component.ts
|
|
2733
2760
|
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext) {
|
|
2734
2761
|
const _insertionParent = insertionParent;
|
|
2735
2762
|
const _insertionAnchor = insertionAnchor;
|
|
2736
2763
|
const _isLastInsertion = isLastInsertion;
|
|
2737
|
-
if (isHydrating$1) locateHydrationNode();
|
|
2764
|
+
if (isHydrating$1) locateHydrationNode(component.__multiRoot);
|
|
2738
2765
|
else resetInsertionState();
|
|
2739
2766
|
let prevSuspense = null;
|
|
2740
2767
|
if (currentInstance && currentInstance.suspense) prevSuspense = setParentSuspense(currentInstance.suspense);
|
|
@@ -2748,7 +2775,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2748
2775
|
if (cached) return cached;
|
|
2749
2776
|
}
|
|
2750
2777
|
if (isInteropEnabled && appContext.vapor && !component.__vapor) {
|
|
2751
|
-
const frag = appContext.vapor.vdomMount(component, currentInstance, rawProps, rawSlots
|
|
2778
|
+
const frag = appContext.vapor.vdomMount(component, currentInstance, rawProps, rawSlots);
|
|
2752
2779
|
if (!isHydrating$1) {
|
|
2753
2780
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
2754
2781
|
} else {
|
|
@@ -2982,7 +3009,7 @@ function mountComponent(instance, parent, anchor) {
|
|
|
2982
3009
|
return;
|
|
2983
3010
|
}
|
|
2984
3011
|
const { root, type } = instance;
|
|
2985
|
-
if (root && root.ce && root.ce._hasShadowRoot()) root.ce._injectChildStyle(type);
|
|
3012
|
+
if (root && root.ce && root.ce._hasShadowRoot()) root.ce._injectChildStyle(type, instance.parent ? instance.parent.type : void 0);
|
|
2986
3013
|
if (!!(process.env.NODE_ENV !== "production")) startMeasure(instance, `mount`);
|
|
2987
3014
|
if (instance.bm) invokeArrayFns(instance.bm);
|
|
2988
3015
|
if (!isHydrating$1) {
|
|
@@ -3068,7 +3095,6 @@ function getCurrentScopeId() {
|
|
|
3068
3095
|
const scopeOwner = getScopeOwner();
|
|
3069
3096
|
return scopeOwner ? scopeOwner.type.__scopeId : void 0;
|
|
3070
3097
|
}
|
|
3071
|
-
|
|
3072
3098
|
//#endregion
|
|
3073
3099
|
//#region packages/runtime-vapor/src/apiCreateApp.ts
|
|
3074
3100
|
let _createApp;
|
|
@@ -3131,7 +3157,6 @@ const createVaporSSRApp = (comp, props) => {
|
|
|
3131
3157
|
postPrepareApp(app);
|
|
3132
3158
|
return app;
|
|
3133
3159
|
};
|
|
3134
|
-
|
|
3135
3160
|
//#endregion
|
|
3136
3161
|
//#region packages/runtime-vapor/src/apiDefineAsyncComponent.ts
|
|
3137
3162
|
function defineVaporAsyncComponent(source) {
|
|
@@ -3223,7 +3248,6 @@ function createInnerComp(comp, parent, frag) {
|
|
|
3223
3248
|
const { rawProps, rawSlots, appContext } = parent;
|
|
3224
3249
|
return createComponent(comp, rawProps, rawSlots, void 0, void 0, appContext);
|
|
3225
3250
|
}
|
|
3226
|
-
|
|
3227
3251
|
//#endregion
|
|
3228
3252
|
//#region packages/runtime-vapor/src/apiDefineCustomElement.ts
|
|
3229
3253
|
/* @__NO_SIDE_EFFECTS__ */
|
|
@@ -3307,7 +3331,6 @@ var VaporElement = class extends VueElementBase {
|
|
|
3307
3331
|
createComponent(this._def, this._props, void 0, void 0, void 0, this._app._context);
|
|
3308
3332
|
}
|
|
3309
3333
|
};
|
|
3310
|
-
|
|
3311
3334
|
//#endregion
|
|
3312
3335
|
//#region packages/runtime-vapor/src/dom/template.ts
|
|
3313
3336
|
let t;
|
|
@@ -3337,21 +3360,24 @@ function template(html, root, ns) {
|
|
|
3337
3360
|
return ret;
|
|
3338
3361
|
};
|
|
3339
3362
|
}
|
|
3340
|
-
|
|
3341
3363
|
//#endregion
|
|
3342
3364
|
//#region packages/runtime-vapor/src/apiCreateIf.ts
|
|
3343
|
-
function createIf(condition, b1, b2, once, index) {
|
|
3365
|
+
function createIf(condition, b1, b2, blockShape, once, index) {
|
|
3344
3366
|
const _insertionParent = insertionParent;
|
|
3345
3367
|
const _insertionAnchor = insertionAnchor;
|
|
3346
3368
|
const _isLastInsertion = isLastInsertion;
|
|
3347
3369
|
if (!isHydrating$1) resetInsertionState();
|
|
3348
3370
|
let frag;
|
|
3349
|
-
if (once)
|
|
3350
|
-
|
|
3371
|
+
if (once) {
|
|
3372
|
+
const ok = condition();
|
|
3373
|
+
if (isHydrating$1) locateHydrationNode(decodeIfShape(blockShape, ok) === 2);
|
|
3374
|
+
frag = ok ? b1() : b2 ? b2() : [!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("if") : /* @__PURE__ */ createTextNode()];
|
|
3375
|
+
} else {
|
|
3351
3376
|
const keyed = index != null;
|
|
3352
|
-
frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if", keyed) : new DynamicFragment(void 0, keyed);
|
|
3377
|
+
frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if", keyed, false) : new DynamicFragment(void 0, keyed, false);
|
|
3353
3378
|
renderEffect(() => {
|
|
3354
3379
|
const ok = condition();
|
|
3380
|
+
if (isHydrating$1) locateHydrationNode(decodeIfShape(blockShape, ok) === 2);
|
|
3355
3381
|
frag.update(ok ? b1 : b2, keyed ? `${index}${ok ? 0 : 1}` : void 0);
|
|
3356
3382
|
});
|
|
3357
3383
|
}
|
|
@@ -3360,7 +3386,9 @@ function createIf(condition, b1, b2, once, index) {
|
|
|
3360
3386
|
} else if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
3361
3387
|
return frag;
|
|
3362
3388
|
}
|
|
3363
|
-
|
|
3389
|
+
function decodeIfShape(shape, ok) {
|
|
3390
|
+
return shape >> (ok ? 0 : 2) & 3;
|
|
3391
|
+
}
|
|
3364
3392
|
//#endregion
|
|
3365
3393
|
//#region packages/runtime-vapor/src/apiCreateFragment.ts
|
|
3366
3394
|
/**
|
|
@@ -3385,7 +3413,6 @@ function createKeyedFragment(key, render) {
|
|
|
3385
3413
|
} else if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
3386
3414
|
return frag;
|
|
3387
3415
|
}
|
|
3388
|
-
|
|
3389
3416
|
//#endregion
|
|
3390
3417
|
//#region packages/runtime-vapor/src/apiCreateFor.ts
|
|
3391
3418
|
var ForBlock = class extends VaporFragment {
|
|
@@ -3403,7 +3430,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3403
3430
|
const _insertionAnchor = insertionAnchor;
|
|
3404
3431
|
const _insertionIndex = insertionIndex;
|
|
3405
3432
|
const _isLastInsertion = isLastInsertion;
|
|
3406
|
-
if (isHydrating$1) locateHydrationNode();
|
|
3433
|
+
if (isHydrating$1) locateHydrationNode(true);
|
|
3407
3434
|
else resetInsertionState();
|
|
3408
3435
|
let isMounted = false;
|
|
3409
3436
|
let oldBlocks = [];
|
|
@@ -3428,12 +3455,14 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3428
3455
|
const prevSub = setActiveSub();
|
|
3429
3456
|
if (!isMounted) {
|
|
3430
3457
|
isMounted = true;
|
|
3458
|
+
let nextNode;
|
|
3431
3459
|
for (let i = 0; i < newLength; i++) {
|
|
3432
|
-
|
|
3433
|
-
|
|
3460
|
+
if (isHydrating$1) nextNode = locateNextNode(currentHydrationNode);
|
|
3461
|
+
mount(source, i);
|
|
3462
|
+
if (isHydrating$1 && nextNode) setCurrentHydrationNode(nextNode);
|
|
3434
3463
|
}
|
|
3435
3464
|
if (isHydrating$1) {
|
|
3436
|
-
parentAnchor =
|
|
3465
|
+
parentAnchor = currentHydrationNode;
|
|
3437
3466
|
if (!!(process.env.NODE_ENV !== "production") && (!parentAnchor || parentAnchor && !isComment(parentAnchor, "]"))) throw new Error(`v-for fragment anchor node was not found. this is likely a Vue internal bug.`);
|
|
3438
3467
|
if (_insertionParent && isComment(parentAnchor, "]")) {
|
|
3439
3468
|
parentAnchor.$idx = _insertionIndex || 0;
|
|
@@ -3766,7 +3795,6 @@ function getDefaultValue(val, defaultVal) {
|
|
|
3766
3795
|
function isForBlock(block) {
|
|
3767
3796
|
return block instanceof ForBlock;
|
|
3768
3797
|
}
|
|
3769
|
-
|
|
3770
3798
|
//#endregion
|
|
3771
3799
|
//#region packages/runtime-vapor/src/apiTemplateRef.ts
|
|
3772
3800
|
const refCleanups = /* @__PURE__ */ new WeakMap();
|
|
@@ -3804,16 +3832,19 @@ function createTemplateRefSetter() {
|
|
|
3804
3832
|
*/
|
|
3805
3833
|
function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
3806
3834
|
if (!instance || instance.isUnmounted) return;
|
|
3807
|
-
if (isInteropEnabled && isFragment(el) && el.setRef) {
|
|
3808
|
-
el.setRef(instance, ref, refFor, refKey);
|
|
3809
|
-
return;
|
|
3810
|
-
}
|
|
3811
3835
|
if (isVaporComponent(el) && isAsyncWrapper(el)) {
|
|
3812
3836
|
if (!el.type.__asyncResolved) return;
|
|
3813
3837
|
el = el.block.nodes;
|
|
3814
3838
|
}
|
|
3815
3839
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
3816
3840
|
const refValue = getRefValue(el);
|
|
3841
|
+
if (isInteropEnabled) {
|
|
3842
|
+
const target = isFragment(el) && el.setRef ? el : refValue && isFragment(refValue) && refValue.setRef ? refValue : null;
|
|
3843
|
+
if (target) {
|
|
3844
|
+
target.setRef(instance, ref, refFor, refKey);
|
|
3845
|
+
return ref;
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3817
3848
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
3818
3849
|
const canSetSetupRef = !!(process.env.NODE_ENV !== "production") ? createCanSetSetupRefChecker(setupState, refs) : NO;
|
|
3819
3850
|
const canSetRef = (ref, key) => {
|
|
@@ -3835,6 +3866,7 @@ function setRef$1(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
3835
3866
|
if (cleanup) cleanup.fn();
|
|
3836
3867
|
}
|
|
3837
3868
|
}
|
|
3869
|
+
if (ref == null) return ref;
|
|
3838
3870
|
if (isFunction(ref)) {
|
|
3839
3871
|
const invokeRefSetter = (value) => {
|
|
3840
3872
|
callWithErrorHandling(ref, instance, 12, [value, refs]);
|
|
@@ -3896,7 +3928,6 @@ const getRefValue = (el) => {
|
|
|
3896
3928
|
}
|
|
3897
3929
|
return el;
|
|
3898
3930
|
};
|
|
3899
|
-
|
|
3900
3931
|
//#endregion
|
|
3901
3932
|
//#region packages/runtime-vapor/src/helpers/useCssVars.ts
|
|
3902
3933
|
function useVaporCssVars(getter) {
|
|
@@ -3920,7 +3951,6 @@ function setVarsOnBlock(block, vars) {
|
|
|
3920
3951
|
else if (isTeleportFragment(block)) return;
|
|
3921
3952
|
else setVarsOnBlock(block.nodes, vars);
|
|
3922
3953
|
}
|
|
3923
|
-
|
|
3924
3954
|
//#endregion
|
|
3925
3955
|
//#region packages/runtime-vapor/src/apiCreateDynamicComponent.ts
|
|
3926
3956
|
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once) {
|
|
@@ -3942,6 +3972,7 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
3942
3972
|
}
|
|
3943
3973
|
const frag = appContext.vapor.vdomMountVNode(value, currentInstance);
|
|
3944
3974
|
if (isHydrating$1) {
|
|
3975
|
+
locateHydrationNode(shouldConsumeFragmentStart(value));
|
|
3945
3976
|
frag.hydrate();
|
|
3946
3977
|
if (_isLastInsertion) advanceHydrationNode(_insertionParent);
|
|
3947
3978
|
}
|
|
@@ -3965,7 +3996,14 @@ function withScopeOwner(owner, fn) {
|
|
|
3965
3996
|
setCurrentRenderingInstance(prev);
|
|
3966
3997
|
}
|
|
3967
3998
|
}
|
|
3968
|
-
|
|
3999
|
+
function shouldConsumeFragmentStart(vnode) {
|
|
4000
|
+
if (vnode.type === Fragment) return false;
|
|
4001
|
+
if (vnode.shapeFlag & 6) {
|
|
4002
|
+
const type = vnode.type;
|
|
4003
|
+
return !!type.__vapor && !type.__multiRoot;
|
|
4004
|
+
}
|
|
4005
|
+
return true;
|
|
4006
|
+
}
|
|
3969
4007
|
//#endregion
|
|
3970
4008
|
//#region packages/runtime-vapor/src/directives/vShow.ts
|
|
3971
4009
|
function applyVShow(target, source) {
|
|
@@ -4016,7 +4054,6 @@ function setDisplay(target, value) {
|
|
|
4016
4054
|
el[vShowHidden] = !value;
|
|
4017
4055
|
} else if (!!(process.env.NODE_ENV !== "production")) warn("v-show used on component with non-single-element root node and will be ignored.");
|
|
4018
4056
|
}
|
|
4019
|
-
|
|
4020
4057
|
//#endregion
|
|
4021
4058
|
//#region packages/runtime-vapor/src/directives/vModel.ts
|
|
4022
4059
|
function ensureMounted(cb) {
|
|
@@ -4064,7 +4101,6 @@ const applyDynamicModel = (el, get, set, modifiers) => {
|
|
|
4064
4101
|
else if (el.type === "radio") apply = applyRadioModel;
|
|
4065
4102
|
apply(el, get, set, modifiers);
|
|
4066
4103
|
};
|
|
4067
|
-
|
|
4068
4104
|
//#endregion
|
|
4069
4105
|
//#region packages/runtime-vapor/src/directives/custom.ts
|
|
4070
4106
|
function withVaporDirectives(node, dirs) {
|
|
@@ -4078,7 +4114,6 @@ function withVaporDirectives(node, dirs) {
|
|
|
4078
4114
|
if (ret) onScopeDispose(ret);
|
|
4079
4115
|
}
|
|
4080
4116
|
}
|
|
4081
|
-
|
|
4082
4117
|
//#endregion
|
|
4083
4118
|
//#region packages/runtime-vapor/src/components/TransitionGroup.ts
|
|
4084
4119
|
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -4087,7 +4122,7 @@ const decorate = (t) => {
|
|
|
4087
4122
|
delete t.props.mode;
|
|
4088
4123
|
return t;
|
|
4089
4124
|
};
|
|
4090
|
-
const
|
|
4125
|
+
const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVaporComponent({
|
|
4091
4126
|
name: "VaporTransitionGroup",
|
|
4092
4127
|
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
4093
4128
|
tag: String,
|
|
@@ -4106,11 +4141,10 @@ const VaporTransitionGroupImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
4106
4141
|
cssTransitionProps = resolveTransitionProps(props);
|
|
4107
4142
|
});
|
|
4108
4143
|
let prevChildren;
|
|
4109
|
-
let children;
|
|
4110
4144
|
const slottedBlock = slots.default && slots.default();
|
|
4111
4145
|
onBeforeUpdate(() => {
|
|
4112
4146
|
prevChildren = [];
|
|
4113
|
-
children = getTransitionBlocks(slottedBlock);
|
|
4147
|
+
const children = getTransitionBlocks(slottedBlock);
|
|
4114
4148
|
if (children) for (let i = 0; i < children.length; i++) {
|
|
4115
4149
|
const child = children[i];
|
|
4116
4150
|
if (isValidTransitionBlock(child)) {
|
|
@@ -4138,19 +4172,12 @@ const VaporTransitionGroupImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
4138
4172
|
movedChildren.forEach((c) => handleMovedChildren(getTransitionElement(c), moveClass));
|
|
4139
4173
|
prevChildren = [];
|
|
4140
4174
|
});
|
|
4141
|
-
|
|
4175
|
+
applyGroupTransitionHooks(slottedBlock, {
|
|
4142
4176
|
props: propsProxy,
|
|
4143
4177
|
state,
|
|
4144
|
-
instance
|
|
4178
|
+
instance,
|
|
4179
|
+
applyGroup: applyGroupTransitionHooks
|
|
4145
4180
|
});
|
|
4146
|
-
children = getTransitionBlocks(slottedBlock);
|
|
4147
|
-
for (let i = 0; i < children.length; i++) {
|
|
4148
|
-
const child = children[i];
|
|
4149
|
-
if (isValidTransitionBlock(child)) {
|
|
4150
|
-
if (child.$key != null) setTransitionHooks$1(child, resolveTransitionHooks(child, propsProxy, state, instance));
|
|
4151
|
-
else if (!!(process.env.NODE_ENV !== "production")) warn(`<transition-group> children must be keyed`);
|
|
4152
|
-
}
|
|
4153
|
-
}
|
|
4154
4181
|
const tag = props.tag;
|
|
4155
4182
|
if (tag) {
|
|
4156
4183
|
const container = /* @__PURE__ */ createElement(tag);
|
|
@@ -4158,8 +4185,19 @@ const VaporTransitionGroupImpl = /* @__PURE__ */ defineVaporComponent({
|
|
|
4158
4185
|
return container;
|
|
4159
4186
|
} else return slottedBlock;
|
|
4160
4187
|
}
|
|
4161
|
-
});
|
|
4162
|
-
|
|
4188
|
+
}));
|
|
4189
|
+
function applyGroupTransitionHooks(block, hooks) {
|
|
4190
|
+
setTransitionHooksOnFragment(block, hooks);
|
|
4191
|
+
const { props, state, instance } = hooks;
|
|
4192
|
+
const children = getTransitionBlocks(block);
|
|
4193
|
+
for (let i = 0; i < children.length; i++) {
|
|
4194
|
+
const child = children[i];
|
|
4195
|
+
if (isValidTransitionBlock(child)) {
|
|
4196
|
+
if (child.$key != null) setTransitionHooks$1(child, resolveTransitionHooks(child, props, state, instance));
|
|
4197
|
+
else if (!!(process.env.NODE_ENV !== "production")) warn(`<transition-group> children must be keyed`);
|
|
4198
|
+
}
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4163
4201
|
function getTransitionBlocks(block) {
|
|
4164
4202
|
let children = [];
|
|
4165
4203
|
if (block instanceof Node) children.push(block);
|
|
@@ -4193,6 +4231,5 @@ function getFirstConnectedChild(children) {
|
|
|
4193
4231
|
if (el.isConnected) return el;
|
|
4194
4232
|
}
|
|
4195
4233
|
}
|
|
4196
|
-
|
|
4197
4234
|
//#endregion
|
|
4198
|
-
export { DynamicFragment, VaporElement, VaporFragment, VaporKeepAlive, 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, useVaporCssVars, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
|
|
4235
|
+
export { DynamicFragment, VaporElement, VaporFragment, VaporKeepAlive, 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, useVaporCssVars, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/runtime-vapor",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.8",
|
|
4
4
|
"description": "@vue/runtime-vapor",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/runtime-vapor.esm-bundler.js",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/vuejs/core/tree/dev/packages/runtime-vapor#readme",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@vue/shared": "3.6.0-beta.
|
|
42
|
-
"@vue/reactivity": "3.6.0-beta.
|
|
41
|
+
"@vue/shared": "3.6.0-beta.8",
|
|
42
|
+
"@vue/reactivity": "3.6.0-beta.8"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@vue/runtime-dom": "3.6.0-beta.
|
|
45
|
+
"@vue/runtime-dom": "3.6.0-beta.8"
|
|
46
46
|
}
|
|
47
47
|
}
|