{#snippet dialog()}
{ const target = e.target as HTMLElement; if (open && !dialogContainer?.contains(target) && target !== dialogContainer) open = false; }} onkeydown={(e) => { if (e.key === 'Escape') { open = false; } }} role="dialog" tabindex="-1" >
{title}
{#if error}
{/if} {#if description}
{description}
{/if} {#if children}{@render children()}{:else}Dialog is empty{/if}
{#if controls && typeof controls === 'function'}{@render controls()}{:else}
{ if (controls?.cancel?.action) { controls.cancel.action(dialogAPI); } else if (!frozen) { open = false; } }} disabled={frozen} > {controls?.cancel?.label || 'Cancel'}
{ if (controls?.ok?.action) { controls.ok.action(dialogAPI); } else if (!frozen && !loading) { open = false; } }} disabled={frozen} {loading} > {controls?.ok?.label || 'OK'}
{/if}
{ if (!frozen) open = false; }} disabled={frozen} >
{/snippet}