@vue/runtime-vapor 3.6.0-alpha.4 → 3.6.0-alpha.6
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 +33 -14
- package/dist/runtime-vapor.esm-bundler.js +1826 -1549
- package/package.json +4 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-vapor v3.6.0-alpha.
|
|
2
|
+
* @vue/runtime-vapor v3.6.0-alpha.6
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
import { isMismatchAllowed, warn,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, queuePostFlushCb, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, watch, onMounted, onUpdated, onBeforeUnmount, isAsyncWrapper, getComponentName, matches, devtoolsComponentAdded, resetShapeFlag, isKeepAlive, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, isVNode, Fragment, isRef, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, setCurrentInstance, startMeasure, queueJob, TransitionPropsValidators, leaveCbKey, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, warnExtraneousAttributes, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, markAsyncBoundary, getFunctionalFallthrough, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, createCanSetSetupRefChecker, baseUseCssVars, setVarsOnNode, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
|
|
7
|
+
import { isArray, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, normalizeCssVarValue, getEscapedCssVarName, isFunction, extend, invokeArrayFns, isReservedProp, EMPTY_OBJ, hasOwn, EMPTY_ARR, NO, YES, isPromise, getGlobalThis, isPlainObject, isObject, remove as remove$1, NOOP, looseEqual } from '@vue/shared';
|
|
8
|
+
import { onEffectCleanup, pauseTracking, resetTracking, ReactiveEffect, setActiveSub, EffectScope, onScopeDispose as onScopeDispose$1, markRaw, unref, proxyRefs, toRaw, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
|
|
9
9
|
|
|
10
10
|
let insertionParent;
|
|
11
11
|
let insertionAnchor;
|
|
@@ -336,814 +336,344 @@ function updateLastLogicalChild(parent, child2) {
|
|
|
336
336
|
parent.$llc = child2;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
instance.isUpdating = false;
|
|
354
|
-
instance.u && invokeArrayFns(instance.u);
|
|
355
|
-
};
|
|
356
|
-
if (instance) {
|
|
357
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
358
|
-
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
359
|
-
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
360
|
-
}
|
|
361
|
-
if (!!(process.env.NODE_ENV !== "production") || instance.type.ce) {
|
|
362
|
-
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
363
|
-
}
|
|
364
|
-
job.i = instance;
|
|
339
|
+
function addEventListener(el, event, handler, options) {
|
|
340
|
+
el.addEventListener(event, handler, options);
|
|
341
|
+
return () => el.removeEventListener(event, handler, options);
|
|
342
|
+
}
|
|
343
|
+
function on(el, event, handler, options = {}) {
|
|
344
|
+
if (isArray(handler)) {
|
|
345
|
+
handler.forEach((fn) => on(el, event, fn, options));
|
|
346
|
+
} else {
|
|
347
|
+
if (!handler) return;
|
|
348
|
+
addEventListener(el, event, handler, options);
|
|
349
|
+
if (options.effect) {
|
|
350
|
+
onEffectCleanup(() => {
|
|
351
|
+
el.removeEventListener(event, handler, options);
|
|
352
|
+
});
|
|
365
353
|
}
|
|
366
|
-
this.job = job;
|
|
367
|
-
this.i = instance;
|
|
368
354
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const prev = setCurrentInstance(instance, scope);
|
|
377
|
-
if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
|
|
378
|
-
instance.isUpdating = true;
|
|
379
|
-
instance.bu && invokeArrayFns(instance.bu);
|
|
380
|
-
this.render();
|
|
381
|
-
queuePostFlushCb(this.updateJob);
|
|
355
|
+
}
|
|
356
|
+
function delegate(el, event, handler) {
|
|
357
|
+
const key = `$evt${event}`;
|
|
358
|
+
const existing = el[key];
|
|
359
|
+
if (existing) {
|
|
360
|
+
if (isArray(existing)) {
|
|
361
|
+
existing.push(handler);
|
|
382
362
|
} else {
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
setCurrentInstance(...prev);
|
|
386
|
-
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
387
|
-
startMeasure(instance, `renderEffect`);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
notify() {
|
|
391
|
-
const flags = this.flags;
|
|
392
|
-
if (!(flags & 256)) {
|
|
393
|
-
queueJob(this.job, this.i ? this.i.uid : void 0);
|
|
363
|
+
el[key] = [existing, handler];
|
|
394
364
|
}
|
|
365
|
+
} else {
|
|
366
|
+
el[key] = handler;
|
|
395
367
|
}
|
|
396
368
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
369
|
+
const delegatedEvents = /* @__PURE__ */ Object.create(null);
|
|
370
|
+
const delegateEvents = (...names) => {
|
|
371
|
+
for (const name of names) {
|
|
372
|
+
if (!delegatedEvents[name]) {
|
|
373
|
+
delegatedEvents[name] = true;
|
|
374
|
+
document.addEventListener(name, delegatedEventHandler);
|
|
375
|
+
}
|
|
401
376
|
}
|
|
402
|
-
effect.run();
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
const displayName = "VaporTransition";
|
|
406
|
-
const decorate$1 = (t) => {
|
|
407
|
-
t.displayName = displayName;
|
|
408
|
-
t.props = TransitionPropsValidators;
|
|
409
|
-
t.__vapor = true;
|
|
410
|
-
return t;
|
|
411
377
|
};
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
resetDisplay = () => firstChild.style.display = originalDisplay;
|
|
425
|
-
}
|
|
426
|
-
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
427
|
-
setCurrentHydrationNode(firstChild);
|
|
428
|
-
}
|
|
378
|
+
const delegatedEventHandler = (e) => {
|
|
379
|
+
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
380
|
+
if (e.target !== node) {
|
|
381
|
+
Object.defineProperty(e, "target", {
|
|
382
|
+
configurable: true,
|
|
383
|
+
value: node
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
Object.defineProperty(e, "currentTarget", {
|
|
387
|
+
configurable: true,
|
|
388
|
+
get() {
|
|
389
|
+
return node || document;
|
|
429
390
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (isMounted) {
|
|
440
|
-
if (isFragment(children)) {
|
|
441
|
-
children.$transition.props = resolvedProps;
|
|
442
|
-
} else {
|
|
443
|
-
const child = findTransitionBlock(children);
|
|
444
|
-
if (child) {
|
|
445
|
-
child.$transition.props = resolvedProps;
|
|
446
|
-
applyTransitionHooks(child, child.$transition, void 0, true);
|
|
391
|
+
});
|
|
392
|
+
while (node !== null) {
|
|
393
|
+
const handlers = node[`$evt${e.type}`];
|
|
394
|
+
if (handlers) {
|
|
395
|
+
if (isArray(handlers)) {
|
|
396
|
+
for (const handler of handlers) {
|
|
397
|
+
if (!node.disabled) {
|
|
398
|
+
handler(e);
|
|
399
|
+
if (e.cancelBubble) return;
|
|
447
400
|
}
|
|
448
401
|
}
|
|
449
402
|
} else {
|
|
450
|
-
|
|
403
|
+
handlers(e);
|
|
404
|
+
if (e.cancelBubble) return;
|
|
451
405
|
}
|
|
452
|
-
});
|
|
453
|
-
let fallthroughAttrs = true;
|
|
454
|
-
if (instance.hasFallthrough) {
|
|
455
|
-
renderEffect(() => {
|
|
456
|
-
const resolvedAttrs = extend({}, attrs);
|
|
457
|
-
const child = findTransitionBlock(children);
|
|
458
|
-
if (child) {
|
|
459
|
-
child.$root = true;
|
|
460
|
-
applyFallthroughProps(child, resolvedAttrs);
|
|
461
|
-
fallthroughAttrs = false;
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
const hooks = applyTransitionHooks(
|
|
466
|
-
children,
|
|
467
|
-
{
|
|
468
|
-
state: useTransitionState(),
|
|
469
|
-
props: resolvedProps,
|
|
470
|
-
instance
|
|
471
|
-
},
|
|
472
|
-
fallthroughAttrs
|
|
473
|
-
);
|
|
474
|
-
if (resetDisplay && resolvedProps.appear) {
|
|
475
|
-
const child = findTransitionBlock(children);
|
|
476
|
-
hooks.beforeEnter(child);
|
|
477
|
-
resetDisplay();
|
|
478
|
-
queuePostFlushCb(() => hooks.enter(child));
|
|
479
406
|
}
|
|
480
|
-
|
|
407
|
+
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
481
408
|
}
|
|
482
|
-
);
|
|
483
|
-
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
484
|
-
const { leavingNodes } = state;
|
|
485
|
-
const context = {
|
|
486
|
-
setLeavingNodeCache: (el) => {
|
|
487
|
-
leavingNodes.set(key, el);
|
|
488
|
-
},
|
|
489
|
-
unsetLeavingNodeCache: (el) => {
|
|
490
|
-
const leavingNode = leavingNodes.get(key);
|
|
491
|
-
if (leavingNode === el) {
|
|
492
|
-
leavingNodes.delete(key);
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
earlyRemove: () => {
|
|
496
|
-
const leavingNode = leavingNodes.get(key);
|
|
497
|
-
if (leavingNode && leavingNode[leaveCbKey]) {
|
|
498
|
-
leavingNode[leaveCbKey]();
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
cloneHooks: (block) => {
|
|
502
|
-
const hooks = resolveTransitionHooks(
|
|
503
|
-
block,
|
|
504
|
-
props,
|
|
505
|
-
state,
|
|
506
|
-
instance,
|
|
507
|
-
postClone
|
|
508
|
-
);
|
|
509
|
-
if (postClone) postClone(hooks);
|
|
510
|
-
return hooks;
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
return context;
|
|
514
409
|
};
|
|
515
|
-
function
|
|
516
|
-
const
|
|
517
|
-
|
|
518
|
-
props,
|
|
519
|
-
state,
|
|
520
|
-
instance,
|
|
521
|
-
postClone
|
|
522
|
-
);
|
|
523
|
-
const hooks = baseResolveTransitionHooks(
|
|
524
|
-
context,
|
|
525
|
-
props,
|
|
526
|
-
state,
|
|
527
|
-
instance
|
|
528
|
-
);
|
|
529
|
-
hooks.state = state;
|
|
530
|
-
hooks.props = props;
|
|
531
|
-
hooks.instance = instance;
|
|
532
|
-
return hooks;
|
|
533
|
-
}
|
|
534
|
-
function applyTransitionHooks(block, hooks, fallthroughAttrs = true, isResolved = false) {
|
|
535
|
-
if (isArray(block)) {
|
|
536
|
-
block = block.filter((b) => !(b instanceof Comment));
|
|
537
|
-
if (block.length === 1) {
|
|
538
|
-
block = block[0];
|
|
539
|
-
} else if (block.length === 0) {
|
|
540
|
-
return hooks;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
const isFrag = isFragment(block);
|
|
544
|
-
const child = isResolved ? block : findTransitionBlock(block, isFrag);
|
|
545
|
-
if (!child) {
|
|
546
|
-
if (isFrag) setTransitionHooksOnFragment(block, hooks);
|
|
547
|
-
return hooks;
|
|
410
|
+
function setDynamicEvents(el, events) {
|
|
411
|
+
for (const name in events) {
|
|
412
|
+
on(el, name, events[name], { effect: true });
|
|
548
413
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
414
|
+
}
|
|
415
|
+
function createInvoker(handler) {
|
|
416
|
+
const i = currentInstance;
|
|
417
|
+
return (...args) => callWithAsyncErrorHandling(
|
|
418
|
+
handler,
|
|
419
|
+
i,
|
|
420
|
+
5,
|
|
421
|
+
args
|
|
556
422
|
);
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
if (
|
|
562
|
-
|
|
563
|
-
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const hasFallthroughKey = (key) => currentInstance.hasFallthrough && key in currentInstance.attrs;
|
|
426
|
+
function setProp(el, key, value) {
|
|
427
|
+
if (key in el) {
|
|
428
|
+
setDOMProp(el, key, value);
|
|
429
|
+
} else {
|
|
430
|
+
setAttr(el, key, value);
|
|
564
431
|
}
|
|
565
|
-
return resolvedHooks;
|
|
566
432
|
}
|
|
567
|
-
function
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
const { props, state, instance } = enterHooks;
|
|
571
|
-
const leavingHooks = resolveTransitionHooks(
|
|
572
|
-
leavingBlock,
|
|
573
|
-
props,
|
|
574
|
-
state,
|
|
575
|
-
instance
|
|
576
|
-
);
|
|
577
|
-
leavingBlock.$transition = leavingHooks;
|
|
578
|
-
const { mode } = props;
|
|
579
|
-
if (mode === "out-in") {
|
|
580
|
-
state.isLeaving = true;
|
|
581
|
-
leavingHooks.afterLeave = () => {
|
|
582
|
-
state.isLeaving = false;
|
|
583
|
-
afterLeaveCb();
|
|
584
|
-
leavingBlock.$transition = void 0;
|
|
585
|
-
delete leavingHooks.afterLeave;
|
|
586
|
-
};
|
|
587
|
-
} else if (mode === "in-out") {
|
|
588
|
-
leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
|
|
589
|
-
state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
|
|
590
|
-
block2[leaveCbKey] = () => {
|
|
591
|
-
earlyRemove();
|
|
592
|
-
block2[leaveCbKey] = void 0;
|
|
593
|
-
leavingBlock.$transition = void 0;
|
|
594
|
-
delete enterHooks.delayedLeave;
|
|
595
|
-
};
|
|
596
|
-
enterHooks.delayedLeave = () => {
|
|
597
|
-
delayedLeave();
|
|
598
|
-
leavingBlock.$transition = void 0;
|
|
599
|
-
delete enterHooks.delayedLeave;
|
|
600
|
-
};
|
|
601
|
-
};
|
|
433
|
+
function setAttr(el, key, value, isSVG = false) {
|
|
434
|
+
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
435
|
+
return;
|
|
602
436
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
437
|
+
if (key === "true-value") {
|
|
438
|
+
el._trueValue = value;
|
|
439
|
+
} else if (key === "false-value") {
|
|
440
|
+
el._falseValue = value;
|
|
441
|
+
}
|
|
442
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value)) {
|
|
443
|
+
el[`$${key}`] = value;
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
if (value !== el[`$${key}`]) {
|
|
447
|
+
el[`$${key}`] = value;
|
|
448
|
+
if (isSVG && key.startsWith("xlink:")) {
|
|
449
|
+
if (value != null) {
|
|
450
|
+
el.setAttributeNS(xlinkNS, key, value);
|
|
451
|
+
} else {
|
|
452
|
+
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
453
|
+
}
|
|
611
454
|
} else {
|
|
612
|
-
if (
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
} else if (isArray(block)) {
|
|
617
|
-
let hasFound = false;
|
|
618
|
-
for (const c of block) {
|
|
619
|
-
if (c instanceof Comment) continue;
|
|
620
|
-
if (isFragment(c)) inFragment = true;
|
|
621
|
-
const item = findTransitionBlock(c, inFragment);
|
|
622
|
-
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
623
|
-
warn(
|
|
624
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
625
|
-
);
|
|
626
|
-
break;
|
|
455
|
+
if (value != null) {
|
|
456
|
+
el.setAttribute(key, value);
|
|
457
|
+
} else {
|
|
458
|
+
el.removeAttribute(key);
|
|
627
459
|
}
|
|
628
|
-
child = item;
|
|
629
|
-
hasFound = true;
|
|
630
|
-
if (!!!(process.env.NODE_ENV !== "production")) break;
|
|
631
460
|
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function setDOMProp(el, key, value, forceHydrate = false, attrName) {
|
|
464
|
+
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value) && !shouldForceHydrate(el, key) && !forceHydrate) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const prev = el[key];
|
|
471
|
+
if (value === prev) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
let needRemove = false;
|
|
475
|
+
if (value === "" || value == null) {
|
|
476
|
+
const type = typeof prev;
|
|
477
|
+
if (type === "boolean") {
|
|
478
|
+
value = includeBooleanAttr(value);
|
|
479
|
+
} else if (value == null && type === "string") {
|
|
480
|
+
value = "";
|
|
481
|
+
needRemove = true;
|
|
482
|
+
} else if (type === "number") {
|
|
483
|
+
value = 0;
|
|
484
|
+
needRemove = true;
|
|
638
485
|
}
|
|
639
486
|
}
|
|
640
|
-
|
|
641
|
-
|
|
487
|
+
try {
|
|
488
|
+
el[key] = value;
|
|
489
|
+
} catch (e) {
|
|
490
|
+
if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
|
|
491
|
+
warn(
|
|
492
|
+
`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: value ${value} is invalid.`,
|
|
493
|
+
e
|
|
494
|
+
);
|
|
495
|
+
}
|
|
642
496
|
}
|
|
643
|
-
|
|
497
|
+
needRemove && el.removeAttribute(attrName || key);
|
|
644
498
|
}
|
|
645
|
-
function
|
|
646
|
-
if (
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
499
|
+
function setClass(el, value, isSVG = false) {
|
|
500
|
+
if (el.$root) {
|
|
501
|
+
setClassIncremental(el, value);
|
|
502
|
+
} else {
|
|
503
|
+
value = normalizeClass(value);
|
|
504
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, value, false)) {
|
|
505
|
+
el.$cls = value;
|
|
506
|
+
return;
|
|
650
507
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
508
|
+
if (value !== el.$cls) {
|
|
509
|
+
if (isSVG) {
|
|
510
|
+
el.setAttribute("class", el.$cls = value);
|
|
511
|
+
} else {
|
|
512
|
+
el.className = el.$cls = value;
|
|
513
|
+
}
|
|
654
514
|
}
|
|
655
515
|
}
|
|
656
516
|
}
|
|
657
|
-
function
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
517
|
+
function setClassIncremental(el, value) {
|
|
518
|
+
const cacheKey = `$clsi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
519
|
+
const normalizedValue = normalizeClass(value);
|
|
520
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, normalizedValue, true)) {
|
|
521
|
+
el[cacheKey] = normalizedValue;
|
|
522
|
+
return;
|
|
661
523
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
524
|
+
const prev = el[cacheKey];
|
|
525
|
+
if ((value = el[cacheKey] = normalizedValue) !== prev) {
|
|
526
|
+
const nextList = value.split(/\s+/);
|
|
527
|
+
if (value) {
|
|
528
|
+
el.classList.add(...nextList);
|
|
529
|
+
}
|
|
530
|
+
if (prev) {
|
|
531
|
+
for (const cls of prev.split(/\s+/)) {
|
|
532
|
+
if (!nextList.includes(cls)) el.classList.remove(cls);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
669
535
|
}
|
|
670
536
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
super(nodes);
|
|
674
|
-
}
|
|
537
|
+
function shouldDeferCheckStyleMismatch(el) {
|
|
538
|
+
return !!(process.env.NODE_ENV !== "production") && (!!currentInstance.getCssVars || Object.values(el.style).some((v) => v.startsWith("--")));
|
|
675
539
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
);
|
|
688
|
-
} else {
|
|
689
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
690
|
-
this.anchor.data = this.anchorLabel;
|
|
691
|
-
}
|
|
540
|
+
function setStyle(el, value) {
|
|
541
|
+
if (el.$root) {
|
|
542
|
+
setStyleIncremental(el, value);
|
|
543
|
+
} else {
|
|
544
|
+
const normalizedValue = normalizeStyle(value);
|
|
545
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating) {
|
|
546
|
+
if (shouldDeferCheckStyleMismatch(el)) {
|
|
547
|
+
const instance = currentInstance;
|
|
548
|
+
queuePostFlushCb(() => {
|
|
549
|
+
if (!styleHasMismatch(el, value, normalizedValue, false, instance)) {
|
|
550
|
+
el.$sty = normalizedValue;
|
|
692
551
|
return;
|
|
693
552
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
this.anchor = locateFragmentEndAnchor();
|
|
704
|
-
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
705
|
-
throw new Error(
|
|
706
|
-
"Failed to locate slot anchor. this is likely a Vue internal bug."
|
|
707
|
-
);
|
|
708
|
-
} else {
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
553
|
+
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
554
|
+
});
|
|
555
|
+
return;
|
|
556
|
+
} else if (!styleHasMismatch(el, value, normalizedValue, false)) {
|
|
557
|
+
el.$sty = normalizedValue;
|
|
558
|
+
return;
|
|
711
559
|
}
|
|
712
|
-
const { parentNode, nextNode } = findBlockNode(this.nodes);
|
|
713
|
-
queuePostFlushCb(() => {
|
|
714
|
-
parentNode.insertBefore(
|
|
715
|
-
this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
|
|
716
|
-
nextNode
|
|
717
|
-
);
|
|
718
|
-
});
|
|
719
|
-
};
|
|
720
|
-
if (isHydrating) {
|
|
721
|
-
this.anchorLabel = anchorLabel;
|
|
722
|
-
locateHydrationNode();
|
|
723
|
-
} else {
|
|
724
|
-
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? createComment(anchorLabel) : createTextNode();
|
|
725
560
|
}
|
|
561
|
+
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
726
562
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
563
|
+
}
|
|
564
|
+
function setStyleIncremental(el, value) {
|
|
565
|
+
const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
566
|
+
const normalizedValue = isString(value) ? parseStringStyle(value) : normalizeStyle(value);
|
|
567
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating) {
|
|
568
|
+
if (shouldDeferCheckStyleMismatch(el)) {
|
|
569
|
+
const instance = currentInstance;
|
|
570
|
+
queuePostFlushCb(() => {
|
|
571
|
+
if (!styleHasMismatch(el, value, normalizedValue, true, instance)) {
|
|
572
|
+
el[cacheKey] = normalizedValue;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
576
|
+
});
|
|
577
|
+
return;
|
|
578
|
+
} else if (!styleHasMismatch(el, value, normalizedValue, true)) {
|
|
579
|
+
el[cacheKey] = normalizedValue;
|
|
730
580
|
return;
|
|
731
581
|
}
|
|
732
|
-
this.current = key;
|
|
733
|
-
const prevSub = setActiveSub();
|
|
734
|
-
const parent = isHydrating ? null : this.anchor.parentNode;
|
|
735
|
-
const transition = this.$transition;
|
|
736
|
-
const instance = currentInstance;
|
|
737
|
-
this.inKeepAlive = isKeepAlive(instance);
|
|
738
|
-
if (this.scope) {
|
|
739
|
-
if (this.inKeepAlive) {
|
|
740
|
-
instance.processFragment(this);
|
|
741
|
-
if (!this.keptAliveScopes) this.keptAliveScopes = /* @__PURE__ */ new Map();
|
|
742
|
-
this.keptAliveScopes.set(this.current, this.scope);
|
|
743
|
-
} else {
|
|
744
|
-
this.scope.stop();
|
|
745
|
-
}
|
|
746
|
-
const mode = transition && transition.mode;
|
|
747
|
-
if (mode) {
|
|
748
|
-
applyTransitionLeaveHooks(
|
|
749
|
-
this.nodes,
|
|
750
|
-
transition,
|
|
751
|
-
() => this.render(render, instance, transition, parent)
|
|
752
|
-
);
|
|
753
|
-
parent && remove(this.nodes, parent);
|
|
754
|
-
if (mode === "out-in") {
|
|
755
|
-
setActiveSub(prevSub);
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
} else {
|
|
759
|
-
parent && remove(this.nodes, parent);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
this.render(render, instance, transition, parent);
|
|
763
|
-
if (this.fallback) {
|
|
764
|
-
const hasNestedFragment = isFragment(this.nodes);
|
|
765
|
-
if (hasNestedFragment) {
|
|
766
|
-
setFragmentFallback(this.nodes, this.fallback);
|
|
767
|
-
}
|
|
768
|
-
const invalidFragment = findInvalidFragment(this);
|
|
769
|
-
if (invalidFragment) {
|
|
770
|
-
parent && remove(this.nodes, parent);
|
|
771
|
-
const scope = this.scope || (this.scope = new EffectScope());
|
|
772
|
-
scope.run(() => {
|
|
773
|
-
if (hasNestedFragment) {
|
|
774
|
-
renderFragmentFallback(invalidFragment);
|
|
775
|
-
} else {
|
|
776
|
-
this.nodes = this.fallback() || [];
|
|
777
|
-
}
|
|
778
|
-
});
|
|
779
|
-
parent && insert(this.nodes, parent, this.anchor);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
setActiveSub(prevSub);
|
|
783
|
-
if (isHydrating) this.hydrate();
|
|
784
|
-
}
|
|
785
|
-
render(render, instance, transition, parent) {
|
|
786
|
-
if (render) {
|
|
787
|
-
const scope = this.inKeepAlive && this.keptAliveScopes ? this.keptAliveScopes.get(this.current) : void 0;
|
|
788
|
-
if (scope) {
|
|
789
|
-
this.scope = scope;
|
|
790
|
-
this.keptAliveScopes.delete(this.current);
|
|
791
|
-
this.scope.resume();
|
|
792
|
-
} else {
|
|
793
|
-
this.scope = new EffectScope();
|
|
794
|
-
}
|
|
795
|
-
this.nodes = this.scope.run(render) || [];
|
|
796
|
-
if (this.inKeepAlive) {
|
|
797
|
-
instance.cacheFragment(this);
|
|
798
|
-
}
|
|
799
|
-
if (transition) {
|
|
800
|
-
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
801
|
-
}
|
|
802
|
-
if (parent) insert(this.nodes, parent, this.anchor);
|
|
803
|
-
} else {
|
|
804
|
-
this.scope = void 0;
|
|
805
|
-
this.nodes = [];
|
|
806
|
-
}
|
|
807
582
|
}
|
|
583
|
+
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
808
584
|
}
|
|
809
|
-
function
|
|
810
|
-
if (
|
|
811
|
-
|
|
812
|
-
fragment.fallback = () => {
|
|
813
|
-
const fallbackNodes = originalFallback();
|
|
814
|
-
if (isValidBlock(fallbackNodes)) {
|
|
815
|
-
return fallbackNodes;
|
|
816
|
-
}
|
|
817
|
-
return fallback();
|
|
818
|
-
};
|
|
819
|
-
} else {
|
|
820
|
-
fragment.fallback = fallback;
|
|
585
|
+
function setValue(el, value, forceHydrate = false) {
|
|
586
|
+
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
587
|
+
return;
|
|
821
588
|
}
|
|
822
|
-
|
|
823
|
-
|
|
589
|
+
el._value = value;
|
|
590
|
+
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, "value", getClientText(el, value)) && !shouldForceHydrate(el, "value") && !forceHydrate) {
|
|
591
|
+
return;
|
|
824
592
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
if (
|
|
828
|
-
|
|
829
|
-
} else if (fragment instanceof DynamicFragment) {
|
|
830
|
-
fragment.update(fragment.fallback);
|
|
831
|
-
} else ;
|
|
832
|
-
}
|
|
833
|
-
function findInvalidFragment(fragment) {
|
|
834
|
-
if (isValidBlock(fragment.nodes)) return null;
|
|
835
|
-
return isFragment(fragment.nodes) ? findInvalidFragment(fragment.nodes) || fragment : fragment;
|
|
836
|
-
}
|
|
837
|
-
function isFragment(val) {
|
|
838
|
-
return val instanceof VaporFragment;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
function addEventListener(el, event, handler, options) {
|
|
842
|
-
el.addEventListener(event, handler, options);
|
|
843
|
-
return () => el.removeEventListener(event, handler, options);
|
|
844
|
-
}
|
|
845
|
-
function on(el, event, handler, options = {}) {
|
|
846
|
-
addEventListener(el, event, handler, options);
|
|
847
|
-
if (options.effect) {
|
|
848
|
-
onEffectCleanup(() => {
|
|
849
|
-
el.removeEventListener(event, handler, options);
|
|
850
|
-
});
|
|
593
|
+
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
594
|
+
const newValue = value == null ? "" : value;
|
|
595
|
+
if (oldValue !== newValue) {
|
|
596
|
+
el.value = newValue;
|
|
851
597
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
const key = `$evt${event}`;
|
|
855
|
-
const existing = el[key];
|
|
856
|
-
if (existing) {
|
|
857
|
-
if (isArray(existing)) {
|
|
858
|
-
existing.push(handler);
|
|
859
|
-
} else {
|
|
860
|
-
el[key] = [existing, handler];
|
|
861
|
-
}
|
|
862
|
-
} else {
|
|
863
|
-
el[key] = handler;
|
|
598
|
+
if (value == null) {
|
|
599
|
+
el.removeAttribute("value");
|
|
864
600
|
}
|
|
865
601
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
if (
|
|
870
|
-
|
|
871
|
-
|
|
602
|
+
function setText(el, value) {
|
|
603
|
+
if (isHydrating) {
|
|
604
|
+
const clientText = getClientText(el.parentNode, value);
|
|
605
|
+
if (el.nodeValue == clientText) {
|
|
606
|
+
el.$txt = clientText;
|
|
607
|
+
return;
|
|
872
608
|
}
|
|
609
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
610
|
+
`Hydration text mismatch in`,
|
|
611
|
+
el.parentNode,
|
|
612
|
+
`
|
|
613
|
+
- rendered on server: ${JSON.stringify(el.data)}
|
|
614
|
+
- expected on client: ${JSON.stringify(value)}`
|
|
615
|
+
);
|
|
616
|
+
logMismatchError();
|
|
873
617
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
877
|
-
if (e.target !== node) {
|
|
878
|
-
Object.defineProperty(e, "target", {
|
|
879
|
-
configurable: true,
|
|
880
|
-
value: node
|
|
881
|
-
});
|
|
618
|
+
if (el.$txt !== value) {
|
|
619
|
+
el.nodeValue = el.$txt = value;
|
|
882
620
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
621
|
+
}
|
|
622
|
+
function setElementText(el, value) {
|
|
623
|
+
value = toDisplayString(value);
|
|
624
|
+
if (isHydrating) {
|
|
625
|
+
let clientText = getClientText(el, value);
|
|
626
|
+
if (el.textContent === clientText) {
|
|
627
|
+
el.$txt = clientText;
|
|
628
|
+
return;
|
|
887
629
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
} else {
|
|
900
|
-
handlers(e);
|
|
901
|
-
if (e.cancelBubble) return;
|
|
902
|
-
}
|
|
630
|
+
if (!isMismatchAllowed(el, 0)) {
|
|
631
|
+
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
632
|
+
`Hydration text content mismatch on`,
|
|
633
|
+
el,
|
|
634
|
+
`
|
|
635
|
+
- rendered on server: ${el.textContent}
|
|
636
|
+
- expected on client: ${clientText}`
|
|
637
|
+
);
|
|
638
|
+
logMismatchError();
|
|
903
639
|
}
|
|
904
|
-
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
905
640
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
for (const name in events) {
|
|
909
|
-
on(el, name, events[name], { effect: true });
|
|
641
|
+
if (el.$txt !== value) {
|
|
642
|
+
el.textContent = el.$txt = value;
|
|
910
643
|
}
|
|
911
644
|
}
|
|
912
|
-
function
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
645
|
+
function setBlockText(block, value) {
|
|
646
|
+
value = value == null ? "" : value;
|
|
647
|
+
if (block.$txt !== value) {
|
|
648
|
+
setTextToBlock(block, block.$txt = value);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
function warnCannotSetProp(prop) {
|
|
652
|
+
warn(
|
|
653
|
+
`Extraneous non-props attributes (${prop}) were passed to component but could not be automatically inherited because component renders text or multiple root nodes.`
|
|
919
654
|
);
|
|
920
655
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
656
|
+
function setTextToBlock(block, value) {
|
|
657
|
+
if (block instanceof Node) {
|
|
658
|
+
if (block instanceof Element) {
|
|
659
|
+
block.textContent = value;
|
|
660
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
661
|
+
warnCannotSetProp("textContent");
|
|
662
|
+
}
|
|
663
|
+
} else if (isVaporComponent(block)) {
|
|
664
|
+
setTextToBlock(block.block, value);
|
|
665
|
+
} else if (isArray(block)) {
|
|
666
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
667
|
+
warnCannotSetProp("textContent");
|
|
668
|
+
}
|
|
926
669
|
} else {
|
|
927
|
-
|
|
670
|
+
setTextToBlock(block.nodes, value);
|
|
928
671
|
}
|
|
929
672
|
}
|
|
930
|
-
function
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
if (key === "true-value") {
|
|
935
|
-
el._trueValue = value;
|
|
936
|
-
} else if (key === "false-value") {
|
|
937
|
-
el._falseValue = value;
|
|
938
|
-
}
|
|
939
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value)) {
|
|
940
|
-
el[`$${key}`] = value;
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
|
-
if (value !== el[`$${key}`]) {
|
|
944
|
-
el[`$${key}`] = value;
|
|
945
|
-
if (isSVG && key.startsWith("xlink:")) {
|
|
946
|
-
if (value != null) {
|
|
947
|
-
el.setAttributeNS(xlinkNS, key, value);
|
|
948
|
-
} else {
|
|
949
|
-
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
950
|
-
}
|
|
951
|
-
} else {
|
|
952
|
-
if (value != null) {
|
|
953
|
-
el.setAttribute(key, value);
|
|
954
|
-
} else {
|
|
955
|
-
el.removeAttribute(key);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
function setDOMProp(el, key, value, forceHydrate = false, attrName) {
|
|
961
|
-
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value) && !shouldForceHydrate(el, key) && !forceHydrate) {
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
const prev = el[key];
|
|
968
|
-
if (value === prev) {
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
let needRemove = false;
|
|
972
|
-
if (value === "" || value == null) {
|
|
973
|
-
const type = typeof prev;
|
|
974
|
-
if (type === "boolean") {
|
|
975
|
-
value = includeBooleanAttr(value);
|
|
976
|
-
} else if (value == null && type === "string") {
|
|
977
|
-
value = "";
|
|
978
|
-
needRemove = true;
|
|
979
|
-
} else if (type === "number") {
|
|
980
|
-
value = 0;
|
|
981
|
-
needRemove = true;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
try {
|
|
985
|
-
el[key] = value;
|
|
986
|
-
} catch (e) {
|
|
987
|
-
if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
|
|
988
|
-
warn(
|
|
989
|
-
`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: value ${value} is invalid.`,
|
|
990
|
-
e
|
|
991
|
-
);
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
needRemove && el.removeAttribute(attrName || key);
|
|
995
|
-
}
|
|
996
|
-
function setClass(el, value, isSVG = false) {
|
|
997
|
-
if (el.$root) {
|
|
998
|
-
setClassIncremental(el, value);
|
|
999
|
-
} else {
|
|
1000
|
-
value = normalizeClass(value);
|
|
1001
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, value, false)) {
|
|
1002
|
-
el.$cls = value;
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
if (value !== el.$cls) {
|
|
1006
|
-
if (isSVG) {
|
|
1007
|
-
el.setAttribute("class", el.$cls = value);
|
|
1008
|
-
} else {
|
|
1009
|
-
el.className = el.$cls = value;
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
function setClassIncremental(el, value) {
|
|
1015
|
-
const cacheKey = `$clsi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1016
|
-
const normalizedValue = normalizeClass(value);
|
|
1017
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, normalizedValue, true)) {
|
|
1018
|
-
el[cacheKey] = normalizedValue;
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
const prev = el[cacheKey];
|
|
1022
|
-
if ((value = el[cacheKey] = normalizedValue) !== prev) {
|
|
1023
|
-
const nextList = value.split(/\s+/);
|
|
1024
|
-
if (value) {
|
|
1025
|
-
el.classList.add(...nextList);
|
|
1026
|
-
}
|
|
1027
|
-
if (prev) {
|
|
1028
|
-
for (const cls of prev.split(/\s+/)) {
|
|
1029
|
-
if (!nextList.includes(cls)) el.classList.remove(cls);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
function setStyle(el, value) {
|
|
1035
|
-
if (el.$root) {
|
|
1036
|
-
setStyleIncremental(el, value);
|
|
1037
|
-
} else {
|
|
1038
|
-
const normalizedValue = normalizeStyle(value);
|
|
1039
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !styleHasMismatch(el, value, normalizedValue, false)) {
|
|
1040
|
-
el.$sty = normalizedValue;
|
|
1041
|
-
return;
|
|
1042
|
-
}
|
|
1043
|
-
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
function setStyleIncremental(el, value) {
|
|
1047
|
-
const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1048
|
-
const normalizedValue = isString(value) ? parseStringStyle(value) : normalizeStyle(value);
|
|
1049
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !styleHasMismatch(el, value, normalizedValue, true)) {
|
|
1050
|
-
el[cacheKey] = normalizedValue;
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
1054
|
-
}
|
|
1055
|
-
function setValue(el, value, forceHydrate = false) {
|
|
1056
|
-
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
1057
|
-
return;
|
|
1058
|
-
}
|
|
1059
|
-
el._value = value;
|
|
1060
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, "value", getClientText(el, value)) && !shouldForceHydrate(el, "value") && !forceHydrate) {
|
|
1061
|
-
return;
|
|
1062
|
-
}
|
|
1063
|
-
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
1064
|
-
const newValue = value == null ? "" : value;
|
|
1065
|
-
if (oldValue !== newValue) {
|
|
1066
|
-
el.value = newValue;
|
|
1067
|
-
}
|
|
1068
|
-
if (value == null) {
|
|
1069
|
-
el.removeAttribute("value");
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
function setText(el, value) {
|
|
1073
|
-
if (isHydrating) {
|
|
1074
|
-
const clientText = getClientText(el.parentNode, value);
|
|
1075
|
-
if (el.nodeValue == clientText) {
|
|
1076
|
-
el.$txt = clientText;
|
|
1077
|
-
return;
|
|
1078
|
-
}
|
|
1079
|
-
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1080
|
-
`Hydration text mismatch in`,
|
|
1081
|
-
el.parentNode,
|
|
1082
|
-
`
|
|
1083
|
-
- rendered on server: ${JSON.stringify(el.data)}
|
|
1084
|
-
- expected on client: ${JSON.stringify(value)}`
|
|
1085
|
-
);
|
|
1086
|
-
logMismatchError();
|
|
1087
|
-
}
|
|
1088
|
-
if (el.$txt !== value) {
|
|
1089
|
-
el.nodeValue = el.$txt = value;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
function setElementText(el, value) {
|
|
1093
|
-
value = toDisplayString(value);
|
|
1094
|
-
if (isHydrating) {
|
|
1095
|
-
let clientText = getClientText(el, value);
|
|
1096
|
-
if (el.textContent === clientText) {
|
|
1097
|
-
el.$txt = clientText;
|
|
1098
|
-
return;
|
|
1099
|
-
}
|
|
1100
|
-
if (!isMismatchAllowed(el, 0)) {
|
|
1101
|
-
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1102
|
-
`Hydration text content mismatch on`,
|
|
1103
|
-
el,
|
|
1104
|
-
`
|
|
1105
|
-
- rendered on server: ${el.textContent}
|
|
1106
|
-
- expected on client: ${clientText}`
|
|
1107
|
-
);
|
|
1108
|
-
logMismatchError();
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
if (el.$txt !== value) {
|
|
1112
|
-
el.textContent = el.$txt = value;
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
function setBlockText(block, value) {
|
|
1116
|
-
value = value == null ? "" : value;
|
|
1117
|
-
if (block.$txt !== value) {
|
|
1118
|
-
setTextToBlock(block, block.$txt = value);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
function warnCannotSetProp(prop) {
|
|
1122
|
-
warn(
|
|
1123
|
-
`Extraneous non-props attributes (${prop}) were passed to component but could not be automatically inherited because component renders text or multiple root nodes.`
|
|
1124
|
-
);
|
|
1125
|
-
}
|
|
1126
|
-
function setTextToBlock(block, value) {
|
|
1127
|
-
if (block instanceof Node) {
|
|
1128
|
-
if (block instanceof Element) {
|
|
1129
|
-
block.textContent = value;
|
|
1130
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1131
|
-
warnCannotSetProp("textContent");
|
|
1132
|
-
}
|
|
1133
|
-
} else if (isVaporComponent(block)) {
|
|
1134
|
-
setTextToBlock(block.block, value);
|
|
1135
|
-
} else if (isArray(block)) {
|
|
1136
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1137
|
-
warnCannotSetProp("textContent");
|
|
1138
|
-
}
|
|
1139
|
-
} else {
|
|
1140
|
-
setTextToBlock(block.nodes, value);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
function setHtml(el, value) {
|
|
1144
|
-
value = value == null ? "" : unsafeToTrustedHTML(value);
|
|
1145
|
-
if (el.$html !== value) {
|
|
1146
|
-
el.innerHTML = el.$html = value;
|
|
673
|
+
function setHtml(el, value) {
|
|
674
|
+
value = value == null ? "" : unsafeToTrustedHTML(value);
|
|
675
|
+
if (el.$html !== value) {
|
|
676
|
+
el.innerHTML = el.$html = value;
|
|
1147
677
|
}
|
|
1148
678
|
}
|
|
1149
679
|
function setBlockHtml(block, value) {
|
|
@@ -1169,11 +699,10 @@ function setHtmlToBlock(block, value) {
|
|
|
1169
699
|
setHtmlToBlock(block.nodes, value);
|
|
1170
700
|
}
|
|
1171
701
|
}
|
|
1172
|
-
function setDynamicProps(el, args,
|
|
702
|
+
function setDynamicProps(el, args, isSVG) {
|
|
1173
703
|
const props = args.length > 1 ? mergeProps(...args) : args[0];
|
|
1174
704
|
const cacheKey = `$dprops${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1175
705
|
const prevKeys = el[cacheKey];
|
|
1176
|
-
if (root) el.$root = root;
|
|
1177
706
|
if (prevKeys) {
|
|
1178
707
|
for (const key of prevKeys) {
|
|
1179
708
|
if (!(key in props)) {
|
|
@@ -1249,7 +778,7 @@ function classHasMismatch(el, expected, isIncremental) {
|
|
|
1249
778
|
}
|
|
1250
779
|
return false;
|
|
1251
780
|
}
|
|
1252
|
-
function styleHasMismatch(el, value, normalizedValue, isIncremental) {
|
|
781
|
+
function styleHasMismatch(el, value, normalizedValue, isIncremental, instance = currentInstance) {
|
|
1253
782
|
const actual = el.getAttribute("style");
|
|
1254
783
|
const actualStyleMap = toStyleMap(actual || "");
|
|
1255
784
|
const expected = isString(value) ? value : stringifyStyle(normalizedValue);
|
|
@@ -1257,6 +786,9 @@ function styleHasMismatch(el, value, normalizedValue, isIncremental) {
|
|
|
1257
786
|
if (el[vShowHidden]) {
|
|
1258
787
|
expectedStyleMap.set("display", "none");
|
|
1259
788
|
}
|
|
789
|
+
if (instance) {
|
|
790
|
+
resolveCssVars(instance, el, expectedStyleMap);
|
|
791
|
+
}
|
|
1260
792
|
let hasMismatch = false;
|
|
1261
793
|
if (isIncremental) {
|
|
1262
794
|
if (expected) {
|
|
@@ -1274,6 +806,24 @@ function styleHasMismatch(el, value, normalizedValue, isIncremental) {
|
|
|
1274
806
|
}
|
|
1275
807
|
return false;
|
|
1276
808
|
}
|
|
809
|
+
function resolveCssVars(instance, block, expectedMap) {
|
|
810
|
+
if (!instance.isMounted) return;
|
|
811
|
+
const rootBlocks = normalizeBlock(instance);
|
|
812
|
+
if (instance.getCssVars && normalizeBlock(block).every((b) => rootBlocks.includes(b))) {
|
|
813
|
+
const cssVars = instance.getCssVars();
|
|
814
|
+
for (const key in cssVars) {
|
|
815
|
+
const value = normalizeCssVarValue(cssVars[key]);
|
|
816
|
+
expectedMap.set(`--${getEscapedCssVarName(key, false)}`, value);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
if (normalizeBlock(block).every((b) => rootBlocks.includes(b)) && instance.parent) {
|
|
820
|
+
resolveCssVars(
|
|
821
|
+
instance.parent,
|
|
822
|
+
instance.block,
|
|
823
|
+
expectedMap
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
1277
827
|
function attributeHasMismatch(el, key, value) {
|
|
1278
828
|
if (isValidHtmlOrSvgAttribute(el, key)) {
|
|
1279
829
|
const { actual, expected } = getAttributeMismatch(el, key, value);
|
|
@@ -1297,232 +847,51 @@ function shouldForceHydrate(el, key) {
|
|
|
1297
847
|
tagName.includes("-");
|
|
1298
848
|
}
|
|
1299
849
|
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
850
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
851
|
+
// @__NO_SIDE_EFFECTS__
|
|
852
|
+
function defineVaporComponent(comp, extraOptions) {
|
|
853
|
+
if (isFunction(comp)) {
|
|
854
|
+
return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
|
|
855
|
+
setup: comp,
|
|
856
|
+
__vapor: true
|
|
857
|
+
}))();
|
|
1306
858
|
}
|
|
859
|
+
comp.__vapor = true;
|
|
860
|
+
return comp;
|
|
1307
861
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
enumerable: true,
|
|
1317
|
-
value: slot
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
862
|
+
|
|
863
|
+
const VaporKeepAliveImpl = defineVaporComponent({
|
|
864
|
+
name: "VaporKeepAlive",
|
|
865
|
+
__isKeepAlive: true,
|
|
866
|
+
props: {
|
|
867
|
+
include: [String, RegExp, Array],
|
|
868
|
+
exclude: [String, RegExp, Array],
|
|
869
|
+
max: [String, Number]
|
|
1320
870
|
},
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
if (dynamicSources) {
|
|
1325
|
-
keys = keys.filter((k) => k !== "$");
|
|
1326
|
-
for (const source of dynamicSources) {
|
|
1327
|
-
if (isFunction(source)) {
|
|
1328
|
-
const slot = source();
|
|
1329
|
-
if (isArray(slot)) {
|
|
1330
|
-
for (const s of slot) keys.push(String(s.name));
|
|
1331
|
-
} else {
|
|
1332
|
-
keys.push(String(slot.name));
|
|
1333
|
-
}
|
|
1334
|
-
} else {
|
|
1335
|
-
keys.push(...Object.keys(source));
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
return keys;
|
|
1340
|
-
},
|
|
1341
|
-
set: NO,
|
|
1342
|
-
deleteProperty: NO
|
|
1343
|
-
};
|
|
1344
|
-
function getSlot(target, key) {
|
|
1345
|
-
if (key === "$") return;
|
|
1346
|
-
const dynamicSources = target.$;
|
|
1347
|
-
if (dynamicSources) {
|
|
1348
|
-
let i = dynamicSources.length;
|
|
1349
|
-
let source;
|
|
1350
|
-
while (i--) {
|
|
1351
|
-
source = dynamicSources[i];
|
|
1352
|
-
if (isFunction(source)) {
|
|
1353
|
-
const slot = source();
|
|
1354
|
-
if (slot) {
|
|
1355
|
-
if (isArray(slot)) {
|
|
1356
|
-
for (const s of slot) {
|
|
1357
|
-
if (String(s.name) === key) return s.fn;
|
|
1358
|
-
}
|
|
1359
|
-
} else if (String(slot.name) === key) {
|
|
1360
|
-
return slot.fn;
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
} else if (hasOwn(source, key)) {
|
|
1364
|
-
return source[key];
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
if (hasOwn(target, key)) {
|
|
1369
|
-
return target[key];
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
let currentSlotConsumer = null;
|
|
1373
|
-
function setCurrentSlotConsumer(consumer) {
|
|
1374
|
-
try {
|
|
1375
|
-
return currentSlotConsumer;
|
|
1376
|
-
} finally {
|
|
1377
|
-
currentSlotConsumer = consumer;
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
function getParentInstance() {
|
|
1381
|
-
return currentSlotConsumer || currentInstance;
|
|
1382
|
-
}
|
|
1383
|
-
function withVaporCtx(fn) {
|
|
1384
|
-
const owner = currentInstance;
|
|
1385
|
-
return (...args) => {
|
|
1386
|
-
const prev = setCurrentInstance(owner);
|
|
1387
|
-
const prevConsumer = setCurrentSlotConsumer(prev[0]);
|
|
1388
|
-
try {
|
|
1389
|
-
return fn(...args);
|
|
1390
|
-
} finally {
|
|
1391
|
-
setCurrentInstance(...prev);
|
|
1392
|
-
setCurrentSlotConsumer(prevConsumer);
|
|
1393
|
-
}
|
|
1394
|
-
};
|
|
1395
|
-
}
|
|
1396
|
-
function createSlot(name, rawProps, fallback, noSlotted) {
|
|
1397
|
-
const _insertionParent = insertionParent;
|
|
1398
|
-
const _insertionAnchor = insertionAnchor;
|
|
1399
|
-
const _isLastInsertion = isLastInsertion;
|
|
1400
|
-
if (!isHydrating) resetInsertionState();
|
|
1401
|
-
const instance = currentInstance;
|
|
1402
|
-
const rawSlots = instance.rawSlots;
|
|
1403
|
-
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
1404
|
-
let fragment;
|
|
1405
|
-
if (isRef(rawSlots._)) {
|
|
1406
|
-
if (isHydrating) locateHydrationNode();
|
|
1407
|
-
fragment = instance.appContext.vapor.vdomSlot(
|
|
1408
|
-
rawSlots._,
|
|
1409
|
-
name,
|
|
1410
|
-
slotProps,
|
|
1411
|
-
instance,
|
|
1412
|
-
fallback
|
|
1413
|
-
);
|
|
1414
|
-
} else {
|
|
1415
|
-
fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
|
|
1416
|
-
const isDynamicName = isFunction(name);
|
|
1417
|
-
const slotScopeIds = [];
|
|
1418
|
-
if (!noSlotted) {
|
|
1419
|
-
const scopeId = instance.type.__scopeId;
|
|
1420
|
-
if (scopeId) {
|
|
1421
|
-
slotScopeIds.push(`${scopeId}-s`);
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
const renderSlot = () => {
|
|
1425
|
-
const slotName = isFunction(name) ? name() : name;
|
|
1426
|
-
if (instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce) {
|
|
1427
|
-
const el = createElement("slot");
|
|
1428
|
-
renderEffect(() => {
|
|
1429
|
-
setDynamicProps(el, [
|
|
1430
|
-
slotProps,
|
|
1431
|
-
slotName !== "default" ? { name: slotName } : {}
|
|
1432
|
-
]);
|
|
1433
|
-
});
|
|
1434
|
-
if (fallback) insert(fallback(), el);
|
|
1435
|
-
fragment.nodes = el;
|
|
1436
|
-
return;
|
|
1437
|
-
}
|
|
1438
|
-
const slot = getSlot(rawSlots, slotName);
|
|
1439
|
-
if (slot) {
|
|
1440
|
-
fragment.fallback = fallback;
|
|
1441
|
-
fragment.update(
|
|
1442
|
-
slot._bound || (slot._bound = () => {
|
|
1443
|
-
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
1444
|
-
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
1445
|
-
);
|
|
1446
|
-
try {
|
|
1447
|
-
return slot(slotProps);
|
|
1448
|
-
} finally {
|
|
1449
|
-
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
1450
|
-
}
|
|
1451
|
-
})
|
|
1452
|
-
);
|
|
1453
|
-
} else {
|
|
1454
|
-
fragment.update(fallback);
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
if (isDynamicName || rawSlots.$) {
|
|
1458
|
-
renderEffect(renderSlot);
|
|
1459
|
-
} else {
|
|
1460
|
-
renderSlot();
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
if (!isHydrating) {
|
|
1464
|
-
if (!noSlotted) {
|
|
1465
|
-
const scopeId = instance.type.__scopeId;
|
|
1466
|
-
if (scopeId) {
|
|
1467
|
-
setScopeId(fragment, [`${scopeId}-s`]);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
1471
|
-
} else {
|
|
1472
|
-
if (fragment.insert) {
|
|
1473
|
-
fragment.hydrate();
|
|
1474
|
-
}
|
|
1475
|
-
if (_isLastInsertion) {
|
|
1476
|
-
advanceHydrationNode(_insertionParent);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
return fragment;
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1483
|
-
// @__NO_SIDE_EFFECTS__
|
|
1484
|
-
function defineVaporComponent(comp, extraOptions) {
|
|
1485
|
-
if (isFunction(comp)) {
|
|
1486
|
-
return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
|
|
1487
|
-
setup: comp,
|
|
1488
|
-
__vapor: true
|
|
1489
|
-
}))();
|
|
1490
|
-
}
|
|
1491
|
-
comp.__vapor = true;
|
|
1492
|
-
return comp;
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
const VaporKeepAliveImpl = defineVaporComponent({
|
|
1496
|
-
name: "VaporKeepAlive",
|
|
1497
|
-
__isKeepAlive: true,
|
|
1498
|
-
props: {
|
|
1499
|
-
include: [String, RegExp, Array],
|
|
1500
|
-
exclude: [String, RegExp, Array],
|
|
1501
|
-
max: [String, Number]
|
|
1502
|
-
},
|
|
1503
|
-
setup(props, { slots }) {
|
|
1504
|
-
if (!slots.default) {
|
|
1505
|
-
return void 0;
|
|
871
|
+
setup(props, { slots }) {
|
|
872
|
+
if (!slots.default) {
|
|
873
|
+
return void 0;
|
|
1506
874
|
}
|
|
1507
875
|
const keepAliveInstance = currentInstance;
|
|
1508
876
|
const cache = /* @__PURE__ */ new Map();
|
|
1509
877
|
const keys = /* @__PURE__ */ new Set();
|
|
1510
878
|
const storageContainer = createElement("div");
|
|
879
|
+
const keptAliveScopes = /* @__PURE__ */ new Map();
|
|
1511
880
|
let current;
|
|
1512
881
|
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
1513
882
|
keepAliveInstance.__v_cache = cache;
|
|
1514
883
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
}
|
|
1525
|
-
|
|
884
|
+
keepAliveInstance.getStorageContainer = () => storageContainer;
|
|
885
|
+
keepAliveInstance.getCachedComponent = (comp) => cache.get(comp);
|
|
886
|
+
keepAliveInstance.activate = (instance, parentNode, anchor) => {
|
|
887
|
+
current = instance;
|
|
888
|
+
activate(instance, parentNode, anchor);
|
|
889
|
+
};
|
|
890
|
+
keepAliveInstance.deactivate = (instance) => {
|
|
891
|
+
current = void 0;
|
|
892
|
+
deactivate(instance, storageContainer);
|
|
893
|
+
};
|
|
894
|
+
const innerCacheBlock = (key, instance) => {
|
|
1526
895
|
const { max } = props;
|
|
1527
896
|
if (cache.has(key)) {
|
|
1528
897
|
keys.delete(key);
|
|
@@ -1535,116 +904,49 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1535
904
|
}
|
|
1536
905
|
cache.set(key, instance);
|
|
1537
906
|
current = instance;
|
|
1538
|
-
}
|
|
1539
|
-
function cacheBlock() {
|
|
1540
|
-
const block = keepAliveInstance.block;
|
|
1541
|
-
const innerBlock = getInnerBlock(block);
|
|
1542
|
-
if (!innerBlock || !shouldCache(innerBlock)) return;
|
|
1543
|
-
let toCache;
|
|
1544
|
-
let key;
|
|
1545
|
-
let frag;
|
|
1546
|
-
if (isFragment(block) && (frag = findInteropFragment(block))) {
|
|
1547
|
-
toCache = frag;
|
|
1548
|
-
key = frag.vnode.type;
|
|
1549
|
-
} else {
|
|
1550
|
-
toCache = innerBlock;
|
|
1551
|
-
key = innerBlock.type;
|
|
1552
|
-
}
|
|
1553
|
-
innerCacheBlock(key, toCache);
|
|
1554
|
-
}
|
|
1555
|
-
onMounted(cacheBlock);
|
|
1556
|
-
onUpdated(cacheBlock);
|
|
1557
|
-
onBeforeUnmount(() => {
|
|
1558
|
-
cache.forEach((cached, key) => {
|
|
1559
|
-
const instance = getInstanceFromCache(cached);
|
|
1560
|
-
if (!instance) return;
|
|
1561
|
-
resetCachedShapeFlag(cached);
|
|
1562
|
-
cache.delete(key);
|
|
1563
|
-
if (current) {
|
|
1564
|
-
const currentKey = isVaporComponent(current) ? current.type : current.vnode.type;
|
|
1565
|
-
if (currentKey === key) {
|
|
1566
|
-
const da = instance.da;
|
|
1567
|
-
da && queuePostFlushCb(da);
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
remove(cached, storageContainer);
|
|
1572
|
-
});
|
|
1573
|
-
});
|
|
1574
|
-
keepAliveInstance.getStorageContainer = () => storageContainer;
|
|
1575
|
-
keepAliveInstance.getCachedComponent = (comp) => {
|
|
1576
|
-
return cache.get(comp);
|
|
1577
907
|
};
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
908
|
+
const cacheBlock = () => {
|
|
909
|
+
const block = keepAliveInstance.block;
|
|
910
|
+
const [innerBlock, interop] = getInnerBlock(block);
|
|
911
|
+
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
912
|
+
innerCacheBlock(
|
|
913
|
+
interop ? innerBlock.vnode.type : innerBlock.type,
|
|
914
|
+
innerBlock
|
|
915
|
+
);
|
|
1582
916
|
};
|
|
1583
|
-
|
|
1584
|
-
const innerBlock = getInnerBlock(frag.nodes);
|
|
1585
|
-
if (!innerBlock) return;
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
fragment.vnode.shapeFlag |= 512;
|
|
917
|
+
const processFragment = (frag) => {
|
|
918
|
+
const [innerBlock, interop] = getInnerBlock(frag.nodes);
|
|
919
|
+
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
920
|
+
if (interop) {
|
|
921
|
+
if (cache.has(innerBlock.vnode.type)) {
|
|
922
|
+
innerBlock.vnode.shapeFlag |= 512;
|
|
1590
923
|
}
|
|
1591
|
-
if (shouldCache(innerBlock)) {
|
|
1592
|
-
|
|
924
|
+
if (shouldCache(innerBlock, props, true)) {
|
|
925
|
+
innerBlock.vnode.shapeFlag |= 256;
|
|
1593
926
|
}
|
|
1594
927
|
} else {
|
|
1595
928
|
if (cache.has(innerBlock.type)) {
|
|
1596
929
|
innerBlock.shapeFlag |= 512;
|
|
1597
930
|
}
|
|
1598
|
-
if (shouldCache(innerBlock)) {
|
|
931
|
+
if (shouldCache(innerBlock, props)) {
|
|
1599
932
|
innerBlock.shapeFlag |= 256;
|
|
1600
933
|
}
|
|
1601
934
|
}
|
|
1602
935
|
};
|
|
1603
|
-
|
|
1604
|
-
const innerBlock = getInnerBlock(fragment.nodes);
|
|
1605
|
-
if (!innerBlock || !shouldCache(innerBlock)) return;
|
|
1606
|
-
let toCache;
|
|
936
|
+
const cacheFragment = (fragment) => {
|
|
937
|
+
const [innerBlock, interop] = getInnerBlock(fragment.nodes);
|
|
938
|
+
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
1607
939
|
let key;
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
toCache = frag;
|
|
1612
|
-
key = frag.vnode.type;
|
|
940
|
+
if (interop) {
|
|
941
|
+
innerBlock.vnode.shapeFlag |= 256;
|
|
942
|
+
key = innerBlock.vnode.type;
|
|
1613
943
|
} else {
|
|
1614
944
|
innerBlock.shapeFlag |= 256;
|
|
1615
|
-
toCache = innerBlock;
|
|
1616
945
|
key = innerBlock.type;
|
|
1617
946
|
}
|
|
1618
|
-
innerCacheBlock(key,
|
|
1619
|
-
};
|
|
1620
|
-
keepAliveInstance.activate = (instance, parentNode, anchor) => {
|
|
1621
|
-
current = instance;
|
|
1622
|
-
activate(instance, parentNode, anchor);
|
|
1623
|
-
};
|
|
1624
|
-
keepAliveInstance.deactivate = (instance) => {
|
|
1625
|
-
current = void 0;
|
|
1626
|
-
deactivate(instance, storageContainer);
|
|
947
|
+
innerCacheBlock(key, innerBlock);
|
|
1627
948
|
};
|
|
1628
|
-
|
|
1629
|
-
if (isVaporComponent(cached)) {
|
|
1630
|
-
resetShapeFlag(cached);
|
|
1631
|
-
} else {
|
|
1632
|
-
resetShapeFlag(cached.vnode);
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
let children = slots.default();
|
|
1636
|
-
if (isArray(children) && children.length > 1) {
|
|
1637
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1638
|
-
warn(`KeepAlive should contain exactly one component child.`);
|
|
1639
|
-
}
|
|
1640
|
-
return children;
|
|
1641
|
-
}
|
|
1642
|
-
if (isVaporComponent(children)) {
|
|
1643
|
-
children.shapeFlag |= 256;
|
|
1644
|
-
} else if (isInteropFragment(children)) {
|
|
1645
|
-
children.vnode.shapeFlag |= 256;
|
|
1646
|
-
}
|
|
1647
|
-
function pruneCache(filter) {
|
|
949
|
+
const pruneCache = (filter) => {
|
|
1648
950
|
cache.forEach((cached, key) => {
|
|
1649
951
|
const instance = getInstanceFromCache(cached);
|
|
1650
952
|
if (!instance) return;
|
|
@@ -1653,8 +955,8 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1653
955
|
pruneCacheEntry(key);
|
|
1654
956
|
}
|
|
1655
957
|
});
|
|
1656
|
-
}
|
|
1657
|
-
|
|
958
|
+
};
|
|
959
|
+
const pruneCacheEntry = (key) => {
|
|
1658
960
|
const cached = cache.get(key);
|
|
1659
961
|
resetCachedShapeFlag(cached);
|
|
1660
962
|
if (cached !== current) {
|
|
@@ -1662,7 +964,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1662
964
|
}
|
|
1663
965
|
cache.delete(key);
|
|
1664
966
|
keys.delete(key);
|
|
1665
|
-
}
|
|
967
|
+
};
|
|
1666
968
|
watch(
|
|
1667
969
|
() => [props.include, props.exclude],
|
|
1668
970
|
([include, exclude]) => {
|
|
@@ -1672,29 +974,103 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1672
974
|
// prune post-render after `current` has been updated
|
|
1673
975
|
{ flush: "post", deep: true }
|
|
1674
976
|
);
|
|
977
|
+
onMounted(cacheBlock);
|
|
978
|
+
onUpdated(cacheBlock);
|
|
979
|
+
onBeforeUnmount(() => {
|
|
980
|
+
cache.forEach((cached, key) => {
|
|
981
|
+
const instance = getInstanceFromCache(cached);
|
|
982
|
+
if (!instance) return;
|
|
983
|
+
resetCachedShapeFlag(cached);
|
|
984
|
+
cache.delete(key);
|
|
985
|
+
if (current) {
|
|
986
|
+
const currentKey = isVaporComponent(current) ? current.type : current.vnode.type;
|
|
987
|
+
if (currentKey === key) {
|
|
988
|
+
const da = instance.da;
|
|
989
|
+
da && queuePostFlushCb(da);
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
remove(cached, storageContainer);
|
|
994
|
+
});
|
|
995
|
+
keptAliveScopes.forEach((scope) => scope.stop());
|
|
996
|
+
keptAliveScopes.clear();
|
|
997
|
+
});
|
|
998
|
+
let children = slots.default();
|
|
999
|
+
if (isArray(children)) {
|
|
1000
|
+
children = children.filter((child) => !(child instanceof Comment));
|
|
1001
|
+
if (children.length > 1) {
|
|
1002
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1003
|
+
warn(`KeepAlive should contain exactly one component child.`);
|
|
1004
|
+
}
|
|
1005
|
+
return children;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
const injectKeepAliveHooks = (frag) => {
|
|
1009
|
+
(frag.beforeTeardown || (frag.beforeTeardown = [])).push(
|
|
1010
|
+
(oldKey, nodes, scope) => {
|
|
1011
|
+
processFragment(frag);
|
|
1012
|
+
keptAliveScopes.set(oldKey, scope);
|
|
1013
|
+
return true;
|
|
1014
|
+
}
|
|
1015
|
+
);
|
|
1016
|
+
(frag.beforeMount || (frag.beforeMount = [])).push(
|
|
1017
|
+
() => cacheFragment(frag)
|
|
1018
|
+
);
|
|
1019
|
+
frag.getScope = (key) => {
|
|
1020
|
+
const scope = keptAliveScopes.get(key);
|
|
1021
|
+
if (scope) {
|
|
1022
|
+
keptAliveScopes.delete(key);
|
|
1023
|
+
return scope;
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
};
|
|
1027
|
+
if (isVaporComponent(children)) {
|
|
1028
|
+
children.shapeFlag |= 256;
|
|
1029
|
+
if (isAsyncWrapper(children)) {
|
|
1030
|
+
injectKeepAliveHooks(children.block);
|
|
1031
|
+
}
|
|
1032
|
+
} else if (isInteropFragment(children)) {
|
|
1033
|
+
children.vnode.shapeFlag |= 256;
|
|
1034
|
+
} else if (isDynamicFragment(children)) {
|
|
1035
|
+
processFragment(children);
|
|
1036
|
+
injectKeepAliveHooks(children);
|
|
1037
|
+
if (isVaporComponent(children.nodes) && isAsyncWrapper(children.nodes)) {
|
|
1038
|
+
injectKeepAliveHooks(children.nodes.block);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1675
1041
|
return children;
|
|
1676
1042
|
}
|
|
1677
1043
|
});
|
|
1044
|
+
const shouldCache = (block, props, interop = false) => {
|
|
1045
|
+
const isAsync = !interop && isAsyncWrapper(block);
|
|
1046
|
+
const type = interop ? block.vnode.type : block.type;
|
|
1047
|
+
if (isAsync && !type.__asyncResolved) {
|
|
1048
|
+
return true;
|
|
1049
|
+
}
|
|
1050
|
+
const { include, exclude } = props;
|
|
1051
|
+
const name = getComponentName(isAsync ? type.__asyncResolved : type);
|
|
1052
|
+
return !(include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name));
|
|
1053
|
+
};
|
|
1054
|
+
const resetCachedShapeFlag = (cached) => {
|
|
1055
|
+
if (isVaporComponent(cached)) {
|
|
1056
|
+
resetShapeFlag(cached);
|
|
1057
|
+
} else {
|
|
1058
|
+
resetShapeFlag(cached.vnode);
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1678
1061
|
function getInnerBlock(block) {
|
|
1679
1062
|
if (isVaporComponent(block)) {
|
|
1680
|
-
return block;
|
|
1063
|
+
return [block, false];
|
|
1681
1064
|
} else if (isInteropFragment(block)) {
|
|
1682
|
-
return block
|
|
1065
|
+
return [block, true];
|
|
1683
1066
|
} else if (isFragment(block)) {
|
|
1684
1067
|
return getInnerBlock(block.nodes);
|
|
1685
1068
|
}
|
|
1069
|
+
return [void 0, false];
|
|
1686
1070
|
}
|
|
1687
1071
|
function isInteropFragment(block) {
|
|
1688
1072
|
return !!(isFragment(block) && block.vnode);
|
|
1689
1073
|
}
|
|
1690
|
-
function findInteropFragment(block) {
|
|
1691
|
-
if (isInteropFragment(block)) {
|
|
1692
|
-
return block;
|
|
1693
|
-
}
|
|
1694
|
-
if (isFragment(block)) {
|
|
1695
|
-
return findInteropFragment(block.nodes);
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
1074
|
function getInstanceFromCache(cached) {
|
|
1699
1075
|
if (isVaporComponent(cached)) {
|
|
1700
1076
|
return cached;
|
|
@@ -1732,9 +1108,18 @@ function findParentKeepAlive(instance) {
|
|
|
1732
1108
|
return null;
|
|
1733
1109
|
}
|
|
1734
1110
|
|
|
1111
|
+
let parentSuspense = null;
|
|
1112
|
+
function setParentSuspense(suspense) {
|
|
1113
|
+
try {
|
|
1114
|
+
return parentSuspense;
|
|
1115
|
+
} finally {
|
|
1116
|
+
parentSuspense = suspense;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1735
1120
|
const interopKey = Symbol(`interop`);
|
|
1736
1121
|
const vaporInteropImpl = {
|
|
1737
|
-
mount(vnode, container, anchor, parentComponent) {
|
|
1122
|
+
mount(vnode, container, anchor, parentComponent, parentSuspense) {
|
|
1738
1123
|
let selfAnchor = vnode.el = vnode.anchor = createTextNode();
|
|
1739
1124
|
if (isHydrating) {
|
|
1740
1125
|
queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
@@ -1751,6 +1136,10 @@ const vaporInteropImpl = {
|
|
|
1751
1136
|
}
|
|
1752
1137
|
const propsRef = shallowRef(props);
|
|
1753
1138
|
const slotsRef = shallowRef(vnode.children);
|
|
1139
|
+
let prevSuspense = null;
|
|
1140
|
+
if (parentSuspense) {
|
|
1141
|
+
prevSuspense = setParentSuspense(parentSuspense);
|
|
1142
|
+
}
|
|
1754
1143
|
const dynamicPropSource = [
|
|
1755
1144
|
() => propsRef.value
|
|
1756
1145
|
];
|
|
@@ -1777,6 +1166,9 @@ const vaporInteropImpl = {
|
|
|
1777
1166
|
vnode.transition
|
|
1778
1167
|
);
|
|
1779
1168
|
}
|
|
1169
|
+
if (parentSuspense) {
|
|
1170
|
+
setParentSuspense(prevSuspense);
|
|
1171
|
+
}
|
|
1780
1172
|
mountComponent(instance, container, selfAnchor);
|
|
1781
1173
|
simpleSetCurrentInstance(prev);
|
|
1782
1174
|
return instance;
|
|
@@ -1792,8 +1184,11 @@ const vaporInteropImpl = {
|
|
|
1792
1184
|
},
|
|
1793
1185
|
unmount(vnode, doRemove) {
|
|
1794
1186
|
const container = doRemove ? vnode.anchor.parentNode : void 0;
|
|
1795
|
-
|
|
1796
|
-
|
|
1187
|
+
const instance = vnode.component;
|
|
1188
|
+
if (instance) {
|
|
1189
|
+
if (instance.block) {
|
|
1190
|
+
unmountComponent(instance, container);
|
|
1191
|
+
}
|
|
1797
1192
|
} else if (vnode.vb) {
|
|
1798
1193
|
remove(vnode.vb, container);
|
|
1799
1194
|
}
|
|
@@ -1825,10 +1220,10 @@ const vaporInteropImpl = {
|
|
|
1825
1220
|
insert(vnode.vb || vnode.component, container, anchor);
|
|
1826
1221
|
insert(vnode.anchor, container, anchor);
|
|
1827
1222
|
},
|
|
1828
|
-
hydrate(vnode, node, container, anchor, parentComponent) {
|
|
1223
|
+
hydrate(vnode, node, container, anchor, parentComponent, parentSuspense) {
|
|
1829
1224
|
hydrateNode(
|
|
1830
1225
|
node,
|
|
1831
|
-
() => this.mount(vnode, container, anchor, parentComponent)
|
|
1226
|
+
() => this.mount(vnode, container, anchor, parentComponent, parentSuspense)
|
|
1832
1227
|
);
|
|
1833
1228
|
return _next(node);
|
|
1834
1229
|
},
|
|
@@ -1896,8 +1291,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1896
1291
|
rawProps,
|
|
1897
1292
|
rawSlots,
|
|
1898
1293
|
parentComponent ? parentComponent.appContext : void 0,
|
|
1899
|
-
void 0
|
|
1900
|
-
parentComponent
|
|
1294
|
+
void 0
|
|
1901
1295
|
);
|
|
1902
1296
|
vnode.vi = (instance) => {
|
|
1903
1297
|
instance.props = shallowReactive(wrapper.props);
|
|
@@ -1932,7 +1326,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1932
1326
|
isMounted = true;
|
|
1933
1327
|
frag.nodes = vnode.el;
|
|
1934
1328
|
};
|
|
1935
|
-
vnode.scopeId =
|
|
1329
|
+
vnode.scopeId = getCurrentScopeId() || null;
|
|
1936
1330
|
vnode.slotScopeIds = currentSlotScopeIds;
|
|
1937
1331
|
frag.insert = (parentNode, anchor, transition) => {
|
|
1938
1332
|
if (isHydrating) return;
|
|
@@ -1976,6 +1370,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1976
1370
|
simpleSetCurrentInstance(prev);
|
|
1977
1371
|
}
|
|
1978
1372
|
frag.nodes = vnode.el;
|
|
1373
|
+
if (isMounted && frag.updated) frag.updated.forEach((m) => m());
|
|
1979
1374
|
};
|
|
1980
1375
|
frag.remove = unmount;
|
|
1981
1376
|
frag.setRef = (instance, ref, refFor, refKey) => {
|
|
@@ -2017,6 +1412,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
|
|
|
2017
1412
|
internals.um(oldVNode, parentComponent, null);
|
|
2018
1413
|
}
|
|
2019
1414
|
};
|
|
1415
|
+
if (isMounted && frag.updated) frag.updated.forEach((m) => m());
|
|
2020
1416
|
};
|
|
2021
1417
|
const render = (parentNode, anchor) => {
|
|
2022
1418
|
renderEffect(() => {
|
|
@@ -2342,129 +1738,819 @@ function hasAttrFromRawProps(rawProps, key) {
|
|
|
2342
1738
|
return true;
|
|
2343
1739
|
}
|
|
2344
1740
|
}
|
|
2345
|
-
}
|
|
2346
|
-
return hasOwn(rawProps, key);
|
|
2347
|
-
}
|
|
2348
|
-
function getKeysFromRawProps(rawProps) {
|
|
2349
|
-
const keys = [];
|
|
2350
|
-
for (const key in rawProps) {
|
|
2351
|
-
if (key !== "$") keys.push(key);
|
|
2352
|
-
}
|
|
2353
|
-
const dynamicSources = rawProps.$;
|
|
2354
|
-
if (dynamicSources) {
|
|
2355
|
-
let i = dynamicSources.length;
|
|
2356
|
-
let source;
|
|
2357
|
-
while (i--) {
|
|
2358
|
-
source = resolveSource(dynamicSources[i]);
|
|
2359
|
-
for (const key in source) {
|
|
2360
|
-
keys.push(key);
|
|
1741
|
+
}
|
|
1742
|
+
return hasOwn(rawProps, key);
|
|
1743
|
+
}
|
|
1744
|
+
function getKeysFromRawProps(rawProps) {
|
|
1745
|
+
const keys = [];
|
|
1746
|
+
for (const key in rawProps) {
|
|
1747
|
+
if (key !== "$") keys.push(key);
|
|
1748
|
+
}
|
|
1749
|
+
const dynamicSources = rawProps.$;
|
|
1750
|
+
if (dynamicSources) {
|
|
1751
|
+
let i = dynamicSources.length;
|
|
1752
|
+
let source;
|
|
1753
|
+
while (i--) {
|
|
1754
|
+
source = resolveSource(dynamicSources[i]);
|
|
1755
|
+
for (const key in source) {
|
|
1756
|
+
keys.push(key);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
return Array.from(new Set(keys));
|
|
1761
|
+
}
|
|
1762
|
+
function normalizePropsOptions(comp) {
|
|
1763
|
+
const cached = comp.__propsOptions;
|
|
1764
|
+
if (cached) return cached;
|
|
1765
|
+
const raw = comp.props;
|
|
1766
|
+
if (!raw) return EMPTY_ARR;
|
|
1767
|
+
const normalized = {};
|
|
1768
|
+
const needCastKeys = [];
|
|
1769
|
+
baseNormalizePropsOptions(raw, normalized, needCastKeys);
|
|
1770
|
+
return comp.__propsOptions = [normalized, needCastKeys];
|
|
1771
|
+
}
|
|
1772
|
+
function resolveDefault(factory, instance) {
|
|
1773
|
+
const prev = setCurrentInstance(instance);
|
|
1774
|
+
const res = factory.call(null, instance.props);
|
|
1775
|
+
setCurrentInstance(...prev);
|
|
1776
|
+
return res;
|
|
1777
|
+
}
|
|
1778
|
+
function hasFallthroughAttrs(comp, rawProps) {
|
|
1779
|
+
if (rawProps) {
|
|
1780
|
+
if (rawProps.$ || !comp.props) {
|
|
1781
|
+
return true;
|
|
1782
|
+
} else {
|
|
1783
|
+
const propsOptions = normalizePropsOptions(comp)[0];
|
|
1784
|
+
for (const key in rawProps) {
|
|
1785
|
+
if (!hasOwn(propsOptions, camelize(key))) {
|
|
1786
|
+
return true;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
return false;
|
|
1792
|
+
}
|
|
1793
|
+
function setupPropsValidation(instance) {
|
|
1794
|
+
const rawProps = instance.rawProps;
|
|
1795
|
+
if (!rawProps) return;
|
|
1796
|
+
renderEffect(
|
|
1797
|
+
() => {
|
|
1798
|
+
pushWarningContext(instance);
|
|
1799
|
+
validateProps(
|
|
1800
|
+
resolveDynamicProps(rawProps),
|
|
1801
|
+
instance.props,
|
|
1802
|
+
normalizePropsOptions(instance.type)[0]
|
|
1803
|
+
);
|
|
1804
|
+
popWarningContext();
|
|
1805
|
+
},
|
|
1806
|
+
true
|
|
1807
|
+
/* noLifecycle */
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
function resolveDynamicProps(props) {
|
|
1811
|
+
const mergedRawProps = {};
|
|
1812
|
+
for (const key in props) {
|
|
1813
|
+
if (key !== "$") {
|
|
1814
|
+
mergedRawProps[key] = resolveSource(props[key]);
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
if (props.$) {
|
|
1818
|
+
for (const source of props.$) {
|
|
1819
|
+
const isDynamic = isFunction(source);
|
|
1820
|
+
const resolved = isDynamic ? source() : source;
|
|
1821
|
+
for (const key in resolved) {
|
|
1822
|
+
const value = isDynamic ? resolved[key] : resolved[key]();
|
|
1823
|
+
if (key === "class" || key === "style") {
|
|
1824
|
+
const existing = mergedRawProps[key];
|
|
1825
|
+
if (isArray(existing)) {
|
|
1826
|
+
existing.push(value);
|
|
1827
|
+
} else {
|
|
1828
|
+
mergedRawProps[key] = [existing, value];
|
|
1829
|
+
}
|
|
1830
|
+
} else {
|
|
1831
|
+
mergedRawProps[key] = value;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
return mergedRawProps;
|
|
1837
|
+
}
|
|
1838
|
+
function propsSetDevTrap(_, key) {
|
|
1839
|
+
warn(
|
|
1840
|
+
`Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
1841
|
+
);
|
|
1842
|
+
return true;
|
|
1843
|
+
}
|
|
1844
|
+
function propsDeleteDevTrap(_, key) {
|
|
1845
|
+
warn(
|
|
1846
|
+
`Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
|
|
1847
|
+
);
|
|
1848
|
+
return true;
|
|
1849
|
+
}
|
|
1850
|
+
const rawPropsProxyHandlers = {
|
|
1851
|
+
get: getAttrFromRawProps,
|
|
1852
|
+
has: hasAttrFromRawProps,
|
|
1853
|
+
ownKeys: getKeysFromRawProps,
|
|
1854
|
+
getOwnPropertyDescriptor(target, key) {
|
|
1855
|
+
if (hasAttrFromRawProps(target, key)) {
|
|
1856
|
+
return {
|
|
1857
|
+
configurable: true,
|
|
1858
|
+
enumerable: true,
|
|
1859
|
+
get: () => getAttrFromRawProps(target, key)
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1865
|
+
let inOnceSlot = false;
|
|
1866
|
+
let currentSlotScopeIds = null;
|
|
1867
|
+
function setCurrentSlotScopeIds(scopeIds) {
|
|
1868
|
+
try {
|
|
1869
|
+
return currentSlotScopeIds;
|
|
1870
|
+
} finally {
|
|
1871
|
+
currentSlotScopeIds = scopeIds;
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
const dynamicSlotsProxyHandlers = {
|
|
1875
|
+
get: getSlot,
|
|
1876
|
+
has: (target, key) => !!getSlot(target, key),
|
|
1877
|
+
getOwnPropertyDescriptor(target, key) {
|
|
1878
|
+
const slot = getSlot(target, key);
|
|
1879
|
+
if (slot) {
|
|
1880
|
+
return {
|
|
1881
|
+
configurable: true,
|
|
1882
|
+
enumerable: true,
|
|
1883
|
+
value: slot
|
|
1884
|
+
};
|
|
1885
|
+
}
|
|
1886
|
+
},
|
|
1887
|
+
ownKeys(target) {
|
|
1888
|
+
let keys = Object.keys(target);
|
|
1889
|
+
const dynamicSources = target.$;
|
|
1890
|
+
if (dynamicSources) {
|
|
1891
|
+
keys = keys.filter((k) => k !== "$");
|
|
1892
|
+
for (const source of dynamicSources) {
|
|
1893
|
+
if (isFunction(source)) {
|
|
1894
|
+
const slot = source();
|
|
1895
|
+
if (isArray(slot)) {
|
|
1896
|
+
for (const s of slot) keys.push(String(s.name));
|
|
1897
|
+
} else {
|
|
1898
|
+
keys.push(String(slot.name));
|
|
1899
|
+
}
|
|
1900
|
+
} else {
|
|
1901
|
+
keys.push(...Object.keys(source));
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
return keys;
|
|
1906
|
+
},
|
|
1907
|
+
set: NO,
|
|
1908
|
+
deleteProperty: NO
|
|
1909
|
+
};
|
|
1910
|
+
function getSlot(target, key) {
|
|
1911
|
+
if (key === "$") return;
|
|
1912
|
+
const dynamicSources = target.$;
|
|
1913
|
+
if (dynamicSources) {
|
|
1914
|
+
let i = dynamicSources.length;
|
|
1915
|
+
let source;
|
|
1916
|
+
while (i--) {
|
|
1917
|
+
source = dynamicSources[i];
|
|
1918
|
+
if (isFunction(source)) {
|
|
1919
|
+
const slot = source();
|
|
1920
|
+
if (slot) {
|
|
1921
|
+
if (isArray(slot)) {
|
|
1922
|
+
for (const s of slot) {
|
|
1923
|
+
if (String(s.name) === key) return s.fn;
|
|
1924
|
+
}
|
|
1925
|
+
} else if (String(slot.name) === key) {
|
|
1926
|
+
return slot.fn;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
} else if (hasOwn(source, key)) {
|
|
1930
|
+
return source[key];
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
if (hasOwn(target, key)) {
|
|
1935
|
+
return target[key];
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
let currentSlotOwner = null;
|
|
1939
|
+
function setCurrentSlotOwner(owner) {
|
|
1940
|
+
try {
|
|
1941
|
+
return currentSlotOwner;
|
|
1942
|
+
} finally {
|
|
1943
|
+
currentSlotOwner = owner;
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
function getScopeOwner() {
|
|
1947
|
+
return currentSlotOwner || currentInstance;
|
|
1948
|
+
}
|
|
1949
|
+
function withVaporCtx(fn) {
|
|
1950
|
+
const owner = currentInstance;
|
|
1951
|
+
return (...args) => {
|
|
1952
|
+
const prevOwner = setCurrentSlotOwner(owner);
|
|
1953
|
+
try {
|
|
1954
|
+
return fn(...args);
|
|
1955
|
+
} finally {
|
|
1956
|
+
setCurrentSlotOwner(prevOwner);
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
}
|
|
1960
|
+
function createSlot(name, rawProps, fallback, noSlotted, once) {
|
|
1961
|
+
const _insertionParent = insertionParent;
|
|
1962
|
+
const _insertionAnchor = insertionAnchor;
|
|
1963
|
+
const _isLastInsertion = isLastInsertion;
|
|
1964
|
+
if (!isHydrating) resetInsertionState();
|
|
1965
|
+
const instance = getScopeOwner();
|
|
1966
|
+
const rawSlots = instance.rawSlots;
|
|
1967
|
+
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
1968
|
+
let fragment;
|
|
1969
|
+
if (isRef(rawSlots._)) {
|
|
1970
|
+
if (isHydrating) locateHydrationNode();
|
|
1971
|
+
fragment = instance.appContext.vapor.vdomSlot(
|
|
1972
|
+
rawSlots._,
|
|
1973
|
+
name,
|
|
1974
|
+
slotProps,
|
|
1975
|
+
instance,
|
|
1976
|
+
fallback
|
|
1977
|
+
);
|
|
1978
|
+
} else {
|
|
1979
|
+
fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
|
|
1980
|
+
const isDynamicName = isFunction(name);
|
|
1981
|
+
const slotScopeIds = [];
|
|
1982
|
+
if (!noSlotted) {
|
|
1983
|
+
const scopeId = instance.type.__scopeId;
|
|
1984
|
+
if (scopeId) {
|
|
1985
|
+
slotScopeIds.push(`${scopeId}-s`);
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
const renderSlot = () => {
|
|
1989
|
+
const slotName = isFunction(name) ? name() : name;
|
|
1990
|
+
if (instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce) {
|
|
1991
|
+
const el = createElement("slot");
|
|
1992
|
+
renderEffect(() => {
|
|
1993
|
+
setDynamicProps(el, [
|
|
1994
|
+
slotProps,
|
|
1995
|
+
slotName !== "default" ? { name: slotName } : {}
|
|
1996
|
+
]);
|
|
1997
|
+
});
|
|
1998
|
+
if (fallback) insert(fallback(), el);
|
|
1999
|
+
fragment.nodes = el;
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
const slot = getSlot(rawSlots, slotName);
|
|
2003
|
+
if (slot) {
|
|
2004
|
+
fragment.fallback = fallback;
|
|
2005
|
+
fragment.update(
|
|
2006
|
+
slot._bound || (slot._bound = () => {
|
|
2007
|
+
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
2008
|
+
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
2009
|
+
);
|
|
2010
|
+
const prev = inOnceSlot;
|
|
2011
|
+
try {
|
|
2012
|
+
if (once) inOnceSlot = true;
|
|
2013
|
+
return slot(slotProps);
|
|
2014
|
+
} finally {
|
|
2015
|
+
inOnceSlot = prev;
|
|
2016
|
+
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
2017
|
+
}
|
|
2018
|
+
})
|
|
2019
|
+
);
|
|
2020
|
+
} else {
|
|
2021
|
+
fragment.update(fallback);
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
if (!once && (isDynamicName || rawSlots.$)) {
|
|
2025
|
+
renderEffect(renderSlot);
|
|
2026
|
+
} else {
|
|
2027
|
+
renderSlot();
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
if (!isHydrating) {
|
|
2031
|
+
if (!noSlotted) {
|
|
2032
|
+
const scopeId = instance.type.__scopeId;
|
|
2033
|
+
if (scopeId) {
|
|
2034
|
+
setScopeId(fragment, [`${scopeId}-s`]);
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
2038
|
+
} else {
|
|
2039
|
+
if (fragment.insert) {
|
|
2040
|
+
fragment.hydrate();
|
|
2041
|
+
}
|
|
2042
|
+
if (_isLastInsertion) {
|
|
2043
|
+
advanceHydrationNode(_insertionParent);
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
return fragment;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
class RenderEffect extends ReactiveEffect {
|
|
2050
|
+
constructor(render) {
|
|
2051
|
+
super();
|
|
2052
|
+
this.render = render;
|
|
2053
|
+
const instance = currentInstance;
|
|
2054
|
+
if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
|
|
2055
|
+
warn("renderEffect called without active EffectScope or Vapor instance.");
|
|
2056
|
+
}
|
|
2057
|
+
const job = () => {
|
|
2058
|
+
if (this.dirty) {
|
|
2059
|
+
this.run();
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
this.updateJob = () => {
|
|
2063
|
+
instance.isUpdating = false;
|
|
2064
|
+
instance.u && invokeArrayFns(instance.u);
|
|
2065
|
+
};
|
|
2066
|
+
if (instance) {
|
|
2067
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2068
|
+
this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
2069
|
+
this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
2070
|
+
}
|
|
2071
|
+
if (!!(process.env.NODE_ENV !== "production") || instance.type.ce) {
|
|
2072
|
+
(instance.renderEffects || (instance.renderEffects = [])).push(this);
|
|
2073
|
+
}
|
|
2074
|
+
job.i = instance;
|
|
2075
|
+
}
|
|
2076
|
+
this.job = job;
|
|
2077
|
+
this.i = instance;
|
|
2078
|
+
}
|
|
2079
|
+
fn() {
|
|
2080
|
+
const instance = this.i;
|
|
2081
|
+
const scope = this.subs ? this.subs.sub : void 0;
|
|
2082
|
+
const hasUpdateHooks = instance && (instance.bu || instance.u);
|
|
2083
|
+
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
2084
|
+
startMeasure(instance, `renderEffect`);
|
|
2085
|
+
}
|
|
2086
|
+
const prev = setCurrentInstance(instance, scope);
|
|
2087
|
+
if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
|
|
2088
|
+
instance.isUpdating = true;
|
|
2089
|
+
instance.bu && invokeArrayFns(instance.bu);
|
|
2090
|
+
this.render();
|
|
2091
|
+
queuePostFlushCb(this.updateJob);
|
|
2092
|
+
} else {
|
|
2093
|
+
this.render();
|
|
2094
|
+
}
|
|
2095
|
+
setCurrentInstance(...prev);
|
|
2096
|
+
if (!!(process.env.NODE_ENV !== "production") && instance) {
|
|
2097
|
+
startMeasure(instance, `renderEffect`);
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
notify() {
|
|
2101
|
+
const flags = this.flags;
|
|
2102
|
+
if (!(flags & 256)) {
|
|
2103
|
+
queueJob(this.job, this.i ? this.i.uid : void 0);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
function renderEffect(fn, noLifecycle = false) {
|
|
2108
|
+
if (inOnceSlot) return fn();
|
|
2109
|
+
const effect = new RenderEffect(fn);
|
|
2110
|
+
if (noLifecycle) {
|
|
2111
|
+
effect.fn = fn;
|
|
2112
|
+
}
|
|
2113
|
+
effect.run();
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
const displayName = "VaporTransition";
|
|
2117
|
+
const decorate$1 = (t) => {
|
|
2118
|
+
t.displayName = displayName;
|
|
2119
|
+
t.props = TransitionPropsValidators;
|
|
2120
|
+
t.__vapor = true;
|
|
2121
|
+
return t;
|
|
2122
|
+
};
|
|
2123
|
+
const VaporTransition = /* @__PURE__ */ decorate$1(
|
|
2124
|
+
(props, { slots }) => {
|
|
2125
|
+
let resetDisplay;
|
|
2126
|
+
if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
|
|
2127
|
+
const {
|
|
2128
|
+
content: { firstChild },
|
|
2129
|
+
parentNode
|
|
2130
|
+
} = currentHydrationNode;
|
|
2131
|
+
if (firstChild) {
|
|
2132
|
+
if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
|
|
2133
|
+
const originalDisplay = firstChild.style.display;
|
|
2134
|
+
firstChild.style.display = "none";
|
|
2135
|
+
resetDisplay = () => firstChild.style.display = originalDisplay;
|
|
2136
|
+
}
|
|
2137
|
+
parentNode.replaceChild(firstChild, currentHydrationNode);
|
|
2138
|
+
setCurrentHydrationNode(firstChild);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
const children = slots.default && slots.default();
|
|
2142
|
+
if (!children) return;
|
|
2143
|
+
const instance = currentInstance;
|
|
2144
|
+
const { mode } = props;
|
|
2145
|
+
checkTransitionMode(mode);
|
|
2146
|
+
let resolvedProps;
|
|
2147
|
+
let isMounted = false;
|
|
2148
|
+
renderEffect(() => {
|
|
2149
|
+
resolvedProps = resolveTransitionProps(props);
|
|
2150
|
+
if (isMounted) {
|
|
2151
|
+
if (isFragment(children)) {
|
|
2152
|
+
children.$transition.props = resolvedProps;
|
|
2153
|
+
} else {
|
|
2154
|
+
const child = findTransitionBlock(children);
|
|
2155
|
+
if (child) {
|
|
2156
|
+
child.$transition.props = resolvedProps;
|
|
2157
|
+
applyTransitionHooks(child, child.$transition, true);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
} else {
|
|
2161
|
+
isMounted = true;
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
const hooks = applyTransitionHooks(children, {
|
|
2165
|
+
state: useTransitionState(),
|
|
2166
|
+
props: resolvedProps,
|
|
2167
|
+
instance
|
|
2168
|
+
});
|
|
2169
|
+
if (resetDisplay && resolvedProps.appear) {
|
|
2170
|
+
const child = findTransitionBlock(children);
|
|
2171
|
+
hooks.beforeEnter(child);
|
|
2172
|
+
resetDisplay();
|
|
2173
|
+
queuePostFlushCb(() => hooks.enter(child));
|
|
2174
|
+
}
|
|
2175
|
+
return children;
|
|
2176
|
+
}
|
|
2177
|
+
);
|
|
2178
|
+
const getTransitionHooksContext = (key, props, state, instance, postClone) => {
|
|
2179
|
+
const { leavingNodes } = state;
|
|
2180
|
+
const context = {
|
|
2181
|
+
setLeavingNodeCache: (el) => {
|
|
2182
|
+
leavingNodes.set(key, el);
|
|
2183
|
+
},
|
|
2184
|
+
unsetLeavingNodeCache: (el) => {
|
|
2185
|
+
const leavingNode = leavingNodes.get(key);
|
|
2186
|
+
if (leavingNode === el) {
|
|
2187
|
+
leavingNodes.delete(key);
|
|
2188
|
+
}
|
|
2189
|
+
},
|
|
2190
|
+
earlyRemove: () => {
|
|
2191
|
+
const leavingNode = leavingNodes.get(key);
|
|
2192
|
+
if (leavingNode && leavingNode[leaveCbKey]) {
|
|
2193
|
+
leavingNode[leaveCbKey]();
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2196
|
+
cloneHooks: (block) => {
|
|
2197
|
+
const hooks = resolveTransitionHooks(
|
|
2198
|
+
block,
|
|
2199
|
+
props,
|
|
2200
|
+
state,
|
|
2201
|
+
instance,
|
|
2202
|
+
postClone
|
|
2203
|
+
);
|
|
2204
|
+
if (postClone) postClone(hooks);
|
|
2205
|
+
return hooks;
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
return context;
|
|
2209
|
+
};
|
|
2210
|
+
function resolveTransitionHooks(block, props, state, instance, postClone) {
|
|
2211
|
+
const context = getTransitionHooksContext(
|
|
2212
|
+
String(block.$key),
|
|
2213
|
+
props,
|
|
2214
|
+
state,
|
|
2215
|
+
instance,
|
|
2216
|
+
postClone
|
|
2217
|
+
);
|
|
2218
|
+
const hooks = baseResolveTransitionHooks(
|
|
2219
|
+
context,
|
|
2220
|
+
props,
|
|
2221
|
+
state,
|
|
2222
|
+
instance
|
|
2223
|
+
);
|
|
2224
|
+
hooks.state = state;
|
|
2225
|
+
hooks.props = props;
|
|
2226
|
+
hooks.instance = instance;
|
|
2227
|
+
return hooks;
|
|
2228
|
+
}
|
|
2229
|
+
function applyTransitionHooks(block, hooks, isResolved = false) {
|
|
2230
|
+
if (isArray(block)) {
|
|
2231
|
+
block = block.filter((b) => !(b instanceof Comment));
|
|
2232
|
+
if (block.length === 1) {
|
|
2233
|
+
block = block[0];
|
|
2234
|
+
} else if (block.length === 0) {
|
|
2235
|
+
return hooks;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
const isFrag = isFragment(block);
|
|
2239
|
+
const child = isResolved ? block : findTransitionBlock(block, isFrag);
|
|
2240
|
+
if (!child) {
|
|
2241
|
+
if (isFrag) setTransitionHooksOnFragment(block, hooks);
|
|
2242
|
+
return hooks;
|
|
2243
|
+
}
|
|
2244
|
+
const { props, instance, state, delayedLeave } = hooks;
|
|
2245
|
+
let resolvedHooks = resolveTransitionHooks(
|
|
2246
|
+
child,
|
|
2247
|
+
props,
|
|
2248
|
+
state,
|
|
2249
|
+
instance,
|
|
2250
|
+
(hooks2) => resolvedHooks = hooks2
|
|
2251
|
+
);
|
|
2252
|
+
resolvedHooks.delayedLeave = delayedLeave;
|
|
2253
|
+
child.$transition = resolvedHooks;
|
|
2254
|
+
if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
|
|
2255
|
+
return resolvedHooks;
|
|
2256
|
+
}
|
|
2257
|
+
function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
|
|
2258
|
+
const leavingBlock = findTransitionBlock(block);
|
|
2259
|
+
if (!leavingBlock) return void 0;
|
|
2260
|
+
const { props, state, instance } = enterHooks;
|
|
2261
|
+
const leavingHooks = resolveTransitionHooks(
|
|
2262
|
+
leavingBlock,
|
|
2263
|
+
props,
|
|
2264
|
+
state,
|
|
2265
|
+
instance
|
|
2266
|
+
);
|
|
2267
|
+
leavingBlock.$transition = leavingHooks;
|
|
2268
|
+
const { mode } = props;
|
|
2269
|
+
if (mode === "out-in") {
|
|
2270
|
+
state.isLeaving = true;
|
|
2271
|
+
leavingHooks.afterLeave = () => {
|
|
2272
|
+
state.isLeaving = false;
|
|
2273
|
+
afterLeaveCb();
|
|
2274
|
+
leavingBlock.$transition = void 0;
|
|
2275
|
+
delete leavingHooks.afterLeave;
|
|
2276
|
+
};
|
|
2277
|
+
} else if (mode === "in-out") {
|
|
2278
|
+
leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
|
|
2279
|
+
state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
|
|
2280
|
+
block2[leaveCbKey] = () => {
|
|
2281
|
+
earlyRemove();
|
|
2282
|
+
block2[leaveCbKey] = void 0;
|
|
2283
|
+
leavingBlock.$transition = void 0;
|
|
2284
|
+
delete enterHooks.delayedLeave;
|
|
2285
|
+
};
|
|
2286
|
+
enterHooks.delayedLeave = () => {
|
|
2287
|
+
delayedLeave();
|
|
2288
|
+
leavingBlock.$transition = void 0;
|
|
2289
|
+
delete enterHooks.delayedLeave;
|
|
2290
|
+
};
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
function findTransitionBlock(block, inFragment = false) {
|
|
2295
|
+
let child;
|
|
2296
|
+
if (block instanceof Node) {
|
|
2297
|
+
if (block instanceof Element) child = block;
|
|
2298
|
+
} else if (isVaporComponent(block)) {
|
|
2299
|
+
if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
|
|
2300
|
+
child = block;
|
|
2301
|
+
} else {
|
|
2302
|
+
if (getComponentName(block.type) === displayName) return void 0;
|
|
2303
|
+
child = findTransitionBlock(block.block, inFragment);
|
|
2304
|
+
if (child && child.$key === void 0) child.$key = block.uid;
|
|
2305
|
+
}
|
|
2306
|
+
} else if (isArray(block)) {
|
|
2307
|
+
let hasFound = false;
|
|
2308
|
+
for (const c of block) {
|
|
2309
|
+
if (c instanceof Comment) continue;
|
|
2310
|
+
if (isFragment(c)) inFragment = true;
|
|
2311
|
+
const item = findTransitionBlock(c, inFragment);
|
|
2312
|
+
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
2313
|
+
warn(
|
|
2314
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
2315
|
+
);
|
|
2316
|
+
break;
|
|
2317
|
+
}
|
|
2318
|
+
child = item;
|
|
2319
|
+
hasFound = true;
|
|
2320
|
+
if (!!!(process.env.NODE_ENV !== "production")) break;
|
|
2321
|
+
}
|
|
2322
|
+
} else if (isFragment(block)) {
|
|
2323
|
+
inFragment = true;
|
|
2324
|
+
if (block.insert) {
|
|
2325
|
+
child = block;
|
|
2326
|
+
} else {
|
|
2327
|
+
child = findTransitionBlock(block.nodes, true);
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
|
|
2331
|
+
warn("Transition component has no valid child element");
|
|
2332
|
+
}
|
|
2333
|
+
return child;
|
|
2334
|
+
}
|
|
2335
|
+
function setTransitionHooksOnFragment(block, hooks) {
|
|
2336
|
+
if (isFragment(block)) {
|
|
2337
|
+
block.$transition = hooks;
|
|
2338
|
+
if (block.nodes && isFragment(block.nodes)) {
|
|
2339
|
+
setTransitionHooksOnFragment(block.nodes, hooks);
|
|
2340
|
+
}
|
|
2341
|
+
} else if (isArray(block)) {
|
|
2342
|
+
for (let i = 0; i < block.length; i++) {
|
|
2343
|
+
setTransitionHooksOnFragment(block[i], hooks);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
function setTransitionHooks(block, hooks) {
|
|
2348
|
+
if (isVaporComponent(block)) {
|
|
2349
|
+
block = findTransitionBlock(block.block);
|
|
2350
|
+
if (!block) return;
|
|
2351
|
+
}
|
|
2352
|
+
block.$transition = hooks;
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
class VaporFragment {
|
|
2356
|
+
constructor(nodes) {
|
|
2357
|
+
this.vnode = null;
|
|
2358
|
+
this.nodes = nodes;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
class ForFragment extends VaporFragment {
|
|
2362
|
+
constructor(nodes) {
|
|
2363
|
+
super(nodes);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
class DynamicFragment extends VaporFragment {
|
|
2367
|
+
constructor(anchorLabel) {
|
|
2368
|
+
super([]);
|
|
2369
|
+
this.hydrate = (isEmpty = false) => {
|
|
2370
|
+
if (this.anchor) return;
|
|
2371
|
+
if (this.anchorLabel === "if") {
|
|
2372
|
+
if (isEmpty) {
|
|
2373
|
+
this.anchor = locateFragmentEndAnchor("");
|
|
2374
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
2375
|
+
throw new Error(
|
|
2376
|
+
"Failed to locate if anchor. this is likely a Vue internal bug."
|
|
2377
|
+
);
|
|
2378
|
+
} else {
|
|
2379
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2380
|
+
this.anchor.data = this.anchorLabel;
|
|
2381
|
+
}
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
} else if (this.anchorLabel === "slot") {
|
|
2386
|
+
if (isEmpty && isComment(currentHydrationNode, "")) {
|
|
2387
|
+
this.anchor = currentHydrationNode;
|
|
2388
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2389
|
+
this.anchor.data = this.anchorLabel;
|
|
2390
|
+
}
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
this.anchor = locateFragmentEndAnchor();
|
|
2394
|
+
if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
|
|
2395
|
+
throw new Error(
|
|
2396
|
+
"Failed to locate slot anchor. this is likely a Vue internal bug."
|
|
2397
|
+
);
|
|
2398
|
+
} else {
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
const { parentNode, nextNode } = findBlockNode(this.nodes);
|
|
2403
|
+
queuePostFlushCb(() => {
|
|
2404
|
+
parentNode.insertBefore(
|
|
2405
|
+
this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
|
|
2406
|
+
nextNode
|
|
2407
|
+
);
|
|
2408
|
+
});
|
|
2409
|
+
};
|
|
2410
|
+
if (isHydrating) {
|
|
2411
|
+
this.anchorLabel = anchorLabel;
|
|
2412
|
+
locateHydrationNode();
|
|
2413
|
+
} else {
|
|
2414
|
+
this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? createComment(anchorLabel) : createTextNode();
|
|
2415
|
+
if (!!(process.env.NODE_ENV !== "production")) this.anchorLabel = anchorLabel;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
update(render, key = render) {
|
|
2419
|
+
if (key === this.current) {
|
|
2420
|
+
if (isHydrating) this.hydrate(true);
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
this.current = key;
|
|
2424
|
+
const instance = currentInstance;
|
|
2425
|
+
const prevSub = setActiveSub();
|
|
2426
|
+
const parent = isHydrating ? null : this.anchor.parentNode;
|
|
2427
|
+
const transition = this.$transition;
|
|
2428
|
+
if (this.scope) {
|
|
2429
|
+
let preserveScope = false;
|
|
2430
|
+
if (this.beforeTeardown) {
|
|
2431
|
+
preserveScope = this.beforeTeardown.some(
|
|
2432
|
+
(hook) => hook(this.current, this.nodes, this.scope)
|
|
2433
|
+
);
|
|
2434
|
+
}
|
|
2435
|
+
if (!preserveScope) {
|
|
2436
|
+
this.scope.stop();
|
|
2437
|
+
}
|
|
2438
|
+
const mode = transition && transition.mode;
|
|
2439
|
+
if (mode) {
|
|
2440
|
+
applyTransitionLeaveHooks(
|
|
2441
|
+
this.nodes,
|
|
2442
|
+
transition,
|
|
2443
|
+
() => this.render(render, transition, parent, instance)
|
|
2444
|
+
);
|
|
2445
|
+
parent && remove(this.nodes, parent);
|
|
2446
|
+
if (mode === "out-in") {
|
|
2447
|
+
setActiveSub(prevSub);
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
} else {
|
|
2451
|
+
parent && remove(this.nodes, parent);
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
this.render(render, transition, parent, instance);
|
|
2455
|
+
if (this.fallback) {
|
|
2456
|
+
const hasNestedFragment = isFragment(this.nodes);
|
|
2457
|
+
if (hasNestedFragment) {
|
|
2458
|
+
setFragmentFallback(this.nodes, this.fallback);
|
|
2459
|
+
}
|
|
2460
|
+
const invalidFragment = findInvalidFragment(this);
|
|
2461
|
+
if (invalidFragment) {
|
|
2462
|
+
parent && remove(this.nodes, parent);
|
|
2463
|
+
const scope = this.scope || (this.scope = new EffectScope());
|
|
2464
|
+
scope.run(() => {
|
|
2465
|
+
if (hasNestedFragment) {
|
|
2466
|
+
renderFragmentFallback(invalidFragment);
|
|
2467
|
+
} else {
|
|
2468
|
+
this.nodes = this.fallback() || [];
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
parent && insert(this.nodes, parent, this.anchor);
|
|
2361
2472
|
}
|
|
2362
2473
|
}
|
|
2474
|
+
setActiveSub(prevSub);
|
|
2475
|
+
if (isHydrating) this.hydrate();
|
|
2363
2476
|
}
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2477
|
+
render(render, transition, parent, instance) {
|
|
2478
|
+
if (render) {
|
|
2479
|
+
const scope = this.getScope && this.getScope(this.current);
|
|
2480
|
+
if (scope) {
|
|
2481
|
+
this.scope = scope;
|
|
2482
|
+
} else {
|
|
2483
|
+
this.scope = new EffectScope();
|
|
2484
|
+
}
|
|
2485
|
+
let prev;
|
|
2486
|
+
if (parent && instance) prev = setCurrentInstance(instance);
|
|
2487
|
+
this.nodes = this.scope.run(render) || [];
|
|
2488
|
+
if (parent && instance) setCurrentInstance(...prev);
|
|
2489
|
+
if (transition) {
|
|
2490
|
+
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
2491
|
+
}
|
|
2492
|
+
if (this.beforeMount) {
|
|
2493
|
+
this.beforeMount.forEach(
|
|
2494
|
+
(hook) => hook(this.current, this.nodes, this.scope)
|
|
2495
|
+
);
|
|
2496
|
+
}
|
|
2497
|
+
if (parent) {
|
|
2498
|
+
if (this.attrs) {
|
|
2499
|
+
if (this.nodes instanceof Element) {
|
|
2500
|
+
renderEffect(
|
|
2501
|
+
() => applyFallthroughProps(this.nodes, this.attrs)
|
|
2502
|
+
);
|
|
2503
|
+
} else if (!!(process.env.NODE_ENV !== "production") && // preventing attrs fallthrough on slots
|
|
2504
|
+
// consistent with VDOM slots behavior
|
|
2505
|
+
(this.anchorLabel === "slot" || isArray(this.nodes) && this.nodes.length)) {
|
|
2506
|
+
warnExtraneousAttributes(this.attrs);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
insert(this.nodes, parent, this.anchor);
|
|
2510
|
+
if (this.updated) {
|
|
2511
|
+
this.updated.forEach((hook) => hook(this.nodes));
|
|
2391
2512
|
}
|
|
2392
2513
|
}
|
|
2514
|
+
} else {
|
|
2515
|
+
this.scope = void 0;
|
|
2516
|
+
this.nodes = [];
|
|
2393
2517
|
}
|
|
2394
2518
|
}
|
|
2395
|
-
return false;
|
|
2396
|
-
}
|
|
2397
|
-
function setupPropsValidation(instance) {
|
|
2398
|
-
const rawProps = instance.rawProps;
|
|
2399
|
-
if (!rawProps) return;
|
|
2400
|
-
renderEffect(
|
|
2401
|
-
() => {
|
|
2402
|
-
pushWarningContext(instance);
|
|
2403
|
-
validateProps(
|
|
2404
|
-
resolveDynamicProps(rawProps),
|
|
2405
|
-
instance.props,
|
|
2406
|
-
normalizePropsOptions(instance.type)[0]
|
|
2407
|
-
);
|
|
2408
|
-
popWarningContext();
|
|
2409
|
-
},
|
|
2410
|
-
true
|
|
2411
|
-
/* noLifecycle */
|
|
2412
|
-
);
|
|
2413
2519
|
}
|
|
2414
|
-
function
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
if (props.$) {
|
|
2422
|
-
for (const source of props.$) {
|
|
2423
|
-
const isDynamic = isFunction(source);
|
|
2424
|
-
const resolved = isDynamic ? source() : source;
|
|
2425
|
-
for (const key in resolved) {
|
|
2426
|
-
const value = isDynamic ? resolved[key] : resolved[key]();
|
|
2427
|
-
if (key === "class" || key === "style") {
|
|
2428
|
-
const existing = mergedRawProps[key];
|
|
2429
|
-
if (isArray(existing)) {
|
|
2430
|
-
existing.push(value);
|
|
2431
|
-
} else {
|
|
2432
|
-
mergedRawProps[key] = [existing, value];
|
|
2433
|
-
}
|
|
2434
|
-
} else {
|
|
2435
|
-
mergedRawProps[key] = value;
|
|
2436
|
-
}
|
|
2520
|
+
function setFragmentFallback(fragment, fallback) {
|
|
2521
|
+
if (fragment.fallback) {
|
|
2522
|
+
const originalFallback = fragment.fallback;
|
|
2523
|
+
fragment.fallback = () => {
|
|
2524
|
+
const fallbackNodes = originalFallback();
|
|
2525
|
+
if (isValidBlock(fallbackNodes)) {
|
|
2526
|
+
return fallbackNodes;
|
|
2437
2527
|
}
|
|
2438
|
-
|
|
2528
|
+
return fallback();
|
|
2529
|
+
};
|
|
2530
|
+
} else {
|
|
2531
|
+
fragment.fallback = fallback;
|
|
2532
|
+
}
|
|
2533
|
+
if (isFragment(fragment.nodes)) {
|
|
2534
|
+
setFragmentFallback(fragment.nodes, fragment.fallback);
|
|
2439
2535
|
}
|
|
2440
|
-
return mergedRawProps;
|
|
2441
2536
|
}
|
|
2442
|
-
function
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
)
|
|
2446
|
-
|
|
2537
|
+
function renderFragmentFallback(fragment) {
|
|
2538
|
+
if (fragment instanceof ForFragment) {
|
|
2539
|
+
fragment.nodes[0] = [fragment.fallback() || []];
|
|
2540
|
+
} else if (fragment instanceof DynamicFragment) {
|
|
2541
|
+
fragment.update(fragment.fallback);
|
|
2542
|
+
} else ;
|
|
2447
2543
|
}
|
|
2448
|
-
function
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2544
|
+
function findInvalidFragment(fragment) {
|
|
2545
|
+
if (isValidBlock(fragment.nodes)) return null;
|
|
2546
|
+
return isFragment(fragment.nodes) ? findInvalidFragment(fragment.nodes) || fragment : fragment;
|
|
2547
|
+
}
|
|
2548
|
+
function isFragment(val) {
|
|
2549
|
+
return val instanceof VaporFragment;
|
|
2550
|
+
}
|
|
2551
|
+
function isDynamicFragment(val) {
|
|
2552
|
+
return val instanceof DynamicFragment;
|
|
2453
2553
|
}
|
|
2454
|
-
const rawPropsProxyHandlers = {
|
|
2455
|
-
get: getAttrFromRawProps,
|
|
2456
|
-
has: hasAttrFromRawProps,
|
|
2457
|
-
ownKeys: getKeysFromRawProps,
|
|
2458
|
-
getOwnPropertyDescriptor(target, key) {
|
|
2459
|
-
if (hasAttrFromRawProps(target, key)) {
|
|
2460
|
-
return {
|
|
2461
|
-
configurable: true,
|
|
2462
|
-
enumerable: true,
|
|
2463
|
-
get: () => getAttrFromRawProps(target, key)
|
|
2464
|
-
};
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
};
|
|
2468
2554
|
|
|
2469
2555
|
const VaporTeleportImpl = {
|
|
2470
2556
|
name: "VaporTeleport",
|
|
@@ -2537,7 +2623,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2537
2623
|
setCurrentHydrationNode(targetNode.nextSibling);
|
|
2538
2624
|
}
|
|
2539
2625
|
if (!this.targetAnchor) {
|
|
2540
|
-
this.
|
|
2626
|
+
this.mountChildren(target);
|
|
2541
2627
|
} else {
|
|
2542
2628
|
this.initChildren();
|
|
2543
2629
|
}
|
|
@@ -2559,6 +2645,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2559
2645
|
rawPropsProxyHandlers
|
|
2560
2646
|
)
|
|
2561
2647
|
);
|
|
2648
|
+
this.isDisabled = isTeleportDisabled(this.resolvedProps);
|
|
2562
2649
|
this.handlePropsUpdate();
|
|
2563
2650
|
});
|
|
2564
2651
|
if (!isHydrating) {
|
|
@@ -2574,8 +2661,21 @@ class TeleportFragment extends VaporFragment {
|
|
|
2574
2661
|
this.rawSlots.default && this.rawSlots.default()
|
|
2575
2662
|
);
|
|
2576
2663
|
});
|
|
2664
|
+
const nodes = this.nodes;
|
|
2665
|
+
if (this.parentComponent && this.parentComponent.ut) {
|
|
2666
|
+
if (isFragment(nodes)) {
|
|
2667
|
+
(nodes.updated || (nodes.updated = [])).push(() => updateCssVars(this));
|
|
2668
|
+
} else if (isArray(nodes)) {
|
|
2669
|
+
nodes.forEach((node) => {
|
|
2670
|
+
if (isFragment(node)) {
|
|
2671
|
+
(node.updated || (node.updated = [])).push(
|
|
2672
|
+
() => updateCssVars(this)
|
|
2673
|
+
);
|
|
2674
|
+
}
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2577
2678
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2578
|
-
const nodes = this.nodes;
|
|
2579
2679
|
if (isVaporComponent(nodes)) {
|
|
2580
2680
|
nodes.parentTeleport = this;
|
|
2581
2681
|
} else if (isArray(nodes)) {
|
|
@@ -2593,53 +2693,55 @@ class TeleportFragment extends VaporFragment {
|
|
|
2593
2693
|
remove(this.nodes, this.mountContainer);
|
|
2594
2694
|
insert(this.nodes = children, this.mountContainer, this.mountAnchor);
|
|
2595
2695
|
}
|
|
2596
|
-
|
|
2597
|
-
if (
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2696
|
+
mount(parent, anchor) {
|
|
2697
|
+
if (this.$transition) {
|
|
2698
|
+
applyTransitionHooks(this.nodes, this.$transition);
|
|
2699
|
+
}
|
|
2700
|
+
insert(
|
|
2701
|
+
this.nodes,
|
|
2702
|
+
this.mountContainer = parent,
|
|
2703
|
+
this.mountAnchor = anchor
|
|
2704
|
+
);
|
|
2705
|
+
}
|
|
2706
|
+
mountToTarget() {
|
|
2707
|
+
const target = this.target = resolveTeleportTarget(
|
|
2708
|
+
this.resolvedProps,
|
|
2709
|
+
querySelector
|
|
2710
|
+
);
|
|
2711
|
+
if (target) {
|
|
2712
|
+
if (
|
|
2713
|
+
// initial mount into target
|
|
2714
|
+
!this.targetAnchor || // target changed
|
|
2715
|
+
this.targetAnchor.parentNode !== target
|
|
2716
|
+
) {
|
|
2717
|
+
insert(this.targetStart = createTextNode(""), target);
|
|
2718
|
+
insert(this.targetAnchor = createTextNode(""), target);
|
|
2601
2719
|
}
|
|
2602
|
-
|
|
2603
|
-
this.
|
|
2604
|
-
this.mountContainer = parent,
|
|
2605
|
-
this.mountAnchor = anchor
|
|
2606
|
-
);
|
|
2607
|
-
};
|
|
2608
|
-
const mountToTarget = () => {
|
|
2609
|
-
const target = this.target = resolveTeleportTarget(
|
|
2610
|
-
this.resolvedProps,
|
|
2611
|
-
querySelector
|
|
2612
|
-
);
|
|
2613
|
-
if (target) {
|
|
2614
|
-
if (
|
|
2615
|
-
// initial mount into target
|
|
2616
|
-
!this.targetAnchor || // target changed
|
|
2617
|
-
this.targetAnchor.parentNode !== target
|
|
2618
|
-
) {
|
|
2619
|
-
insert(this.targetStart = createTextNode(""), target);
|
|
2620
|
-
insert(this.targetAnchor = createTextNode(""), target);
|
|
2621
|
-
}
|
|
2622
|
-
if (this.parentComponent && this.parentComponent.isCE) {
|
|
2623
|
-
(this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2624
|
-
}
|
|
2625
|
-
mount(target, this.targetAnchor);
|
|
2626
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2627
|
-
warn(
|
|
2628
|
-
`Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`,
|
|
2629
|
-
target,
|
|
2630
|
-
`(${typeof target})`
|
|
2631
|
-
);
|
|
2720
|
+
if (this.parentComponent && this.parentComponent.isCE) {
|
|
2721
|
+
(this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2632
2722
|
}
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2723
|
+
this.mount(target, this.targetAnchor);
|
|
2724
|
+
updateCssVars(this);
|
|
2725
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2726
|
+
warn(
|
|
2727
|
+
`Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`,
|
|
2728
|
+
target,
|
|
2729
|
+
`(${typeof target})`
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
handlePropsUpdate() {
|
|
2734
|
+
if (!this.parent || isHydrating) return;
|
|
2735
|
+
if (this.isDisabled) {
|
|
2736
|
+
this.mount(this.parent, this.anchor);
|
|
2737
|
+
updateCssVars(this);
|
|
2636
2738
|
} else {
|
|
2637
2739
|
if (isTeleportDeferred(this.resolvedProps) || // force defer when the parent is not connected to the DOM,
|
|
2638
2740
|
// typically due to an early insertion caused by setInsertionState.
|
|
2639
2741
|
!this.parent.isConnected) {
|
|
2640
|
-
queuePostFlushCb(mountToTarget);
|
|
2742
|
+
queuePostFlushCb(this.mountToTarget.bind(this));
|
|
2641
2743
|
} else {
|
|
2642
|
-
mountToTarget();
|
|
2744
|
+
this.mountToTarget();
|
|
2643
2745
|
}
|
|
2644
2746
|
}
|
|
2645
2747
|
}
|
|
@@ -2652,7 +2754,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2652
2754
|
this.targetAnchor = targetNode && targetNode.nextSibling;
|
|
2653
2755
|
this.initChildren();
|
|
2654
2756
|
}
|
|
2655
|
-
|
|
2757
|
+
mountChildren(target) {
|
|
2656
2758
|
target.appendChild(this.targetStart = createTextNode(""));
|
|
2657
2759
|
target.appendChild(
|
|
2658
2760
|
this.mountAnchor = this.targetAnchor = createTextNode("")
|
|
@@ -2683,6 +2785,25 @@ function locateTeleportEndAnchor(node = currentHydrationNode) {
|
|
|
2683
2785
|
}
|
|
2684
2786
|
return null;
|
|
2685
2787
|
}
|
|
2788
|
+
function updateCssVars(frag) {
|
|
2789
|
+
const ctx = frag.parentComponent;
|
|
2790
|
+
if (ctx && ctx.ut) {
|
|
2791
|
+
let node, anchor;
|
|
2792
|
+
if (frag.isDisabled) {
|
|
2793
|
+
node = frag.placeholder;
|
|
2794
|
+
anchor = frag.anchor;
|
|
2795
|
+
} else {
|
|
2796
|
+
node = frag.targetStart;
|
|
2797
|
+
anchor = frag.targetAnchor;
|
|
2798
|
+
}
|
|
2799
|
+
while (node && node !== anchor) {
|
|
2800
|
+
if (node.nodeType === 1)
|
|
2801
|
+
node.setAttribute("data-v-owner", String(ctx.uid));
|
|
2802
|
+
node = node.nextSibling;
|
|
2803
|
+
}
|
|
2804
|
+
ctx.ut();
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2686
2807
|
|
|
2687
2808
|
function isBlock(val) {
|
|
2688
2809
|
return val instanceof Node || isArray(val) || isVaporComponent(val) || isFragment(val);
|
|
@@ -2765,11 +2886,6 @@ function remove(block, parent) {
|
|
|
2765
2886
|
if (block.anchor) remove(block.anchor, parent);
|
|
2766
2887
|
if (block.scope) {
|
|
2767
2888
|
block.scope.stop();
|
|
2768
|
-
const scopes = block.keptAliveScopes;
|
|
2769
|
-
if (scopes) {
|
|
2770
|
-
scopes.forEach((scope) => scope.stop());
|
|
2771
|
-
scopes.clear();
|
|
2772
|
-
}
|
|
2773
2889
|
}
|
|
2774
2890
|
}
|
|
2775
2891
|
}
|
|
@@ -2881,6 +2997,10 @@ function hmrRerender(instance) {
|
|
|
2881
2997
|
insert(instance.block, parent, anchor);
|
|
2882
2998
|
}
|
|
2883
2999
|
function hmrReload(instance, newComp) {
|
|
3000
|
+
if (instance.parent && isKeepAlive(instance.parent)) {
|
|
3001
|
+
instance.parent.hmrRerender();
|
|
3002
|
+
return;
|
|
3003
|
+
}
|
|
2884
3004
|
const normalized = normalizeBlock(instance.block);
|
|
2885
3005
|
const parent = normalized[0].parentNode;
|
|
2886
3006
|
const anchor = normalized[normalized.length - 1].nextSibling;
|
|
@@ -2938,10 +3058,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2938
3058
|
} else {
|
|
2939
3059
|
resetInsertionState();
|
|
2940
3060
|
}
|
|
2941
|
-
|
|
2942
|
-
if (
|
|
2943
|
-
|
|
2944
|
-
|
|
3061
|
+
let prevSuspense = null;
|
|
3062
|
+
if (currentInstance && currentInstance.suspense) {
|
|
3063
|
+
prevSuspense = setParentSuspense(currentInstance.suspense);
|
|
3064
|
+
}
|
|
3065
|
+
if ((isSingleRoot || // transition has attrs fallthrough
|
|
3066
|
+
currentInstance && isVaporTransition(currentInstance.type)) && component.inheritAttrs !== false && isVaporComponent(currentInstance) && currentInstance.hasFallthrough) {
|
|
3067
|
+
const attrs = currentInstance.attrs;
|
|
3068
|
+
if (rawProps && rawProps !== EMPTY_OBJ) {
|
|
2945
3069
|
(rawProps.$ || (rawProps.$ = [])).push(
|
|
2946
3070
|
() => attrs
|
|
2947
3071
|
);
|
|
@@ -2949,21 +3073,19 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2949
3073
|
rawProps = { $: [() => attrs] };
|
|
2950
3074
|
}
|
|
2951
3075
|
}
|
|
2952
|
-
if (
|
|
2953
|
-
const cached =
|
|
3076
|
+
if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
3077
|
+
const cached = currentInstance.getCachedComponent(
|
|
2954
3078
|
component
|
|
2955
3079
|
);
|
|
2956
3080
|
if (cached) return cached;
|
|
2957
3081
|
}
|
|
2958
3082
|
if (appContext.vapor && !component.__vapor) {
|
|
2959
|
-
const prevSlotConsumer2 = setCurrentSlotConsumer(null);
|
|
2960
3083
|
const frag = appContext.vapor.vdomMount(
|
|
2961
3084
|
component,
|
|
2962
|
-
|
|
3085
|
+
currentInstance,
|
|
2963
3086
|
rawProps,
|
|
2964
3087
|
rawSlots
|
|
2965
3088
|
);
|
|
2966
|
-
setCurrentSlotConsumer(prevSlotConsumer2);
|
|
2967
3089
|
if (!isHydrating) {
|
|
2968
3090
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
2969
3091
|
} else {
|
|
@@ -2991,17 +3113,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
2991
3113
|
rawProps,
|
|
2992
3114
|
rawSlots,
|
|
2993
3115
|
appContext,
|
|
2994
|
-
once
|
|
2995
|
-
parentInstance
|
|
3116
|
+
once
|
|
2996
3117
|
);
|
|
2997
|
-
const
|
|
2998
|
-
if (!!(process.env.NODE_ENV !== "production")
|
|
3118
|
+
const prevSlotOwner = setCurrentSlotOwner(null);
|
|
3119
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
2999
3120
|
registerHMR(instance);
|
|
3000
3121
|
instance.isSingleRoot = isSingleRoot;
|
|
3001
3122
|
instance.hmrRerender = hmrRerender.bind(null, instance);
|
|
3002
3123
|
instance.hmrReload = hmrReload.bind(null, instance);
|
|
3003
|
-
}
|
|
3004
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3005
3124
|
pushWarningContext(instance);
|
|
3006
3125
|
startMeasure(instance, `init`);
|
|
3007
3126
|
instance.propsOptions = normalizePropsOptions(component);
|
|
@@ -3036,7 +3155,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3036
3155
|
} else {
|
|
3037
3156
|
setupComponent(instance, component);
|
|
3038
3157
|
}
|
|
3039
|
-
|
|
3158
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3159
|
+
popWarningContext();
|
|
3160
|
+
endMeasure(instance, "init");
|
|
3161
|
+
}
|
|
3162
|
+
if (currentInstance && currentInstance.suspense) {
|
|
3163
|
+
setParentSuspense(prevSuspense);
|
|
3164
|
+
}
|
|
3165
|
+
setCurrentSlotOwner(prevSlotOwner);
|
|
3040
3166
|
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
3041
3167
|
if (_insertionParent || isHydrating) {
|
|
3042
3168
|
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
@@ -3047,6 +3173,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3047
3173
|
return instance;
|
|
3048
3174
|
}
|
|
3049
3175
|
function setupComponent(instance, component) {
|
|
3176
|
+
var _a;
|
|
3050
3177
|
const prevInstance = setCurrentInstance(instance);
|
|
3051
3178
|
const prevSub = setActiveSub();
|
|
3052
3179
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -3056,50 +3183,45 @@ function setupComponent(instance, component) {
|
|
|
3056
3183
|
const setupResult = setupFn ? callWithErrorHandling(setupFn, instance, 0, [
|
|
3057
3184
|
instance.props,
|
|
3058
3185
|
instance
|
|
3059
|
-
]) || EMPTY_OBJ : EMPTY_OBJ;
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
instance.block = [];
|
|
3064
|
-
} else if (!component.render) {
|
|
3065
|
-
warn(
|
|
3066
|
-
`Vapor component setup() returned non-block value, and has no render function.`
|
|
3067
|
-
);
|
|
3068
|
-
instance.block = [];
|
|
3069
|
-
} else {
|
|
3070
|
-
instance.devtoolsRawSetupState = setupResult;
|
|
3071
|
-
instance.setupState = proxyRefs(setupResult);
|
|
3072
|
-
devRender(instance);
|
|
3073
|
-
}
|
|
3074
|
-
} else {
|
|
3075
|
-
if (!setupFn && component.render) {
|
|
3076
|
-
instance.block = callWithErrorHandling(
|
|
3077
|
-
component.render,
|
|
3078
|
-
instance,
|
|
3079
|
-
1
|
|
3080
|
-
);
|
|
3081
|
-
} else {
|
|
3082
|
-
instance.block = setupResult;
|
|
3083
|
-
}
|
|
3186
|
+
]) || EMPTY_OBJ : EMPTY_OBJ;
|
|
3187
|
+
const isAsyncSetup = isPromise(setupResult);
|
|
3188
|
+
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
3189
|
+
markAsyncBoundary(instance);
|
|
3084
3190
|
}
|
|
3085
|
-
if (
|
|
3086
|
-
|
|
3191
|
+
if (isAsyncSetup) {
|
|
3192
|
+
{
|
|
3193
|
+
instance.asyncDep = setupResult;
|
|
3194
|
+
if (!!(process.env.NODE_ENV !== "production") && !instance.suspense) {
|
|
3195
|
+
const name = (_a = getComponentName(component)) != null ? _a : "Anonymous";
|
|
3196
|
+
warn(
|
|
3197
|
+
`Component <${name}>: setup function returned a promise, but no <Suspense> boundary was found in the parent component tree. A component with async setup() must be nested in a <Suspense> in order to be rendered.`
|
|
3198
|
+
);
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
} else {
|
|
3202
|
+
handleSetupResult(setupResult, component, instance, setupFn);
|
|
3087
3203
|
}
|
|
3088
3204
|
setActiveSub(prevSub);
|
|
3089
3205
|
setCurrentInstance(...prevInstance);
|
|
3090
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3091
|
-
popWarningContext();
|
|
3092
|
-
endMeasure(instance, "init");
|
|
3093
|
-
}
|
|
3094
3206
|
}
|
|
3095
3207
|
let isApplyingFallthroughProps = false;
|
|
3096
|
-
function applyFallthroughProps(
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
}
|
|
3208
|
+
function applyFallthroughProps(el, attrs) {
|
|
3209
|
+
isApplyingFallthroughProps = true;
|
|
3210
|
+
setDynamicProps(el, [attrs]);
|
|
3211
|
+
isApplyingFallthroughProps = false;
|
|
3212
|
+
}
|
|
3213
|
+
function createDevSetupStateProxy(instance) {
|
|
3214
|
+
const { setupState } = instance;
|
|
3215
|
+
return new Proxy(setupState, {
|
|
3216
|
+
get(target, key, receiver) {
|
|
3217
|
+
if (isString(key) && !key.startsWith("__v") && !hasOwn(toRaw(setupState), key)) {
|
|
3218
|
+
warn(
|
|
3219
|
+
`Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
|
|
3220
|
+
);
|
|
3221
|
+
}
|
|
3222
|
+
return Reflect.get(target, key, receiver);
|
|
3223
|
+
}
|
|
3224
|
+
});
|
|
3103
3225
|
}
|
|
3104
3226
|
function devRender(instance) {
|
|
3105
3227
|
instance.block = (instance.type.render ? callWithErrorHandling(
|
|
@@ -3134,17 +3256,24 @@ const emptyContext = {
|
|
|
3134
3256
|
provides: /* @__PURE__ */ Object.create(null)
|
|
3135
3257
|
};
|
|
3136
3258
|
class VaporComponentInstance {
|
|
3137
|
-
constructor(comp, rawProps, rawSlots, appContext, once
|
|
3259
|
+
constructor(comp, rawProps, rawSlots, appContext, once) {
|
|
3260
|
+
/**
|
|
3261
|
+
* dev only flag to track whether $attrs was used during render.
|
|
3262
|
+
* If $attrs was used during render then the warning for failed attrs
|
|
3263
|
+
* fallthrough can be suppressed.
|
|
3264
|
+
*/
|
|
3265
|
+
this.accessedAttrs = false;
|
|
3138
3266
|
this.vapor = true;
|
|
3139
3267
|
this.uid = nextUid();
|
|
3140
3268
|
this.type = comp;
|
|
3141
|
-
this.parent =
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
this.appContext =
|
|
3145
|
-
this.provides =
|
|
3146
|
-
this.ids =
|
|
3269
|
+
this.parent = currentInstance;
|
|
3270
|
+
if (currentInstance) {
|
|
3271
|
+
this.root = currentInstance.root;
|
|
3272
|
+
this.appContext = currentInstance.appContext;
|
|
3273
|
+
this.provides = currentInstance.provides;
|
|
3274
|
+
this.ids = currentInstance.ids;
|
|
3147
3275
|
} else {
|
|
3276
|
+
this.root = this;
|
|
3148
3277
|
this.appContext = appContext || emptyContext;
|
|
3149
3278
|
this.provides = Object.create(this.appContext.provides);
|
|
3150
3279
|
this.ids = ["", 0, 0];
|
|
@@ -3154,7 +3283,11 @@ class VaporComponentInstance {
|
|
|
3154
3283
|
this.emit = emit.bind(null, this);
|
|
3155
3284
|
this.expose = expose.bind(null, this);
|
|
3156
3285
|
this.refs = EMPTY_OBJ;
|
|
3157
|
-
this.emitted = this.exposed = this.exposeProxy = this.propsDefaults =
|
|
3286
|
+
this.emitted = this.exposed = this.exposeProxy = this.propsDefaults = null;
|
|
3287
|
+
this.suspense = parentSuspense;
|
|
3288
|
+
this.suspenseId = parentSuspense ? parentSuspense.pendingId : 0;
|
|
3289
|
+
this.asyncDep = null;
|
|
3290
|
+
this.asyncResolved = false;
|
|
3158
3291
|
this.isMounted = this.isUnmounted = this.isUpdating = this.isDeactivated = false;
|
|
3159
3292
|
this.rawProps = rawProps || EMPTY_OBJ;
|
|
3160
3293
|
this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
|
|
@@ -3167,10 +3300,24 @@ class VaporComponentInstance {
|
|
|
3167
3300
|
}
|
|
3168
3301
|
this.rawSlots = rawSlots || EMPTY_OBJ;
|
|
3169
3302
|
this.slots = rawSlots ? rawSlots.$ ? new Proxy(rawSlots, dynamicSlotsProxyHandlers) : rawSlots : EMPTY_OBJ;
|
|
3170
|
-
this.scopeId =
|
|
3303
|
+
this.scopeId = getCurrentScopeId();
|
|
3171
3304
|
if (comp.ce) {
|
|
3172
3305
|
comp.ce(this);
|
|
3173
3306
|
}
|
|
3307
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3308
|
+
if (this.props === this.attrs) {
|
|
3309
|
+
this.accessedAttrs = true;
|
|
3310
|
+
} else {
|
|
3311
|
+
const attrs = this.attrs;
|
|
3312
|
+
const instance = this;
|
|
3313
|
+
this.attrs = new Proxy(attrs, {
|
|
3314
|
+
get(target, key, receiver) {
|
|
3315
|
+
instance.accessedAttrs = true;
|
|
3316
|
+
return Reflect.get(target, key, receiver);
|
|
3317
|
+
}
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3174
3321
|
}
|
|
3175
3322
|
/**
|
|
3176
3323
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
@@ -3208,7 +3355,7 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
3208
3355
|
const el = isHydrating ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : createElement(comp);
|
|
3209
3356
|
el.$root = isSingleRoot;
|
|
3210
3357
|
if (!isHydrating) {
|
|
3211
|
-
const scopeId =
|
|
3358
|
+
const scopeId = getCurrentScopeId();
|
|
3212
3359
|
if (scopeId) setScopeId(el, [scopeId]);
|
|
3213
3360
|
}
|
|
3214
3361
|
if (rawProps) {
|
|
@@ -3246,6 +3393,19 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
3246
3393
|
return el;
|
|
3247
3394
|
}
|
|
3248
3395
|
function mountComponent(instance, parent, anchor) {
|
|
3396
|
+
if (instance.suspense && instance.asyncDep && !instance.asyncResolved) {
|
|
3397
|
+
const component = instance.type;
|
|
3398
|
+
instance.suspense.registerDep(instance, (setupResult) => {
|
|
3399
|
+
handleSetupResult(
|
|
3400
|
+
setupResult,
|
|
3401
|
+
component,
|
|
3402
|
+
instance,
|
|
3403
|
+
isFunction(component) ? component : component.setup
|
|
3404
|
+
);
|
|
3405
|
+
mountComponent(instance, parent, anchor);
|
|
3406
|
+
});
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3249
3409
|
if (instance.shapeFlag & 512) {
|
|
3250
3410
|
findParentKeepAlive(instance).activate(instance, parent, anchor);
|
|
3251
3411
|
return;
|
|
@@ -3301,16 +3461,102 @@ function getExposed(instance) {
|
|
|
3301
3461
|
}));
|
|
3302
3462
|
}
|
|
3303
3463
|
}
|
|
3304
|
-
function getRootElement(block) {
|
|
3464
|
+
function getRootElement(block, onDynamicFragment, recurse = true) {
|
|
3305
3465
|
if (block instanceof Element) {
|
|
3306
3466
|
return block;
|
|
3307
3467
|
}
|
|
3308
|
-
if (
|
|
3468
|
+
if (recurse && isVaporComponent(block)) {
|
|
3469
|
+
return getRootElement(block.block, onDynamicFragment, recurse);
|
|
3470
|
+
}
|
|
3471
|
+
if (isFragment(block) && !(block instanceof TeleportFragment)) {
|
|
3472
|
+
if (block instanceof DynamicFragment && onDynamicFragment) {
|
|
3473
|
+
onDynamicFragment(block);
|
|
3474
|
+
}
|
|
3309
3475
|
const { nodes } = block;
|
|
3310
3476
|
if (nodes instanceof Element && nodes.$root) {
|
|
3311
3477
|
return nodes;
|
|
3312
3478
|
}
|
|
3479
|
+
return getRootElement(nodes, onDynamicFragment, recurse);
|
|
3480
|
+
}
|
|
3481
|
+
if (isArray(block)) {
|
|
3482
|
+
let singleRoot;
|
|
3483
|
+
let hasComment = false;
|
|
3484
|
+
for (const b of block) {
|
|
3485
|
+
if (b instanceof Comment) {
|
|
3486
|
+
hasComment = true;
|
|
3487
|
+
continue;
|
|
3488
|
+
}
|
|
3489
|
+
const thisRoot = getRootElement(b, onDynamicFragment, recurse);
|
|
3490
|
+
if (!thisRoot || singleRoot) {
|
|
3491
|
+
return;
|
|
3492
|
+
}
|
|
3493
|
+
singleRoot = thisRoot;
|
|
3494
|
+
}
|
|
3495
|
+
return hasComment ? singleRoot : void 0;
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
function isVaporTransition(component) {
|
|
3499
|
+
return getComponentName(component) === "VaporTransition";
|
|
3500
|
+
}
|
|
3501
|
+
function handleSetupResult(setupResult, component, instance, setupFn) {
|
|
3502
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3503
|
+
pushWarningContext(instance);
|
|
3504
|
+
}
|
|
3505
|
+
if (!!(process.env.NODE_ENV !== "production") && !isBlock(setupResult)) {
|
|
3506
|
+
if (isFunction(component)) {
|
|
3507
|
+
warn(`Functional vapor component must return a block directly.`);
|
|
3508
|
+
instance.block = [];
|
|
3509
|
+
} else if (!component.render) {
|
|
3510
|
+
warn(
|
|
3511
|
+
`Vapor component setup() returned non-block value, and has no render function.`
|
|
3512
|
+
);
|
|
3513
|
+
instance.block = [];
|
|
3514
|
+
} else {
|
|
3515
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
3516
|
+
instance.devtoolsRawSetupState = setupResult;
|
|
3517
|
+
}
|
|
3518
|
+
instance.setupState = proxyRefs(setupResult);
|
|
3519
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3520
|
+
instance.setupState = createDevSetupStateProxy(instance);
|
|
3521
|
+
}
|
|
3522
|
+
devRender(instance);
|
|
3523
|
+
}
|
|
3524
|
+
} else {
|
|
3525
|
+
if (!setupFn && component.render) {
|
|
3526
|
+
instance.block = callWithErrorHandling(
|
|
3527
|
+
component.render,
|
|
3528
|
+
instance,
|
|
3529
|
+
1
|
|
3530
|
+
);
|
|
3531
|
+
} else {
|
|
3532
|
+
instance.block = setupResult;
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
3536
|
+
const root = getRootElement(
|
|
3537
|
+
instance.block,
|
|
3538
|
+
// attach attrs to root dynamic fragments for applying during each update
|
|
3539
|
+
(frag) => frag.attrs = instance.attrs,
|
|
3540
|
+
false
|
|
3541
|
+
);
|
|
3542
|
+
if (root) {
|
|
3543
|
+
renderEffect(() => {
|
|
3544
|
+
const attrs = isFunction(component) && !isVaporTransition(component) ? getFunctionalFallthrough(instance.attrs) : instance.attrs;
|
|
3545
|
+
if (attrs) applyFallthroughProps(root, attrs);
|
|
3546
|
+
});
|
|
3547
|
+
} else if (!!(process.env.NODE_ENV !== "production") && (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || // preventing attrs fallthrough on Teleport
|
|
3548
|
+
// consistent with VDOM Teleport behavior
|
|
3549
|
+
instance.block instanceof TeleportFragment)) {
|
|
3550
|
+
warnExtraneousAttributes(instance.attrs);
|
|
3551
|
+
}
|
|
3313
3552
|
}
|
|
3553
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3554
|
+
popWarningContext();
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
function getCurrentScopeId() {
|
|
3558
|
+
const scopeOwner = getScopeOwner();
|
|
3559
|
+
return scopeOwner ? scopeOwner.type.__scopeId : void 0;
|
|
3314
3560
|
}
|
|
3315
3561
|
|
|
3316
3562
|
let _createApp;
|
|
@@ -3500,21 +3746,19 @@ function defineVaporAsyncComponent(source) {
|
|
|
3500
3746
|
});
|
|
3501
3747
|
}
|
|
3502
3748
|
function createInnerComp(comp, parent, frag) {
|
|
3503
|
-
const { rawProps, rawSlots,
|
|
3749
|
+
const { rawProps, rawSlots, appContext, $transition } = parent;
|
|
3504
3750
|
const instance = createComponent(
|
|
3505
3751
|
comp,
|
|
3506
3752
|
rawProps,
|
|
3507
3753
|
rawSlots,
|
|
3508
|
-
|
|
3754
|
+
// rawProps is shared and already contains fallthrough attrs.
|
|
3755
|
+
// so isSingleRoot should be undefined
|
|
3756
|
+
void 0,
|
|
3509
3757
|
void 0,
|
|
3510
3758
|
appContext
|
|
3511
3759
|
);
|
|
3512
|
-
if (parent.parent && isKeepAlive(parent.parent)) {
|
|
3513
|
-
parent.parent.cacheComponent(instance);
|
|
3514
|
-
parent.parent.cacheComponent(parent);
|
|
3515
|
-
}
|
|
3516
3760
|
if ($transition) setTransitionHooks(instance, $transition);
|
|
3517
|
-
frag && frag.
|
|
3761
|
+
frag && frag.setAsyncRef && frag.setAsyncRef(instance);
|
|
3518
3762
|
return instance;
|
|
3519
3763
|
}
|
|
3520
3764
|
|
|
@@ -3652,227 +3896,62 @@ function template(html, root, ns) {
|
|
|
3652
3896
|
if (html[0] !== "<") {
|
|
3653
3897
|
return createTextNode(html);
|
|
3654
3898
|
}
|
|
3655
|
-
if (!node) {
|
|
3656
|
-
t = t || document.createElement("template");
|
|
3657
|
-
if (ns) {
|
|
3658
|
-
const tag = ns === 1 ? "svg" : "math";
|
|
3659
|
-
t.innerHTML = `<${tag}>${html}</${tag}>`;
|
|
3660
|
-
node = _child(_child(t.content));
|
|
3661
|
-
} else {
|
|
3662
|
-
t.innerHTML = html;
|
|
3663
|
-
node = _child(t.content);
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
const ret = node.cloneNode(true);
|
|
3667
|
-
if (root) ret.$root = true;
|
|
3668
|
-
return ret;
|
|
3669
|
-
};
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3672
|
-
function createIf(condition, b1, b2, once) {
|
|
3673
|
-
const _insertionParent = insertionParent;
|
|
3674
|
-
const _insertionAnchor = insertionAnchor;
|
|
3675
|
-
const _isLastInsertion = isLastInsertion;
|
|
3676
|
-
if (!isHydrating) resetInsertionState();
|
|
3677
|
-
let frag;
|
|
3678
|
-
if (once) {
|
|
3679
|
-
frag = condition() ? b1() : b2 ? b2() : [];
|
|
3680
|
-
} else {
|
|
3681
|
-
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
3682
|
-
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
3683
|
-
}
|
|
3684
|
-
if (!isHydrating) {
|
|
3685
|
-
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3686
|
-
} else {
|
|
3687
|
-
if (_isLastInsertion) {
|
|
3688
|
-
advanceHydrationNode(_insertionParent);
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
return frag;
|
|
3692
|
-
}
|
|
3693
|
-
|
|
3694
|
-
function createKeyedFragment(key, render) {
|
|
3695
|
-
const _insertionParent = insertionParent;
|
|
3696
|
-
const _insertionAnchor = insertionAnchor;
|
|
3697
|
-
const _isLastInsertion = isLastInsertion;
|
|
3698
|
-
if (!isHydrating) resetInsertionState();
|
|
3699
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
3700
|
-
renderEffect(() => {
|
|
3701
|
-
frag.update(render, key());
|
|
3702
|
-
});
|
|
3703
|
-
if (!isHydrating) {
|
|
3704
|
-
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3705
|
-
} else {
|
|
3706
|
-
if (_isLastInsertion) {
|
|
3707
|
-
advanceHydrationNode(_insertionParent);
|
|
3708
|
-
}
|
|
3709
|
-
}
|
|
3710
|
-
return frag;
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
|
-
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
3714
|
-
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
3715
|
-
const decorate = (t) => {
|
|
3716
|
-
delete t.props.mode;
|
|
3717
|
-
t.__vapor = true;
|
|
3718
|
-
return t;
|
|
3719
|
-
};
|
|
3720
|
-
const VaporTransitionGroup = decorate({
|
|
3721
|
-
name: "VaporTransitionGroup",
|
|
3722
|
-
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
3723
|
-
tag: String,
|
|
3724
|
-
moveClass: String
|
|
3725
|
-
}),
|
|
3726
|
-
setup(props, { slots }) {
|
|
3727
|
-
const instance = currentInstance;
|
|
3728
|
-
const state = useTransitionState();
|
|
3729
|
-
const cssTransitionProps = resolveTransitionProps(props);
|
|
3730
|
-
let prevChildren;
|
|
3731
|
-
let children;
|
|
3732
|
-
const slottedBlock = slots.default && slots.default();
|
|
3733
|
-
onBeforeUpdate(() => {
|
|
3734
|
-
prevChildren = [];
|
|
3735
|
-
children = getTransitionBlocks(slottedBlock);
|
|
3736
|
-
if (children) {
|
|
3737
|
-
for (let i = 0; i < children.length; i++) {
|
|
3738
|
-
const child = children[i];
|
|
3739
|
-
if (isValidTransitionBlock(child)) {
|
|
3740
|
-
prevChildren.push(child);
|
|
3741
|
-
child.$transition.disabled = true;
|
|
3742
|
-
positionMap.set(
|
|
3743
|
-
child,
|
|
3744
|
-
getTransitionElement(child).getBoundingClientRect()
|
|
3745
|
-
);
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
}
|
|
3749
|
-
});
|
|
3750
|
-
onUpdated(() => {
|
|
3751
|
-
if (!prevChildren.length) {
|
|
3752
|
-
return;
|
|
3753
|
-
}
|
|
3754
|
-
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
3755
|
-
const firstChild = getFirstConnectedChild(prevChildren);
|
|
3756
|
-
if (!firstChild || !hasCSSTransform(
|
|
3757
|
-
firstChild,
|
|
3758
|
-
firstChild.parentNode,
|
|
3759
|
-
moveClass
|
|
3760
|
-
)) {
|
|
3761
|
-
prevChildren = [];
|
|
3762
|
-
return;
|
|
3763
|
-
}
|
|
3764
|
-
prevChildren.forEach(callPendingCbs);
|
|
3765
|
-
prevChildren.forEach((child) => {
|
|
3766
|
-
child.$transition.disabled = false;
|
|
3767
|
-
recordPosition(child);
|
|
3768
|
-
});
|
|
3769
|
-
const movedChildren = prevChildren.filter(applyTranslation);
|
|
3770
|
-
forceReflow();
|
|
3771
|
-
movedChildren.forEach(
|
|
3772
|
-
(c) => handleMovedChildren(
|
|
3773
|
-
getTransitionElement(c),
|
|
3774
|
-
moveClass
|
|
3775
|
-
)
|
|
3776
|
-
);
|
|
3777
|
-
prevChildren = [];
|
|
3778
|
-
});
|
|
3779
|
-
setTransitionHooksOnFragment(slottedBlock, {
|
|
3780
|
-
props: cssTransitionProps,
|
|
3781
|
-
state,
|
|
3782
|
-
instance,
|
|
3783
|
-
group: true
|
|
3784
|
-
});
|
|
3785
|
-
children = getTransitionBlocks(slottedBlock);
|
|
3786
|
-
for (let i = 0; i < children.length; i++) {
|
|
3787
|
-
const child = children[i];
|
|
3788
|
-
if (isValidTransitionBlock(child)) {
|
|
3789
|
-
if (child.$key != null) {
|
|
3790
|
-
const hooks = resolveTransitionHooks(
|
|
3791
|
-
child,
|
|
3792
|
-
cssTransitionProps,
|
|
3793
|
-
state,
|
|
3794
|
-
instance
|
|
3795
|
-
);
|
|
3796
|
-
hooks.group = true;
|
|
3797
|
-
setTransitionHooks(child, hooks);
|
|
3798
|
-
} else if (!!(process.env.NODE_ENV !== "production") && child.$key == null) {
|
|
3799
|
-
warn(`<transition-group> children must be keyed`);
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
}
|
|
3803
|
-
const tag = props.tag;
|
|
3804
|
-
if (tag) {
|
|
3805
|
-
const container = createElement(tag);
|
|
3806
|
-
insert(slottedBlock, container);
|
|
3807
|
-
if (instance.hasFallthrough) {
|
|
3808
|
-
container.$root = true;
|
|
3809
|
-
renderEffect(() => applyFallthroughProps(container, instance.attrs));
|
|
3810
|
-
}
|
|
3811
|
-
return container;
|
|
3812
|
-
} else {
|
|
3813
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("transition-group") : new DynamicFragment();
|
|
3814
|
-
renderEffect(() => frag.update(() => slottedBlock));
|
|
3815
|
-
return frag;
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
});
|
|
3819
|
-
function getTransitionBlocks(block) {
|
|
3820
|
-
let children = [];
|
|
3821
|
-
if (block instanceof Node) {
|
|
3822
|
-
children.push(block);
|
|
3823
|
-
} else if (isVaporComponent(block)) {
|
|
3824
|
-
children.push(...getTransitionBlocks(block.block));
|
|
3825
|
-
} else if (isArray(block)) {
|
|
3826
|
-
for (let i = 0; i < block.length; i++) {
|
|
3827
|
-
const b = block[i];
|
|
3828
|
-
const blocks = getTransitionBlocks(b);
|
|
3829
|
-
if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
|
|
3830
|
-
children.push(...blocks);
|
|
3831
|
-
}
|
|
3832
|
-
} else if (isFragment(block)) {
|
|
3833
|
-
if (block.insert) {
|
|
3834
|
-
children.push(block);
|
|
3835
|
-
} else {
|
|
3836
|
-
children.push(...getTransitionBlocks(block.nodes));
|
|
3899
|
+
if (!node) {
|
|
3900
|
+
t = t || document.createElement("template");
|
|
3901
|
+
if (ns) {
|
|
3902
|
+
const tag = ns === 1 ? "svg" : "math";
|
|
3903
|
+
t.innerHTML = `<${tag}>${html}</${tag}>`;
|
|
3904
|
+
node = _child(_child(t.content));
|
|
3905
|
+
} else {
|
|
3906
|
+
t.innerHTML = html;
|
|
3907
|
+
node = _child(t.content);
|
|
3908
|
+
}
|
|
3837
3909
|
}
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
return !!(block instanceof Element || isFragment(block) && block.insert);
|
|
3843
|
-
}
|
|
3844
|
-
function getTransitionElement(c) {
|
|
3845
|
-
return isFragment(c) ? c.nodes : c;
|
|
3846
|
-
}
|
|
3847
|
-
function recordPosition(c) {
|
|
3848
|
-
newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
|
|
3910
|
+
const ret = node.cloneNode(true);
|
|
3911
|
+
if (root) ret.$root = true;
|
|
3912
|
+
return ret;
|
|
3913
|
+
};
|
|
3849
3914
|
}
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
))
|
|
3856
|
-
|
|
3915
|
+
|
|
3916
|
+
function createIf(condition, b1, b2, once) {
|
|
3917
|
+
const _insertionParent = insertionParent;
|
|
3918
|
+
const _insertionAnchor = insertionAnchor;
|
|
3919
|
+
const _isLastInsertion = isLastInsertion;
|
|
3920
|
+
if (!isHydrating) resetInsertionState();
|
|
3921
|
+
let frag;
|
|
3922
|
+
if (once) {
|
|
3923
|
+
frag = condition() ? b1() : b2 ? b2() : [];
|
|
3924
|
+
} else {
|
|
3925
|
+
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
3926
|
+
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
3857
3927
|
}
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3928
|
+
if (!isHydrating) {
|
|
3929
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3930
|
+
} else {
|
|
3931
|
+
if (_isLastInsertion) {
|
|
3932
|
+
advanceHydrationNode(_insertionParent);
|
|
3933
|
+
}
|
|
3864
3934
|
}
|
|
3935
|
+
return frag;
|
|
3865
3936
|
}
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3937
|
+
|
|
3938
|
+
function createKeyedFragment(key, render) {
|
|
3939
|
+
const _insertionParent = insertionParent;
|
|
3940
|
+
const _insertionAnchor = insertionAnchor;
|
|
3941
|
+
const _isLastInsertion = isLastInsertion;
|
|
3942
|
+
if (!isHydrating) resetInsertionState();
|
|
3943
|
+
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
3944
|
+
renderEffect(() => {
|
|
3945
|
+
frag.update(render, key());
|
|
3946
|
+
});
|
|
3947
|
+
if (!isHydrating) {
|
|
3948
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3949
|
+
} else {
|
|
3950
|
+
if (_isLastInsertion) {
|
|
3951
|
+
advanceHydrationNode(_insertionParent);
|
|
3952
|
+
}
|
|
3875
3953
|
}
|
|
3954
|
+
return frag;
|
|
3876
3955
|
}
|
|
3877
3956
|
|
|
3878
3957
|
class ForBlock extends VaporFragment {
|
|
@@ -3917,10 +3996,6 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
3917
3996
|
const oldLength = oldBlocks.length;
|
|
3918
3997
|
newBlocks = new Array(newLength);
|
|
3919
3998
|
let isFallback = false;
|
|
3920
|
-
const transitionHooks = frag.$transition;
|
|
3921
|
-
if (transitionHooks && transitionHooks.group) {
|
|
3922
|
-
triggerTransitionGroupUpdate(transitionHooks);
|
|
3923
|
-
}
|
|
3924
3999
|
const prevSub = setActiveSub();
|
|
3925
4000
|
if (!isMounted) {
|
|
3926
4001
|
isMounted = true;
|
|
@@ -4136,6 +4211,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4136
4211
|
} else {
|
|
4137
4212
|
oldBlocks = [];
|
|
4138
4213
|
}
|
|
4214
|
+
if (isMounted && frag.updated) frag.updated.forEach((m) => m());
|
|
4139
4215
|
setActiveSub(prevSub);
|
|
4140
4216
|
};
|
|
4141
4217
|
const needKey = renderItem.length > 1;
|
|
@@ -4164,7 +4240,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4164
4240
|
key2
|
|
4165
4241
|
);
|
|
4166
4242
|
if (frag.$transition) {
|
|
4167
|
-
applyTransitionHooks(block.nodes, frag.$transition
|
|
4243
|
+
applyTransitionHooks(block.nodes, frag.$transition);
|
|
4168
4244
|
}
|
|
4169
4245
|
if (parent) insert(block.nodes, parent, anchor);
|
|
4170
4246
|
return block;
|
|
@@ -4345,6 +4421,18 @@ function isForBlock(block) {
|
|
|
4345
4421
|
return block instanceof ForBlock;
|
|
4346
4422
|
}
|
|
4347
4423
|
|
|
4424
|
+
const refCleanups = /* @__PURE__ */ new WeakMap();
|
|
4425
|
+
function ensureCleanup(el) {
|
|
4426
|
+
let cleanupRef = refCleanups.get(el);
|
|
4427
|
+
if (!cleanupRef) {
|
|
4428
|
+
refCleanups.set(el, cleanupRef = { fn: NOOP });
|
|
4429
|
+
onScopeDispose$1(() => {
|
|
4430
|
+
cleanupRef.fn();
|
|
4431
|
+
refCleanups.delete(el);
|
|
4432
|
+
});
|
|
4433
|
+
}
|
|
4434
|
+
return cleanupRef;
|
|
4435
|
+
}
|
|
4348
4436
|
function createTemplateRefSetter() {
|
|
4349
4437
|
const instance = currentInstance;
|
|
4350
4438
|
return (...args) => setRef(instance, ...args);
|
|
@@ -4355,12 +4443,10 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4355
4443
|
el.setRef(instance, ref, refFor, refKey);
|
|
4356
4444
|
return;
|
|
4357
4445
|
}
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
if (!i.type.__asyncResolved) {
|
|
4363
|
-
frag.setRef = (i2) => setRef(instance, i2, ref, oldRef, refFor);
|
|
4446
|
+
if (isVaporComponent(el) && isAsyncWrapper(el)) {
|
|
4447
|
+
const frag = el.block;
|
|
4448
|
+
if (!el.type.__asyncResolved) {
|
|
4449
|
+
frag.setAsyncRef = (i) => setRef(instance, i, ref, oldRef, refFor);
|
|
4364
4450
|
return;
|
|
4365
4451
|
}
|
|
4366
4452
|
el = frag.nodes;
|
|
@@ -4368,11 +4454,11 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4368
4454
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
4369
4455
|
const refValue = getRefValue(el);
|
|
4370
4456
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
4371
|
-
const canSetSetupRef = createCanSetSetupRefChecker(setupState);
|
|
4457
|
+
const canSetSetupRef = !!(process.env.NODE_ENV !== "production") ? createCanSetSetupRefChecker(setupState) : NO;
|
|
4372
4458
|
if (oldRef != null && oldRef !== ref) {
|
|
4373
4459
|
if (isString(oldRef)) {
|
|
4374
4460
|
refs[oldRef] = null;
|
|
4375
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4461
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(oldRef)) {
|
|
4376
4462
|
setupState[oldRef] = null;
|
|
4377
4463
|
}
|
|
4378
4464
|
} else if (isRef$1(oldRef)) {
|
|
@@ -4387,7 +4473,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4387
4473
|
]);
|
|
4388
4474
|
};
|
|
4389
4475
|
invokeRefSetter(refValue);
|
|
4390
|
-
|
|
4476
|
+
ensureCleanup(el).fn = () => invokeRefSetter(null);
|
|
4391
4477
|
} else {
|
|
4392
4478
|
const _isString = isString(ref);
|
|
4393
4479
|
const _isRef = isRef$1(ref);
|
|
@@ -4424,7 +4510,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4424
4510
|
}
|
|
4425
4511
|
};
|
|
4426
4512
|
queuePostFlushCb(doSet, -1);
|
|
4427
|
-
|
|
4513
|
+
ensureCleanup(el).fn = () => {
|
|
4428
4514
|
queuePostFlushCb(() => {
|
|
4429
4515
|
if (isArray(existing)) {
|
|
4430
4516
|
remove$1(existing, refValue);
|
|
@@ -4438,7 +4524,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4438
4524
|
if (refKey) refs[refKey] = null;
|
|
4439
4525
|
}
|
|
4440
4526
|
});
|
|
4441
|
-
}
|
|
4527
|
+
};
|
|
4442
4528
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
4443
4529
|
warn("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
4444
4530
|
}
|
|
@@ -4454,6 +4540,45 @@ const getRefValue = (el) => {
|
|
|
4454
4540
|
return el;
|
|
4455
4541
|
};
|
|
4456
4542
|
|
|
4543
|
+
function useVaporCssVars(getter) {
|
|
4544
|
+
const instance = currentInstance;
|
|
4545
|
+
baseUseCssVars(
|
|
4546
|
+
instance,
|
|
4547
|
+
() => resolveParentNode(instance.block),
|
|
4548
|
+
getter,
|
|
4549
|
+
(vars) => setVars(instance, vars)
|
|
4550
|
+
);
|
|
4551
|
+
}
|
|
4552
|
+
function resolveParentNode(block) {
|
|
4553
|
+
if (block instanceof Node) {
|
|
4554
|
+
return block.parentNode;
|
|
4555
|
+
} else if (isArray(block)) {
|
|
4556
|
+
return resolveParentNode(block[0]);
|
|
4557
|
+
} else if (isVaporComponent(block)) {
|
|
4558
|
+
return resolveParentNode(block.block);
|
|
4559
|
+
} else {
|
|
4560
|
+
return resolveParentNode(block.nodes);
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
function setVars(instance, vars) {
|
|
4564
|
+
if (instance.ce) {
|
|
4565
|
+
setVarsOnNode(instance.ce, vars);
|
|
4566
|
+
} else {
|
|
4567
|
+
setVarsOnBlock(instance.block, vars);
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
function setVarsOnBlock(block, vars) {
|
|
4571
|
+
if (block instanceof Node) {
|
|
4572
|
+
setVarsOnNode(block, vars);
|
|
4573
|
+
} else if (isArray(block)) {
|
|
4574
|
+
block.forEach((child) => setVarsOnBlock(child, vars));
|
|
4575
|
+
} else if (isVaporComponent(block)) {
|
|
4576
|
+
setVarsOnBlock(block.block, vars);
|
|
4577
|
+
} else {
|
|
4578
|
+
setVarsOnBlock(block.nodes, vars);
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4457
4582
|
function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once) {
|
|
4458
4583
|
const _insertionParent = insertionParent;
|
|
4459
4584
|
const _insertionAnchor = insertionAnchor;
|
|
@@ -4511,24 +4636,21 @@ function applyVShow(target, source) {
|
|
|
4511
4636
|
}
|
|
4512
4637
|
function setDisplay(target, value) {
|
|
4513
4638
|
if (isVaporComponent(target)) {
|
|
4514
|
-
return setDisplay(target, value);
|
|
4639
|
+
return setDisplay(target.block, value);
|
|
4515
4640
|
}
|
|
4516
4641
|
if (isArray(target)) {
|
|
4517
4642
|
if (target.length === 0) return;
|
|
4518
4643
|
if (target.length === 1) return setDisplay(target[0], value);
|
|
4519
4644
|
}
|
|
4520
|
-
if (target
|
|
4521
|
-
return setDisplay(target.nodes, value);
|
|
4522
|
-
}
|
|
4523
|
-
if (target instanceof VaporFragment && target.insert) {
|
|
4645
|
+
if (isFragment(target)) {
|
|
4524
4646
|
return setDisplay(target.nodes, value);
|
|
4525
4647
|
}
|
|
4526
|
-
const { $transition } = target;
|
|
4527
4648
|
if (target instanceof Element) {
|
|
4528
4649
|
const el = target;
|
|
4529
4650
|
if (!(vShowOriginalDisplay in el)) {
|
|
4530
4651
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
4531
4652
|
}
|
|
4653
|
+
const { $transition } = target;
|
|
4532
4654
|
if ($transition) {
|
|
4533
4655
|
if (value) {
|
|
4534
4656
|
$transition.beforeEnter(target);
|
|
@@ -4631,12 +4753,167 @@ const applyDynamicModel = (el, get, set, modifiers) => {
|
|
|
4631
4753
|
};
|
|
4632
4754
|
|
|
4633
4755
|
function withVaporDirectives(node, dirs) {
|
|
4756
|
+
const element = isVaporComponent(node) ? getRootElement(node.block) : node;
|
|
4757
|
+
if (!element) {
|
|
4758
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
4759
|
+
warn(
|
|
4760
|
+
`Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
|
4761
|
+
);
|
|
4762
|
+
}
|
|
4763
|
+
return;
|
|
4764
|
+
}
|
|
4634
4765
|
for (const [dir, value, argument, modifiers] of dirs) {
|
|
4635
4766
|
if (dir) {
|
|
4636
|
-
const ret = dir(
|
|
4767
|
+
const ret = dir(element, value, argument, modifiers);
|
|
4637
4768
|
if (ret) onScopeDispose(ret);
|
|
4638
4769
|
}
|
|
4639
4770
|
}
|
|
4640
4771
|
}
|
|
4641
4772
|
|
|
4642
|
-
|
|
4773
|
+
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
4774
|
+
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
4775
|
+
const decorate = (t) => {
|
|
4776
|
+
delete t.props.mode;
|
|
4777
|
+
t.__vapor = true;
|
|
4778
|
+
return t;
|
|
4779
|
+
};
|
|
4780
|
+
const VaporTransitionGroup = decorate({
|
|
4781
|
+
name: "VaporTransitionGroup",
|
|
4782
|
+
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
4783
|
+
tag: String,
|
|
4784
|
+
moveClass: String
|
|
4785
|
+
}),
|
|
4786
|
+
setup(props, { slots }) {
|
|
4787
|
+
const instance = currentInstance;
|
|
4788
|
+
const state = useTransitionState();
|
|
4789
|
+
const cssTransitionProps = resolveTransitionProps(props);
|
|
4790
|
+
let prevChildren;
|
|
4791
|
+
let children;
|
|
4792
|
+
const slottedBlock = slots.default && slots.default();
|
|
4793
|
+
onBeforeUpdate(() => {
|
|
4794
|
+
prevChildren = [];
|
|
4795
|
+
children = getTransitionBlocks(slottedBlock);
|
|
4796
|
+
if (children) {
|
|
4797
|
+
for (let i = 0; i < children.length; i++) {
|
|
4798
|
+
const child = children[i];
|
|
4799
|
+
if (isValidTransitionBlock(child)) {
|
|
4800
|
+
prevChildren.push(child);
|
|
4801
|
+
child.$transition.disabled = true;
|
|
4802
|
+
positionMap.set(
|
|
4803
|
+
child,
|
|
4804
|
+
getTransitionElement(child).getBoundingClientRect()
|
|
4805
|
+
);
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
}
|
|
4809
|
+
});
|
|
4810
|
+
onUpdated(() => {
|
|
4811
|
+
if (!prevChildren.length) {
|
|
4812
|
+
return;
|
|
4813
|
+
}
|
|
4814
|
+
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
4815
|
+
const firstChild = getFirstConnectedChild(prevChildren);
|
|
4816
|
+
if (!firstChild || !hasCSSTransform(
|
|
4817
|
+
firstChild,
|
|
4818
|
+
firstChild.parentNode,
|
|
4819
|
+
moveClass
|
|
4820
|
+
)) {
|
|
4821
|
+
prevChildren = [];
|
|
4822
|
+
return;
|
|
4823
|
+
}
|
|
4824
|
+
prevChildren.forEach(callPendingCbs);
|
|
4825
|
+
prevChildren.forEach((child) => {
|
|
4826
|
+
child.$transition.disabled = false;
|
|
4827
|
+
recordPosition(child);
|
|
4828
|
+
});
|
|
4829
|
+
const movedChildren = prevChildren.filter(applyTranslation);
|
|
4830
|
+
forceReflow();
|
|
4831
|
+
movedChildren.forEach(
|
|
4832
|
+
(c) => handleMovedChildren(
|
|
4833
|
+
getTransitionElement(c),
|
|
4834
|
+
moveClass
|
|
4835
|
+
)
|
|
4836
|
+
);
|
|
4837
|
+
prevChildren = [];
|
|
4838
|
+
});
|
|
4839
|
+
setTransitionHooksOnFragment(slottedBlock, {
|
|
4840
|
+
props: cssTransitionProps,
|
|
4841
|
+
state,
|
|
4842
|
+
instance
|
|
4843
|
+
});
|
|
4844
|
+
children = getTransitionBlocks(slottedBlock);
|
|
4845
|
+
for (let i = 0; i < children.length; i++) {
|
|
4846
|
+
const child = children[i];
|
|
4847
|
+
if (isValidTransitionBlock(child)) {
|
|
4848
|
+
if (child.$key != null) {
|
|
4849
|
+
const hooks = resolveTransitionHooks(
|
|
4850
|
+
child,
|
|
4851
|
+
cssTransitionProps,
|
|
4852
|
+
state,
|
|
4853
|
+
instance
|
|
4854
|
+
);
|
|
4855
|
+
setTransitionHooks(child, hooks);
|
|
4856
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
4857
|
+
warn(`<transition-group> children must be keyed`);
|
|
4858
|
+
}
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
const tag = props.tag;
|
|
4862
|
+
if (tag) {
|
|
4863
|
+
const container = createElement(tag);
|
|
4864
|
+
insert(slottedBlock, container);
|
|
4865
|
+
return container;
|
|
4866
|
+
} else {
|
|
4867
|
+
return slottedBlock;
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
});
|
|
4871
|
+
function getTransitionBlocks(block) {
|
|
4872
|
+
let children = [];
|
|
4873
|
+
if (block instanceof Node) {
|
|
4874
|
+
children.push(block);
|
|
4875
|
+
} else if (isVaporComponent(block)) {
|
|
4876
|
+
children.push(...getTransitionBlocks(block.block));
|
|
4877
|
+
} else if (isArray(block)) {
|
|
4878
|
+
for (let i = 0; i < block.length; i++) {
|
|
4879
|
+
const b = block[i];
|
|
4880
|
+
const blocks = getTransitionBlocks(b);
|
|
4881
|
+
if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
|
|
4882
|
+
children.push(...blocks);
|
|
4883
|
+
}
|
|
4884
|
+
} else if (isFragment(block)) {
|
|
4885
|
+
if (block.insert) {
|
|
4886
|
+
children.push(block);
|
|
4887
|
+
} else {
|
|
4888
|
+
children.push(...getTransitionBlocks(block.nodes));
|
|
4889
|
+
}
|
|
4890
|
+
}
|
|
4891
|
+
return children;
|
|
4892
|
+
}
|
|
4893
|
+
function isValidTransitionBlock(block) {
|
|
4894
|
+
return !!(block instanceof Element || isFragment(block) && block.insert);
|
|
4895
|
+
}
|
|
4896
|
+
function getTransitionElement(c) {
|
|
4897
|
+
return isFragment(c) ? c.nodes : c;
|
|
4898
|
+
}
|
|
4899
|
+
function recordPosition(c) {
|
|
4900
|
+
newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
|
|
4901
|
+
}
|
|
4902
|
+
function applyTranslation(c) {
|
|
4903
|
+
if (baseApplyTranslation(
|
|
4904
|
+
positionMap.get(c),
|
|
4905
|
+
newPositionMap.get(c),
|
|
4906
|
+
getTransitionElement(c)
|
|
4907
|
+
)) {
|
|
4908
|
+
return c;
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
function getFirstConnectedChild(children) {
|
|
4912
|
+
for (let i = 0; i < children.length; i++) {
|
|
4913
|
+
const child = children[i];
|
|
4914
|
+
const el = getTransitionElement(child);
|
|
4915
|
+
if (el.isConnected) return el;
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
|
|
4919
|
+
export { VaporFragment, VaporKeepAliveImpl as VaporKeepAlive, VaporTeleportImpl as VaporTeleport, VaporTransition, VaporTransitionGroup, applyCheckboxModel, applyDynamicModel, applyRadioModel, applySelectModel, applyTextModel, applyVShow, child, createComponent, createComponentWithFallback, createDynamicComponent, createFor, createForSlots, createIf, createInvoker, createKeyedFragment, createPlainElement, createSlot, createTemplateRefSetter, createTextNode, createVaporApp, createVaporSSRApp, defineVaporAsyncComponent, defineVaporComponent, defineVaporCustomElement, defineVaporSSRCustomElement, delegate, delegateEvents, getDefaultValue, getRestElement, insert, isFragment, isVaporComponent, next, nthChild, on, prepend, remove, renderEffect, setAttr, setBlockHtml, setBlockText, setClass, setDOMProp, setDynamicEvents, setDynamicProps, setElementText, setHtml, setInsertionState, setProp, setStyle, setText, setValue, template, txt, useVaporCssVars, vaporInteropPlugin, withVaporCtx, withVaporDirectives };
|