You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
595 lines
22 KiB
595 lines
22 KiB
<script lang="ts">
|
|
import {
|
|
Heading,
|
|
type HeadingLevel,
|
|
type HeadingStyle,
|
|
type HeadingSize,
|
|
type HeadingFamily,
|
|
type HeadingWeight,
|
|
type HeadingColor,
|
|
type HeadingAlign
|
|
} from '$uix/eidos/components/heading';
|
|
import { compileMorfo } from '$uix/morfo';
|
|
import { headingMorfo } from '@/uix/morfo/components/heading';
|
|
|
|
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'a11y';
|
|
type TraceEntry = { event: string; family: string; intent?: string; at: number };
|
|
let tab = $state<Tab>('live');
|
|
let trace = $state<TraceEntry[]>([]);
|
|
let stageRef = $state<HTMLElement | null>(null);
|
|
|
|
// ── Live state ────────────────────────────────────────────────────────
|
|
let level = $state<HeadingLevel>(2);
|
|
let headingStyle = $state<HeadingStyle | ''>('');
|
|
let size = $state<HeadingSize | ''>('');
|
|
let family = $state<HeadingFamily | ''>('');
|
|
let weight = $state<HeadingWeight | ''>('');
|
|
let color = $state<HeadingColor | ''>('');
|
|
let align = $state<HeadingAlign | ''>('');
|
|
let italic = $state(false);
|
|
let underline = $state(false);
|
|
let truncate = $state(false);
|
|
let clamp = $state<number>(0);
|
|
let content = $state('Designed for the eidos visual layer.');
|
|
|
|
const levelOptions: HeadingLevel[] = [1, 2, 3, 4, 5, 6];
|
|
const styleOptions = ['', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;
|
|
const sizes: HeadingSize[] = ['xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl', 'xxxl'];
|
|
const families: HeadingFamily[] = ['primary', 'secondary', 'mono', 'display'];
|
|
const weights: HeadingWeight[] = ['regular', 'medium', 'semibold', 'bold'];
|
|
const colors: HeadingColor[] = ['primary', 'secondary', 'muted', 'disabled', 'on-solid'];
|
|
const alignOptions = ['', 'start', 'center', 'end', 'justify'] as const;
|
|
|
|
// ── Compiled morfo ────────────────────────────────────────────────────
|
|
const compiled = compileMorfo(headingMorfo);
|
|
const partsList = $derived([...compiled.parts.byKebab.values()]);
|
|
const events = $derived([...compiled.actions.byName.values()]);
|
|
|
|
$effect(() => {
|
|
const el = stageRef;
|
|
if (!el) return;
|
|
const obs = new MutationObserver((mutations) => {
|
|
for (const m of mutations) {
|
|
if (m.attributeName !== 'data-event') continue;
|
|
const target = m.target as Element;
|
|
const ev = target.getAttribute('data-event');
|
|
if (!ev) continue;
|
|
trace = [
|
|
{
|
|
event: ev,
|
|
family: target.getAttribute('data-event-family') ?? '—',
|
|
intent: target.getAttribute('data-event-intent') ?? undefined,
|
|
at: Date.now()
|
|
},
|
|
...trace
|
|
].slice(0, 6);
|
|
}
|
|
});
|
|
obs.observe(el, { attributes: true, subtree: true, attributeFilter: ['data-event'] });
|
|
return () => obs.disconnect();
|
|
});
|
|
|
|
// ── Code snippets ─────────────────────────────────────────────────────
|
|
const somaSnippet = $derived(
|
|
[
|
|
'<!-- Heading is eidos-native — no soma layer. -->',
|
|
'<!-- Equivalent semantic markup: -->',
|
|
'',
|
|
`<h${level}`,
|
|
' data-heading',
|
|
` data-style="${headingStyle || `h${level}`}"`,
|
|
headingStyle && headingStyle !== `h${level}` && ' <!-- semantic and visual decoupled -->',
|
|
'>',
|
|
` ${content}`,
|
|
`</h${level}>`
|
|
]
|
|
.filter(Boolean)
|
|
.join('\n')
|
|
);
|
|
|
|
const eidosSnippet = $derived(
|
|
[
|
|
"<script lang='ts'>",
|
|
" import { Heading } from '$uix/eidos/components/heading';",
|
|
'</' + 'script>',
|
|
'',
|
|
'<Heading',
|
|
level !== 2 && ` level={${level}}`,
|
|
headingStyle && ` style="${headingStyle}"`,
|
|
size && ` size="${size}"`,
|
|
family && ` family="${family}"`,
|
|
weight && ` weight="${weight}"`,
|
|
color && ` color="${color}"`,
|
|
align && ` align="${align}"`,
|
|
italic && ' italic',
|
|
underline && ' underline',
|
|
truncate && ' truncate',
|
|
clamp > 0 && ` clamp={${clamp}}`,
|
|
'>',
|
|
' ' + content,
|
|
'</Heading>'
|
|
]
|
|
.filter(Boolean)
|
|
.join('\n')
|
|
);
|
|
</script>
|
|
|
|
<div data-uix-canvas-inner>
|
|
<header>
|
|
<div data-uix-eyebrow>Typography · Heading</div>
|
|
<h1 data-uix-page-title>Heading</h1>
|
|
<p data-uix-page-lede>
|
|
Semantic heading typography primitive. <code>level</code> chooses the HTML tag
|
|
(<code>h1</code>..<code>h6</code>) and <code>style</code> chooses the visual treatment — by
|
|
default they mirror each other but can be decoupled
|
|
(<code>{`<Heading level={3} style="h1">`}</code>) for visual-h1-with-semantic-h3 cases.
|
|
Single part. Eidos-native: no soma backing, no semantic events.
|
|
</p>
|
|
<div data-uix-page-meta>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>parts</span>{compiled.parts.order.length}
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>events</span>0
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>levels</span>6
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>styles</span>6
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>scope</span>eidos
|
|
</span>
|
|
</div>
|
|
</header>
|
|
|
|
<div data-uix-stage>
|
|
<div data-uix-stage-area bind:this={stageRef}>
|
|
<div
|
|
style="max-inline-size: 38rem; padding: var(--space-3); border: 1px dashed var(--color-neutral-border); border-radius: var(--radius-md);"
|
|
>
|
|
<Heading
|
|
{level}
|
|
style={headingStyle || undefined}
|
|
size={size || undefined}
|
|
family={family || undefined}
|
|
weight={weight || undefined}
|
|
color={color || undefined}
|
|
align={align || undefined}
|
|
{italic}
|
|
{underline}
|
|
{truncate}
|
|
clamp={clamp > 0 ? clamp : undefined}
|
|
>
|
|
{content}
|
|
</Heading>
|
|
</div>
|
|
</div>
|
|
<div data-uix-stage-trace>
|
|
<span data-uix-stage-trace-key>trace</span>
|
|
<span>{trace.length === 0 ? 'no semantic events' : `${trace.length} event(s)`}</span>
|
|
<span style="color: var(--uix-text-faint)">·</span>
|
|
<span data-uix-stage-trace-key>level</span>
|
|
<span>h{level}</span>
|
|
<span style="margin-inline-start: auto;">
|
|
<span data-uix-stage-trace-key>style</span> {headingStyle || `h${level}`} ·
|
|
<span data-uix-stage-trace-key>size</span> {size || 'inherit'}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div data-uix-tabs role="tablist">
|
|
<button data-uix-tab data-active={tab === 'live'} onclick={() => (tab = 'live')}>Live</button>
|
|
<button data-uix-tab data-active={tab === 'api'} onclick={() => (tab = 'api')}>
|
|
API <span data-uix-tab-count>11</span>
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'morfo'} onclick={() => (tab = 'morfo')}>
|
|
<span data-uix-layer-badge="morfo">morfo</span>
|
|
<span data-uix-tab-count>{partsList.length}p · 0e</span>
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'sema'} onclick={() => (tab = 'sema')}>
|
|
<span data-uix-layer-badge="sema">sema</span>
|
|
<span data-uix-tab-count>{events.length}</span>
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'recipe'} onclick={() => (tab = 'recipe')}
|
|
>Recipe</button
|
|
>
|
|
<button data-uix-tab data-active={tab === 'a11y'} onclick={() => (tab = 'a11y')}>A11y</button>
|
|
</div>
|
|
|
|
{#if tab === 'live'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Controls</h2>
|
|
<p data-uix-section-desc>
|
|
Heading is eidos-native — no <span data-uix-layer-badge="soma">soma</span> split. The
|
|
<code>level</code> prop drives semantics; <code>style</code> drives visual weight (defaults
|
|
to mirror level). Per-axis overrides write inline
|
|
<code>--_heading-*</code> CSS variables.
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span> props · semantic + visual
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label
|
|
>level <span data-uix-control-hint>HTML tag</span></span
|
|
>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each levelOptions as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={level === opt}
|
|
onclick={() => (level = opt)}>h{opt}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label
|
|
>style <span data-uix-control-hint>visual scale, default mirrors level</span></span
|
|
>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each styleOptions as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={headingStyle === opt}
|
|
onclick={() => (headingStyle = opt)}>{opt || 'auto'}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>size override</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
<button
|
|
data-uix-chip
|
|
data-active={size === ''}
|
|
onclick={() => (size = '')}>inherit</button
|
|
>
|
|
{#each sizes as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={size === opt}
|
|
onclick={() => (size = opt)}>{opt}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>family override</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
<button
|
|
data-uix-chip
|
|
data-active={family === ''}
|
|
onclick={() => (family = '')}>inherit</button
|
|
>
|
|
{#each families as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={family === opt}
|
|
onclick={() => (family = opt)}>{opt}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>weight override</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
<button
|
|
data-uix-chip
|
|
data-active={weight === ''}
|
|
onclick={() => (weight = '')}>inherit</button
|
|
>
|
|
{#each weights as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={weight === opt}
|
|
onclick={() => (weight = opt)}>{opt}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label
|
|
>color override <span data-uix-control-hint>content-role slot</span></span
|
|
>
|
|
<span data-uix-chips role="radiogroup">
|
|
<button
|
|
data-uix-chip
|
|
data-active={color === ''}
|
|
onclick={() => (color = '')}>inherit</button
|
|
>
|
|
{#each colors as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={color === opt}
|
|
onclick={() => (color = opt)}>{opt}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>align</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each alignOptions as opt}
|
|
<button
|
|
data-uix-chip
|
|
data-active={align === opt}
|
|
onclick={() => (align = opt)}>{opt || 'inherit'}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>italic</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={italic} />
|
|
<span data-uix-switch-label>{italic ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>underline</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={underline} />
|
|
<span data-uix-switch-label>{underline ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label
|
|
>truncate <span data-uix-control-hint>single-line ellipsis</span></span
|
|
>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={truncate} />
|
|
<span data-uix-switch-label>{truncate ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label
|
|
>clamp <span data-uix-control-hint>multi-line cap (0 = off)</span></span
|
|
>
|
|
<input
|
|
type="number"
|
|
min="0"
|
|
max="10"
|
|
step="1"
|
|
bind:value={clamp}
|
|
style="inline-size: 6rem;"
|
|
/>
|
|
</label>
|
|
<label data-uix-control style="grid-column: span 2;">
|
|
<span data-uix-control-label>content</span>
|
|
<textarea bind:value={content} rows="2" style="inline-size: 100%; font: inherit;"
|
|
></textarea>
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-code>
|
|
<div data-uix-code-head>
|
|
<span data-uix-layer-badge="soma">soma</span>
|
|
<span>n/a · heading is eidos-native — equivalent markup shown</span>
|
|
<span data-uix-code-lang>svelte</span>
|
|
</div>
|
|
<pre><code>{somaSnippet}</code></pre>
|
|
</div>
|
|
|
|
<div data-uix-code style="margin-top: var(--uix-space-3);">
|
|
<div data-uix-code-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span>
|
|
<span>visual · level + style + per-axis overrides</span>
|
|
<span data-uix-code-lang>svelte</span>
|
|
</div>
|
|
<pre><code>{eidosSnippet}</code></pre>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'api'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>API reference</h2>
|
|
<p data-uix-section-desc>
|
|
<code>level</code> renders <code>{`<h{level}>`}</code>; <code>style</code> selects the
|
|
<code>{`--style-h{n}-*`}</code> token set (defaults to mirror level). Per-axis props
|
|
override individual fields without breaking the named-style cascade.
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>Semantic + visual</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Notes</th></tr></thead>
|
|
<tbody>
|
|
<tr
|
|
><td class="name">level</td><td class="type">1 | 2 | 3 | 4 | 5 | 6</td><td
|
|
class="default">2</td
|
|
><td>Renders <code>{`<h{level}>`}</code>. Drives semantic hierarchy.</td></tr
|
|
>
|
|
<tr
|
|
><td class="name">style</td><td class="type">'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'</td
|
|
><td class="default">mirrors level</td><td
|
|
>Visual treatment. Decouples from level when set explicitly.</td
|
|
></tr
|
|
>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Per-axis overrides</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Notes</th></tr></thead>
|
|
<tbody>
|
|
<tr
|
|
><td class="name">size</td><td class="type"
|
|
>'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | 'xxxl'</td
|
|
><td>Resolves to <code>{`var(--font-size-{key})`}</code>.</td></tr
|
|
>
|
|
<tr
|
|
><td class="name">family</td><td class="type"
|
|
>'primary' | 'secondary' | 'mono' | 'display'</td
|
|
><td>Resolves to <code>{`var(--font-family-{key})`}</code>.</td></tr
|
|
>
|
|
<tr
|
|
><td class="name">weight</td><td class="type"
|
|
>'regular' | 'medium' | 'semibold' | 'bold'</td
|
|
><td>Resolves to <code>{`var(--font-weight-{key})`}</code>.</td></tr
|
|
>
|
|
<tr
|
|
><td class="name">color</td><td class="type"
|
|
>'primary' | 'secondary' | 'muted' | 'disabled' | 'on-solid'</td
|
|
><td>Resolves to <code>{`var(--color-content-{key})`}</code>.</td></tr
|
|
>
|
|
<tr
|
|
><td class="name">align</td><td class="type"
|
|
>'start' | 'center' | 'end' | 'justify'</td
|
|
><td>Maps to <code>text-align</code>.</td></tr
|
|
>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Shorthand booleans + truncation</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Notes</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">italic</td><td class="type">boolean</td><td><code>font-style: italic</code>.</td></tr>
|
|
<tr><td class="name">underline</td><td class="type">boolean</td><td><code>text-decoration: underline</code>.</td></tr>
|
|
<tr><td class="name">truncate</td><td class="type">boolean</td><td>Single-line ellipsis. Requires container width.</td></tr>
|
|
<tr><td class="name">clamp</td><td class="type">number</td><td>Multi-line cap via <code>-webkit-line-clamp</code>.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Element + escape hatch</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Notes</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">as</td><td class="type">string</td><td>Override the rendered tag. Defaults to <code>{`h{level}`}</code>.</td></tr>
|
|
<tr><td class="name">tagStyle</td><td class="type">string</td><td>Extra inline CSS. Appended after the recipe's vars.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Reference comparison</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Library</th><th>Closest equivalent</th><th>Difference</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">radix-themes</td><td><code><Heading></code></td><td>Radix conflates semantic + visual into <code>as</code> + numeric size; UIX keeps them as separate props.</td></tr>
|
|
<tr><td class="name">chakra-ui</td><td><code><Heading></code></td><td>Chakra ties visual via <code>fontSize</code> only; UIX adds named foundation styles.</td></tr>
|
|
<tr><td class="name">mantine</td><td><code><Title order={`{1..6}`}></code></td><td>Mantine's <code>order</code> drives both; UIX splits via level/style.</td></tr>
|
|
<tr><td class="name">mui Typography</td><td><code><Typography variant="h1"></code></td><td>MUI <code>variant</code> ≈ UIX <code>style</code>; consumer composes <code>component="h3"</code> for the semantic split.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'morfo'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Morfo contract</h2>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Field</th><th>Value</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">name</td><td>{headingMorfo.name}</td></tr>
|
|
<tr><td class="name">kebab</td><td><code>{headingMorfo.kebab}</code></td></tr>
|
|
<tr><td class="name">scope</td><td>{headingMorfo.scope.join(', ')}</td></tr>
|
|
<tr><td class="name">parts</td><td>{partsList.length}</td></tr>
|
|
<tr><td class="name">events</td><td>0</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Parts</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead
|
|
><tr
|
|
><th>kebab</th><th>marker</th><th>element</th><th>archetype</th><th>optional</th
|
|
></tr
|
|
></thead
|
|
>
|
|
<tbody>
|
|
{#each partsList as part}
|
|
<tr>
|
|
<td class="name">{part.kebab}</td>
|
|
<td><code data-uix-part-marker>[{part.marker}]</code></td>
|
|
<td class="type"><{part.defaultElement}></td>
|
|
<td class="type">{part.archetype}</td>
|
|
<td class="default">{part.optional ? 'yes' : 'no'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<p data-uix-section-desc style="margin-top: var(--uix-space-4);">
|
|
The Provider stamps <code>data-heading</code> on the rendered
|
|
<code>{`<h{level}>`}</code>
|
|
tag (or the override from <code>as</code>) plus <code>data-level</code>,
|
|
<code>data-style</code> and the boolean modifier attrs (<code>data-italic</code>,
|
|
<code>data-underline</code>, <code>data-truncate</code>, <code>data-clamp</code>). The
|
|
recipe selects the named-style fallback chain via <code>data-style</code>; per-axis
|
|
overrides come through inline <code>--_heading-*</code> CSS variables.
|
|
</p>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'sema'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>
|
|
<span data-uix-layer-badge="sema">sema</span> · events
|
|
</h2>
|
|
<p data-uix-section-desc>
|
|
Heading declares no semantic events. As a passive typography primitive, the headline does
|
|
not commit, emerge, or react — it just renders its visual treatment. Components that
|
|
animate headings on appearance (dialog title, collapsible reveal, toast title) compose
|
|
Heading inside the interactive primitive that owns the relevant sema verb.
|
|
</p>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'recipe'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Eidos recipe</h2>
|
|
<p data-uix-section-desc>
|
|
Recipe lives in <code>src/uix/eidos/components/heading/heading.css</code>. The selector
|
|
<code>[data-heading]</code> applies the default h2 cascade; matching <code>data-style</code>
|
|
swaps to the corresponding <code>{`--style-h{n}-*`}</code> tokens. Per-axis overrides come
|
|
from <code>--_heading-*</code> custom properties written inline by the wrapper.
|
|
</p>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Selector</th><th>Owner</th><th>Purpose</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name"><code>[data-heading]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Provider marker. Default h2-style applied.</td></tr>
|
|
<tr><td class="name"><code>{`[data-heading][data-style='h1'..'h6']`}</code></td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Swap to the named style's token set.</td></tr>
|
|
<tr><td class="name"><code>{`[data-heading][data-italic|data-underline|data-truncate|data-clamp]`}</code></td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Visual modifier flags from boolean props.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'a11y'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Accessibility</h2>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Concern</th><th>Contract</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">Role</td><td>Native HTML heading semantics from <code>{`<h{level}>`}</code>. AT announce the heading and its level automatically.</td></tr>
|
|
<tr><td class="name">Heading hierarchy</td><td>Consumer responsibility — pass <code>level</code> per outline depth. Don't skip levels (h2 then h4).</td></tr>
|
|
<tr><td class="name">Visual ≠ semantic</td><td>Decoupling via <code>{`level={3} style="h1"`}</code> is safe for AT — they read the level, not the visual style.</td></tr>
|
|
<tr><td class="name">Truncation + AT</td><td>CSS-only — full text remains in DOM. AT read the full heading.</td></tr>
|
|
<tr><td class="name">Color contrast</td><td>Content-role colors meet WCAG AA. Free colors via <code>tagStyle</code> bypass that guarantee.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
</div>
|