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
@@ -0,0 +1,51 @@
<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { CommandLinkItemProps } from "../types.js";
import { CommandItemState } from "../command.svelte.js";
import { noop } from "../../../internal/noop.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
id = createId(uid),
ref = $bindable(null),
value = "",
disabled = false,
children,
child,
onSelect = noop,
forceMount = false,
keywords = [],
...restProps
}: CommandLinkItemProps = $props();
const itemState = CommandItemState.create({
id: boxWith(() => id),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
value: boxWith(() => value),
disabled: boxWith(() => disabled),
onSelect: boxWith(() => onSelect),
forceMount: boxWith(() => forceMount),
keywords: boxWith(() => keywords),
});
const mergedProps = $derived(mergeProps(restProps, itemState.props));
</script>
{#key itemState.root.key}
<div style="display: contents;">
{#if itemState.shouldRender}
{#if child}
{@render child({ props: mergedProps })}
{:else}
<a {...mergedProps}>
{@render children?.()}
</a>
{/if}
{/if}
</div>
{/key}