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.
677 lines
29 KiB
677 lines
29 KiB
<script lang="ts">
|
|
import {
|
|
TreeGrid,
|
|
type TreeGridSize,
|
|
type TreeGridVariant,
|
|
type TreeGridColor,
|
|
type TreeGridSelectionMode
|
|
} from '$uix/eidos/components/tree-grid';
|
|
import { compileMorfo } from '$uix/morfo';
|
|
import { treeGridMorfo } from '@/uix/morfo/components/tree-grid';
|
|
import { getActiveUix } from '$active-uix';
|
|
|
|
const uix = getActiveUix();
|
|
|
|
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'a11y';
|
|
let tab = $state<Tab>('live');
|
|
|
|
// ── Sample data: file manager with columns ──────────────────────────
|
|
type Leaf = {
|
|
kind: 'item';
|
|
value: string;
|
|
label: string;
|
|
size: string;
|
|
modified: string;
|
|
};
|
|
type Folder = {
|
|
kind: 'branch';
|
|
value: string;
|
|
label: string;
|
|
size: string;
|
|
modified: string;
|
|
children: TreeNode[];
|
|
};
|
|
type TreeNode = Leaf | Folder;
|
|
|
|
const FILES: TreeNode[] = [
|
|
{ kind: 'item', value: 'readme', label: 'README.md', size: '4.2 KB', modified: '2026-05-22' },
|
|
{
|
|
kind: 'branch',
|
|
value: 'src',
|
|
label: 'src',
|
|
size: '—',
|
|
modified: '2026-05-23',
|
|
children: [
|
|
{ kind: 'item', value: 'index', label: 'index.ts', size: '1.1 KB', modified: '2026-05-23' },
|
|
{ kind: 'item', value: 'app', label: 'App.svelte', size: '7.8 KB', modified: '2026-05-22' },
|
|
{
|
|
kind: 'branch',
|
|
value: 'components',
|
|
label: 'components',
|
|
size: '—',
|
|
modified: '2026-05-23',
|
|
children: [
|
|
{ kind: 'item', value: 'button', label: 'Button.svelte', size: '3.2 KB', modified: '2026-05-21' },
|
|
{ kind: 'item', value: 'input', label: 'Input.svelte', size: '2.1 KB', modified: '2026-05-22' },
|
|
{
|
|
kind: 'branch',
|
|
value: 'forms',
|
|
label: 'forms',
|
|
size: '—',
|
|
modified: '2026-05-23',
|
|
children: [
|
|
{ kind: 'item', value: 'field', label: 'Field.svelte', size: '1.7 KB', modified: '2026-05-23' },
|
|
{ kind: 'item', value: 'form', label: 'Form.svelte', size: '4.4 KB', modified: '2026-05-22' }
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
kind: 'branch',
|
|
value: 'tests',
|
|
label: 'tests',
|
|
size: '—',
|
|
modified: '2026-05-21',
|
|
children: [
|
|
{ kind: 'item', value: 'unit', label: 'unit.spec.ts', size: '5.4 KB', modified: '2026-05-21' },
|
|
{ kind: 'item', value: 'e2e', label: 'e2e.spec.ts', size: '9.1 KB', modified: '2026-05-21' }
|
|
]
|
|
},
|
|
{ kind: 'item', value: 'package', label: 'package.json', size: '2.0 KB', modified: '2026-05-20' }
|
|
];
|
|
|
|
// ── Visual props ─────────────────────────────────────────────────────
|
|
let size = $state<TreeGridSize>('md');
|
|
let variant = $state<TreeGridVariant>('surface');
|
|
let color = $state<TreeGridColor>('primary');
|
|
let block = $state(true);
|
|
let striped = $state(true);
|
|
let hoverable = $state(true);
|
|
let showIndentGuides = $state(true);
|
|
let useScrollRegion = $state(false);
|
|
let columns = $state('1fr 7rem 9rem');
|
|
|
|
// ── i18n controls ────────────────────────────────────────────────────
|
|
let locale = $state('en-US');
|
|
let dir = $state<'ltr' | 'rtl'>('ltr');
|
|
|
|
// ── Soma feature controls ────────────────────────────────────────────
|
|
let selectionMode = $state<TreeGridSelectionMode>('single');
|
|
let loop = $state(false);
|
|
let typeahead = $state(true);
|
|
let expanded = $state<string[]>(['src', 'components']);
|
|
let value = $state<string[]>([]);
|
|
|
|
// ── Trace ────────────────────────────────────────────────────────────
|
|
type TraceEntry = { event: string; family: string; intent?: string; at: number };
|
|
let trace = $state<TraceEntry[]>([]);
|
|
let stageRef = $state<HTMLElement | null>(null);
|
|
|
|
$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();
|
|
});
|
|
|
|
const compiled = compileMorfo(treeGridMorfo);
|
|
const partsList = $derived([...compiled.parts.byKebab.values()]);
|
|
const events = $derived([...compiled.actions.byName.values()]);
|
|
|
|
function fmtTime(at: number): string {
|
|
const d = new Date(at);
|
|
return `${String(d.getSeconds()).padStart(2, '0')}.${String(d.getMilliseconds()).padStart(3, '0')}`;
|
|
}
|
|
|
|
function fmtDate(s: string) {
|
|
try {
|
|
return new Intl.DateTimeFormat(locale, { year: 'numeric', month: 'short', day: '2-digit' }).format(new Date(s));
|
|
} catch {
|
|
return s;
|
|
}
|
|
}
|
|
|
|
const eidosSnippet = $derived(
|
|
[
|
|
"<script lang='ts'>",
|
|
" import { TreeGrid } from '$uix/eidos/components/tree-grid';",
|
|
' let expanded = $state<string[]>([]);',
|
|
' let value = $state<string[]>([]);',
|
|
'</' + 'script>',
|
|
'',
|
|
'<TreeGrid',
|
|
` columns="${columns}"`,
|
|
' bind:expanded',
|
|
' bind:value',
|
|
selectionMode !== 'single' && ` selectionMode="${selectionMode}"`,
|
|
dir !== 'ltr' && ` dir="${dir}"`,
|
|
loop && ' loop',
|
|
!typeahead && ' typeahead={false}',
|
|
size !== 'md' && ` size="${size}"`,
|
|
variant !== 'surface' && ` variant="${variant}"`,
|
|
color !== 'primary' && ` color="${color}"`,
|
|
!block && ' block={false}',
|
|
striped && ' striped',
|
|
!hoverable && ' hoverable={false}',
|
|
showIndentGuides && ' showIndentGuides',
|
|
useScrollRegion && ' maxHeight="22rem"',
|
|
'>',
|
|
' <TreeGrid.Header>',
|
|
' <TreeGrid.ColumnHeader>Name</TreeGrid.ColumnHeader>',
|
|
' <TreeGrid.ColumnHeader>Size</TreeGrid.ColumnHeader>',
|
|
' <TreeGrid.ColumnHeader>Modified</TreeGrid.ColumnHeader>',
|
|
' </TreeGrid.Header>',
|
|
' <TreeGrid.Row value="src" hasChildren>',
|
|
' <TreeGrid.Cell>',
|
|
' <TreeGrid.ExpandTrigger />',
|
|
' src',
|
|
' </TreeGrid.Cell>',
|
|
' <TreeGrid.Cell>—</TreeGrid.Cell>',
|
|
' <TreeGrid.Cell>2 days ago</TreeGrid.Cell>',
|
|
' <TreeGrid.RowChildren>',
|
|
' <TreeGrid.Row value="index">…</TreeGrid.Row>',
|
|
' </TreeGrid.RowChildren>',
|
|
' </TreeGrid.Row>',
|
|
'</TreeGrid>'
|
|
]
|
|
.filter(Boolean)
|
|
.join('\n')
|
|
);
|
|
</script>
|
|
|
|
{#snippet renderRow(node: TreeNode)}
|
|
{#if node.kind === 'item'}
|
|
<TreeGrid.Row value={node.value}>
|
|
<TreeGrid.Cell>
|
|
<span style="opacity: 0.6;">📄</span>
|
|
{node.label}
|
|
</TreeGrid.Cell>
|
|
<TreeGrid.Cell>{node.size}</TreeGrid.Cell>
|
|
<TreeGrid.Cell>{fmtDate(node.modified)}</TreeGrid.Cell>
|
|
</TreeGrid.Row>
|
|
{:else}
|
|
<TreeGrid.Row value={node.value} hasChildren>
|
|
<TreeGrid.Cell>
|
|
<TreeGrid.ExpandTrigger />
|
|
<span style="margin-inline-end: 0.25rem;">📁</span>
|
|
{node.label}
|
|
</TreeGrid.Cell>
|
|
<TreeGrid.Cell>{node.size}</TreeGrid.Cell>
|
|
<TreeGrid.Cell>{fmtDate(node.modified)}</TreeGrid.Cell>
|
|
<TreeGrid.RowChildren>
|
|
{#each node.children as child (child.value)}
|
|
{@render renderRow(child)}
|
|
{/each}
|
|
</TreeGrid.RowChildren>
|
|
</TreeGrid.Row>
|
|
{/if}
|
|
{/snippet}
|
|
|
|
<div data-uix-canvas-inner {dir}>
|
|
<header>
|
|
<div data-uix-eyebrow>Data · TreeGrid</div>
|
|
<h1 data-uix-page-title>TreeGrid</h1>
|
|
<p data-uix-page-lede>
|
|
Hierarchical rows + columnar attributes — file managers, org
|
|
charts with departments, nested tasks with priority/due-date
|
|
columns. Implements the WAI-ARIA <code>role="treegrid"</code>
|
|
pattern. Use TreeGrid when data has both a hierarchy and
|
|
columns; use <code>TreeView</code> for hierarchy-only and
|
|
<code>Table</code> for flat tabular data.
|
|
</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>{events.length}
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>sizes</span>5
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>apg</span>
|
|
<a href={treeGridMorfo.apg} target="_blank" rel="noreferrer">treegrid ↗</a>
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>expanded</span> {expanded.length}
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>selected</span> {value.length ? value.join(', ') : '—'}
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>locale</span> {locale}
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>dir</span> {dir}
|
|
</span>
|
|
</div>
|
|
</header>
|
|
|
|
<div data-uix-stage>
|
|
<div data-uix-stage-area bind:this={stageRef} style="padding: var(--uix-space-3);">
|
|
<TreeGrid
|
|
bind:expanded
|
|
bind:value
|
|
{selectionMode}
|
|
{loop}
|
|
{typeahead}
|
|
{dir}
|
|
{size}
|
|
{variant}
|
|
{color}
|
|
{block}
|
|
{striped}
|
|
{hoverable}
|
|
{showIndentGuides}
|
|
{columns}
|
|
maxHeight={useScrollRegion ? '22rem' : undefined}
|
|
>
|
|
<TreeGrid.Header>
|
|
<TreeGrid.ColumnHeader>Name</TreeGrid.ColumnHeader>
|
|
<TreeGrid.ColumnHeader>Size</TreeGrid.ColumnHeader>
|
|
<TreeGrid.ColumnHeader>Modified</TreeGrid.ColumnHeader>
|
|
</TreeGrid.Header>
|
|
{#each FILES as node (node.value)}
|
|
{@render renderRow(node)}
|
|
{/each}
|
|
</TreeGrid>
|
|
</div>
|
|
<div data-uix-stage-trace>
|
|
<span data-uix-stage-trace-key>trace</span>
|
|
{#if trace.length === 0}
|
|
<span>click a row, expand a branch, arrow keys to navigate…</span>
|
|
{:else}
|
|
{#each trace.slice(0, 3) as entry}
|
|
<span><span data-uix-stage-trace-event>{entry.event}</span> · {entry.family}{entry.intent ? ' · ' + entry.intent : ''}</span>
|
|
<span style="color: var(--uix-text-faint)">{fmtTime(entry.at)}</span>
|
|
{/each}
|
|
{/if}
|
|
<span style="margin-inline-start: auto;">
|
|
<span data-uix-stage-trace-key>expanded</span> [{expanded.join(', ')}]
|
|
</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>7</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 · {events.length}e</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>
|
|
Soma owns selection / expansion / roving tabindex / typeahead / ARIA treegrid wiring. Eidos adds visual chrome, CSS-Grid layout via the <code>columns</code> prop, optional indent guides, striping, hover and scroll region.
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="soma">soma</span> i18n
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>locale</span>
|
|
<select bind:value={locale}>
|
|
<option value="en-US">en-US</option>
|
|
<option value="es-ES">es-ES</option>
|
|
<option value="fr-FR">fr-FR</option>
|
|
</select>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>direction</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['ltr', 'rtl'] as v (v)}
|
|
<button data-uix-chip data-active={dir === v} onclick={() => (dir = v as 'ltr' | 'rtl')}>{v}</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="soma">soma</span> feature toggles
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>selectionMode</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['none', 'single', 'multiple'] as m (m)}
|
|
<button data-uix-chip data-active={selectionMode === m} onclick={() => (selectionMode = m as TreeGridSelectionMode)}>{m}</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>loop</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={loop} />
|
|
<span data-uix-switch-label>{loop ? 'wrap' : 'clamp'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>typeahead</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={typeahead} />
|
|
<span data-uix-switch-label>{typeahead ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span> visual props
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>columns</span>
|
|
<input type="text" bind:value={columns} style="inline-size: 14rem; padding: 0.25rem 0.5rem; border: 1px solid var(--color-border-default); border-radius: var(--radius-sm); background: var(--color-surface-default); font: inherit;" />
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>variant</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['surface', 'outline', 'ghost'] as v (v)}
|
|
<button data-uix-chip data-active={variant === v} onclick={() => (variant = v as TreeGridVariant)}>{v}</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>size</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['xs', 'sm', 'md', 'lg', 'xl'] as s (s)}
|
|
<button data-uix-chip data-active={size === s} onclick={() => (size = s as TreeGridSize)}>{s}</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>color</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['primary', 'secondary', 'neutral', 'affirm', 'fulfill', 'risk', 'threat', 'loss'] as c (c)}
|
|
<button data-uix-chip data-active={color === c} onclick={() => (color = c as TreeGridColor)}>{c}</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>block</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={block} />
|
|
<span data-uix-switch-label>{block ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>striped</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={striped} />
|
|
<span data-uix-switch-label>{striped ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>hoverable</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={hoverable} />
|
|
<span data-uix-switch-label>{hoverable ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>showIndentGuides</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={showIndentGuides} />
|
|
<span data-uix-switch-label>{showIndentGuides ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>scrollable</span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={useScrollRegion} />
|
|
<span data-uix-switch-label>{useScrollRegion ? 'maxHeight=22rem' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-code>
|
|
<div data-uix-code-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span>
|
|
<span>visual · TreeGrid + columns + recursive Rows</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>
|
|
7 parts: <code>Provider · Header · ColumnHeader · Row · RowChildren · Cell · ExpandTrigger</code>. Rows declare <code>hasChildren</code> to participate in the expand/collapse contract; <code>level</code> is auto-derived from DOM ancestry. The <code>columns</code> prop drives a CSS-Grid layout shared by Header + every Row.
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>Provider (TreeGrid)</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Description</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">expanded <span data-uix-tag data-kind="bindable">bindable</span></td><td class="type">string[]</td><td class="default">[]</td><td>Expanded row values.</td></tr>
|
|
<tr><td class="name">value <span data-uix-tag data-kind="bindable">bindable</span></td><td class="type">string[]</td><td class="default">[]</td><td>Selected row values.</td></tr>
|
|
<tr><td class="name">selectionMode</td><td class="type">'none' | 'single' | 'multiple'</td><td class="default">'single'</td><td>—</td></tr>
|
|
<tr><td class="name">loop</td><td class="type">boolean</td><td class="default">false</td><td>Arrow navigation wraps.</td></tr>
|
|
<tr><td class="name">typeahead</td><td class="type">boolean</td><td class="default">true</td><td>Letter keys jump to matching row.</td></tr>
|
|
<tr><td class="name">disabled · readonly</td><td class="type">boolean</td><td class="default">false</td><td>Standard form-control flags.</td></tr>
|
|
<tr><td class="name">columns <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">string</td><td class="default">'1fr'</td><td>CSS grid-template-columns.</td></tr>
|
|
<tr><td class="name">variant <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">'surface' | 'outline' | 'ghost'</td><td class="default">'surface'</td><td>—</td></tr>
|
|
<tr><td class="name">size <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">'xs' | 'sm' | 'md' | 'lg' | 'xl'</td><td class="default">'md'</td><td>Row + indent + font scale.</td></tr>
|
|
<tr><td class="name">color <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">ColorRole</td><td class="default">'primary'</td><td>Accent for selected + focus.</td></tr>
|
|
<tr><td class="name">block <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">boolean</td><td class="default">true</td><td>Stretch to container width.</td></tr>
|
|
<tr><td class="name">striped <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">boolean</td><td class="default">false</td><td>Alternate top-level row tint.</td></tr>
|
|
<tr><td class="name">hoverable <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">boolean</td><td class="default">true</td><td>Row hover highlight.</td></tr>
|
|
<tr><td class="name">showIndentGuides <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">boolean</td><td class="default">false</td><td>Vertical guide lines per depth.</td></tr>
|
|
<tr><td class="name">maxHeight <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">string</td><td class="default empty">—</td><td>Wraps in a scrolling region.</td></tr>
|
|
<tr><td class="name">stableRows <span data-uix-tag data-kind="eidos">eidos</span></td><td class="type">number</td><td class="default empty">—</td><td>Reserve N rows + header of vertical space.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Row</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Description</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">value</td><td class="type">string</td><td class="default empty">required</td><td>Unique node identifier.</td></tr>
|
|
<tr><td class="name">hasChildren</td><td class="type">boolean</td><td class="default">false</td><td>Declares the row as a branch — drives <code>aria-expanded</code> + Arrow Right/Left.</td></tr>
|
|
<tr><td class="name">disabled</td><td class="type">boolean</td><td class="default">false</td><td>Skip from roving set.</td></tr>
|
|
<tr><td class="name">textValue</td><td class="type">string</td><td class="default empty">—</td><td>Override label for typeahead.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'morfo'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>
|
|
<span data-uix-layer-badge="morfo">morfo</span>
|
|
· declarative contract
|
|
</h2>
|
|
<p data-uix-section-desc>Source: <code>src/uix/morfo/components/tree-grid.ts</code>.</p>
|
|
|
|
<div data-uix-subsection-head>Parts</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Part</th><th>Marker</th><th>Element</th><th>Role</th><th>Archetype</th><th>States</th><th>Optional</th></tr></thead>
|
|
<tbody>
|
|
{#each partsList as part (part.kebab)}
|
|
<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.role ?? '—'}</td>
|
|
<td class="default">{part.archetype ?? '—'}</td>
|
|
<td class="default">{part.states.length ? part.states.join(' | ') : '—'}</td>
|
|
<td class="default">{part.optional ? 'yes' : 'no'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Events declaration</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>name</th><th>family</th><th>verb</th><th>sequence</th><th>intent</th><th>target</th></tr></thead>
|
|
<tbody>
|
|
{#each events as action (action.name)}
|
|
{@const sem = action.semantic}
|
|
{@const intentDecl = 'intent' in sem ? sem.intent : undefined}
|
|
{@const intentStr = typeof intentDecl === 'string' ? intentDecl : intentDecl ? `fromProp:${(intentDecl as { fromProp?: string }).fromProp ?? '?'}` : '—'}
|
|
<tr>
|
|
<td class="name">{action.name}</td>
|
|
<td class="type">{sem.family}</td>
|
|
<td>{sem.verb ?? '—'}</td>
|
|
<td>{sem.sequence ?? 'pre'}</td>
|
|
<td class="default">{intentStr}</td>
|
|
<td>{action.target}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'sema'}
|
|
<section data-uix-section id="sema">
|
|
<h2 data-uix-section-title>
|
|
<span data-uix-layer-badge="sema">sema</span>
|
|
· events
|
|
</h2>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Name</th><th>Family</th><th>Verb</th><th>Sequence</th><th>Intent</th><th>Play</th></tr></thead>
|
|
<tbody>
|
|
{#each events as action (action.name)}
|
|
{@const intentDecl = 'intent' in action.semantic ? action.semantic.intent : undefined}
|
|
{@const effectiveIntent = typeof intentDecl === 'string' ? intentDecl : undefined}
|
|
<tr>
|
|
<td class="name">{action.name}</td>
|
|
<td class="type">{action.semantic.family}</td>
|
|
<td>{action.semantic.verb ?? '—'}</td>
|
|
<td>{action.semantic.sequence ?? 'pre'}</td>
|
|
<td class="default">{effectiveIntent ?? '—'}</td>
|
|
<td>
|
|
<button
|
|
data-uix-play
|
|
onclick={() => {
|
|
const target = (stageRef?.querySelector('[data-tree-grid-row]') ?? stageRef) as HTMLElement | null;
|
|
if (!target) return;
|
|
void uix.events?.emit({
|
|
name: action.name,
|
|
family: action.semantic.family,
|
|
target,
|
|
...(effectiveIntent ? { intent: effectiveIntent } : {})
|
|
});
|
|
}}
|
|
>▶ play</button>
|
|
</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'recipe'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Eidos recipe</h2>
|
|
<p data-uix-section-desc>Selectors at <code>src/uix/eidos/components/tree-grid/tree-grid.css</code>. Visual data-attrs live on the <code><div data-tree-grid-root></code> wrapper. Layout uses CSS Grid — every Row + Header inherits <code>grid-template-columns: var(--_tree-grid-columns)</code>.</p>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Selector</th><th>Source</th><th>What it paints</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">[data-tree-grid-root]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Wrapper — radius, border, scroll cap.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-root][data-variant]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Border + background per variant.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-root][data-size]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Row + indent + font-size scale.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-row]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>CSS Grid row layout.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-row][aria-selected="true"]</td><td><span data-uix-tag data-kind="soma">morfo</span></td><td>Selected-row accent-soft fill.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-row][aria-level]</td><td><span data-uix-tag data-kind="soma">morfo</span></td><td>Depth-based first-cell padding (1-8).</td></tr>
|
|
<tr><td class="name">[data-tree-grid-row-children]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td><code>display:contents</code> — child rows join parent grid.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-root][data-indent-guides]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Vertical guide stripes via background-image.</td></tr>
|
|
<tr><td class="name">[data-tree-grid-expand-trigger][data-state]</td><td><span data-uix-tag data-kind="soma">morfo</span></td><td>Chevron rotation (open/closed).</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'a11y'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Accessibility</h2>
|
|
<p data-uix-section-desc>
|
|
Follows the APG <a href={treeGridMorfo.apg} target="_blank" rel="noreferrer">treegrid pattern</a>. Root is <code>role="treegrid"</code>, rows are <code>role="row"</code>, header cells are <code>role="columnheader"</code>, body cells are <code>role="gridcell"</code>. Roving tabindex; arrows traverse rows; Right/Left expand/collapse on branches; Home/End jump to first/last; PageUp/PageDown move by ~10 rows.
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>Keyboard</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Key</th><th>Action</th></tr></thead>
|
|
<tbody>
|
|
<tr><td><span data-uix-kbd>ArrowDown</span> / <span data-uix-kbd>ArrowUp</span></td><td>Move focus through visible rows.</td></tr>
|
|
<tr><td><span data-uix-kbd>ArrowRight</span></td><td>Expand the focused branch row; if already open, focus the first child.</td></tr>
|
|
<tr><td><span data-uix-kbd>ArrowLeft</span></td><td>Collapse the focused branch; if leaf/closed, focus the parent.</td></tr>
|
|
<tr><td><span data-uix-kbd>Home</span> / <span data-uix-kbd>End</span></td><td>First / last visible row.</td></tr>
|
|
<tr><td><span data-uix-kbd>PageUp</span> / <span data-uix-kbd>PageDown</span></td><td>Jump ~10 rows.</td></tr>
|
|
<tr><td><span data-uix-kbd>Enter</span> / <span data-uix-kbd>Space</span></td><td>Toggle selection of the focused row.</td></tr>
|
|
<tr><td>Letter / digit</td><td>Typeahead — focus next matching row.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>ARIA contract</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Part</th><th>Attribute</th><th>Value</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">Provider</td><td>role</td><td class="type">"treegrid"</td></tr>
|
|
<tr><td class="name">Provider</td><td>aria-multiselectable</td><td class="type">"true" (multiple mode)</td></tr>
|
|
<tr><td class="name">Header</td><td>role</td><td class="type">"row"</td></tr>
|
|
<tr><td class="name">ColumnHeader</td><td>role</td><td class="type">"columnheader"</td></tr>
|
|
<tr><td class="name">Row</td><td>role / aria-level</td><td class="type">"row" / 1-based auto</td></tr>
|
|
<tr><td class="name">Row</td><td>aria-expanded</td><td class="type">"true" | "false" (branches only)</td></tr>
|
|
<tr><td class="name">Row</td><td>aria-selected</td><td class="type">"true" | "false"</td></tr>
|
|
<tr><td class="name">Cell</td><td>role</td><td class="type">"gridcell"</td></tr>
|
|
<tr><td class="name">RowChildren</td><td>role</td><td class="type">"group"</td></tr>
|
|
<tr><td class="name">ExpandTrigger</td><td>aria-label / aria-hidden</td><td class="type">translated / "true"</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
</div>
|