Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243<script lang="ts"> // A name typed in place: Enter or leaving it keeps what it says, Esc keeps // the old one, and an empty name clears it. let { value, placeholder, label, ondone }: { value: string; placeholder: string; label: string; ondone: (name: string | null) => void } = $props();
let done = false;
function finish(event: KeyboardEvent | FocusEvent) { if (event instanceof KeyboardEvent && event.key !== 'Enter' && event.key !== 'Escape') return; if (done) return; done = true; ondone(event instanceof KeyboardEvent && event.key === 'Escape' ? null : (event.currentTarget as HTMLInputElement).value.trim()); }</script>
<input class="name-field nodrag" {value} {placeholder} aria-label={label} onkeydown={finish} onblur={finish} {@attach (field) => { field.focus(); field.select(); }}/>
<style> .name-field { flex: 1; min-width: 0; padding: 2px 6px; margin-left: -6px; color: var(--text); font: inherit; background: var(--field); border: 0; border-radius: 6px; outline: none; }</style>