2026-02-02 18:09:14 +00:00
|
|
|
<script lang="ts">
|
2026-09-12 17:03:24 +00:00
|
|
|
import {getContext} from "svelte"
|
2026-02-02 18:09:14 +00:00
|
|
|
import type {Snippet} from "svelte"
|
2026-09-12 17:03:24 +00:00
|
|
|
import cx from "classnames"
|
|
|
|
|
import {randomId} from "@welshman/lib"
|
|
|
|
|
import type {DialogContext} from "@lib/components/dialog"
|
|
|
|
|
import {DIALOG_CONTEXT} from "@lib/components/dialog"
|
2026-02-02 18:09:14 +00:00
|
|
|
|
2026-09-12 17:03:24 +00:00
|
|
|
type Props = {
|
|
|
|
|
class?: string
|
2026-02-02 18:09:14 +00:00
|
|
|
children: Snippet
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-12 17:03:24 +00:00
|
|
|
const {children, ...props}: Props = $props()
|
|
|
|
|
|
|
|
|
|
const id = randomId()
|
|
|
|
|
const context = getContext<DialogContext | undefined>(DIALOG_CONTEXT)
|
|
|
|
|
|
|
|
|
|
$effect(() => context?.registerTitle(id))
|
2026-02-02 18:09:14 +00:00
|
|
|
</script>
|
|
|
|
|
|
2026-09-12 17:03:24 +00:00
|
|
|
<h1 {id} class={cx("heading", props.class)} tabindex="-1">{@render children()}</h1>
|