// The heading element a composite renders, written out one intrinsic per level. `` over // `headingTag(level)` is a string to the server's JSX factory and a COMPONENT to the island // build's Solid transform, which calls it and throws (#488, `intrinsic-root.test.ts`). PageHeader, // Section and Accordion all render through this, so the switch exists once. import type { JSX } from 'solid-js'; import type { HeadingTag } from './heading-level'; export interface HeadingNodeAttrs { readonly id?: string | undefined; readonly class?: string | undefined; } /** * `tag` comes from `headingTag(level)`, resolved once by the caller so an off-scale level still * throws `X_UI_INVALID_VALUE` there. `content` is an accessor: read inside the element, it stays * reactive in an island. */ export function headingNode( tag: HeadingTag, attrs: HeadingNodeAttrs, content: () => JSX.Element, ): JSX.Element { switch (tag) { case 'h1': return (

{content()}

); case 'h2': return (

{content()}

); case 'h3': return (

{content()}

); case 'h4': return (

{content()}

); case 'h5': return (
{content()}
); case 'h6': return (
{content()}
); } }