@vue/runtime-vapor 3.6.0-beta.12 → 3.6.0-beta.14
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 +52 -79
- package/dist/runtime-vapor.esm-bundler.js +1353 -922
- package/package.json +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-beta.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-beta.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { EffectScope, Fragment, NULL_DYNAMIC_COMPONENT, Static, TransitionPropsValidators, VaporSlot, 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, ensureValidVNode, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, normalizeVNode, onBeforeMount, 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, shouldUpdateComponent, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, withAsyncContext as withAsyncContext$1, withCtx, xlinkNS } from "@vue/runtime-dom";
|
|
6
|
+
import { EffectScope, Fragment, NULL_DYNAMIC_COMPONENT, Static, TransitionPropsValidators, VaporSlot, 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, ensureValidVNode, ensureVaporSlotFallback, expose, flushOnAppMount, forceReflow, getAttributeMismatch, getComponentName, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, handleError, handleMovedChildren, hasCSSTransform, initFeatureFlags, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMismatchAllowed, isRef, isSetEqual, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, matches, mergeProps, nextUid, normalizeContainer, normalizeRef, normalizeVNode, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onMounted, onScopeDispose, onUpdated, patchStyle, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popWarningContext, pushWarningContext, queueJob, queuePostFlushCb, registerHMR, renderSlot, resetShapeFlag, resolveComponent, resolveDynamicComponent, resolvePropValue, resolveTeleportTarget, resolveTransitionProps, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setRef, setTransitionHooks, setVarsOnNode, shallowReactive, shallowRef, shouldSetAsProp, shouldSetAsPropForVueCE, shouldUpdateComponent, simpleSetCurrentInstance, startMeasure, toClassSet, toStyleMap, unregisterHMR, unsafeToTrustedHTML, useAsyncComponentState, useTransitionState, vModelCheckboxInit, vModelCheckboxUpdate, vModelGetValue, vModelSelectInit, vModelSetSelected, vModelTextInit, vModelTextUpdate, vShowHidden, vShowOriginalDisplay, validateProps, warn, warnExtraneousAttributes, warnPropMismatch, watch, withAsyncContext as withAsyncContext$1, withCtx, withKeys, withModifiers, 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
|
-
import { EffectScope as EffectScope$1, ReactiveEffect, computed, effectScope, getCurrentScope, 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";
|
|
8
|
+
import { EffectScope as EffectScope$1, ReactiveEffect, computed, effectScope, getCurrentScope, isReactive, isReadonly, isRef as isRef$1, isShallow, markRaw, onEffectCleanup, onScopeDispose as onScopeDispose$1, pauseTracking, proxyRefs, resetTracking, setActiveSub, shallowReactive as shallowReactive$1, shallowReadArray, shallowRef as shallowRef$1, toRaw, toReactive, toReadonly, traverse, unref, watch as watch$1 } from "@vue/reactivity";
|
|
9
9
|
//#region packages/runtime-vapor/src/insertionState.ts
|
|
10
10
|
let insertionParent;
|
|
11
11
|
let insertionAnchor;
|
|
@@ -30,6 +30,7 @@ function resetInsertionState() {
|
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region packages/runtime-vapor/src/dom/hydration.ts
|
|
33
|
+
const START_TAG_RE = /^<([^\s/>]+)/;
|
|
33
34
|
let isHydratingEnabled = false;
|
|
34
35
|
function setIsHydratingEnabled(value) {
|
|
35
36
|
isHydratingEnabled = value;
|
|
@@ -152,18 +153,18 @@ function exitHydrationCursor(cursor) {
|
|
|
152
153
|
* Locate the first non-fragment-comment node and locate the next node
|
|
153
154
|
* while handling potential fragments.
|
|
154
155
|
*/
|
|
155
|
-
function adoptTemplateImpl(node, template) {
|
|
156
|
+
function adoptTemplateImpl(node, template, adoptChildren = false, ns) {
|
|
156
157
|
if (!(template[0] === "<" && template[1] === "!")) {
|
|
157
158
|
if (template.trim() === "" && isComment(node, "]") && isComment(node.previousSibling, "[")) node.before(node = /* @__PURE__ */ createTextNode());
|
|
158
159
|
node = resolveHydrationTarget(node);
|
|
159
160
|
}
|
|
160
161
|
const type = node.nodeType;
|
|
161
|
-
if (type === 8 && !template.startsWith("<!") || type === 1 && !template.startsWith(`<` + node.tagName.toLowerCase())) node = handleMismatch(node, template);
|
|
162
|
+
if (type === 8 && !template.startsWith("<!") || type === 1 && !template.startsWith(`<` + node.tagName.toLowerCase())) node = handleMismatch(node, template, adoptChildren, ns);
|
|
162
163
|
advanceHydrationNode(node);
|
|
163
164
|
return node;
|
|
164
165
|
}
|
|
165
|
-
function
|
|
166
|
-
return isComment(node, "[") ?
|
|
166
|
+
function nextLogicalSibling(node) {
|
|
167
|
+
return isComment(node, "[") ? locateEndAnchor(node).nextSibling : isComment(node, "teleport start") ? locateEndAnchor(node, "teleport start", "teleport end").nextSibling : node.nextSibling;
|
|
167
168
|
}
|
|
168
169
|
function locateHydrationNodeImpl(consumeFragmentStart = false) {
|
|
169
170
|
let node;
|
|
@@ -192,18 +193,15 @@ function locateHydrationBoundaryClose(node, closeHint = null) {
|
|
|
192
193
|
let close = closeHint;
|
|
193
194
|
if (!close || !isComment(close, "]")) if (isComment(node, "]")) close = node;
|
|
194
195
|
else {
|
|
195
|
-
let candidate =
|
|
196
|
-
while (candidate && !isComment(candidate, "]")) candidate =
|
|
196
|
+
let candidate = nextLogicalSibling(node);
|
|
197
|
+
while (candidate && !isComment(candidate, "]")) candidate = nextLogicalSibling(candidate);
|
|
197
198
|
close = candidate;
|
|
198
199
|
}
|
|
199
200
|
if (!close) return node;
|
|
200
201
|
return close;
|
|
201
202
|
}
|
|
202
|
-
function handleMismatch(node, template) {
|
|
203
|
-
|
|
204
|
-
(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);
|
|
205
|
-
logMismatchError();
|
|
206
|
-
}
|
|
203
|
+
function handleMismatch(node, template, adoptChildren, ns) {
|
|
204
|
+
warnHydrationNodeMismatch(node, template);
|
|
207
205
|
if (isComment(node, "[")) removeFragmentNodes(node);
|
|
208
206
|
const shouldPreserveAnchor = isHydrationAnchor(node);
|
|
209
207
|
const container = /* @__PURE__ */ parentNode(node);
|
|
@@ -211,17 +209,46 @@ function handleMismatch(node, template) {
|
|
|
211
209
|
if (!shouldPreserveAnchor) remove(node, container);
|
|
212
210
|
if (template[0] !== "<") return container.insertBefore(/* @__PURE__ */ createTextNode(template), next);
|
|
213
211
|
const t = /* @__PURE__ */ createElement("template");
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
let newNode;
|
|
213
|
+
if (ns) {
|
|
214
|
+
const tag = ns === 1 ? "svg" : "math";
|
|
215
|
+
t.innerHTML = `<${tag}>${template}</${tag}>`;
|
|
216
|
+
newNode = (/* @__PURE__ */ _child(/* @__PURE__ */ _child(t.content))).cloneNode(true);
|
|
217
|
+
} else {
|
|
218
|
+
t.innerHTML = template;
|
|
219
|
+
newNode = (/* @__PURE__ */ _child(t.content)).cloneNode(true);
|
|
220
|
+
}
|
|
221
|
+
if (adoptChildren && node.nodeType === 1 && !newNode.firstChild) {
|
|
222
|
+
let child = node.firstChild;
|
|
223
|
+
while (child) {
|
|
224
|
+
const nextChild = child.nextSibling;
|
|
225
|
+
newNode.appendChild(child);
|
|
226
|
+
child = nextChild;
|
|
227
|
+
}
|
|
221
228
|
}
|
|
222
229
|
container.insertBefore(newNode, next);
|
|
223
230
|
return newNode;
|
|
224
231
|
}
|
|
232
|
+
function validateHydrationTarget(node, template) {
|
|
233
|
+
let expectedType;
|
|
234
|
+
if (template[0] !== "<") expectedType = 3;
|
|
235
|
+
else if (template[1] === "!") expectedType = 8;
|
|
236
|
+
else expectedType = 1;
|
|
237
|
+
if (node.nodeType !== expectedType) {
|
|
238
|
+
warnHydrationNodeMismatch(node, template);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (expectedType !== 1) return;
|
|
242
|
+
const match = START_TAG_RE.exec(template);
|
|
243
|
+
const expectedTag = match && match[1];
|
|
244
|
+
if (expectedTag && node.tagName.toLowerCase() !== expectedTag.toLowerCase()) warnHydrationNodeMismatch(node, template);
|
|
245
|
+
}
|
|
246
|
+
function warnHydrationNodeMismatch(node, expected) {
|
|
247
|
+
if (!isMismatchAllowed(node.parentElement, 1)) {
|
|
248
|
+
(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:`, expected);
|
|
249
|
+
logMismatchError();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
225
252
|
let hasLoggedMismatchError = false;
|
|
226
253
|
const logMismatchError = () => {
|
|
227
254
|
if (hasLoggedMismatchError) return;
|
|
@@ -263,7 +290,7 @@ function cleanupHydrationTail(node, container) {
|
|
|
263
290
|
}
|
|
264
291
|
let current = node;
|
|
265
292
|
while (current && current.parentNode === container) {
|
|
266
|
-
const next =
|
|
293
|
+
const next = nextLogicalSibling(current);
|
|
267
294
|
removeHydrationNode(current);
|
|
268
295
|
current = next;
|
|
269
296
|
}
|
|
@@ -294,7 +321,7 @@ function finalizeHydrationBoundary(close) {
|
|
|
294
321
|
let hasRemovableNode = false;
|
|
295
322
|
while (cur && cur !== close) {
|
|
296
323
|
if (!isHydrationAnchor(cur)) hasRemovableNode = true;
|
|
297
|
-
cur =
|
|
324
|
+
cur = nextLogicalSibling(cur);
|
|
298
325
|
}
|
|
299
326
|
if (!cur) return;
|
|
300
327
|
if (!hasRemovableNode) {
|
|
@@ -303,7 +330,7 @@ function finalizeHydrationBoundary(close) {
|
|
|
303
330
|
}
|
|
304
331
|
warnHydrationChildrenMismatch(close.parentElement);
|
|
305
332
|
while (node && node !== close) {
|
|
306
|
-
const next =
|
|
333
|
+
const next = nextLogicalSibling(node);
|
|
307
334
|
if (!isHydrationAnchor(node)) removeHydrationNode(node, close);
|
|
308
335
|
node = next;
|
|
309
336
|
}
|
|
@@ -386,7 +413,7 @@ function locateChildByLogicalIndex(parent, logicalIndex) {
|
|
|
386
413
|
child.$idx = logicalIndex;
|
|
387
414
|
return parent.$llc = child;
|
|
388
415
|
}
|
|
389
|
-
child =
|
|
416
|
+
child = nextLogicalSibling(child);
|
|
390
417
|
fromIndex++;
|
|
391
418
|
}
|
|
392
419
|
return null;
|
|
@@ -440,6 +467,66 @@ function propGetter(rawProps, key) {
|
|
|
440
467
|
return rawProps[key] && resolveSource(rawProps[key]);
|
|
441
468
|
}
|
|
442
469
|
//#endregion
|
|
470
|
+
//#region packages/runtime-vapor/src/renderEffect.ts
|
|
471
|
+
var RenderEffect = class extends ReactiveEffect {
|
|
472
|
+
constructor(render, noLifecycle = false) {
|
|
473
|
+
super(noLifecycle ? render : void 0);
|
|
474
|
+
this.render = render;
|
|
475
|
+
const instance = currentInstance;
|
|
476
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.subs && !isVaporComponent(instance)) warn("renderEffect called without active EffectScope or Vapor instance.");
|
|
477
|
+
const job = () => {
|
|
478
|
+
if (this.dirty) this.run();
|
|
479
|
+
};
|
|
480
|
+
if (instance) {
|
|
481
|
+
if (!!(process.env.NODE_ENV !== "production") && !noLifecycle) {
|
|
482
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
483
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
484
|
+
}
|
|
485
|
+
if (!!(process.env.NODE_ENV !== "production")) (instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
486
|
+
job.i = instance;
|
|
487
|
+
}
|
|
488
|
+
this.job = job;
|
|
489
|
+
this.i = instance;
|
|
490
|
+
this.flags |= 128;
|
|
491
|
+
this.job.flags |= 2;
|
|
492
|
+
}
|
|
493
|
+
fn() {
|
|
494
|
+
const instance = this.i;
|
|
495
|
+
const scope = this.subs ? this.subs.sub : void 0;
|
|
496
|
+
const hasUpdateHooks = instance && (instance.bu || instance.u);
|
|
497
|
+
if (!!(process.env.NODE_ENV !== "production") && instance) startMeasure(instance, `renderEffect`);
|
|
498
|
+
const prev = setCurrentInstance(instance, scope);
|
|
499
|
+
try {
|
|
500
|
+
if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
|
|
501
|
+
instance.isUpdating = true;
|
|
502
|
+
try {
|
|
503
|
+
instance.bu && invokeArrayFns(instance.bu);
|
|
504
|
+
this.render();
|
|
505
|
+
} catch (err) {
|
|
506
|
+
instance.isUpdating = false;
|
|
507
|
+
throw err;
|
|
508
|
+
}
|
|
509
|
+
let updateJob = this.updateJob;
|
|
510
|
+
if (!updateJob) updateJob = this.updateJob = () => {
|
|
511
|
+
instance.isUpdating = false;
|
|
512
|
+
instance.u && invokeArrayFns(instance.u);
|
|
513
|
+
};
|
|
514
|
+
queuePostFlushCb(updateJob);
|
|
515
|
+
} else this.render();
|
|
516
|
+
} finally {
|
|
517
|
+
setCurrentInstance(...prev);
|
|
518
|
+
if (!!(process.env.NODE_ENV !== "production") && instance) endMeasure(instance, `renderEffect`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
notify() {
|
|
522
|
+
if (!(this.flags & 256)) queueJob(this.job, this.i ? this.i.uid : void 0);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
function renderEffect(fn, noLifecycle = false) {
|
|
526
|
+
if (inOnceSlot) return fn();
|
|
527
|
+
new RenderEffect(fn, noLifecycle).run();
|
|
528
|
+
}
|
|
529
|
+
//#endregion
|
|
443
530
|
//#region packages/runtime-vapor/src/componentProps.ts
|
|
444
531
|
function resolveSource(source) {
|
|
445
532
|
return isFunction(source) ? resolveFunctionSource(source) : source;
|
|
@@ -461,6 +548,36 @@ function resolveFunctionSource(source) {
|
|
|
461
548
|
}
|
|
462
549
|
return source();
|
|
463
550
|
}
|
|
551
|
+
function snapshotRawProps(rawProps) {
|
|
552
|
+
const snapshot = Object.create(null);
|
|
553
|
+
for (const key in rawProps) if (key !== "$") {
|
|
554
|
+
const value = resolveSource(rawProps[key]);
|
|
555
|
+
snapshot[key] = () => value;
|
|
556
|
+
}
|
|
557
|
+
const dynamicSources = rawProps.$;
|
|
558
|
+
if (dynamicSources) {
|
|
559
|
+
const snapshotSources = [];
|
|
560
|
+
for (let i = 0; i < dynamicSources.length; i++) {
|
|
561
|
+
const source = dynamicSources[i];
|
|
562
|
+
const value = Object.create(null);
|
|
563
|
+
if (isFunction(source)) {
|
|
564
|
+
const resolved = resolveFunctionSource(source);
|
|
565
|
+
for (const key in resolved) value[key] = resolved[key];
|
|
566
|
+
snapshotSources[i] = () => value;
|
|
567
|
+
} else {
|
|
568
|
+
for (const key in source) {
|
|
569
|
+
const resolved = resolveSource(source[key]);
|
|
570
|
+
value[key] = () => resolved;
|
|
571
|
+
}
|
|
572
|
+
snapshotSources[i] = value;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
const symbols = Object.getOwnPropertySymbols(dynamicSources);
|
|
576
|
+
for (let i = 0; i < symbols.length; i++) snapshotSources[symbols[i]] = dynamicSources[symbols[i]];
|
|
577
|
+
snapshot.$ = snapshotSources;
|
|
578
|
+
}
|
|
579
|
+
return snapshot;
|
|
580
|
+
}
|
|
464
581
|
function stabilizeDynamicSourceValue(oldValue, value) {
|
|
465
582
|
if (!isPlainObject(oldValue) || !isPlainObject(value)) return value;
|
|
466
583
|
const oldKeys = Object.keys(oldValue);
|
|
@@ -472,7 +589,7 @@ function stabilizeDynamicSourceValue(oldValue, value) {
|
|
|
472
589
|
}
|
|
473
590
|
return oldValue;
|
|
474
591
|
}
|
|
475
|
-
function getPropsProxyHandlers(comp
|
|
592
|
+
function getPropsProxyHandlers(comp) {
|
|
476
593
|
if (comp.__propsHandlers) return comp.__propsHandlers;
|
|
477
594
|
const propsOptions = normalizePropsOptions(comp)[0];
|
|
478
595
|
const emitsOptions = normalizeEmitsOptions(comp);
|
|
@@ -490,7 +607,7 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
490
607
|
source = dynamicSources[i];
|
|
491
608
|
isDynamic = isFunction(source);
|
|
492
609
|
source = isDynamic ? resolveFunctionSource(source) : source;
|
|
493
|
-
for (rawKey in source) if (camelize(rawKey) === key) return resolvePropValue(propsOptions, key, isDynamic ? source[rawKey] :
|
|
610
|
+
for (rawKey in source) if (camelize(rawKey) === key) return resolvePropValue(propsOptions, key, isDynamic ? source[rawKey] : resolveSource(source[rawKey]), instance, resolveDefault);
|
|
494
611
|
}
|
|
495
612
|
}
|
|
496
613
|
for (const rawKey in rawProps) if (camelize(rawKey) === key) return resolvePropValue(propsOptions, key, resolveSource(rawProps[rawKey]), instance, resolveDefault);
|
|
@@ -498,8 +615,8 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
498
615
|
};
|
|
499
616
|
const withOnceCache = (getter) => {
|
|
500
617
|
return ((instance, key) => {
|
|
501
|
-
const cache = instance.oncePropsCache || (instance.oncePropsCache =
|
|
502
|
-
if (!(key
|
|
618
|
+
const cache = instance.oncePropsCache || (instance.oncePropsCache = Object.create(null));
|
|
619
|
+
if (!hasOwn(cache, key)) {
|
|
503
620
|
pauseTracking();
|
|
504
621
|
try {
|
|
505
622
|
cache[key] = getter(instance, key);
|
|
@@ -511,15 +628,16 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
511
628
|
});
|
|
512
629
|
};
|
|
513
630
|
const getOnceProp = withOnceCache(getProp);
|
|
631
|
+
const getMaybeOnceProp = (instance, key) => (instance.isOnce ? getOnceProp : getProp)(instance, key);
|
|
514
632
|
const propsHandlers = propsOptions ? {
|
|
515
|
-
get:
|
|
633
|
+
get: getMaybeOnceProp,
|
|
516
634
|
has: (_, key) => isProp(key),
|
|
517
635
|
ownKeys: () => Object.keys(propsOptions),
|
|
518
636
|
getOwnPropertyDescriptor(target, key) {
|
|
519
637
|
if (isProp(key)) return {
|
|
520
638
|
configurable: true,
|
|
521
639
|
enumerable: true,
|
|
522
|
-
get: () => (
|
|
640
|
+
get: () => getMaybeOnceProp(target, key)
|
|
523
641
|
};
|
|
524
642
|
}
|
|
525
643
|
} : null;
|
|
@@ -535,15 +653,36 @@ function getPropsProxyHandlers(comp, once) {
|
|
|
535
653
|
else return false;
|
|
536
654
|
};
|
|
537
655
|
const getOnceAttr = withOnceCache((instance, key) => getAttr(instance.rawProps, key));
|
|
656
|
+
const onceAttrKeys = Symbol();
|
|
657
|
+
const getAttrKeys = (target) => getKeysFromRawProps(target.rawProps).filter(isAttr);
|
|
658
|
+
const getOnceAttrKeys = (target) => {
|
|
659
|
+
const cache = target.oncePropsCache || (target.oncePropsCache = Object.create(null));
|
|
660
|
+
if (!hasOwn(cache, onceAttrKeys)) {
|
|
661
|
+
pauseTracking();
|
|
662
|
+
try {
|
|
663
|
+
const keys = getAttrKeys(target);
|
|
664
|
+
cache[onceAttrKeys] = keys;
|
|
665
|
+
for (let i = 0; i < keys.length; i++) {
|
|
666
|
+
const key = keys[i];
|
|
667
|
+
if (!hasOwn(cache, key)) cache[key] = getAttr(target.rawProps, key);
|
|
668
|
+
}
|
|
669
|
+
} finally {
|
|
670
|
+
resetTracking();
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return cache[onceAttrKeys];
|
|
674
|
+
};
|
|
675
|
+
const getMaybeOnceAttrKeys = (target) => target.isOnce ? getOnceAttrKeys(target) : getAttrKeys(target);
|
|
676
|
+
const getMaybeOnceAttr = (instance, key) => instance.isOnce ? getOnceAttrKeys(instance).includes(key) ? getOnceAttr(instance, key) : void 0 : getAttr(instance.rawProps, key);
|
|
538
677
|
const attrsHandlers = {
|
|
539
|
-
get:
|
|
540
|
-
has: (target, key) => hasAttr(target.rawProps, key),
|
|
541
|
-
ownKeys:
|
|
678
|
+
get: getMaybeOnceAttr,
|
|
679
|
+
has: (target, key) => target.isOnce ? getOnceAttrKeys(target).includes(key) : hasAttr(target.rawProps, key),
|
|
680
|
+
ownKeys: getMaybeOnceAttrKeys,
|
|
542
681
|
getOwnPropertyDescriptor(target, key) {
|
|
543
|
-
if (isString(key) && hasAttr(target.rawProps, key)) return {
|
|
682
|
+
if (isString(key) && (target.isOnce ? getOnceAttrKeys(target).includes(key) : hasAttr(target.rawProps, key))) return {
|
|
544
683
|
configurable: true,
|
|
545
684
|
enumerable: true,
|
|
546
|
-
get: () =>
|
|
685
|
+
get: () => getMaybeOnceAttr(target, key)
|
|
547
686
|
};
|
|
548
687
|
}
|
|
549
688
|
};
|
|
@@ -565,7 +704,7 @@ function getAttrFromRawProps(rawProps, key) {
|
|
|
565
704
|
isDynamic = isFunction(source);
|
|
566
705
|
source = isDynamic ? resolveFunctionSource(source) : source;
|
|
567
706
|
if (source && hasOwn(source, key)) {
|
|
568
|
-
const value = isDynamic ? source[key] :
|
|
707
|
+
const value = isDynamic ? source[key] : resolveSource(source[key]);
|
|
569
708
|
if (merged) merged.push(value);
|
|
570
709
|
else return value;
|
|
571
710
|
}
|
|
@@ -647,7 +786,7 @@ function resolveDynamicProps(props) {
|
|
|
647
786
|
const isDynamic = isFunction(source);
|
|
648
787
|
const resolved = isDynamic ? resolveFunctionSource(source) : source;
|
|
649
788
|
for (const key in resolved) {
|
|
650
|
-
const value = isDynamic ? resolved[key] :
|
|
789
|
+
const value = isDynamic ? resolved[key] : resolveSource(source[key]);
|
|
651
790
|
if (key === "class" || key === "style") {
|
|
652
791
|
const existing = mergedRawProps[key];
|
|
653
792
|
if (isArray(existing)) existing.push(value);
|
|
@@ -687,18 +826,23 @@ function on(el, event, handler, options = {}) {
|
|
|
687
826
|
if (isArray(handler)) handler.forEach((fn) => on(el, event, fn, options));
|
|
688
827
|
else {
|
|
689
828
|
if (!handler) return;
|
|
690
|
-
addEventListener(el, event, handler, options);
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
829
|
+
addEventListener(el, event, createInvoker(handler), options);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
function onBinding(el, event, handler, options = {}) {
|
|
833
|
+
if (isArray(handler)) handler.forEach((fn) => onBinding(el, event, fn, options));
|
|
834
|
+
else {
|
|
835
|
+
if (!handler) return;
|
|
836
|
+
onEffectCleanup(addEventListener(el, event, createInvoker(handler), options));
|
|
694
837
|
}
|
|
695
838
|
}
|
|
696
839
|
function delegate(el, event, handler) {
|
|
697
840
|
const key = `$evt${event}`;
|
|
698
841
|
const existing = el[key];
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
else el[key] =
|
|
842
|
+
const invoker = createInvoker(handler);
|
|
843
|
+
if (existing) if (isArray(existing)) existing.push(invoker);
|
|
844
|
+
else el[key] = [existing, invoker];
|
|
845
|
+
else el[key] = invoker;
|
|
702
846
|
}
|
|
703
847
|
/**
|
|
704
848
|
* Event delegation borrowed from solid
|
|
@@ -737,7 +881,13 @@ const delegatedEventHandler = (e) => {
|
|
|
737
881
|
}
|
|
738
882
|
};
|
|
739
883
|
function setDynamicEvents(el, events) {
|
|
740
|
-
for (const name in events)
|
|
884
|
+
for (const name in events) onBinding(el, name, events[name]);
|
|
885
|
+
}
|
|
886
|
+
function withVaporModifiers(fn, modifiers) {
|
|
887
|
+
return createInvoker(typeof fn === "function" ? withModifiers(fn, modifiers) : fn);
|
|
888
|
+
}
|
|
889
|
+
function withVaporKeys(fn, modifiers) {
|
|
890
|
+
return createInvoker(typeof fn === "function" ? withKeys(fn, modifiers) : fn);
|
|
741
891
|
}
|
|
742
892
|
function createInvoker(handler) {
|
|
743
893
|
const i = currentInstance;
|
|
@@ -745,13 +895,16 @@ function createInvoker(handler) {
|
|
|
745
895
|
}
|
|
746
896
|
//#endregion
|
|
747
897
|
//#region packages/runtime-vapor/src/dom/prop.ts
|
|
748
|
-
const
|
|
898
|
+
const shouldSkipFallthroughKey = (el, key) => {
|
|
899
|
+
const instance = currentInstance;
|
|
900
|
+
return !isApplyingFallthroughProps && el.$root && instance.hasFallthrough && instance.type.inheritAttrs !== false && key in instance.attrs;
|
|
901
|
+
};
|
|
749
902
|
function setProp(el, key, value) {
|
|
750
903
|
if (key in el) setDOMProp(el, key, value);
|
|
751
904
|
else setAttr(el, key, value);
|
|
752
905
|
}
|
|
753
906
|
function setAttr(el, key, value, isSVG = false) {
|
|
754
|
-
if (
|
|
907
|
+
if (shouldSkipFallthroughKey(el, key)) return;
|
|
755
908
|
if (key === "true-value") el._trueValue = value;
|
|
756
909
|
else if (key === "false-value") el._falseValue = value;
|
|
757
910
|
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating$1 && !attributeHasMismatch(el, key, value)) {
|
|
@@ -767,7 +920,7 @@ function setAttr(el, key, value, isSVG = false) {
|
|
|
767
920
|
}
|
|
768
921
|
}
|
|
769
922
|
function setDOMProp(el, key, value, forceHydrate = false, attrName) {
|
|
770
|
-
if (
|
|
923
|
+
if (shouldSkipFallthroughKey(el, key)) return;
|
|
771
924
|
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating$1 && !attributeHasMismatch(el, key, value) && !shouldForceHydrate(el, key) && !forceHydrate) return;
|
|
772
925
|
const prev = el[key];
|
|
773
926
|
if (value === prev) return;
|
|
@@ -885,7 +1038,7 @@ function setStyleIncremental(el, value) {
|
|
|
885
1038
|
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
886
1039
|
}
|
|
887
1040
|
function setValue(el, value, forceHydrate = false) {
|
|
888
|
-
if (
|
|
1041
|
+
if (shouldSkipFallthroughKey(el, "value")) return;
|
|
889
1042
|
el._value = value;
|
|
890
1043
|
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating$1 && !attributeHasMismatch(el, "value", getClientText(el, value)) && !shouldForceHydrate(el, "value") && !forceHydrate) return;
|
|
891
1044
|
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
@@ -990,8 +1143,10 @@ function setDynamicProp(el, key, value, isSVG = false) {
|
|
|
990
1143
|
let forceHydrate = false;
|
|
991
1144
|
if (key === "class") setClass(el, value, isSVG);
|
|
992
1145
|
else if (key === "style") setStyle(el, value);
|
|
993
|
-
else if (isOn(key))
|
|
994
|
-
|
|
1146
|
+
else if (isOn(key)) {
|
|
1147
|
+
if (shouldSkipFallthroughKey(el, key)) return;
|
|
1148
|
+
onBinding(el, key[2].toLowerCase() + key.slice(3), value);
|
|
1149
|
+
} else if ((forceHydrate = key[0] === ".") ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, value, isSVG)) if (key === "innerHTML") setHtml(el, value);
|
|
995
1150
|
else if (key === "textContent") setElementText(el, value);
|
|
996
1151
|
else if (key === "value" && canSetValueDirectly(el.tagName)) setValue(el, value, forceHydrate);
|
|
997
1152
|
else setDOMProp(el, key, value, forceHydrate);
|
|
@@ -1024,9 +1179,10 @@ function classHasMismatch(el, expected, isIncremental) {
|
|
|
1024
1179
|
if (expected) hasMismatch = Array.from(expectedClassSet).some((cls) => !actualClassSet.has(cls));
|
|
1025
1180
|
} else hasMismatch = !isSetEqual(actualClassSet, expectedClassSet);
|
|
1026
1181
|
if (hasMismatch) {
|
|
1027
|
-
warnPropMismatch(el, "class", 2, actual, expected)
|
|
1028
|
-
|
|
1029
|
-
|
|
1182
|
+
if (warnPropMismatch(el, "class", 2, actual, expected)) {
|
|
1183
|
+
logMismatchError();
|
|
1184
|
+
return true;
|
|
1185
|
+
}
|
|
1030
1186
|
}
|
|
1031
1187
|
return false;
|
|
1032
1188
|
}
|
|
@@ -1042,9 +1198,10 @@ function styleHasMismatch(el, value, normalizedValue, isIncremental, instance =
|
|
|
1042
1198
|
if (expected) hasMismatch = Array.from(expectedStyleMap.entries()).some(([key, val]) => actualStyleMap.get(key) !== val);
|
|
1043
1199
|
} else hasMismatch = !isMapEqual(actualStyleMap, expectedStyleMap);
|
|
1044
1200
|
if (hasMismatch) {
|
|
1045
|
-
warnPropMismatch(el, "style", 3, actual, expected)
|
|
1046
|
-
|
|
1047
|
-
|
|
1201
|
+
if (warnPropMismatch(el, "style", 3, actual, expected)) {
|
|
1202
|
+
logMismatchError();
|
|
1203
|
+
return true;
|
|
1204
|
+
}
|
|
1048
1205
|
}
|
|
1049
1206
|
return false;
|
|
1050
1207
|
}
|
|
@@ -1067,9 +1224,10 @@ function attributeHasMismatch(el, key, value) {
|
|
|
1067
1224
|
if (isValidHtmlOrSvgAttribute(el, key)) {
|
|
1068
1225
|
const { actual, expected } = getAttributeMismatch(el, key, value);
|
|
1069
1226
|
if (actual !== expected) {
|
|
1070
|
-
warnPropMismatch(el, key, 4, actual, expected)
|
|
1071
|
-
|
|
1072
|
-
|
|
1227
|
+
if (warnPropMismatch(el, key, 4, actual, expected)) {
|
|
1228
|
+
logMismatchError();
|
|
1229
|
+
return true;
|
|
1230
|
+
}
|
|
1073
1231
|
}
|
|
1074
1232
|
}
|
|
1075
1233
|
return false;
|
|
@@ -1088,22 +1246,77 @@ function setScopeId(block, scopeIds) {
|
|
|
1088
1246
|
if (block instanceof Element) for (const id of scopeIds) block.setAttribute(id, "");
|
|
1089
1247
|
else if (isVaporComponent(block)) setScopeId(block.block, scopeIds);
|
|
1090
1248
|
else if (isArray(block)) for (const b of block) setScopeId(b, scopeIds);
|
|
1091
|
-
else if (isFragment(block))
|
|
1249
|
+
else if (isFragment(block)) {
|
|
1250
|
+
trackScopeIdFragment(block, scopeIds, false);
|
|
1251
|
+
setScopeId(block.nodes, scopeIds);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
const trackedScopeIdFragments = /* @__PURE__ */ new WeakMap();
|
|
1255
|
+
function trackScopeIdFragment(frag, scopeIds, recursive = true) {
|
|
1256
|
+
if (isInteropEnabled && isInteropFragment(frag)) setInteropFragmentScopeIds(frag, scopeIds);
|
|
1257
|
+
else if (trackFragmentScopeIds(frag, scopeIds)) (frag.onBeforeInsert || (frag.onBeforeInsert = [])).push((nodes) => setScopeId(nodes, scopeIds));
|
|
1258
|
+
if (recursive) trackScopeIdsInBlock(frag.nodes, scopeIds);
|
|
1259
|
+
}
|
|
1260
|
+
function trackFragmentScopeIds(frag, scopeIds) {
|
|
1261
|
+
const key = scopeIds.join(" ");
|
|
1262
|
+
let trackedScopeIds = trackedScopeIdFragments.get(frag);
|
|
1263
|
+
if (!trackedScopeIds) {
|
|
1264
|
+
trackedScopeIds = /* @__PURE__ */ new Set();
|
|
1265
|
+
trackedScopeIdFragments.set(frag, trackedScopeIds);
|
|
1266
|
+
} else if (trackedScopeIds.has(key)) return false;
|
|
1267
|
+
trackedScopeIds.add(key);
|
|
1268
|
+
return true;
|
|
1269
|
+
}
|
|
1270
|
+
function setInteropFragmentScopeIds(frag, scopeIds) {
|
|
1271
|
+
const vnode = frag.vnode;
|
|
1272
|
+
if (!vnode) return;
|
|
1273
|
+
const existing = vnode.slotScopeIds;
|
|
1274
|
+
if (!existing) {
|
|
1275
|
+
vnode.slotScopeIds = scopeIds;
|
|
1276
|
+
return;
|
|
1277
|
+
}
|
|
1278
|
+
for (let i = 0; i < scopeIds.length; i++) if (!existing.includes(scopeIds[i])) existing.push(scopeIds[i]);
|
|
1279
|
+
}
|
|
1280
|
+
function trackScopeIdsInBlock(block, scopeIds) {
|
|
1281
|
+
if (isVaporComponent(block)) trackScopeIdsInBlock(block.block, scopeIds);
|
|
1282
|
+
else if (isArray(block)) for (const b of block) trackScopeIdsInBlock(b, scopeIds);
|
|
1283
|
+
else if (isFragment(block)) trackScopeIdFragment(block, scopeIds);
|
|
1284
|
+
}
|
|
1285
|
+
const trackedInheritedScopeIdFragments = /* @__PURE__ */ new WeakMap();
|
|
1286
|
+
function trackInheritedScopeIdFragment(instance, frag) {
|
|
1287
|
+
let trackedInstances = trackedInheritedScopeIdFragments.get(frag);
|
|
1288
|
+
if (!trackedInstances) {
|
|
1289
|
+
trackedInstances = /* @__PURE__ */ new WeakSet();
|
|
1290
|
+
trackedInheritedScopeIdFragments.set(frag, trackedInstances);
|
|
1291
|
+
} else if (trackedInstances.has(instance)) return;
|
|
1292
|
+
trackedInstances.add(instance);
|
|
1293
|
+
(frag.onUpdated || (frag.onUpdated = [])).push(() => applyInheritedScopeIdToRoot(instance));
|
|
1294
|
+
}
|
|
1295
|
+
function applyInheritedScopeIdToRoot(instance) {
|
|
1296
|
+
const { scopeId } = instance;
|
|
1297
|
+
if (!scopeId) return;
|
|
1298
|
+
const root = getRootElement(instance, (frag) => trackInheritedScopeIdFragment(instance, frag));
|
|
1299
|
+
if (root) root.setAttribute(scopeId, "");
|
|
1300
|
+
return root;
|
|
1301
|
+
}
|
|
1302
|
+
function trackComponentScopeId(instance) {
|
|
1303
|
+
const { parent, scopeId } = instance;
|
|
1304
|
+
if (!parent || !scopeId) return;
|
|
1305
|
+
getRootElement(instance, (frag) => trackInheritedScopeIdFragment(instance, frag));
|
|
1092
1306
|
}
|
|
1093
1307
|
function setComponentScopeId(instance) {
|
|
1094
1308
|
const { parent, scopeId } = instance;
|
|
1095
1309
|
if (!parent || !scopeId) return;
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if (parentScopeId !== scopeId) scopeIds.push(scopeId);
|
|
1100
|
-
else if (parentScopeId) scopeIds.push(parentScopeId);
|
|
1101
|
-
if (isInteropEnabled && parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
|
|
1102
|
-
scopeIds.push(parent.vnode.scopeId);
|
|
1310
|
+
const root = applyInheritedScopeIdToRoot(instance);
|
|
1311
|
+
if (isInteropEnabled && root && parent.subTree && parent.subTree.component === instance && parent.vnode.scopeId) {
|
|
1312
|
+
root.setAttribute(parent.vnode.scopeId, "");
|
|
1103
1313
|
const inheritedScopeIds = getInheritedScopeIds(parent.vnode, parent.parent);
|
|
1104
|
-
|
|
1314
|
+
for (let i = 0; i < inheritedScopeIds.length; i++) root.setAttribute(inheritedScopeIds[i], "");
|
|
1105
1315
|
}
|
|
1106
|
-
|
|
1316
|
+
}
|
|
1317
|
+
function getCurrentScopeId() {
|
|
1318
|
+
const scopeOwner = getScopeOwner();
|
|
1319
|
+
return scopeOwner ? scopeOwner.type.__scopeId : void 0;
|
|
1107
1320
|
}
|
|
1108
1321
|
//#endregion
|
|
1109
1322
|
//#region packages/runtime-vapor/src/componentSlots.ts
|
|
@@ -1112,6 +1325,15 @@ function setComponentScopeId(instance) {
|
|
|
1112
1325
|
* When true, renderEffect should skip creating reactive effect.
|
|
1113
1326
|
*/
|
|
1114
1327
|
let inOnceSlot = false;
|
|
1328
|
+
function withOnceSlot(fn, value = true) {
|
|
1329
|
+
const prev = inOnceSlot;
|
|
1330
|
+
try {
|
|
1331
|
+
inOnceSlot = value;
|
|
1332
|
+
return fn();
|
|
1333
|
+
} finally {
|
|
1334
|
+
inOnceSlot = prev;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1115
1337
|
/**
|
|
1116
1338
|
* Current slot scopeIds for vdom interop
|
|
1117
1339
|
*/
|
|
@@ -1123,6 +1345,36 @@ function setCurrentSlotScopeIds(scopeIds) {
|
|
|
1123
1345
|
currentSlotScopeIds = scopeIds;
|
|
1124
1346
|
}
|
|
1125
1347
|
}
|
|
1348
|
+
const rawSlotsOwnerMap = /* @__PURE__ */ new WeakMap();
|
|
1349
|
+
const rawSlotWrappersCache = /* @__PURE__ */ new WeakMap();
|
|
1350
|
+
function normalizeRawSlots(rawSlots) {
|
|
1351
|
+
if (!rawSlots) return rawSlots;
|
|
1352
|
+
const normalized = isFunction(rawSlots) ? { default: rawSlots } : rawSlots;
|
|
1353
|
+
if (!rawSlotsOwnerMap.has(normalized)) rawSlotsOwnerMap.set(normalized, getScopeOwner());
|
|
1354
|
+
return normalized;
|
|
1355
|
+
}
|
|
1356
|
+
function withSlotOwner(slots, fn) {
|
|
1357
|
+
if (!rawSlotsOwnerMap.has(slots)) return fn();
|
|
1358
|
+
const prevOwner = setCurrentSlotOwner(rawSlotsOwnerMap.get(slots) || null);
|
|
1359
|
+
try {
|
|
1360
|
+
return fn();
|
|
1361
|
+
} finally {
|
|
1362
|
+
setCurrentSlotOwner(prevOwner);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
function getOwnedSlot(slots, key, slot) {
|
|
1366
|
+
if (!rawSlotsOwnerMap.has(slots)) return slot;
|
|
1367
|
+
let wrappers = rawSlotWrappersCache.get(slots);
|
|
1368
|
+
if (!wrappers) rawSlotWrappersCache.set(slots, wrappers = /* @__PURE__ */ new Map());
|
|
1369
|
+
const cached = wrappers.get(key);
|
|
1370
|
+
if (cached && cached.slot === slot) return cached.wrapped;
|
|
1371
|
+
const wrapped = ((...args) => withSlotOwner(slots, () => slot(...args)));
|
|
1372
|
+
wrappers.set(key, {
|
|
1373
|
+
slot,
|
|
1374
|
+
wrapped
|
|
1375
|
+
});
|
|
1376
|
+
return wrapped;
|
|
1377
|
+
}
|
|
1126
1378
|
const dynamicSlotsProxyHandlers = {
|
|
1127
1379
|
get: getSlot,
|
|
1128
1380
|
has: (target, key) => !!getSlot(target, key),
|
|
@@ -1135,17 +1387,14 @@ const dynamicSlotsProxyHandlers = {
|
|
|
1135
1387
|
};
|
|
1136
1388
|
},
|
|
1137
1389
|
ownKeys(target) {
|
|
1138
|
-
|
|
1390
|
+
const keys = new Set(Object.keys(target).filter((k) => k !== "$"));
|
|
1139
1391
|
const dynamicSources = target.$;
|
|
1140
|
-
if (dynamicSources) {
|
|
1141
|
-
|
|
1142
|
-
for (const
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
} else keys.push(...Object.keys(source));
|
|
1147
|
-
}
|
|
1148
|
-
return keys;
|
|
1392
|
+
if (dynamicSources) for (const source of dynamicSources) if (isFunction(source)) {
|
|
1393
|
+
const slot = withSlotOwner(target, () => resolveFunctionSource(source));
|
|
1394
|
+
if (slot) if (isArray(slot)) for (const s of slot) keys.add(String(s.name));
|
|
1395
|
+
else keys.add(String(slot.name));
|
|
1396
|
+
} else for (const key of Object.keys(source)) keys.add(key);
|
|
1397
|
+
return [...keys];
|
|
1149
1398
|
},
|
|
1150
1399
|
set: NO,
|
|
1151
1400
|
deleteProperty: NO
|
|
@@ -1159,16 +1408,16 @@ function getSlot(target, key) {
|
|
|
1159
1408
|
while (i--) {
|
|
1160
1409
|
source = dynamicSources[i];
|
|
1161
1410
|
if (isFunction(source)) {
|
|
1162
|
-
const slot = resolveFunctionSource(source);
|
|
1411
|
+
const slot = withSlotOwner(target, () => resolveFunctionSource(source));
|
|
1163
1412
|
if (slot) {
|
|
1164
1413
|
if (isArray(slot)) {
|
|
1165
|
-
for (let j = slot.length - 1; j >= 0; j--) if (String(slot[j].name) === key) return slot[j].fn;
|
|
1166
|
-
} else if (String(slot.name) === key) return slot.fn;
|
|
1414
|
+
for (let j = slot.length - 1; j >= 0; j--) if (String(slot[j].name) === key) return getOwnedSlot(target, key, slot[j].fn);
|
|
1415
|
+
} else if (String(slot.name) === key) return getOwnedSlot(target, key, slot.fn);
|
|
1167
1416
|
}
|
|
1168
|
-
} else if (hasOwn(source, key)) return source[key];
|
|
1417
|
+
} else if (hasOwn(source, key)) return getOwnedSlot(target, key, source[key]);
|
|
1169
1418
|
}
|
|
1170
1419
|
}
|
|
1171
|
-
if (hasOwn(target, key)) return target[key];
|
|
1420
|
+
if (hasOwn(target, key)) return getOwnedSlot(target, key, target[key]);
|
|
1172
1421
|
}
|
|
1173
1422
|
/**
|
|
1174
1423
|
* Tracks the slot owner (the component that defines the slot content).
|
|
@@ -1191,25 +1440,7 @@ function setCurrentSlotOwner(owner) {
|
|
|
1191
1440
|
function getScopeOwner() {
|
|
1192
1441
|
return currentSlotOwner || currentInstance;
|
|
1193
1442
|
}
|
|
1194
|
-
|
|
1195
|
-
* Wrap a slot function to track the slot owner.
|
|
1196
|
-
*
|
|
1197
|
-
* This ensures:
|
|
1198
|
-
* 1. createSlot gets rawSlots from the correct instance (slot owner)
|
|
1199
|
-
* 2. elements inherit the slot owner's scopeId
|
|
1200
|
-
*/
|
|
1201
|
-
function withVaporCtx(fn) {
|
|
1202
|
-
const owner = getScopeOwner();
|
|
1203
|
-
return (...args) => {
|
|
1204
|
-
const prevOwner = setCurrentSlotOwner(owner);
|
|
1205
|
-
try {
|
|
1206
|
-
return fn(...args);
|
|
1207
|
-
} finally {
|
|
1208
|
-
setCurrentSlotOwner(prevOwner);
|
|
1209
|
-
}
|
|
1210
|
-
};
|
|
1211
|
-
}
|
|
1212
|
-
function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
1443
|
+
function createSlot(name = "default", rawProps, fallback, flags = 0) {
|
|
1213
1444
|
if (isInteropEnabled && isCollectingVdomSlotVNodes) return;
|
|
1214
1445
|
const _insertionParent = insertionParent;
|
|
1215
1446
|
const _insertionAnchor = insertionAnchor;
|
|
@@ -1217,25 +1448,42 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1217
1448
|
let hydrationCursor = null;
|
|
1218
1449
|
const instance = getScopeOwner();
|
|
1219
1450
|
const rawSlots = instance.rawSlots;
|
|
1220
|
-
const
|
|
1221
|
-
const scopeId = !noSlotted && instance.type.__scopeId;
|
|
1451
|
+
const scopeId = !(flags & 1) && instance.type.__scopeId;
|
|
1222
1452
|
const slotScopeIds = scopeId ? [`${scopeId}-s`] : null;
|
|
1453
|
+
const once = !!(flags & 2);
|
|
1454
|
+
const slotRoot = !!(flags & 4);
|
|
1455
|
+
const slotProps = rawProps ? new Proxy(once ? snapshotRawProps(rawProps) : rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
1456
|
+
if (once && fallback) {
|
|
1457
|
+
const originalFallback = fallback;
|
|
1458
|
+
fallback = (...args) => withOnceSlot(() => originalFallback(...args));
|
|
1459
|
+
}
|
|
1223
1460
|
let fragment;
|
|
1224
1461
|
if (isRef(rawSlots._) && isInteropEnabled) {
|
|
1225
1462
|
if (isHydrating$1) hydrationCursor = enterHydrationCursor();
|
|
1226
|
-
fragment = instance.appContext.vapor.vdomSlot(rawSlots._, name, slotProps, instance, fallback);
|
|
1463
|
+
fragment = instance.appContext.vapor.vdomSlot(rawSlots._, name, slotProps, instance, fallback, once, slotRoot);
|
|
1227
1464
|
} else {
|
|
1228
1465
|
if (isHydrating$1) hydrationCursor = captureHydrationCursor();
|
|
1229
|
-
const
|
|
1230
|
-
slotFragment
|
|
1466
|
+
const isCustomElementSlot = !!(instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce);
|
|
1467
|
+
const slotFragment = isHydrating$1 || !!fallback || !!getCurrentSlotBoundary() || isCustomElementSlot ? new SlotFragment(slotRoot) : void 0;
|
|
1468
|
+
let dynamicFragment;
|
|
1469
|
+
if (slotFragment) {
|
|
1470
|
+
fragment = slotFragment;
|
|
1471
|
+
if (isHydrating$1) slotFragment.forwarded = currentSlotOwner != null && currentSlotOwner !== currentInstance;
|
|
1472
|
+
} else {
|
|
1473
|
+
dynamicFragment = new DynamicFragment(!!(process.env.NODE_ENV !== "production") ? "slot" : void 0, false, false);
|
|
1474
|
+
dynamicFragment.isSlot = true;
|
|
1475
|
+
fragment = dynamicFragment;
|
|
1476
|
+
}
|
|
1231
1477
|
const isDynamicName = isFunction(name);
|
|
1232
1478
|
const renderSlot = () => {
|
|
1233
1479
|
const slotName = isFunction(name) ? name() : name;
|
|
1234
|
-
if (
|
|
1480
|
+
if (isCustomElementSlot) {
|
|
1235
1481
|
const el = /* @__PURE__ */ createElement("slot");
|
|
1236
|
-
|
|
1482
|
+
const setSlotProps = () => {
|
|
1237
1483
|
setDynamicProps(el, [slotProps, slotName !== "default" ? { name: slotName } : {}]);
|
|
1238
|
-
}
|
|
1484
|
+
};
|
|
1485
|
+
if (once) setSlotProps();
|
|
1486
|
+
else renderEffect(setSlotProps);
|
|
1239
1487
|
if (fallback) withOwnedSlotBoundary(slotFragment.parentSlotBoundary, () => {
|
|
1240
1488
|
const fallbackBlock = fallback();
|
|
1241
1489
|
slotFragment.customElementFallback = fallbackBlock;
|
|
@@ -1245,8 +1493,10 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1245
1493
|
return;
|
|
1246
1494
|
}
|
|
1247
1495
|
const slot = getSlot(rawSlots, slotName);
|
|
1248
|
-
if (slot) slotFragment.updateSlot(getBoundSlot(slot), fallback);
|
|
1249
|
-
else
|
|
1496
|
+
if (slot) if (slotFragment) slotFragment.updateSlot(getBoundSlot(slot), fallback);
|
|
1497
|
+
else dynamicFragment.update(getBoundSlot(slot));
|
|
1498
|
+
else if (slotFragment) slotFragment.updateSlot(void 0, fallback);
|
|
1499
|
+
else dynamicFragment.update();
|
|
1250
1500
|
};
|
|
1251
1501
|
let cachedSlot;
|
|
1252
1502
|
let cachedBoundSlot;
|
|
@@ -1255,12 +1505,9 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1255
1505
|
cachedSlot = slot;
|
|
1256
1506
|
cachedBoundSlot = () => {
|
|
1257
1507
|
const prevSlotScopeIds = setCurrentSlotScopeIds(slotScopeIds);
|
|
1258
|
-
const prev = inOnceSlot;
|
|
1259
1508
|
try {
|
|
1260
|
-
|
|
1261
|
-
return slot(slotProps);
|
|
1509
|
+
return once ? withOnceSlot(() => slot(slotProps)) : slot(slotProps);
|
|
1262
1510
|
} finally {
|
|
1263
|
-
inOnceSlot = prev;
|
|
1264
1511
|
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
1265
1512
|
}
|
|
1266
1513
|
};
|
|
@@ -1274,73 +1521,13 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
|
1274
1521
|
if (slotScopeIds) setScopeId(fragment, slotScopeIds);
|
|
1275
1522
|
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
1276
1523
|
} else {
|
|
1277
|
-
if (fragment
|
|
1524
|
+
if (isInteropEnabled && isInteropFragment(fragment)) fragment.hydrate();
|
|
1525
|
+
if (slotScopeIds) trackScopeIdFragment(fragment, slotScopeIds);
|
|
1278
1526
|
exitHydrationCursor(hydrationCursor);
|
|
1279
1527
|
}
|
|
1280
1528
|
return fragment;
|
|
1281
1529
|
}
|
|
1282
1530
|
//#endregion
|
|
1283
|
-
//#region packages/runtime-vapor/src/renderEffect.ts
|
|
1284
|
-
var RenderEffect = class extends ReactiveEffect {
|
|
1285
|
-
constructor(render) {
|
|
1286
|
-
super();
|
|
1287
|
-
this.render = render;
|
|
1288
|
-
const instance = currentInstance;
|
|
1289
|
-
if (!!(process.env.NODE_ENV !== "production") && !this.subs && !isVaporComponent(instance)) warn("renderEffect called without active EffectScope or Vapor instance.");
|
|
1290
|
-
const job = () => {
|
|
1291
|
-
if (this.dirty) this.run();
|
|
1292
|
-
};
|
|
1293
|
-
this.updateJob = () => {
|
|
1294
|
-
instance.isUpdating = false;
|
|
1295
|
-
instance.u && invokeArrayFns(instance.u);
|
|
1296
|
-
};
|
|
1297
|
-
if (instance) {
|
|
1298
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1299
|
-
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
1300
|
-
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
1301
|
-
}
|
|
1302
|
-
if (instance.type.ce) (instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
1303
|
-
job.i = instance;
|
|
1304
|
-
}
|
|
1305
|
-
this.job = job;
|
|
1306
|
-
this.i = instance;
|
|
1307
|
-
this.flags |= 128;
|
|
1308
|
-
this.job.flags |= 2;
|
|
1309
|
-
}
|
|
1310
|
-
fn() {
|
|
1311
|
-
const instance = this.i;
|
|
1312
|
-
const scope = this.subs ? this.subs.sub : void 0;
|
|
1313
|
-
const hasUpdateHooks = instance && (instance.bu || instance.u);
|
|
1314
|
-
if (!!(process.env.NODE_ENV !== "production") && instance) startMeasure(instance, `renderEffect`);
|
|
1315
|
-
const prev = setCurrentInstance(instance, scope);
|
|
1316
|
-
try {
|
|
1317
|
-
if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
|
|
1318
|
-
instance.isUpdating = true;
|
|
1319
|
-
try {
|
|
1320
|
-
instance.bu && invokeArrayFns(instance.bu);
|
|
1321
|
-
this.render();
|
|
1322
|
-
} catch (err) {
|
|
1323
|
-
instance.isUpdating = false;
|
|
1324
|
-
throw err;
|
|
1325
|
-
}
|
|
1326
|
-
queuePostFlushCb(this.updateJob);
|
|
1327
|
-
} else this.render();
|
|
1328
|
-
} finally {
|
|
1329
|
-
setCurrentInstance(...prev);
|
|
1330
|
-
if (!!(process.env.NODE_ENV !== "production") && instance) endMeasure(instance, `renderEffect`);
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
notify() {
|
|
1334
|
-
if (!(this.flags & 256)) queueJob(this.job, this.i ? this.i.uid : void 0);
|
|
1335
|
-
}
|
|
1336
|
-
};
|
|
1337
|
-
function renderEffect(fn, noLifecycle = false) {
|
|
1338
|
-
if (inOnceSlot) return fn();
|
|
1339
|
-
const effect = new RenderEffect(fn);
|
|
1340
|
-
if (noLifecycle) effect.fn = fn;
|
|
1341
|
-
effect.run();
|
|
1342
|
-
}
|
|
1343
|
-
//#endregion
|
|
1344
1531
|
//#region packages/runtime-vapor/src/keepAlive.ts
|
|
1345
1532
|
let isKeepAliveEnabled = false;
|
|
1346
1533
|
let currentKeepAliveCtx = null;
|
|
@@ -1400,9 +1587,9 @@ function isVaporTransition(component) {
|
|
|
1400
1587
|
}
|
|
1401
1588
|
//#endregion
|
|
1402
1589
|
//#region packages/runtime-vapor/src/fragment.ts
|
|
1590
|
+
const EMPTY_BLOCK$1 = EMPTY_ARR;
|
|
1403
1591
|
var VaporFragment = class {
|
|
1404
1592
|
constructor(nodes) {
|
|
1405
|
-
this.vnode = null;
|
|
1406
1593
|
this.renderInstance = currentInstance;
|
|
1407
1594
|
this.slotOwner = currentSlotOwner;
|
|
1408
1595
|
this.inheritedSlotBoundary = currentSlotBoundary;
|
|
@@ -1411,24 +1598,32 @@ var VaporFragment = class {
|
|
|
1411
1598
|
}
|
|
1412
1599
|
runWithRenderCtx(fn, scope) {
|
|
1413
1600
|
const prevInstance = setCurrentInstance(this.renderInstance, scope);
|
|
1414
|
-
const prevSlotOwner = setCurrentSlotOwner(this.slotOwner);
|
|
1415
|
-
let prevKeepAliveCtx = null;
|
|
1416
|
-
if (isKeepAliveEnabled) prevKeepAliveCtx = setCurrentKeepAliveCtx(this.keepAliveCtx || null);
|
|
1417
|
-
const prevBoundary = setCurrentSlotBoundary(this.inheritedSlotBoundary);
|
|
1418
1601
|
try {
|
|
1419
|
-
return fn
|
|
1602
|
+
return runWithFragmentCtx(this, fn);
|
|
1420
1603
|
} finally {
|
|
1421
|
-
setCurrentSlotBoundary(prevBoundary);
|
|
1422
|
-
if (isKeepAliveEnabled) setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
1423
|
-
setCurrentSlotOwner(prevSlotOwner);
|
|
1424
1604
|
setCurrentInstance(...prevInstance);
|
|
1425
1605
|
}
|
|
1426
1606
|
}
|
|
1427
1607
|
};
|
|
1608
|
+
function runWithFragmentCtx(fragment, fn) {
|
|
1609
|
+
const keepAliveCtx = isKeepAliveEnabled ? fragment.keepAliveCtx || null : null;
|
|
1610
|
+
if (currentSlotOwner === fragment.slotOwner && currentSlotBoundary === fragment.inheritedSlotBoundary && (!isKeepAliveEnabled || currentKeepAliveCtx === keepAliveCtx)) return fn();
|
|
1611
|
+
const prevSlotOwner = setCurrentSlotOwner(fragment.slotOwner);
|
|
1612
|
+
let prevKeepAliveCtx = null;
|
|
1613
|
+
if (isKeepAliveEnabled) prevKeepAliveCtx = setCurrentKeepAliveCtx(keepAliveCtx);
|
|
1614
|
+
const prevBoundary = setCurrentSlotBoundary(fragment.inheritedSlotBoundary);
|
|
1615
|
+
try {
|
|
1616
|
+
return fn();
|
|
1617
|
+
} finally {
|
|
1618
|
+
setCurrentSlotBoundary(prevBoundary);
|
|
1619
|
+
if (isKeepAliveEnabled) setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
1620
|
+
setCurrentSlotOwner(prevSlotOwner);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1428
1623
|
var ForFragment = class extends VaporFragment {
|
|
1429
|
-
constructor(nodes) {
|
|
1624
|
+
constructor(nodes, trackSlotBoundary) {
|
|
1430
1625
|
super(nodes);
|
|
1431
|
-
trackSlotBoundaryDirtying(this);
|
|
1626
|
+
if (trackSlotBoundary) trackSlotBoundaryDirtying(this);
|
|
1432
1627
|
}
|
|
1433
1628
|
onReset(fn) {
|
|
1434
1629
|
(this.resetListeners || (this.resetListeners = [])).push(fn);
|
|
@@ -1445,10 +1640,12 @@ var ForBlock = class extends VaporFragment {
|
|
|
1445
1640
|
}
|
|
1446
1641
|
};
|
|
1447
1642
|
function getDynamicCloseOwner(isSlot, forwardedSlot, anchorLabel, nodes, currentSlotEndAnchor) {
|
|
1448
|
-
|
|
1449
|
-
|
|
1643
|
+
if (isSlot) {
|
|
1644
|
+
if (!forwardedSlot) return 1;
|
|
1645
|
+
return isValidBlock(nodes) ? 1 : 3;
|
|
1646
|
+
}
|
|
1450
1647
|
if (anchorLabel === "if" && isArray(nodes) && nodes.length > 1) return 1;
|
|
1451
|
-
if (anchorLabel === "if" &&
|
|
1648
|
+
if (anchorLabel === "if" && currentSlotEndAnchor && isHydratingSlotFallbackActive() && !isValidBlock(nodes)) return 2;
|
|
1452
1649
|
return 0;
|
|
1453
1650
|
}
|
|
1454
1651
|
function queueAnchorInsert(parentNode$1, nextNode, createAnchor) {
|
|
@@ -1458,110 +1655,9 @@ function queueAnchorInsert(parentNode$1, nextNode, createAnchor) {
|
|
|
1458
1655
|
});
|
|
1459
1656
|
}
|
|
1460
1657
|
var DynamicFragment = class extends VaporFragment {
|
|
1461
|
-
constructor(anchorLabel, keyed = false, locate = true) {
|
|
1462
|
-
super(
|
|
1463
|
-
|
|
1464
|
-
if (!isHydrating$1) return;
|
|
1465
|
-
let advanceAfterRestore = null;
|
|
1466
|
-
let exitHydrationBoundary;
|
|
1467
|
-
const reuseAnchor = (anchor) => {
|
|
1468
|
-
this.anchor = markHydrationAnchor(anchor);
|
|
1469
|
-
if (currentHydrationNode === this.anchor) advanceHydrationNode(this.anchor);
|
|
1470
|
-
else {
|
|
1471
|
-
exitHydrationBoundary = enterHydrationBoundary(this.anchor);
|
|
1472
|
-
advanceAfterRestore = this.anchor;
|
|
1473
|
-
}
|
|
1474
|
-
};
|
|
1475
|
-
const createRuntimeAnchor = () => this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode());
|
|
1476
|
-
const cleanupAndInsertRuntimeAnchor = (parentNode, nextNode, cleanupStart, cleanupUntil) => {
|
|
1477
|
-
if (cleanupUntil) exitHydrationBoundary = enterHydrationBoundary(cleanupUntil);
|
|
1478
|
-
else {
|
|
1479
|
-
cleanupHydrationTail(cleanupStart);
|
|
1480
|
-
setCurrentHydrationNode(null);
|
|
1481
|
-
}
|
|
1482
|
-
queueAnchorInsert(parentNode, nextNode, createRuntimeAnchor);
|
|
1483
|
-
};
|
|
1484
|
-
try {
|
|
1485
|
-
if (isEmpty) {
|
|
1486
|
-
if (isComment(currentHydrationNode, "")) {
|
|
1487
|
-
reuseAnchor(currentHydrationNode);
|
|
1488
|
-
return;
|
|
1489
|
-
}
|
|
1490
|
-
if (this.anchorLabel && currentHydrationNode && isComment(currentHydrationNode, "teleport anchor")) {
|
|
1491
|
-
const parentNode$2 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
1492
|
-
const anchor = markHydrationAnchor(currentHydrationNode);
|
|
1493
|
-
if (parentNode$2) {
|
|
1494
|
-
queueAnchorInsert(parentNode$2, anchor, createRuntimeAnchor);
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
if (!isSlot && this.anchorLabel && currentHydrationNode && !isHydratingSlotFallbackActive() && !isComment(currentHydrationNode, "]")) {
|
|
1499
|
-
const parentNode$4 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
1500
|
-
const anchor = locateNextNode(currentHydrationNode);
|
|
1501
|
-
const reusableAnchor = anchor && anchor.nodeType === 8 && isReusableDynamicFragmentAnchor(anchor, this.anchorLabel) && /* @__PURE__ */ parentNode(anchor) ? anchor : null;
|
|
1502
|
-
if (parentNode$4) {
|
|
1503
|
-
this.nodes = [];
|
|
1504
|
-
if (reusableAnchor) reuseAnchor(reusableAnchor);
|
|
1505
|
-
else cleanupAndInsertRuntimeAnchor(parentNode$4, anchor, currentHydrationNode, anchor);
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
if (this.anchorLabel && !isValidBlock(this.nodes) && this.nodes instanceof Comment && isReusableDynamicFragmentAnchor(this.nodes, this.anchorLabel) && /* @__PURE__ */ parentNode(this.nodes)) {
|
|
1511
|
-
const anchor = this.nodes;
|
|
1512
|
-
this.nodes = [];
|
|
1513
|
-
reuseAnchor(anchor);
|
|
1514
|
-
return;
|
|
1515
|
-
}
|
|
1516
|
-
if (this.anchorLabel && !isValidBlock(this.nodes) && this.nodes instanceof Comment && !/* @__PURE__ */ parentNode(this.nodes) && currentHydrationNode) {
|
|
1517
|
-
const parentNode$5 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
1518
|
-
const nextNode = locateNextNode(currentHydrationNode);
|
|
1519
|
-
if (parentNode$5) {
|
|
1520
|
-
this.nodes = [];
|
|
1521
|
-
cleanupAndInsertRuntimeAnchor(parentNode$5, nextNode, currentHydrationNode, nextNode);
|
|
1522
|
-
return;
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
const currentSlotEndAnchor = getCurrentSlotEndAnchor();
|
|
1526
|
-
const forwardedSlot = this.forwarded;
|
|
1527
|
-
const slotAnchor = isSlot ? currentSlotEndAnchor : null;
|
|
1528
|
-
const closeOwner = getDynamicCloseOwner(isSlot, forwardedSlot, this.anchorLabel, this.nodes, currentSlotEndAnchor);
|
|
1529
|
-
if (closeOwner === 1) {
|
|
1530
|
-
const anchor = locateHydrationBoundaryClose(slotAnchor || currentHydrationNode, slotAnchor || null);
|
|
1531
|
-
if (isComment(anchor, "]")) {
|
|
1532
|
-
reuseAnchor(anchor);
|
|
1533
|
-
return;
|
|
1534
|
-
} else if (!!(process.env.NODE_ENV !== "production")) throw new Error(`Failed to locate ${this.anchorLabel} fragment anchor. this is likely a Vue internal bug.`);
|
|
1535
|
-
} else if (closeOwner === 3 && currentSlotEndAnchor) {
|
|
1536
|
-
const anchor = markHydrationAnchor(currentSlotEndAnchor);
|
|
1537
|
-
queueAnchorInsert(anchor.parentNode, anchor.nextSibling, createRuntimeAnchor);
|
|
1538
|
-
return;
|
|
1539
|
-
} else if (closeOwner === 2 && currentSlotEndAnchor) {
|
|
1540
|
-
const endAnchor = currentSlotEndAnchor;
|
|
1541
|
-
queuePostFlushCb(() => {
|
|
1542
|
-
const parentNode$6 = /* @__PURE__ */ parentNode(endAnchor);
|
|
1543
|
-
if (!parentNode$6) return;
|
|
1544
|
-
parentNode$6.insertBefore(createRuntimeAnchor(), endAnchor);
|
|
1545
|
-
});
|
|
1546
|
-
return;
|
|
1547
|
-
}
|
|
1548
|
-
let parentNode$3;
|
|
1549
|
-
let nextNode;
|
|
1550
|
-
if (this.anchorLabel === "if" && !isValidBlock(this.nodes) && currentSlotEndAnchor && currentHydrationNode === currentSlotEndAnchor) {
|
|
1551
|
-
parentNode$3 = currentSlotEndAnchor.parentNode;
|
|
1552
|
-
nextNode = currentSlotEndAnchor;
|
|
1553
|
-
} else {
|
|
1554
|
-
const node = findBlockNode(this.nodes);
|
|
1555
|
-
parentNode$3 = node.parentNode;
|
|
1556
|
-
nextNode = node.nextNode;
|
|
1557
|
-
}
|
|
1558
|
-
queueAnchorInsert(parentNode$3, nextNode, createRuntimeAnchor);
|
|
1559
|
-
} finally {
|
|
1560
|
-
exitHydrationBoundary && exitHydrationBoundary();
|
|
1561
|
-
if (advanceAfterRestore && currentHydrationNode === advanceAfterRestore) advanceHydrationNode(advanceAfterRestore);
|
|
1562
|
-
}
|
|
1563
|
-
};
|
|
1564
|
-
this.keyed = keyed;
|
|
1658
|
+
constructor(anchorLabel, keyed = false, locate = true, trackSlotBoundary = false) {
|
|
1659
|
+
super(EMPTY_BLOCK$1);
|
|
1660
|
+
if (keyed) this.keyed = true;
|
|
1565
1661
|
if (isTransitionEnabled && currentInstance && isVaporTransition(currentInstance.type)) this.inTransition = true;
|
|
1566
1662
|
if (isHydrating$1) {
|
|
1567
1663
|
this.anchorLabel = anchorLabel;
|
|
@@ -1570,43 +1666,44 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
1570
1666
|
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? /* @__PURE__ */ createComment(anchorLabel) : /* @__PURE__ */ createTextNode();
|
|
1571
1667
|
if (!!(process.env.NODE_ENV !== "production")) this.anchorLabel = anchorLabel;
|
|
1572
1668
|
}
|
|
1573
|
-
|
|
1669
|
+
if (trackSlotBoundary) trackSlotBoundaryDirtying(this);
|
|
1574
1670
|
}
|
|
1575
|
-
|
|
1576
|
-
const boundary = this.inheritedSlotBoundary;
|
|
1577
|
-
if (!boundary) return;
|
|
1578
|
-
(this.onUpdated || (this.onUpdated = [])).push(() => boundary.markDirty());
|
|
1579
|
-
}
|
|
1580
|
-
update(render, key = render) {
|
|
1671
|
+
update(render, key = render, noScope = false, shouldInsert = true) {
|
|
1581
1672
|
if (key === this.current) {
|
|
1582
|
-
if (isHydrating$1 && this.
|
|
1673
|
+
if (isHydrating$1 && !this.isSlot) this.hydrate(true);
|
|
1583
1674
|
return;
|
|
1584
1675
|
}
|
|
1585
1676
|
const transition = isTransitionEnabled ? this.$transition : void 0;
|
|
1677
|
+
const wasMounted = this.current !== void 0;
|
|
1678
|
+
if (wasMounted) {
|
|
1679
|
+
const onBeforeUpdate = this.onBeforeUpdate;
|
|
1680
|
+
if (onBeforeUpdate) for (let i = 0; i < onBeforeUpdate.length; i++) onBeforeUpdate[i]();
|
|
1681
|
+
}
|
|
1586
1682
|
if (transition && transition.state.isLeaving) {
|
|
1587
1683
|
this.current = key;
|
|
1588
|
-
|
|
1684
|
+
const pending = this.pending;
|
|
1685
|
+
if (pending) {
|
|
1686
|
+
pending.render = render;
|
|
1687
|
+
pending.key = key;
|
|
1688
|
+
pending.noScope = noScope;
|
|
1689
|
+
} else this.pending = {
|
|
1589
1690
|
render,
|
|
1590
|
-
key
|
|
1691
|
+
key,
|
|
1692
|
+
noScope
|
|
1591
1693
|
};
|
|
1592
1694
|
return;
|
|
1593
1695
|
}
|
|
1594
1696
|
const instance = currentInstance;
|
|
1595
1697
|
const prevSub = setActiveSub();
|
|
1596
|
-
const parent = isHydrating$1
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1698
|
+
const parent = !isHydrating$1 && shouldInsert ? this.anchor.parentNode : null;
|
|
1699
|
+
if (wasMounted) {
|
|
1700
|
+
const scope = this.scope;
|
|
1701
|
+
if (scope) {
|
|
1599
1702
|
let retainScope = false;
|
|
1600
|
-
const
|
|
1601
|
-
if (
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
keepAliveCtx.cacheScope(cacheKey, this.current, this.scope);
|
|
1605
|
-
retainScope = true;
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
if (!retainScope) this.scope.stop();
|
|
1609
|
-
} else this.scope.stop();
|
|
1703
|
+
const onBeforeRemove = this.onBeforeRemove;
|
|
1704
|
+
if (onBeforeRemove) for (let i = 0; i < onBeforeRemove.length; i++) retainScope = onBeforeRemove[i](scope) || retainScope;
|
|
1705
|
+
if (!retainScope) scope.stop();
|
|
1706
|
+
}
|
|
1610
1707
|
const mode = transition && transition.mode;
|
|
1611
1708
|
if (mode && (mode !== "in-out" || mode === "in-out" && render) && (mode !== "out-in" || isValidBlock(this.nodes))) {
|
|
1612
1709
|
applyTransitionLeaveHooks(this.nodes, transition, () => {
|
|
@@ -1615,8 +1712,8 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
1615
1712
|
const pending = this.pending;
|
|
1616
1713
|
if (pending) {
|
|
1617
1714
|
this.pending = void 0;
|
|
1618
|
-
this.renderBranch(pending.render, transition, parent, pending.key);
|
|
1619
|
-
} else this.renderBranch(render, transition, parent, key);
|
|
1715
|
+
this.renderBranch(pending.render, transition, parent, pending.key, pending.noScope, true);
|
|
1716
|
+
} else this.renderBranch(render, transition, parent, key, noScope, true);
|
|
1620
1717
|
} finally {
|
|
1621
1718
|
setCurrentInstance(...prevInstance);
|
|
1622
1719
|
}
|
|
@@ -1628,27 +1725,33 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
1628
1725
|
}
|
|
1629
1726
|
} else parent && remove(this.nodes, parent);
|
|
1630
1727
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1728
|
+
let reusingDeferredAnchor = false;
|
|
1729
|
+
if (isHydrating$1) {
|
|
1730
|
+
const isRevivingDeferredBranch = isInDeferredHydrationBoundary() && !!render && !this.isSlot && !isValidBlock(this.nodes);
|
|
1731
|
+
reusingDeferredAnchor = isRevivingDeferredBranch && !!this.anchor && !!this.anchor.parentNode;
|
|
1732
|
+
if (isRevivingDeferredBranch) {
|
|
1733
|
+
let slotEndAnchor = null;
|
|
1734
|
+
const anchor = this.anchor || (currentHydrationNode === (slotEndAnchor = getCurrentSlotEndAnchor()) ? slotEndAnchor : null);
|
|
1735
|
+
if (anchor) setCurrentHydrationNode(markHydrationAnchor(anchor));
|
|
1736
|
+
}
|
|
1637
1737
|
}
|
|
1638
|
-
this.renderBranch(render, transition, parent, key);
|
|
1738
|
+
this.renderBranch(render, transition, parent, key, noScope, wasMounted || !!parent);
|
|
1639
1739
|
setActiveSub(prevSub);
|
|
1640
|
-
if (isHydrating$1 && this.
|
|
1740
|
+
if (isHydrating$1 && !this.isSlot && !reusingDeferredAnchor) this.hydrate(render == null);
|
|
1641
1741
|
}
|
|
1642
|
-
renderBranch(render, transition, parent, key) {
|
|
1742
|
+
renderBranch(render, transition, parent, key, noScope = false, notifyUpdated = !!parent) {
|
|
1643
1743
|
this.current = key;
|
|
1644
1744
|
if (render) {
|
|
1645
1745
|
const keepAliveCtx = isKeepAliveEnabled ? this.keepAliveCtx : null;
|
|
1646
|
-
const
|
|
1647
|
-
if (
|
|
1648
|
-
|
|
1746
|
+
const useScope = !noScope || !!this.hasFallthroughAttrs;
|
|
1747
|
+
if (useScope) {
|
|
1748
|
+
const scope = keepAliveCtx && keepAliveCtx.getScope(this.current);
|
|
1749
|
+
if (scope) this.scope = scope;
|
|
1750
|
+
else this.scope = new EffectScope$1();
|
|
1751
|
+
} else this.scope = void 0;
|
|
1649
1752
|
const renderBranch = () => {
|
|
1650
1753
|
try {
|
|
1651
|
-
this.nodes = this.runWithRenderCtx(() => this.scope.run(render) ||
|
|
1754
|
+
this.nodes = this.runWithRenderCtx(() => (useScope ? this.scope.run(render) : render()) || EMPTY_BLOCK$1, this.scope);
|
|
1652
1755
|
} finally {
|
|
1653
1756
|
const key = this.keyed ? this.current : this.$key;
|
|
1654
1757
|
if (key !== void 0 && (transition || this.inTransition || keepAliveCtx)) setBlockKey(this.nodes, key);
|
|
@@ -1659,20 +1762,117 @@ var DynamicFragment = class extends VaporFragment {
|
|
|
1659
1762
|
if (keepAliveCtx && this.keyed) withCurrentCacheKey(key, renderBranch);
|
|
1660
1763
|
else renderBranch();
|
|
1661
1764
|
if (parent) {
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
renderEffect(() => applyFallthroughProps(this.nodes, this.attrs));
|
|
1665
|
-
});
|
|
1666
|
-
else if (!!(process.env.NODE_ENV !== "production") && (this.anchorLabel === "slot" || isArray(this.nodes) && this.nodes.length)) warnExtraneousAttributes(this.attrs);
|
|
1667
|
-
}
|
|
1765
|
+
const onBeforeInsert = this.onBeforeInsert;
|
|
1766
|
+
if (onBeforeInsert) onBeforeInsert.forEach((hook) => hook(this.nodes));
|
|
1668
1767
|
insert(this.nodes, parent, this.anchor);
|
|
1669
|
-
if (keepAliveCtx && transition && transition.mode === "out-in") keepAliveCtx.cacheBlock();
|
|
1670
1768
|
}
|
|
1671
1769
|
} else {
|
|
1672
1770
|
this.scope = void 0;
|
|
1673
|
-
this.nodes =
|
|
1771
|
+
this.nodes = EMPTY_BLOCK$1;
|
|
1772
|
+
}
|
|
1773
|
+
const onUpdated = this.onUpdated;
|
|
1774
|
+
if (notifyUpdated && onUpdated) onUpdated.forEach((hook) => hook(this.nodes));
|
|
1775
|
+
}
|
|
1776
|
+
hydrate(isEmpty = false) {
|
|
1777
|
+
if (!isHydrating$1) return;
|
|
1778
|
+
let advanceAfterRestore = null;
|
|
1779
|
+
let exitHydrationBoundary;
|
|
1780
|
+
const reuseAnchor = (anchor) => {
|
|
1781
|
+
this.anchor = markHydrationAnchor(anchor);
|
|
1782
|
+
if (currentHydrationNode === this.anchor) advanceHydrationNode(this.anchor);
|
|
1783
|
+
else {
|
|
1784
|
+
exitHydrationBoundary = enterHydrationBoundary(this.anchor);
|
|
1785
|
+
advanceAfterRestore = this.anchor;
|
|
1786
|
+
}
|
|
1787
|
+
};
|
|
1788
|
+
const createRuntimeAnchor = () => this.anchor = markHydrationAnchor(!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment(this.anchorLabel) : /* @__PURE__ */ createTextNode());
|
|
1789
|
+
const cleanupAndInsertRuntimeAnchor = (parentNode, nextNode, cleanupStart, cleanupUntil) => {
|
|
1790
|
+
if (cleanupUntil) exitHydrationBoundary = enterHydrationBoundary(cleanupUntil);
|
|
1791
|
+
else {
|
|
1792
|
+
cleanupHydrationTail(cleanupStart);
|
|
1793
|
+
setCurrentHydrationNode(null);
|
|
1794
|
+
}
|
|
1795
|
+
queueAnchorInsert(parentNode, nextNode, createRuntimeAnchor);
|
|
1796
|
+
};
|
|
1797
|
+
try {
|
|
1798
|
+
if (isEmpty) {
|
|
1799
|
+
if (isComment(currentHydrationNode, "")) {
|
|
1800
|
+
reuseAnchor(currentHydrationNode);
|
|
1801
|
+
return;
|
|
1802
|
+
}
|
|
1803
|
+
if (this.anchorLabel && currentHydrationNode && isComment(currentHydrationNode, "teleport anchor")) {
|
|
1804
|
+
const parentNode$2 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
1805
|
+
const anchor = markHydrationAnchor(currentHydrationNode);
|
|
1806
|
+
if (parentNode$2) {
|
|
1807
|
+
queueAnchorInsert(parentNode$2, anchor, createRuntimeAnchor);
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
if (!this.isSlot && this.anchorLabel && currentHydrationNode && !isHydratingSlotFallbackActive() && !isComment(currentHydrationNode, "]")) {
|
|
1812
|
+
const parentNode$4 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
1813
|
+
const anchor = nextLogicalSibling(currentHydrationNode);
|
|
1814
|
+
const reusableAnchor = anchor && anchor.nodeType === 8 && isReusableDynamicFragmentAnchor(anchor, this.anchorLabel) && /* @__PURE__ */ parentNode(anchor) ? anchor : null;
|
|
1815
|
+
if (parentNode$4) {
|
|
1816
|
+
this.nodes = EMPTY_BLOCK$1;
|
|
1817
|
+
if (reusableAnchor) reuseAnchor(reusableAnchor);
|
|
1818
|
+
else cleanupAndInsertRuntimeAnchor(parentNode$4, anchor, currentHydrationNode, anchor);
|
|
1819
|
+
return;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
if (this.anchorLabel && !isValidBlock(this.nodes) && this.nodes instanceof Comment && isReusableDynamicFragmentAnchor(this.nodes, this.anchorLabel) && /* @__PURE__ */ parentNode(this.nodes)) {
|
|
1824
|
+
const anchor = this.nodes;
|
|
1825
|
+
this.nodes = EMPTY_BLOCK$1;
|
|
1826
|
+
reuseAnchor(anchor);
|
|
1827
|
+
return;
|
|
1828
|
+
}
|
|
1829
|
+
if (this.anchorLabel && !isValidBlock(this.nodes) && this.nodes instanceof Comment && !/* @__PURE__ */ parentNode(this.nodes) && currentHydrationNode) {
|
|
1830
|
+
const parentNode$5 = /* @__PURE__ */ parentNode(currentHydrationNode);
|
|
1831
|
+
const nextNode = nextLogicalSibling(currentHydrationNode);
|
|
1832
|
+
if (parentNode$5) {
|
|
1833
|
+
this.nodes = EMPTY_BLOCK$1;
|
|
1834
|
+
cleanupAndInsertRuntimeAnchor(parentNode$5, nextNode, currentHydrationNode, nextNode);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
const currentSlotEndAnchor = getCurrentSlotEndAnchor();
|
|
1839
|
+
const forwardedSlot = this.isSlot ? this.forwarded : false;
|
|
1840
|
+
const slotAnchor = this.isSlot ? currentSlotEndAnchor : null;
|
|
1841
|
+
const closeOwner = getDynamicCloseOwner(!!this.isSlot, forwardedSlot, this.anchorLabel, this.nodes, currentSlotEndAnchor);
|
|
1842
|
+
if (closeOwner === 1) {
|
|
1843
|
+
const anchor = locateHydrationBoundaryClose(slotAnchor || currentHydrationNode, slotAnchor || null);
|
|
1844
|
+
if (isComment(anchor, "]")) {
|
|
1845
|
+
reuseAnchor(anchor);
|
|
1846
|
+
return;
|
|
1847
|
+
} else if (!!(process.env.NODE_ENV !== "production")) throw new Error(`Failed to locate ${this.anchorLabel} fragment anchor. this is likely a Vue internal bug.`);
|
|
1848
|
+
} else if (closeOwner === 3 && currentSlotEndAnchor) {
|
|
1849
|
+
const anchor = markHydrationAnchor(currentSlotEndAnchor);
|
|
1850
|
+
queueAnchorInsert(anchor.parentNode, anchor.nextSibling, createRuntimeAnchor);
|
|
1851
|
+
return;
|
|
1852
|
+
} else if (closeOwner === 2 && currentSlotEndAnchor) {
|
|
1853
|
+
const endAnchor = currentSlotEndAnchor;
|
|
1854
|
+
queuePostFlushCb(() => {
|
|
1855
|
+
const parentNode$6 = /* @__PURE__ */ parentNode(endAnchor);
|
|
1856
|
+
if (!parentNode$6) return;
|
|
1857
|
+
parentNode$6.insertBefore(createRuntimeAnchor(), endAnchor);
|
|
1858
|
+
});
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
let parentNode$3;
|
|
1862
|
+
let nextNode;
|
|
1863
|
+
if (this.anchorLabel === "if" && !isValidBlock(this.nodes) && currentSlotEndAnchor && currentHydrationNode === currentSlotEndAnchor) {
|
|
1864
|
+
parentNode$3 = currentSlotEndAnchor.parentNode;
|
|
1865
|
+
nextNode = currentSlotEndAnchor;
|
|
1866
|
+
} else {
|
|
1867
|
+
const node = findBlockBoundary(this.nodes);
|
|
1868
|
+
parentNode$3 = node.parentNode;
|
|
1869
|
+
nextNode = node.nextNode;
|
|
1870
|
+
}
|
|
1871
|
+
queueAnchorInsert(parentNode$3, nextNode, createRuntimeAnchor);
|
|
1872
|
+
} finally {
|
|
1873
|
+
exitHydrationBoundary && exitHydrationBoundary();
|
|
1874
|
+
if (advanceAfterRestore && currentHydrationNode === advanceAfterRestore) advanceHydrationNode(advanceAfterRestore);
|
|
1674
1875
|
}
|
|
1675
|
-
if (parent && this.onUpdated) this.onUpdated.forEach((hook) => hook(this.nodes));
|
|
1676
1876
|
}
|
|
1677
1877
|
};
|
|
1678
1878
|
let currentSlotBoundary = null;
|
|
@@ -1708,58 +1908,14 @@ function getRedirectedBoundary(boundary) {
|
|
|
1708
1908
|
function trackSlotBoundaryDirtying(fragment) {
|
|
1709
1909
|
const boundary = currentSlotBoundary;
|
|
1710
1910
|
if (!boundary) return;
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
if (block instanceof Node) return node(block);
|
|
1715
|
-
if (isVaporComponent(block)) return walkSlotFallbackBlock(block.block, node, fragment);
|
|
1716
|
-
if (isArray(block)) {
|
|
1717
|
-
for (const child of block) if (walkSlotFallbackBlock(child, node, fragment)) return true;
|
|
1718
|
-
return false;
|
|
1719
|
-
}
|
|
1720
|
-
return fragment(block, (block) => walkSlotFallbackBlock(block, node, fragment));
|
|
1721
|
-
}
|
|
1722
|
-
function resolveSlotFallbackCarrierOwner(block) {
|
|
1723
|
-
let owner = null;
|
|
1724
|
-
walkSlotFallbackBlock(block, () => false, (block) => {
|
|
1725
|
-
owner = block;
|
|
1726
|
-
return true;
|
|
1727
|
-
});
|
|
1728
|
-
return owner;
|
|
1729
|
-
}
|
|
1730
|
-
function findFirstSlotFallbackCarrierNode(block) {
|
|
1731
|
-
let node = null;
|
|
1732
|
-
walkSlotFallbackBlock(block, (value) => {
|
|
1733
|
-
node = value;
|
|
1734
|
-
return true;
|
|
1735
|
-
}, (block, walk) => {
|
|
1736
|
-
if (walk(block.nodes)) return true;
|
|
1737
|
-
if (block.anchor) {
|
|
1738
|
-
node = block.anchor;
|
|
1739
|
-
return true;
|
|
1740
|
-
}
|
|
1741
|
-
return false;
|
|
1742
|
-
});
|
|
1743
|
-
return node;
|
|
1744
|
-
}
|
|
1745
|
-
function collectBlockNodes(block, nodes = [], includeComments = false) {
|
|
1746
|
-
walkSlotFallbackBlock(block, (block) => {
|
|
1747
|
-
if (includeComments || !(block instanceof Comment)) nodes.push(block);
|
|
1748
|
-
return false;
|
|
1749
|
-
}, (block) => {
|
|
1750
|
-
collectBlockNodes(block.nodes, nodes, true);
|
|
1751
|
-
if (block.anchor) nodes.push(block.anchor);
|
|
1752
|
-
return false;
|
|
1911
|
+
let prevValid = isValidBlock(fragment);
|
|
1912
|
+
(fragment.onBeforeUpdate || (fragment.onBeforeUpdate = [])).push(() => {
|
|
1913
|
+
prevValid = isValidBlock(fragment);
|
|
1753
1914
|
});
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
if (!(block instanceof Comment)) apply(block);
|
|
1759
|
-
return false;
|
|
1760
|
-
}, (block) => {
|
|
1761
|
-
apply(block);
|
|
1762
|
-
return false;
|
|
1915
|
+
(fragment.onUpdated || (fragment.onUpdated = [])).push(() => {
|
|
1916
|
+
const valid = isValidBlock(fragment);
|
|
1917
|
+
if (valid !== prevValid) boundary.markDirty();
|
|
1918
|
+
prevValid = valid;
|
|
1763
1919
|
});
|
|
1764
1920
|
}
|
|
1765
1921
|
function hasSlotFallback(boundary) {
|
|
@@ -1769,154 +1925,145 @@ function hasSlotFallback(boundary) {
|
|
|
1769
1925
|
}
|
|
1770
1926
|
return false;
|
|
1771
1927
|
}
|
|
1772
|
-
function renderSlotFallback(boundary, scope
|
|
1773
|
-
|
|
1774
|
-
return hasFallback ? block : void 0;
|
|
1775
|
-
}
|
|
1776
|
-
function renderSlotFallbackBlock(boundary, scope, args) {
|
|
1777
|
-
if (!boundary) return [[], false];
|
|
1928
|
+
function renderSlotFallback(boundary, scope) {
|
|
1929
|
+
if (!boundary) return;
|
|
1778
1930
|
const localFallback = boundary.getFallback();
|
|
1779
|
-
if (!localFallback) return
|
|
1780
|
-
const renderFallback = () => withOwnedSlotBoundary(getRedirectedBoundary(boundary), () => localFallback(
|
|
1781
|
-
const local = boundary.run(() =>
|
|
1782
|
-
if (isValidBlock(local)) return
|
|
1783
|
-
const
|
|
1784
|
-
return
|
|
1785
|
-
}
|
|
1786
|
-
function
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1931
|
+
if (!localFallback) return renderSlotFallback(boundary.parent, scope);
|
|
1932
|
+
const renderFallback = () => withOwnedSlotBoundary(getRedirectedBoundary(boundary), () => localFallback());
|
|
1933
|
+
const local = boundary.run(() => scope.run(renderFallback) || [], scope);
|
|
1934
|
+
if (isValidBlock(local)) return local;
|
|
1935
|
+
const inherited = renderSlotFallback(boundary.parent, scope);
|
|
1936
|
+
return inherited === void 0 ? local : inherited;
|
|
1937
|
+
}
|
|
1938
|
+
function detachBlock(block, parent) {
|
|
1939
|
+
if (block instanceof Node) {
|
|
1940
|
+
if (block.parentNode === parent) removeNode(block, parent);
|
|
1941
|
+
} else if (isVaporComponent(block)) {
|
|
1942
|
+
if (block.block) detachBlock(block.block, parent);
|
|
1943
|
+
} else if (isArray(block)) for (let i = 0; i < block.length; i++) detachBlock(block[i], parent);
|
|
1944
|
+
else {
|
|
1945
|
+
detachBlock(block.nodes, parent);
|
|
1946
|
+
if (!(block instanceof SlotFragment) && block.anchor && block.anchor.parentNode === parent) removeNode(block.anchor, parent);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
function markSlotFallbackDirty(state) {
|
|
1950
|
+
if (state.isDisposed()) return;
|
|
1951
|
+
if (state.isRenderingFallback) {
|
|
1952
|
+
state.pendingRecheck = true;
|
|
1796
1953
|
return;
|
|
1797
1954
|
}
|
|
1798
|
-
if (
|
|
1799
|
-
|
|
1955
|
+
if (state.isBusy()) {
|
|
1956
|
+
state.pendingRecheck = true;
|
|
1800
1957
|
return;
|
|
1801
1958
|
}
|
|
1802
|
-
recheckSlotFallback(
|
|
1959
|
+
recheckSlotFallback(state, true);
|
|
1803
1960
|
}
|
|
1804
|
-
function clearSlotFallback(
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1961
|
+
function clearSlotFallback(state) {
|
|
1962
|
+
const fallback = state.activeFallback;
|
|
1963
|
+
if (fallback) {
|
|
1964
|
+
const parentNode = state.getParentNode();
|
|
1965
|
+
if (parentNode) remove(fallback, parentNode);
|
|
1966
|
+
state.activeFallback = null;
|
|
1809
1967
|
}
|
|
1810
|
-
if (
|
|
1811
|
-
|
|
1812
|
-
|
|
1968
|
+
if (state.fallbackScope) {
|
|
1969
|
+
state.fallbackScope.stop();
|
|
1970
|
+
state.fallbackScope = void 0;
|
|
1813
1971
|
}
|
|
1814
1972
|
}
|
|
1815
|
-
function
|
|
1816
|
-
const scope = new EffectScope$1();
|
|
1973
|
+
function renderSlotFallbackState(state) {
|
|
1974
|
+
const scope = new EffectScope$1(true);
|
|
1817
1975
|
let renderedFallback;
|
|
1818
|
-
|
|
1976
|
+
state.isRenderingFallback = true;
|
|
1819
1977
|
try {
|
|
1820
|
-
renderedFallback = renderSlotFallback(
|
|
1978
|
+
renderedFallback = renderSlotFallback(state.boundary, scope);
|
|
1821
1979
|
} catch (err) {
|
|
1822
1980
|
scope.stop();
|
|
1823
1981
|
throw err;
|
|
1824
1982
|
} finally {
|
|
1825
|
-
|
|
1983
|
+
state.isRenderingFallback = false;
|
|
1826
1984
|
}
|
|
1827
1985
|
if (!renderedFallback) {
|
|
1828
1986
|
scope.stop();
|
|
1829
|
-
return
|
|
1987
|
+
return;
|
|
1830
1988
|
}
|
|
1831
1989
|
return {
|
|
1832
|
-
found: true,
|
|
1833
1990
|
block: renderedFallback,
|
|
1834
1991
|
scope
|
|
1835
1992
|
};
|
|
1836
1993
|
}
|
|
1837
|
-
function
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1994
|
+
function insertActiveSlotFallback(state) {
|
|
1995
|
+
const fallback = state.activeFallback;
|
|
1996
|
+
if (isHydrating$1 || !fallback || !isValidBlock(fallback)) return;
|
|
1997
|
+
const parentNode = state.getParentNode();
|
|
1998
|
+
if (!parentNode) return;
|
|
1999
|
+
insert(fallback, parentNode, state.getAnchor());
|
|
2000
|
+
}
|
|
2001
|
+
function commitSlotFallback(state, block, scope, detachContent) {
|
|
2002
|
+
const parentNode = state.getParentNode();
|
|
2003
|
+
if (detachContent && !isHydrating$1 && parentNode) detachBlock(state.getContent(), parentNode);
|
|
2004
|
+
state.activeFallback = block;
|
|
2005
|
+
state.fallbackScope = scope;
|
|
2006
|
+
if (isTransitionEnabled) {
|
|
2007
|
+
const transitionState = state;
|
|
2008
|
+
if (transitionState.$transition) {
|
|
2009
|
+
setBlockKey(block, "_fb");
|
|
2010
|
+
transitionState.$transition = applyTransitionHooks(block, transitionState.$transition);
|
|
1852
2011
|
}
|
|
1853
|
-
nextNode = carrierNode.nextSibling;
|
|
1854
2012
|
}
|
|
1855
|
-
|
|
1856
|
-
let anchor = lastNode.nextSibling;
|
|
1857
|
-
for (let i = carrierNodes.length - 1; i >= 0; i--) {
|
|
1858
|
-
const carrierNode = carrierNodes[i];
|
|
1859
|
-
parentNode.insertBefore(carrierNode, anchor);
|
|
1860
|
-
anchor = carrierNode;
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
function ensureSlotFallbackOrderHook(outlet, block) {
|
|
1864
|
-
if (!isFragment(block)) return;
|
|
1865
|
-
const fragment = block;
|
|
1866
|
-
if (fragment.hasSlotFallbackOrderHook) return;
|
|
1867
|
-
(fragment.onUpdated || (fragment.onUpdated = [])).push(() => syncSlotFallbackOrder(outlet, fragment));
|
|
1868
|
-
fragment.hasSlotFallbackOrderHook = true;
|
|
2013
|
+
insertActiveSlotFallback(state);
|
|
1869
2014
|
}
|
|
1870
|
-
function
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
if (
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
ensureSlotFallbackOrderHook(outlet, block);
|
|
1881
|
-
insertActiveSlotFallback(outlet);
|
|
1882
|
-
}
|
|
1883
|
-
function syncActiveSlotFallback(outlet) {
|
|
1884
|
-
if (!outlet.activeFallback) return;
|
|
1885
|
-
const activeFallback = outlet.activeFallback;
|
|
1886
|
-
queuePostFlushCb(() => {
|
|
1887
|
-
syncSlotFallbackOrder(outlet, activeFallback);
|
|
1888
|
-
});
|
|
2015
|
+
function renderAndCommitSlotFallback(state, hadFallback) {
|
|
2016
|
+
const result = renderSlotFallbackState(state);
|
|
2017
|
+
clearSlotFallback(state);
|
|
2018
|
+
if (result) {
|
|
2019
|
+
commitSlotFallback(state, result.block, result.scope, !hadFallback);
|
|
2020
|
+
if (state.pendingRecheck) {
|
|
2021
|
+
state.pendingRecheck = false;
|
|
2022
|
+
recheckSlotFallback(state, true);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
1889
2025
|
}
|
|
1890
|
-
function disposeSlotFallback(
|
|
1891
|
-
clearSlotFallback(
|
|
1892
|
-
|
|
1893
|
-
|
|
2026
|
+
function disposeSlotFallback(state) {
|
|
2027
|
+
clearSlotFallback(state);
|
|
2028
|
+
state.pendingRecheck = false;
|
|
2029
|
+
state.lastNodesValid = void 0;
|
|
1894
2030
|
}
|
|
1895
|
-
function recheckSlotFallback(
|
|
1896
|
-
if (
|
|
1897
|
-
|
|
2031
|
+
function recheckSlotFallback(state, force = false) {
|
|
2032
|
+
if (state.isRenderingFallback) {
|
|
2033
|
+
state.pendingRecheck = true;
|
|
1898
2034
|
return;
|
|
1899
2035
|
}
|
|
1900
|
-
const
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
commitSlotFallback(outlet, result.block, result.scope);
|
|
1909
|
-
if (outlet.pendingRecheck && outlet.rerunRecheckAfterFallbackRender !== false) {
|
|
1910
|
-
outlet.pendingRecheck = false;
|
|
1911
|
-
recheckSlotFallback(outlet, true);
|
|
1912
|
-
}
|
|
1913
|
-
} else clearSlotFallback(outlet);
|
|
1914
|
-
}
|
|
2036
|
+
const fallback = state.activeFallback;
|
|
2037
|
+
const fallbackValid = fallback ? isValidBlock(fallback) : false;
|
|
2038
|
+
const contentValid = state.isContentValid();
|
|
2039
|
+
const prevNodesValid = state.lastNodesValid === void 0 ? fallback ? fallbackValid : contentValid : state.lastNodesValid;
|
|
2040
|
+
if (!force && contentValid && !fallback && prevNodesValid) {
|
|
2041
|
+
state.syncNodes();
|
|
2042
|
+
state.lastNodesValid = true;
|
|
2043
|
+
return;
|
|
1915
2044
|
}
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2045
|
+
if (contentValid) {
|
|
2046
|
+
const content = state.getContent();
|
|
2047
|
+
const hadFallback = !!fallback;
|
|
2048
|
+
clearSlotFallback(state);
|
|
2049
|
+
if (!isHydrating$1 && hadFallback) {
|
|
2050
|
+
const parentNode = state.getParentNode();
|
|
2051
|
+
if (parentNode) insert(content, parentNode, state.getAnchor());
|
|
2052
|
+
}
|
|
2053
|
+
} else if (fallback) {
|
|
2054
|
+
if (prevNodesValid) {
|
|
2055
|
+
if (!fallbackValid && !hasSlotFallback(state.boundary.parent)) {
|
|
2056
|
+
const parentNode = state.getParentNode();
|
|
2057
|
+
if (parentNode) detachBlock(fallback, parentNode);
|
|
2058
|
+
} else if (force) renderAndCommitSlotFallback(state, true);
|
|
2059
|
+
} else if (fallbackValid) insertActiveSlotFallback(state);
|
|
2060
|
+
else if (force) renderAndCommitSlotFallback(state, true);
|
|
2061
|
+
} else renderAndCommitSlotFallback(state, false);
|
|
2062
|
+
const nextFallback = state.activeFallback;
|
|
2063
|
+
const nextNodesValid = nextFallback ? isValidBlock(nextFallback) : state.isContentValid();
|
|
2064
|
+
state.syncNodes();
|
|
2065
|
+
state.lastNodesValid = nextNodesValid;
|
|
2066
|
+
if (prevNodesValid !== nextNodesValid) state.notifyFallbackValidityChange();
|
|
1920
2067
|
}
|
|
1921
2068
|
let currentHydratingSlotBoundaryState = null;
|
|
1922
2069
|
function setCurrentHydratingSlotBoundaryState(state) {
|
|
@@ -1971,16 +2118,18 @@ function isReusableDynamicFragmentAnchor(node, anchorLabel) {
|
|
|
1971
2118
|
return isComment(node, anchorLabel) || isComment(node, "") && (anchorLabel === "dynamic-component" || anchorLabel === "async component" || anchorLabel === "keyed");
|
|
1972
2119
|
}
|
|
1973
2120
|
var SlotFragment = class extends DynamicFragment {
|
|
1974
|
-
constructor() {
|
|
1975
|
-
super(isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? "slot" : void 0, false, false);
|
|
2121
|
+
constructor(notifyParent = false) {
|
|
2122
|
+
super(isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? "slot" : void 0, false, false, false);
|
|
2123
|
+
this.isSlot = true;
|
|
1976
2124
|
this.disposed = false;
|
|
1977
2125
|
this.forwarded = false;
|
|
1978
2126
|
this.parentSlotBoundary = getCurrentSlotBoundary();
|
|
1979
2127
|
this.activeFallback = null;
|
|
1980
2128
|
this.pendingRecheck = false;
|
|
1981
2129
|
this.isRenderingFallback = false;
|
|
1982
|
-
this.
|
|
2130
|
+
this.content = EMPTY_BLOCK$1;
|
|
1983
2131
|
this.isUpdatingSlot = false;
|
|
2132
|
+
this.notifyParent = notifyParent;
|
|
1984
2133
|
if (!isHydrating$1) this.insert = (parent, anchor) => this.insertSlot(parent, anchor);
|
|
1985
2134
|
this.remove = (parent) => this.removeSlot(parent);
|
|
1986
2135
|
}
|
|
@@ -1996,7 +2145,6 @@ var SlotFragment = class extends DynamicFragment {
|
|
|
1996
2145
|
markDirty: () => markSlotFallbackDirty(this)
|
|
1997
2146
|
};
|
|
1998
2147
|
}
|
|
1999
|
-
registerSlotBoundaryDirty() {}
|
|
2000
2148
|
get fallbackBlock() {
|
|
2001
2149
|
return this.activeFallback;
|
|
2002
2150
|
}
|
|
@@ -2006,55 +2154,46 @@ var SlotFragment = class extends DynamicFragment {
|
|
|
2006
2154
|
get slotFallbackBoundary() {
|
|
2007
2155
|
return this.ensureSlotFallbackBoundary();
|
|
2008
2156
|
}
|
|
2009
|
-
getEffectiveOutput() {
|
|
2010
|
-
return getSlotEffectiveOutput(this);
|
|
2011
|
-
}
|
|
2012
2157
|
insertSlot(parent, anchor) {
|
|
2013
2158
|
this.disposed = false;
|
|
2014
|
-
if (this.fallbackBlock) {
|
|
2015
|
-
insert(this.fallbackBlock, parent, anchor);
|
|
2016
|
-
mutateSlotFallbackCarrier(this.nodes, (block) => insert(block, parent, anchor));
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
2159
|
insert(this.nodes, parent, anchor);
|
|
2020
2160
|
}
|
|
2021
2161
|
removeSlot(parent) {
|
|
2022
2162
|
this.disposed = true;
|
|
2023
|
-
|
|
2024
|
-
|
|
2163
|
+
const nodes = this.nodes;
|
|
2164
|
+
remove(nodes, parent);
|
|
2165
|
+
if (this.activeFallback === nodes) this.activeFallback = null;
|
|
2025
2166
|
disposeSlotFallback(this);
|
|
2026
2167
|
}
|
|
2168
|
+
updateContent(render, key) {
|
|
2169
|
+
this.nodes = this.content;
|
|
2170
|
+
this.update(render, key, false, !this.activeFallback);
|
|
2171
|
+
this.content = this.nodes;
|
|
2172
|
+
}
|
|
2027
2173
|
updateSlot(render, fallback, key = render || fallback) {
|
|
2028
2174
|
const prevLocalFallback = this.localFallback;
|
|
2029
2175
|
this.localFallback = fallback;
|
|
2030
|
-
const fallbackChanged = prevLocalFallback !== fallback;
|
|
2031
|
-
const fastSlotKey = key === void 0 ? render : key;
|
|
2032
|
-
if (!isHydrating$1 && !fallback && !this.parentSlotBoundary && !this._slotFallbackBoundary) {
|
|
2033
|
-
this.update(render, fastSlotKey);
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
2176
|
const boundary = this.slotFallbackBoundary;
|
|
2037
|
-
const slotRender = render ? () => withOwnedSlotBoundary(boundary, render) : () =>
|
|
2038
|
-
const slotKey = key === void 0 ? slotRender : key;
|
|
2177
|
+
const slotRender = render ? () => withOwnedSlotBoundary(boundary, render) : () => EMPTY_BLOCK$1;
|
|
2039
2178
|
this.isUpdatingSlot = true;
|
|
2040
2179
|
this.pendingRecheck = false;
|
|
2041
2180
|
try {
|
|
2042
|
-
const shouldForce =
|
|
2181
|
+
const shouldForce = prevLocalFallback !== fallback;
|
|
2043
2182
|
if (isHydrating$1) withHydratingSlotBoundary(() => {
|
|
2044
2183
|
const prev = isHydratingSlotFallbackActive();
|
|
2045
2184
|
try {
|
|
2046
2185
|
if (hasSlotFallback(boundary)) setCurrentHydratingSlotFallbackActive(true);
|
|
2047
|
-
this.
|
|
2048
|
-
const contentValid = isValidBlock(this.
|
|
2186
|
+
this.updateContent(slotRender, key);
|
|
2187
|
+
const contentValid = isValidBlock(this.content);
|
|
2049
2188
|
recheckSlotFallback(this, shouldForce);
|
|
2050
2189
|
if (!hasSlotFallback(boundary) || contentValid) setCurrentHydratingSlotFallbackActive(prev);
|
|
2051
|
-
this.hydrate(!isValidBlock(this.
|
|
2190
|
+
this.hydrate(!isValidBlock(this.nodes));
|
|
2052
2191
|
} finally {
|
|
2053
2192
|
setCurrentHydratingSlotFallbackActive(prev);
|
|
2054
2193
|
}
|
|
2055
2194
|
});
|
|
2056
2195
|
else {
|
|
2057
|
-
this.
|
|
2196
|
+
this.updateContent(slotRender, key);
|
|
2058
2197
|
recheckSlotFallback(this, shouldForce);
|
|
2059
2198
|
}
|
|
2060
2199
|
} finally {
|
|
@@ -2063,7 +2202,7 @@ var SlotFragment = class extends DynamicFragment {
|
|
|
2063
2202
|
}
|
|
2064
2203
|
}
|
|
2065
2204
|
getContent() {
|
|
2066
|
-
return this.
|
|
2205
|
+
return this.content;
|
|
2067
2206
|
}
|
|
2068
2207
|
getParentNode() {
|
|
2069
2208
|
return this.anchor ? this.anchor.parentNode : null;
|
|
@@ -2077,16 +2216,28 @@ var SlotFragment = class extends DynamicFragment {
|
|
|
2077
2216
|
isDisposed() {
|
|
2078
2217
|
return this.disposed;
|
|
2079
2218
|
}
|
|
2219
|
+
isContentValid() {
|
|
2220
|
+
return isValidBlock(this.content);
|
|
2221
|
+
}
|
|
2222
|
+
syncNodes() {
|
|
2223
|
+
this.nodes = this.activeFallback || this.content;
|
|
2224
|
+
}
|
|
2080
2225
|
notifyFallbackValidityChange() {
|
|
2081
|
-
if (this.parentSlotBoundary) this.parentSlotBoundary.markDirty();
|
|
2226
|
+
if (this.notifyParent && this.parentSlotBoundary) this.parentSlotBoundary.markDirty();
|
|
2082
2227
|
}
|
|
2083
2228
|
};
|
|
2084
2229
|
function isFragment(val) {
|
|
2085
2230
|
return val instanceof VaporFragment;
|
|
2086
2231
|
}
|
|
2232
|
+
function isInteropFragment(val) {
|
|
2233
|
+
return val instanceof VaporFragment && val.vnode !== void 0;
|
|
2234
|
+
}
|
|
2087
2235
|
function isDynamicFragment(val) {
|
|
2088
2236
|
return val instanceof DynamicFragment;
|
|
2089
2237
|
}
|
|
2238
|
+
function isSlotFragment(val) {
|
|
2239
|
+
return val instanceof DynamicFragment && !!val.isSlot;
|
|
2240
|
+
}
|
|
2090
2241
|
//#endregion
|
|
2091
2242
|
//#region packages/runtime-vapor/src/teleport.ts
|
|
2092
2243
|
let isTeleportEnabled = false;
|
|
@@ -2111,29 +2262,38 @@ function isValidBlock(block) {
|
|
|
2111
2262
|
else if (isVaporComponent(block)) return isValidBlock(block.block);
|
|
2112
2263
|
else if (isArray(block)) return block.length > 0 && block.some(isValidBlock);
|
|
2113
2264
|
else {
|
|
2114
|
-
|
|
2115
|
-
if (isBlockValid) return isBlockValid.call(block);
|
|
2265
|
+
if (isInteropEnabled && block.isBlockValid) return block.isBlockValid();
|
|
2116
2266
|
if (block.validityPending) return true;
|
|
2117
|
-
|
|
2118
|
-
return isValidBlock(getEffectiveOutput ? getEffectiveOutput.call(block) : block.nodes);
|
|
2267
|
+
return isValidBlock(block.nodes);
|
|
2119
2268
|
}
|
|
2120
2269
|
}
|
|
2121
2270
|
function insert(block, parent, anchor = null, parentSuspense) {
|
|
2122
|
-
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
2123
2271
|
if (block instanceof Node) {
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2272
|
+
insertNode(block, parent, anchor, parentSuspense);
|
|
2273
|
+
return;
|
|
2274
|
+
}
|
|
2275
|
+
if (isVaporComponent(block)) {
|
|
2276
|
+
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
2277
|
+
if (block.isMounted && !block.isDeactivated) insert(block.block, parent, anchor);
|
|
2278
|
+
else mountComponent(block, parent, anchor);
|
|
2279
|
+
} else if (isArray(block)) {
|
|
2280
|
+
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
2281
|
+
for (const b of block) insert(b, parent, anchor);
|
|
2282
|
+
} else insertFragment(block, parent, anchor, parentSuspense);
|
|
2283
|
+
}
|
|
2284
|
+
function insertNode(block, parent, anchor = null, parentSuspense) {
|
|
2285
|
+
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
2286
|
+
if (!isHydrating$1) if (isTransitionEnabled && block instanceof Element && block.$transition && !block.$transition.disabled) performTransitionEnter(block, block.$transition, () => parent.insertBefore(block, anchor), parentSuspense);
|
|
2287
|
+
else parent.insertBefore(block, anchor);
|
|
2288
|
+
}
|
|
2289
|
+
function insertFragment(block, parent, anchor = null, parentSuspense) {
|
|
2290
|
+
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
2291
|
+
if (block.anchor) {
|
|
2292
|
+
insertNode(block.anchor, parent, anchor, parentSuspense);
|
|
2293
|
+
anchor = block.anchor;
|
|
2136
2294
|
}
|
|
2295
|
+
if (block.insert) block.insert(parent, anchor, block.$transition);
|
|
2296
|
+
else insert(block.nodes, parent, anchor, parentSuspense);
|
|
2137
2297
|
}
|
|
2138
2298
|
function move(block, parent, anchor = null, moveType = 1, parentComponent, parentSuspense) {
|
|
2139
2299
|
anchor = anchor === 0 ? parent.$fc || /* @__PURE__ */ _child(parent) : anchor;
|
|
@@ -2160,16 +2320,20 @@ function prepend(parent, ...blocks) {
|
|
|
2160
2320
|
while (i--) insert(blocks[i], parent, 0);
|
|
2161
2321
|
}
|
|
2162
2322
|
function remove(block, parent) {
|
|
2163
|
-
if (block instanceof Node)
|
|
2164
|
-
else parent && parent.removeChild(block);
|
|
2323
|
+
if (block instanceof Node) removeNode(block, parent);
|
|
2165
2324
|
else if (isVaporComponent(block)) unmountComponent(block, parent);
|
|
2166
2325
|
else if (isArray(block)) for (let i = 0; i < block.length; i++) remove(block[i], parent);
|
|
2167
|
-
else
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2326
|
+
else removeFragment(block, parent);
|
|
2327
|
+
}
|
|
2328
|
+
function removeNode(block, parent) {
|
|
2329
|
+
if (isTransitionEnabled && block.$transition && block instanceof Element) performTransitionLeave(block, block.$transition, () => parent && parent.removeChild(block));
|
|
2330
|
+
else parent && parent.removeChild(block);
|
|
2331
|
+
}
|
|
2332
|
+
function removeFragment(block, parent) {
|
|
2333
|
+
if (block.remove) block.remove(parent, block.$transition);
|
|
2334
|
+
else remove(block.nodes, parent);
|
|
2335
|
+
if (block.anchor) removeNode(block.anchor, parent);
|
|
2336
|
+
if (block.scope) block.scope.stop();
|
|
2173
2337
|
}
|
|
2174
2338
|
/**
|
|
2175
2339
|
* dev / test only
|
|
@@ -2187,7 +2351,7 @@ function normalizeBlock(block) {
|
|
|
2187
2351
|
}
|
|
2188
2352
|
return nodes;
|
|
2189
2353
|
}
|
|
2190
|
-
function
|
|
2354
|
+
function findBlockBoundary(block) {
|
|
2191
2355
|
const lastChild = findLastChild(block);
|
|
2192
2356
|
let { parentNode, nextSibling: nextNode } = lastChild;
|
|
2193
2357
|
if (nextNode && isComment(nextNode, "]") && isFragmentBlock(block) && !isComment(lastChild, "]")) nextNode = nextNode.nextSibling;
|
|
@@ -2214,73 +2378,42 @@ function isFragmentBlock(block) {
|
|
|
2214
2378
|
//#endregion
|
|
2215
2379
|
//#region packages/runtime-vapor/src/hmr.ts
|
|
2216
2380
|
function hmrRerender(instance) {
|
|
2217
|
-
const
|
|
2218
|
-
const parent =
|
|
2219
|
-
|
|
2220
|
-
|
|
2381
|
+
const { parentNode, nextNode: anchor } = findBlockBoundary(instance.block);
|
|
2382
|
+
const parent = parentNode;
|
|
2383
|
+
if (instance.renderEffects) {
|
|
2384
|
+
instance.renderEffects.forEach((e) => e.stop());
|
|
2385
|
+
instance.renderEffects.length = 0;
|
|
2386
|
+
}
|
|
2221
2387
|
remove(instance.block, parent);
|
|
2222
2388
|
const prev = setCurrentInstance(instance);
|
|
2223
2389
|
pushWarningContext(instance);
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2390
|
+
try {
|
|
2391
|
+
devRender(instance);
|
|
2392
|
+
} finally {
|
|
2393
|
+
popWarningContext();
|
|
2394
|
+
setCurrentInstance(...prev);
|
|
2395
|
+
}
|
|
2227
2396
|
insert(instance.block, parent, anchor);
|
|
2228
2397
|
}
|
|
2229
2398
|
function hmrReload(instance, newComp) {
|
|
2230
|
-
|
|
2231
|
-
|
|
2399
|
+
const parentInstance = instance.parent;
|
|
2400
|
+
if (parentInstance) {
|
|
2401
|
+
parentInstance.hmrRerender();
|
|
2232
2402
|
return;
|
|
2233
2403
|
}
|
|
2234
|
-
const
|
|
2235
|
-
const parent =
|
|
2236
|
-
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
2404
|
+
const { parentNode, nextNode: anchor } = findBlockBoundary(instance.block);
|
|
2405
|
+
const parent = parentNode;
|
|
2237
2406
|
unmountComponent(instance, parent);
|
|
2238
|
-
const parentInstance = instance.parent;
|
|
2239
2407
|
const prev = setCurrentInstance(parentInstance);
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* dev only
|
|
2248
|
-
* update parentInstance.block to ensure that the correct parent and
|
|
2249
|
-
* anchor are found during parentInstance HMR rerender/reload, as
|
|
2250
|
-
* `normalizeBlock` relies on the current instance.block
|
|
2251
|
-
*/
|
|
2252
|
-
function updateParentBlockOnHmrReload(parentInstance, instance, newInstance) {
|
|
2253
|
-
if (parentInstance) parentInstance.block = replaceBlockInstance(parentInstance.block, instance, newInstance);
|
|
2254
|
-
}
|
|
2255
|
-
/**
|
|
2256
|
-
* dev only
|
|
2257
|
-
* during root component HMR reload, since the old component will be unmounted
|
|
2258
|
-
* and a new one will be mounted, we need to update the teleport's nodes
|
|
2259
|
-
* to ensure that the correct parent and anchor are found during parentInstance
|
|
2260
|
-
* HMR rerender/reload, as `normalizeBlock` relies on the current instance.block
|
|
2261
|
-
*/
|
|
2262
|
-
function updateParentTeleportOnHmrReload(instance, newInstance) {
|
|
2263
|
-
const teleport = instance.parentTeleport;
|
|
2264
|
-
if (teleport) {
|
|
2265
|
-
newInstance.parentTeleport = teleport;
|
|
2266
|
-
teleport.nodes = replaceBlockInstance(teleport.nodes, instance, newInstance);
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
function replaceBlockInstance(block, instance, newInstance) {
|
|
2270
|
-
if (block === instance) return newInstance;
|
|
2271
|
-
if (isArray(block)) {
|
|
2272
|
-
for (let i = 0; i < block.length; i++) block[i] = replaceBlockInstance(block[i], instance, newInstance);
|
|
2273
|
-
return block;
|
|
2274
|
-
}
|
|
2275
|
-
if (isVaporComponent(block)) {
|
|
2276
|
-
block.block = replaceBlockInstance(block.block, instance, newInstance);
|
|
2277
|
-
return block;
|
|
2278
|
-
}
|
|
2279
|
-
if (isFragment(block)) {
|
|
2280
|
-
block.nodes = replaceBlockInstance(block.nodes, instance, newInstance);
|
|
2281
|
-
return block;
|
|
2408
|
+
let newInstance;
|
|
2409
|
+
try {
|
|
2410
|
+
newInstance = createComponent(newComp, instance.rawProps, instance.rawSlots, instance.isSingleRoot, void 0, instance.appContext);
|
|
2411
|
+
} finally {
|
|
2412
|
+
setCurrentInstance(...prev);
|
|
2282
2413
|
}
|
|
2283
|
-
|
|
2414
|
+
mountComponent(newInstance, parent, anchor);
|
|
2415
|
+
const app = instance.appContext.app;
|
|
2416
|
+
if (app && app._instance === instance) app._instance = newInstance;
|
|
2284
2417
|
}
|
|
2285
2418
|
//#endregion
|
|
2286
2419
|
//#region packages/runtime-vapor/src/suspense.ts
|
|
@@ -2298,7 +2431,9 @@ function setParentSuspense(suspense) {
|
|
|
2298
2431
|
}
|
|
2299
2432
|
//#endregion
|
|
2300
2433
|
//#region packages/runtime-vapor/src/component.ts
|
|
2301
|
-
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext, managedMount = false) {
|
|
2434
|
+
function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appContext = currentInstance && currentInstance.appContext || emptyContext, managedMount = false, ce) {
|
|
2435
|
+
const wasInOnceSlot = inOnceSlot;
|
|
2436
|
+
if (wasInOnceSlot) once = true;
|
|
2302
2437
|
if (isInteropEnabled && isCollectingVdomSlotVNodes) {
|
|
2303
2438
|
if (component.__vapor) return;
|
|
2304
2439
|
const owner = getScopeOwner();
|
|
@@ -2339,7 +2474,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2339
2474
|
if (cached) return cached;
|
|
2340
2475
|
}
|
|
2341
2476
|
if (isInteropEnabled && appContext.vapor && !component.__vapor) {
|
|
2342
|
-
const frag = appContext.vapor.vdomMount(component, currentInstance, rawProps, rawSlots);
|
|
2477
|
+
const frag = appContext.vapor.vdomMount(component, currentInstance, rawProps, normalizeRawSlots(rawSlots), once);
|
|
2343
2478
|
if (isCollectingVdomSlotVNodes) return frag;
|
|
2344
2479
|
if (!isHydrating$1) {
|
|
2345
2480
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
@@ -2347,14 +2482,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2347
2482
|
return frag;
|
|
2348
2483
|
}
|
|
2349
2484
|
if (isTeleportEnabled && isVaporTeleport(component)) {
|
|
2350
|
-
const frag = component.process(rawProps, rawSlots);
|
|
2485
|
+
const frag = component.process(rawProps, normalizeRawSlots(rawSlots));
|
|
2351
2486
|
if (_insertionParent) onScopeDispose$1(() => frag.dispose(), true);
|
|
2352
2487
|
if (!isHydrating$1) {
|
|
2353
2488
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
2354
2489
|
} else frag.hydrate();
|
|
2355
2490
|
return frag;
|
|
2356
2491
|
}
|
|
2357
|
-
const instance = new VaporComponentInstance(component, rawProps, rawSlots, appContext, once);
|
|
2492
|
+
const instance = new VaporComponentInstance(component, rawProps, rawSlots, appContext, once, ce);
|
|
2358
2493
|
if (isKeepAliveEnabled && currentKeepAliveCtx && !isAsyncWrapper(instance)) {
|
|
2359
2494
|
currentKeepAliveCtx.processShapeFlag(instance);
|
|
2360
2495
|
setCurrentKeepAliveCtx(null);
|
|
@@ -2375,7 +2510,10 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2375
2510
|
instance.propsOptions = normalizePropsOptions(component);
|
|
2376
2511
|
instance.emitsOptions = normalizeEmitsOptions(component);
|
|
2377
2512
|
}
|
|
2378
|
-
if (isHydrating$1 && isAsyncWrapper(instance) && component.__asyncHydrate && !component.__asyncResolved)
|
|
2513
|
+
if (isHydrating$1 && isAsyncWrapper(instance) && component.__asyncHydrate && !component.__asyncResolved) {
|
|
2514
|
+
const setup = () => setupComponent(instance, component);
|
|
2515
|
+
component.__asyncHydrate(currentHydrationNode, instance, wasInOnceSlot ? () => withOnceSlot(setup, false) : setup);
|
|
2516
|
+
} else if (wasInOnceSlot) withOnceSlot(() => setupComponent(instance, component), false);
|
|
2379
2517
|
else setupComponent(instance, component);
|
|
2380
2518
|
} finally {
|
|
2381
2519
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -2393,7 +2531,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2393
2531
|
if (isSuspenseEnabled && isHydrating$1 && hydrationClose && instance.suspense && instance.asyncDep && !instance.asyncResolved && instance.restoreAsyncContext) {
|
|
2394
2532
|
deferHydrationBoundary = true;
|
|
2395
2533
|
instance.deferredHydrationBoundary = () => {
|
|
2396
|
-
if (instance.block && hydrationClose &&
|
|
2534
|
+
if (instance.block && hydrationClose && findBlockBoundary(instance.block).nextNode === hydrationClose.nextSibling) setCurrentHydrationNode(hydrationClose);
|
|
2397
2535
|
finalizeHydrationBoundary();
|
|
2398
2536
|
};
|
|
2399
2537
|
exitHydrationCursor(hydrationCursor);
|
|
@@ -2475,7 +2613,7 @@ const emptyContext = {
|
|
|
2475
2613
|
provides: /* @__PURE__ */ Object.create(null)
|
|
2476
2614
|
};
|
|
2477
2615
|
var VaporComponentInstance = class {
|
|
2478
|
-
constructor(comp, rawProps, rawSlots, appContext, once) {
|
|
2616
|
+
constructor(comp, rawProps, rawSlots, appContext, once, ce) {
|
|
2479
2617
|
this.accessedAttrs = false;
|
|
2480
2618
|
this.vapor = true;
|
|
2481
2619
|
this.uid = nextUid();
|
|
@@ -2498,6 +2636,7 @@ var VaporComponentInstance = class {
|
|
|
2498
2636
|
}
|
|
2499
2637
|
this.block = null;
|
|
2500
2638
|
this.scope = new EffectScope(true);
|
|
2639
|
+
this.isOnce = !!once;
|
|
2501
2640
|
this.emit = emit.bind(null, this);
|
|
2502
2641
|
this.expose = expose.bind(null, this);
|
|
2503
2642
|
this.refs = EMPTY_OBJ;
|
|
@@ -2511,17 +2650,18 @@ var VaporComponentInstance = class {
|
|
|
2511
2650
|
this.asyncDep = null;
|
|
2512
2651
|
this.asyncResolved = false;
|
|
2513
2652
|
this.isMounted = this.isUnmounted = this.isUpdating = this.isDeactivated = false;
|
|
2514
|
-
this.rawProps = rawProps || EMPTY_OBJ;
|
|
2515
|
-
this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
|
|
2653
|
+
this.rawProps = this.isOnce && rawProps ? snapshotRawProps(rawProps) : rawProps || EMPTY_OBJ;
|
|
2654
|
+
this.hasFallthrough = hasFallthroughAttrs(comp, this.rawProps);
|
|
2516
2655
|
if (rawProps || comp.props) {
|
|
2517
|
-
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp
|
|
2656
|
+
const [propsHandlers, attrsHandlers] = getPropsProxyHandlers(comp);
|
|
2518
2657
|
this.attrs = new Proxy(this, attrsHandlers);
|
|
2519
2658
|
this.props = comp.props ? new Proxy(this, propsHandlers) : isFunction(comp) ? this.attrs : EMPTY_OBJ;
|
|
2520
2659
|
} else this.props = this.attrs = EMPTY_OBJ;
|
|
2521
|
-
|
|
2522
|
-
this.
|
|
2660
|
+
const normalizedRawSlots = normalizeRawSlots(rawSlots);
|
|
2661
|
+
this.rawSlots = normalizedRawSlots || EMPTY_OBJ;
|
|
2662
|
+
this.slots = normalizedRawSlots ? new Proxy(normalizedRawSlots, dynamicSlotsProxyHandlers) : EMPTY_OBJ;
|
|
2523
2663
|
this.scopeId = getCurrentScopeId();
|
|
2524
|
-
if (
|
|
2664
|
+
if (ce) ce(this);
|
|
2525
2665
|
if (!!(process.env.NODE_ENV !== "production")) if (this.props === this.attrs) this.accessedAttrs = true;
|
|
2526
2666
|
else {
|
|
2527
2667
|
const attrs = this.attrs;
|
|
@@ -2544,6 +2684,14 @@ function isVaporComponent(value) {
|
|
|
2544
2684
|
return value instanceof VaporComponentInstance;
|
|
2545
2685
|
}
|
|
2546
2686
|
/**
|
|
2687
|
+
* Resolve an asset component by name before passing it to the fallback helper;
|
|
2688
|
+
* a string passed directly to `createComponentWithFallback` is plain element
|
|
2689
|
+
* fallback, not a component name.
|
|
2690
|
+
*/
|
|
2691
|
+
function createAssetComponent(name, rawProps, rawSlots, isSingleRoot, once, maybeSelfReference, appContext) {
|
|
2692
|
+
return createComponentWithFallback(resolveComponent(name, maybeSelfReference), rawProps, rawSlots, isSingleRoot, once, appContext);
|
|
2693
|
+
}
|
|
2694
|
+
/**
|
|
2547
2695
|
* Used when a component cannot be resolved at compile time
|
|
2548
2696
|
* and needs rely on runtime resolution - where it might fallback to a plain
|
|
2549
2697
|
* element if the resolution fails.
|
|
@@ -2556,7 +2704,7 @@ function createComponentWithFallback(comp, rawProps, rawSlots, isSingleRoot, onc
|
|
|
2556
2704
|
if (isComment(node, "")) advanceHydrationNode(node);
|
|
2557
2705
|
return node;
|
|
2558
2706
|
}
|
|
2559
|
-
const nextAnchor =
|
|
2707
|
+
const nextAnchor = nextLogicalSibling(currentHydrationNode);
|
|
2560
2708
|
if (nextAnchor && isReusableNullComponentAnchor(nextAnchor)) return nextAnchor;
|
|
2561
2709
|
}
|
|
2562
2710
|
return !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("ndc") : /* @__PURE__ */ createTextNode("");
|
|
@@ -2568,12 +2716,17 @@ function isReusableNullComponentAnchor(node) {
|
|
|
2568
2716
|
return isComment(node, "") || isComment(node, "dynamic-component") || isComment(node, "async component") || isComment(node, "keyed");
|
|
2569
2717
|
}
|
|
2570
2718
|
function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
2719
|
+
rawSlots = normalizeRawSlots(rawSlots);
|
|
2571
2720
|
const _insertionParent = insertionParent;
|
|
2572
2721
|
const _insertionAnchor = insertionAnchor;
|
|
2573
2722
|
let hydrationCursor = null;
|
|
2574
2723
|
if (isHydrating$1) hydrationCursor = enterHydrationCursor();
|
|
2575
2724
|
else resetInsertionState();
|
|
2576
|
-
const
|
|
2725
|
+
const defaultSlot = rawSlots && getSlot(rawSlots, "default");
|
|
2726
|
+
const hasDynamicSlots = !!rawSlots && !!rawSlots.$;
|
|
2727
|
+
const adoptHydrationChildren = !!defaultSlot;
|
|
2728
|
+
const hydrationTemplate = hasDynamicSlots && !defaultSlot ? `<${comp}><!></${comp}>` : `<${comp}/>`;
|
|
2729
|
+
const el = isHydrating$1 ? adoptTemplate(currentHydrationNode, hydrationTemplate, adoptHydrationChildren) : /* @__PURE__ */ createElement(comp);
|
|
2577
2730
|
el.$root = isSingleRoot;
|
|
2578
2731
|
if (!isHydrating$1) {
|
|
2579
2732
|
const scopeId = getCurrentScopeId();
|
|
@@ -2587,7 +2740,7 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
2587
2740
|
if (rawSlots) {
|
|
2588
2741
|
let nextNode = null;
|
|
2589
2742
|
if (isHydrating$1) {
|
|
2590
|
-
nextNode =
|
|
2743
|
+
nextNode = nextLogicalSibling(el);
|
|
2591
2744
|
setCurrentHydrationNode(el.firstChild);
|
|
2592
2745
|
}
|
|
2593
2746
|
if (rawSlots.$) {
|
|
@@ -2642,7 +2795,7 @@ function mountComponent(instance, parent, anchor) {
|
|
|
2642
2795
|
if (!isHydrating$1) {
|
|
2643
2796
|
insert(instance.block, parent, anchor);
|
|
2644
2797
|
setComponentScopeId(instance);
|
|
2645
|
-
}
|
|
2798
|
+
} else trackComponentScopeId(instance);
|
|
2646
2799
|
if (instance.m) queuePostFlushCb(instance.m);
|
|
2647
2800
|
if (isKeepAliveEnabled && instance.shapeFlag & 256 && instance.a) queuePostFlushCb(instance.a);
|
|
2648
2801
|
instance.isMounted = true;
|
|
@@ -2708,18 +2861,65 @@ function handleSetupResult(setupResult, component, instance) {
|
|
|
2708
2861
|
else if (setupResult === EMPTY_OBJ && component.render) instance.block = callRender(component.render, instance, setupResult);
|
|
2709
2862
|
else instance.block = setupResult;
|
|
2710
2863
|
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2713
|
-
|
|
2864
|
+
const getFallthroughAttrs = isFunction(component) && !(isTransitionEnabled ? isVaporTransition(component) : false) ? () => getFunctionalFallthrough(instance.attrs) : () => instance.attrs;
|
|
2865
|
+
applyFallthroughAttrs(instance.block, instance, getFallthroughAttrs);
|
|
2866
|
+
}
|
|
2867
|
+
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
|
|
2868
|
+
}
|
|
2869
|
+
function applyFallthroughAttrs(block, instance, getFallthroughAttrs, scope) {
|
|
2870
|
+
let hasSlotFragment = false;
|
|
2871
|
+
let dynamicFragments;
|
|
2872
|
+
const root = getRootElement(block, (frag) => {
|
|
2873
|
+
if (frag.isSlot) hasSlotFragment = true;
|
|
2874
|
+
else (dynamicFragments || (dynamicFragments = [])).push(frag);
|
|
2875
|
+
}, false);
|
|
2876
|
+
const dynamicRoot = root ? void 0 : getSingleDynamicRootChain(block);
|
|
2877
|
+
const fragmentsToRegister = root ? dynamicFragments : dynamicRoot && dynamicRoot.fragments;
|
|
2878
|
+
if (fragmentsToRegister) {
|
|
2879
|
+
for (const frag of fragmentsToRegister) if (!frag.isSlot) registerDynamicFragmentFallthroughAttrs(frag, instance, getFallthroughAttrs);
|
|
2880
|
+
}
|
|
2881
|
+
if (root && !hasSlotFragment) {
|
|
2882
|
+
const applyEffect = () => renderEffect(() => {
|
|
2883
|
+
const attrs = getFallthroughAttrs();
|
|
2714
2884
|
if (attrs) applyFallthroughProps(root, attrs);
|
|
2715
2885
|
});
|
|
2716
|
-
|
|
2886
|
+
scope ? scope.run(applyEffect) : applyEffect();
|
|
2887
|
+
} else if (!!(process.env.NODE_ENV !== "production") && (hasSlotFragment || dynamicRoot && dynamicRoot.hasNonSingleRoot || isTeleportEnabled && containsTeleportFragment(block) || !instance.accessedAttrs && isArray(block) && block.length)) warnExtraneousAttributes(instance.attrs);
|
|
2888
|
+
}
|
|
2889
|
+
function getSingleDynamicRootChain(block) {
|
|
2890
|
+
if (block instanceof DynamicFragment) {
|
|
2891
|
+
const { nodes } = block;
|
|
2892
|
+
const nested = getSingleDynamicRootChain(nodes);
|
|
2893
|
+
return {
|
|
2894
|
+
fragments: nested ? [block, ...nested.fragments] : [block],
|
|
2895
|
+
hasNonSingleRoot: nested ? nested.hasNonSingleRoot : isArray(nodes) && nodes.some((child) => !(child instanceof Comment))
|
|
2896
|
+
};
|
|
2897
|
+
}
|
|
2898
|
+
if (isFragment(block) && !(isTeleportEnabled && isTeleportFragment(block))) return getSingleDynamicRootChain(block.nodes);
|
|
2899
|
+
if (isArray(block)) {
|
|
2900
|
+
let singleRoot;
|
|
2901
|
+
let hasComment = false;
|
|
2902
|
+
for (const child of block) {
|
|
2903
|
+
if (child instanceof Comment) {
|
|
2904
|
+
hasComment = true;
|
|
2905
|
+
continue;
|
|
2906
|
+
}
|
|
2907
|
+
const childRoot = getSingleDynamicRootChain(child);
|
|
2908
|
+
if (!childRoot || singleRoot) return;
|
|
2909
|
+
singleRoot = childRoot;
|
|
2910
|
+
}
|
|
2911
|
+
return hasComment ? singleRoot : void 0;
|
|
2717
2912
|
}
|
|
2718
|
-
if (!!(process.env.NODE_ENV !== "production")) popWarningContext();
|
|
2719
2913
|
}
|
|
2720
|
-
function
|
|
2721
|
-
|
|
2722
|
-
|
|
2914
|
+
function containsTeleportFragment(block) {
|
|
2915
|
+
if (isTeleportFragment(block)) return true;
|
|
2916
|
+
if (isArray(block)) return block.some((child) => !(child instanceof Comment) && containsTeleportFragment(child));
|
|
2917
|
+
return isFragment(block) && containsTeleportFragment(block.nodes);
|
|
2918
|
+
}
|
|
2919
|
+
function registerDynamicFragmentFallthroughAttrs(frag, instance, getFallthroughAttrs) {
|
|
2920
|
+
if (frag.hasFallthroughAttrs) return;
|
|
2921
|
+
frag.hasFallthroughAttrs = true;
|
|
2922
|
+
(frag.onBeforeInsert || (frag.onBeforeInsert = [])).push((nodes) => applyFallthroughAttrs(nodes, instance, getFallthroughAttrs, frag.scope));
|
|
2723
2923
|
}
|
|
2724
2924
|
//#endregion
|
|
2725
2925
|
//#region packages/runtime-vapor/src/apiCreateApp.ts
|
|
@@ -2829,17 +3029,20 @@ function defineVaporAsyncComponent(source) {
|
|
|
2829
3029
|
frag.update(() => createInnerComp(resolvedComp, instance));
|
|
2830
3030
|
return frag;
|
|
2831
3031
|
}
|
|
3032
|
+
frag.validityPending = true;
|
|
2832
3033
|
const onError = (err) => {
|
|
2833
3034
|
setPendingRequest(null);
|
|
2834
3035
|
handleError(err, instance, 13, !errorComponent);
|
|
2835
3036
|
};
|
|
2836
3037
|
if (suspensible && instance.suspense) return load().then(() => {
|
|
2837
3038
|
resolvedComp = getResolvedComp();
|
|
3039
|
+
frag.validityPending = false;
|
|
2838
3040
|
if (resolvedComp) frag.update(() => createInnerComp(resolvedComp, instance));
|
|
2839
3041
|
return frag;
|
|
2840
3042
|
}).catch((err) => {
|
|
2841
3043
|
onError(err);
|
|
2842
|
-
|
|
3044
|
+
frag.validityPending = false;
|
|
3045
|
+
if (errorComponent) frag.update(() => createErrorComp(errorComponent, instance, err));
|
|
2843
3046
|
return frag;
|
|
2844
3047
|
});
|
|
2845
3048
|
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
@@ -2853,8 +3056,11 @@ function defineVaporAsyncComponent(source) {
|
|
|
2853
3056
|
resolvedComp = getResolvedComp();
|
|
2854
3057
|
let render;
|
|
2855
3058
|
if (loaded.value && resolvedComp) render = () => createInnerComp(resolvedComp, instance);
|
|
2856
|
-
else if (error.value && errorComponent)
|
|
2857
|
-
|
|
3059
|
+
else if (error.value && errorComponent) {
|
|
3060
|
+
const err = error.value;
|
|
3061
|
+
render = () => createErrorComp(errorComponent, instance, err);
|
|
3062
|
+
} else if (loadingComponent && !delayed.value) render = () => createInnerComp(loadingComponent, instance);
|
|
3063
|
+
frag.validityPending = !render && !error.value;
|
|
2858
3064
|
frag.update(render);
|
|
2859
3065
|
if (isKeepAliveEnabled && frag.keepAliveCtx) frag.keepAliveCtx.cacheBlock();
|
|
2860
3066
|
});
|
|
@@ -2862,10 +3068,13 @@ function defineVaporAsyncComponent(source) {
|
|
|
2862
3068
|
}
|
|
2863
3069
|
});
|
|
2864
3070
|
}
|
|
3071
|
+
function createErrorComp(comp, parent, error) {
|
|
3072
|
+
return createInnerComp(comp, parent, { error: () => error }, {});
|
|
3073
|
+
}
|
|
2865
3074
|
function createInnerComp(comp, parent, rawProps = parent.rawProps, rawSlots = parent.rawSlots) {
|
|
2866
3075
|
const prevInstance = setCurrentInstance(parent);
|
|
2867
3076
|
try {
|
|
2868
|
-
return createComponent(comp, rawProps, rawSlots, void 0,
|
|
3077
|
+
return createComponent(comp, rawProps, rawSlots, void 0, parent.isOnce, parent.appContext);
|
|
2869
3078
|
} finally {
|
|
2870
3079
|
setCurrentInstance(...prevInstance);
|
|
2871
3080
|
}
|
|
@@ -2929,10 +3138,11 @@ function setDisplay(target, value) {
|
|
|
2929
3138
|
else el.style.display = "none";
|
|
2930
3139
|
else if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating$1) {
|
|
2931
3140
|
if (!value && el.style.display !== "none") {
|
|
2932
|
-
warnPropMismatch(el, "style", 3, `display: ${el.style.display}`, "display: none")
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
3141
|
+
if (warnPropMismatch(el, "style", 3, `display: ${el.style.display}`, "display: none")) {
|
|
3142
|
+
logMismatchError();
|
|
3143
|
+
el.style.display = "none";
|
|
3144
|
+
el[vShowOriginalDisplay] = "";
|
|
3145
|
+
}
|
|
2936
3146
|
}
|
|
2937
3147
|
} else el.style.display = value ? el[vShowOriginalDisplay] : "none";
|
|
2938
3148
|
el[vShowHidden] = !value;
|
|
@@ -3082,7 +3292,7 @@ function applyResolvedTransitionHooks(block, hooks) {
|
|
|
3082
3292
|
if (block.length === 1) block = block[0];
|
|
3083
3293
|
else if (block.length === 0) return { hooks };
|
|
3084
3294
|
}
|
|
3085
|
-
if (hooks.applyGroup && block instanceof ForFragment) {
|
|
3295
|
+
if (hooks.applyGroup && (block instanceof ForFragment || isSlotFragment(block) || isVaporComponent(block) && isSlotFragment(block.block))) {
|
|
3086
3296
|
hooks.applyGroup(block, hooks.props, hooks.state, hooks.instance);
|
|
3087
3297
|
return { hooks };
|
|
3088
3298
|
}
|
|
@@ -3295,7 +3505,7 @@ const VaporKeepAlive = /* @__PURE__ */ withKeepAliveEnabled(/* @__PURE__ */ defi
|
|
|
3295
3505
|
cache.forEach((cached) => {
|
|
3296
3506
|
unsetShapeFlag(cached);
|
|
3297
3507
|
if (cached !== current) {
|
|
3298
|
-
const parentNode =
|
|
3508
|
+
const parentNode = findBlockBoundary(cached).parentNode;
|
|
3299
3509
|
if (parentNode) remove(cached, parentNode);
|
|
3300
3510
|
}
|
|
3301
3511
|
});
|
|
@@ -3387,7 +3597,7 @@ const VaporKeepAlive = /* @__PURE__ */ withKeepAliveEnabled(/* @__PURE__ */ defi
|
|
|
3387
3597
|
const cached = cache.get(key);
|
|
3388
3598
|
if (cached && (!current || cached !== current)) {
|
|
3389
3599
|
unsetShapeFlag(cached);
|
|
3390
|
-
const parentNode =
|
|
3600
|
+
const parentNode = findBlockBoundary(cached).parentNode;
|
|
3391
3601
|
if (parentNode) remove(cached, parentNode);
|
|
3392
3602
|
} else if (current) unsetShapeFlag(current);
|
|
3393
3603
|
cache.delete(key);
|
|
@@ -3438,7 +3648,7 @@ const VaporKeepAlive = /* @__PURE__ */ withKeepAliveEnabled(/* @__PURE__ */ defi
|
|
|
3438
3648
|
keptAliveScopes.forEach((scope) => scope.stop());
|
|
3439
3649
|
keptAliveScopes.clear();
|
|
3440
3650
|
});
|
|
3441
|
-
const
|
|
3651
|
+
const keepAliveCtx = {
|
|
3442
3652
|
processShapeFlag,
|
|
3443
3653
|
cacheBlock,
|
|
3444
3654
|
cacheScope(cacheKey, scopeLookupKey, scope) {
|
|
@@ -3453,11 +3663,14 @@ const VaporKeepAlive = /* @__PURE__ */ withKeepAliveEnabled(/* @__PURE__ */ defi
|
|
|
3453
3663
|
getScope(key) {
|
|
3454
3664
|
return deleteScope(key);
|
|
3455
3665
|
}
|
|
3456
|
-
}
|
|
3666
|
+
};
|
|
3667
|
+
const prevCtx = setCurrentKeepAliveCtx(keepAliveCtx);
|
|
3457
3668
|
let children = slots.default();
|
|
3458
3669
|
setCurrentKeepAliveCtx(prevCtx);
|
|
3670
|
+
registerDynamicFragmentHooks(children, keepAliveCtx);
|
|
3459
3671
|
if (isArray(children)) {
|
|
3460
3672
|
children = children.filter((child) => !(child instanceof Comment));
|
|
3673
|
+
if (children.length === 1) registerDynamicFragmentHooks(children[0], keepAliveCtx);
|
|
3461
3674
|
if (children.length > 1) {
|
|
3462
3675
|
if (!!(process.env.NODE_ENV !== "production")) warn(`KeepAlive should contain exactly one component child.`);
|
|
3463
3676
|
return children;
|
|
@@ -3466,6 +3679,20 @@ const VaporKeepAlive = /* @__PURE__ */ withKeepAliveEnabled(/* @__PURE__ */ defi
|
|
|
3466
3679
|
return children;
|
|
3467
3680
|
}
|
|
3468
3681
|
}));
|
|
3682
|
+
function registerDynamicFragmentHooks(block, keepAliveCtx) {
|
|
3683
|
+
if (!isDynamicFragment(block)) return;
|
|
3684
|
+
(block.onBeforeRemove || (block.onBeforeRemove = [])).push((scope) => {
|
|
3685
|
+
const cacheKey = block.keyed ? withCurrentCacheKey(block.current, () => keepAliveCtx.processShapeFlag(block.nodes)) : keepAliveCtx.processShapeFlag(block.nodes);
|
|
3686
|
+
if (cacheKey !== false) {
|
|
3687
|
+
keepAliveCtx.cacheScope(cacheKey, block.current, scope);
|
|
3688
|
+
return true;
|
|
3689
|
+
}
|
|
3690
|
+
return false;
|
|
3691
|
+
});
|
|
3692
|
+
(block.onUpdated || (block.onUpdated = [])).unshift(() => {
|
|
3693
|
+
if (block.$transition && block.$transition.mode === "out-in") keepAliveCtx.cacheBlock(block);
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3469
3696
|
const shouldCache = (block, props, interop = false) => {
|
|
3470
3697
|
const isAsync = isAsyncWrapper(interop ? block.vnode : block);
|
|
3471
3698
|
const type = interop && isInteropEnabled ? block.vnode.type : block.type;
|
|
@@ -3502,9 +3729,6 @@ function getInnerBlock(block) {
|
|
|
3502
3729
|
else if (isFragment(block)) return getInnerBlock(block.nodes);
|
|
3503
3730
|
return [void 0, false];
|
|
3504
3731
|
}
|
|
3505
|
-
function isInteropFragment(block) {
|
|
3506
|
-
return !!(isFragment(block) && block.vnode);
|
|
3507
|
-
}
|
|
3508
3732
|
function getInstanceFromCache(cached) {
|
|
3509
3733
|
if (isVaporComponent(cached)) return cached;
|
|
3510
3734
|
if (isInteropEnabled) return cached.vnode.component;
|
|
@@ -3530,6 +3754,8 @@ function deactivate$1(instance, container) {
|
|
|
3530
3754
|
}
|
|
3531
3755
|
//#endregion
|
|
3532
3756
|
//#region packages/runtime-vapor/src/vdomInterop.ts
|
|
3757
|
+
const EMPTY_BLOCK = EMPTY_ARR;
|
|
3758
|
+
const EMPTY_VNODES = EMPTY_ARR;
|
|
3533
3759
|
function filterReservedProps(props) {
|
|
3534
3760
|
const filtered = {};
|
|
3535
3761
|
for (const key in props) if (!isReservedProp(key)) filtered[key] = props[key];
|
|
@@ -3537,7 +3763,7 @@ function filterReservedProps(props) {
|
|
|
3537
3763
|
}
|
|
3538
3764
|
const vaporInteropImpl = {
|
|
3539
3765
|
mount(vnode, container, anchor, parentComponent, parentSuspense, onBeforeMount, onVnodeBeforeMount) {
|
|
3540
|
-
|
|
3766
|
+
const selfAnchor = vnode.anchor = /* @__PURE__ */ createTextNode();
|
|
3541
3767
|
if (isHydrating$1) queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
3542
3768
|
else {
|
|
3543
3769
|
vnode.el = selfAnchor;
|
|
@@ -3555,7 +3781,9 @@ const vaporInteropImpl = {
|
|
|
3555
3781
|
const instance = vnode.component = createComponent(vnode.type, { $: dynamicPropSource }, rawSlots, void 0, void 0, parentComponent ? parentComponent.appContext : vnode.appContext, true);
|
|
3556
3782
|
instance.rawPropsRef = propsRef;
|
|
3557
3783
|
instance.rawSlotsRef = slotsRef;
|
|
3558
|
-
ensureVNodeHookState(instance, vnode);
|
|
3784
|
+
const vnodeHookState = ensureVNodeHookState(instance, vnode);
|
|
3785
|
+
const applyScopeId = (vnode) => setInteropVnodeScopeId(instance, vnode, instance.parent);
|
|
3786
|
+
vnodeHookState.postRootSyncHooks.push(applyScopeId);
|
|
3559
3787
|
if (parentComponent && isKeepAlive(parentComponent)) {
|
|
3560
3788
|
enableKeepAlive();
|
|
3561
3789
|
instance.shapeFlag = vnode.shapeFlag;
|
|
@@ -3574,6 +3802,7 @@ const vaporInteropImpl = {
|
|
|
3574
3802
|
vnode.dirs = null;
|
|
3575
3803
|
}
|
|
3576
3804
|
mountComponent(instance, container, selfAnchor);
|
|
3805
|
+
if (!isHydrating$1) applyScopeId(vnodeHookState.vnode);
|
|
3577
3806
|
simpleSetCurrentInstance(prev);
|
|
3578
3807
|
return instance;
|
|
3579
3808
|
},
|
|
@@ -3594,6 +3823,7 @@ const vaporInteropImpl = {
|
|
|
3594
3823
|
instance.rawSlotsRef.value = normalizeInteropSlots(n2.children);
|
|
3595
3824
|
queuePostFlushCb(() => {
|
|
3596
3825
|
syncVNodeEl(n2, instance);
|
|
3826
|
+
setInteropVnodeScopeId(instance, n2, instance.parent);
|
|
3597
3827
|
if (!instance.isUpdating) vnodeHookState.skipVnodeHooks = false;
|
|
3598
3828
|
});
|
|
3599
3829
|
}
|
|
@@ -3607,14 +3837,14 @@ const vaporInteropImpl = {
|
|
|
3607
3837
|
const anchor = vnode.anchor;
|
|
3608
3838
|
unmountComponent(instance, container);
|
|
3609
3839
|
if (!doRemove) {
|
|
3610
|
-
const blockContainer =
|
|
3840
|
+
const blockContainer = needsHostParentForRemove(instance.block) ? anchor && anchor.parentNode : void 0;
|
|
3611
3841
|
remove(instance.block, blockContainer);
|
|
3612
3842
|
}
|
|
3613
3843
|
}
|
|
3614
3844
|
} else if (vnode.vb) {
|
|
3615
3845
|
const anchor = vnode.anchor;
|
|
3616
3846
|
if (vnode.el && vnode.el !== anchor && isComment(vnode.el, "[")) slotStartAnchor = vnode.el;
|
|
3617
|
-
const blockContainer = container || (
|
|
3847
|
+
const blockContainer = container || (needsHostParentForRemove(vnode.vb) ? anchor && anchor.parentNode : void 0);
|
|
3618
3848
|
remove(vnode.vb, blockContainer);
|
|
3619
3849
|
stopVaporSlotScope(vnode);
|
|
3620
3850
|
}
|
|
@@ -3759,26 +3989,35 @@ const vaporSlotPropsProxyHandler = {
|
|
|
3759
3989
|
}
|
|
3760
3990
|
};
|
|
3761
3991
|
const vaporSlotWrappersCache = /* @__PURE__ */ new WeakMap();
|
|
3762
|
-
const vaporSlotsProxyHandler = {
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
slot
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3992
|
+
const vaporSlotsProxyHandler = {
|
|
3993
|
+
get(target, key) {
|
|
3994
|
+
const slot = isString(key) && !isInternalSlotKey(key) ? getSlot(target, key) : target[key];
|
|
3995
|
+
if (isFunction(slot)) {
|
|
3996
|
+
slot.__vapor = true;
|
|
3997
|
+
let wrappers = vaporSlotWrappersCache.get(target);
|
|
3998
|
+
if (!wrappers) vaporSlotWrappersCache.set(target, wrappers = /* @__PURE__ */ new Map());
|
|
3999
|
+
const cached = wrappers.get(key);
|
|
4000
|
+
if (cached && cached.slot === slot) return cached.wrapped;
|
|
4001
|
+
const wrapped = (props) => {
|
|
4002
|
+
return normalizeVaporSlotVNodes(slot, props) || [renderSlot({ [key]: slot }, key, props)];
|
|
4003
|
+
};
|
|
4004
|
+
wrapped.__vs = slot;
|
|
4005
|
+
wrappers.set(key, {
|
|
4006
|
+
slot,
|
|
4007
|
+
wrapped
|
|
4008
|
+
});
|
|
4009
|
+
return wrapped;
|
|
4010
|
+
}
|
|
4011
|
+
return slot;
|
|
4012
|
+
},
|
|
4013
|
+
ownKeys(target) {
|
|
4014
|
+
return Array.from(dynamicSlotsProxyHandlers.ownKeys(target)).filter((key) => isString(key) && !isInternalSlotKey(key));
|
|
4015
|
+
},
|
|
4016
|
+
getOwnPropertyDescriptor(target, key) {
|
|
4017
|
+
if (!isString(key) || isInternalSlotKey(key)) return;
|
|
4018
|
+
return dynamicSlotsProxyHandlers.getOwnPropertyDescriptor(target, key);
|
|
3779
4019
|
}
|
|
3780
|
-
|
|
3781
|
-
} };
|
|
4020
|
+
};
|
|
3782
4021
|
const collectedVdomSlotVNodes = /* @__PURE__ */ new WeakMap();
|
|
3783
4022
|
function normalizeVaporSlotVNodes(slot, props) {
|
|
3784
4023
|
if (props && hasVNodeSlotProps(props)) return;
|
|
@@ -3860,29 +4099,43 @@ function removeAttachedNodes(block, parent) {
|
|
|
3860
4099
|
if (block.parentNode === parent) remove(block, parent);
|
|
3861
4100
|
} else if (isArray(block)) for (let i = 0; i < block.length; i++) removeAttachedNodes(block[i], parent);
|
|
3862
4101
|
}
|
|
3863
|
-
function
|
|
4102
|
+
function appendVnodeHook(vnode, key, hook) {
|
|
3864
4103
|
const props = vnode.props || (vnode.props = {});
|
|
3865
|
-
const existing = props
|
|
3866
|
-
props
|
|
4104
|
+
const existing = props[key];
|
|
4105
|
+
props[key] = existing ? isArray(existing) ? [...existing, hook] : [existing, hook] : hook;
|
|
4106
|
+
}
|
|
4107
|
+
function trackFragmentVNodeUpdates(frag, vnode, syncNodes) {
|
|
4108
|
+
const beforeUpdate = () => {
|
|
4109
|
+
if (frag.onBeforeUpdate) frag.onBeforeUpdate.forEach((bu) => bu());
|
|
4110
|
+
};
|
|
4111
|
+
const updated = () => {
|
|
4112
|
+
syncNodes();
|
|
4113
|
+
if (frag.onUpdated) frag.onUpdated.forEach((u) => u());
|
|
4114
|
+
};
|
|
4115
|
+
appendVnodeHook(vnode, "onVnodeBeforeUpdate", beforeUpdate);
|
|
4116
|
+
appendVnodeHook(vnode, "onVnodeUpdated", updated);
|
|
3867
4117
|
}
|
|
3868
|
-
function
|
|
3869
|
-
const
|
|
4118
|
+
function createVNodeFragment(vnode) {
|
|
4119
|
+
const frag = createInteropFragment(EMPTY_BLOCK, vnode);
|
|
4120
|
+
frag.$key = vnode.key;
|
|
4121
|
+
let validityPending = !isHydrating$1;
|
|
4122
|
+
const syncNodes = () => {
|
|
3870
4123
|
frag.nodes = resolveVNodeNodes(vnode);
|
|
3871
|
-
|
|
3872
|
-
|
|
4124
|
+
validityPending = false;
|
|
4125
|
+
};
|
|
4126
|
+
frag.isBlockValid = () => validityPending ? true : isValidBlock(frag.nodes);
|
|
4127
|
+
trackFragmentVNodeUpdates(frag, vnode, syncNodes);
|
|
4128
|
+
return {
|
|
4129
|
+
frag,
|
|
4130
|
+
syncNodes
|
|
3873
4131
|
};
|
|
3874
|
-
appendVnodeUpdatedHook(vnode, refresh);
|
|
3875
4132
|
}
|
|
3876
4133
|
/**
|
|
3877
4134
|
* Mount VNode in vapor
|
|
3878
4135
|
*/
|
|
3879
4136
|
function mountVNode(internals, vnode, parentComponent) {
|
|
3880
4137
|
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
3881
|
-
const frag =
|
|
3882
|
-
frag.validityPending = !isHydrating$1;
|
|
3883
|
-
frag.vnode = vnode;
|
|
3884
|
-
frag.$key = vnode.key;
|
|
3885
|
-
trackFragmentVNodeUpdates(frag, vnode);
|
|
4138
|
+
const { frag, syncNodes } = createVNodeFragment(vnode);
|
|
3886
4139
|
let isMounted = false;
|
|
3887
4140
|
const unmount = (parentNode, transition) => {
|
|
3888
4141
|
if (transition) setTransitionHooks(vnode, transition);
|
|
@@ -3895,8 +4148,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
3895
4148
|
hydrateVNode(vnode, parentComponent);
|
|
3896
4149
|
onScopeDispose(unmount, true);
|
|
3897
4150
|
isMounted = true;
|
|
3898
|
-
|
|
3899
|
-
frag.validityPending = false;
|
|
4151
|
+
syncNodes();
|
|
3900
4152
|
};
|
|
3901
4153
|
frag.insert = (parentNode, anchor, transition) => {
|
|
3902
4154
|
if (isHydrating$1) return;
|
|
@@ -3915,8 +4167,7 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
3915
4167
|
} else internals.m(vnode, parentNode, anchor, 2, parentComponent);
|
|
3916
4168
|
simpleSetCurrentInstance(prev);
|
|
3917
4169
|
}
|
|
3918
|
-
|
|
3919
|
-
frag.validityPending = false;
|
|
4170
|
+
syncNodes();
|
|
3920
4171
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
3921
4172
|
};
|
|
3922
4173
|
frag.remove = unmount;
|
|
@@ -3925,15 +4176,12 @@ function mountVNode(internals, vnode, parentComponent) {
|
|
|
3925
4176
|
/**
|
|
3926
4177
|
* Mount vdom component in vapor
|
|
3927
4178
|
*/
|
|
3928
|
-
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots) {
|
|
4179
|
+
function createVDOMComponent(internals, component, parentComponent, rawProps, rawSlots, once) {
|
|
3929
4180
|
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
3930
4181
|
const useBridge = shouldUseRendererBridge(component);
|
|
3931
4182
|
const comp = useBridge ? ensureRendererBridge(component) : component;
|
|
3932
|
-
const
|
|
3933
|
-
frag
|
|
3934
|
-
const vnode = frag.vnode = createVNode(comp, rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers)));
|
|
3935
|
-
frag.$key = vnode.key;
|
|
3936
|
-
trackFragmentVNodeUpdates(frag, vnode);
|
|
4183
|
+
const vnode = createVNode(comp, rawProps && extend({}, new Proxy(rawProps, rawPropsProxyHandlers)));
|
|
4184
|
+
const { frag, syncNodes } = createVNodeFragment(vnode);
|
|
3937
4185
|
if (!isCollectingVdomSlotVNodes && isKeepAliveEnabled && currentKeepAliveCtx) {
|
|
3938
4186
|
currentKeepAliveCtx.processShapeFlag(frag);
|
|
3939
4187
|
if (component.__asyncLoader) {
|
|
@@ -3946,8 +4194,8 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
3946
4194
|
}
|
|
3947
4195
|
setCurrentKeepAliveCtx(null);
|
|
3948
4196
|
}
|
|
3949
|
-
const wrapper = new VaporComponentInstance(useBridge ? comp : { props: component.props }, rawProps, rawSlots, parentComponent ? parentComponent.appContext : void 0,
|
|
3950
|
-
if (isCollectingVdomSlotVNodes) collectedVdomSlotVNodes.set(frag, createCollectedVDOMSlotVNode(component, rawProps, wrapper.
|
|
4197
|
+
const wrapper = new VaporComponentInstance(useBridge ? comp : { props: component.props }, rawProps, rawSlots, parentComponent ? parentComponent.appContext : void 0, once);
|
|
4198
|
+
if (isCollectingVdomSlotVNodes) collectedVdomSlotVNodes.set(frag, createCollectedVDOMSlotVNode(component, rawProps, wrapper.rawSlots));
|
|
3951
4199
|
vnode.vi = (instance) => {
|
|
3952
4200
|
instance.props = shallowReactive(wrapper.props);
|
|
3953
4201
|
const attrs = createInternalObject();
|
|
@@ -3970,7 +4218,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
3970
4218
|
};
|
|
3971
4219
|
}
|
|
3972
4220
|
});
|
|
3973
|
-
instance.slots = wrapper.
|
|
4221
|
+
instance.slots = wrapper.rawSlots === EMPTY_OBJ ? EMPTY_OBJ : new Proxy(wrapper.rawSlots, vaporSlotsProxyHandler);
|
|
3974
4222
|
};
|
|
3975
4223
|
let rawRef = null;
|
|
3976
4224
|
let isMounted = false;
|
|
@@ -4001,8 +4249,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
4001
4249
|
if (!isHydrating$1) return;
|
|
4002
4250
|
hydrateVNode(vnode, parentComponent);
|
|
4003
4251
|
isMounted = true;
|
|
4004
|
-
|
|
4005
|
-
frag.validityPending = false;
|
|
4252
|
+
syncNodes();
|
|
4006
4253
|
};
|
|
4007
4254
|
vnode.scopeId = getCurrentScopeId() || null;
|
|
4008
4255
|
vnode.slotScopeIds = currentSlotScopeIds;
|
|
@@ -4020,8 +4267,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
4020
4267
|
} else internals.m(vnode, parentNode, anchor, 2, parentComponent);
|
|
4021
4268
|
simpleSetCurrentInstance(prev);
|
|
4022
4269
|
}
|
|
4023
|
-
|
|
4024
|
-
frag.validityPending = false;
|
|
4270
|
+
syncNodes();
|
|
4025
4271
|
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
4026
4272
|
};
|
|
4027
4273
|
frag.remove = unmount;
|
|
@@ -4061,12 +4307,6 @@ function ensureRendererBridge(component) {
|
|
|
4061
4307
|
if (!bridge) rendererBridgeCache.set(component, bridge = (props, { slots }) => createVNode(component, props, slots));
|
|
4062
4308
|
return bridge;
|
|
4063
4309
|
}
|
|
4064
|
-
function trackSlotVNodeUpdates(frag, vnode) {
|
|
4065
|
-
trackSlotVNodeUpdatesWithRefresh(vnode, () => {
|
|
4066
|
-
frag.nodes = resolveVNodeNodes(vnode);
|
|
4067
|
-
if (frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
4068
|
-
});
|
|
4069
|
-
}
|
|
4070
4310
|
function hasValidVNodeContent(vnode) {
|
|
4071
4311
|
return !!ensureValidVNode(vnode.type === Fragment && isArray(vnode.children) ? vnode.children : [vnode]);
|
|
4072
4312
|
}
|
|
@@ -4074,13 +4314,12 @@ function isSlotOutletOnlyVNode(vnode) {
|
|
|
4074
4314
|
if (vnode.type === VaporSlot) return true;
|
|
4075
4315
|
return vnode.type === Fragment && isArray(vnode.children) && vnode.children.every((child) => isVNode(child) && isSlotOutletOnlyVNode(child));
|
|
4076
4316
|
}
|
|
4077
|
-
function hydrateForwardedEmptySlotFragment(vnode, parentComponent) {
|
|
4317
|
+
function hydrateForwardedEmptySlotFragment(vnode, parentComponent, contentValid) {
|
|
4078
4318
|
if (vnode.type !== Fragment || !isArray(vnode.children)) return false;
|
|
4079
4319
|
const children = vnode.children;
|
|
4080
4320
|
const inheritedEmptySlotEndAnchor = isComment(currentHydrationNode, "]") && isComment(currentHydrationNode.previousSibling, "[") ? currentHydrationNode : null;
|
|
4081
4321
|
const slotEndAnchor = getCurrentSlotEndAnchor() || inheritedEmptySlotEndAnchor;
|
|
4082
4322
|
const slotStartAnchor = slotEndAnchor && slotEndAnchor.previousSibling;
|
|
4083
|
-
const contentValid = hasValidVNodeContent(vnode);
|
|
4084
4323
|
if (!contentValid && currentHydrationNode === slotEndAnchor && slotStartAnchor && isComment(slotStartAnchor, "[")) {
|
|
4085
4324
|
vnode.el = slotStartAnchor;
|
|
4086
4325
|
vnode.anchor = slotEndAnchor;
|
|
@@ -4104,10 +4343,11 @@ function hydrateForwardedEmptySlotFragment(vnode, parentComponent) {
|
|
|
4104
4343
|
if (currentHydrationNode === fragmentEndAnchor) advanceHydrationNode(fragmentEndAnchor);
|
|
4105
4344
|
return true;
|
|
4106
4345
|
}
|
|
4107
|
-
function trackSlotVNodeUpdatesWithRefresh(vnode, refresh) {
|
|
4346
|
+
function trackSlotVNodeUpdatesWithRefresh(vnode, refresh, beforeUpdate) {
|
|
4108
4347
|
const onUpdated = () => refresh();
|
|
4109
4348
|
const track = (node) => {
|
|
4110
|
-
|
|
4349
|
+
if (beforeUpdate) appendVnodeHook(node, "onVnodeBeforeUpdate", beforeUpdate);
|
|
4350
|
+
appendVnodeHook(node, "onVnodeUpdated", onUpdated);
|
|
4111
4351
|
if (node.type === Fragment && isArray(node.children)) node.children.forEach((child) => {
|
|
4112
4352
|
if (isVNode(child)) track(child);
|
|
4113
4353
|
});
|
|
@@ -4117,73 +4357,81 @@ function trackSlotVNodeUpdatesWithRefresh(vnode, refresh) {
|
|
|
4117
4357
|
/**
|
|
4118
4358
|
* Mount vdom slot in vapor
|
|
4119
4359
|
*/
|
|
4120
|
-
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback) {
|
|
4360
|
+
function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallback, once, slotRoot) {
|
|
4121
4361
|
const suspense = parentSuspense || parentComponent.suspense;
|
|
4122
|
-
const frag =
|
|
4123
|
-
|
|
4124
|
-
frag.validityPending = !isHydrating$1;
|
|
4362
|
+
const frag = createInteropFragment();
|
|
4363
|
+
let validityPending = !isHydrating$1;
|
|
4125
4364
|
const instance = currentInstance;
|
|
4126
4365
|
let isMounted = false;
|
|
4127
4366
|
const contentState = {
|
|
4128
|
-
nodes:
|
|
4367
|
+
nodes: EMPTY_BLOCK,
|
|
4129
4368
|
valid: false,
|
|
4130
4369
|
rendered: null
|
|
4131
4370
|
};
|
|
4132
|
-
let currentParentNode;
|
|
4133
|
-
let currentAnchor;
|
|
4371
|
+
let currentParentNode = null;
|
|
4372
|
+
let currentAnchor = null;
|
|
4134
4373
|
let disposed = false;
|
|
4135
4374
|
const scope = effectScope();
|
|
4136
4375
|
const inheritedBoundary = frag.inheritedSlotBoundary;
|
|
4137
4376
|
let isContentUpdateRecheck = false;
|
|
4138
4377
|
let localFallback;
|
|
4139
|
-
let
|
|
4378
|
+
let fallbackState;
|
|
4379
|
+
frag.isBlockValid = () => {
|
|
4380
|
+
if (validityPending) return true;
|
|
4381
|
+
return fallbackState.activeFallback ? isValidBlock(fallbackState.activeFallback) : contentState.valid;
|
|
4382
|
+
};
|
|
4140
4383
|
const boundary = {
|
|
4141
4384
|
get parent() {
|
|
4142
4385
|
return inheritedBoundary;
|
|
4143
4386
|
},
|
|
4144
4387
|
getFallback: () => localFallback,
|
|
4145
|
-
run: (fn) =>
|
|
4146
|
-
markDirty: () => markSlotFallbackDirty(
|
|
4388
|
+
run: (fn) => runWithFragmentCtx(frag, fn),
|
|
4389
|
+
markDirty: () => markSlotFallbackDirty(fallbackState)
|
|
4147
4390
|
};
|
|
4148
|
-
|
|
4391
|
+
fallbackState = {
|
|
4149
4392
|
boundary,
|
|
4150
4393
|
activeFallback: null,
|
|
4151
4394
|
pendingRecheck: false,
|
|
4152
4395
|
isRenderingFallback: false,
|
|
4153
4396
|
getContent: () => contentState.nodes,
|
|
4154
|
-
getParentNode: () =>
|
|
4155
|
-
getAnchor: () => currentAnchor
|
|
4397
|
+
getParentNode: () => currentParentNode,
|
|
4398
|
+
getAnchor: () => currentAnchor,
|
|
4399
|
+
isBusy: () => false,
|
|
4156
4400
|
isDisposed: () => disposed,
|
|
4157
4401
|
isContentValid: () => contentState.valid,
|
|
4158
|
-
|
|
4159
|
-
frag.nodes =
|
|
4402
|
+
syncNodes: () => {
|
|
4403
|
+
frag.nodes = fallbackState.activeFallback || contentState.nodes;
|
|
4160
4404
|
},
|
|
4161
4405
|
notifyFallbackValidityChange: () => {
|
|
4162
|
-
if (!isContentUpdateRecheck && inheritedBoundary) inheritedBoundary.markDirty();
|
|
4406
|
+
if (slotRoot && !isContentUpdateRecheck && inheritedBoundary) inheritedBoundary.markDirty();
|
|
4163
4407
|
}
|
|
4164
4408
|
};
|
|
4165
|
-
|
|
4166
|
-
|
|
4409
|
+
if (slotRoot) trackSlotBoundaryDirtying(frag);
|
|
4410
|
+
localFallback = fallback ? once ? () => withOnceSlot(() => fallback(internals, parentComponent)) : () => fallback(internals, parentComponent) : void 0;
|
|
4411
|
+
const setRenderedContent = (rendered, knownValid) => {
|
|
4167
4412
|
contentState.rendered = rendered;
|
|
4168
4413
|
if (isVNode(rendered)) {
|
|
4169
4414
|
contentState.nodes = resolveVNodeNodes(rendered);
|
|
4170
|
-
contentState.valid = hasValidVNodeContent(rendered);
|
|
4415
|
+
contentState.valid = knownValid === void 0 ? hasValidVNodeContent(rendered) : knownValid;
|
|
4171
4416
|
} else if (rendered) {
|
|
4172
4417
|
contentState.nodes = rendered;
|
|
4173
|
-
contentState.valid = isValidBlock(rendered);
|
|
4418
|
+
contentState.valid = knownValid === void 0 ? isValidBlock(rendered) : knownValid;
|
|
4174
4419
|
} else {
|
|
4175
|
-
contentState.nodes =
|
|
4420
|
+
contentState.nodes = EMPTY_BLOCK;
|
|
4176
4421
|
contentState.valid = false;
|
|
4177
4422
|
}
|
|
4178
|
-
|
|
4423
|
+
validityPending = false;
|
|
4179
4424
|
};
|
|
4180
4425
|
const notifyUpdated = () => {
|
|
4181
|
-
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((
|
|
4426
|
+
if (isMounted && frag.onUpdated) frag.onUpdated.forEach((u) => u());
|
|
4427
|
+
};
|
|
4428
|
+
const notifyBeforeUpdate = () => {
|
|
4429
|
+
if (isMounted && frag.onBeforeUpdate) frag.onBeforeUpdate.forEach((bu) => bu());
|
|
4182
4430
|
};
|
|
4183
4431
|
const recheckAfterContentUpdate = (forceFallbackRecheck = false) => {
|
|
4184
4432
|
isContentUpdateRecheck = true;
|
|
4185
4433
|
try {
|
|
4186
|
-
recheckSlotFallback(
|
|
4434
|
+
recheckSlotFallback(fallbackState, forceFallbackRecheck);
|
|
4187
4435
|
} finally {
|
|
4188
4436
|
isContentUpdateRecheck = false;
|
|
4189
4437
|
}
|
|
@@ -4194,7 +4442,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4194
4442
|
};
|
|
4195
4443
|
frag.insert = (parentNode, anchor) => {
|
|
4196
4444
|
if (isHydrating$1) return;
|
|
4197
|
-
currentParentNode = parentNode
|
|
4445
|
+
currentParentNode = parentNode;
|
|
4198
4446
|
currentAnchor = anchor;
|
|
4199
4447
|
if (!isMounted) {
|
|
4200
4448
|
scope.run(render);
|
|
@@ -4202,29 +4450,30 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4202
4450
|
} else {
|
|
4203
4451
|
if (isVNode(contentState.rendered)) internals.m(contentState.rendered, parentNode, anchor, 2, parentComponent);
|
|
4204
4452
|
else if (contentState.rendered) insert(contentState.rendered, parentNode, anchor);
|
|
4205
|
-
insertActiveSlotFallback(
|
|
4453
|
+
insertActiveSlotFallback(fallbackState);
|
|
4206
4454
|
}
|
|
4207
4455
|
notifyUpdated();
|
|
4208
4456
|
};
|
|
4209
4457
|
frag.remove = (parentNode) => {
|
|
4210
|
-
|
|
4211
|
-
currentAnchor = currentAnchor || null;
|
|
4458
|
+
if (parentNode) currentParentNode = parentNode;
|
|
4212
4459
|
scope.stop();
|
|
4213
4460
|
disposed = true;
|
|
4214
4461
|
if (isVNode(contentState.rendered)) internals.um(contentState.rendered, parentComponent, null, !!parentNode);
|
|
4215
4462
|
else if (contentState.rendered) remove(contentState.rendered, parentNode);
|
|
4216
|
-
disposeSlotFallback(
|
|
4463
|
+
disposeSlotFallback(fallbackState);
|
|
4217
4464
|
};
|
|
4218
4465
|
const render = () => {
|
|
4219
4466
|
const prev = currentInstance;
|
|
4220
4467
|
simpleSetCurrentInstance(instance);
|
|
4221
4468
|
try {
|
|
4222
|
-
|
|
4223
|
-
|
|
4469
|
+
const renderSlotContent = () => {
|
|
4470
|
+
notifyBeforeUpdate();
|
|
4471
|
+
runWithFragmentCtx(frag, () => withOwnedSlotBoundary(boundary, () => {
|
|
4224
4472
|
let slotContent;
|
|
4225
4473
|
let slotContentValid = false;
|
|
4226
4474
|
if (slotsRef.value) {
|
|
4227
|
-
|
|
4475
|
+
const renderContent = () => renderSlot(slotsRef.value, isFunction(name) ? name() : name, props);
|
|
4476
|
+
slotContent = once ? withOnceSlot(renderContent) : renderContent();
|
|
4228
4477
|
if (isVNode(slotContent)) if (slotContent.type === Fragment) {
|
|
4229
4478
|
const children = slotContent.children;
|
|
4230
4479
|
ensureVaporSlotFallback(children, localFallback);
|
|
@@ -4237,13 +4486,20 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4237
4486
|
if (isVNode(hydratedContent)) {
|
|
4238
4487
|
frag.vnode = hydratedContent;
|
|
4239
4488
|
frag.$key = getVNodeKey(hydratedContent);
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4489
|
+
const refreshSlotVNode = () => {
|
|
4490
|
+
frag.nodes = resolveVNodeNodes(hydratedContent);
|
|
4491
|
+
if (frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
4492
|
+
};
|
|
4493
|
+
trackSlotVNodeUpdatesWithRefresh(hydratedContent, refreshSlotVNode, slotRoot ? notifyBeforeUpdate : void 0);
|
|
4494
|
+
if (!hydrateForwardedEmptySlotFragment(hydratedContent, parentComponent, slotContentValid)) hydrateVNode(hydratedContent, parentComponent);
|
|
4495
|
+
const hydratedEnd = hydratedContent.anchor;
|
|
4496
|
+
currentParentNode = hydratedEnd.parentNode;
|
|
4497
|
+
currentAnchor = hydratedEnd.nextSibling;
|
|
4498
|
+
setRenderedContent(hydratedContent, slotContentValid);
|
|
4243
4499
|
} else if (hydratedContent) {
|
|
4244
4500
|
frag.vnode = null;
|
|
4245
4501
|
frag.$key = void 0;
|
|
4246
|
-
setRenderedContent(hydratedContent);
|
|
4502
|
+
setRenderedContent(hydratedContent, slotContentValid);
|
|
4247
4503
|
} else {
|
|
4248
4504
|
frag.vnode = null;
|
|
4249
4505
|
frag.$key = void 0;
|
|
@@ -4255,17 +4511,20 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4255
4511
|
if (isVNode(slotContent)) {
|
|
4256
4512
|
frag.vnode = slotContent;
|
|
4257
4513
|
frag.$key = getVNodeKey(slotContent);
|
|
4258
|
-
|
|
4514
|
+
const refreshSlotVNode = () => {
|
|
4259
4515
|
const prevValid = contentState.valid;
|
|
4260
4516
|
const prevOutput = frag.nodes;
|
|
4261
4517
|
setRenderedContent(slotContent);
|
|
4262
4518
|
recheckAfterContentUpdate();
|
|
4263
4519
|
if (contentState.valid !== prevValid || !isSameResolvedOutput(prevOutput, frag.nodes)) notifyUpdated();
|
|
4264
|
-
}
|
|
4520
|
+
};
|
|
4521
|
+
trackSlotVNodeUpdatesWithRefresh(slotContent, refreshSlotVNode, slotRoot ? notifyBeforeUpdate : void 0);
|
|
4265
4522
|
const prevRendered = contentState.rendered;
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4523
|
+
const prevIsVNode = isVNode(prevRendered);
|
|
4524
|
+
const prevVNode = prevIsVNode && (!fallbackState.activeFallback || contentState.valid) ? prevRendered : null;
|
|
4525
|
+
if (prevRendered && !prevIsVNode) remove(prevRendered, currentParentNode);
|
|
4526
|
+
internals.p(prevVNode, slotContent, currentParentNode, currentAnchor, parentComponent, suspense, void 0, slotContent.slotScopeIds);
|
|
4527
|
+
setRenderedContent(slotContent, slotContentValid);
|
|
4269
4528
|
finishContentUpdate();
|
|
4270
4529
|
return;
|
|
4271
4530
|
}
|
|
@@ -4276,7 +4535,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4276
4535
|
if (isVNode(prevRendered)) internals.um(prevRendered, parentComponent, null, true);
|
|
4277
4536
|
else if (prevRendered) remove(prevRendered, currentParentNode);
|
|
4278
4537
|
insert(slotContent, currentParentNode, currentAnchor);
|
|
4279
|
-
setRenderedContent(slotContent);
|
|
4538
|
+
setRenderedContent(slotContent, slotContentValid);
|
|
4280
4539
|
finishContentUpdate();
|
|
4281
4540
|
return;
|
|
4282
4541
|
}
|
|
@@ -4287,7 +4546,8 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4287
4546
|
setRenderedContent(null);
|
|
4288
4547
|
finishContentUpdate();
|
|
4289
4548
|
}));
|
|
4290
|
-
}
|
|
4549
|
+
};
|
|
4550
|
+
once ? renderSlotContent() : renderEffect(renderSlotContent);
|
|
4291
4551
|
} finally {
|
|
4292
4552
|
simpleSetCurrentInstance(prev);
|
|
4293
4553
|
}
|
|
@@ -4295,23 +4555,25 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
4295
4555
|
frag.hydrate = () => {
|
|
4296
4556
|
if (!isHydrating$1) return;
|
|
4297
4557
|
scope.run(render);
|
|
4298
|
-
currentParentNode
|
|
4299
|
-
|
|
4558
|
+
if (!currentParentNode) {
|
|
4559
|
+
currentAnchor = getCurrentSlotEndAnchor() || currentHydrationNode;
|
|
4560
|
+
currentParentNode = currentAnchor.parentNode;
|
|
4561
|
+
}
|
|
4300
4562
|
isMounted = true;
|
|
4301
4563
|
};
|
|
4302
4564
|
return frag;
|
|
4303
4565
|
}
|
|
4304
|
-
function
|
|
4305
|
-
if (isVaporComponent(block)) return isKeepAlive(block) ||
|
|
4306
|
-
if (isArray(block)) return block.some(
|
|
4307
|
-
if (isFragment(block)) return
|
|
4566
|
+
function needsHostParentForRemove(block) {
|
|
4567
|
+
if (isVaporComponent(block)) return isKeepAlive(block) || needsHostParentForRemove(block.block);
|
|
4568
|
+
if (isArray(block)) return block.some(needsHostParentForRemove);
|
|
4569
|
+
if (isFragment(block)) return needsHostParentForRemove(block.nodes);
|
|
4308
4570
|
return false;
|
|
4309
4571
|
}
|
|
4310
4572
|
const vaporInteropPlugin = (app) => {
|
|
4311
4573
|
enableSuspense();
|
|
4312
4574
|
setInteropEnabled();
|
|
4313
4575
|
const internals = ensureRenderer().internals;
|
|
4314
|
-
app._context.vapor = extend(vaporInteropImpl, {
|
|
4576
|
+
app._context.vapor = extend({}, vaporInteropImpl, {
|
|
4315
4577
|
vdomMount: createVDOMComponent.bind(null, internals),
|
|
4316
4578
|
vdomUnmount: internals.umt,
|
|
4317
4579
|
vdomSlot: renderVDOMSlot.bind(null, internals),
|
|
@@ -4334,30 +4596,17 @@ function createFallback(fallback, parentComponent, isVNodeFallback) {
|
|
|
4334
4596
|
const internals = ensureRenderer().internals;
|
|
4335
4597
|
return () => {
|
|
4336
4598
|
if (isVNodeFallback()) {
|
|
4337
|
-
const frag = createVNodeChildrenFragment(internals, () =>
|
|
4599
|
+
const frag = createVNodeChildrenFragment(internals, () => {
|
|
4600
|
+
const children = fallback();
|
|
4601
|
+
return children == null ? EMPTY_VNODES : normalizeInteropSlotValue(children);
|
|
4602
|
+
}, parentComponent);
|
|
4338
4603
|
if (isHydrating$1 && frag.hydrate) frag.hydrate();
|
|
4339
4604
|
return frag;
|
|
4340
4605
|
}
|
|
4341
4606
|
return fallback();
|
|
4342
4607
|
};
|
|
4343
4608
|
}
|
|
4344
|
-
const renderEmptyVNodes = () =>
|
|
4345
|
-
function runWithFragmentRenderCtx(fragment, fn) {
|
|
4346
|
-
const prevSlotOwner = setCurrentSlotOwner(fragment.slotOwner);
|
|
4347
|
-
let prevKeepAliveCtx = null;
|
|
4348
|
-
if (isKeepAliveEnabled) prevKeepAliveCtx = setCurrentKeepAliveCtx(fragment.keepAliveCtx || null);
|
|
4349
|
-
try {
|
|
4350
|
-
return withOwnedSlotBoundary(fragment.inheritedSlotBoundary, fn);
|
|
4351
|
-
} finally {
|
|
4352
|
-
if (isKeepAliveEnabled) setCurrentKeepAliveCtx(prevKeepAliveCtx);
|
|
4353
|
-
setCurrentSlotOwner(prevSlotOwner);
|
|
4354
|
-
}
|
|
4355
|
-
}
|
|
4356
|
-
function getSlotFallbackParentNode(currentParentNode, content) {
|
|
4357
|
-
if (currentParentNode) return currentParentNode;
|
|
4358
|
-
const carrierAnchor = findFirstSlotFallbackCarrierNode(content);
|
|
4359
|
-
return carrierAnchor ? carrierAnchor.parentNode : null;
|
|
4360
|
-
}
|
|
4609
|
+
const renderEmptyVNodes = () => EMPTY_VNODES;
|
|
4361
4610
|
function resolveInteropVaporSlotState(vnode) {
|
|
4362
4611
|
const slot = vnode.vs;
|
|
4363
4612
|
let state = slot.state;
|
|
@@ -4405,12 +4654,14 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4405
4654
|
simpleSetCurrentInstance(parentComponent);
|
|
4406
4655
|
if (isSuspenseEnabled && parentSuspense) prevSuspense = setParentSuspense(parentSuspense);
|
|
4407
4656
|
try {
|
|
4408
|
-
if (!vnode.vs || !vnode.vs.slot) return
|
|
4657
|
+
if (!vnode.vs || !vnode.vs.slot) return EMPTY_BLOCK;
|
|
4409
4658
|
const slotState = resolveInteropVaporSlotState(vnode);
|
|
4410
|
-
const
|
|
4411
|
-
frag
|
|
4659
|
+
const scopeIds = getInteropVaporSlotScopeIds(vnode, parentComponent);
|
|
4660
|
+
const frag = createInteropFragment();
|
|
4661
|
+
let validityPending = !isHydrating$1;
|
|
4662
|
+
frag.isBlockValid = () => validityPending ? true : isValidBlock(frag.nodes);
|
|
4412
4663
|
const inheritedBoundary = frag.inheritedSlotBoundary;
|
|
4413
|
-
let contentNodes =
|
|
4664
|
+
let contentNodes = EMPTY_BLOCK;
|
|
4414
4665
|
let isResolvingContent = false;
|
|
4415
4666
|
let localFallback;
|
|
4416
4667
|
let outletFallback;
|
|
@@ -4418,13 +4669,13 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4418
4669
|
let currentAnchor = null;
|
|
4419
4670
|
let slotScope;
|
|
4420
4671
|
let disposed = false;
|
|
4421
|
-
let
|
|
4672
|
+
let fallbackState;
|
|
4422
4673
|
let ownedSlotFragment;
|
|
4423
4674
|
let ownedSlotFragmentDirtyQueued = false;
|
|
4424
4675
|
const markInteropFallbackDirty = () => {
|
|
4425
4676
|
const target = ownedSlotFragment;
|
|
4426
4677
|
if (!target) {
|
|
4427
|
-
markSlotFallbackDirty(
|
|
4678
|
+
markSlotFallbackDirty(fallbackState);
|
|
4428
4679
|
return;
|
|
4429
4680
|
}
|
|
4430
4681
|
if (ownedSlotFragmentDirtyQueued) return;
|
|
@@ -4432,7 +4683,6 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4432
4683
|
queuePostFlushCb(() => {
|
|
4433
4684
|
ownedSlotFragmentDirtyQueued = false;
|
|
4434
4685
|
markSlotFallbackDirty(target);
|
|
4435
|
-
syncActiveSlotFallback(target);
|
|
4436
4686
|
});
|
|
4437
4687
|
};
|
|
4438
4688
|
const outletFallbackBoundary = {
|
|
@@ -4440,7 +4690,7 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4440
4690
|
return inheritedBoundary;
|
|
4441
4691
|
},
|
|
4442
4692
|
getFallback: () => slotState.outletFallback.value ? outletFallback : void 0,
|
|
4443
|
-
run: (fn) =>
|
|
4693
|
+
run: (fn) => runWithFragmentCtx(frag, fn),
|
|
4444
4694
|
markDirty: markInteropFallbackDirty
|
|
4445
4695
|
};
|
|
4446
4696
|
const localFallbackBoundary = {
|
|
@@ -4448,37 +4698,38 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4448
4698
|
return outletFallbackBoundary;
|
|
4449
4699
|
},
|
|
4450
4700
|
getFallback: () => slotState.localFallback.value ? localFallback : void 0,
|
|
4451
|
-
run: (fn) =>
|
|
4701
|
+
run: (fn) => runWithFragmentCtx(frag, fn),
|
|
4452
4702
|
markDirty: markInteropFallbackDirty
|
|
4453
4703
|
};
|
|
4454
|
-
|
|
4704
|
+
fallbackState = {
|
|
4455
4705
|
boundary: localFallbackBoundary,
|
|
4456
4706
|
activeFallback: null,
|
|
4457
4707
|
pendingRecheck: false,
|
|
4458
4708
|
isRenderingFallback: false,
|
|
4459
4709
|
getContent: () => contentNodes,
|
|
4460
|
-
getParentNode: () =>
|
|
4710
|
+
getParentNode: () => currentParentNode,
|
|
4461
4711
|
getAnchor: () => currentAnchor,
|
|
4462
4712
|
isBusy: () => isResolvingContent,
|
|
4463
4713
|
isDisposed: () => disposed,
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
frag.
|
|
4714
|
+
isContentValid: () => isValidBlock(contentNodes),
|
|
4715
|
+
syncNodes: () => {
|
|
4716
|
+
frag.nodes = fallbackState.activeFallback || contentNodes;
|
|
4717
|
+
validityPending = false;
|
|
4467
4718
|
},
|
|
4468
4719
|
notifyFallbackValidityChange: () => {
|
|
4469
4720
|
if (inheritedBoundary) inheritedBoundary.markDirty();
|
|
4470
4721
|
}
|
|
4471
4722
|
};
|
|
4472
4723
|
const takePendingRecheck = () => {
|
|
4473
|
-
const shouldRecheck =
|
|
4474
|
-
|
|
4724
|
+
const shouldRecheck = fallbackState.pendingRecheck;
|
|
4725
|
+
fallbackState.pendingRecheck = false;
|
|
4475
4726
|
return shouldRecheck;
|
|
4476
4727
|
};
|
|
4477
4728
|
const dispose = (parentNode) => {
|
|
4478
4729
|
if (disposed) return;
|
|
4479
|
-
currentParentNode = parentNode
|
|
4730
|
+
if (parentNode) currentParentNode = parentNode;
|
|
4480
4731
|
disposed = true;
|
|
4481
|
-
disposeSlotFallback(
|
|
4732
|
+
disposeSlotFallback(fallbackState);
|
|
4482
4733
|
slotScope = void 0;
|
|
4483
4734
|
currentParentNode = null;
|
|
4484
4735
|
currentAnchor = null;
|
|
@@ -4486,22 +4737,23 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4486
4737
|
try {
|
|
4487
4738
|
localFallback = createFallback(() => (slotState.localFallback.value || renderEmptyVNodes)(), parentComponent, () => !!slotState.localFallback.value && !!slotState.localFallback.value.__vdom);
|
|
4488
4739
|
outletFallback = createFallback(() => (slotState.outletFallback.value || renderEmptyVNodes)(), parentComponent, () => !!slotState.outletFallback.value && !!slotState.outletFallback.value.__vdom);
|
|
4489
|
-
const
|
|
4490
|
-
|
|
4740
|
+
const hasInteropFallback = !!slotState.localFallback.value || !!slotState.outletFallback.value;
|
|
4741
|
+
fallbackState.pendingRecheck = false;
|
|
4491
4742
|
const finalizeResolvedContent = (resolvedContent) => {
|
|
4492
|
-
if (
|
|
4493
|
-
|
|
4494
|
-
|
|
4743
|
+
if (resolvedContent && scopeIds) setScopeId(resolvedContent, scopeIds);
|
|
4744
|
+
if (hasInteropFallback && resolvedContent instanceof SlotFragment) return resolvedContent;
|
|
4745
|
+
contentNodes = resolvedContent || EMPTY_BLOCK;
|
|
4746
|
+
recheckSlotFallback(fallbackState, takePendingRecheck());
|
|
4495
4747
|
return resolvedContent;
|
|
4496
4748
|
};
|
|
4497
4749
|
let resolvedContent;
|
|
4498
4750
|
isResolvingContent = true;
|
|
4499
4751
|
try {
|
|
4500
|
-
if (isHydrating$1) resolvedContent = withHydratingSlotBoundary(() => finalizeResolvedContent(
|
|
4752
|
+
if (isHydrating$1) resolvedContent = withHydratingSlotBoundary(() => finalizeResolvedContent(runWithFragmentCtx(frag, () => {
|
|
4501
4753
|
const renderSlot = () => withOwnedSlotBoundary(localFallbackBoundary, () => invokeVaporSlot(vnode));
|
|
4502
4754
|
return hasSlotFallback(localFallbackBoundary) ? withHydratingSlotFallbackActive(renderSlot) : renderSlot();
|
|
4503
4755
|
})));
|
|
4504
|
-
else resolvedContent = finalizeResolvedContent(
|
|
4756
|
+
else resolvedContent = finalizeResolvedContent(runWithFragmentCtx(frag, () => withOwnedSlotBoundary(localFallbackBoundary, () => invokeVaporSlot(vnode))));
|
|
4505
4757
|
} finally {
|
|
4506
4758
|
isResolvingContent = false;
|
|
4507
4759
|
}
|
|
@@ -4512,30 +4764,30 @@ function renderVaporSlot(vnode, parentComponent, parentSuspense) {
|
|
|
4512
4764
|
onScopeDispose(() => dispose(), true);
|
|
4513
4765
|
});
|
|
4514
4766
|
}
|
|
4515
|
-
if (
|
|
4767
|
+
if (hasInteropFallback && resolvedContent instanceof SlotFragment) {
|
|
4516
4768
|
ownedSlotFragment = resolvedContent;
|
|
4517
4769
|
trackInteropFallbackChanges(vnode.vs.scope, slotState, () => markInteropFallbackDirty());
|
|
4518
4770
|
dispose();
|
|
4519
4771
|
return resolvedContent;
|
|
4520
4772
|
}
|
|
4521
|
-
|
|
4773
|
+
fallbackState.pendingRecheck = false;
|
|
4522
4774
|
frag.insert = (parentNode, anchor) => {
|
|
4523
4775
|
currentParentNode = parentNode;
|
|
4524
4776
|
currentAnchor = anchor;
|
|
4525
|
-
if (
|
|
4526
|
-
|
|
4527
|
-
mutateSlotFallbackCarrier(contentNodes, (block) => insert(block, parentNode, anchor));
|
|
4528
|
-
} else insert(frag.nodes, parentNode, anchor);
|
|
4777
|
+
if (fallbackState.activeFallback) insertActiveSlotFallback(fallbackState);
|
|
4778
|
+
else insert(frag.nodes, parentNode, anchor);
|
|
4529
4779
|
};
|
|
4530
4780
|
frag.remove = (parentNode) => {
|
|
4531
|
-
if (
|
|
4532
|
-
else remove(frag.nodes, parentNode);
|
|
4781
|
+
if (!fallbackState.activeFallback) remove(frag.nodes, parentNode);
|
|
4533
4782
|
dispose(parentNode);
|
|
4534
4783
|
};
|
|
4535
4784
|
trackInteropFallbackChanges(vnode.vs.scope, slotState, () => {
|
|
4536
|
-
recheckSlotFallback(
|
|
4537
|
-
syncActiveSlotFallback(outlet);
|
|
4785
|
+
recheckSlotFallback(fallbackState, true);
|
|
4538
4786
|
});
|
|
4787
|
+
if (isHydrating$1 && currentHydrationNode) {
|
|
4788
|
+
currentAnchor = currentHydrationNode;
|
|
4789
|
+
currentParentNode = currentAnchor.parentNode;
|
|
4790
|
+
}
|
|
4539
4791
|
return frag;
|
|
4540
4792
|
} catch (e) {
|
|
4541
4793
|
dispose();
|
|
@@ -4584,7 +4836,8 @@ function ensureVNodeHookState(instance, vnode) {
|
|
|
4584
4836
|
if (!state) {
|
|
4585
4837
|
state = {
|
|
4586
4838
|
vnode,
|
|
4587
|
-
skipVnodeHooks: false
|
|
4839
|
+
skipVnodeHooks: false,
|
|
4840
|
+
postRootSyncHooks: []
|
|
4588
4841
|
};
|
|
4589
4842
|
vnodeHookStateMap.set(instance, state);
|
|
4590
4843
|
(instance.bu || (instance.bu = [])).push(() => {
|
|
@@ -4592,7 +4845,11 @@ function ensureVNodeHookState(instance, vnode) {
|
|
|
4592
4845
|
const vnodeHook = state.vnode.props && state.vnode.props.onVnodeBeforeUpdate;
|
|
4593
4846
|
if (vnodeHook) callWithAsyncErrorHandling(vnodeHook, instance.parent, 7, [state.vnode, state.vnode]);
|
|
4594
4847
|
});
|
|
4595
|
-
(instance.u || (instance.u = [])).unshift(() =>
|
|
4848
|
+
(instance.u || (instance.u = [])).unshift(() => {
|
|
4849
|
+
syncVNodeEl(state.vnode, instance);
|
|
4850
|
+
const hooks = state.postRootSyncHooks;
|
|
4851
|
+
for (let i = 0; i < hooks.length; i++) hooks[i](state.vnode);
|
|
4852
|
+
});
|
|
4596
4853
|
instance.u.push(() => {
|
|
4597
4854
|
if (state.skipVnodeHooks) {
|
|
4598
4855
|
state.skipVnodeHooks = false;
|
|
@@ -4606,24 +4863,24 @@ function ensureVNodeHookState(instance, vnode) {
|
|
|
4606
4863
|
}
|
|
4607
4864
|
function createVNodeChildrenFragment(internals, render, parentComponent) {
|
|
4608
4865
|
const suspense = parentSuspense || parentComponent && parentComponent.suspense;
|
|
4609
|
-
const frag =
|
|
4866
|
+
const frag = createInteropFragment();
|
|
4610
4867
|
let contentValid = false;
|
|
4611
|
-
|
|
4612
|
-
frag.isBlockValid = () =>
|
|
4868
|
+
let validityPending = !isHydrating$1;
|
|
4869
|
+
frag.isBlockValid = () => validityPending ? true : contentValid;
|
|
4613
4870
|
let currentVNode = null;
|
|
4614
|
-
let currentChildren =
|
|
4871
|
+
let currentChildren = EMPTY_VNODES;
|
|
4615
4872
|
let currentParentNode = null;
|
|
4616
4873
|
let currentAnchor = null;
|
|
4617
4874
|
let isMounted = false;
|
|
4618
4875
|
let isRenderEffectStarted = false;
|
|
4619
4876
|
const scope = effectScope();
|
|
4620
4877
|
const syncResolvedNodes = (children = currentChildren) => {
|
|
4621
|
-
const prevValid =
|
|
4878
|
+
const prevValid = validityPending ? true : contentValid;
|
|
4622
4879
|
contentValid = !!ensureValidVNode(children);
|
|
4623
|
-
if (children.length === 0) frag.nodes =
|
|
4880
|
+
if (children.length === 0) frag.nodes = EMPTY_BLOCK;
|
|
4624
4881
|
else if (children.length === 1) frag.nodes = resolveVNodeNodes(children[0]);
|
|
4625
4882
|
else frag.nodes = children.map(resolveVNodeNodes);
|
|
4626
|
-
|
|
4883
|
+
validityPending = false;
|
|
4627
4884
|
return prevValid !== contentValid;
|
|
4628
4885
|
};
|
|
4629
4886
|
const notifyUpdated = (validityChanged = false) => {
|
|
@@ -4635,7 +4892,7 @@ function createVNodeChildrenFragment(internals, render, parentComponent) {
|
|
|
4635
4892
|
simpleSetCurrentInstance(parentComponent);
|
|
4636
4893
|
try {
|
|
4637
4894
|
renderEffect(() => {
|
|
4638
|
-
|
|
4895
|
+
runWithFragmentCtx(frag, () => {
|
|
4639
4896
|
const nextChildren = render();
|
|
4640
4897
|
if (isHydrating$1) {
|
|
4641
4898
|
nextChildren.forEach((vnode) => hydrateVNode(vnode, parentComponent));
|
|
@@ -4647,8 +4904,9 @@ function createVNodeChildrenFragment(internals, render, parentComponent) {
|
|
|
4647
4904
|
} else if (!isMounted) {
|
|
4648
4905
|
currentChildren = nextChildren;
|
|
4649
4906
|
currentVNode = createVNode(Fragment, null, nextChildren);
|
|
4650
|
-
|
|
4651
|
-
|
|
4907
|
+
const wasPending = validityPending;
|
|
4908
|
+
const validityChanged = syncResolvedNodes(nextChildren);
|
|
4909
|
+
if (!wasPending) notifyUpdated(validityChanged);
|
|
4652
4910
|
return;
|
|
4653
4911
|
} else if (!currentVNode) {
|
|
4654
4912
|
currentChildren = nextChildren;
|
|
@@ -4734,7 +4992,23 @@ function normalizeInteropSlots(rawSlots) {
|
|
|
4734
4992
|
});
|
|
4735
4993
|
return normalized;
|
|
4736
4994
|
}
|
|
4995
|
+
const interopSlotCache = /* @__PURE__ */ new WeakMap();
|
|
4737
4996
|
function normalizeInteropSlot(rawSlot, ctx) {
|
|
4997
|
+
let cache = interopSlotCache.get(rawSlot);
|
|
4998
|
+
if (!cache) interopSlotCache.set(rawSlot, cache = {});
|
|
4999
|
+
if (ctx) {
|
|
5000
|
+
let ctxCache = cache.ctx;
|
|
5001
|
+
if (!ctxCache) cache.ctx = ctxCache = /* @__PURE__ */ new WeakMap();
|
|
5002
|
+
const cached = ctxCache.get(ctx);
|
|
5003
|
+
if (cached) return cached;
|
|
5004
|
+
const normalized = createNormalizedInteropSlot(rawSlot, ctx);
|
|
5005
|
+
ctxCache.set(ctx, normalized);
|
|
5006
|
+
return normalized;
|
|
5007
|
+
}
|
|
5008
|
+
if (cache.noCtx) return cache.noCtx;
|
|
5009
|
+
return cache.noCtx = createNormalizedInteropSlot(rawSlot, ctx);
|
|
5010
|
+
}
|
|
5011
|
+
function createNormalizedInteropSlot(rawSlot, ctx) {
|
|
4738
5012
|
const normalized = withCtx((...args) => normalizeInteropSlotValue(rawSlot(...args)), ctx);
|
|
4739
5013
|
normalized._c = false;
|
|
4740
5014
|
return normalized;
|
|
@@ -4748,7 +5022,7 @@ function normalizeInteropDefaultSlot(value) {
|
|
|
4748
5022
|
function normalizeInteropSlotValue(value) {
|
|
4749
5023
|
return isArray(value) ? value.map((child) => normalizeVNode(child)) : [normalizeVNode(value)];
|
|
4750
5024
|
}
|
|
4751
|
-
const isInternalSlotKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
|
|
5025
|
+
const isInternalSlotKey = (key) => key === "_" || key === "_ctx" || key === "$stable" || key === "$";
|
|
4752
5026
|
const interopSlotsSourceHandlers = {
|
|
4753
5027
|
get(target, key) {
|
|
4754
5028
|
const slots = target.value;
|
|
@@ -4760,7 +5034,7 @@ const interopSlotsSourceHandlers = {
|
|
|
4760
5034
|
},
|
|
4761
5035
|
ownKeys(target) {
|
|
4762
5036
|
const slots = target.value;
|
|
4763
|
-
return slots ? Object.keys(slots).filter((key) => !isInternalSlotKey(key)) :
|
|
5037
|
+
return slots ? Object.keys(slots).filter((key) => !isInternalSlotKey(key)) : EMPTY_ARR;
|
|
4764
5038
|
},
|
|
4765
5039
|
getOwnPropertyDescriptor(target, key) {
|
|
4766
5040
|
const slots = target.value;
|
|
@@ -4780,6 +5054,48 @@ function createInteropRawSlots(slotsRef) {
|
|
|
4780
5054
|
});
|
|
4781
5055
|
return rawSlots;
|
|
4782
5056
|
}
|
|
5057
|
+
const interopScopeIdRootMap = /* @__PURE__ */ new WeakMap();
|
|
5058
|
+
const interopScopeIdFragmentMap = /* @__PURE__ */ new WeakMap();
|
|
5059
|
+
function trackInteropScopeIdFragment(instance, frag) {
|
|
5060
|
+
if (interopScopeIdFragmentMap.get(frag) === instance) return;
|
|
5061
|
+
interopScopeIdFragmentMap.set(frag, instance);
|
|
5062
|
+
(frag.onUpdated || (frag.onUpdated = [])).push(() => {
|
|
5063
|
+
const state = vnodeHookStateMap.get(instance);
|
|
5064
|
+
if (!state) return;
|
|
5065
|
+
syncVNodeEl(state.vnode, instance);
|
|
5066
|
+
setInteropVnodeScopeId(instance, state.vnode, instance.parent);
|
|
5067
|
+
});
|
|
5068
|
+
}
|
|
5069
|
+
function setInteropVnodeScopeId(instance, vnode, parentComponent) {
|
|
5070
|
+
const root = getRootElement(instance, (frag) => trackInteropScopeIdFragment(instance, frag));
|
|
5071
|
+
if (!root) {
|
|
5072
|
+
interopScopeIdRootMap.delete(instance);
|
|
5073
|
+
return;
|
|
5074
|
+
}
|
|
5075
|
+
if (interopScopeIdRootMap.get(instance) === root) return;
|
|
5076
|
+
interopScopeIdRootMap.set(instance, root);
|
|
5077
|
+
const scopeIds = getInteropVnodeScopeIds(vnode, parentComponent);
|
|
5078
|
+
if (!scopeIds) return;
|
|
5079
|
+
for (let i = 0; i < scopeIds.length; i++) root.setAttribute(scopeIds[i], "");
|
|
5080
|
+
}
|
|
5081
|
+
function getInteropVnodeScopeIds(vnode, parentComponent) {
|
|
5082
|
+
const scopeIds = [];
|
|
5083
|
+
if (vnode.scopeId) scopeIds.push(vnode.scopeId);
|
|
5084
|
+
if (vnode.slotScopeIds) scopeIds.push(...vnode.slotScopeIds);
|
|
5085
|
+
scopeIds.push(...getInheritedScopeIds(vnode, parentComponent));
|
|
5086
|
+
return scopeIds.length ? scopeIds : void 0;
|
|
5087
|
+
}
|
|
5088
|
+
function getInteropVaporSlotScopeIds(vnode, parentComponent) {
|
|
5089
|
+
const scopeIds = [];
|
|
5090
|
+
if (vnode.slotScopeIds) scopeIds.push(...vnode.slotScopeIds);
|
|
5091
|
+
scopeIds.push(...getInheritedScopeIds(vnode, parentComponent));
|
|
5092
|
+
return scopeIds.length ? scopeIds : void 0;
|
|
5093
|
+
}
|
|
5094
|
+
function createInteropFragment(nodes = EMPTY_BLOCK, vnode = null) {
|
|
5095
|
+
const frag = new VaporFragment(nodes);
|
|
5096
|
+
frag.vnode = vnode;
|
|
5097
|
+
return frag;
|
|
5098
|
+
}
|
|
4783
5099
|
//#endregion
|
|
4784
5100
|
//#region packages/runtime-vapor/src/components/Teleport.ts
|
|
4785
5101
|
const VaporTeleportImpl = {
|
|
@@ -4897,10 +5213,6 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
4897
5213
|
}
|
|
4898
5214
|
bindChildren(block) {
|
|
4899
5215
|
if (this.parentComponent && this.parentComponent.ut) this.registerUpdateCssVars(block);
|
|
4900
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4901
|
-
if (isVaporComponent(block)) block.parentTeleport = this;
|
|
4902
|
-
else if (isArray(block)) block.forEach((node) => isVaporComponent(node) && (node.parentTeleport = this));
|
|
4903
|
-
}
|
|
4904
5216
|
}
|
|
4905
5217
|
handleChildrenUpdate(children) {
|
|
4906
5218
|
if (isHydrating$1 || !this.parent || !this.mountContainer) {
|
|
@@ -4908,7 +5220,10 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
4908
5220
|
return;
|
|
4909
5221
|
}
|
|
4910
5222
|
remove(this.nodes, this.mountContainer);
|
|
4911
|
-
|
|
5223
|
+
this.nodes = children;
|
|
5224
|
+
const onBeforeInsert = this.onBeforeInsert;
|
|
5225
|
+
if (onBeforeInsert) onBeforeInsert.forEach((fn) => fn(this.nodes));
|
|
5226
|
+
insert(children, this.mountContainer, this.mountAnchor);
|
|
4912
5227
|
this.bindChildren(this.nodes);
|
|
4913
5228
|
updateCssVars(this);
|
|
4914
5229
|
}
|
|
@@ -4916,6 +5231,8 @@ var TeleportFragment = class extends VaporFragment {
|
|
|
4916
5231
|
if (isTransitionEnabled && this.$transition && !this.isMounted) applyTransitionHooks(this.nodes, this.$transition);
|
|
4917
5232
|
if (this.isMounted) move(this.nodes, this.mountContainer = parent, this.mountAnchor = anchor, 2);
|
|
4918
5233
|
else {
|
|
5234
|
+
const onBeforeInsert = this.onBeforeInsert;
|
|
5235
|
+
if (onBeforeInsert) onBeforeInsert.forEach((fn) => fn(this.nodes));
|
|
4919
5236
|
insert(this.nodes, this.mountContainer = parent, this.mountAnchor = anchor);
|
|
4920
5237
|
this.isMounted = true;
|
|
4921
5238
|
}
|
|
@@ -5056,7 +5373,7 @@ const defineVaporSSRCustomElement = ((options, extraOptions) => {
|
|
|
5056
5373
|
});
|
|
5057
5374
|
var VaporElement = class extends VueElementBase {
|
|
5058
5375
|
constructor(def, props = {}, createAppFn = createVaporApp) {
|
|
5059
|
-
super(def, props, createAppFn);
|
|
5376
|
+
super(def, shallowReactive$1(props), createAppFn);
|
|
5060
5377
|
}
|
|
5061
5378
|
_needsHydration() {
|
|
5062
5379
|
const hydrate = vaporCustomElementHydrates.get(this.constructor);
|
|
@@ -5075,13 +5392,9 @@ var VaporElement = class extends VueElementBase {
|
|
|
5075
5392
|
this._app.mount(this._root);
|
|
5076
5393
|
if (!this.shadowRoot) this._renderSlots();
|
|
5077
5394
|
}
|
|
5078
|
-
_update() {
|
|
5079
|
-
if (!this._app) return;
|
|
5080
|
-
const renderEffects = this._instance.renderEffects;
|
|
5081
|
-
if (renderEffects) renderEffects.forEach((e) => e.run());
|
|
5082
|
-
}
|
|
5395
|
+
_update() {}
|
|
5083
5396
|
_unmount() {
|
|
5084
|
-
this._app.unmount();
|
|
5397
|
+
if (this._app) this._app.unmount();
|
|
5085
5398
|
if (this._instance && this._instance.ce) this._instance.ce = void 0;
|
|
5086
5399
|
this._app = this._instance = null;
|
|
5087
5400
|
}
|
|
@@ -5113,28 +5426,31 @@ var VaporElement = class extends VueElementBase {
|
|
|
5113
5426
|
else this._updateFragmentNodes(nodes, replacements);
|
|
5114
5427
|
}
|
|
5115
5428
|
_createComponent() {
|
|
5116
|
-
|
|
5429
|
+
const ce = (instance) => {
|
|
5117
5430
|
this._app._ceComponent = this._instance = instance;
|
|
5118
5431
|
if (!this.shadowRoot) this._instance.u = [this._renderSlots.bind(this)];
|
|
5119
5432
|
this._processInstance();
|
|
5120
5433
|
};
|
|
5121
|
-
createComponent(this._def, this._props, void 0, void 0, void 0, this._app._context);
|
|
5434
|
+
createComponent(this._def, this._props, void 0, void 0, void 0, this._app._context, false, ce);
|
|
5122
5435
|
}
|
|
5123
5436
|
};
|
|
5124
5437
|
//#endregion
|
|
5125
5438
|
//#region packages/runtime-vapor/src/dom/template.ts
|
|
5126
5439
|
let t;
|
|
5127
5440
|
/* @__NO_SIDE_EFFECTS__ */
|
|
5128
|
-
function template(html,
|
|
5441
|
+
function template(html, flags = 0, ns) {
|
|
5442
|
+
const root = !!(flags & 1);
|
|
5443
|
+
const isStatic = !!(flags & 2);
|
|
5129
5444
|
let node;
|
|
5130
5445
|
return () => {
|
|
5131
5446
|
if (isHydrating$1) {
|
|
5132
5447
|
let adopted = null;
|
|
5133
5448
|
if (isStatic) {
|
|
5134
5449
|
adopted = resolveHydrationTarget(currentHydrationNode);
|
|
5450
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && html !== "") validateHydrationTarget(adopted, html);
|
|
5135
5451
|
node = adopted.cloneNode(true);
|
|
5136
5452
|
advanceHydrationNode(adopted);
|
|
5137
|
-
} else adopted = adoptTemplate(currentHydrationNode, html);
|
|
5453
|
+
} else adopted = adoptTemplate(currentHydrationNode, html, false, ns);
|
|
5138
5454
|
if (root) adopted.$root = true;
|
|
5139
5455
|
return adopted;
|
|
5140
5456
|
}
|
|
@@ -5160,30 +5476,33 @@ function template(html, root, isStatic, ns) {
|
|
|
5160
5476
|
}
|
|
5161
5477
|
//#endregion
|
|
5162
5478
|
//#region packages/runtime-vapor/src/apiCreateIf.ts
|
|
5163
|
-
function createIf(condition, b1, b2,
|
|
5479
|
+
function createIf(condition, b1, b2, flags = 1) {
|
|
5164
5480
|
const _insertionParent = insertionParent;
|
|
5165
5481
|
const _insertionAnchor = insertionAnchor;
|
|
5166
5482
|
if (!isHydrating$1) resetInsertionState();
|
|
5167
5483
|
let hydrationCursor = null;
|
|
5168
5484
|
let branchShape;
|
|
5169
5485
|
let frag;
|
|
5170
|
-
if (
|
|
5486
|
+
if (flags & 16) {
|
|
5171
5487
|
const ok = condition();
|
|
5172
5488
|
if (isHydrating$1) {
|
|
5173
|
-
branchShape = decodeIfShape(
|
|
5489
|
+
branchShape = decodeIfShape(flags, ok);
|
|
5174
5490
|
hydrationCursor = enterHydrationCursor(branchShape === 2);
|
|
5175
5491
|
}
|
|
5176
5492
|
frag = ok ? b1() : b2 ? b2() : [!!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("if") : /* @__PURE__ */ createTextNode()];
|
|
5177
5493
|
} else {
|
|
5178
|
-
const
|
|
5179
|
-
|
|
5494
|
+
const index = flags >> 8;
|
|
5495
|
+
const keyed = index > 0;
|
|
5496
|
+
const keyBase = keyed ? (index - 1) * 2 : 0;
|
|
5497
|
+
const trackSlotBoundary = !!(flags & 128);
|
|
5498
|
+
frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if", keyed, false, trackSlotBoundary) : new DynamicFragment(void 0, keyed, false, trackSlotBoundary);
|
|
5180
5499
|
renderEffect(() => {
|
|
5181
5500
|
const ok = condition();
|
|
5182
5501
|
if (isHydrating$1) {
|
|
5183
|
-
branchShape = decodeIfShape(
|
|
5502
|
+
branchShape = decodeIfShape(flags, ok);
|
|
5184
5503
|
hydrationCursor = enterHydrationCursor(branchShape === 2);
|
|
5185
5504
|
}
|
|
5186
|
-
frag.update(ok ? b1 : b2, keyed ?
|
|
5505
|
+
frag.update(ok ? b1 : b2, keyed ? keyBase + (ok ? 0 : 1) : void 0, isNoScopeBranch(flags, ok));
|
|
5187
5506
|
});
|
|
5188
5507
|
}
|
|
5189
5508
|
if (!isHydrating$1) {
|
|
@@ -5200,6 +5519,9 @@ function createIf(condition, b1, b2, blockShape, once, index) {
|
|
|
5200
5519
|
function decodeIfShape(shape, ok) {
|
|
5201
5520
|
return shape >> (ok ? 0 : 2) & 3;
|
|
5202
5521
|
}
|
|
5522
|
+
function isNoScopeBranch(flags, ok) {
|
|
5523
|
+
return !!(flags & (ok ? 32 : 64));
|
|
5524
|
+
}
|
|
5203
5525
|
//#endregion
|
|
5204
5526
|
//#region packages/runtime-vapor/src/apiCreateFragment.ts
|
|
5205
5527
|
/**
|
|
@@ -5240,14 +5562,17 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5240
5562
|
let isMounted = false;
|
|
5241
5563
|
let oldBlocks = [];
|
|
5242
5564
|
let newBlocks;
|
|
5565
|
+
let newKeys;
|
|
5243
5566
|
let parent;
|
|
5244
5567
|
let parentAnchor;
|
|
5245
5568
|
let pendingHydrationAnchor = false;
|
|
5246
5569
|
if (!isHydrating$1) parentAnchor = !!(process.env.NODE_ENV !== "production") ? /* @__PURE__ */ createComment("for") : /* @__PURE__ */ createTextNode();
|
|
5247
|
-
const frag = new ForFragment(oldBlocks);
|
|
5570
|
+
const frag = new ForFragment(oldBlocks, !!(flags & 32));
|
|
5248
5571
|
const instance = currentInstance$1;
|
|
5249
|
-
const canUseFastRemove = !!(flags & 1);
|
|
5250
5572
|
const isComponent = !!(flags & 2);
|
|
5573
|
+
const canUseFastRemove = !!(flags & 1) && !isComponent;
|
|
5574
|
+
const isSingleNode = !!(flags & 8);
|
|
5575
|
+
const isFragment = !!(flags & 16);
|
|
5251
5576
|
const slotOwner = currentSlotOwner;
|
|
5252
5577
|
if (!!(process.env.NODE_ENV !== "production") && !instance) warn("createFor() can only be used inside setup()");
|
|
5253
5578
|
if (!isComponent) onScopeDispose$1(() => {
|
|
@@ -5261,8 +5586,15 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5261
5586
|
const newLength = source.values.length;
|
|
5262
5587
|
const oldLength = oldBlocks.length;
|
|
5263
5588
|
newBlocks = new Array(newLength);
|
|
5589
|
+
newKeys = void 0;
|
|
5590
|
+
if (getKey) {
|
|
5591
|
+
newKeys = new Array(newLength);
|
|
5592
|
+
for (let i = 0; i < newLength; i++) newKeys[i] = getKey(...getItem(source, i));
|
|
5593
|
+
}
|
|
5264
5594
|
const prevSub = setActiveSub();
|
|
5265
|
-
|
|
5595
|
+
const wasMounted = isMounted;
|
|
5596
|
+
if (wasMounted && frag.onBeforeUpdate) for (let i = 0; i < frag.onBeforeUpdate.length; i++) frag.onBeforeUpdate[i]();
|
|
5597
|
+
if (!wasMounted) {
|
|
5266
5598
|
isMounted = true;
|
|
5267
5599
|
if (isHydrating$1) hydrateList(source, newLength);
|
|
5268
5600
|
else for (let i = 0; i < newLength; i++) mount(source, i);
|
|
@@ -5279,14 +5611,17 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5279
5611
|
}
|
|
5280
5612
|
} else if (!getKey) {
|
|
5281
5613
|
const commonLength = Math.min(newLength, oldLength);
|
|
5282
|
-
for (let i = 0; i < commonLength; i++)
|
|
5614
|
+
for (let i = 0; i < commonLength; i++) {
|
|
5615
|
+
const item = getItem(source, i);
|
|
5616
|
+
update(newBlocks[i] = oldBlocks[i], ...item);
|
|
5617
|
+
}
|
|
5283
5618
|
for (let i = oldLength; i < newLength; i++) mount(source, i);
|
|
5284
5619
|
for (let i = newLength; i < oldLength; i++) unmount(oldBlocks[i]);
|
|
5285
5620
|
} else {
|
|
5286
5621
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
5287
5622
|
const keyToIndexMap = /* @__PURE__ */ new Map();
|
|
5288
5623
|
for (let i = 0; i < newLength; i++) {
|
|
5289
|
-
const key =
|
|
5624
|
+
const key = newKeys[i];
|
|
5290
5625
|
if (key != null) {
|
|
5291
5626
|
if (keyToIndexMap.has(key)) warn(`Duplicate keys found during update:`, JSON.stringify(key), `Make sure keys are unique.`);
|
|
5292
5627
|
keyToIndexMap.set(key, i);
|
|
@@ -5302,7 +5637,7 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5302
5637
|
while (endOffset < commonLength) {
|
|
5303
5638
|
const index = newLength - endOffset - 1;
|
|
5304
5639
|
const item = getItem(source, index);
|
|
5305
|
-
const key =
|
|
5640
|
+
const key = newKeys[index];
|
|
5306
5641
|
const existingBlock = oldBlocks[oldLength - endOffset - 1];
|
|
5307
5642
|
if (existingBlock.key !== key) break;
|
|
5308
5643
|
update(existingBlock, ...item);
|
|
@@ -5314,10 +5649,10 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5314
5649
|
const e3 = newLength - endOffset;
|
|
5315
5650
|
for (let i = 0; i < e1; i++) {
|
|
5316
5651
|
const currentItem = getItem(source, i);
|
|
5317
|
-
const currentKey =
|
|
5652
|
+
const currentKey = newKeys[i];
|
|
5318
5653
|
const oldBlock = oldBlocks[i];
|
|
5319
5654
|
const oldKey = oldBlock.key;
|
|
5320
|
-
if (oldKey === currentKey) update(newBlocks[i] = oldBlock, currentItem
|
|
5655
|
+
if (oldKey === currentKey) update(newBlocks[i] = oldBlock, ...currentItem);
|
|
5321
5656
|
else {
|
|
5322
5657
|
queuedBlocks[queuedBlocksLength++] = [
|
|
5323
5658
|
i,
|
|
@@ -5330,7 +5665,7 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5330
5665
|
for (let i = e1; i < e2; i++) oldKeyIndexPairs[oldKeyIndexPairsLength++] = [oldBlocks[i].key, i];
|
|
5331
5666
|
for (let i = e1; i < e3; i++) {
|
|
5332
5667
|
const blockItem = getItem(source, i);
|
|
5333
|
-
const blockKey =
|
|
5668
|
+
const blockKey = newKeys[i];
|
|
5334
5669
|
queuedBlocks[queuedBlocksLength++] = [
|
|
5335
5670
|
i,
|
|
5336
5671
|
blockItem,
|
|
@@ -5396,7 +5731,7 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5396
5731
|
const { item, key } = action;
|
|
5397
5732
|
moveLink(mount(source, index, anchorNode, item, key), nextBlock.prev, nextBlock);
|
|
5398
5733
|
} else if (action.block.next !== nextBlock) {
|
|
5399
|
-
|
|
5734
|
+
insertForBlock(action.block, anchorNode);
|
|
5400
5735
|
moveLink(action.block, nextBlock.prev, nextBlock);
|
|
5401
5736
|
}
|
|
5402
5737
|
} else if ("source" in action) {
|
|
@@ -5407,7 +5742,7 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5407
5742
|
} else if (action.block.next !== void 0) {
|
|
5408
5743
|
let anchorNode = anchor ? normalizeAnchor(anchor.nodes) : parentAnchor;
|
|
5409
5744
|
if (!anchorNode.parentNode) anchorNode = parentAnchor;
|
|
5410
|
-
|
|
5745
|
+
insertForBlock(action.block, anchorNode);
|
|
5411
5746
|
moveLink(action.block, blocksTail);
|
|
5412
5747
|
blocksTail = action.block;
|
|
5413
5748
|
}
|
|
@@ -5418,12 +5753,14 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5418
5753
|
}
|
|
5419
5754
|
frag.nodes = [oldBlocks = newBlocks];
|
|
5420
5755
|
if (parentAnchor) frag.nodes.push(parentAnchor);
|
|
5421
|
-
if (
|
|
5756
|
+
if (wasMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
|
|
5422
5757
|
setActiveSub(prevSub);
|
|
5423
5758
|
};
|
|
5424
5759
|
const needKey = renderItem.length > 1;
|
|
5425
5760
|
const needIndex = renderItem.length > 2;
|
|
5426
|
-
const
|
|
5761
|
+
const insertForBlock = isSingleNode ? (block, anchor) => insertNode(block.nodes, parent, anchor) : isFragment ? (block, anchor) => insertFragment(block.nodes, parent, anchor) : (block, anchor) => insert(block.nodes, parent, anchor);
|
|
5762
|
+
const removeForBlock = isSingleNode ? (block) => removeNode(block.nodes, parent) : isFragment ? (block) => removeFragment(block.nodes, parent) : (block) => remove(block.nodes, parent);
|
|
5763
|
+
const mount = (source, idx, anchor = parentAnchor, [item, key, index] = getItem(source, idx), key2 = newKeys ? newKeys[idx] : getKey && getKey(item, key, index)) => {
|
|
5427
5764
|
const itemRef = shallowRef$1(item);
|
|
5428
5765
|
const keyRef = needKey ? shallowRef$1(key) : void 0;
|
|
5429
5766
|
const indexRef = needIndex ? shallowRef$1(index) : void 0;
|
|
@@ -5440,8 +5777,15 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5440
5777
|
}
|
|
5441
5778
|
}
|
|
5442
5779
|
const block = newBlocks[idx] = new ForBlock(nodes, scope, itemRef, keyRef, indexRef, key2);
|
|
5443
|
-
if (isTransitionEnabled && frag.$transition)
|
|
5444
|
-
|
|
5780
|
+
if (isTransitionEnabled && frag.$transition) {
|
|
5781
|
+
if (frag.$transition.applyGroup) setBlockKey(block.nodes, block.key);
|
|
5782
|
+
applyTransitionHooks(block.nodes, frag.$transition);
|
|
5783
|
+
}
|
|
5784
|
+
if (parent) {
|
|
5785
|
+
const onBeforeInsert = frag.onBeforeInsert;
|
|
5786
|
+
if (onBeforeInsert) onBeforeInsert.forEach((fn) => fn(block.nodes));
|
|
5787
|
+
insertForBlock(block, anchor);
|
|
5788
|
+
}
|
|
5445
5789
|
return block;
|
|
5446
5790
|
};
|
|
5447
5791
|
function hydrateList(source, newLength) {
|
|
@@ -5465,7 +5809,7 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5465
5809
|
if (isComment(currentHydrationNode, "]")) {
|
|
5466
5810
|
nextNode = markHydrationAnchor(currentHydrationNode);
|
|
5467
5811
|
setCurrentHydrationNode(nextNode);
|
|
5468
|
-
} else nextNode =
|
|
5812
|
+
} else nextNode = nextLogicalSibling(currentHydrationNode);
|
|
5469
5813
|
mount(source, i);
|
|
5470
5814
|
if (nextNode) setCurrentHydrationNode(nextNode);
|
|
5471
5815
|
}
|
|
@@ -5502,7 +5846,7 @@ const createFor = (src, renderItem, getKey, flags = 0) => {
|
|
|
5502
5846
|
};
|
|
5503
5847
|
const unmount = (block, doRemove = true) => {
|
|
5504
5848
|
if (!isComponent) block.scope.stop();
|
|
5505
|
-
if (doRemove)
|
|
5849
|
+
if (doRemove) removeForBlock(block);
|
|
5506
5850
|
};
|
|
5507
5851
|
if (flags & 4) renderList();
|
|
5508
5852
|
else renderEffect(() => {
|
|
@@ -5623,11 +5967,14 @@ function normalizeSource(source) {
|
|
|
5623
5967
|
isReadonlySource = isReadonly(source);
|
|
5624
5968
|
}
|
|
5625
5969
|
} else if (isString(source)) values = source.split("");
|
|
5626
|
-
else if (typeof source === "number") {
|
|
5627
|
-
|
|
5970
|
+
else if (typeof source === "number") if (!!(process.env.NODE_ENV !== "production") && (!Number.isInteger(source) || source < 0)) {
|
|
5971
|
+
warn(`The v-for range expects a positive integer value but got ${source}.`);
|
|
5972
|
+
values = [];
|
|
5973
|
+
} else {
|
|
5628
5974
|
values = new Array(source);
|
|
5629
5975
|
for (let i = 0; i < source; i++) values[i] = i + 1;
|
|
5630
|
-
}
|
|
5976
|
+
}
|
|
5977
|
+
else if (isObject(source)) if (source[Symbol.iterator]) values = Array.from(source);
|
|
5631
5978
|
else {
|
|
5632
5979
|
keys = Object.keys(source);
|
|
5633
5980
|
values = new Array(keys.length);
|
|
@@ -5656,23 +6003,35 @@ function getItem({ keys, values, needsWrap, isReadonlySource }, idx) {
|
|
|
5656
6003
|
}
|
|
5657
6004
|
function normalizeAnchor(node) {
|
|
5658
6005
|
if (node instanceof Node) return node;
|
|
5659
|
-
else if (isArray(node))
|
|
5660
|
-
|
|
5661
|
-
|
|
6006
|
+
else if (isArray(node)) {
|
|
6007
|
+
for (let i = 0; i < node.length; i++) {
|
|
6008
|
+
const anchor = normalizeAnchor(node[i]);
|
|
6009
|
+
if (anchor) return anchor;
|
|
6010
|
+
}
|
|
6011
|
+
return;
|
|
6012
|
+
} else if (isVaporComponent(node)) return normalizeAnchor(node.block);
|
|
6013
|
+
else {
|
|
6014
|
+
const nodes = node.nodes;
|
|
6015
|
+
return isValidBlock(nodes) ? normalizeAnchor(nodes) : node.anchor || normalizeAnchor(nodes);
|
|
6016
|
+
}
|
|
5662
6017
|
}
|
|
5663
6018
|
function getRestElement(val, keys) {
|
|
5664
6019
|
const res = {};
|
|
5665
6020
|
for (const key in val) if (!keys.includes(key)) res[key] = val[key];
|
|
5666
6021
|
return res;
|
|
5667
6022
|
}
|
|
5668
|
-
function getDefaultValue(val,
|
|
5669
|
-
return val === void 0 ?
|
|
6023
|
+
function getDefaultValue(val, getDefaultVal) {
|
|
6024
|
+
return val === void 0 ? getDefaultVal() : val;
|
|
5670
6025
|
}
|
|
5671
6026
|
function isForBlock(block) {
|
|
5672
6027
|
return block instanceof ForBlock;
|
|
5673
6028
|
}
|
|
5674
6029
|
//#endregion
|
|
5675
6030
|
//#region packages/runtime-vapor/src/apiTemplateRef.ts
|
|
6031
|
+
function getTemplateRefUpdateFragment(el) {
|
|
6032
|
+
if (isDynamicFragment(el)) return el;
|
|
6033
|
+
if (isVaporComponent(el) && isAsyncWrapper(el)) return el.block;
|
|
6034
|
+
}
|
|
5676
6035
|
function ensureCleanup(el) {
|
|
5677
6036
|
let cleanupRef = refCleanups.get(el);
|
|
5678
6037
|
if (!cleanupRef) {
|
|
@@ -5690,8 +6049,8 @@ function createTemplateRefSetter() {
|
|
|
5690
6049
|
const oldRefMap = /* @__PURE__ */ new WeakMap();
|
|
5691
6050
|
const setRefMap = /* @__PURE__ */ new WeakMap();
|
|
5692
6051
|
return (el, ref, refFor, refKey) => {
|
|
5693
|
-
|
|
5694
|
-
|
|
6052
|
+
const frag = getTemplateRefUpdateFragment(el);
|
|
6053
|
+
if (frag) {
|
|
5695
6054
|
const doSet = () => {
|
|
5696
6055
|
if (isVaporComponent(el) && el.isDeactivated) return;
|
|
5697
6056
|
oldRefMap.set(el, setRef$1(instance, el, ref, oldRefMap.get(el), refFor, refKey));
|
|
@@ -5706,6 +6065,19 @@ function createTemplateRefSetter() {
|
|
|
5706
6065
|
return oldRef;
|
|
5707
6066
|
};
|
|
5708
6067
|
}
|
|
6068
|
+
function setStaticTemplateRef(el, ref, refFor, refKey) {
|
|
6069
|
+
const instance = currentInstance$1;
|
|
6070
|
+
const oldRef = setRef$1(instance, el, ref, void 0, refFor, refKey);
|
|
6071
|
+
const frag = getTemplateRefUpdateFragment(el);
|
|
6072
|
+
if (frag) (frag.onUpdated || (frag.onUpdated = [])).push(() => {
|
|
6073
|
+
if (isVaporComponent(el) && el.isDeactivated) return;
|
|
6074
|
+
setRef$1(instance, el, ref, oldRef, refFor, refKey);
|
|
6075
|
+
});
|
|
6076
|
+
return oldRef;
|
|
6077
|
+
}
|
|
6078
|
+
function setTemplateRefBinding(el, getter, setter = createTemplateRefSetter(), refFor, refKey) {
|
|
6079
|
+
renderEffect(() => setter(el, getter(), refFor, refKey));
|
|
6080
|
+
}
|
|
5709
6081
|
/**
|
|
5710
6082
|
* Function for handling a template ref
|
|
5711
6083
|
*/
|
|
@@ -5840,12 +6212,16 @@ function setVarsOnBlock(block, vars) {
|
|
|
5840
6212
|
}
|
|
5841
6213
|
//#endregion
|
|
5842
6214
|
//#region packages/runtime-vapor/src/apiCreateDynamicComponent.ts
|
|
5843
|
-
function createDynamicComponent(getter, rawProps, rawSlots,
|
|
6215
|
+
function createDynamicComponent(getter, rawProps, rawSlots, flags = 0) {
|
|
6216
|
+
const isSingleRoot = !!(flags & 1);
|
|
6217
|
+
const once = !!(flags & 2);
|
|
6218
|
+
const slotRoot = !!(flags & 4);
|
|
5844
6219
|
const _insertionParent = insertionParent;
|
|
5845
6220
|
const _insertionAnchor = insertionAnchor;
|
|
5846
6221
|
if (!isHydrating$1) resetInsertionState();
|
|
5847
6222
|
const hydrationCursor = isHydrating$1 ? captureHydrationCursor() : null;
|
|
5848
|
-
const frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component") : new DynamicFragment();
|
|
6223
|
+
const frag = isHydrating$1 || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("dynamic-component", false, true, slotRoot) : new DynamicFragment(void 0, false, true, slotRoot);
|
|
6224
|
+
const normalizedRawSlots = normalizeRawSlots(rawSlots);
|
|
5849
6225
|
const scopeOwner = getScopeOwner();
|
|
5850
6226
|
const renderFn = () => {
|
|
5851
6227
|
const value = getter();
|
|
@@ -5865,7 +6241,7 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
|
|
|
5865
6241
|
}
|
|
5866
6242
|
return frag;
|
|
5867
6243
|
}
|
|
5868
|
-
return createComponentWithFallback(withScopeOwner(scopeOwner, () => resolveDynamicComponent(value)), rawProps,
|
|
6244
|
+
return createComponentWithFallback(withScopeOwner(scopeOwner, () => resolveDynamicComponent(value)), rawProps, normalizedRawSlots, isSingleRoot, once, appContext);
|
|
5869
6245
|
}, value);
|
|
5870
6246
|
};
|
|
5871
6247
|
if (once) renderFn();
|
|
@@ -5965,6 +6341,7 @@ function withVaporDirectives(node, dirs) {
|
|
|
5965
6341
|
//#region packages/runtime-vapor/src/components/TransitionGroup.ts
|
|
5966
6342
|
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
5967
6343
|
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
6344
|
+
const transitionGroupUpdateOwnerMap = /* @__PURE__ */ new WeakMap();
|
|
5968
6345
|
let isForHydrationAnchorResolverRegistered = false;
|
|
5969
6346
|
let currentForHydrationContainer;
|
|
5970
6347
|
function ensureForHydrationAnchorResolver() {
|
|
@@ -5995,29 +6372,34 @@ const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVapo
|
|
|
5995
6372
|
ensureTransitionHooksRegistered();
|
|
5996
6373
|
const instance = currentInstance;
|
|
5997
6374
|
const state = useTransitionState();
|
|
5998
|
-
let cssTransitionProps
|
|
6375
|
+
let cssTransitionProps;
|
|
5999
6376
|
const propsProxy = new Proxy({}, { get(_, key) {
|
|
6000
6377
|
return cssTransitionProps[key];
|
|
6001
6378
|
} });
|
|
6002
|
-
renderEffect(() =>
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
let
|
|
6379
|
+
renderEffect(() => cssTransitionProps = resolveTransitionProps(props), true);
|
|
6380
|
+
let prevChildren = [];
|
|
6381
|
+
let isUpdatePending = false;
|
|
6382
|
+
let isUpdatedPending = false;
|
|
6006
6383
|
let slottedBlock = [];
|
|
6007
|
-
|
|
6384
|
+
const beforeUpdate = () => {
|
|
6385
|
+
if (isUpdatePending) return;
|
|
6386
|
+
isUpdatePending = true;
|
|
6008
6387
|
prevChildren = [];
|
|
6009
6388
|
const children = getTransitionBlocks(slottedBlock);
|
|
6010
6389
|
for (let i = 0; i < children.length; i++) {
|
|
6011
6390
|
const child = children[i];
|
|
6012
6391
|
const el = isValidTransitionBlock(child) && child.$transition ? getTransitionElement(child) : void 0;
|
|
6013
|
-
if (el) {
|
|
6392
|
+
if (el && !el[vShowHidden]) {
|
|
6014
6393
|
prevChildren.push(child);
|
|
6015
6394
|
child.$transition.disabled = true;
|
|
6016
6395
|
positionMap.set(child, el.getBoundingClientRect());
|
|
6017
6396
|
}
|
|
6018
6397
|
}
|
|
6019
|
-
}
|
|
6020
|
-
|
|
6398
|
+
};
|
|
6399
|
+
const flushUpdated = () => {
|
|
6400
|
+
isUpdatedPending = false;
|
|
6401
|
+
if (!isUpdatePending) return;
|
|
6402
|
+
isUpdatePending = false;
|
|
6021
6403
|
if (!prevChildren.length) return;
|
|
6022
6404
|
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
6023
6405
|
const firstChild = getFirstConnectedChild(prevChildren);
|
|
@@ -6034,7 +6416,14 @@ const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVapo
|
|
|
6034
6416
|
forceReflow();
|
|
6035
6417
|
movedChildren.forEach((c) => handleMovedChildren(getTransitionElement(c), moveClass));
|
|
6036
6418
|
prevChildren = [];
|
|
6037
|
-
}
|
|
6419
|
+
};
|
|
6420
|
+
const updated = () => {
|
|
6421
|
+
if (!isUpdatePending || isUpdatedPending) return;
|
|
6422
|
+
isUpdatedPending = true;
|
|
6423
|
+
queuePostFlushCb(flushUpdated);
|
|
6424
|
+
};
|
|
6425
|
+
onBeforeUpdate(beforeUpdate);
|
|
6426
|
+
onUpdated(updated);
|
|
6038
6427
|
const frag = new DynamicFragment("transition-group");
|
|
6039
6428
|
let currentTag;
|
|
6040
6429
|
let currentSlot;
|
|
@@ -6050,7 +6439,7 @@ const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVapo
|
|
|
6050
6439
|
ensureForHydrationAnchorResolver();
|
|
6051
6440
|
prevForHydrationContainer = currentForHydrationContainer;
|
|
6052
6441
|
currentForHydrationContainer = container;
|
|
6053
|
-
nextNode =
|
|
6442
|
+
nextNode = nextLogicalSibling(container);
|
|
6054
6443
|
setCurrentHydrationNode(container.firstChild || container);
|
|
6055
6444
|
}
|
|
6056
6445
|
let block = slottedBlock;
|
|
@@ -6058,7 +6447,10 @@ const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVapo
|
|
|
6058
6447
|
try {
|
|
6059
6448
|
frag.update(() => {
|
|
6060
6449
|
block = slot && slot() || [];
|
|
6061
|
-
transitionBlocks = applyGroupTransitionHooks(block, propsProxy, state, instance
|
|
6450
|
+
transitionBlocks = applyGroupTransitionHooks(block, propsProxy, state, instance, {
|
|
6451
|
+
beforeUpdate,
|
|
6452
|
+
updated
|
|
6453
|
+
});
|
|
6062
6454
|
if (container) {
|
|
6063
6455
|
if (!isHydrating$1) insert(block, container);
|
|
6064
6456
|
return container;
|
|
@@ -6080,9 +6472,9 @@ const VaporTransitionGroup = /* @__PURE__ */ decorate(/* @__PURE__ */ defineVapo
|
|
|
6080
6472
|
return frag;
|
|
6081
6473
|
}
|
|
6082
6474
|
}));
|
|
6083
|
-
function applyGroupTransitionHooks(block, props, state, instance) {
|
|
6475
|
+
function applyGroupTransitionHooks(block, props, state, instance, updateHooks) {
|
|
6084
6476
|
const fragments = [];
|
|
6085
|
-
const children = getTransitionBlocks(block, (frag) => fragments.push(frag));
|
|
6477
|
+
const children = getTransitionBlocks(block, (frag) => fragments.push(frag), (owner) => trackTransitionGroupUpdate(owner, updateHooks));
|
|
6086
6478
|
for (let i = 0; i < children.length; i++) {
|
|
6087
6479
|
const child = children[i];
|
|
6088
6480
|
if (isValidTransitionBlock(child)) {
|
|
@@ -6092,11 +6484,45 @@ function applyGroupTransitionHooks(block, props, state, instance) {
|
|
|
6092
6484
|
}
|
|
6093
6485
|
fragments.forEach((frag) => {
|
|
6094
6486
|
const hooks = resolveTransitionHooks(frag, props, state, instance);
|
|
6095
|
-
hooks.applyGroup = applyGroupTransitionHooks;
|
|
6487
|
+
hooks.applyGroup = (block, props, state, instance) => applyGroupTransitionHooks(block, props, state, instance, updateHooks);
|
|
6096
6488
|
frag.$transition = hooks;
|
|
6097
6489
|
});
|
|
6098
6490
|
return children;
|
|
6099
6491
|
}
|
|
6492
|
+
function trackTransitionGroupUpdate(owner, updateHooks) {
|
|
6493
|
+
const registeredHooks = transitionGroupUpdateOwnerMap.get(owner);
|
|
6494
|
+
if (registeredHooks) {
|
|
6495
|
+
registeredHooks.beforeUpdate = updateHooks.beforeUpdate;
|
|
6496
|
+
registeredHooks.updated = updateHooks.updated;
|
|
6497
|
+
return;
|
|
6498
|
+
}
|
|
6499
|
+
transitionGroupUpdateOwnerMap.set(owner, updateHooks);
|
|
6500
|
+
if (isFragment(owner)) {
|
|
6501
|
+
(owner.onBeforeUpdate || (owner.onBeforeUpdate = [])).push(() => updateHooks.beforeUpdate());
|
|
6502
|
+
(owner.onUpdated || (owner.onUpdated = [])).push(() => updateHooks.updated());
|
|
6503
|
+
} else {
|
|
6504
|
+
let isPending = false;
|
|
6505
|
+
const flushUpdated = () => {
|
|
6506
|
+
isPending = false;
|
|
6507
|
+
updateHooks.updated();
|
|
6508
|
+
};
|
|
6509
|
+
owner.scope.run(() => {
|
|
6510
|
+
watch$1(() => {
|
|
6511
|
+
const prev = setCurrentInstance(owner, owner.scope);
|
|
6512
|
+
try {
|
|
6513
|
+
return resolveDynamicProps(owner.rawProps);
|
|
6514
|
+
} finally {
|
|
6515
|
+
setCurrentInstance(...prev);
|
|
6516
|
+
}
|
|
6517
|
+
}, () => {
|
|
6518
|
+
if (isPending) return;
|
|
6519
|
+
isPending = true;
|
|
6520
|
+
updateHooks.beforeUpdate();
|
|
6521
|
+
queuePostFlushCb(flushUpdated);
|
|
6522
|
+
});
|
|
6523
|
+
});
|
|
6524
|
+
}
|
|
6525
|
+
}
|
|
6100
6526
|
function inheritKey(children, key) {
|
|
6101
6527
|
if (key === void 0 || children.length === 0) return;
|
|
6102
6528
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -6104,25 +6530,30 @@ function inheritKey(children, key) {
|
|
|
6104
6530
|
child.$key = String(key) + String(child.$key != null ? child.$key : i);
|
|
6105
6531
|
}
|
|
6106
6532
|
}
|
|
6107
|
-
function getTransitionBlocks(block, onFragment) {
|
|
6533
|
+
function getTransitionBlocks(block, onFragment, onUpdateOwner) {
|
|
6108
6534
|
let children = [];
|
|
6109
6535
|
if (block instanceof Element) children.push(block);
|
|
6110
6536
|
else if (isVaporComponent(block)) {
|
|
6111
|
-
const
|
|
6537
|
+
const isRootSlot = block.block && isSlotFragment(block.block);
|
|
6538
|
+
if (onUpdateOwner && !isRootSlot) onUpdateOwner(block);
|
|
6539
|
+
const blocks = getTransitionBlocks(block.block, onFragment, isRootSlot ? onUpdateOwner : void 0);
|
|
6112
6540
|
inheritKey(blocks, block.$key);
|
|
6113
6541
|
children.push(...blocks);
|
|
6114
6542
|
} else if (isArray(block)) for (let i = 0; i < block.length; i++) {
|
|
6115
6543
|
const b = block[i];
|
|
6116
|
-
const blocks = getTransitionBlocks(b, onFragment);
|
|
6544
|
+
const blocks = getTransitionBlocks(b, onFragment, onUpdateOwner);
|
|
6117
6545
|
if (isForBlock(b)) blocks.forEach((block) => block.$key = b.key);
|
|
6118
6546
|
children.push(...blocks);
|
|
6119
6547
|
}
|
|
6120
|
-
else if (isFragment(block))
|
|
6121
|
-
else {
|
|
6548
|
+
else if (isFragment(block)) {
|
|
6122
6549
|
if (onFragment) onFragment(block);
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6550
|
+
if (onUpdateOwner) onUpdateOwner(block);
|
|
6551
|
+
if (isInteropEnabled && block.vnode) children.push(block);
|
|
6552
|
+
else {
|
|
6553
|
+
const blocks = getTransitionBlocks(block.nodes, onFragment, onUpdateOwner);
|
|
6554
|
+
inheritKey(blocks, block.$key);
|
|
6555
|
+
children.push(...blocks);
|
|
6556
|
+
}
|
|
6126
6557
|
}
|
|
6127
6558
|
return children;
|
|
6128
6559
|
}
|
|
@@ -6149,4 +6580,4 @@ function getFirstConnectedChild(children) {
|
|
|
6149
6580
|
}
|
|
6150
6581
|
}
|
|
6151
6582
|
//#endregion
|
|
6152
|
-
export { DynamicFragment, VaporElement, VaporFragment, VaporKeepAlive, VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSelector, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockKey, setBlockText, setClass, setClassName, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, useVaporCssVars, vaporInteropPlugin, withAsyncContext,
|
|
6583
|
+
export { DynamicFragment, VaporElement, VaporFragment, VaporKeepAlive, VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createAssetComponent, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSelector, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, onBinding, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockKey, setBlockText, setClass, setClassName, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStaticTemplateRef, setStyle, setTemplateRefBinding, setText, setValue, template, txt, useVaporCssVars, vaporInteropPlugin, withAsyncContext, withVaporDirectives, withVaporKeys, withVaporModifiers };
|