@vue/runtime-vapor 3.6.0-alpha.5 → 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 +24 -10
- package/dist/runtime-vapor.esm-bundler.js +1579 -1451
- 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,843 +336,338 @@ 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
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
let preserveScope = false;
|
|
738
|
-
if (this.beforeTeardown) {
|
|
739
|
-
preserveScope = this.beforeTeardown.some(
|
|
740
|
-
(hook) => hook(this.current, this.nodes, this.scope)
|
|
741
|
-
);
|
|
742
|
-
}
|
|
743
|
-
if (!preserveScope) {
|
|
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, transition, parent)
|
|
752
|
-
);
|
|
753
|
-
parent && remove(this.nodes, parent);
|
|
754
|
-
if (mode === "out-in") {
|
|
755
|
-
setActiveSub(prevSub);
|
|
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;
|
|
756
573
|
return;
|
|
757
574
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
|
|
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, transition, parent) {
|
|
786
|
-
if (render) {
|
|
787
|
-
const scope = this.getScope && this.getScope(this.current);
|
|
788
|
-
if (scope) {
|
|
789
|
-
this.scope = scope;
|
|
790
|
-
} else {
|
|
791
|
-
this.scope = new EffectScope();
|
|
792
|
-
}
|
|
793
|
-
this.nodes = this.scope.run(render) || [];
|
|
794
|
-
if (transition) {
|
|
795
|
-
this.$transition = applyTransitionHooks(this.nodes, transition);
|
|
796
|
-
}
|
|
797
|
-
if (this.beforeMount) {
|
|
798
|
-
this.beforeMount.forEach(
|
|
799
|
-
(hook) => hook(this.current, this.nodes, this.scope)
|
|
800
|
-
);
|
|
801
|
-
}
|
|
802
|
-
if (parent) {
|
|
803
|
-
insert(this.nodes, parent, this.anchor);
|
|
804
|
-
if (this.anchor.isConnected && this.updated) {
|
|
805
|
-
this.updated.forEach((hook) => hook(this.nodes));
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
} else {
|
|
809
|
-
this.scope = void 0;
|
|
810
|
-
this.nodes = [];
|
|
575
|
+
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
576
|
+
});
|
|
577
|
+
return;
|
|
578
|
+
} else if (!styleHasMismatch(el, value, normalizedValue, true)) {
|
|
579
|
+
el[cacheKey] = normalizedValue;
|
|
580
|
+
return;
|
|
811
581
|
}
|
|
812
582
|
}
|
|
583
|
+
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
813
584
|
}
|
|
814
|
-
function
|
|
815
|
-
if (
|
|
816
|
-
|
|
817
|
-
fragment.fallback = () => {
|
|
818
|
-
const fallbackNodes = originalFallback();
|
|
819
|
-
if (isValidBlock(fallbackNodes)) {
|
|
820
|
-
return fallbackNodes;
|
|
821
|
-
}
|
|
822
|
-
return fallback();
|
|
823
|
-
};
|
|
824
|
-
} else {
|
|
825
|
-
fragment.fallback = fallback;
|
|
585
|
+
function setValue(el, value, forceHydrate = false) {
|
|
586
|
+
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
587
|
+
return;
|
|
826
588
|
}
|
|
827
|
-
|
|
828
|
-
|
|
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;
|
|
829
592
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
if (
|
|
833
|
-
|
|
834
|
-
} else if (fragment instanceof DynamicFragment) {
|
|
835
|
-
fragment.update(fragment.fallback);
|
|
836
|
-
} else ;
|
|
837
|
-
}
|
|
838
|
-
function findInvalidFragment(fragment) {
|
|
839
|
-
if (isValidBlock(fragment.nodes)) return null;
|
|
840
|
-
return isFragment(fragment.nodes) ? findInvalidFragment(fragment.nodes) || fragment : fragment;
|
|
841
|
-
}
|
|
842
|
-
function isFragment(val) {
|
|
843
|
-
return val instanceof VaporFragment;
|
|
844
|
-
}
|
|
845
|
-
function isDynamicFragment(val) {
|
|
846
|
-
return val instanceof DynamicFragment;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
function addEventListener(el, event, handler, options) {
|
|
850
|
-
el.addEventListener(event, handler, options);
|
|
851
|
-
return () => el.removeEventListener(event, handler, options);
|
|
852
|
-
}
|
|
853
|
-
function on(el, event, handler, options = {}) {
|
|
854
|
-
addEventListener(el, event, handler, options);
|
|
855
|
-
if (options.effect) {
|
|
856
|
-
onEffectCleanup(() => {
|
|
857
|
-
el.removeEventListener(event, handler, options);
|
|
858
|
-
});
|
|
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;
|
|
859
597
|
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
const key = `$evt${event}`;
|
|
863
|
-
const existing = el[key];
|
|
864
|
-
if (existing) {
|
|
865
|
-
if (isArray(existing)) {
|
|
866
|
-
existing.push(handler);
|
|
867
|
-
} else {
|
|
868
|
-
el[key] = [existing, handler];
|
|
869
|
-
}
|
|
870
|
-
} else {
|
|
871
|
-
el[key] = handler;
|
|
598
|
+
if (value == null) {
|
|
599
|
+
el.removeAttribute("value");
|
|
872
600
|
}
|
|
873
601
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
if (
|
|
878
|
-
|
|
879
|
-
|
|
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;
|
|
880
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();
|
|
881
617
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
let node = e.composedPath && e.composedPath()[0] || e.target;
|
|
885
|
-
if (e.target !== node) {
|
|
886
|
-
Object.defineProperty(e, "target", {
|
|
887
|
-
configurable: true,
|
|
888
|
-
value: node
|
|
889
|
-
});
|
|
618
|
+
if (el.$txt !== value) {
|
|
619
|
+
el.nodeValue = el.$txt = value;
|
|
890
620
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
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;
|
|
895
629
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
} else {
|
|
908
|
-
handlers(e);
|
|
909
|
-
if (e.cancelBubble) return;
|
|
910
|
-
}
|
|
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();
|
|
911
639
|
}
|
|
912
|
-
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
913
640
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
for (const name in events) {
|
|
917
|
-
on(el, name, events[name], { effect: true });
|
|
641
|
+
if (el.$txt !== value) {
|
|
642
|
+
el.textContent = el.$txt = value;
|
|
918
643
|
}
|
|
919
644
|
}
|
|
920
|
-
function
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
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.`
|
|
927
654
|
);
|
|
928
655
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
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
|
+
}
|
|
934
669
|
} else {
|
|
935
|
-
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
function setAttr(el, key, value, isSVG = false) {
|
|
939
|
-
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
940
|
-
return;
|
|
941
|
-
}
|
|
942
|
-
if (key === "true-value") {
|
|
943
|
-
el._trueValue = value;
|
|
944
|
-
} else if (key === "false-value") {
|
|
945
|
-
el._falseValue = value;
|
|
946
|
-
}
|
|
947
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value)) {
|
|
948
|
-
el[`$${key}`] = value;
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
if (value !== el[`$${key}`]) {
|
|
952
|
-
el[`$${key}`] = value;
|
|
953
|
-
if (isSVG && key.startsWith("xlink:")) {
|
|
954
|
-
if (value != null) {
|
|
955
|
-
el.setAttributeNS(xlinkNS, key, value);
|
|
956
|
-
} else {
|
|
957
|
-
el.removeAttributeNS(xlinkNS, key.slice(6, key.length));
|
|
958
|
-
}
|
|
959
|
-
} else {
|
|
960
|
-
if (value != null) {
|
|
961
|
-
el.setAttribute(key, value);
|
|
962
|
-
} else {
|
|
963
|
-
el.removeAttribute(key);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
function setDOMProp(el, key, value, forceHydrate = false, attrName) {
|
|
969
|
-
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, key, value) && !shouldForceHydrate(el, key) && !forceHydrate) {
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
const prev = el[key];
|
|
976
|
-
if (value === prev) {
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
let needRemove = false;
|
|
980
|
-
if (value === "" || value == null) {
|
|
981
|
-
const type = typeof prev;
|
|
982
|
-
if (type === "boolean") {
|
|
983
|
-
value = includeBooleanAttr(value);
|
|
984
|
-
} else if (value == null && type === "string") {
|
|
985
|
-
value = "";
|
|
986
|
-
needRemove = true;
|
|
987
|
-
} else if (type === "number") {
|
|
988
|
-
value = 0;
|
|
989
|
-
needRemove = true;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
try {
|
|
993
|
-
el[key] = value;
|
|
994
|
-
} catch (e) {
|
|
995
|
-
if (!!(process.env.NODE_ENV !== "production") && !needRemove) {
|
|
996
|
-
warn(
|
|
997
|
-
`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: value ${value} is invalid.`,
|
|
998
|
-
e
|
|
999
|
-
);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
needRemove && el.removeAttribute(attrName || key);
|
|
1003
|
-
}
|
|
1004
|
-
function setClass(el, value, isSVG = false) {
|
|
1005
|
-
if (el.$root) {
|
|
1006
|
-
setClassIncremental(el, value);
|
|
1007
|
-
} else {
|
|
1008
|
-
value = normalizeClass(value);
|
|
1009
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, value, false)) {
|
|
1010
|
-
el.$cls = value;
|
|
1011
|
-
return;
|
|
1012
|
-
}
|
|
1013
|
-
if (value !== el.$cls) {
|
|
1014
|
-
if (isSVG) {
|
|
1015
|
-
el.setAttribute("class", el.$cls = value);
|
|
1016
|
-
} else {
|
|
1017
|
-
el.className = el.$cls = value;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
function setClassIncremental(el, value) {
|
|
1023
|
-
const cacheKey = `$clsi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1024
|
-
const normalizedValue = normalizeClass(value);
|
|
1025
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !classHasMismatch(el, normalizedValue, true)) {
|
|
1026
|
-
el[cacheKey] = normalizedValue;
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
const prev = el[cacheKey];
|
|
1030
|
-
if ((value = el[cacheKey] = normalizedValue) !== prev) {
|
|
1031
|
-
const nextList = value.split(/\s+/);
|
|
1032
|
-
if (value) {
|
|
1033
|
-
el.classList.add(...nextList);
|
|
1034
|
-
}
|
|
1035
|
-
if (prev) {
|
|
1036
|
-
for (const cls of prev.split(/\s+/)) {
|
|
1037
|
-
if (!nextList.includes(cls)) el.classList.remove(cls);
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
function shouldDeferCheckStyleMismatch(el) {
|
|
1043
|
-
return !!(process.env.NODE_ENV !== "production") && (!!currentInstance.getCssVars || Object.values(el.style).some((v) => v.startsWith("--")));
|
|
1044
|
-
}
|
|
1045
|
-
function setStyle(el, value) {
|
|
1046
|
-
if (el.$root) {
|
|
1047
|
-
setStyleIncremental(el, value);
|
|
1048
|
-
} else {
|
|
1049
|
-
const normalizedValue = normalizeStyle(value);
|
|
1050
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating) {
|
|
1051
|
-
if (shouldDeferCheckStyleMismatch(el)) {
|
|
1052
|
-
const instance = currentInstance;
|
|
1053
|
-
queuePostFlushCb(() => {
|
|
1054
|
-
if (!styleHasMismatch(el, value, normalizedValue, false, instance)) {
|
|
1055
|
-
el.$sty = normalizedValue;
|
|
1056
|
-
return;
|
|
1057
|
-
}
|
|
1058
|
-
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
1059
|
-
});
|
|
1060
|
-
return;
|
|
1061
|
-
} else if (!styleHasMismatch(el, value, normalizedValue, false)) {
|
|
1062
|
-
el.$sty = normalizedValue;
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
patchStyle(el, el.$sty, el.$sty = normalizedValue);
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
function setStyleIncremental(el, value) {
|
|
1070
|
-
const cacheKey = `$styi${isApplyingFallthroughProps ? "$" : ""}`;
|
|
1071
|
-
const normalizedValue = isString(value) ? parseStringStyle(value) : normalizeStyle(value);
|
|
1072
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating) {
|
|
1073
|
-
if (shouldDeferCheckStyleMismatch(el)) {
|
|
1074
|
-
const instance = currentInstance;
|
|
1075
|
-
queuePostFlushCb(() => {
|
|
1076
|
-
if (!styleHasMismatch(el, value, normalizedValue, true, instance)) {
|
|
1077
|
-
el[cacheKey] = normalizedValue;
|
|
1078
|
-
return;
|
|
1079
|
-
}
|
|
1080
|
-
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
1081
|
-
});
|
|
1082
|
-
return;
|
|
1083
|
-
} else if (!styleHasMismatch(el, value, normalizedValue, true)) {
|
|
1084
|
-
el[cacheKey] = normalizedValue;
|
|
1085
|
-
return;
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
patchStyle(el, el[cacheKey], el[cacheKey] = normalizedValue);
|
|
1089
|
-
}
|
|
1090
|
-
function setValue(el, value, forceHydrate = false) {
|
|
1091
|
-
if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey("value")) {
|
|
1092
|
-
return;
|
|
1093
|
-
}
|
|
1094
|
-
el._value = value;
|
|
1095
|
-
if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && isHydrating && !attributeHasMismatch(el, "value", getClientText(el, value)) && !shouldForceHydrate(el, "value") && !forceHydrate) {
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
const oldValue = el.tagName === "OPTION" ? el.getAttribute("value") : el.value;
|
|
1099
|
-
const newValue = value == null ? "" : value;
|
|
1100
|
-
if (oldValue !== newValue) {
|
|
1101
|
-
el.value = newValue;
|
|
1102
|
-
}
|
|
1103
|
-
if (value == null) {
|
|
1104
|
-
el.removeAttribute("value");
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
function setText(el, value) {
|
|
1108
|
-
if (isHydrating) {
|
|
1109
|
-
const clientText = getClientText(el.parentNode, value);
|
|
1110
|
-
if (el.nodeValue == clientText) {
|
|
1111
|
-
el.$txt = clientText;
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1115
|
-
`Hydration text mismatch in`,
|
|
1116
|
-
el.parentNode,
|
|
1117
|
-
`
|
|
1118
|
-
- rendered on server: ${JSON.stringify(el.data)}
|
|
1119
|
-
- expected on client: ${JSON.stringify(value)}`
|
|
1120
|
-
);
|
|
1121
|
-
logMismatchError();
|
|
1122
|
-
}
|
|
1123
|
-
if (el.$txt !== value) {
|
|
1124
|
-
el.nodeValue = el.$txt = value;
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
function setElementText(el, value) {
|
|
1128
|
-
value = toDisplayString(value);
|
|
1129
|
-
if (isHydrating) {
|
|
1130
|
-
let clientText = getClientText(el, value);
|
|
1131
|
-
if (el.textContent === clientText) {
|
|
1132
|
-
el.$txt = clientText;
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
if (!isMismatchAllowed(el, 0)) {
|
|
1136
|
-
(!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn(
|
|
1137
|
-
`Hydration text content mismatch on`,
|
|
1138
|
-
el,
|
|
1139
|
-
`
|
|
1140
|
-
- rendered on server: ${el.textContent}
|
|
1141
|
-
- expected on client: ${clientText}`
|
|
1142
|
-
);
|
|
1143
|
-
logMismatchError();
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
if (el.$txt !== value) {
|
|
1147
|
-
el.textContent = el.$txt = value;
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
function setBlockText(block, value) {
|
|
1151
|
-
value = value == null ? "" : value;
|
|
1152
|
-
if (block.$txt !== value) {
|
|
1153
|
-
setTextToBlock(block, block.$txt = value);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
function warnCannotSetProp(prop) {
|
|
1157
|
-
warn(
|
|
1158
|
-
`Extraneous non-props attributes (${prop}) were passed to component but could not be automatically inherited because component renders text or multiple root nodes.`
|
|
1159
|
-
);
|
|
1160
|
-
}
|
|
1161
|
-
function setTextToBlock(block, value) {
|
|
1162
|
-
if (block instanceof Node) {
|
|
1163
|
-
if (block instanceof Element) {
|
|
1164
|
-
block.textContent = value;
|
|
1165
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1166
|
-
warnCannotSetProp("textContent");
|
|
1167
|
-
}
|
|
1168
|
-
} else if (isVaporComponent(block)) {
|
|
1169
|
-
setTextToBlock(block.block, value);
|
|
1170
|
-
} else if (isArray(block)) {
|
|
1171
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1172
|
-
warnCannotSetProp("textContent");
|
|
1173
|
-
}
|
|
1174
|
-
} else {
|
|
1175
|
-
setTextToBlock(block.nodes, value);
|
|
670
|
+
setTextToBlock(block.nodes, value);
|
|
1176
671
|
}
|
|
1177
672
|
}
|
|
1178
673
|
function setHtml(el, value) {
|
|
@@ -1352,199 +847,17 @@ function shouldForceHydrate(el, key) {
|
|
|
1352
847
|
tagName.includes("-");
|
|
1353
848
|
}
|
|
1354
849
|
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
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
|
+
}))();
|
|
1361
858
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
get: getSlot,
|
|
1365
|
-
has: (target, key) => !!getSlot(target, key),
|
|
1366
|
-
getOwnPropertyDescriptor(target, key) {
|
|
1367
|
-
const slot = getSlot(target, key);
|
|
1368
|
-
if (slot) {
|
|
1369
|
-
return {
|
|
1370
|
-
configurable: true,
|
|
1371
|
-
enumerable: true,
|
|
1372
|
-
value: slot
|
|
1373
|
-
};
|
|
1374
|
-
}
|
|
1375
|
-
},
|
|
1376
|
-
ownKeys(target) {
|
|
1377
|
-
let keys = Object.keys(target);
|
|
1378
|
-
const dynamicSources = target.$;
|
|
1379
|
-
if (dynamicSources) {
|
|
1380
|
-
keys = keys.filter((k) => k !== "$");
|
|
1381
|
-
for (const source of dynamicSources) {
|
|
1382
|
-
if (isFunction(source)) {
|
|
1383
|
-
const slot = source();
|
|
1384
|
-
if (isArray(slot)) {
|
|
1385
|
-
for (const s of slot) keys.push(String(s.name));
|
|
1386
|
-
} else {
|
|
1387
|
-
keys.push(String(slot.name));
|
|
1388
|
-
}
|
|
1389
|
-
} else {
|
|
1390
|
-
keys.push(...Object.keys(source));
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
return keys;
|
|
1395
|
-
},
|
|
1396
|
-
set: NO,
|
|
1397
|
-
deleteProperty: NO
|
|
1398
|
-
};
|
|
1399
|
-
function getSlot(target, key) {
|
|
1400
|
-
if (key === "$") return;
|
|
1401
|
-
const dynamicSources = target.$;
|
|
1402
|
-
if (dynamicSources) {
|
|
1403
|
-
let i = dynamicSources.length;
|
|
1404
|
-
let source;
|
|
1405
|
-
while (i--) {
|
|
1406
|
-
source = dynamicSources[i];
|
|
1407
|
-
if (isFunction(source)) {
|
|
1408
|
-
const slot = source();
|
|
1409
|
-
if (slot) {
|
|
1410
|
-
if (isArray(slot)) {
|
|
1411
|
-
for (const s of slot) {
|
|
1412
|
-
if (String(s.name) === key) return s.fn;
|
|
1413
|
-
}
|
|
1414
|
-
} else if (String(slot.name) === key) {
|
|
1415
|
-
return slot.fn;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
} else if (hasOwn(source, key)) {
|
|
1419
|
-
return source[key];
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
if (hasOwn(target, key)) {
|
|
1424
|
-
return target[key];
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
let currentSlotConsumer = null;
|
|
1428
|
-
function setCurrentSlotConsumer(consumer) {
|
|
1429
|
-
try {
|
|
1430
|
-
return currentSlotConsumer;
|
|
1431
|
-
} finally {
|
|
1432
|
-
currentSlotConsumer = consumer;
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
function getParentInstance() {
|
|
1436
|
-
return currentSlotConsumer || currentInstance;
|
|
1437
|
-
}
|
|
1438
|
-
function withVaporCtx(fn) {
|
|
1439
|
-
const owner = currentInstance;
|
|
1440
|
-
return (...args) => {
|
|
1441
|
-
const prev = setCurrentInstance(owner);
|
|
1442
|
-
const prevConsumer = setCurrentSlotConsumer(prev[0]);
|
|
1443
|
-
try {
|
|
1444
|
-
return fn(...args);
|
|
1445
|
-
} finally {
|
|
1446
|
-
setCurrentInstance(...prev);
|
|
1447
|
-
setCurrentSlotConsumer(prevConsumer);
|
|
1448
|
-
}
|
|
1449
|
-
};
|
|
1450
|
-
}
|
|
1451
|
-
function createSlot(name, rawProps, fallback, noSlotted) {
|
|
1452
|
-
const _insertionParent = insertionParent;
|
|
1453
|
-
const _insertionAnchor = insertionAnchor;
|
|
1454
|
-
const _isLastInsertion = isLastInsertion;
|
|
1455
|
-
if (!isHydrating) resetInsertionState();
|
|
1456
|
-
const instance = currentInstance;
|
|
1457
|
-
const rawSlots = instance.rawSlots;
|
|
1458
|
-
const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
|
|
1459
|
-
let fragment;
|
|
1460
|
-
if (isRef(rawSlots._)) {
|
|
1461
|
-
if (isHydrating) locateHydrationNode();
|
|
1462
|
-
fragment = instance.appContext.vapor.vdomSlot(
|
|
1463
|
-
rawSlots._,
|
|
1464
|
-
name,
|
|
1465
|
-
slotProps,
|
|
1466
|
-
instance,
|
|
1467
|
-
fallback
|
|
1468
|
-
);
|
|
1469
|
-
} else {
|
|
1470
|
-
fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
|
|
1471
|
-
const isDynamicName = isFunction(name);
|
|
1472
|
-
const slotScopeIds = [];
|
|
1473
|
-
if (!noSlotted) {
|
|
1474
|
-
const scopeId = instance.type.__scopeId;
|
|
1475
|
-
if (scopeId) {
|
|
1476
|
-
slotScopeIds.push(`${scopeId}-s`);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
const renderSlot = () => {
|
|
1480
|
-
const slotName = isFunction(name) ? name() : name;
|
|
1481
|
-
if (instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce) {
|
|
1482
|
-
const el = createElement("slot");
|
|
1483
|
-
renderEffect(() => {
|
|
1484
|
-
setDynamicProps(el, [
|
|
1485
|
-
slotProps,
|
|
1486
|
-
slotName !== "default" ? { name: slotName } : {}
|
|
1487
|
-
]);
|
|
1488
|
-
});
|
|
1489
|
-
if (fallback) insert(fallback(), el);
|
|
1490
|
-
fragment.nodes = el;
|
|
1491
|
-
return;
|
|
1492
|
-
}
|
|
1493
|
-
const slot = getSlot(rawSlots, slotName);
|
|
1494
|
-
if (slot) {
|
|
1495
|
-
fragment.fallback = fallback;
|
|
1496
|
-
fragment.update(
|
|
1497
|
-
slot._bound || (slot._bound = () => {
|
|
1498
|
-
const prevSlotScopeIds = setCurrentSlotScopeIds(
|
|
1499
|
-
slotScopeIds.length > 0 ? slotScopeIds : null
|
|
1500
|
-
);
|
|
1501
|
-
try {
|
|
1502
|
-
return slot(slotProps);
|
|
1503
|
-
} finally {
|
|
1504
|
-
setCurrentSlotScopeIds(prevSlotScopeIds);
|
|
1505
|
-
}
|
|
1506
|
-
})
|
|
1507
|
-
);
|
|
1508
|
-
} else {
|
|
1509
|
-
fragment.update(fallback);
|
|
1510
|
-
}
|
|
1511
|
-
};
|
|
1512
|
-
if (isDynamicName || rawSlots.$) {
|
|
1513
|
-
renderEffect(renderSlot);
|
|
1514
|
-
} else {
|
|
1515
|
-
renderSlot();
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
if (!isHydrating) {
|
|
1519
|
-
if (!noSlotted) {
|
|
1520
|
-
const scopeId = instance.type.__scopeId;
|
|
1521
|
-
if (scopeId) {
|
|
1522
|
-
setScopeId(fragment, [`${scopeId}-s`]);
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
|
|
1526
|
-
} else {
|
|
1527
|
-
if (fragment.insert) {
|
|
1528
|
-
fragment.hydrate();
|
|
1529
|
-
}
|
|
1530
|
-
if (_isLastInsertion) {
|
|
1531
|
-
advanceHydrationNode(_insertionParent);
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
return fragment;
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1538
|
-
// @__NO_SIDE_EFFECTS__
|
|
1539
|
-
function defineVaporComponent(comp, extraOptions) {
|
|
1540
|
-
if (isFunction(comp)) {
|
|
1541
|
-
return /* @__PURE__ */ (() => extend({ name: comp.name }, extraOptions, {
|
|
1542
|
-
setup: comp,
|
|
1543
|
-
__vapor: true
|
|
1544
|
-
}))();
|
|
1545
|
-
}
|
|
1546
|
-
comp.__vapor = true;
|
|
1547
|
-
return comp;
|
|
859
|
+
comp.__vapor = true;
|
|
860
|
+
return comp;
|
|
1548
861
|
}
|
|
1549
862
|
|
|
1550
863
|
const VaporKeepAliveImpl = defineVaporComponent({
|
|
@@ -1603,7 +916,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
|
|
|
1603
916
|
};
|
|
1604
917
|
const processFragment = (frag) => {
|
|
1605
918
|
const [innerBlock, interop] = getInnerBlock(frag.nodes);
|
|
1606
|
-
if (!innerBlock
|
|
919
|
+
if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
|
|
1607
920
|
if (interop) {
|
|
1608
921
|
if (cache.has(innerBlock.vnode.type)) {
|
|
1609
922
|
innerBlock.vnode.shapeFlag |= 512;
|
|
@@ -1795,9 +1108,18 @@ function findParentKeepAlive(instance) {
|
|
|
1795
1108
|
return null;
|
|
1796
1109
|
}
|
|
1797
1110
|
|
|
1111
|
+
let parentSuspense = null;
|
|
1112
|
+
function setParentSuspense(suspense) {
|
|
1113
|
+
try {
|
|
1114
|
+
return parentSuspense;
|
|
1115
|
+
} finally {
|
|
1116
|
+
parentSuspense = suspense;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1798
1120
|
const interopKey = Symbol(`interop`);
|
|
1799
1121
|
const vaporInteropImpl = {
|
|
1800
|
-
mount(vnode, container, anchor, parentComponent) {
|
|
1122
|
+
mount(vnode, container, anchor, parentComponent, parentSuspense) {
|
|
1801
1123
|
let selfAnchor = vnode.el = vnode.anchor = createTextNode();
|
|
1802
1124
|
if (isHydrating) {
|
|
1803
1125
|
queuePostFlushCb(() => container.insertBefore(selfAnchor, anchor));
|
|
@@ -1814,6 +1136,10 @@ const vaporInteropImpl = {
|
|
|
1814
1136
|
}
|
|
1815
1137
|
const propsRef = shallowRef(props);
|
|
1816
1138
|
const slotsRef = shallowRef(vnode.children);
|
|
1139
|
+
let prevSuspense = null;
|
|
1140
|
+
if (parentSuspense) {
|
|
1141
|
+
prevSuspense = setParentSuspense(parentSuspense);
|
|
1142
|
+
}
|
|
1817
1143
|
const dynamicPropSource = [
|
|
1818
1144
|
() => propsRef.value
|
|
1819
1145
|
];
|
|
@@ -1840,6 +1166,9 @@ const vaporInteropImpl = {
|
|
|
1840
1166
|
vnode.transition
|
|
1841
1167
|
);
|
|
1842
1168
|
}
|
|
1169
|
+
if (parentSuspense) {
|
|
1170
|
+
setParentSuspense(prevSuspense);
|
|
1171
|
+
}
|
|
1843
1172
|
mountComponent(instance, container, selfAnchor);
|
|
1844
1173
|
simpleSetCurrentInstance(prev);
|
|
1845
1174
|
return instance;
|
|
@@ -1855,8 +1184,11 @@ const vaporInteropImpl = {
|
|
|
1855
1184
|
},
|
|
1856
1185
|
unmount(vnode, doRemove) {
|
|
1857
1186
|
const container = doRemove ? vnode.anchor.parentNode : void 0;
|
|
1858
|
-
|
|
1859
|
-
|
|
1187
|
+
const instance = vnode.component;
|
|
1188
|
+
if (instance) {
|
|
1189
|
+
if (instance.block) {
|
|
1190
|
+
unmountComponent(instance, container);
|
|
1191
|
+
}
|
|
1860
1192
|
} else if (vnode.vb) {
|
|
1861
1193
|
remove(vnode.vb, container);
|
|
1862
1194
|
}
|
|
@@ -1888,10 +1220,10 @@ const vaporInteropImpl = {
|
|
|
1888
1220
|
insert(vnode.vb || vnode.component, container, anchor);
|
|
1889
1221
|
insert(vnode.anchor, container, anchor);
|
|
1890
1222
|
},
|
|
1891
|
-
hydrate(vnode, node, container, anchor, parentComponent) {
|
|
1223
|
+
hydrate(vnode, node, container, anchor, parentComponent, parentSuspense) {
|
|
1892
1224
|
hydrateNode(
|
|
1893
1225
|
node,
|
|
1894
|
-
() => this.mount(vnode, container, anchor, parentComponent)
|
|
1226
|
+
() => this.mount(vnode, container, anchor, parentComponent, parentSuspense)
|
|
1895
1227
|
);
|
|
1896
1228
|
return _next(node);
|
|
1897
1229
|
},
|
|
@@ -1959,8 +1291,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1959
1291
|
rawProps,
|
|
1960
1292
|
rawSlots,
|
|
1961
1293
|
parentComponent ? parentComponent.appContext : void 0,
|
|
1962
|
-
void 0
|
|
1963
|
-
parentComponent
|
|
1294
|
+
void 0
|
|
1964
1295
|
);
|
|
1965
1296
|
vnode.vi = (instance) => {
|
|
1966
1297
|
instance.props = shallowReactive(wrapper.props);
|
|
@@ -1995,7 +1326,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
|
|
|
1995
1326
|
isMounted = true;
|
|
1996
1327
|
frag.nodes = vnode.el;
|
|
1997
1328
|
};
|
|
1998
|
-
vnode.scopeId =
|
|
1329
|
+
vnode.scopeId = getCurrentScopeId() || null;
|
|
1999
1330
|
vnode.slotScopeIds = currentSlotScopeIds;
|
|
2000
1331
|
frag.insert = (parentNode, anchor, transition) => {
|
|
2001
1332
|
if (isHydrating) return;
|
|
@@ -2407,129 +1738,819 @@ function hasAttrFromRawProps(rawProps, key) {
|
|
|
2407
1738
|
return true;
|
|
2408
1739
|
}
|
|
2409
1740
|
}
|
|
2410
|
-
}
|
|
2411
|
-
return hasOwn(rawProps, key);
|
|
2412
|
-
}
|
|
2413
|
-
function getKeysFromRawProps(rawProps) {
|
|
2414
|
-
const keys = [];
|
|
2415
|
-
for (const key in rawProps) {
|
|
2416
|
-
if (key !== "$") keys.push(key);
|
|
2417
|
-
}
|
|
2418
|
-
const dynamicSources = rawProps.$;
|
|
2419
|
-
if (dynamicSources) {
|
|
2420
|
-
let i = dynamicSources.length;
|
|
2421
|
-
let source;
|
|
2422
|
-
while (i--) {
|
|
2423
|
-
source = resolveSource(dynamicSources[i]);
|
|
2424
|
-
for (const key in source) {
|
|
2425
|
-
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);
|
|
2426
2472
|
}
|
|
2427
2473
|
}
|
|
2474
|
+
setActiveSub(prevSub);
|
|
2475
|
+
if (isHydrating) this.hydrate();
|
|
2428
2476
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
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));
|
|
2456
2512
|
}
|
|
2457
2513
|
}
|
|
2514
|
+
} else {
|
|
2515
|
+
this.scope = void 0;
|
|
2516
|
+
this.nodes = [];
|
|
2458
2517
|
}
|
|
2459
2518
|
}
|
|
2460
|
-
return false;
|
|
2461
|
-
}
|
|
2462
|
-
function setupPropsValidation(instance) {
|
|
2463
|
-
const rawProps = instance.rawProps;
|
|
2464
|
-
if (!rawProps) return;
|
|
2465
|
-
renderEffect(
|
|
2466
|
-
() => {
|
|
2467
|
-
pushWarningContext(instance);
|
|
2468
|
-
validateProps(
|
|
2469
|
-
resolveDynamicProps(rawProps),
|
|
2470
|
-
instance.props,
|
|
2471
|
-
normalizePropsOptions(instance.type)[0]
|
|
2472
|
-
);
|
|
2473
|
-
popWarningContext();
|
|
2474
|
-
},
|
|
2475
|
-
true
|
|
2476
|
-
/* noLifecycle */
|
|
2477
|
-
);
|
|
2478
2519
|
}
|
|
2479
|
-
function
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
if (props.$) {
|
|
2487
|
-
for (const source of props.$) {
|
|
2488
|
-
const isDynamic = isFunction(source);
|
|
2489
|
-
const resolved = isDynamic ? source() : source;
|
|
2490
|
-
for (const key in resolved) {
|
|
2491
|
-
const value = isDynamic ? resolved[key] : resolved[key]();
|
|
2492
|
-
if (key === "class" || key === "style") {
|
|
2493
|
-
const existing = mergedRawProps[key];
|
|
2494
|
-
if (isArray(existing)) {
|
|
2495
|
-
existing.push(value);
|
|
2496
|
-
} else {
|
|
2497
|
-
mergedRawProps[key] = [existing, value];
|
|
2498
|
-
}
|
|
2499
|
-
} else {
|
|
2500
|
-
mergedRawProps[key] = value;
|
|
2501
|
-
}
|
|
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;
|
|
2502
2527
|
}
|
|
2503
|
-
|
|
2528
|
+
return fallback();
|
|
2529
|
+
};
|
|
2530
|
+
} else {
|
|
2531
|
+
fragment.fallback = fallback;
|
|
2532
|
+
}
|
|
2533
|
+
if (isFragment(fragment.nodes)) {
|
|
2534
|
+
setFragmentFallback(fragment.nodes, fragment.fallback);
|
|
2504
2535
|
}
|
|
2505
|
-
return mergedRawProps;
|
|
2506
2536
|
}
|
|
2507
|
-
function
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
)
|
|
2511
|
-
|
|
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 ;
|
|
2512
2543
|
}
|
|
2513
|
-
function
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
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;
|
|
2518
2553
|
}
|
|
2519
|
-
const rawPropsProxyHandlers = {
|
|
2520
|
-
get: getAttrFromRawProps,
|
|
2521
|
-
has: hasAttrFromRawProps,
|
|
2522
|
-
ownKeys: getKeysFromRawProps,
|
|
2523
|
-
getOwnPropertyDescriptor(target, key) {
|
|
2524
|
-
if (hasAttrFromRawProps(target, key)) {
|
|
2525
|
-
return {
|
|
2526
|
-
configurable: true,
|
|
2527
|
-
enumerable: true,
|
|
2528
|
-
get: () => getAttrFromRawProps(target, key)
|
|
2529
|
-
};
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
};
|
|
2533
2554
|
|
|
2534
2555
|
const VaporTeleportImpl = {
|
|
2535
2556
|
name: "VaporTeleport",
|
|
@@ -2602,7 +2623,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2602
2623
|
setCurrentHydrationNode(targetNode.nextSibling);
|
|
2603
2624
|
}
|
|
2604
2625
|
if (!this.targetAnchor) {
|
|
2605
|
-
this.
|
|
2626
|
+
this.mountChildren(target);
|
|
2606
2627
|
} else {
|
|
2607
2628
|
this.initChildren();
|
|
2608
2629
|
}
|
|
@@ -2672,55 +2693,55 @@ class TeleportFragment extends VaporFragment {
|
|
|
2672
2693
|
remove(this.nodes, this.mountContainer);
|
|
2673
2694
|
insert(this.nodes = children, this.mountContainer, this.mountAnchor);
|
|
2674
2695
|
}
|
|
2675
|
-
|
|
2676
|
-
if (
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
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);
|
|
2680
2719
|
}
|
|
2681
|
-
|
|
2682
|
-
this.
|
|
2683
|
-
this.mountContainer = parent,
|
|
2684
|
-
this.mountAnchor = anchor
|
|
2685
|
-
);
|
|
2686
|
-
};
|
|
2687
|
-
const mountToTarget = () => {
|
|
2688
|
-
const target = this.target = resolveTeleportTarget(
|
|
2689
|
-
this.resolvedProps,
|
|
2690
|
-
querySelector
|
|
2691
|
-
);
|
|
2692
|
-
if (target) {
|
|
2693
|
-
if (
|
|
2694
|
-
// initial mount into target
|
|
2695
|
-
!this.targetAnchor || // target changed
|
|
2696
|
-
this.targetAnchor.parentNode !== target
|
|
2697
|
-
) {
|
|
2698
|
-
insert(this.targetStart = createTextNode(""), target);
|
|
2699
|
-
insert(this.targetAnchor = createTextNode(""), target);
|
|
2700
|
-
}
|
|
2701
|
-
if (this.parentComponent && this.parentComponent.isCE) {
|
|
2702
|
-
(this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2703
|
-
}
|
|
2704
|
-
mount(target, this.targetAnchor);
|
|
2705
|
-
updateCssVars(this);
|
|
2706
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2707
|
-
warn(
|
|
2708
|
-
`Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`,
|
|
2709
|
-
target,
|
|
2710
|
-
`(${typeof target})`
|
|
2711
|
-
);
|
|
2720
|
+
if (this.parentComponent && this.parentComponent.isCE) {
|
|
2721
|
+
(this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
2712
2722
|
}
|
|
2713
|
-
|
|
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;
|
|
2714
2735
|
if (this.isDisabled) {
|
|
2715
|
-
mount(this.parent, this.anchor);
|
|
2736
|
+
this.mount(this.parent, this.anchor);
|
|
2716
2737
|
updateCssVars(this);
|
|
2717
2738
|
} else {
|
|
2718
2739
|
if (isTeleportDeferred(this.resolvedProps) || // force defer when the parent is not connected to the DOM,
|
|
2719
2740
|
// typically due to an early insertion caused by setInsertionState.
|
|
2720
2741
|
!this.parent.isConnected) {
|
|
2721
|
-
queuePostFlushCb(mountToTarget);
|
|
2742
|
+
queuePostFlushCb(this.mountToTarget.bind(this));
|
|
2722
2743
|
} else {
|
|
2723
|
-
mountToTarget();
|
|
2744
|
+
this.mountToTarget();
|
|
2724
2745
|
}
|
|
2725
2746
|
}
|
|
2726
2747
|
}
|
|
@@ -2733,7 +2754,7 @@ class TeleportFragment extends VaporFragment {
|
|
|
2733
2754
|
this.targetAnchor = targetNode && targetNode.nextSibling;
|
|
2734
2755
|
this.initChildren();
|
|
2735
2756
|
}
|
|
2736
|
-
|
|
2757
|
+
mountChildren(target) {
|
|
2737
2758
|
target.appendChild(this.targetStart = createTextNode(""));
|
|
2738
2759
|
target.appendChild(
|
|
2739
2760
|
this.mountAnchor = this.targetAnchor = createTextNode("")
|
|
@@ -3037,10 +3058,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3037
3058
|
} else {
|
|
3038
3059
|
resetInsertionState();
|
|
3039
3060
|
}
|
|
3040
|
-
|
|
3041
|
-
if (
|
|
3042
|
-
|
|
3043
|
-
|
|
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) {
|
|
3044
3069
|
(rawProps.$ || (rawProps.$ = [])).push(
|
|
3045
3070
|
() => attrs
|
|
3046
3071
|
);
|
|
@@ -3048,21 +3073,19 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3048
3073
|
rawProps = { $: [() => attrs] };
|
|
3049
3074
|
}
|
|
3050
3075
|
}
|
|
3051
|
-
if (
|
|
3052
|
-
const cached =
|
|
3076
|
+
if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
|
|
3077
|
+
const cached = currentInstance.getCachedComponent(
|
|
3053
3078
|
component
|
|
3054
3079
|
);
|
|
3055
3080
|
if (cached) return cached;
|
|
3056
3081
|
}
|
|
3057
3082
|
if (appContext.vapor && !component.__vapor) {
|
|
3058
|
-
const prevSlotConsumer2 = setCurrentSlotConsumer(null);
|
|
3059
3083
|
const frag = appContext.vapor.vdomMount(
|
|
3060
3084
|
component,
|
|
3061
|
-
|
|
3085
|
+
currentInstance,
|
|
3062
3086
|
rawProps,
|
|
3063
3087
|
rawSlots
|
|
3064
3088
|
);
|
|
3065
|
-
setCurrentSlotConsumer(prevSlotConsumer2);
|
|
3066
3089
|
if (!isHydrating) {
|
|
3067
3090
|
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3068
3091
|
} else {
|
|
@@ -3090,10 +3113,9 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3090
3113
|
rawProps,
|
|
3091
3114
|
rawSlots,
|
|
3092
3115
|
appContext,
|
|
3093
|
-
once
|
|
3094
|
-
parentInstance
|
|
3116
|
+
once
|
|
3095
3117
|
);
|
|
3096
|
-
const
|
|
3118
|
+
const prevSlotOwner = setCurrentSlotOwner(null);
|
|
3097
3119
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3098
3120
|
registerHMR(instance);
|
|
3099
3121
|
instance.isSingleRoot = isSingleRoot;
|
|
@@ -3133,7 +3155,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3133
3155
|
} else {
|
|
3134
3156
|
setupComponent(instance, component);
|
|
3135
3157
|
}
|
|
3136
|
-
|
|
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);
|
|
3137
3166
|
onScopeDispose$1(() => unmountComponent(instance), true);
|
|
3138
3167
|
if (_insertionParent || isHydrating) {
|
|
3139
3168
|
mountComponent(instance, _insertionParent, _insertionAnchor);
|
|
@@ -3144,6 +3173,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
|
|
|
3144
3173
|
return instance;
|
|
3145
3174
|
}
|
|
3146
3175
|
function setupComponent(instance, component) {
|
|
3176
|
+
var _a;
|
|
3147
3177
|
const prevInstance = setCurrentInstance(instance);
|
|
3148
3178
|
const prevSub = setActiveSub();
|
|
3149
3179
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -3154,49 +3184,44 @@ function setupComponent(instance, component) {
|
|
|
3154
3184
|
instance.props,
|
|
3155
3185
|
instance
|
|
3156
3186
|
]) || EMPTY_OBJ : EMPTY_OBJ;
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
)
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3187
|
+
const isAsyncSetup = isPromise(setupResult);
|
|
3188
|
+
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
|
|
3189
|
+
markAsyncBoundary(instance);
|
|
3190
|
+
}
|
|
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
|
+
}
|
|
3170
3200
|
}
|
|
3171
3201
|
} else {
|
|
3172
|
-
|
|
3173
|
-
instance.block = callWithErrorHandling(
|
|
3174
|
-
component.render,
|
|
3175
|
-
instance,
|
|
3176
|
-
1
|
|
3177
|
-
);
|
|
3178
|
-
} else {
|
|
3179
|
-
instance.block = setupResult;
|
|
3180
|
-
}
|
|
3181
|
-
}
|
|
3182
|
-
if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
|
|
3183
|
-
renderEffect(() => applyFallthroughProps(instance.block, instance.attrs));
|
|
3202
|
+
handleSetupResult(setupResult, component, instance, setupFn);
|
|
3184
3203
|
}
|
|
3185
3204
|
setActiveSub(prevSub);
|
|
3186
3205
|
setCurrentInstance(...prevInstance);
|
|
3187
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3188
|
-
popWarningContext();
|
|
3189
|
-
endMeasure(instance, "init");
|
|
3190
|
-
}
|
|
3191
3206
|
}
|
|
3192
3207
|
let isApplyingFallthroughProps = false;
|
|
3193
|
-
function applyFallthroughProps(
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
}
|
|
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
|
+
});
|
|
3200
3225
|
}
|
|
3201
3226
|
function devRender(instance) {
|
|
3202
3227
|
instance.block = (instance.type.render ? callWithErrorHandling(
|
|
@@ -3231,17 +3256,24 @@ const emptyContext = {
|
|
|
3231
3256
|
provides: /* @__PURE__ */ Object.create(null)
|
|
3232
3257
|
};
|
|
3233
3258
|
class VaporComponentInstance {
|
|
3234
|
-
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;
|
|
3235
3266
|
this.vapor = true;
|
|
3236
3267
|
this.uid = nextUid();
|
|
3237
3268
|
this.type = comp;
|
|
3238
|
-
this.parent =
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
this.appContext =
|
|
3242
|
-
this.provides =
|
|
3243
|
-
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;
|
|
3244
3275
|
} else {
|
|
3276
|
+
this.root = this;
|
|
3245
3277
|
this.appContext = appContext || emptyContext;
|
|
3246
3278
|
this.provides = Object.create(this.appContext.provides);
|
|
3247
3279
|
this.ids = ["", 0, 0];
|
|
@@ -3251,7 +3283,11 @@ class VaporComponentInstance {
|
|
|
3251
3283
|
this.emit = emit.bind(null, this);
|
|
3252
3284
|
this.expose = expose.bind(null, this);
|
|
3253
3285
|
this.refs = EMPTY_OBJ;
|
|
3254
|
-
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;
|
|
3255
3291
|
this.isMounted = this.isUnmounted = this.isUpdating = this.isDeactivated = false;
|
|
3256
3292
|
this.rawProps = rawProps || EMPTY_OBJ;
|
|
3257
3293
|
this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
|
|
@@ -3264,10 +3300,24 @@ class VaporComponentInstance {
|
|
|
3264
3300
|
}
|
|
3265
3301
|
this.rawSlots = rawSlots || EMPTY_OBJ;
|
|
3266
3302
|
this.slots = rawSlots ? rawSlots.$ ? new Proxy(rawSlots, dynamicSlotsProxyHandlers) : rawSlots : EMPTY_OBJ;
|
|
3267
|
-
this.scopeId =
|
|
3303
|
+
this.scopeId = getCurrentScopeId();
|
|
3268
3304
|
if (comp.ce) {
|
|
3269
3305
|
comp.ce(this);
|
|
3270
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
|
+
}
|
|
3271
3321
|
}
|
|
3272
3322
|
/**
|
|
3273
3323
|
* Expose `getKeysFromRawProps` on the instance so it can be used in code
|
|
@@ -3305,7 +3355,7 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
3305
3355
|
const el = isHydrating ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : createElement(comp);
|
|
3306
3356
|
el.$root = isSingleRoot;
|
|
3307
3357
|
if (!isHydrating) {
|
|
3308
|
-
const scopeId =
|
|
3358
|
+
const scopeId = getCurrentScopeId();
|
|
3309
3359
|
if (scopeId) setScopeId(el, [scopeId]);
|
|
3310
3360
|
}
|
|
3311
3361
|
if (rawProps) {
|
|
@@ -3343,6 +3393,19 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
|
|
|
3343
3393
|
return el;
|
|
3344
3394
|
}
|
|
3345
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
|
+
}
|
|
3346
3409
|
if (instance.shapeFlag & 512) {
|
|
3347
3410
|
findParentKeepAlive(instance).activate(instance, parent, anchor);
|
|
3348
3411
|
return;
|
|
@@ -3398,15 +3461,22 @@ function getExposed(instance) {
|
|
|
3398
3461
|
}));
|
|
3399
3462
|
}
|
|
3400
3463
|
}
|
|
3401
|
-
function getRootElement(block) {
|
|
3464
|
+
function getRootElement(block, onDynamicFragment, recurse = true) {
|
|
3402
3465
|
if (block instanceof Element) {
|
|
3403
3466
|
return block;
|
|
3404
3467
|
}
|
|
3405
|
-
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
|
+
}
|
|
3406
3475
|
const { nodes } = block;
|
|
3407
3476
|
if (nodes instanceof Element && nodes.$root) {
|
|
3408
3477
|
return nodes;
|
|
3409
3478
|
}
|
|
3479
|
+
return getRootElement(nodes, onDynamicFragment, recurse);
|
|
3410
3480
|
}
|
|
3411
3481
|
if (isArray(block)) {
|
|
3412
3482
|
let singleRoot;
|
|
@@ -3416,7 +3486,7 @@ function getRootElement(block) {
|
|
|
3416
3486
|
hasComment = true;
|
|
3417
3487
|
continue;
|
|
3418
3488
|
}
|
|
3419
|
-
const thisRoot = getRootElement(b);
|
|
3489
|
+
const thisRoot = getRootElement(b, onDynamicFragment, recurse);
|
|
3420
3490
|
if (!thisRoot || singleRoot) {
|
|
3421
3491
|
return;
|
|
3422
3492
|
}
|
|
@@ -3425,6 +3495,69 @@ function getRootElement(block) {
|
|
|
3425
3495
|
return hasComment ? singleRoot : void 0;
|
|
3426
3496
|
}
|
|
3427
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
|
+
}
|
|
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;
|
|
3560
|
+
}
|
|
3428
3561
|
|
|
3429
3562
|
let _createApp;
|
|
3430
3563
|
const mountApp = (app, container) => {
|
|
@@ -3625,7 +3758,7 @@ function createInnerComp(comp, parent, frag) {
|
|
|
3625
3758
|
appContext
|
|
3626
3759
|
);
|
|
3627
3760
|
if ($transition) setTransitionHooks(instance, $transition);
|
|
3628
|
-
frag && frag.
|
|
3761
|
+
frag && frag.setAsyncRef && frag.setAsyncRef(instance);
|
|
3629
3762
|
return instance;
|
|
3630
3763
|
}
|
|
3631
3764
|
|
|
@@ -3741,247 +3874,84 @@ class VaporElement extends VueElementBase {
|
|
|
3741
3874
|
createComponent(
|
|
3742
3875
|
this._def,
|
|
3743
3876
|
this._props,
|
|
3744
|
-
void 0,
|
|
3745
|
-
void 0,
|
|
3746
|
-
void 0,
|
|
3747
|
-
this._app._context
|
|
3748
|
-
);
|
|
3749
|
-
}
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
let t;
|
|
3753
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
3754
|
-
// @__NO_SIDE_EFFECTS__
|
|
3755
|
-
function template(html, root, ns) {
|
|
3756
|
-
let node;
|
|
3757
|
-
return () => {
|
|
3758
|
-
if (isHydrating) {
|
|
3759
|
-
const adopted = adoptTemplate(currentHydrationNode, html);
|
|
3760
|
-
if (root) adopted.$root = true;
|
|
3761
|
-
return adopted;
|
|
3762
|
-
}
|
|
3763
|
-
if (html[0] !== "<") {
|
|
3764
|
-
return createTextNode(html);
|
|
3765
|
-
}
|
|
3766
|
-
if (!node) {
|
|
3767
|
-
t = t || document.createElement("template");
|
|
3768
|
-
if (ns) {
|
|
3769
|
-
const tag = ns === 1 ? "svg" : "math";
|
|
3770
|
-
t.innerHTML = `<${tag}>${html}</${tag}>`;
|
|
3771
|
-
node = _child(_child(t.content));
|
|
3772
|
-
} else {
|
|
3773
|
-
t.innerHTML = html;
|
|
3774
|
-
node = _child(t.content);
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
const ret = node.cloneNode(true);
|
|
3778
|
-
if (root) ret.$root = true;
|
|
3779
|
-
return ret;
|
|
3780
|
-
};
|
|
3781
|
-
}
|
|
3782
|
-
|
|
3783
|
-
function createIf(condition, b1, b2, once) {
|
|
3784
|
-
const _insertionParent = insertionParent;
|
|
3785
|
-
const _insertionAnchor = insertionAnchor;
|
|
3786
|
-
const _isLastInsertion = isLastInsertion;
|
|
3787
|
-
if (!isHydrating) resetInsertionState();
|
|
3788
|
-
let frag;
|
|
3789
|
-
if (once) {
|
|
3790
|
-
frag = condition() ? b1() : b2 ? b2() : [];
|
|
3791
|
-
} else {
|
|
3792
|
-
frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
|
|
3793
|
-
renderEffect(() => frag.update(condition() ? b1 : b2));
|
|
3794
|
-
}
|
|
3795
|
-
if (!isHydrating) {
|
|
3796
|
-
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3797
|
-
} else {
|
|
3798
|
-
if (_isLastInsertion) {
|
|
3799
|
-
advanceHydrationNode(_insertionParent);
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
return frag;
|
|
3803
|
-
}
|
|
3804
|
-
|
|
3805
|
-
function createKeyedFragment(key, render) {
|
|
3806
|
-
const _insertionParent = insertionParent;
|
|
3807
|
-
const _insertionAnchor = insertionAnchor;
|
|
3808
|
-
const _isLastInsertion = isLastInsertion;
|
|
3809
|
-
if (!isHydrating) resetInsertionState();
|
|
3810
|
-
const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
|
|
3811
|
-
renderEffect(() => {
|
|
3812
|
-
frag.update(render, key());
|
|
3813
|
-
});
|
|
3814
|
-
if (!isHydrating) {
|
|
3815
|
-
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3816
|
-
} else {
|
|
3817
|
-
if (_isLastInsertion) {
|
|
3818
|
-
advanceHydrationNode(_insertionParent);
|
|
3819
|
-
}
|
|
3820
|
-
}
|
|
3821
|
-
return frag;
|
|
3822
|
-
}
|
|
3823
|
-
|
|
3824
|
-
const positionMap = /* @__PURE__ */ new WeakMap();
|
|
3825
|
-
const newPositionMap = /* @__PURE__ */ new WeakMap();
|
|
3826
|
-
const decorate = (t) => {
|
|
3827
|
-
delete t.props.mode;
|
|
3828
|
-
t.__vapor = true;
|
|
3829
|
-
return t;
|
|
3830
|
-
};
|
|
3831
|
-
const VaporTransitionGroup = decorate({
|
|
3832
|
-
name: "VaporTransitionGroup",
|
|
3833
|
-
props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
|
|
3834
|
-
tag: String,
|
|
3835
|
-
moveClass: String
|
|
3836
|
-
}),
|
|
3837
|
-
setup(props, { slots }) {
|
|
3838
|
-
const instance = currentInstance;
|
|
3839
|
-
const state = useTransitionState();
|
|
3840
|
-
const cssTransitionProps = resolveTransitionProps(props);
|
|
3841
|
-
let prevChildren;
|
|
3842
|
-
let children;
|
|
3843
|
-
const slottedBlock = slots.default && slots.default();
|
|
3844
|
-
onBeforeUpdate(() => {
|
|
3845
|
-
prevChildren = [];
|
|
3846
|
-
children = getTransitionBlocks(slottedBlock);
|
|
3847
|
-
if (children) {
|
|
3848
|
-
for (let i = 0; i < children.length; i++) {
|
|
3849
|
-
const child = children[i];
|
|
3850
|
-
if (isValidTransitionBlock(child)) {
|
|
3851
|
-
prevChildren.push(child);
|
|
3852
|
-
child.$transition.disabled = true;
|
|
3853
|
-
positionMap.set(
|
|
3854
|
-
child,
|
|
3855
|
-
getTransitionElement(child).getBoundingClientRect()
|
|
3856
|
-
);
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
}
|
|
3860
|
-
});
|
|
3861
|
-
onUpdated(() => {
|
|
3862
|
-
if (!prevChildren.length) {
|
|
3863
|
-
return;
|
|
3864
|
-
}
|
|
3865
|
-
const moveClass = props.moveClass || `${props.name || "v"}-move`;
|
|
3866
|
-
const firstChild = getFirstConnectedChild(prevChildren);
|
|
3867
|
-
if (!firstChild || !hasCSSTransform(
|
|
3868
|
-
firstChild,
|
|
3869
|
-
firstChild.parentNode,
|
|
3870
|
-
moveClass
|
|
3871
|
-
)) {
|
|
3872
|
-
prevChildren = [];
|
|
3873
|
-
return;
|
|
3874
|
-
}
|
|
3875
|
-
prevChildren.forEach(callPendingCbs);
|
|
3876
|
-
prevChildren.forEach((child) => {
|
|
3877
|
-
child.$transition.disabled = false;
|
|
3878
|
-
recordPosition(child);
|
|
3879
|
-
});
|
|
3880
|
-
const movedChildren = prevChildren.filter(applyTranslation);
|
|
3881
|
-
forceReflow();
|
|
3882
|
-
movedChildren.forEach(
|
|
3883
|
-
(c) => handleMovedChildren(
|
|
3884
|
-
getTransitionElement(c),
|
|
3885
|
-
moveClass
|
|
3886
|
-
)
|
|
3887
|
-
);
|
|
3888
|
-
prevChildren = [];
|
|
3889
|
-
});
|
|
3890
|
-
setTransitionHooksOnFragment(slottedBlock, {
|
|
3891
|
-
props: cssTransitionProps,
|
|
3892
|
-
state,
|
|
3893
|
-
instance,
|
|
3894
|
-
group: true
|
|
3895
|
-
});
|
|
3896
|
-
children = getTransitionBlocks(slottedBlock);
|
|
3897
|
-
for (let i = 0; i < children.length; i++) {
|
|
3898
|
-
const child = children[i];
|
|
3899
|
-
if (isValidTransitionBlock(child)) {
|
|
3900
|
-
if (child.$key != null) {
|
|
3901
|
-
const hooks = resolveTransitionHooks(
|
|
3902
|
-
child,
|
|
3903
|
-
cssTransitionProps,
|
|
3904
|
-
state,
|
|
3905
|
-
instance
|
|
3906
|
-
);
|
|
3907
|
-
hooks.group = true;
|
|
3908
|
-
setTransitionHooks(child, hooks);
|
|
3909
|
-
} else if (!!(process.env.NODE_ENV !== "production") && child.$key == null) {
|
|
3910
|
-
warn(`<transition-group> children must be keyed`);
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
|
-
}
|
|
3914
|
-
const tag = props.tag;
|
|
3915
|
-
if (tag) {
|
|
3916
|
-
const container = createElement(tag);
|
|
3917
|
-
insert(slottedBlock, container);
|
|
3918
|
-
if (instance.hasFallthrough) {
|
|
3919
|
-
container.$root = true;
|
|
3920
|
-
renderEffect(() => applyFallthroughProps(container, instance.attrs));
|
|
3921
|
-
}
|
|
3922
|
-
return container;
|
|
3923
|
-
} else {
|
|
3924
|
-
return slottedBlock;
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
});
|
|
3928
|
-
function getTransitionBlocks(block) {
|
|
3929
|
-
let children = [];
|
|
3930
|
-
if (block instanceof Node) {
|
|
3931
|
-
children.push(block);
|
|
3932
|
-
} else if (isVaporComponent(block)) {
|
|
3933
|
-
children.push(...getTransitionBlocks(block.block));
|
|
3934
|
-
} else if (isArray(block)) {
|
|
3935
|
-
for (let i = 0; i < block.length; i++) {
|
|
3936
|
-
const b = block[i];
|
|
3937
|
-
const blocks = getTransitionBlocks(b);
|
|
3938
|
-
if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
|
|
3939
|
-
children.push(...blocks);
|
|
3940
|
-
}
|
|
3941
|
-
} else if (isFragment(block)) {
|
|
3942
|
-
if (block.insert) {
|
|
3943
|
-
children.push(block);
|
|
3944
|
-
} else {
|
|
3945
|
-
children.push(...getTransitionBlocks(block.nodes));
|
|
3946
|
-
}
|
|
3877
|
+
void 0,
|
|
3878
|
+
void 0,
|
|
3879
|
+
void 0,
|
|
3880
|
+
this._app._context
|
|
3881
|
+
);
|
|
3947
3882
|
}
|
|
3948
|
-
return children;
|
|
3949
|
-
}
|
|
3950
|
-
function isValidTransitionBlock(block) {
|
|
3951
|
-
return !!(block instanceof Element || isFragment(block) && block.insert);
|
|
3952
|
-
}
|
|
3953
|
-
function getTransitionElement(c) {
|
|
3954
|
-
return isFragment(c) ? c.nodes : c;
|
|
3955
3883
|
}
|
|
3956
|
-
|
|
3957
|
-
|
|
3884
|
+
|
|
3885
|
+
let t;
|
|
3886
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
3887
|
+
// @__NO_SIDE_EFFECTS__
|
|
3888
|
+
function template(html, root, ns) {
|
|
3889
|
+
let node;
|
|
3890
|
+
return () => {
|
|
3891
|
+
if (isHydrating) {
|
|
3892
|
+
const adopted = adoptTemplate(currentHydrationNode, html);
|
|
3893
|
+
if (root) adopted.$root = true;
|
|
3894
|
+
return adopted;
|
|
3895
|
+
}
|
|
3896
|
+
if (html[0] !== "<") {
|
|
3897
|
+
return createTextNode(html);
|
|
3898
|
+
}
|
|
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
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
const ret = node.cloneNode(true);
|
|
3911
|
+
if (root) ret.$root = true;
|
|
3912
|
+
return ret;
|
|
3913
|
+
};
|
|
3958
3914
|
}
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
))
|
|
3965
|
-
|
|
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));
|
|
3966
3927
|
}
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3928
|
+
if (!isHydrating) {
|
|
3929
|
+
if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
|
|
3930
|
+
} else {
|
|
3931
|
+
if (_isLastInsertion) {
|
|
3932
|
+
advanceHydrationNode(_insertionParent);
|
|
3933
|
+
}
|
|
3973
3934
|
}
|
|
3935
|
+
return frag;
|
|
3974
3936
|
}
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
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
|
+
}
|
|
3984
3953
|
}
|
|
3954
|
+
return frag;
|
|
3985
3955
|
}
|
|
3986
3956
|
|
|
3987
3957
|
class ForBlock extends VaporFragment {
|
|
@@ -4026,10 +3996,6 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4026
3996
|
const oldLength = oldBlocks.length;
|
|
4027
3997
|
newBlocks = new Array(newLength);
|
|
4028
3998
|
let isFallback = false;
|
|
4029
|
-
const transitionHooks = frag.$transition;
|
|
4030
|
-
if (transitionHooks && transitionHooks.group && isMounted) {
|
|
4031
|
-
triggerTransitionGroupUpdate(transitionHooks);
|
|
4032
|
-
}
|
|
4033
3999
|
const prevSub = setActiveSub();
|
|
4034
4000
|
if (!isMounted) {
|
|
4035
4001
|
isMounted = true;
|
|
@@ -4274,7 +4240,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
|
|
|
4274
4240
|
key2
|
|
4275
4241
|
);
|
|
4276
4242
|
if (frag.$transition) {
|
|
4277
|
-
applyTransitionHooks(block.nodes, frag.$transition
|
|
4243
|
+
applyTransitionHooks(block.nodes, frag.$transition);
|
|
4278
4244
|
}
|
|
4279
4245
|
if (parent) insert(block.nodes, parent, anchor);
|
|
4280
4246
|
return block;
|
|
@@ -4455,6 +4421,18 @@ function isForBlock(block) {
|
|
|
4455
4421
|
return block instanceof ForBlock;
|
|
4456
4422
|
}
|
|
4457
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
|
+
}
|
|
4458
4436
|
function createTemplateRefSetter() {
|
|
4459
4437
|
const instance = currentInstance;
|
|
4460
4438
|
return (...args) => setRef(instance, ...args);
|
|
@@ -4465,12 +4443,10 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4465
4443
|
el.setRef(instance, ref, refFor, refKey);
|
|
4466
4444
|
return;
|
|
4467
4445
|
}
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
if (!i.type.__asyncResolved) {
|
|
4473
|
-
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);
|
|
4474
4450
|
return;
|
|
4475
4451
|
}
|
|
4476
4452
|
el = frag.nodes;
|
|
@@ -4478,11 +4454,11 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4478
4454
|
const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
|
|
4479
4455
|
const refValue = getRefValue(el);
|
|
4480
4456
|
const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
|
|
4481
|
-
const canSetSetupRef = createCanSetSetupRefChecker(setupState);
|
|
4457
|
+
const canSetSetupRef = !!(process.env.NODE_ENV !== "production") ? createCanSetSetupRefChecker(setupState) : NO;
|
|
4482
4458
|
if (oldRef != null && oldRef !== ref) {
|
|
4483
4459
|
if (isString(oldRef)) {
|
|
4484
4460
|
refs[oldRef] = null;
|
|
4485
|
-
if (!!(process.env.NODE_ENV !== "production") &&
|
|
4461
|
+
if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(oldRef)) {
|
|
4486
4462
|
setupState[oldRef] = null;
|
|
4487
4463
|
}
|
|
4488
4464
|
} else if (isRef$1(oldRef)) {
|
|
@@ -4497,7 +4473,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4497
4473
|
]);
|
|
4498
4474
|
};
|
|
4499
4475
|
invokeRefSetter(refValue);
|
|
4500
|
-
|
|
4476
|
+
ensureCleanup(el).fn = () => invokeRefSetter(null);
|
|
4501
4477
|
} else {
|
|
4502
4478
|
const _isString = isString(ref);
|
|
4503
4479
|
const _isRef = isRef$1(ref);
|
|
@@ -4534,7 +4510,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4534
4510
|
}
|
|
4535
4511
|
};
|
|
4536
4512
|
queuePostFlushCb(doSet, -1);
|
|
4537
|
-
|
|
4513
|
+
ensureCleanup(el).fn = () => {
|
|
4538
4514
|
queuePostFlushCb(() => {
|
|
4539
4515
|
if (isArray(existing)) {
|
|
4540
4516
|
remove$1(existing, refValue);
|
|
@@ -4548,7 +4524,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
|
|
|
4548
4524
|
if (refKey) refs[refKey] = null;
|
|
4549
4525
|
}
|
|
4550
4526
|
});
|
|
4551
|
-
}
|
|
4527
|
+
};
|
|
4552
4528
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
4553
4529
|
warn("Invalid template ref type:", ref, `(${typeof ref})`);
|
|
4554
4530
|
}
|
|
@@ -4666,18 +4642,15 @@ function setDisplay(target, value) {
|
|
|
4666
4642
|
if (target.length === 0) return;
|
|
4667
4643
|
if (target.length === 1) return setDisplay(target[0], value);
|
|
4668
4644
|
}
|
|
4669
|
-
if (target
|
|
4670
|
-
return setDisplay(target.nodes, value);
|
|
4671
|
-
}
|
|
4672
|
-
if (target instanceof VaporFragment && target.insert) {
|
|
4645
|
+
if (isFragment(target)) {
|
|
4673
4646
|
return setDisplay(target.nodes, value);
|
|
4674
4647
|
}
|
|
4675
|
-
const { $transition } = target;
|
|
4676
4648
|
if (target instanceof Element) {
|
|
4677
4649
|
const el = target;
|
|
4678
4650
|
if (!(vShowOriginalDisplay in el)) {
|
|
4679
4651
|
el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
|
|
4680
4652
|
}
|
|
4653
|
+
const { $transition } = target;
|
|
4681
4654
|
if ($transition) {
|
|
4682
4655
|
if (value) {
|
|
4683
4656
|
$transition.beforeEnter(target);
|
|
@@ -4780,12 +4753,167 @@ const applyDynamicModel = (el, get, set, modifiers) => {
|
|
|
4780
4753
|
};
|
|
4781
4754
|
|
|
4782
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
|
+
}
|
|
4783
4765
|
for (const [dir, value, argument, modifiers] of dirs) {
|
|
4784
4766
|
if (dir) {
|
|
4785
|
-
const ret = dir(
|
|
4767
|
+
const ret = dir(element, value, argument, modifiers);
|
|
4786
4768
|
if (ret) onScopeDispose(ret);
|
|
4787
4769
|
}
|
|
4788
4770
|
}
|
|
4789
4771
|
}
|
|
4790
4772
|
|
|
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
|
+
|
|
4791
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 };
|