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.
svelte-kit-vice/web/routes/uix/components/css-field/+page.svelte

760 lines
27 KiB

<script lang="ts">
import {
CssField,
type CssFieldColor,
type CssFieldSize,
type CssFieldSteppers,
type CssFieldVariant,
type CssFieldValidate
} from '$uix/eidos/components/css-field';
import { compileMorfo } from '$uix/morfo';
import { cssFieldMorfo } from '@/uix/morfo/components/css-field';
import { getActiveUix } from '$active-uix';
import { pipe, string, cssValue, type CssUnit } from '$sium';
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'a11y';
type Direction = 'ltr' | 'rtl';
type ValidateMode = 'built-in' | 'fn-px-only' | 'sium-px-rem';
type TraceEntry = { event: string; family: string; intent?: string; at: number };
const uix = getActiveUix();
let tab = $state<Tab>('live');
let value = $state<string | undefined>('16px');
let allowNegative = $state(true);
let validateMode = $state<ValidateMode>('built-in');
let min = $state<number | undefined>(undefined);
let max = $state<number | undefined>(undefined);
let step = $state<number | undefined>(undefined);
let largeStep = $state<number | undefined>(undefined);
let allowMouseWheel = $state(false);
let clampOnBlur = $state(true);
let disabled = $state(false);
let readonly = $state(false);
let required = $state(false);
let invalid = $state(false);
let dir = $state<Direction>('ltr');
let size = $state<CssFieldSize>('md');
let variant = $state<CssFieldVariant>('surface');
let color = $state<CssFieldColor>('primary');
let steppers = $state<CssFieldSteppers>('split');
let stepperLayoutValue = $state<string | undefined>('16px');
let lastInvalid = $state<string | null>(null);
let trace = $state<TraceEntry[]>([]);
let stageRef = $state<HTMLElement | null>(null);
// ── Unit whitelist (the `allowedUnits` prop) ─────────────────────────
const UNIT_CHOICES: CssUnit[] = ['px', 'rem', 'em', '%', 'vh', 'vw', 'ch', 'fr', 'deg', 's', 'ms'];
let selectedUnits = $state<CssUnit[]>(['px', 'rem', '%']);
const allowedUnits = $derived(selectedUnits.length ? selectedUnits : undefined);
function toggleUnit(u: CssUnit) {
selectedUnits = selectedUnits.includes(u)
? selectedUnits.filter((x) => x !== u)
: [...selectedUnits, u];
}
// ── Keywords ──────────────────────────────────────────────────────────
const KEYWORD_CHOICES = ['auto', 'inherit', 'initial', 'none', 'fit-content', 'max-content'];
let selectedKeywords = $state<string[]>([]);
const keywords = $derived(selectedKeywords);
function toggleKeyword(k: string) {
selectedKeywords = selectedKeywords.includes(k)
? selectedKeywords.filter((x) => x !== k)
: [...selectedKeywords, k];
}
// ── Validation strategy (built-in functions OR delegate to sium) ──────
const validate = $derived.by<CssFieldValidate | undefined>(() => {
if (validateMode === 'fn-px-only') {
return (v: string) => v.endsWith('px') || 'Only px units allowed';
}
if (validateMode === 'sium-px-rem') {
return pipe(string(), cssValue({ units: ['px', 'rem'], allowNegative }));
}
return undefined;
});
// ── Presets ───────────────────────────────────────────────────────────
type Preset = {
label: string;
units: CssUnit[];
keywords?: string[];
value: string;
step?: number;
};
const PRESETS: Preset[] = [
{ label: 'padding · px/rem', units: ['px', 'rem'], value: '12px', step: 1 },
{ label: 'width · %/px + auto', units: ['%', 'px'], keywords: ['auto'], value: '50%', step: 1 },
{ label: 'font-size · rem/em/px', units: ['rem', 'em', 'px'], value: '1.5rem', step: 0.1 },
{ label: 'duration · s/ms', units: ['s', 'ms'], value: '300ms', step: 50 },
{ label: 'angle · deg', units: ['deg'], value: '45deg', step: 15 },
{ label: 'grid · fr', units: ['fr'], value: '1fr', step: 1 }
];
function applyPreset(p: Preset) {
selectedUnits = [...p.units];
selectedKeywords = [...(p.keywords ?? [])];
value = p.value;
step = p.step;
validateMode = 'built-in';
lastInvalid = null;
}
const compiled = compileMorfo(cssFieldMorfo);
const partsList = $derived([...compiled.parts.byKebab.values()]);
const events = $derived([...compiled.actions.byName.values()]);
const displayValue = $derived(value === undefined ? 'empty' : value);
const variants: CssFieldVariant[] = ['surface', 'outline', 'ghost'];
const colors: CssFieldColor[] = [
'primary',
'secondary',
'neutral',
'affirm',
'fulfill',
'risk',
'threat',
'loss'
];
$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 targetSelector(target: string): string {
if (target === 'scrubber') return '[data-css-field-scrubber]';
if (target === 'input') return '[data-css-field-input]';
return '[data-css-field]';
}
const somaSnippet = $derived(
[
"<script lang='ts'>",
" import * as CssField from '$soma/components/css-field';",
` let value = $state(${value ? `'${value}'` : 'undefined'});`,
'</' + 'script>',
'',
`<CssField.Provider bind:value allowedUnits={${JSON.stringify(selectedUnits)}}>`,
' <CssField.DecrementTrigger />',
' <CssField.Input />',
' <CssField.IncrementTrigger />',
' <CssField.Scrubber>drag</CssField.Scrubber>',
'</CssField.Provider>'
].join('\n')
);
const eidosSnippet = $derived(
[
"<script lang='ts'>",
" import { CssField } from '$uix/eidos/components/css-field';",
` let value = $state(${value ? `'${value}'` : 'undefined'});`,
'</' + 'script>',
'',
'<CssField',
' bind:value',
` allowedUnits={${JSON.stringify(selectedUnits)}}`,
selectedKeywords.length > 0 && ` keywords={${JSON.stringify(selectedKeywords)}}`,
validateMode === 'sium-px-rem' && ' validate={pipe(string(), cssValue({ units: [\'px\', \'rem\'] }))}',
size !== 'md' && ` size="${size}"`,
variant !== 'surface' && ` variant="${variant}"`,
color !== 'primary' && ` color="${color}"`,
steppers !== 'split' && ` steppers="${steppers}"`,
'>',
' <CssField.DecrementTrigger />',
' <CssField.Input />',
' <CssField.IncrementTrigger />',
' <CssField.Scrubber>drag</CssField.Scrubber>',
'</CssField>'
]
.filter(Boolean)
.join('\n')
);
</script>
<div data-uix-canvas-inner>
<header>
<div data-uix-eyebrow>Forms · CSS value field</div>
<h1 data-uix-page-title>CssField</h1>
<p data-uix-page-lede>
Spinbutton for CSS dimension values (px, rem, %, …) with a unit whitelist, optional
increment/decrement triggers and a pointer scrubber. Soma parses and validates via the pure
sium functions — or delegates to a sium schema; Eidos adds visual size.
</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>keyboard</span>9</span>
<span data-uix-meta-pill><span data-uix-meta-key>sizes</span>5</span>
</div>
</header>
<div data-uix-stage>
<div data-uix-stage-area bind:this={stageRef}>
<CssField
bind:value
{allowedUnits}
{keywords}
{allowNegative}
{validate}
{min}
{max}
{step}
{largeStep}
{allowMouseWheel}
{clampOnBlur}
{disabled}
{readonly}
{required}
{invalid}
{dir}
{size}
{variant}
{color}
{steppers}
onInvalid={(v) => (lastInvalid = v)}
onValueCommit={() => (lastInvalid = null)}
>
<CssField.DecrementTrigger />
<CssField.Input aria-label="CSS value" />
<CssField.IncrementTrigger />
<CssField.Scrubber>drag</CssField.Scrubber>
</CssField>
</div>
<div data-uix-stage-trace>
<span data-uix-stage-trace-key>trace</span>
{#if trace.length === 0}
<span>type a value, increment, press Enter or drag the scrubber to see 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>
<span data-uix-stage-trace-event>{displayValue}</span>
{#if lastInvalid !== null}
<span data-uix-stage-trace-key style="margin-inline-start: var(--uix-space-2);"
>invalid</span
>
<span data-uix-stage-trace-event>{lastInvalid}</span>
{/if}
</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>18</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>
<span data-uix-layer-badge="soma">soma</span> owns parse/validate/step model.
<span data-uix-layer-badge="eidos">eidos</span> owns size.
</p>
<div data-uix-subsection-head>
<span data-uix-layer-badge="soma">soma</span> props · value model
</div>
<div data-uix-controls>
<label data-uix-control>
<span data-uix-control-label
>allowedUnits <span data-uix-control-hint>unit whitelist (1st = default)</span></span
>
<span data-uix-chips role="group">
{#each UNIT_CHOICES as u (u)}
<button
data-uix-chip
data-active={selectedUnits.includes(u)}
onclick={() => toggleUnit(u)}>{u}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label
>keywords <span data-uix-control-hint>opt-in bare keywords</span></span
>
<span data-uix-chips role="group">
{#each KEYWORD_CHOICES as k (k)}
<button
data-uix-chip
data-active={selectedKeywords.includes(k)}
onclick={() => toggleKeyword(k)}>{k}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label
>validate <span data-uix-control-hint>built-in fns or delegate to sium</span></span
>
<span data-uix-chips role="radiogroup">
{#each ['built-in', 'fn-px-only', 'sium-px-rem'] as m (m)}
<button
data-uix-chip
data-active={validateMode === m}
onclick={() => (validateMode = m as ValidateMode)}>{m}</button
>
{/each}
</span>
</label>
<label data-uix-control>
<span data-uix-control-label>min</span>
<input
type="number"
value={min ?? ''}
oninput={(e) =>
(min = e.currentTarget.value === '' ? undefined : Number(e.currentTarget.value))}
/>
</label>
<label data-uix-control>
<span data-uix-control-label>max</span>
<input
type="number"
value={max ?? ''}
oninput={(e) =>
(max = e.currentTarget.value === '' ? undefined : Number(e.currentTarget.value))}
/>
</label>
<label data-uix-control>
<span data-uix-control-label>step <span data-uix-control-hint>auto per-unit</span></span>
<input
type="number"
step="0.1"
value={step ?? ''}
oninput={(e) =>
(step = e.currentTarget.value === '' ? undefined : Number(e.currentTarget.value))}
/>
</label>
<label data-uix-control>
<span data-uix-control-label>largeStep</span>
<input
type="number"
value={largeStep ?? ''}
oninput={(e) =>
(largeStep =
e.currentTarget.value === '' ? undefined : Number(e.currentTarget.value))}
/>
</label>
<label data-uix-control>
<span data-uix-control-label>dir</span>
<span data-uix-chips role="radiogroup">
{#each ['ltr', 'rtl'] as d}
<button data-uix-chip data-active={dir === d} onclick={() => (dir = d as Direction)}
>{d}</button
>
{/each}
</span>
</label>
{#each ['allowNegative', 'allowMouseWheel', 'clampOnBlur', 'disabled', 'readonly', 'required', 'invalid'] as flag}
<label data-uix-control>
<span data-uix-control-label>{flag}</span>
<span data-uix-switch>
{#if flag === 'allowNegative'}
<input type="checkbox" bind:checked={allowNegative} />
<span data-uix-switch-label>{allowNegative ? 'on' : 'off'}</span>
{:else if flag === 'allowMouseWheel'}
<input type="checkbox" bind:checked={allowMouseWheel} />
<span data-uix-switch-label>{allowMouseWheel ? 'on' : 'off'}</span>
{:else if flag === 'clampOnBlur'}
<input type="checkbox" bind:checked={clampOnBlur} />
<span data-uix-switch-label>{clampOnBlur ? 'on' : 'off'}</span>
{:else if flag === 'disabled'}
<input type="checkbox" bind:checked={disabled} />
<span data-uix-switch-label>{disabled ? 'on' : 'off'}</span>
{:else if flag === 'readonly'}
<input type="checkbox" bind:checked={readonly} />
<span data-uix-switch-label>{readonly ? 'on' : 'off'}</span>
{:else if flag === 'required'}
<input type="checkbox" bind:checked={required} />
<span data-uix-switch-label>{required ? 'on' : 'off'}</span>
{:else}
<input type="checkbox" bind:checked={invalid} />
<span data-uix-switch-label>{invalid ? 'on' : 'off'}</span>
{/if}
</span>
</label>
{/each}
</div>
<div data-uix-subsection-head>Presets · canonical scenarios</div>
<div data-uix-controls>
<div
style="display: flex; flex-wrap: wrap; gap: var(--uix-space-1); padding: var(--uix-space-2) 0;"
>
{#each PRESETS as p (p.label)}
<button data-uix-chip onclick={() => applyPreset(p)}>{p.label}</button>
{/each}
</div>
</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 ['xs', 'sm', 'md', 'lg', 'xl'] as s}
<button
data-uix-chip
data-active={size === s}
onclick={() => (size = s as CssFieldSize)}>{s}</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>
<label data-uix-control>
<span data-uix-control-label>steppers</span>
<span data-uix-chips role="radiogroup">
{#each ['split', 'stacked'] as item}
<button
data-uix-chip
data-active={steppers === item}
onclick={() => (steppers = item as CssFieldSteppers)}>{item}</button
>
{/each}
</span>
</label>
</div>
<div data-uix-subsection-head>
<span data-uix-layer-badge="eidos">eidos</span> stepper layout · <code>steppers</code>
</div>
<p data-uix-section-desc>
<code>split</code> (default) — decrement/increment at the two ends. <code>stacked</code> —
one compact column on the inline-end (▲ top / ▼ bottom); flips to the inline-start under
RTL. The arrow glyphs come from themeable tokens, so passing children is optional.
</p>
<!-- Plain wrappers (NOT data-uix-control) so the demo's native-input border
doesn't leak into the CssField's own input. -->
<div
style="display:flex; flex-wrap:wrap; gap:var(--space-6); align-items:flex-start; margin-block-start:var(--space-2)"
>
<div style="display:flex; flex-direction:column; gap:var(--space-1-5); inline-size:13rem">
<span data-uix-control-label>split</span>
<CssField
bind:value={stepperLayoutValue}
allowedUnits={['px', 'rem', '%']}
aria-label="Split"
>
<CssField.DecrementTrigger />
<CssField.Input aria-label="Split stepper" />
<CssField.IncrementTrigger />
</CssField>
</div>
<div style="display:flex; flex-direction:column; gap:var(--space-1-5); inline-size:13rem">
<span data-uix-control-label>stacked</span>
<CssField
bind:value={stepperLayoutValue}
allowedUnits={['px', 'rem', '%']}
steppers="stacked"
aria-label="Stacked"
>
<CssField.DecrementTrigger />
<CssField.Input aria-label="Stacked stepper" />
<CssField.IncrementTrigger />
</CssField>
</div>
<div style="display:flex; flex-direction:column; gap:var(--space-1-5); inline-size:13rem">
<span data-uix-control-label>stacked · rtl</span>
<CssField
bind:value={stepperLayoutValue}
allowedUnits={['px', 'rem', '%']}
steppers="stacked"
dir="rtl"
aria-label="Stacked RTL"
>
<CssField.DecrementTrigger />
<CssField.Input aria-label="Stacked RTL stepper" />
<CssField.IncrementTrigger />
</CssField>
</div>
</div>
<div data-uix-code>
<div data-uix-code-head>
<span data-uix-layer-badge="soma">soma</span>
<span>headless · CSS-value spinbutton</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 · size, variant and intent color</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>Radix</th><th>Ark</th><th>React Aria</th><th>UIX</th><th>Decision</th>
</tr>
</thead>
<tbody>
<tr><td class="name">Numeric stepper</td><td>NumberField</td><td>NumberInput</td><td>NumberField</td><td>✅</td><td>Steps the numeric component.</td></tr>
<tr><td class="name">Unit-aware value</td><td>❌</td><td>❌</td><td>❌</td><td>✅</td><td>allowedUnits whitelist; unit preserved on step.</td></tr>
<tr><td class="name">Increment/decrement triggers</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Optional, hold-to-repeat.</td></tr>
<tr><td class="name">Pointer scrubber</td><td>❌</td><td>❌</td><td>❌</td><td>✅</td><td>Optional, RTL-aware.</td></tr>
<tr><td class="name">Pluggable validation</td><td>❌</td><td>partial</td><td>partial</td><td>✅</td><td>Built-in fns or delegate to a sium schema.</td></tr>
<tr><td class="name">Field integration</td><td>✅</td><td>✅</td><td>✅</td><td>✅</td><td>Inherits disabled/readonly/required/invalid.</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">undefined</td><td>Bindable CSS string ("12px").</td></tr>
<tr><td class="name">allowedUnits</td><td>soma</td><td class="default">all units</td><td>Allowed-units whitelist; 1st = default.</td></tr>
<tr><td class="name">keywords</td><td>soma</td><td class="default">[]</td><td>Opt-in bare keywords.</td></tr>
<tr><td class="name">allowNegative</td><td>soma</td><td class="default">true</td><td>Allow a leading minus.</td></tr>
<tr><td class="name">validate</td><td>soma</td><td class="default">built-in</td><td>Predicate fn or sium schema.</td></tr>
<tr><td class="name">min / max</td><td>soma</td><td class="default">—</td><td>Numeric-component bounds.</td></tr>
<tr><td class="name">step / largeStep</td><td>soma</td><td class="default">per-unit / step*10</td><td>Stepping amounts.</td></tr>
<tr><td class="name">size</td><td>eidos</td><td class="default">md</td><td>xs | sm | md | lg | xl.</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>Accent palette.</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>Part</th><th>Marker</th><th>Element</th><th>Role</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">&lt;{part.defaultElement}&gt;</td>
<td class="type">{part.role ?? '—'}</td>
<td class="default">{part.optional ? 'yes' : 'no'}</td>
</tr>
{/each}
</tbody>
</table>
</div>
<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>
{#each cssFieldMorfo.parts[1].keyboard ?? [] as key}
<tr><td class="name">{key.key}</td><td>{key.action}</td></tr>
{/each}
</tbody>
</table>
</div>
</section>
{/if}
{#if tab === 'sema'}
<section data-uix-section>
<h2 data-uix-section-title>
<span data-uix-layer-badge="sema">sema</span> · events + perceptual signature
</h2>
<p data-uix-section-desc>
Value commits resolve through <code>commit-set</code>. The scrubber emits pickup + drag
cues; an out-of-whitelist unit fires <code>signal-warn-invalid</code> (untilFix).
</p>
<div data-uix-table-wrap>
<table data-uix-table>
<thead
><tr
><th>Name</th><th>Family</th><th>Verb</th><th>Intent</th><th>Sequence</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.intent ?? '—'}</td>
<td>{action.semantic.sequence ?? 'pre'}</td>
<td>{action.target}</td>
<td>
<button
data-uix-play
onclick={() => {
const target = stageRef?.querySelector(
targetSelector(action.target)
) as HTMLElement | null;
if (!target) return;
void uix.events?.emit({
name: action.name,
family: action.semantic.family,
intent: action.semantic.intent as
| 'neutral'
| 'affirm'
| 'fulfill'
| 'risk'
| 'threat'
| 'loss'
| undefined,
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/css-field/css-field.css</code> and consume
Soma focus/scrubbing/invalid/disabled attrs plus Eidos <code>data-size</code>.
</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-css-field]</code></td>
<td><span data-uix-tag data-kind="morfo">morfo</span></td>
<td>Root spinbutton composition shell.</td>
</tr>
<tr>
<td class="name"><code>[data-css-field][data-size][data-variant][data-color]</code></td>
<td><span data-uix-tag data-kind="eidos">eidos</span></td>
<td>Visual scale, input treatment and intent palette.</td>
</tr>
<tr>
<td class="name"><code>[data-css-field][data-focused], [data-css-field][data-invalid]</code></td>
<td><span data-uix-tag data-kind="morfo">morfo</span></td>
<td>Focus ring + invalid border surfaced by the headless layer.</td>
</tr>
<tr>
<td class="name"
><code>[data-css-field-increment-trigger]</code> /
<code>[data-css-field-decrement-trigger]</code></td
>
<td><span data-uix-tag data-kind="morfo">morfo</span></td>
<td>Stepper affordances.</td>
</tr>
<tr>
<td class="name"><code>[data-css-field-scrubber][data-scrubbing]</code></td>
<td><span data-uix-tag data-kind="morfo">morfo</span></td>
<td>Drag scrubbing affordance and active state.</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>Input uses <code>role="spinbutton"</code>.</td></tr>
<tr><td class="name">Value</td><td>Input exposes <code>aria-valuenow</code> (numeric part) + <code>aria-valuetext</code> (full string).</td></tr>
<tr><td class="name">Keyboard</td><td>Arrows, PageUp/PageDown, Home/End and Enter are declared.</td></tr>
<tr><td class="name">Invalid</td><td><code>aria-invalid</code> + a live <code>signal-warn-invalid</code> cue on a disallowed unit.</td></tr>
<tr><td class="name">Triggers</td><td>Increment/decrement controls get translated labels.</td></tr>
</tbody>
</table>
</div>
</section>
{/if}
</div>

Powered by TurnKey Linux.