This commit is contained in:
eewing
2026-02-17 14:10:16 -06:00
parent 2bca5834c5
commit cf73cd3b4c
11246 changed files with 1690552 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { CommandInputProps } from "../types.js";
import { CommandInputState } from "../command.svelte.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
value = $bindable(""),
autofocus = false,
id = createId(uid),
ref = $bindable(null),
child,
...restProps
}: CommandInputProps = $props();
const inputState = CommandInputState.create({
id: boxWith(() => id),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
value: boxWith(
() => value,
(v) => {
value = v;
}
),
autofocus: boxWith(() => autofocus ?? false),
});
const mergedProps = $derived(mergeProps(restProps, inputState.props));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<input {...mergedProps} bind:value />
{/if}