import { createSignal, onMount, onCleanup } from 'solid-js'; interface PasskeyToastProps { site: string; displayName: string; username: string; requestId: string; onSignIn: () => void; onDeny: () => void; } const TIMEOUT_MS = 30_000; export function PasskeyToast(props: PasskeyToastProps) { const [visible, setVisible] = createSignal(false); const [exiting, setExiting] = createSignal(false); let timeoutId: number; onMount(() => { requestAnimationFrame(() => setVisible(true)); timeoutId = window.setTimeout(() => { handleDeny(); }, TIMEOUT_MS); }); onCleanup(() => { clearTimeout(timeoutId); }); function handleSignIn() { clearTimeout(timeoutId); exit(props.onSignIn); } function handleDeny() { clearTimeout(timeoutId); exit(props.onDeny); } function exit(callback: () => void) { setExiting(true); setTimeout(callback, 220); } // on:click bypasses Solid's document-level event delegation, which breaks // inside shadow DOM because event.target is retargeted to the shadow host. return (

sign in to {props.site}?

{props.displayName} ยท {props.username}
); }