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.
676 lines
26 KiB
676 lines
26 KiB
<script lang="ts">
|
|
import {
|
|
Select,
|
|
type SelectColor,
|
|
type SelectSize,
|
|
type SelectVariant
|
|
} from '$uix/eidos/components/select';
|
|
import { compileMorfo } from '$uix/morfo';
|
|
import { selectMorfo } from '@/uix/morfo/components/select';
|
|
import type { Intent } from '$uix/intent';
|
|
import { getActiveUix } from '$active-uix';
|
|
import { page } from '$app/state';
|
|
|
|
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'a11y';
|
|
type SelectMode = 'single' | 'multiple';
|
|
type Option = {
|
|
value: string;
|
|
label: string;
|
|
group: string;
|
|
disabled?: boolean;
|
|
description?: string;
|
|
};
|
|
type TraceEntry = { event: string; family: string; intent?: string; at: number };
|
|
|
|
const uix = getActiveUix();
|
|
const params = page.url.searchParams;
|
|
|
|
const options: readonly Option[] = [
|
|
{ value: 'apple', label: 'Apple', group: 'Fruit', description: 'Crisp, sweet, ubiquitous' },
|
|
{ value: 'pear', label: 'Pear', group: 'Fruit', description: 'Soft, mellow autumn fruit' },
|
|
{ value: 'orange', label: 'Orange', group: 'Fruit' },
|
|
{ value: 'carrot', label: 'Carrot', group: 'Vegetables', description: 'Root, high in beta-carotene' },
|
|
{ value: 'mushroom', label: 'Mushroom', group: 'Vegetables', disabled: true },
|
|
{ value: 'pepper', label: 'Pepper', group: 'Vegetables' }
|
|
];
|
|
const groups = [...new Set(options.map((option) => option.group))];
|
|
const sizes: SelectSize[] = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
const variants: SelectVariant[] = ['surface', 'outline', 'ghost'];
|
|
const colors: SelectColor[] = [
|
|
'primary',
|
|
'secondary',
|
|
'neutral',
|
|
'affirm',
|
|
'fulfill',
|
|
'risk',
|
|
'threat',
|
|
'loss'
|
|
];
|
|
|
|
let tab = $state<Tab>('live');
|
|
let value = $state<string[]>(['apple']);
|
|
let open = $state(false);
|
|
let mode = $state<SelectMode>('single');
|
|
let disabled = $state(params.get('perm.disabled') === 'true');
|
|
let required = $state(false);
|
|
let invalid = $state(false);
|
|
let allowDeselect = $state(true);
|
|
let size = $state<SelectSize>('md');
|
|
let variant = $state<SelectVariant>('surface');
|
|
let color = $state<SelectColor>('primary');
|
|
let trace = $state<TraceEntry[]>([]);
|
|
let stageRef = $state<HTMLElement | null>(null);
|
|
|
|
const compiled = compileMorfo(selectMorfo);
|
|
const partsList = $derived([...compiled.parts.byKebab.values()]);
|
|
const events = $derived([...compiled.actions.byName.values()]);
|
|
const selectedLabels = $derived(
|
|
options.filter((option) => value.includes(option.value)).map((option) => option.label)
|
|
);
|
|
|
|
$effect(() => {
|
|
if (mode === 'single' && value.length > 1) value = value.slice(0, 1);
|
|
});
|
|
|
|
$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();
|
|
});
|
|
|
|
function fmtTime(at: number): string {
|
|
const d = new Date(at);
|
|
return `${String(d.getSeconds()).padStart(2, '0')}.${String(d.getMilliseconds()).padStart(3, '0')}`;
|
|
}
|
|
|
|
function intentLiteral(value: unknown): Intent | undefined {
|
|
return typeof value === 'string' ? (value as Intent) : undefined;
|
|
}
|
|
|
|
const somaSnippet = $derived(
|
|
[
|
|
"<script lang='ts'>",
|
|
" import * as Select from '$soma/components/select';",
|
|
" let value = $state(['apple']);",
|
|
" let open = $state(false);",
|
|
'</' + 'script>',
|
|
'',
|
|
'<Select.Provider',
|
|
' bind:value',
|
|
' bind:open',
|
|
` type="${mode}"`,
|
|
allowDeselect && ' allowDeselect',
|
|
required && ' required',
|
|
' name="fruit"',
|
|
'>',
|
|
' <Select.Trigger>',
|
|
' <Select.Value placeholder="Choose a fruit" />',
|
|
' </Select.Trigger>',
|
|
' <Select.Content sideOffset={6}>',
|
|
' <Select.Viewport>',
|
|
' <Select.Item value="apple" label="Apple">Apple</Select.Item>',
|
|
' </Select.Viewport>',
|
|
' </Select.Content>',
|
|
'</Select.Provider>'
|
|
]
|
|
.filter(Boolean)
|
|
.join('\n')
|
|
);
|
|
|
|
const eidosSnippet = $derived(
|
|
[
|
|
"<script lang='ts'>",
|
|
" import { Select } from '$uix/eidos/components/select';",
|
|
" let value = $state(['apple']);",
|
|
'</' + 'script>',
|
|
'',
|
|
'<Select',
|
|
' bind:value',
|
|
` type="${mode}"`,
|
|
size !== 'md' && ` size="${size}"`,
|
|
variant !== 'surface' && ` variant="${variant}"`,
|
|
color !== 'primary' && ` color="${color}"`,
|
|
' name="fruit"',
|
|
'>',
|
|
' <Select.Trigger>',
|
|
' <Select.Value placeholder="Choose a fruit" />',
|
|
' <Select.Indicator />',
|
|
' </Select.Trigger>',
|
|
' <Select.Portal>',
|
|
' <Select.Content sideOffset={6}>',
|
|
' <Select.Viewport>',
|
|
' <Select.Item value="apple" label="Apple">',
|
|
' <span>Apple</span>',
|
|
' <Select.ItemIndicator />',
|
|
' </Select.Item>',
|
|
' </Select.Viewport>',
|
|
' <Select.Arrow />',
|
|
' </Select.Content>',
|
|
' </Select.Portal>',
|
|
'</Select>'
|
|
]
|
|
.filter(Boolean)
|
|
.join('\n')
|
|
);
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<meta name="perm-axes" content="disabled" />
|
|
</svelte:head>
|
|
|
|
<div data-uix-canvas-inner>
|
|
<header>
|
|
<div data-uix-eyebrow>Forms · Select</div>
|
|
<h1 data-uix-page-title>Select</h1>
|
|
<p data-uix-page-lede>
|
|
Combobox/listbox selector with single and multiple value modes. Soma owns typeahead,
|
|
floating, grouping and form integration; Eidos adds trigger/content treatment and selected
|
|
item indicators.
|
|
</p>
|
|
<div data-uix-page-meta>
|
|
<span data-uix-meta-pill><span data-uix-meta-key>parts</span>{partsList.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>mode</span>{mode}</span>
|
|
<span data-uix-meta-pill><span data-uix-meta-key>scope</span>{selectMorfo.scope.join(' · ')}</span>
|
|
</div>
|
|
</header>
|
|
|
|
<div data-uix-stage>
|
|
<div
|
|
data-uix-stage-area
|
|
bind:this={stageRef}
|
|
style="display: grid; gap: 1rem; align-items: start; inline-size: min(24rem, 100%);"
|
|
>
|
|
<Select
|
|
bind:value
|
|
bind:open
|
|
type={mode}
|
|
{disabled}
|
|
{required}
|
|
{invalid}
|
|
{allowDeselect}
|
|
{size}
|
|
{variant}
|
|
{color}
|
|
name="fruit"
|
|
>
|
|
<Select.Trigger
|
|
data-perm-step={!disabled ? '0' : undefined}
|
|
data-perm-label={!disabled ? 'open select' : undefined}
|
|
>
|
|
<Select.Value placeholder="Choose produce" />
|
|
<Select.Indicator />
|
|
</Select.Trigger>
|
|
<Select.Portal>
|
|
<Select.Content sideOffset={6} preventScroll={false}>
|
|
<Select.Viewport>
|
|
{#each groups as group}
|
|
<Select.Group>
|
|
<Select.GroupHeading>{group}</Select.GroupHeading>
|
|
{#each options.filter((option) => option.group === group) as option}
|
|
<Select.Item
|
|
value={option.value}
|
|
label={option.label}
|
|
disabled={option.disabled}
|
|
data-perm-step={!disabled && option.value === 'pear' ? '1' : undefined}
|
|
data-perm-label={!disabled && option.value === 'pear' ? 'select pear' : undefined}
|
|
>
|
|
<span style="display: flex; flex-direction: column; min-inline-size: 0;">
|
|
<span>{option.label}</span>
|
|
{#if option.description}
|
|
<Select.ItemDescription>{option.description}</Select.ItemDescription>
|
|
{/if}
|
|
</span>
|
|
<Select.ItemIndicator />
|
|
</Select.Item>
|
|
{/each}
|
|
</Select.Group>
|
|
{#if group !== groups[groups.length - 1]}
|
|
<Select.Separator />
|
|
{/if}
|
|
{/each}
|
|
</Select.Viewport>
|
|
<Select.Arrow />
|
|
</Select.Content>
|
|
</Select.Portal>
|
|
</Select>
|
|
</div>
|
|
<div data-uix-stage-trace>
|
|
<span data-uix-stage-trace-key>trace</span>
|
|
{#if trace.length === 0}
|
|
<span>select or unselect an item to see Sema events</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>value</span>
|
|
{selectedLabels.length ? selectedLabels.join(', ') : 'none'}
|
|
</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>9</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>
|
|
Controls are grouped by owner. Events are in the Sema tab; opening the popup is
|
|
deliberately silent and selection is the semantic commit.
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="soma">soma</span> props · headless behavior
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>type</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['single', 'multiple'] as item}
|
|
<button
|
|
data-uix-chip
|
|
data-active={mode === item}
|
|
onclick={() => (mode = item as SelectMode)}
|
|
>
|
|
{item}
|
|
</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-switch>
|
|
<input type="checkbox" bind:checked={disabled} />
|
|
<span data-uix-switch-label>disabled</span>
|
|
</label>
|
|
<label data-uix-switch>
|
|
<input type="checkbox" bind:checked={required} />
|
|
<span data-uix-switch-label>required</span>
|
|
</label>
|
|
<label data-uix-switch>
|
|
<input type="checkbox" bind:checked={invalid} />
|
|
<span data-uix-switch-label>invalid</span>
|
|
</label>
|
|
<label data-uix-switch>
|
|
<input type="checkbox" bind:checked={allowDeselect} />
|
|
<span data-uix-switch-label>allowDeselect</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span> props · visual treatment
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>size</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each sizes as item}
|
|
<button
|
|
data-uix-chip
|
|
data-active={size === item}
|
|
onclick={() => (size = item)}
|
|
>
|
|
{item}
|
|
</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>variant</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each variants as item}
|
|
<button
|
|
data-uix-chip
|
|
data-active={variant === item}
|
|
onclick={() => (variant = item)}
|
|
>
|
|
{item}
|
|
</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>color</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each colors as item}
|
|
<button
|
|
data-uix-chip
|
|
data-active={color === item}
|
|
onclick={() => (color = item)}
|
|
>
|
|
{item}
|
|
</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-code>
|
|
<div data-uix-code-head>
|
|
<span data-uix-layer-badge="soma">soma</span>
|
|
<span>headless · listbox state + form value</span>
|
|
<span data-uix-code-lang>svelte</span>
|
|
</div>
|
|
<pre><code>{somaSnippet}</code></pre>
|
|
</div>
|
|
|
|
<div data-uix-code>
|
|
<div data-uix-code-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span>
|
|
<span>visual · trigger/content recipe</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 comparison</h2>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead>
|
|
<tr>
|
|
<th>Feature</th>
|
|
<th>Air</th>
|
|
<th>Radix</th>
|
|
<th>Bits</th>
|
|
<th>Ark</th>
|
|
<th>React Aria</th>
|
|
<th>UIX</th>
|
|
<th>Decision</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr><td class="name">Compound anatomy</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Keep root + attached parts; no public Provider or Root.</td></tr>
|
|
<tr><td class="name">Trigger value + icon</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Soma owns Value; Eidos owns the visual Indicator.</td></tr>
|
|
<tr><td class="name">Portal + floating + arrow</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Soma owns Floating; Eidos consumes data-side and CSS vars.</td></tr>
|
|
<tr><td class="name">Groups + separator</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Covered by Group, GroupHeading and Separator.</td></tr>
|
|
<tr><td class="name">Selected item indicator</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Eidos-only ItemIndicator reads Soma item state.</td></tr>
|
|
<tr><td class="name">Single select</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Covered.</td></tr>
|
|
<tr><td class="name">Multiple select</td><td>✅</td><td>❌</td><td>✅</td><td>⚠️</td><td>⚠️</td><td>✅</td><td>Soma type="multiple"; Eidos only styles selected state.</td></tr>
|
|
<tr><td class="name">Typeahead + keyboard</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Covered by Soma.</td></tr>
|
|
<tr><td class="name">Hidden native select</td><td>⚠️</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Soma renders it when name is passed.</td></tr>
|
|
<tr><td class="name">Scroll buttons</td><td>✅</td><td>✅</td><td>⚠️</td><td>⚠️</td><td>❌</td><td>❌</td><td>Defer to Soma; it needs viewport behavior.</td></tr>
|
|
<tr><td class="name">Static content</td><td>✅</td><td>❌</td><td>✅</td><td>⚠️</td><td>❌</td><td>❌</td><td>Defer to Soma if inline listbox topology is needed.</td></tr>
|
|
<tr><td class="name">Chip/count display</td><td>✅</td><td>❌</td><td>⚠️</td><td>⚠️</td><td>⚠️</td><td>❌</td><td>Defer to Soma; current Trigger accepts custom content.</td></tr>
|
|
<tr><td class="name">Invalid state</td><td>✅</td><td>⚠️</td><td>⚠️</td><td>✅</td><td>✅</td><td>❌</td><td>Defer to Field/Soma; Eidos must not invent validation.</td></tr>
|
|
<tr><td class="name">Async/virtualized collections</td><td>❌</td><td>❌</td><td>⚠️</td><td>✅</td><td>✅</td><td>❌</td><td>Belongs in collection/virtualization, not visual wrapper.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Owner</th><th>Default</th><th>Notes</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">value</td><td>soma</td><td class="default">[]</td><td>Bindable selected values.</td></tr>
|
|
<tr><td class="name">open</td><td>soma</td><td class="default">false</td><td>Bindable popup state.</td></tr>
|
|
<tr><td class="name">type</td><td>soma</td><td class="default">single</td><td>single | multiple.</td></tr>
|
|
<tr><td class="name">allowDeselect</td><td>soma</td><td class="default">false</td><td>Single mode can clear by reselecting.</td></tr>
|
|
<tr><td class="name">side / align</td><td>soma</td><td class="default">bottom / start</td><td>Floating placement. No <code>auto</code> side.</td></tr>
|
|
<tr><td class="name">size</td><td>eidos</td><td class="default">md</td><td>Responsive visual density.</td></tr>
|
|
<tr><td class="name">variant</td><td>eidos</td><td class="default">surface</td><td>surface | outline | ghost.</td></tr>
|
|
<tr><td class="name">color</td><td>eidos</td><td class="default">primary</td><td>Intent palette for focus/selected state.</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> · contract</h2>
|
|
<p data-uix-section-desc>
|
|
Source: <code>src/uix/morfo/components/select.ts</code>. The morfo is the
|
|
source for markers, ARIA, keyboard and semantic event targets; Eidos only consumes
|
|
the emitted data-attrs.
|
|
</p>
|
|
<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 class="type">"{selectMorfo.name}"</td></tr>
|
|
<tr><td class="name">kebab</td><td class="type">"{selectMorfo.kebab}"</td></tr>
|
|
<tr><td class="name">scope</td><td class="type">[{selectMorfo.scope.map((s) => `"${s}"`).join(', ')}]</td></tr>
|
|
<tr><td class="name">apg</td><td><a href={selectMorfo.apg} target="_blank" rel="noreferrer">{selectMorfo.apg}</a></td></tr>
|
|
<tr><td class="name">parts.length</td><td class="default">{selectMorfo.parts.length}</td></tr>
|
|
<tr><td class="name">events.length</td><td class="default">{selectMorfo.events.length}</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<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}
|
|
<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>
|
|
|
|
{#each selectMorfo.parts as rawPart}
|
|
{@const partAny = rawPart as unknown as { kebab: string; aria?: ReadonlyArray<{ attr: string; value: { kind: string }; condition?: { when: string; prop?: string; part?: string }; severity?: string }>; keyboard?: ReadonlyArray<{ key: string; action: string }> }}
|
|
{@const dataAttrs = compiled.contracts.dataAttrsByPart.get(partAny.kebab) ?? []}
|
|
{@const ariaAttrs = partAny.aria ?? []}
|
|
{@const keyboard = partAny.keyboard ?? []}
|
|
{#if dataAttrs.length || ariaAttrs.length || keyboard.length}
|
|
<div data-uix-subsection-head>{partAny.kebab}</div>
|
|
|
|
{#if dataAttrs.length}
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>data-attr</th><th>Values</th><th>Source kind</th></tr></thead>
|
|
<tbody>
|
|
{#each dataAttrs as attr}
|
|
<tr>
|
|
<td class="name">{attr.attr}</td>
|
|
<td class="type">{attr.values ? attr.values.join(' | ') : '-'}</td>
|
|
<td class="default">{'value' in attr && attr.value ? (attr as { value: { kind: string } }).value.kind : '-'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{/if}
|
|
|
|
{#if ariaAttrs.length}
|
|
<div data-uix-table-wrap style="margin-top: var(--uix-space-2);">
|
|
<table data-uix-table>
|
|
<thead><tr><th>aria-attr</th><th>Source kind</th><th>Condition</th><th>Severity</th></tr></thead>
|
|
<tbody>
|
|
{#each ariaAttrs as a}
|
|
<tr>
|
|
<td class="name">{a.attr}</td>
|
|
<td class="type">{a.value.kind}</td>
|
|
<td class="default">{a.condition ? `when ${a.condition.when}${a.condition.prop ? ` (${a.condition.prop})` : ''}${a.condition.part ? ` (${a.condition.part})` : ''}` : 'always'}</td>
|
|
<td class="default">{a.severity ?? 'required'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{/if}
|
|
|
|
{#if keyboard.length}
|
|
<div data-uix-table-wrap style="margin-top: var(--uix-space-2);">
|
|
<table data-uix-table>
|
|
<thead><tr><th>key</th><th>action</th></tr></thead>
|
|
<tbody>
|
|
{#each keyboard as kb}
|
|
<tr>
|
|
<td><span data-uix-kbd>{kb.key === ' ' ? 'Space' : kb.key}</span></td>
|
|
<td class="default">{kb.action}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
{/each}
|
|
|
|
<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><th>prewrite</th><th>commit</th></tr></thead>
|
|
<tbody>
|
|
{#each events as action}
|
|
{@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>
|
|
<td class="default">{action.prewrite.length ? action.prewrite.map((p) => `${p.attr}=${p.value}`).join(', ') : '-'}</td>
|
|
<td class="default">{action.commit ? `${action.commit.attr}=${action.commit.value}` : '-'}</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 + perceptual signature
|
|
</h2>
|
|
<p data-uix-section-desc>
|
|
Select has two semantic commits: selecting is affirmative; unselecting is neutral. Open,
|
|
close, highlight and typeahead are intentionally silent.
|
|
</p>
|
|
<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><th>Play</th></tr></thead>
|
|
<tbody>
|
|
{#each events as action}
|
|
<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>{action.semantic.intent ?? '-'}</td>
|
|
<td>{action.target}</td>
|
|
<td>
|
|
<button
|
|
data-uix-play
|
|
onclick={() => {
|
|
const target = stageRef?.querySelector('[data-select-item]') as HTMLElement | null;
|
|
if (!target) return;
|
|
void uix.events?.emit({
|
|
name: action.name,
|
|
family: action.semantic.family,
|
|
intent: intentLiteral(action.semantic.intent),
|
|
target
|
|
});
|
|
}}
|
|
>
|
|
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 live in <code>src/uix/eidos/components/select/select.css</code>. Morfo
|
|
provides structure/state; Eidos-only attrs provide visual treatment.
|
|
</p>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Selector</th><th>Source</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">[data-select]</td><td><span data-uix-tag data-kind="soma">morfo</span></td></tr>
|
|
<tr><td class="name">[data-select-trigger][data-state]</td><td><span data-uix-tag data-kind="soma">morfo</span></td></tr>
|
|
<tr><td class="name">[data-select-content][data-side]</td><td><span data-uix-tag data-kind="soma">runtime</span></td></tr>
|
|
<tr><td class="name">[data-select-item][data-state='checked']</td><td><span data-uix-tag data-kind="soma">morfo</span></td></tr>
|
|
<tr><td class="name">[data-select-trigger][data-size]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td></tr>
|
|
<tr><td class="name">[data-select-trigger][data-color]</td><td><span data-uix-tag data-kind="eidos">eidos</span></td></tr>
|
|
<tr><td class="name">[data-select-indicator]</td><td><span data-uix-tag data-kind="eidos">eidos-only</span></td></tr>
|
|
<tr><td class="name">[data-select-item-indicator]</td><td><span data-uix-tag data-kind="eidos">eidos-only</span></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">Pattern</td><td>Trigger is <code>role="combobox"</code>; content is <code>role="listbox"</code>; items are <code>role="option"</code>.</td></tr>
|
|
<tr><td class="name">Keyboard</td><td>Enter/Space opens or selects, arrows navigate, Home/End jump, Escape closes.</td></tr>
|
|
<tr><td class="name">Typeahead</td><td>Character input highlights the next matching enabled item.</td></tr>
|
|
<tr><td class="name">Form</td><td><code>name</code> renders a hidden native <code>select</code> for submission.</td></tr>
|
|
<tr><td class="name">Disabled</td><td>Disabled trigger/items are removed from interaction and navigation candidates.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
</div>
|