Files
eewing ec317eb17c
CI / build (push) Has been skipped
CI / deploy (push) Successful in 1m11s
INIT
2026-02-18 15:17:47 -06:00

39 lines
925 B
Svelte

<script lang="ts">
import { boxWith, mergeProps } from "svelte-toolbelt";
import type { CalendarHeadingProps } from "../types.js";
import { CalendarHeadingState } from "../calendar.svelte.js";
import { createId } from "../../../internal/create-id.js";
const uid = $props.id();
let {
children,
child,
ref = $bindable(null),
id = createId(uid),
...restProps
}: CalendarHeadingProps = $props();
const headingState = CalendarHeadingState.create({
id: boxWith(() => id),
ref: boxWith(
() => ref,
(v) => (ref = v)
),
});
const mergedProps = $derived(mergeProps(restProps, headingState.props));
</script>
{#if child}
{@render child({ props: mergedProps, headingValue: headingState.root.headingValue })}
{:else}
<div {...mergedProps}>
{#if children}
{@render children?.({ headingValue: headingState.root.headingValue })}
{:else}
{headingState.root.headingValue}
{/if}
</div>
{/if}