{#if !hideLabel}
{label}
{/if} {#if editing}
{ e.preventDefault(); save(); }} onfocusout={(e) => { const to = e.relatedTarget as Node | null; // Closing removes the field, which fires this too: only a real move away while editing saves. if (editing && !saving && !form?.contains(to)) save(false); }} >
{ if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); close(); } }} />
{#if saving}
{:else}
{/if}
e.preventDefault()} onclick={() => close()}>
{#if error}
{error}
{/if} {:else}
{value || placeholder}
, edit
{#if saved}
{:else}
{/if}
{/if}