Files
eewing cf73cd3b4c INIT
2026-02-17 14:10:16 -06:00

39 lines
853 B
Svelte

<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { ToolbarRootProps } from "../types.js";
import { ToolbarRootState } from "../toolbar.svelte.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
ref = $bindable(null),
id = createId(uid),
orientation = "horizontal",
loop = true,
child,
children,
...restProps
}: ToolbarRootProps = $props();
const rootState = ToolbarRootState.create({
id: boxWith(() => id),
orientation: boxWith(() => orientation),
loop: boxWith(() => loop),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, rootState.props));
</script>
{#if child}
{@render child({ props: mergedProps })}
{:else}
<div {...mergedProps}>
{@render children?.()}
</div>
{/if}