PageSourceSearch

https://yoyaku.japonin.com/build/assets/Presence-cO_5fvNh.js

js japonin.com collected 2026-10-04 17:47:33 UTC 3,433 bytes, 3 lines download raw bytes

1import{i as T}from"./useForwardPropsEmits-BKczLiIH.js";import{an as g,m as f,w as y,G as w,y as C,k as O,d as S,U,ab as P,a0 as b}from"./app-BI29fHxo.js";import{r as x}from"./Primitive-DQjp7_L1.js";import{e as _,i as $,f as D}from"./useForwardExpose-Dgo49POy.js";function q(a){return a==null}function G(a,e="reka"){let i;const o=T({useId:void 0});return o.useId?i=o.useId():i=g?.(),e?`${e}-${i}`:i}function F(a,e){const i=f(a);function o(u){return e[i.value][u]??i.value}return{state:i,dispatch:u=>{i.value=o(u)}}}function L(a,e){const i=f({}),o=f("none"),v=f(a),u=a.value?"mounted":"unmounted";let l;const c=e.value?.ownerDocument.defaultView??_,{state:m,dispatch:s}=F(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),n=t=>{if($){const r=new CustomEvent(t,{bubbles:!1,cancelable:!1});e.value?.dispatchEvent(r)}};y(a,async(t,r)=>{const h=r!==t;if(await w(),h){const A=o.value,d=N(e.value);t?(s("MOUNT"),n("enter"),d==="none"&&n("after-enter")):d==="none"||d==="undefined"||i.value?.display==="none"?(s("UNMOUNT"),n("leave"),n("after-leave")):r&&A!==d?(s("ANIMATION_OUT"),n("leave")):(s("UNMOUNT"),n("after-leave"))}},{immediate:!0});const p=t=>{const r=N(e.value),h=r.includes(CSS.escape(t.animationName)),A=m.value==="mounted"?"enter":"leave";if(t.target===e.value&&h&&(n(`after-${A}`),s("ANIMATION_END"),!v.value)){const d=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",l=c?.setTimeout(()=>{e.value?.style.animationFillMode==="forwards"&&(e.value.style.animationFillMode=d)})}t.target===e.value&&r==="none"&&s("ANIMATION_END")},I=t=>{t.target===e.value&&(o.value=N(e.value))},M=y(e,(t,r)=>{t?(i.value=getComputedStyle(t),t.addEventListener("animationstart",I),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p)):(s("ANIMATION_END"),l!==void 0&&c?.clearTimeout(l),r?.removeEventListener("animationstart",I),r?.removeEventListener("animationcancel",p),r?.removeEventListener("animationend",p))},{immediate:!0}),E=y(m,()=>{const t=N(e.value);o.value=m.value==="mounted"?t:"none"});return C(()=>{M(),E()}),{isPresent:O(()=>["mounted","unmountSuspended"].includes(m.value))}}function N(a){return a&&getComputedStyle(a).animationName||"none"}var Y=S({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(a,{slots:e,expose:i}){const{present:o,forceMount:v}=U(a),u=f(),{isPresent:l}=L(o,u);i({present:l});let c=e.default({present:l.value});c=x(c||[]);const m=b();if(c&&c?.length>1){const s=m?.parent?.type.name?`<${m.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${s}\` for  \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(n=>`  - ${n}`).join(`
2`)].join(`
3`))}return()=>v.value||o.value||l.value?P(e.default({present:l.value})[0],{ref:s=>{const n=D(s);return typeof n?.hasAttribute>"u"||(n?.hasAttribute("data-reka-popper-content-wrapper")?u.value=n.firstElementChild:u.value=n),n}}):null}});export{Y as P,q as i,G as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.