@vue/runtime-vapor 3.6.0-alpha.5 → 3.6.0-alpha.7

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @vue/runtime-vapor v3.6.0-alpha.5
2
+ * @vue/runtime-vapor v3.6.0-alpha.7
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { isMismatchAllowed, warn, currentInstance, startMeasure, setCurrentInstance, queuePostFlushCb, queueJob, TransitionPropsValidators, leaveCbKey, isAsyncWrapper, getComponentName, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, callWithAsyncErrorHandling, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, isRef, watch, onMounted, onUpdated, onBeforeUnmount, 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, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, markAsyncBoundary, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation, createCanSetSetupRefChecker, baseUseCssVars, setVarsOnNode, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected } from '@vue/runtime-dom';
7
- import { invokeArrayFns, isArray, extend, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, normalizeCssVarValue, getEscapedCssVarName, EMPTY_OBJ, isFunction, NO, hasOwn, isReservedProp, EMPTY_ARR, YES, getGlobalThis, isPlainObject, isObject, remove as remove$1, looseEqual } from '@vue/shared';
8
- import { ReactiveEffect, setActiveSub, EffectScope, onEffectCleanup, pauseTracking, resetTracking, onScopeDispose as onScopeDispose$1, markRaw, unref, proxyRefs, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
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, computed, 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,855 +336,350 @@ function updateLastLogicalChild(parent, child2) {
336
336
  parent.$llc = child2;
337
337
  }
338
338
 
339
- class RenderEffect extends ReactiveEffect {
340
- constructor(render) {
341
- super();
342
- this.render = render;
343
- const instance = currentInstance;
344
- if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
345
- warn("renderEffect called without active EffectScope or Vapor instance.");
346
- }
347
- const job = () => {
348
- if (this.dirty) {
349
- this.run();
350
- }
351
- };
352
- this.updateJob = () => {
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
- fn() {
370
- const instance = this.i;
371
- const scope = this.subs ? this.subs.sub : void 0;
372
- const hasUpdateHooks = instance && (instance.bu || instance.u);
373
- if (!!(process.env.NODE_ENV !== "production") && instance) {
374
- startMeasure(instance, `renderEffect`);
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
- this.render();
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
- function renderEffect(fn, noLifecycle = false) {
398
- const effect = new RenderEffect(fn);
399
- if (noLifecycle) {
400
- effect.fn = fn;
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 VaporTransition = /* @__PURE__ */ decorate$1(
413
- (props, { slots, attrs }) => {
414
- let resetDisplay;
415
- if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
416
- const {
417
- content: { firstChild },
418
- parentNode
419
- } = currentHydrationNode;
420
- if (firstChild) {
421
- if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
422
- const originalDisplay = firstChild.style.display;
423
- firstChild.style.display = "none";
424
- resetDisplay = () => firstChild.style.display = originalDisplay;
425
- }
426
- parentNode.replaceChild(firstChild, currentHydrationNode);
427
- setCurrentHydrationNode(firstChild);
428
- }
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
- const children = slots.default && slots.default();
431
- if (!children) return;
432
- const instance = currentInstance;
433
- const { mode } = props;
434
- checkTransitionMode(mode);
435
- let resolvedProps;
436
- let isMounted = false;
437
- renderEffect(() => {
438
- resolvedProps = resolveTransitionProps(props);
439
- if (isMounted) {
440
- if (isFragment(children)) {
441
- children.$transition.props = resolvedProps;
442
- } else {
443
- const child = findTransitionBlock(children);
444
- if (child) {
445
- child.$transition.props = resolvedProps;
446
- applyTransitionHooks(child, child.$transition, void 0, true);
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
- isMounted = true;
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
- return children;
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 resolveTransitionHooks(block, props, state, instance, postClone) {
516
- const context = getTransitionHooksContext(
517
- String(block.$key),
518
- props,
519
- state,
520
- instance,
521
- postClone
522
- );
523
- const hooks = baseResolveTransitionHooks(
524
- context,
525
- props,
526
- state,
527
- instance
410
+ function setDynamicEvents(el, events) {
411
+ for (const name in events) {
412
+ on(el, name, events[name], { effect: true });
413
+ }
414
+ }
415
+ function createInvoker(handler) {
416
+ const i = currentInstance;
417
+ return (...args) => callWithAsyncErrorHandling(
418
+ handler,
419
+ i,
420
+ 5,
421
+ args
528
422
  );
529
- hooks.state = state;
530
- hooks.props = props;
531
- hooks.instance = instance;
532
- return hooks;
533
423
  }
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
- }
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);
542
431
  }
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;
432
+ }
433
+ function setAttr(el, key, value, isSVG = false) {
434
+ if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
435
+ return;
548
436
  }
549
- const { props, instance, state, delayedLeave, group } = hooks;
550
- let resolvedHooks = resolveTransitionHooks(
551
- child,
552
- props,
553
- state,
554
- instance,
555
- (hooks2) => resolvedHooks = hooks2
556
- );
557
- resolvedHooks.delayedLeave = delayedLeave;
558
- resolvedHooks.group = group;
559
- child.$transition = resolvedHooks;
560
- if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
561
- if (fallthroughAttrs && instance.hasFallthrough) {
562
- child.$root = true;
563
- applyFallthroughProps(child, instance.attrs);
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
+ }
454
+ } else {
455
+ if (value != null) {
456
+ el.setAttribute(key, value);
457
+ } else {
458
+ el.removeAttribute(key);
459
+ }
460
+ }
564
461
  }
565
- return resolvedHooks;
566
462
  }
567
- function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
568
- const leavingBlock = findTransitionBlock(block);
569
- if (!leavingBlock) return void 0;
570
- const { props, state, instance } = enterHooks;
571
- const leavingHooks = resolveTransitionHooks(
572
- leavingBlock,
573
- props,
574
- state,
575
- instance
576
- );
577
- leavingBlock.$transition = leavingHooks;
578
- const { mode } = props;
579
- if (mode === "out-in") {
580
- state.isLeaving = true;
581
- leavingHooks.afterLeave = () => {
582
- state.isLeaving = false;
583
- afterLeaveCb();
584
- leavingBlock.$transition = void 0;
585
- delete leavingHooks.afterLeave;
586
- };
587
- } else if (mode === "in-out") {
588
- leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
589
- state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
590
- block2[leaveCbKey] = () => {
591
- earlyRemove();
592
- block2[leaveCbKey] = void 0;
593
- leavingBlock.$transition = void 0;
594
- delete enterHooks.delayedLeave;
595
- };
596
- enterHooks.delayedLeave = () => {
597
- delayedLeave();
598
- leavingBlock.$transition = void 0;
599
- delete enterHooks.delayedLeave;
600
- };
601
- };
463
+ function setDOMProp(el, key, value, forceHydrate = false, attrName) {
464
+ if (!isApplyingFallthroughProps && el.$root && hasFallthroughKey(key)) {
465
+ return;
602
466
  }
603
- }
604
- function findTransitionBlock(block, inFragment = false) {
605
- let child;
606
- if (block instanceof Node) {
607
- if (block instanceof Element) child = block;
608
- } else if (isVaporComponent(block)) {
609
- if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
610
- child = block;
611
- } else {
612
- if (getComponentName(block.type) === displayName) return void 0;
613
- child = findTransitionBlock(block.block, inFragment);
614
- if (child && child.$key === void 0) child.$key = block.uid;
615
- }
616
- } else if (isArray(block)) {
617
- let hasFound = false;
618
- for (const c of block) {
619
- if (c instanceof Comment) continue;
620
- if (isFragment(c)) inFragment = true;
621
- const item = findTransitionBlock(c, inFragment);
622
- if (!!(process.env.NODE_ENV !== "production") && hasFound) {
623
- warn(
624
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
625
- );
626
- break;
627
- }
628
- child = item;
629
- hasFound = true;
630
- if (!!!(process.env.NODE_ENV !== "production")) break;
631
- }
632
- } else if (isFragment(block)) {
633
- inFragment = true;
634
- if (block.insert) {
635
- child = block;
636
- } else {
637
- child = findTransitionBlock(block.nodes, true);
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
- if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
641
- warn("Transition component has no valid child element");
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
- return child;
497
+ needRemove && el.removeAttribute(attrName || key);
644
498
  }
645
- function setTransitionHooksOnFragment(block, hooks) {
646
- if (isFragment(block)) {
647
- block.$transition = hooks;
648
- if (block.nodes && isFragment(block.nodes)) {
649
- setTransitionHooksOnFragment(block.nodes, hooks);
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
- } else if (isArray(block)) {
652
- for (let i = 0; i < block.length; i++) {
653
- setTransitionHooksOnFragment(block[i], hooks);
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 setTransitionHooks(block, hooks) {
658
- if (isVaporComponent(block)) {
659
- block = findTransitionBlock(block.block);
660
- if (!block) return;
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
- block.$transition = hooks;
663
- }
664
-
665
- class VaporFragment {
666
- constructor(nodes) {
667
- this.vnode = null;
668
- this.nodes = nodes;
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
- class ForFragment extends VaporFragment {
672
- constructor(nodes) {
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
- class DynamicFragment extends VaporFragment {
677
- constructor(anchorLabel) {
678
- super([]);
679
- this.hydrate = (isEmpty = false) => {
680
- if (this.anchor) return;
681
- if (this.anchorLabel === "if") {
682
- if (isEmpty) {
683
- this.anchor = locateFragmentEndAnchor("");
684
- if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
685
- throw new Error(
686
- "Failed to locate if anchor. this is likely a Vue internal bug."
687
- );
688
- } else {
689
- if (!!(process.env.NODE_ENV !== "production")) {
690
- this.anchor.data = this.anchorLabel;
691
- }
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
- } else if (this.anchorLabel === "slot") {
696
- if (isEmpty && isComment(currentHydrationNode, "")) {
697
- this.anchor = currentHydrationNode;
698
- if (!!(process.env.NODE_ENV !== "production")) {
699
- this.anchor.data = this.anchorLabel;
700
- }
701
- return;
702
- }
703
- this.anchor = locateFragmentEndAnchor();
704
- if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
705
- throw new Error(
706
- "Failed to locate slot anchor. this is likely a Vue internal bug."
707
- );
708
- } else {
709
- return;
710
- }
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
- update(render, key = render) {
728
- if (key === this.current) {
729
- if (isHydrating) this.hydrate(true);
730
- return;
731
- }
732
- this.current = key;
733
- const prevSub = setActiveSub();
734
- const parent = isHydrating ? null : this.anchor.parentNode;
735
- const transition = this.$transition;
736
- if (this.scope) {
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
- } else {
759
- parent && remove(this.nodes, parent);
760
- }
761
- }
762
- this.render(render, transition, parent);
763
- if (this.fallback) {
764
- const hasNestedFragment = isFragment(this.nodes);
765
- if (hasNestedFragment) {
766
- setFragmentFallback(this.nodes, this.fallback);
767
- }
768
- const invalidFragment = findInvalidFragment(this);
769
- if (invalidFragment) {
770
- parent && remove(this.nodes, parent);
771
- const scope = this.scope || (this.scope = new EffectScope());
772
- scope.run(() => {
773
- if (hasNestedFragment) {
774
- renderFragmentFallback(invalidFragment);
775
- } else {
776
- this.nodes = this.fallback() || [];
777
- }
778
- });
779
- parent && insert(this.nodes, parent, this.anchor);
780
- }
781
- }
782
- setActiveSub(prevSub);
783
- if (isHydrating) this.hydrate();
784
- }
785
- render(render, 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 setFragmentFallback(fragment, fallback) {
815
- if (fragment.fallback) {
816
- const originalFallback = fragment.fallback;
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
- if (isFragment(fragment.nodes)) {
828
- setFragmentFallback(fragment.nodes, fragment.fallback);
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
- function renderFragmentFallback(fragment) {
832
- if (fragment instanceof ForFragment) {
833
- fragment.nodes[0] = [fragment.fallback() || []];
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
- function delegate(el, event, handler) {
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
- const delegatedEvents = /* @__PURE__ */ Object.create(null);
875
- const delegateEvents = (...names) => {
876
- for (const name of names) {
877
- if (!delegatedEvents[name]) {
878
- delegatedEvents[name] = true;
879
- document.addEventListener(name, delegatedEventHandler);
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
- const delegatedEventHandler = (e) => {
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
- Object.defineProperty(e, "currentTarget", {
892
- configurable: true,
893
- get() {
894
- return node || document;
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
- while (node !== null) {
898
- const handlers = node[`$evt${e.type}`];
899
- if (handlers) {
900
- if (isArray(handlers)) {
901
- for (const handler of handlers) {
902
- if (!node.disabled) {
903
- handler(e);
904
- if (e.cancelBubble) return;
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
- function setDynamicEvents(el, events) {
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 createInvoker(handler) {
921
- const i = currentInstance;
922
- return (...args) => callWithAsyncErrorHandling(
923
- handler,
924
- i,
925
- 5,
926
- args
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
- const hasFallthroughKey = (key) => currentInstance.hasFallthrough && key in currentInstance.attrs;
931
- function setProp(el, key, value) {
932
- if (key in el) {
933
- setDOMProp(el, key, value);
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
- setAttr(el, key, value);
670
+ setTextToBlock(block.nodes, value);
936
671
  }
937
672
  }
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
- }
673
+ function setHtml(el, value) {
674
+ value = value == null ? "" : unsafeToTrustedHTML(value);
675
+ if (el.$html !== value) {
676
+ el.innerHTML = el.$html = value;
966
677
  }
967
678
  }
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);
1176
- }
1177
- }
1178
- function setHtml(el, value) {
1179
- value = value == null ? "" : unsafeToTrustedHTML(value);
1180
- if (el.$html !== value) {
1181
- el.innerHTML = el.$html = value;
1182
- }
1183
- }
1184
- function setBlockHtml(block, value) {
1185
- value = value == null ? "" : unsafeToTrustedHTML(value);
1186
- if (block.$html !== value) {
1187
- setHtmlToBlock(block, block.$html = value);
679
+ function setBlockHtml(block, value) {
680
+ value = value == null ? "" : unsafeToTrustedHTML(value);
681
+ if (block.$html !== value) {
682
+ setHtmlToBlock(block, block.$html = value);
1188
683
  }
1189
684
  }
1190
685
  function setHtmlToBlock(block, value) {
@@ -1352,208 +847,26 @@ function shouldForceHydrate(el, key) {
1352
847
  tagName.includes("-");
1353
848
  }
1354
849
 
1355
- let currentSlotScopeIds = null;
1356
- function setCurrentSlotScopeIds(scopeIds) {
1357
- try {
1358
- return currentSlotScopeIds;
1359
- } finally {
1360
- currentSlotScopeIds = scopeIds;
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
  }
859
+ comp.__vapor = true;
860
+ return comp;
1362
861
  }
1363
- const dynamicSlotsProxyHandlers = {
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;
1548
- }
1549
-
1550
- const VaporKeepAliveImpl = defineVaporComponent({
1551
- name: "VaporKeepAlive",
1552
- __isKeepAlive: true,
1553
- props: {
1554
- include: [String, RegExp, Array],
1555
- exclude: [String, RegExp, Array],
1556
- max: [String, Number]
862
+
863
+ const VaporKeepAliveImpl = defineVaporComponent({
864
+ name: "VaporKeepAlive",
865
+ __isKeepAlive: true,
866
+ props: {
867
+ include: [String, RegExp, Array],
868
+ exclude: [String, RegExp, Array],
869
+ max: [String, Number]
1557
870
  },
1558
871
  setup(props, { slots }) {
1559
872
  if (!slots.default) {
@@ -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 && !shouldCache(innerBlock, props, interop)) return;
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;
@@ -1693,14 +1006,14 @@ const VaporKeepAliveImpl = defineVaporComponent({
1693
1006
  }
1694
1007
  }
1695
1008
  const injectKeepAliveHooks = (frag) => {
1696
- (frag.beforeTeardown || (frag.beforeTeardown = [])).push(
1009
+ (frag.onBeforeTeardown || (frag.onBeforeTeardown = [])).push(
1697
1010
  (oldKey, nodes, scope) => {
1698
1011
  processFragment(frag);
1699
1012
  keptAliveScopes.set(oldKey, scope);
1700
1013
  return true;
1701
1014
  }
1702
1015
  );
1703
- (frag.beforeMount || (frag.beforeMount = [])).push(
1016
+ (frag.onBeforeMount || (frag.onBeforeMount = [])).push(
1704
1017
  () => cacheFragment(frag)
1705
1018
  );
1706
1019
  frag.getScope = (key) => {
@@ -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
- if (vnode.component) {
1859
- unmountComponent(vnode.component, container);
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
  }
@@ -1865,8 +1197,10 @@ const vaporInteropImpl = {
1865
1197
  /**
1866
1198
  * vapor slot in vdom
1867
1199
  */
1868
- slot(n1, n2, container, anchor) {
1200
+ slot(n1, n2, container, anchor, parentComponent) {
1869
1201
  if (!n1) {
1202
+ const prev = currentInstance;
1203
+ simpleSetCurrentInstance(parentComponent);
1870
1204
  let selfAnchor;
1871
1205
  const { slot, fallback } = n2.vs;
1872
1206
  const propsRef = n2.vs.ref = shallowRef(n2.props);
@@ -1875,6 +1209,7 @@ const vaporInteropImpl = {
1875
1209
  setFragmentFallback(slotBlock, createFallback(fallback));
1876
1210
  selfAnchor = slotBlock.anchor;
1877
1211
  }
1212
+ simpleSetCurrentInstance(prev);
1878
1213
  if (!selfAnchor) selfAnchor = createTextNode();
1879
1214
  insert(n2.el = n2.anchor = selfAnchor, container, anchor);
1880
1215
  insert(n2.vb = slotBlock, container, selfAnchor);
@@ -1888,10 +1223,10 @@ const vaporInteropImpl = {
1888
1223
  insert(vnode.vb || vnode.component, container, anchor);
1889
1224
  insert(vnode.anchor, container, anchor);
1890
1225
  },
1891
- hydrate(vnode, node, container, anchor, parentComponent) {
1226
+ hydrate(vnode, node, container, anchor, parentComponent, parentSuspense) {
1892
1227
  hydrateNode(
1893
1228
  node,
1894
- () => this.mount(vnode, container, anchor, parentComponent)
1229
+ () => this.mount(vnode, container, anchor, parentComponent, parentSuspense)
1895
1230
  );
1896
1231
  return _next(node);
1897
1232
  },
@@ -1959,8 +1294,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
1959
1294
  rawProps,
1960
1295
  rawSlots,
1961
1296
  parentComponent ? parentComponent.appContext : void 0,
1962
- void 0,
1963
- parentComponent
1297
+ void 0
1964
1298
  );
1965
1299
  vnode.vi = (instance) => {
1966
1300
  instance.props = shallowReactive(wrapper.props);
@@ -1995,7 +1329,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
1995
1329
  isMounted = true;
1996
1330
  frag.nodes = vnode.el;
1997
1331
  };
1998
- vnode.scopeId = currentInstance && currentInstance.type.__scopeId || null;
1332
+ vnode.scopeId = getCurrentScopeId() || null;
1999
1333
  vnode.slotScopeIds = currentSlotScopeIds;
2000
1334
  frag.insert = (parentNode, anchor, transition) => {
2001
1335
  if (isHydrating) return;
@@ -2039,7 +1373,7 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
2039
1373
  simpleSetCurrentInstance(prev);
2040
1374
  }
2041
1375
  frag.nodes = vnode.el;
2042
- if (isMounted && frag.updated) frag.updated.forEach((m) => m());
1376
+ if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
2043
1377
  };
2044
1378
  frag.remove = unmount;
2045
1379
  frag.setRef = (instance, ref, refFor, refKey) => {
@@ -2081,7 +1415,7 @@ function renderVDOMSlot(internals, slotsRef, name, props, parentComponent, fallb
2081
1415
  internals.um(oldVNode, parentComponent, null);
2082
1416
  }
2083
1417
  };
2084
- if (isMounted && frag.updated) frag.updated.forEach((m) => m());
1418
+ if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
2085
1419
  };
2086
1420
  const render = (parentNode, anchor) => {
2087
1421
  renderEffect(() => {
@@ -2426,110 +1760,815 @@ function getKeysFromRawProps(rawProps) {
2426
1760
  }
2427
1761
  }
2428
1762
  }
2429
- return Array.from(new Set(keys));
2430
- }
2431
- function normalizePropsOptions(comp) {
2432
- const cached = comp.__propsOptions;
2433
- if (cached) return cached;
2434
- const raw = comp.props;
2435
- if (!raw) return EMPTY_ARR;
2436
- const normalized = {};
2437
- const needCastKeys = [];
2438
- baseNormalizePropsOptions(raw, normalized, needCastKeys);
2439
- return comp.__propsOptions = [normalized, needCastKeys];
2440
- }
2441
- function resolveDefault(factory, instance) {
2442
- const prev = setCurrentInstance(instance);
2443
- const res = factory.call(null, instance.props);
2444
- setCurrentInstance(...prev);
2445
- return res;
2446
- }
2447
- function hasFallthroughAttrs(comp, rawProps) {
2448
- if (rawProps) {
2449
- if (rawProps.$ || !comp.props) {
2450
- return true;
2451
- } else {
2452
- const propsOptions = normalizePropsOptions(comp)[0];
2453
- for (const key in rawProps) {
2454
- if (!hasOwn(propsOptions, camelize(key))) {
2455
- return true;
1763
+ return Array.from(new Set(keys));
1764
+ }
1765
+ function normalizePropsOptions(comp) {
1766
+ const cached = comp.__propsOptions;
1767
+ if (cached) return cached;
1768
+ const raw = comp.props;
1769
+ if (!raw) return EMPTY_ARR;
1770
+ const normalized = {};
1771
+ const needCastKeys = [];
1772
+ baseNormalizePropsOptions(raw, normalized, needCastKeys);
1773
+ return comp.__propsOptions = [normalized, needCastKeys];
1774
+ }
1775
+ function resolveDefault(factory, instance) {
1776
+ const prev = setCurrentInstance(instance);
1777
+ const res = factory.call(null, instance.props);
1778
+ setCurrentInstance(...prev);
1779
+ return res;
1780
+ }
1781
+ function hasFallthroughAttrs(comp, rawProps) {
1782
+ if (rawProps) {
1783
+ if (rawProps.$ || !comp.props) {
1784
+ return true;
1785
+ } else {
1786
+ const propsOptions = normalizePropsOptions(comp)[0];
1787
+ for (const key in rawProps) {
1788
+ if (!hasOwn(propsOptions, camelize(key))) {
1789
+ return true;
1790
+ }
1791
+ }
1792
+ }
1793
+ }
1794
+ return false;
1795
+ }
1796
+ function setupPropsValidation(instance) {
1797
+ const rawProps = instance.rawProps;
1798
+ if (!rawProps) return;
1799
+ renderEffect(
1800
+ () => {
1801
+ pushWarningContext(instance);
1802
+ validateProps(
1803
+ resolveDynamicProps(rawProps),
1804
+ instance.props,
1805
+ normalizePropsOptions(instance.type)[0]
1806
+ );
1807
+ popWarningContext();
1808
+ },
1809
+ true
1810
+ /* noLifecycle */
1811
+ );
1812
+ }
1813
+ function resolveDynamicProps(props) {
1814
+ const mergedRawProps = {};
1815
+ for (const key in props) {
1816
+ if (key !== "$") {
1817
+ mergedRawProps[key] = resolveSource(props[key]);
1818
+ }
1819
+ }
1820
+ if (props.$) {
1821
+ for (const source of props.$) {
1822
+ const isDynamic = isFunction(source);
1823
+ const resolved = isDynamic ? source() : source;
1824
+ for (const key in resolved) {
1825
+ const value = isDynamic ? resolved[key] : resolved[key]();
1826
+ if (key === "class" || key === "style") {
1827
+ const existing = mergedRawProps[key];
1828
+ if (isArray(existing)) {
1829
+ existing.push(value);
1830
+ } else {
1831
+ mergedRawProps[key] = [existing, value];
1832
+ }
1833
+ } else {
1834
+ mergedRawProps[key] = value;
1835
+ }
1836
+ }
1837
+ }
1838
+ }
1839
+ return mergedRawProps;
1840
+ }
1841
+ function propsSetDevTrap(_, key) {
1842
+ warn(
1843
+ `Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
1844
+ );
1845
+ return true;
1846
+ }
1847
+ function propsDeleteDevTrap(_, key) {
1848
+ warn(
1849
+ `Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
1850
+ );
1851
+ return true;
1852
+ }
1853
+ const rawPropsProxyHandlers = {
1854
+ get: getAttrFromRawProps,
1855
+ has: hasAttrFromRawProps,
1856
+ ownKeys: getKeysFromRawProps,
1857
+ getOwnPropertyDescriptor(target, key) {
1858
+ if (hasAttrFromRawProps(target, key)) {
1859
+ return {
1860
+ configurable: true,
1861
+ enumerable: true,
1862
+ get: () => getAttrFromRawProps(target, key)
1863
+ };
1864
+ }
1865
+ }
1866
+ };
1867
+
1868
+ let inOnceSlot = false;
1869
+ let currentSlotScopeIds = null;
1870
+ function setCurrentSlotScopeIds(scopeIds) {
1871
+ try {
1872
+ return currentSlotScopeIds;
1873
+ } finally {
1874
+ currentSlotScopeIds = scopeIds;
1875
+ }
1876
+ }
1877
+ function resolveDynamicSlot(source) {
1878
+ if (!source._cache) {
1879
+ source._cache = computed(source);
1880
+ }
1881
+ return source._cache.value;
1882
+ }
1883
+ const dynamicSlotsProxyHandlers = {
1884
+ get: getSlot,
1885
+ has: (target, key) => !!getSlot(target, key),
1886
+ getOwnPropertyDescriptor(target, key) {
1887
+ const slot = getSlot(target, key);
1888
+ if (slot) {
1889
+ return {
1890
+ configurable: true,
1891
+ enumerable: true,
1892
+ value: slot
1893
+ };
1894
+ }
1895
+ },
1896
+ ownKeys(target) {
1897
+ let keys = Object.keys(target);
1898
+ const dynamicSources = target.$;
1899
+ if (dynamicSources) {
1900
+ keys = keys.filter((k) => k !== "$");
1901
+ for (const source of dynamicSources) {
1902
+ if (isFunction(source)) {
1903
+ const slot = resolveDynamicSlot(source);
1904
+ if (isArray(slot)) {
1905
+ for (const s of slot) keys.push(String(s.name));
1906
+ } else {
1907
+ keys.push(String(slot.name));
1908
+ }
1909
+ } else {
1910
+ keys.push(...Object.keys(source));
1911
+ }
1912
+ }
1913
+ }
1914
+ return keys;
1915
+ },
1916
+ set: NO,
1917
+ deleteProperty: NO
1918
+ };
1919
+ function getSlot(target, key) {
1920
+ if (key === "$") return;
1921
+ const dynamicSources = target.$;
1922
+ if (dynamicSources) {
1923
+ let i = dynamicSources.length;
1924
+ let source;
1925
+ while (i--) {
1926
+ source = dynamicSources[i];
1927
+ if (isFunction(source)) {
1928
+ const slot = resolveDynamicSlot(source);
1929
+ if (slot) {
1930
+ if (isArray(slot)) {
1931
+ for (const s of slot) {
1932
+ if (String(s.name) === key) return s.fn;
1933
+ }
1934
+ } else if (String(slot.name) === key) {
1935
+ return slot.fn;
1936
+ }
1937
+ }
1938
+ } else if (hasOwn(source, key)) {
1939
+ return source[key];
1940
+ }
1941
+ }
1942
+ }
1943
+ if (hasOwn(target, key)) {
1944
+ return target[key];
1945
+ }
1946
+ }
1947
+ let currentSlotOwner = null;
1948
+ function setCurrentSlotOwner(owner) {
1949
+ try {
1950
+ return currentSlotOwner;
1951
+ } finally {
1952
+ currentSlotOwner = owner;
1953
+ }
1954
+ }
1955
+ function getScopeOwner() {
1956
+ return currentSlotOwner || currentInstance;
1957
+ }
1958
+ function withVaporCtx(fn) {
1959
+ const owner = currentInstance;
1960
+ return (...args) => {
1961
+ const prevOwner = setCurrentSlotOwner(owner);
1962
+ try {
1963
+ return fn(...args);
1964
+ } finally {
1965
+ setCurrentSlotOwner(prevOwner);
1966
+ }
1967
+ };
1968
+ }
1969
+ function createSlot(name, rawProps, fallback, noSlotted, once) {
1970
+ const _insertionParent = insertionParent;
1971
+ const _insertionAnchor = insertionAnchor;
1972
+ const _isLastInsertion = isLastInsertion;
1973
+ if (!isHydrating) resetInsertionState();
1974
+ const instance = getScopeOwner();
1975
+ const rawSlots = instance.rawSlots;
1976
+ const slotProps = rawProps ? new Proxy(rawProps, rawPropsProxyHandlers) : EMPTY_OBJ;
1977
+ let fragment;
1978
+ if (isRef(rawSlots._)) {
1979
+ if (isHydrating) locateHydrationNode();
1980
+ fragment = instance.appContext.vapor.vdomSlot(
1981
+ rawSlots._,
1982
+ name,
1983
+ slotProps,
1984
+ instance,
1985
+ fallback
1986
+ );
1987
+ } else {
1988
+ fragment = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("slot") : new DynamicFragment();
1989
+ const isDynamicName = isFunction(name);
1990
+ const slotScopeIds = [];
1991
+ if (!noSlotted) {
1992
+ const scopeId = instance.type.__scopeId;
1993
+ if (scopeId) {
1994
+ slotScopeIds.push(`${scopeId}-s`);
1995
+ }
1996
+ }
1997
+ const renderSlot = () => {
1998
+ const slotName = isFunction(name) ? name() : name;
1999
+ if (instance.ce || instance.parent && isAsyncWrapper(instance.parent) && instance.parent.ce) {
2000
+ const el = createElement("slot");
2001
+ renderEffect(() => {
2002
+ setDynamicProps(el, [
2003
+ slotProps,
2004
+ slotName !== "default" ? { name: slotName } : {}
2005
+ ]);
2006
+ });
2007
+ if (fallback) insert(fallback(), el);
2008
+ fragment.nodes = el;
2009
+ return;
2010
+ }
2011
+ const slot = getSlot(rawSlots, slotName);
2012
+ if (slot) {
2013
+ fragment.fallback = fallback;
2014
+ fragment.update(
2015
+ slot._bound || (slot._bound = () => {
2016
+ const prevSlotScopeIds = setCurrentSlotScopeIds(
2017
+ slotScopeIds.length > 0 ? slotScopeIds : null
2018
+ );
2019
+ const prev = inOnceSlot;
2020
+ try {
2021
+ if (once) inOnceSlot = true;
2022
+ return slot(slotProps);
2023
+ } finally {
2024
+ inOnceSlot = prev;
2025
+ setCurrentSlotScopeIds(prevSlotScopeIds);
2026
+ }
2027
+ })
2028
+ );
2029
+ } else {
2030
+ fragment.update(fallback);
2031
+ }
2032
+ };
2033
+ if (!once && (isDynamicName || rawSlots.$)) {
2034
+ renderEffect(renderSlot);
2035
+ } else {
2036
+ renderSlot();
2037
+ }
2038
+ }
2039
+ if (!isHydrating) {
2040
+ if (!noSlotted) {
2041
+ const scopeId = instance.type.__scopeId;
2042
+ if (scopeId) {
2043
+ setScopeId(fragment, [`${scopeId}-s`]);
2044
+ }
2045
+ }
2046
+ if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
2047
+ } else {
2048
+ if (fragment.insert) {
2049
+ fragment.hydrate();
2050
+ }
2051
+ if (_isLastInsertion) {
2052
+ advanceHydrationNode(_insertionParent);
2053
+ }
2054
+ }
2055
+ return fragment;
2056
+ }
2057
+
2058
+ class RenderEffect extends ReactiveEffect {
2059
+ constructor(render) {
2060
+ super();
2061
+ this.render = render;
2062
+ const instance = currentInstance;
2063
+ if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
2064
+ warn("renderEffect called without active EffectScope or Vapor instance.");
2065
+ }
2066
+ const job = () => {
2067
+ if (this.dirty) {
2068
+ this.run();
2069
+ }
2070
+ };
2071
+ this.updateJob = () => {
2072
+ instance.isUpdating = false;
2073
+ instance.u && invokeArrayFns(instance.u);
2074
+ };
2075
+ if (instance) {
2076
+ if (!!(process.env.NODE_ENV !== "production")) {
2077
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
2078
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
2079
+ }
2080
+ if (instance.type.ce) {
2081
+ (instance.renderEffects || (instance.renderEffects = [])).push(this);
2082
+ }
2083
+ job.i = instance;
2084
+ }
2085
+ this.job = job;
2086
+ this.i = instance;
2087
+ }
2088
+ fn() {
2089
+ const instance = this.i;
2090
+ const scope = this.subs ? this.subs.sub : void 0;
2091
+ const hasUpdateHooks = instance && (instance.bu || instance.u);
2092
+ if (!!(process.env.NODE_ENV !== "production") && instance) {
2093
+ startMeasure(instance, `renderEffect`);
2094
+ }
2095
+ const prev = setCurrentInstance(instance, scope);
2096
+ if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
2097
+ instance.isUpdating = true;
2098
+ instance.bu && invokeArrayFns(instance.bu);
2099
+ this.render();
2100
+ queuePostFlushCb(this.updateJob);
2101
+ } else {
2102
+ this.render();
2103
+ }
2104
+ setCurrentInstance(...prev);
2105
+ if (!!(process.env.NODE_ENV !== "production") && instance) {
2106
+ startMeasure(instance, `renderEffect`);
2107
+ }
2108
+ }
2109
+ notify() {
2110
+ const flags = this.flags;
2111
+ if (!(flags & 256)) {
2112
+ queueJob(this.job, this.i ? this.i.uid : void 0);
2113
+ }
2114
+ }
2115
+ }
2116
+ function renderEffect(fn, noLifecycle = false) {
2117
+ if (inOnceSlot) return fn();
2118
+ const effect = new RenderEffect(fn);
2119
+ if (noLifecycle) {
2120
+ effect.fn = fn;
2121
+ }
2122
+ effect.run();
2123
+ }
2124
+
2125
+ const displayName = "VaporTransition";
2126
+ const decorate$1 = (t) => {
2127
+ t.displayName = displayName;
2128
+ t.props = TransitionPropsValidators;
2129
+ t.__vapor = true;
2130
+ return t;
2131
+ };
2132
+ const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
2133
+ let resetDisplay;
2134
+ if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
2135
+ const {
2136
+ content: { firstChild },
2137
+ parentNode
2138
+ } = currentHydrationNode;
2139
+ if (firstChild) {
2140
+ if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
2141
+ const originalDisplay = firstChild.style.display;
2142
+ firstChild.style.display = "none";
2143
+ resetDisplay = () => firstChild.style.display = originalDisplay;
2144
+ }
2145
+ parentNode.replaceChild(firstChild, currentHydrationNode);
2146
+ setCurrentHydrationNode(firstChild);
2147
+ }
2148
+ }
2149
+ const children = slots.default && slots.default();
2150
+ if (!children) return [];
2151
+ const instance = currentInstance;
2152
+ const { mode } = props;
2153
+ checkTransitionMode(mode);
2154
+ let resolvedProps;
2155
+ let isMounted = false;
2156
+ renderEffect(() => {
2157
+ resolvedProps = resolveTransitionProps(props);
2158
+ if (isMounted) {
2159
+ if (isFragment(children)) {
2160
+ children.$transition.props = resolvedProps;
2161
+ } else {
2162
+ const child = findTransitionBlock(children);
2163
+ if (child) {
2164
+ child.$transition.props = resolvedProps;
2165
+ applyTransitionHooks(child, child.$transition, true);
2166
+ }
2167
+ }
2168
+ } else {
2169
+ isMounted = true;
2170
+ }
2171
+ });
2172
+ const hooks = applyTransitionHooks(children, {
2173
+ state: useTransitionState(),
2174
+ props: resolvedProps,
2175
+ instance
2176
+ });
2177
+ if (resetDisplay && resolvedProps.appear) {
2178
+ const child = findTransitionBlock(children);
2179
+ hooks.beforeEnter(child);
2180
+ resetDisplay();
2181
+ queuePostFlushCb(() => hooks.enter(child));
2182
+ }
2183
+ return children;
2184
+ });
2185
+ const getTransitionHooksContext = (key, props, state, instance, postClone) => {
2186
+ const { leavingNodes } = state;
2187
+ const context = {
2188
+ setLeavingNodeCache: (el) => {
2189
+ leavingNodes.set(key, el);
2190
+ },
2191
+ unsetLeavingNodeCache: (el) => {
2192
+ const leavingNode = leavingNodes.get(key);
2193
+ if (leavingNode === el) {
2194
+ leavingNodes.delete(key);
2195
+ }
2196
+ },
2197
+ earlyRemove: () => {
2198
+ const leavingNode = leavingNodes.get(key);
2199
+ if (leavingNode && leavingNode[leaveCbKey]) {
2200
+ leavingNode[leaveCbKey]();
2201
+ }
2202
+ },
2203
+ cloneHooks: (block) => {
2204
+ const hooks = resolveTransitionHooks(
2205
+ block,
2206
+ props,
2207
+ state,
2208
+ instance,
2209
+ postClone
2210
+ );
2211
+ if (postClone) postClone(hooks);
2212
+ return hooks;
2213
+ }
2214
+ };
2215
+ return context;
2216
+ };
2217
+ function resolveTransitionHooks(block, props, state, instance, postClone) {
2218
+ const context = getTransitionHooksContext(
2219
+ String(block.$key),
2220
+ props,
2221
+ state,
2222
+ instance,
2223
+ postClone
2224
+ );
2225
+ const hooks = baseResolveTransitionHooks(
2226
+ context,
2227
+ props,
2228
+ state,
2229
+ instance
2230
+ );
2231
+ hooks.state = state;
2232
+ hooks.props = props;
2233
+ hooks.instance = instance;
2234
+ return hooks;
2235
+ }
2236
+ function applyTransitionHooks(block, hooks, isResolved = false) {
2237
+ if (isArray(block)) {
2238
+ block = block.filter((b) => !(b instanceof Comment));
2239
+ if (block.length === 1) {
2240
+ block = block[0];
2241
+ } else if (block.length === 0) {
2242
+ return hooks;
2243
+ }
2244
+ }
2245
+ const isFrag = isFragment(block);
2246
+ const child = isResolved ? block : findTransitionBlock(block, isFrag);
2247
+ if (!child) {
2248
+ if (isFrag) setTransitionHooksOnFragment(block, hooks);
2249
+ return hooks;
2250
+ }
2251
+ const { props, instance, state, delayedLeave } = hooks;
2252
+ let resolvedHooks = resolveTransitionHooks(
2253
+ child,
2254
+ props,
2255
+ state,
2256
+ instance,
2257
+ (hooks2) => resolvedHooks = hooks2
2258
+ );
2259
+ resolvedHooks.delayedLeave = delayedLeave;
2260
+ child.$transition = resolvedHooks;
2261
+ if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
2262
+ return resolvedHooks;
2263
+ }
2264
+ function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
2265
+ const leavingBlock = findTransitionBlock(block);
2266
+ if (!leavingBlock) return void 0;
2267
+ const { props, state, instance } = enterHooks;
2268
+ const leavingHooks = resolveTransitionHooks(
2269
+ leavingBlock,
2270
+ props,
2271
+ state,
2272
+ instance
2273
+ );
2274
+ leavingBlock.$transition = leavingHooks;
2275
+ const { mode } = props;
2276
+ if (mode === "out-in") {
2277
+ state.isLeaving = true;
2278
+ leavingHooks.afterLeave = () => {
2279
+ state.isLeaving = false;
2280
+ afterLeaveCb();
2281
+ leavingBlock.$transition = void 0;
2282
+ delete leavingHooks.afterLeave;
2283
+ };
2284
+ } else if (mode === "in-out") {
2285
+ leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
2286
+ state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
2287
+ block2[leaveCbKey] = () => {
2288
+ earlyRemove();
2289
+ block2[leaveCbKey] = void 0;
2290
+ leavingBlock.$transition = void 0;
2291
+ delete enterHooks.delayedLeave;
2292
+ };
2293
+ enterHooks.delayedLeave = () => {
2294
+ delayedLeave();
2295
+ leavingBlock.$transition = void 0;
2296
+ delete enterHooks.delayedLeave;
2297
+ };
2298
+ };
2299
+ }
2300
+ }
2301
+ function findTransitionBlock(block, inFragment = false) {
2302
+ let child;
2303
+ if (block instanceof Node) {
2304
+ if (block instanceof Element) child = block;
2305
+ } else if (isVaporComponent(block)) {
2306
+ if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
2307
+ child = block;
2308
+ } else {
2309
+ if (getComponentName(block.type) === displayName) return void 0;
2310
+ child = findTransitionBlock(block.block, inFragment);
2311
+ if (child && child.$key === void 0) child.$key = block.uid;
2312
+ }
2313
+ } else if (isArray(block)) {
2314
+ let hasFound = false;
2315
+ for (const c of block) {
2316
+ if (c instanceof Comment) continue;
2317
+ if (isFragment(c)) inFragment = true;
2318
+ const item = findTransitionBlock(c, inFragment);
2319
+ if (!!(process.env.NODE_ENV !== "production") && hasFound) {
2320
+ warn(
2321
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
2322
+ );
2323
+ break;
2324
+ }
2325
+ child = item;
2326
+ hasFound = true;
2327
+ if (!!!(process.env.NODE_ENV !== "production")) break;
2328
+ }
2329
+ } else if (isFragment(block)) {
2330
+ inFragment = true;
2331
+ if (block.insert) {
2332
+ child = block;
2333
+ } else {
2334
+ child = findTransitionBlock(block.nodes, true);
2335
+ }
2336
+ }
2337
+ if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
2338
+ warn("Transition component has no valid child element");
2339
+ }
2340
+ return child;
2341
+ }
2342
+ function setTransitionHooksOnFragment(block, hooks) {
2343
+ if (isFragment(block)) {
2344
+ block.$transition = hooks;
2345
+ if (block.nodes && isFragment(block.nodes)) {
2346
+ setTransitionHooksOnFragment(block.nodes, hooks);
2347
+ }
2348
+ } else if (isArray(block)) {
2349
+ for (let i = 0; i < block.length; i++) {
2350
+ setTransitionHooksOnFragment(block[i], hooks);
2351
+ }
2352
+ }
2353
+ }
2354
+ function setTransitionHooks(block, hooks) {
2355
+ if (isVaporComponent(block)) {
2356
+ block = findTransitionBlock(block.block);
2357
+ if (!block) return;
2358
+ }
2359
+ block.$transition = hooks;
2360
+ }
2361
+
2362
+ class VaporFragment {
2363
+ constructor(nodes) {
2364
+ this.vnode = null;
2365
+ this.nodes = nodes;
2366
+ }
2367
+ }
2368
+ class ForFragment extends VaporFragment {
2369
+ constructor(nodes) {
2370
+ super(nodes);
2371
+ }
2372
+ }
2373
+ class DynamicFragment extends VaporFragment {
2374
+ constructor(anchorLabel) {
2375
+ super([]);
2376
+ this.hydrate = (isEmpty = false) => {
2377
+ if (this.anchor) return;
2378
+ if (this.anchorLabel === "if") {
2379
+ if (isEmpty) {
2380
+ this.anchor = locateFragmentEndAnchor("");
2381
+ if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
2382
+ throw new Error(
2383
+ "Failed to locate if anchor. this is likely a Vue internal bug."
2384
+ );
2385
+ } else {
2386
+ if (!!(process.env.NODE_ENV !== "production")) {
2387
+ this.anchor.data = this.anchorLabel;
2388
+ }
2389
+ return;
2390
+ }
2391
+ }
2392
+ } else if (this.anchorLabel === "slot") {
2393
+ if (isEmpty && isComment(currentHydrationNode, "")) {
2394
+ this.anchor = currentHydrationNode;
2395
+ if (!!(process.env.NODE_ENV !== "production")) {
2396
+ this.anchor.data = this.anchorLabel;
2397
+ }
2398
+ return;
2399
+ }
2400
+ this.anchor = locateFragmentEndAnchor();
2401
+ if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
2402
+ throw new Error(
2403
+ "Failed to locate slot anchor. this is likely a Vue internal bug."
2404
+ );
2405
+ } else {
2406
+ return;
2407
+ }
2408
+ }
2409
+ const { parentNode, nextNode } = findBlockNode(this.nodes);
2410
+ queuePostFlushCb(() => {
2411
+ parentNode.insertBefore(
2412
+ this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
2413
+ nextNode
2414
+ );
2415
+ });
2416
+ };
2417
+ this.slotOwner = currentSlotOwner;
2418
+ if (isHydrating) {
2419
+ this.anchorLabel = anchorLabel;
2420
+ locateHydrationNode();
2421
+ } else {
2422
+ this.anchor = !!(process.env.NODE_ENV !== "production") && anchorLabel ? createComment(anchorLabel) : createTextNode();
2423
+ if (!!(process.env.NODE_ENV !== "production")) this.anchorLabel = anchorLabel;
2424
+ }
2425
+ }
2426
+ update(render, key = render) {
2427
+ if (key === this.current) {
2428
+ if (isHydrating) this.hydrate(true);
2429
+ return;
2430
+ }
2431
+ this.current = key;
2432
+ const instance = currentInstance;
2433
+ const prevSub = setActiveSub();
2434
+ const parent = isHydrating ? null : this.anchor.parentNode;
2435
+ const transition = this.$transition;
2436
+ if (this.scope) {
2437
+ let preserveScope = false;
2438
+ if (this.onBeforeTeardown) {
2439
+ preserveScope = this.onBeforeTeardown.some(
2440
+ (hook) => hook(this.current, this.nodes, this.scope)
2441
+ );
2442
+ }
2443
+ if (!preserveScope) {
2444
+ this.scope.stop();
2445
+ }
2446
+ const mode = transition && transition.mode;
2447
+ if (mode) {
2448
+ applyTransitionLeaveHooks(
2449
+ this.nodes,
2450
+ transition,
2451
+ () => this.renderBranch(render, transition, parent, instance)
2452
+ );
2453
+ parent && remove(this.nodes, parent);
2454
+ if (mode === "out-in") {
2455
+ setActiveSub(prevSub);
2456
+ return;
2456
2457
  }
2458
+ } else {
2459
+ parent && remove(this.nodes, parent);
2457
2460
  }
2458
2461
  }
2459
- }
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
- }
2479
- function resolveDynamicProps(props) {
2480
- const mergedRawProps = {};
2481
- for (const key in props) {
2482
- if (key !== "$") {
2483
- mergedRawProps[key] = resolveSource(props[key]);
2462
+ this.renderBranch(render, transition, parent, instance);
2463
+ if (this.fallback) {
2464
+ let invalidFragment = null;
2465
+ if (isFragment(this.nodes)) {
2466
+ setFragmentFallback(
2467
+ this.nodes,
2468
+ this.fallback,
2469
+ (frag) => {
2470
+ if (!isValidBlock(frag.nodes)) {
2471
+ invalidFragment = frag;
2472
+ }
2473
+ }
2474
+ );
2475
+ }
2476
+ if (!invalidFragment && !isValidBlock(this.nodes)) {
2477
+ invalidFragment = this;
2478
+ }
2479
+ if (invalidFragment) {
2480
+ parent && remove(this.nodes, parent);
2481
+ const scope = this.scope || (this.scope = new EffectScope());
2482
+ scope.run(() => {
2483
+ if (invalidFragment !== this) {
2484
+ renderFragmentFallback(invalidFragment);
2485
+ } else {
2486
+ this.nodes = this.fallback() || [];
2487
+ }
2488
+ });
2489
+ parent && insert(this.nodes, parent, this.anchor);
2490
+ }
2484
2491
  }
2492
+ setActiveSub(prevSub);
2493
+ if (isHydrating) this.hydrate();
2485
2494
  }
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];
2495
+ renderBranch(render, transition, parent, instance) {
2496
+ if (render) {
2497
+ const scope = this.getScope && this.getScope(this.current);
2498
+ if (scope) {
2499
+ this.scope = scope;
2500
+ } else {
2501
+ this.scope = new EffectScope();
2502
+ }
2503
+ const prevOwner = setCurrentSlotOwner(this.slotOwner);
2504
+ const prev = parent && instance ? setCurrentInstance(instance) : void 0;
2505
+ this.nodes = this.scope.run(render) || [];
2506
+ if (prev !== void 0) setCurrentInstance(...prev);
2507
+ setCurrentSlotOwner(prevOwner);
2508
+ if (transition) {
2509
+ this.$transition = applyTransitionHooks(this.nodes, transition);
2510
+ }
2511
+ if (this.onBeforeMount) {
2512
+ this.onBeforeMount.forEach(
2513
+ (hook) => hook(this.current, this.nodes, this.scope)
2514
+ );
2515
+ }
2516
+ if (parent) {
2517
+ if (this.attrs) {
2518
+ if (this.nodes instanceof Element) {
2519
+ this.scope.run(() => {
2520
+ renderEffect(
2521
+ () => applyFallthroughProps(this.nodes, this.attrs)
2522
+ );
2523
+ });
2524
+ } else if (!!(process.env.NODE_ENV !== "production") && // preventing attrs fallthrough on slots
2525
+ // consistent with VDOM slots behavior
2526
+ (this.anchorLabel === "slot" || isArray(this.nodes) && this.nodes.length)) {
2527
+ warnExtraneousAttributes(this.attrs);
2498
2528
  }
2499
- } else {
2500
- mergedRawProps[key] = value;
2529
+ }
2530
+ insert(this.nodes, parent, this.anchor);
2531
+ if (this.onUpdated) {
2532
+ this.onUpdated.forEach((hook) => hook(this.nodes));
2501
2533
  }
2502
2534
  }
2535
+ } else {
2536
+ this.scope = void 0;
2537
+ this.nodes = [];
2503
2538
  }
2504
2539
  }
2505
- return mergedRawProps;
2506
2540
  }
2507
- function propsSetDevTrap(_, key) {
2508
- warn(
2509
- `Attempt to mutate prop ${JSON.stringify(key)} failed. Props are readonly.`
2510
- );
2511
- return true;
2541
+ function setFragmentFallback(fragment, fallback, onFragment) {
2542
+ if (fragment.fallback) {
2543
+ const originalFallback = fragment.fallback;
2544
+ fragment.fallback = () => {
2545
+ const fallbackNodes = originalFallback();
2546
+ if (isValidBlock(fallbackNodes)) {
2547
+ return fallbackNodes;
2548
+ }
2549
+ return fallback();
2550
+ };
2551
+ } else {
2552
+ fragment.fallback = fallback;
2553
+ }
2554
+ if (onFragment) onFragment(fragment);
2555
+ if (isFragment(fragment.nodes)) {
2556
+ setFragmentFallback(fragment.nodes, fragment.fallback, onFragment);
2557
+ }
2512
2558
  }
2513
- function propsDeleteDevTrap(_, key) {
2514
- warn(
2515
- `Attempt to delete prop ${JSON.stringify(key)} failed. Props are readonly.`
2516
- );
2517
- return true;
2559
+ function renderFragmentFallback(fragment) {
2560
+ if (fragment instanceof ForFragment) {
2561
+ fragment.nodes[0] = [fragment.fallback() || []];
2562
+ } else if (fragment instanceof DynamicFragment) {
2563
+ fragment.update(fragment.fallback);
2564
+ } else ;
2565
+ }
2566
+ function isFragment(val) {
2567
+ return val instanceof VaporFragment;
2568
+ }
2569
+ function isDynamicFragment(val) {
2570
+ return val instanceof DynamicFragment;
2518
2571
  }
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
2572
 
2534
2573
  const VaporTeleportImpl = {
2535
2574
  name: "VaporTeleport",
@@ -2602,7 +2641,7 @@ class TeleportFragment extends VaporFragment {
2602
2641
  setCurrentHydrationNode(targetNode.nextSibling);
2603
2642
  }
2604
2643
  if (!this.targetAnchor) {
2605
- this.mount(target);
2644
+ this.mountChildren(target);
2606
2645
  } else {
2607
2646
  this.initChildren();
2608
2647
  }
@@ -2643,11 +2682,13 @@ class TeleportFragment extends VaporFragment {
2643
2682
  const nodes = this.nodes;
2644
2683
  if (this.parentComponent && this.parentComponent.ut) {
2645
2684
  if (isFragment(nodes)) {
2646
- (nodes.updated || (nodes.updated = [])).push(() => updateCssVars(this));
2685
+ (nodes.onUpdated || (nodes.onUpdated = [])).push(
2686
+ () => updateCssVars(this)
2687
+ );
2647
2688
  } else if (isArray(nodes)) {
2648
2689
  nodes.forEach((node) => {
2649
2690
  if (isFragment(node)) {
2650
- (node.updated || (node.updated = [])).push(
2691
+ (node.onUpdated || (node.onUpdated = [])).push(
2651
2692
  () => updateCssVars(this)
2652
2693
  );
2653
2694
  }
@@ -2672,55 +2713,55 @@ class TeleportFragment extends VaporFragment {
2672
2713
  remove(this.nodes, this.mountContainer);
2673
2714
  insert(this.nodes = children, this.mountContainer, this.mountAnchor);
2674
2715
  }
2675
- handlePropsUpdate() {
2676
- if (!this.parent || isHydrating) return;
2677
- const mount = (parent, anchor) => {
2678
- if (this.$transition) {
2679
- applyTransitionHooks(this.nodes, this.$transition);
2716
+ mount(parent, anchor) {
2717
+ if (this.$transition) {
2718
+ applyTransitionHooks(this.nodes, this.$transition);
2719
+ }
2720
+ insert(
2721
+ this.nodes,
2722
+ this.mountContainer = parent,
2723
+ this.mountAnchor = anchor
2724
+ );
2725
+ }
2726
+ mountToTarget() {
2727
+ const target = this.target = resolveTeleportTarget(
2728
+ this.resolvedProps,
2729
+ querySelector
2730
+ );
2731
+ if (target) {
2732
+ if (
2733
+ // initial mount into target
2734
+ !this.targetAnchor || // target changed
2735
+ this.targetAnchor.parentNode !== target
2736
+ ) {
2737
+ insert(this.targetStart = createTextNode(""), target);
2738
+ insert(this.targetAnchor = createTextNode(""), target);
2680
2739
  }
2681
- insert(
2682
- this.nodes,
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
- );
2740
+ if (this.parentComponent && this.parentComponent.isCE) {
2741
+ (this.parentComponent.ce._teleportTargets || (this.parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
2712
2742
  }
2713
- };
2743
+ this.mount(target, this.targetAnchor);
2744
+ updateCssVars(this);
2745
+ } else if (!!(process.env.NODE_ENV !== "production")) {
2746
+ warn(
2747
+ `Invalid Teleport target on ${this.targetAnchor ? "update" : "mount"}:`,
2748
+ target,
2749
+ `(${typeof target})`
2750
+ );
2751
+ }
2752
+ }
2753
+ handlePropsUpdate() {
2754
+ if (!this.parent || isHydrating) return;
2714
2755
  if (this.isDisabled) {
2715
- mount(this.parent, this.anchor);
2756
+ this.mount(this.parent, this.anchor);
2716
2757
  updateCssVars(this);
2717
2758
  } else {
2718
2759
  if (isTeleportDeferred(this.resolvedProps) || // force defer when the parent is not connected to the DOM,
2719
2760
  // typically due to an early insertion caused by setInsertionState.
2720
2761
  !this.parent.isConnected) {
2721
- queuePostFlushCb(mountToTarget);
2762
+ queuePostFlushCb(this.mountToTarget.bind(this));
2722
2763
  } else {
2723
- mountToTarget();
2764
+ this.mountToTarget();
2724
2765
  }
2725
2766
  }
2726
2767
  }
@@ -2733,7 +2774,7 @@ class TeleportFragment extends VaporFragment {
2733
2774
  this.targetAnchor = targetNode && targetNode.nextSibling;
2734
2775
  this.initChildren();
2735
2776
  }
2736
- mount(target) {
2777
+ mountChildren(target) {
2737
2778
  target.appendChild(this.targetStart = createTextNode(""));
2738
2779
  target.appendChild(
2739
2780
  this.mountAnchor = this.targetAnchor = createTextNode("")
@@ -2963,12 +3004,9 @@ function hmrRerender(instance) {
2963
3004
  const normalized = normalizeBlock(instance.block);
2964
3005
  const parent = normalized[0].parentNode;
2965
3006
  const anchor = normalized[normalized.length - 1].nextSibling;
3007
+ instance.scope.reset();
2966
3008
  remove(instance.block, parent);
2967
3009
  const prev = setCurrentInstance(instance);
2968
- if (instance.renderEffects) {
2969
- instance.renderEffects.forEach((e) => e.stop());
2970
- instance.renderEffects = [];
2971
- }
2972
3010
  pushWarningContext(instance);
2973
3011
  devRender(instance);
2974
3012
  popWarningContext();
@@ -3037,10 +3075,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
3037
3075
  } else {
3038
3076
  resetInsertionState();
3039
3077
  }
3040
- const parentInstance = getParentInstance();
3041
- if (isSingleRoot && component.inheritAttrs !== false && isVaporComponent(parentInstance) && parentInstance.hasFallthrough) {
3042
- const attrs = parentInstance.attrs;
3043
- if (rawProps) {
3078
+ let prevSuspense = null;
3079
+ if (currentInstance && currentInstance.suspense) {
3080
+ prevSuspense = setParentSuspense(currentInstance.suspense);
3081
+ }
3082
+ if ((isSingleRoot || // transition has attrs fallthrough
3083
+ currentInstance && isVaporTransition(currentInstance.type)) && component.inheritAttrs !== false && isVaporComponent(currentInstance) && currentInstance.hasFallthrough) {
3084
+ const attrs = currentInstance.attrs;
3085
+ if (rawProps && rawProps !== EMPTY_OBJ) {
3044
3086
  (rawProps.$ || (rawProps.$ = [])).push(
3045
3087
  () => attrs
3046
3088
  );
@@ -3048,21 +3090,19 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
3048
3090
  rawProps = { $: [() => attrs] };
3049
3091
  }
3050
3092
  }
3051
- if (parentInstance && parentInstance.vapor && isKeepAlive(parentInstance)) {
3052
- const cached = parentInstance.getCachedComponent(
3093
+ if (currentInstance && currentInstance.vapor && isKeepAlive(currentInstance)) {
3094
+ const cached = currentInstance.getCachedComponent(
3053
3095
  component
3054
3096
  );
3055
3097
  if (cached) return cached;
3056
3098
  }
3057
3099
  if (appContext.vapor && !component.__vapor) {
3058
- const prevSlotConsumer2 = setCurrentSlotConsumer(null);
3059
3100
  const frag = appContext.vapor.vdomMount(
3060
3101
  component,
3061
- parentInstance,
3102
+ currentInstance,
3062
3103
  rawProps,
3063
3104
  rawSlots
3064
3105
  );
3065
- setCurrentSlotConsumer(prevSlotConsumer2);
3066
3106
  if (!isHydrating) {
3067
3107
  if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
3068
3108
  } else {
@@ -3090,10 +3130,9 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
3090
3130
  rawProps,
3091
3131
  rawSlots,
3092
3132
  appContext,
3093
- once,
3094
- parentInstance
3133
+ once
3095
3134
  );
3096
- const prevSlotConsumer = setCurrentSlotConsumer(null);
3135
+ const prevSlotOwner = setCurrentSlotOwner(null);
3097
3136
  if (!!(process.env.NODE_ENV !== "production")) {
3098
3137
  registerHMR(instance);
3099
3138
  instance.isSingleRoot = isSingleRoot;
@@ -3133,7 +3172,14 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
3133
3172
  } else {
3134
3173
  setupComponent(instance, component);
3135
3174
  }
3136
- setCurrentSlotConsumer(prevSlotConsumer);
3175
+ if (!!(process.env.NODE_ENV !== "production")) {
3176
+ popWarningContext();
3177
+ endMeasure(instance, "init");
3178
+ }
3179
+ if (currentInstance && currentInstance.suspense) {
3180
+ setParentSuspense(prevSuspense);
3181
+ }
3182
+ setCurrentSlotOwner(prevSlotOwner);
3137
3183
  onScopeDispose$1(() => unmountComponent(instance), true);
3138
3184
  if (_insertionParent || isHydrating) {
3139
3185
  mountComponent(instance, _insertionParent, _insertionAnchor);
@@ -3144,6 +3190,7 @@ function createComponent(component, rawProps, rawSlots, isSingleRoot, once, appC
3144
3190
  return instance;
3145
3191
  }
3146
3192
  function setupComponent(instance, component) {
3193
+ var _a;
3147
3194
  const prevInstance = setCurrentInstance(instance);
3148
3195
  const prevSub = setActiveSub();
3149
3196
  if (!!(process.env.NODE_ENV !== "production")) {
@@ -3154,49 +3201,44 @@ function setupComponent(instance, component) {
3154
3201
  instance.props,
3155
3202
  instance
3156
3203
  ]) || EMPTY_OBJ : EMPTY_OBJ;
3157
- if (!!(process.env.NODE_ENV !== "production") && !isBlock(setupResult)) {
3158
- if (isFunction(component)) {
3159
- warn(`Functional vapor component must return a block directly.`);
3160
- instance.block = [];
3161
- } else if (!component.render) {
3162
- warn(
3163
- `Vapor component setup() returned non-block value, and has no render function.`
3164
- );
3165
- instance.block = [];
3166
- } else {
3167
- instance.devtoolsRawSetupState = setupResult;
3168
- instance.setupState = proxyRefs(setupResult);
3169
- devRender(instance);
3204
+ const isAsyncSetup = isPromise(setupResult);
3205
+ if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) {
3206
+ markAsyncBoundary(instance);
3207
+ }
3208
+ if (isAsyncSetup) {
3209
+ {
3210
+ instance.asyncDep = setupResult;
3211
+ if (!!(process.env.NODE_ENV !== "production") && !instance.suspense) {
3212
+ const name = (_a = getComponentName(component)) != null ? _a : "Anonymous";
3213
+ warn(
3214
+ `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.`
3215
+ );
3216
+ }
3170
3217
  }
3171
3218
  } else {
3172
- if (!setupFn && component.render) {
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));
3219
+ handleSetupResult(setupResult, component, instance);
3184
3220
  }
3185
3221
  setActiveSub(prevSub);
3186
3222
  setCurrentInstance(...prevInstance);
3187
- if (!!(process.env.NODE_ENV !== "production")) {
3188
- popWarningContext();
3189
- endMeasure(instance, "init");
3190
- }
3191
3223
  }
3192
3224
  let isApplyingFallthroughProps = false;
3193
- function applyFallthroughProps(block, attrs) {
3194
- const el = getRootElement(block);
3195
- if (el) {
3196
- isApplyingFallthroughProps = true;
3197
- setDynamicProps(el, [attrs]);
3198
- isApplyingFallthroughProps = false;
3199
- }
3225
+ function applyFallthroughProps(el, attrs) {
3226
+ isApplyingFallthroughProps = true;
3227
+ setDynamicProps(el, [attrs]);
3228
+ isApplyingFallthroughProps = false;
3229
+ }
3230
+ function createDevSetupStateProxy(instance) {
3231
+ const { setupState } = instance;
3232
+ return new Proxy(setupState, {
3233
+ get(target, key, receiver) {
3234
+ if (isString(key) && !key.startsWith("__v") && !hasOwn(toRaw(setupState), key)) {
3235
+ warn(
3236
+ `Property ${JSON.stringify(key)} was accessed during render but is not defined on instance.`
3237
+ );
3238
+ }
3239
+ return Reflect.get(target, key, receiver);
3240
+ }
3241
+ });
3200
3242
  }
3201
3243
  function devRender(instance) {
3202
3244
  instance.block = (instance.type.render ? callWithErrorHandling(
@@ -3231,17 +3273,24 @@ const emptyContext = {
3231
3273
  provides: /* @__PURE__ */ Object.create(null)
3232
3274
  };
3233
3275
  class VaporComponentInstance {
3234
- constructor(comp, rawProps, rawSlots, appContext, once, parent = currentInstance) {
3276
+ constructor(comp, rawProps, rawSlots, appContext, once) {
3277
+ /**
3278
+ * dev only flag to track whether $attrs was used during render.
3279
+ * If $attrs was used during render then the warning for failed attrs
3280
+ * fallthrough can be suppressed.
3281
+ */
3282
+ this.accessedAttrs = false;
3235
3283
  this.vapor = true;
3236
3284
  this.uid = nextUid();
3237
3285
  this.type = comp;
3238
- this.parent = parent;
3239
- this.root = parent ? parent.root : this;
3240
- if (parent) {
3241
- this.appContext = parent.appContext;
3242
- this.provides = parent.provides;
3243
- this.ids = parent.ids;
3286
+ this.parent = currentInstance;
3287
+ if (currentInstance) {
3288
+ this.root = currentInstance.root;
3289
+ this.appContext = currentInstance.appContext;
3290
+ this.provides = currentInstance.provides;
3291
+ this.ids = currentInstance.ids;
3244
3292
  } else {
3293
+ this.root = this;
3245
3294
  this.appContext = appContext || emptyContext;
3246
3295
  this.provides = Object.create(this.appContext.provides);
3247
3296
  this.ids = ["", 0, 0];
@@ -3251,7 +3300,11 @@ class VaporComponentInstance {
3251
3300
  this.emit = emit.bind(null, this);
3252
3301
  this.expose = expose.bind(null, this);
3253
3302
  this.refs = EMPTY_OBJ;
3254
- this.emitted = this.exposed = this.exposeProxy = this.propsDefaults = this.suspense = null;
3303
+ this.emitted = this.exposed = this.exposeProxy = this.propsDefaults = null;
3304
+ this.suspense = parentSuspense;
3305
+ this.suspenseId = parentSuspense ? parentSuspense.pendingId : 0;
3306
+ this.asyncDep = null;
3307
+ this.asyncResolved = false;
3255
3308
  this.isMounted = this.isUnmounted = this.isUpdating = this.isDeactivated = false;
3256
3309
  this.rawProps = rawProps || EMPTY_OBJ;
3257
3310
  this.hasFallthrough = hasFallthroughAttrs(comp, rawProps);
@@ -3264,10 +3317,24 @@ class VaporComponentInstance {
3264
3317
  }
3265
3318
  this.rawSlots = rawSlots || EMPTY_OBJ;
3266
3319
  this.slots = rawSlots ? rawSlots.$ ? new Proxy(rawSlots, dynamicSlotsProxyHandlers) : rawSlots : EMPTY_OBJ;
3267
- this.scopeId = currentInstance && currentInstance.type.__scopeId;
3320
+ this.scopeId = getCurrentScopeId();
3268
3321
  if (comp.ce) {
3269
3322
  comp.ce(this);
3270
3323
  }
3324
+ if (!!(process.env.NODE_ENV !== "production")) {
3325
+ if (this.props === this.attrs) {
3326
+ this.accessedAttrs = true;
3327
+ } else {
3328
+ const attrs = this.attrs;
3329
+ const instance = this;
3330
+ this.attrs = new Proxy(attrs, {
3331
+ get(target, key, receiver) {
3332
+ instance.accessedAttrs = true;
3333
+ return Reflect.get(target, key, receiver);
3334
+ }
3335
+ });
3336
+ }
3337
+ }
3271
3338
  }
3272
3339
  /**
3273
3340
  * Expose `getKeysFromRawProps` on the instance so it can be used in code
@@ -3305,7 +3372,7 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
3305
3372
  const el = isHydrating ? adoptTemplate(currentHydrationNode, `<${comp}/>`) : createElement(comp);
3306
3373
  el.$root = isSingleRoot;
3307
3374
  if (!isHydrating) {
3308
- const scopeId = currentInstance.type.__scopeId;
3375
+ const scopeId = getCurrentScopeId();
3309
3376
  if (scopeId) setScopeId(el, [scopeId]);
3310
3377
  }
3311
3378
  if (rawProps) {
@@ -3343,6 +3410,14 @@ function createPlainElement(comp, rawProps, rawSlots, isSingleRoot, once) {
3343
3410
  return el;
3344
3411
  }
3345
3412
  function mountComponent(instance, parent, anchor) {
3413
+ if (instance.suspense && instance.asyncDep && !instance.asyncResolved) {
3414
+ const component = instance.type;
3415
+ instance.suspense.registerDep(instance, (setupResult) => {
3416
+ handleSetupResult(setupResult, component, instance);
3417
+ mountComponent(instance, parent, anchor);
3418
+ });
3419
+ return;
3420
+ }
3346
3421
  if (instance.shapeFlag & 512) {
3347
3422
  findParentKeepAlive(instance).activate(instance, parent, anchor);
3348
3423
  return;
@@ -3398,15 +3473,22 @@ function getExposed(instance) {
3398
3473
  }));
3399
3474
  }
3400
3475
  }
3401
- function getRootElement(block) {
3476
+ function getRootElement(block, onDynamicFragment, recurse = true) {
3402
3477
  if (block instanceof Element) {
3403
3478
  return block;
3404
3479
  }
3405
- if (block instanceof DynamicFragment) {
3480
+ if (recurse && isVaporComponent(block)) {
3481
+ return getRootElement(block.block, onDynamicFragment, recurse);
3482
+ }
3483
+ if (isFragment(block) && !(block instanceof TeleportFragment)) {
3484
+ if (block instanceof DynamicFragment && onDynamicFragment) {
3485
+ onDynamicFragment(block);
3486
+ }
3406
3487
  const { nodes } = block;
3407
3488
  if (nodes instanceof Element && nodes.$root) {
3408
3489
  return nodes;
3409
3490
  }
3491
+ return getRootElement(nodes, onDynamicFragment, recurse);
3410
3492
  }
3411
3493
  if (isArray(block)) {
3412
3494
  let singleRoot;
@@ -3416,7 +3498,7 @@ function getRootElement(block) {
3416
3498
  hasComment = true;
3417
3499
  continue;
3418
3500
  }
3419
- const thisRoot = getRootElement(b);
3501
+ const thisRoot = getRootElement(b, onDynamicFragment, recurse);
3420
3502
  if (!thisRoot || singleRoot) {
3421
3503
  return;
3422
3504
  }
@@ -3425,6 +3507,69 @@ function getRootElement(block) {
3425
3507
  return hasComment ? singleRoot : void 0;
3426
3508
  }
3427
3509
  }
3510
+ function isVaporTransition(component) {
3511
+ return getComponentName(component) === "VaporTransition";
3512
+ }
3513
+ function handleSetupResult(setupResult, component, instance) {
3514
+ if (!!(process.env.NODE_ENV !== "production")) {
3515
+ pushWarningContext(instance);
3516
+ }
3517
+ if (!!(process.env.NODE_ENV !== "production") && !isBlock(setupResult)) {
3518
+ if (isFunction(component)) {
3519
+ warn(`Functional vapor component must return a block directly.`);
3520
+ instance.block = [];
3521
+ } else if (!component.render) {
3522
+ warn(
3523
+ `Vapor component setup() returned non-block value, and has no render function.`
3524
+ );
3525
+ instance.block = [];
3526
+ } else {
3527
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
3528
+ instance.devtoolsRawSetupState = setupResult;
3529
+ }
3530
+ instance.setupState = proxyRefs(setupResult);
3531
+ if (!!(process.env.NODE_ENV !== "production")) {
3532
+ instance.setupState = createDevSetupStateProxy(instance);
3533
+ }
3534
+ devRender(instance);
3535
+ }
3536
+ } else {
3537
+ if (setupResult === EMPTY_OBJ && component.render) {
3538
+ instance.block = callWithErrorHandling(
3539
+ component.render,
3540
+ instance,
3541
+ 1
3542
+ );
3543
+ } else {
3544
+ instance.block = setupResult;
3545
+ }
3546
+ }
3547
+ if (instance.hasFallthrough && component.inheritAttrs !== false && Object.keys(instance.attrs).length) {
3548
+ const root = getRootElement(
3549
+ instance.block,
3550
+ // attach attrs to root dynamic fragments for applying during each update
3551
+ (frag) => frag.attrs = instance.attrs,
3552
+ false
3553
+ );
3554
+ if (root) {
3555
+ renderEffect(() => {
3556
+ const attrs = isFunction(component) && !isVaporTransition(component) ? getFunctionalFallthrough(instance.attrs) : instance.attrs;
3557
+ if (attrs) applyFallthroughProps(root, attrs);
3558
+ });
3559
+ } else if (!!(process.env.NODE_ENV !== "production") && (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || // preventing attrs fallthrough on Teleport
3560
+ // consistent with VDOM Teleport behavior
3561
+ instance.block instanceof TeleportFragment)) {
3562
+ warnExtraneousAttributes(instance.attrs);
3563
+ }
3564
+ }
3565
+ if (!!(process.env.NODE_ENV !== "production")) {
3566
+ popWarningContext();
3567
+ }
3568
+ }
3569
+ function getCurrentScopeId() {
3570
+ const scopeOwner = getScopeOwner();
3571
+ return scopeOwner ? scopeOwner.type.__scopeId : void 0;
3572
+ }
3428
3573
 
3429
3574
  let _createApp;
3430
3575
  const mountApp = (app, container) => {
@@ -3625,7 +3770,7 @@ function createInnerComp(comp, parent, frag) {
3625
3770
  appContext
3626
3771
  );
3627
3772
  if ($transition) setTransitionHooks(instance, $transition);
3628
- frag && frag.setRef && frag.setRef(instance);
3773
+ frag && frag.setAsyncRef && frag.setAsyncRef(instance);
3629
3774
  return instance;
3630
3775
  }
3631
3776
 
@@ -3741,247 +3886,84 @@ class VaporElement extends VueElementBase {
3741
3886
  createComponent(
3742
3887
  this._def,
3743
3888
  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
- }
3889
+ void 0,
3890
+ void 0,
3891
+ void 0,
3892
+ this._app._context
3893
+ );
3947
3894
  }
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
3895
  }
3956
- function recordPosition(c) {
3957
- newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
3896
+
3897
+ let t;
3898
+ /*! #__NO_SIDE_EFFECTS__ */
3899
+ // @__NO_SIDE_EFFECTS__
3900
+ function template(html, root, ns) {
3901
+ let node;
3902
+ return () => {
3903
+ if (isHydrating) {
3904
+ const adopted = adoptTemplate(currentHydrationNode, html);
3905
+ if (root) adopted.$root = true;
3906
+ return adopted;
3907
+ }
3908
+ if (html[0] !== "<") {
3909
+ return createTextNode(html);
3910
+ }
3911
+ if (!node) {
3912
+ t = t || document.createElement("template");
3913
+ if (ns) {
3914
+ const tag = ns === 1 ? "svg" : "math";
3915
+ t.innerHTML = `<${tag}>${html}</${tag}>`;
3916
+ node = _child(_child(t.content));
3917
+ } else {
3918
+ t.innerHTML = html;
3919
+ node = _child(t.content);
3920
+ }
3921
+ }
3922
+ const ret = node.cloneNode(true);
3923
+ if (root) ret.$root = true;
3924
+ return ret;
3925
+ };
3958
3926
  }
3959
- function applyTranslation(c) {
3960
- if (baseApplyTranslation(
3961
- positionMap.get(c),
3962
- newPositionMap.get(c),
3963
- getTransitionElement(c)
3964
- )) {
3965
- return c;
3927
+
3928
+ function createIf(condition, b1, b2, once) {
3929
+ const _insertionParent = insertionParent;
3930
+ const _insertionAnchor = insertionAnchor;
3931
+ const _isLastInsertion = isLastInsertion;
3932
+ if (!isHydrating) resetInsertionState();
3933
+ let frag;
3934
+ if (once) {
3935
+ frag = condition() ? b1() : b2 ? b2() : [];
3936
+ } else {
3937
+ frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
3938
+ renderEffect(() => frag.update(condition() ? b1 : b2));
3966
3939
  }
3967
- }
3968
- function getFirstConnectedChild(children) {
3969
- for (let i = 0; i < children.length; i++) {
3970
- const child = children[i];
3971
- const el = getTransitionElement(child);
3972
- if (el.isConnected) return el;
3940
+ if (!isHydrating) {
3941
+ if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
3942
+ } else {
3943
+ if (_isLastInsertion) {
3944
+ advanceHydrationNode(_insertionParent);
3945
+ }
3973
3946
  }
3947
+ return frag;
3974
3948
  }
3975
- function triggerTransitionGroupUpdate(transition) {
3976
- const { instance } = transition;
3977
- if (!instance.isUpdating) {
3978
- instance.isUpdating = true;
3979
- if (instance.bu) invokeArrayFns(instance.bu);
3980
- queuePostFlushCb(() => {
3981
- instance.isUpdating = false;
3982
- if (instance.u) invokeArrayFns(instance.u);
3983
- });
3949
+
3950
+ function createKeyedFragment(key, render) {
3951
+ const _insertionParent = insertionParent;
3952
+ const _insertionAnchor = insertionAnchor;
3953
+ const _isLastInsertion = isLastInsertion;
3954
+ if (!isHydrating) resetInsertionState();
3955
+ const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
3956
+ renderEffect(() => {
3957
+ frag.update(render, key());
3958
+ });
3959
+ if (!isHydrating) {
3960
+ if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
3961
+ } else {
3962
+ if (_isLastInsertion) {
3963
+ advanceHydrationNode(_insertionParent);
3964
+ }
3984
3965
  }
3966
+ return frag;
3985
3967
  }
3986
3968
 
3987
3969
  class ForBlock extends VaporFragment {
@@ -4026,10 +4008,6 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
4026
4008
  const oldLength = oldBlocks.length;
4027
4009
  newBlocks = new Array(newLength);
4028
4010
  let isFallback = false;
4029
- const transitionHooks = frag.$transition;
4030
- if (transitionHooks && transitionHooks.group && isMounted) {
4031
- triggerTransitionGroupUpdate(transitionHooks);
4032
- }
4033
4011
  const prevSub = setActiveSub();
4034
4012
  if (!isMounted) {
4035
4013
  isMounted = true;
@@ -4245,7 +4223,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
4245
4223
  } else {
4246
4224
  oldBlocks = [];
4247
4225
  }
4248
- if (isMounted && frag.updated) frag.updated.forEach((m) => m());
4226
+ if (isMounted && frag.onUpdated) frag.onUpdated.forEach((m) => m());
4249
4227
  setActiveSub(prevSub);
4250
4228
  };
4251
4229
  const needKey = renderItem.length > 1;
@@ -4274,7 +4252,7 @@ const createFor = (src, renderItem, getKey, flags = 0, setup) => {
4274
4252
  key2
4275
4253
  );
4276
4254
  if (frag.$transition) {
4277
- applyTransitionHooks(block.nodes, frag.$transition, false);
4255
+ applyTransitionHooks(block.nodes, frag.$transition);
4278
4256
  }
4279
4257
  if (parent) insert(block.nodes, parent, anchor);
4280
4258
  return block;
@@ -4455,6 +4433,18 @@ function isForBlock(block) {
4455
4433
  return block instanceof ForBlock;
4456
4434
  }
4457
4435
 
4436
+ const refCleanups = /* @__PURE__ */ new WeakMap();
4437
+ function ensureCleanup(el) {
4438
+ let cleanupRef = refCleanups.get(el);
4439
+ if (!cleanupRef) {
4440
+ refCleanups.set(el, cleanupRef = { fn: NOOP });
4441
+ onScopeDispose$1(() => {
4442
+ cleanupRef.fn();
4443
+ refCleanups.delete(el);
4444
+ });
4445
+ }
4446
+ return cleanupRef;
4447
+ }
4458
4448
  function createTemplateRefSetter() {
4459
4449
  const instance = currentInstance;
4460
4450
  return (...args) => setRef(instance, ...args);
@@ -4465,12 +4455,10 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
4465
4455
  el.setRef(instance, ref, refFor, refKey);
4466
4456
  return;
4467
4457
  }
4468
- const isVaporComp = isVaporComponent(el);
4469
- if (isVaporComp && isAsyncWrapper(el)) {
4470
- const i = el;
4471
- const frag = i.block;
4472
- if (!i.type.__asyncResolved) {
4473
- frag.setRef = (i2) => setRef(instance, i2, ref, oldRef, refFor);
4458
+ if (isVaporComponent(el) && isAsyncWrapper(el)) {
4459
+ const frag = el.block;
4460
+ if (!el.type.__asyncResolved) {
4461
+ frag.setAsyncRef = (i) => setRef(instance, i, ref, oldRef, refFor);
4474
4462
  return;
4475
4463
  }
4476
4464
  el = frag.nodes;
@@ -4478,11 +4466,11 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
4478
4466
  const setupState = !!(process.env.NODE_ENV !== "production") ? instance.setupState || {} : null;
4479
4467
  const refValue = getRefValue(el);
4480
4468
  const refs = instance.refs === EMPTY_OBJ ? instance.refs = {} : instance.refs;
4481
- const canSetSetupRef = createCanSetSetupRefChecker(setupState);
4469
+ const canSetSetupRef = !!(process.env.NODE_ENV !== "production") ? createCanSetSetupRefChecker(setupState) : NO;
4482
4470
  if (oldRef != null && oldRef !== ref) {
4483
4471
  if (isString(oldRef)) {
4484
4472
  refs[oldRef] = null;
4485
- if (!!(process.env.NODE_ENV !== "production") && hasOwn(setupState, oldRef)) {
4473
+ if (!!(process.env.NODE_ENV !== "production") && canSetSetupRef(oldRef)) {
4486
4474
  setupState[oldRef] = null;
4487
4475
  }
4488
4476
  } else if (isRef$1(oldRef)) {
@@ -4497,7 +4485,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
4497
4485
  ]);
4498
4486
  };
4499
4487
  invokeRefSetter(refValue);
4500
- onScopeDispose$1(() => invokeRefSetter());
4488
+ ensureCleanup(el).fn = () => invokeRefSetter(null);
4501
4489
  } else {
4502
4490
  const _isString = isString(ref);
4503
4491
  const _isRef = isRef$1(ref);
@@ -4534,7 +4522,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
4534
4522
  }
4535
4523
  };
4536
4524
  queuePostFlushCb(doSet, -1);
4537
- onScopeDispose$1(() => {
4525
+ ensureCleanup(el).fn = () => {
4538
4526
  queuePostFlushCb(() => {
4539
4527
  if (isArray(existing)) {
4540
4528
  remove$1(existing, refValue);
@@ -4548,7 +4536,7 @@ function setRef(instance, el, ref, oldRef, refFor = false, refKey) {
4548
4536
  if (refKey) refs[refKey] = null;
4549
4537
  }
4550
4538
  });
4551
- });
4539
+ };
4552
4540
  } else if (!!(process.env.NODE_ENV !== "production")) {
4553
4541
  warn("Invalid template ref type:", ref, `(${typeof ref})`);
4554
4542
  }
@@ -4666,18 +4654,15 @@ function setDisplay(target, value) {
4666
4654
  if (target.length === 0) return;
4667
4655
  if (target.length === 1) return setDisplay(target[0], value);
4668
4656
  }
4669
- if (target instanceof DynamicFragment) {
4670
- return setDisplay(target.nodes, value);
4671
- }
4672
- if (target instanceof VaporFragment && target.insert) {
4657
+ if (isFragment(target)) {
4673
4658
  return setDisplay(target.nodes, value);
4674
4659
  }
4675
- const { $transition } = target;
4676
4660
  if (target instanceof Element) {
4677
4661
  const el = target;
4678
4662
  if (!(vShowOriginalDisplay in el)) {
4679
4663
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
4680
4664
  }
4665
+ const { $transition } = target;
4681
4666
  if ($transition) {
4682
4667
  if (value) {
4683
4668
  $transition.beforeEnter(target);
@@ -4780,12 +4765,167 @@ const applyDynamicModel = (el, get, set, modifiers) => {
4780
4765
  };
4781
4766
 
4782
4767
  function withVaporDirectives(node, dirs) {
4768
+ const element = isVaporComponent(node) ? getRootElement(node.block) : node;
4769
+ if (!element) {
4770
+ if (!!(process.env.NODE_ENV !== "production")) {
4771
+ warn(
4772
+ `Runtime directive used on component with non-element root node. The directives will not function as intended.`
4773
+ );
4774
+ }
4775
+ return;
4776
+ }
4783
4777
  for (const [dir, value, argument, modifiers] of dirs) {
4784
4778
  if (dir) {
4785
- const ret = dir(node, value, argument, modifiers);
4779
+ const ret = dir(element, value, argument, modifiers);
4786
4780
  if (ret) onScopeDispose(ret);
4787
4781
  }
4788
4782
  }
4789
4783
  }
4790
4784
 
4791
- 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 };
4785
+ const positionMap = /* @__PURE__ */ new WeakMap();
4786
+ const newPositionMap = /* @__PURE__ */ new WeakMap();
4787
+ const decorate = (t) => {
4788
+ delete t.props.mode;
4789
+ t.__vapor = true;
4790
+ return t;
4791
+ };
4792
+ const VaporTransitionGroup = decorate({
4793
+ name: "VaporTransitionGroup",
4794
+ props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
4795
+ tag: String,
4796
+ moveClass: String
4797
+ }),
4798
+ setup(props, { slots }) {
4799
+ const instance = currentInstance;
4800
+ const state = useTransitionState();
4801
+ const cssTransitionProps = resolveTransitionProps(props);
4802
+ let prevChildren;
4803
+ let children;
4804
+ const slottedBlock = slots.default && slots.default();
4805
+ onBeforeUpdate(() => {
4806
+ prevChildren = [];
4807
+ children = getTransitionBlocks(slottedBlock);
4808
+ if (children) {
4809
+ for (let i = 0; i < children.length; i++) {
4810
+ const child = children[i];
4811
+ if (isValidTransitionBlock(child)) {
4812
+ prevChildren.push(child);
4813
+ child.$transition.disabled = true;
4814
+ positionMap.set(
4815
+ child,
4816
+ getTransitionElement(child).getBoundingClientRect()
4817
+ );
4818
+ }
4819
+ }
4820
+ }
4821
+ });
4822
+ onUpdated(() => {
4823
+ if (!prevChildren.length) {
4824
+ return;
4825
+ }
4826
+ const moveClass = props.moveClass || `${props.name || "v"}-move`;
4827
+ const firstChild = getFirstConnectedChild(prevChildren);
4828
+ if (!firstChild || !hasCSSTransform(
4829
+ firstChild,
4830
+ firstChild.parentNode,
4831
+ moveClass
4832
+ )) {
4833
+ prevChildren = [];
4834
+ return;
4835
+ }
4836
+ prevChildren.forEach(callPendingCbs);
4837
+ prevChildren.forEach((child) => {
4838
+ child.$transition.disabled = false;
4839
+ recordPosition(child);
4840
+ });
4841
+ const movedChildren = prevChildren.filter(applyTranslation);
4842
+ forceReflow();
4843
+ movedChildren.forEach(
4844
+ (c) => handleMovedChildren(
4845
+ getTransitionElement(c),
4846
+ moveClass
4847
+ )
4848
+ );
4849
+ prevChildren = [];
4850
+ });
4851
+ setTransitionHooksOnFragment(slottedBlock, {
4852
+ props: cssTransitionProps,
4853
+ state,
4854
+ instance
4855
+ });
4856
+ children = getTransitionBlocks(slottedBlock);
4857
+ for (let i = 0; i < children.length; i++) {
4858
+ const child = children[i];
4859
+ if (isValidTransitionBlock(child)) {
4860
+ if (child.$key != null) {
4861
+ const hooks = resolveTransitionHooks(
4862
+ child,
4863
+ cssTransitionProps,
4864
+ state,
4865
+ instance
4866
+ );
4867
+ setTransitionHooks(child, hooks);
4868
+ } else if (!!(process.env.NODE_ENV !== "production")) {
4869
+ warn(`<transition-group> children must be keyed`);
4870
+ }
4871
+ }
4872
+ }
4873
+ const tag = props.tag;
4874
+ if (tag) {
4875
+ const container = createElement(tag);
4876
+ insert(slottedBlock, container);
4877
+ return container;
4878
+ } else {
4879
+ return slottedBlock;
4880
+ }
4881
+ }
4882
+ });
4883
+ function getTransitionBlocks(block) {
4884
+ let children = [];
4885
+ if (block instanceof Node) {
4886
+ children.push(block);
4887
+ } else if (isVaporComponent(block)) {
4888
+ children.push(...getTransitionBlocks(block.block));
4889
+ } else if (isArray(block)) {
4890
+ for (let i = 0; i < block.length; i++) {
4891
+ const b = block[i];
4892
+ const blocks = getTransitionBlocks(b);
4893
+ if (isForBlock(b)) blocks.forEach((block2) => block2.$key = b.key);
4894
+ children.push(...blocks);
4895
+ }
4896
+ } else if (isFragment(block)) {
4897
+ if (block.insert) {
4898
+ children.push(block);
4899
+ } else {
4900
+ children.push(...getTransitionBlocks(block.nodes));
4901
+ }
4902
+ }
4903
+ return children;
4904
+ }
4905
+ function isValidTransitionBlock(block) {
4906
+ return !!(block instanceof Element || isFragment(block) && block.insert);
4907
+ }
4908
+ function getTransitionElement(c) {
4909
+ return isFragment(c) ? c.nodes : c;
4910
+ }
4911
+ function recordPosition(c) {
4912
+ newPositionMap.set(c, getTransitionElement(c).getBoundingClientRect());
4913
+ }
4914
+ function applyTranslation(c) {
4915
+ if (baseApplyTranslation(
4916
+ positionMap.get(c),
4917
+ newPositionMap.get(c),
4918
+ getTransitionElement(c)
4919
+ )) {
4920
+ return c;
4921
+ }
4922
+ }
4923
+ function getFirstConnectedChild(children) {
4924
+ for (let i = 0; i < children.length; i++) {
4925
+ const child = children[i];
4926
+ const el = getTransitionElement(child);
4927
+ if (el.isConnected) return el;
4928
+ }
4929
+ }
4930
+
4931
+ export { VaporElement, 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 };