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/src/uix/morfo/components/date-range-picker.ts

246 lines
6.4 KiB

morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
import type { Morfo } from '../types';
import { v } from '../types';
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
/**
* DateRangePicker — composite popover containing a DateRangeField (segmented
* inputs) + RangeCalendar. The morfo declares the picker's own surface
* (trigger + calendar shell + dismissal events); cell-level events and
* range tracking are owned by the `range-calendar` morfo.
*/
soma/morfo: typed createAttrs + 6 audit batches + form hang fix + A36 ## morfo: typed createAttrs - `types.ts`: all array fields are now `readonly` so morfos can be authored with `as const satisfies Morfo` without casts. - `createAttrs` is a generic `<const M extends MorfoShape>` that infers the emitted attr map from the morfo's literal shape. Typos like `attrs.trigerr` are now compile errors; autocomplete lists every valid part. - All 66 morfos migrated: `export const xMorfo = { ... } as const satisfies Morfo`. - Two latent bugs the new typing caught: `dateRangeFieldAttrs.root` and `timeRangeFieldAttrs.root` — legacy from the root→provider refactor, fixed to `.provider`. - Docs (morfo/README, COMPONENT_GUIDE) mandate `as const satisfies Morfo`; the older `: Morfo` annotation widens literals and loses autocomplete. ## Audit batches 1–7 (soma-audit-2026-04-20) Batch 1 — Keyboard a11y (A14/A12): - Tabs: `isFallbackTabStop(el)` using `untrack` → first trigger gets `tabindex=0` when no tab matches (WCAG 2.1.1 was failing). - RatingGroup: `dir` prop + `getDirectionalKeys(dir, 'horizontal')` for RTL. - Accordion P1-1/P1-6 dismissed: roving/labelledby already correct per APG. Batch 2 — A33 reactive collections: Select `labelRegistry` and NavigationMenu `triggerRefs` migrated to `SvelteMap`. Batch 3 — A31 O(N²) fix: RadioGroup lifts `hasSelection` + `isFallbackTabStop` to the provider with `untrack`-wrapped DOM walk. Per-item derivations drop from O(N²) to O(1) per trigger. Batch 4 — Morfo aria sync: toast / time-field / date-field / tabs / tag-group / navigation-menu declare every aria the provider emits (14 entries across 6 files). Batch 5 — Accessible naming props: Tabs.List, ToggleGroup, TreeView, NavigationMenu expose `aria-label?` / `aria-labelledby?` with explicit "required unless labelledby is set" JSDoc. Batch 6 — A30 cleanup: Checkbox `setLabelId` and 5 trigger-ref providers (select/tooltip/link-preview/dropdown-menu/context-menu) migrated from `$effect(() => parent.ref = opts.ref)` to the `Provider` base's `onRefChange` callback (fires via attachRef inside `untrack`). Batch 7 — A11 wrapper thinning: stepper/tree-view wrappers removed `ctx.get()`, providers expose proxy derivations; time/date-range-field inputs use `untrack(() => …)` for one-shot id registration; menubar content's 40-line keyboard nav moved to `MenubarMenuProvider.onContentKeydown`; color-picker area + channel-slider pointer state machines moved to the providers with `onpointerdown/move/up` emitted via `props`. form-auto-fields deferred with justification (reflective schema renderer, not a state-holding wrapper). ## Form hang fix (A36) `runValidate` entered the `isPromiseLike` branch even for sync schemas because sium's Standard-Schema adapter declares `validate: async`. The fallback `return { errors, issues }` read both reactive vars inside the validation `$effect` while the `.then(...)` microtask wrote them → microtask-mediated loop, silent to Svelte's sync effect-depth guard. Symptom: kitchen-sink hung the tab on mount with onChange / onBlur. Fix: `return untrack(() => ({ errors, issues }))`. Regression locked by two new 5s-timeout tests in `form-auto-fields.svelte.test.ts`. Pattern codified as A36 in COMPONENT_GUIDE; CLAUDE.md count updated to A1–A36 / 39 items. ## Verification - `npm run check`: 0 errors in soma/morfo scope (sema demo pre-existing errors untouched). - `npx vitest run src/uix/soma src/uix/morfo`: all tests green (94 + 7 = 101 tests, inc. 2 new form regression tests). - `npm run smoke`: 65/65 routes. - `npx tsx scripts/morfo-check.ts`: 66/66 morfos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
export const dateRangePickerMorfo = {
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
name: 'DateRangePicker',
kebab: 'date-range-picker',
scope: ['soma', 'sema'],
apg: 'https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/',
uix: rename morfo.translations → morfo.texts (idlangref discipline) Morfo now declares text slots as absolute idlangrefs in `texts: Record<string, LangRef>`, not literal multilingual records. Multilingual content moves out of morfo entirely into per-component catalogs under `src/uix/langs/components/{kebab}.ts`, merged globally by `ActiveUix` via the new `componentLangs` barrel. Morfo stays a pure abstract surface; localization lives in its own layer. - Type: `translations?: LangNode` → `texts?: Record<string, LangRef>` in `src/uix/morfo/types.ts`. Doc and test fixtures updated. - Catalog: new `src/uix/langs/` directory with `common.ts` (was `langs.ts`), `components/` (one file per migrated morfo, plus a barrel), and an aggregate `uixLangs`. `ActiveUix` registers both namespaces at boot. - Registry: `registerMorfo` no longer carries a translations fingerprint and no longer extends `ActiveLangs` dynamically. `connectMorfoTranslations` and `MorfoTranslationTarget` deleted from the public morfo barrel. - Validation: schema.ts drops the relative-translationRef-in-morfo.translations check; catalog presence is enforced by the new `scripts/translations-check.ts` (wired as `npm run translations:check`). - Audit: `scripts/component-audit.ts` rule A-1.3 now validates `texts.label` idlangref shape (`#?components.{kebab}.label|Fallback`) and explicitly errors on any surviving legacy `translations:` field. - Migration: `scripts/migrate-translations-to-texts.ts` is the one-off Node script that produced the 42 morfo rewrites and 42 catalog files. - Tests: `morfo/registry.test.ts` rewritten around the simpler contract; `active-uix.svelte.test.ts` reflects boot-time catalog availability instead of lazy per-morfo extension. Verification: `npm run check` (0 errors), `npm run translations:check` (0/0), `npm run morfo:check` (36/36 routed). The 4 pre-existing failures in `test` are unrelated (date-picker types, css regen, range-calendar clear, color contract). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
texts: {
label: '#?components.date-range-picker.label|Date range picker',
uix: rename morfo.translations → morfo.texts (idlangref discipline) Morfo now declares text slots as absolute idlangrefs in `texts: Record<string, LangRef>`, not literal multilingual records. Multilingual content moves out of morfo entirely into per-component catalogs under `src/uix/langs/components/{kebab}.ts`, merged globally by `ActiveUix` via the new `componentLangs` barrel. Morfo stays a pure abstract surface; localization lives in its own layer. - Type: `translations?: LangNode` → `texts?: Record<string, LangRef>` in `src/uix/morfo/types.ts`. Doc and test fixtures updated. - Catalog: new `src/uix/langs/` directory with `common.ts` (was `langs.ts`), `components/` (one file per migrated morfo, plus a barrel), and an aggregate `uixLangs`. `ActiveUix` registers both namespaces at boot. - Registry: `registerMorfo` no longer carries a translations fingerprint and no longer extends `ActiveLangs` dynamically. `connectMorfoTranslations` and `MorfoTranslationTarget` deleted from the public morfo barrel. - Validation: schema.ts drops the relative-translationRef-in-morfo.translations check; catalog presence is enforced by the new `scripts/translations-check.ts` (wired as `npm run translations:check`). - Audit: `scripts/component-audit.ts` rule A-1.3 now validates `texts.label` idlangref shape (`#?components.{kebab}.label|Fallback`) and explicitly errors on any surviving legacy `translations:` field. - Migration: `scripts/migrate-translations-to-texts.ts` is the one-off Node script that produced the 42 morfo rewrites and 42 catalog files. - Tests: `morfo/registry.test.ts` rewritten around the simpler contract; `active-uix.svelte.test.ts` reflects boot-time catalog availability instead of lazy per-morfo extension. Verification: `npm run check` (0 errors), `npm run translations:check` (0/0), `npm run morfo:check` (36/36 routed). The 4 pre-existing failures in `test` are unrelated (date-picker types, css regen, range-calendar clear, color contract). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
trigger: '#?components.date-range-picker.trigger|Open range calendar',
calendar: '#?components.date-range-picker.calendar|Date range calendar'
},
events: [
{
name: 'open',
semantic: {
family: 'emerge',
verb: 'open',
target: v.partRef('calendar'),
sequence: 'pre',
intent: {
fromProp: 'intent',
default: 'neutral',
supported: ['neutral', 'affirm', 'risk']
}
},
commits: {
part: v.partRef('calendar'),
attr: 'data-state',
value: 'open'
}
},
{
// The user committed a complete range and the popover closed.
// `fulfill` because the picker's job — pick a complete range — is done.
name: 'close-range-commit',
semantic: {
family: 'commit',
verb: 'save',
target: v.partRef('calendar'),
sequence: 'post',
intent: 'fulfill'
},
regime: 'lock',
prewrite: [
{ part: v.partRef('calendar'), attr: 'data-last-action', value: 'range-committed' }
],
commits: {
part: v.partRef('calendar'),
attr: 'data-state',
value: 'closed'
}
},
{
// Explicit cancel from a Save/Cancel button (modal mode).
name: 'close-cancel',
semantic: {
family: 'emerge',
verb: 'close',
target: v.partRef('calendar'),
sequence: 'pre'
},
regime: 'lock',
prewrite: [
{ part: v.partRef('calendar'), attr: 'data-last-action', value: 'cancelled' }
],
commits: {
part: v.partRef('calendar'),
attr: 'data-state',
value: 'closed'
}
},
{
// Escape key.
name: 'close-dismiss',
semantic: {
family: 'emerge',
verb: 'dismiss',
target: v.partRef('calendar'),
sequence: 'pre'
},
regime: 'lock',
prewrite: [
{ part: v.partRef('calendar'), attr: 'data-last-action', value: 'dismissed' }
],
commits: {
part: v.partRef('calendar'),
attr: 'data-state',
value: 'closed'
}
},
{
// Click outside the popover.
name: 'close-dismiss-outside',
semantic: {
family: 'emerge',
verb: 'dismiss',
target: v.partRef('calendar'),
sequence: 'pre'
},
regime: 'lock',
prewrite: [
{
part: v.partRef('calendar'),
attr: 'data-last-action',
value: 'dismissed-outside'
}
],
commits: {
part: v.partRef('calendar'),
attr: 'data-state',
value: 'closed'
}
},
{
// User cleared the range (explicit clear button or backspace).
name: 'commit-clear',
semantic: {
family: 'commit',
verb: 'reset',
target: v.partRef('calendar'),
sequence: 'post',
intent: 'neutral'
}
}
],
focus: {
initial: 'first-focusable',
trap: true,
return: 'trigger',
restore: true
},
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
parts: [
{
name: 'Provider',
kebab: 'provider',
morfo: catalog `archetype` across 65 components (~265 part declarations) Bulk classification pass that gives every part a cross-component archetype where one applies. Done with `scripts/catalog-archetypes.ts` — a one-shot mechanical mapping based on a kebab → archetype table, plus three manual overrides for components where Provider IS the interactive element. Coverage - 440 part declarations examined. - ~265 received an archetype (provider, trigger, content, overlay, viewport, item, indicator, thumb, track, label, title, description, close, action, header, image, fallback, arrow, separator, group, input, segment). - ~175 left without one — genuinely component-specific (Slider.Range, PinInput.Segment internals, color-picker channel-slider, etc.). Manual overrides (Provider IS the trigger) - Toggle, Switch, Checkbox: their `Provider` part is a `<button>` that the user actually interacts with, not a root container. Archetype set to `'trigger'` instead of the default `'provider'` so eidos can style them alongside Dialog.Trigger / Popover.Trigger / etc. Script (scripts/catalog-archetypes.ts) - Walks every `*.ts` under `src/uix/morfo/components/`. - Inserts `archetype: '...'` directly after the matching `kebab:` line when a mapping exists. - Idempotent — skips parts that already declare an archetype. - Indent-aware — only operates on part kebabs (≥2 tabs), never the morfo root kebab. Bug discovered + fixed mid-pass when radio-group's root kebab `'radio-group'` matched the `'radio-group' → 'group'` alias and inserted at the wrong level (cleaned up by hand). - Reports per-file counts + the list of unmapped kebabs at the end so future passes can extend the mapping. Tests - Updated `omits data-archetype when not declared` test to use a tiny inline morfo (Toggle's Provider now has archetype 'trigger', so it can't be the "no archetype" fixture anymore). Verification - 22/22 runtime tests, full focused suite green. - 66/66 morfo-check (every component still validates against its DOM — archetype is additive, doesn't change emitted attrs apart from the new `data-archetype="..."` which morfo-check doesn't enforce yet). - 68/68 smoke routes. - svelte-check unchanged at 155.
6 months ago
archetype: 'provider',
uix: date-picker + date-range-picker components + component audit infra Two new Eidos components shipped end-to-end (wrapper + recipe + demo + Soma provider hardening) plus a checklist-driven audit pipeline that scores all 67 morfo components against doctrinal completion criteria. New components: - date-picker: full popover-anchored picker over date-field + calendar, with calendar/content/trigger parts and demo route. - date-range-picker: standalone wrapper with own calendar/grid/segment surface, demo route, and recipe CSS. - Both wrappers follow Option C disciplined (root + parts attached via explicit assignment, no Object.assign). Supporting Soma changes: - range-calendar provider tightened (211 LOC of behavior, 167 LOC of tests), README brought up to component doctrine. - date-field, date-picker, date-range-field, date-range-picker Soma providers + READMEs updated for new wrappers. - popover provider/close gain props needed by the picker wrappers. Morfo updates: - date-picker / date-range-picker / range-calendar morfos refined for the new APIs (parts, events, ARIA). Audit infrastructure (new): - src/uix/COMPONENT_COMPLETION_CHECKLIST.md — 81 doctrinal rules across morfo / eidos wrapper / recipe CSS / demo / README / cross-layer scripts. Each rule keyed to active_architecture.md, GUIA_IMPLEMENTACION and DEMO_AUTHORING_GUIDE. - scripts/component-audit.ts + `npm run component:audit` — regex parser over all 67 components, emits tmp/component-audit.md with summary scoreboard + per-component findings. Validates against canonical SEMA_FAMILIES / SEMA_VERBS / ARCHETYPE_VOCABULARY / INTENTS. - Initial baseline: 1 PASS, 64 NEEDS-WORK, 2 BROKEN (tooltip, date-range-picker). Top systemic gaps: translations.label (49), README Gaps/Comparativa/Baseline sections (87 combined), keyboard /event ratio under-declaration (15), apg URL absent (19). Misc: - src/uix/kimi-audit-eidos.md — supplementary audit notes. - .gitignore: ignore .codex-* agent scratch artifacts at repo root. - continue.md + READMEs updated through the migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
kind: 'public',
defaultElement: 'div',
optional: false,
uix: date-picker + date-range-picker components + component audit infra Two new Eidos components shipped end-to-end (wrapper + recipe + demo + Soma provider hardening) plus a checklist-driven audit pipeline that scores all 67 morfo components against doctrinal completion criteria. New components: - date-picker: full popover-anchored picker over date-field + calendar, with calendar/content/trigger parts and demo route. - date-range-picker: standalone wrapper with own calendar/grid/segment surface, demo route, and recipe CSS. - Both wrappers follow Option C disciplined (root + parts attached via explicit assignment, no Object.assign). Supporting Soma changes: - range-calendar provider tightened (211 LOC of behavior, 167 LOC of tests), README brought up to component doctrine. - date-field, date-picker, date-range-field, date-range-picker Soma providers + READMEs updated for new wrappers. - popover provider/close gain props needed by the picker wrappers. Morfo updates: - date-picker / date-range-picker / range-calendar morfos refined for the new APIs (parts, events, ARIA). Audit infrastructure (new): - src/uix/COMPONENT_COMPLETION_CHECKLIST.md — 81 doctrinal rules across morfo / eidos wrapper / recipe CSS / demo / README / cross-layer scripts. Each rule keyed to active_architecture.md, GUIA_IMPLEMENTACION and DEMO_AUTHORING_GUIDE. - scripts/component-audit.ts + `npm run component:audit` — regex parser over all 67 components, emits tmp/component-audit.md with summary scoreboard + per-component findings. Validates against canonical SEMA_FAMILIES / SEMA_VERBS / ARCHETYPE_VOCABULARY / INTENTS. - Initial baseline: 1 PASS, 64 NEEDS-WORK, 2 BROKEN (tooltip, date-range-picker). Top systemic gaps: translations.label (49), README Gaps/Comparativa/Baseline sections (87 combined), keyboard /event ratio under-declaration (15), apg URL absent (19). Misc: - src/uix/kimi-audit-eidos.md — supplementary audit notes. - .gitignore: ignore .codex-* agent scratch artifacts at repo root. - continue.md + READMEs updated through the migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
states: ['open', 'closed'],
data: [
{ attr: 'data-state', values: ['open', 'closed'], value: v.stateRef('open') },
{ attr: 'data-disabled', value: v.propRef('disabled'), severity: 'optional' },
{ attr: 'data-readonly', value: v.propRef('readonly'), severity: 'optional' },
{ attr: 'data-required', value: v.propRef('required'), severity: 'optional' },
{ attr: 'data-invalid', value: v.propRef('invalid'), severity: 'optional' }
uix: date-picker + date-range-picker components + component audit infra Two new Eidos components shipped end-to-end (wrapper + recipe + demo + Soma provider hardening) plus a checklist-driven audit pipeline that scores all 67 morfo components against doctrinal completion criteria. New components: - date-picker: full popover-anchored picker over date-field + calendar, with calendar/content/trigger parts and demo route. - date-range-picker: standalone wrapper with own calendar/grid/segment surface, demo route, and recipe CSS. - Both wrappers follow Option C disciplined (root + parts attached via explicit assignment, no Object.assign). Supporting Soma changes: - range-calendar provider tightened (211 LOC of behavior, 167 LOC of tests), README brought up to component doctrine. - date-field, date-picker, date-range-field, date-range-picker Soma providers + READMEs updated for new wrappers. - popover provider/close gain props needed by the picker wrappers. Morfo updates: - date-picker / date-range-picker / range-calendar morfos refined for the new APIs (parts, events, ARIA). Audit infrastructure (new): - src/uix/COMPONENT_COMPLETION_CHECKLIST.md — 81 doctrinal rules across morfo / eidos wrapper / recipe CSS / demo / README / cross-layer scripts. Each rule keyed to active_architecture.md, GUIA_IMPLEMENTACION and DEMO_AUTHORING_GUIDE. - scripts/component-audit.ts + `npm run component:audit` — regex parser over all 67 components, emits tmp/component-audit.md with summary scoreboard + per-component findings. Validates against canonical SEMA_FAMILIES / SEMA_VERBS / ARCHETYPE_VOCABULARY / INTENTS. - Initial baseline: 1 PASS, 64 NEEDS-WORK, 2 BROKEN (tooltip, date-range-picker). Top systemic gaps: translations.label (49), README Gaps/Comparativa/Baseline sections (87 combined), keyboard /event ratio under-declaration (15), apg URL absent (19). Misc: - src/uix/kimi-audit-eidos.md — supplementary audit notes. - .gitignore: ignore .codex-* agent scratch artifacts at repo root. - continue.md + READMEs updated through the migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
],
aria: [
{ attr: 'aria-disabled', value: v.propRef('disabled'), severity: 'optional' },
{ attr: 'aria-readonly', value: v.propRef('readonly'), severity: 'optional' },
{ attr: 'aria-required', value: v.propRef('required'), severity: 'optional' }
]
},
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
{
name: 'Trigger',
kebab: 'trigger',
morfo: catalog `archetype` across 65 components (~265 part declarations) Bulk classification pass that gives every part a cross-component archetype where one applies. Done with `scripts/catalog-archetypes.ts` — a one-shot mechanical mapping based on a kebab → archetype table, plus three manual overrides for components where Provider IS the interactive element. Coverage - 440 part declarations examined. - ~265 received an archetype (provider, trigger, content, overlay, viewport, item, indicator, thumb, track, label, title, description, close, action, header, image, fallback, arrow, separator, group, input, segment). - ~175 left without one — genuinely component-specific (Slider.Range, PinInput.Segment internals, color-picker channel-slider, etc.). Manual overrides (Provider IS the trigger) - Toggle, Switch, Checkbox: their `Provider` part is a `<button>` that the user actually interacts with, not a root container. Archetype set to `'trigger'` instead of the default `'provider'` so eidos can style them alongside Dialog.Trigger / Popover.Trigger / etc. Script (scripts/catalog-archetypes.ts) - Walks every `*.ts` under `src/uix/morfo/components/`. - Inserts `archetype: '...'` directly after the matching `kebab:` line when a mapping exists. - Idempotent — skips parts that already declare an archetype. - Indent-aware — only operates on part kebabs (≥2 tabs), never the morfo root kebab. Bug discovered + fixed mid-pass when radio-group's root kebab `'radio-group'` matched the `'radio-group' → 'group'` alias and inserted at the wrong level (cleaned up by hand). - Reports per-file counts + the list of unmapped kebabs at the end so future passes can extend the mapping. Tests - Updated `omits data-archetype when not declared` test to use a tiny inline morfo (Toggle's Provider now has archetype 'trigger', so it can't be the "no archetype" fixture anymore). Verification - 22/22 runtime tests, full focused suite green. - 66/66 morfo-check (every component still validates against its DOM — archetype is additive, doesn't change emitted attrs apart from the new `data-archetype="..."` which morfo-check doesn't enforce yet). - 68/68 smoke routes. - svelte-check unchanged at 155.
6 months ago
archetype: 'trigger',
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
kind: 'public',
defaultElement: 'button',
role: 'button',
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
optional: false,
states: ['open', 'closed'],
data: [{ attr: 'data-state', values: ['open', 'closed'], value: v.stateRef('open') }],
aria: [
{ attr: 'type', value: v.literal('button') },
{ attr: 'aria-haspopup', value: v.literal('dialog') },
{ attr: 'aria-expanded', value: v.stateRef('open') },
{
attr: 'aria-controls',
value: v.partRef('calendar'),
condition: { when: 'part-present', part: 'calendar' },
severity: 'recommended'
},
{
attr: 'aria-label',
value: v.translationRef('#?components.date-range-picker.trigger|Open range calendar'),
severity: 'recommended'
}
],
keyboard: [
{ key: 'Enter', action: 'open' },
{ key: ' ', action: 'open' }
]
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
},
{
name: 'Calendar',
kebab: 'calendar',
archetype: 'content',
kind: 'public',
defaultElement: 'div',
role: 'dialog',
optional: false,
states: ['open', 'closed'],
data: [
{ attr: 'data-state', values: ['open', 'closed'], value: v.stateRef('open') },
{
/**
* Causal exit reason — mirror of dialog's `data-last-action`.
* Updated by `prewrite` BEFORE `data-state` flips to `closed`,
* so Sema can tint the exit animation per-action.
*/
attr: 'data-last-action',
values: ['range-committed', 'cancelled', 'dismissed', 'dismissed-outside'],
severity: 'optional'
},
{
attr: 'data-starting-style',
severity: 'optional',
condition: { when: 'state-equals', state: 'open', value: 'starting' }
},
{
attr: 'data-ending-style',
severity: 'optional',
condition: { when: 'state-equals', state: 'closed', value: 'ending' }
}
],
aria: [
{
attr: 'aria-label',
value: v.translationRef('#?components.date-range-picker.calendar|Date range calendar'),
severity: 'recommended'
}
],
keyboard: [
{ key: 'Escape', action: 'close' },
{ key: 'Tab', action: 'focus-next' },
{ key: 'Shift+Tab', action: 'focus-prev' }
]
}
refactor(pickers): date/time/date-range pickers consume shared PickerShell Follow-up to commit 714ee373 (PickerShell extraction). Norm N-8 now applied to every composite picker — date-picker, time-picker and date-range-picker stop carrying their own Footer/Clear/Cancel/Close duplicates and read the shared <PickerShell.Footer/Clear/Cancel/Close> through `pickerShellContext`. Soma changes ------------ - date-picker, time-picker, date-range-picker providers each gain a `pickerShellHandle: PickerShellHandle` field exposing `getMode/commit/cancel/clear`, and call `pickerShellContext.set(this.pickerShellHandle)` in the constructor so descendant Eidos shell parts can drive the picker. Morfo changes ------------- - Footer/Clear/Cancel/Close parts removed from each picker morfo. The shared chrome lives outside the per-picker contract — its data attrs are `[data-picker-footer/clear/cancel/close]` (no per-picker prefix). Comment block in each morfo file documents the move. Eidos changes ------------- - Deleted 12 obsolete files: src/uix/eidos/components/date-picker/date-picker-{footer,clear,cancel,close}.svelte src/uix/eidos/components/time-picker/time-picker-{footer,clear,cancel,close}.svelte src/uix/eidos/components/date-range-picker/date-range-picker-{footer,clear,cancel,close}.svelte - Each picker's `index.ts` re-imports the 4 parts from `../picker-shell/picker-shell-{footer,clear,cancel,close}.svelte` so the public namespace stays `X.Footer / X.Clear / X.Cancel / X.Close` — no breaking change for consumers. - Each picker's `types.ts` re-exports `FooterProps/ClearProps/ CancelProps/CloseProps` from `../picker-shell`, replacing the stale per-picker types that referenced soma popover Close props. CSS changes ----------- - Deleted ~190 lines of duplicated footer/clear/cancel/close rules from date-picker.css, time-picker.css, date-range-picker.css. The canonical `[data-picker-footer/clear/cancel/close]` rules in picker-shell.css now style every picker uniformly. - prefers-reduced-motion blocks pruned of the same selectors. Public API ---------- Unchanged from a consumer perspective: `<DatePicker.Footer>`, `<TimePicker.Clear>`, `<DateRangePicker.Close>`, etc. still resolve to working components. The inner DOM markers change from `[data-{x}-picker-footer]` to `[data-picker-footer]` — anyone with custom CSS targeting the old selectors must migrate. Checks ------ - 67/67 component-audit PASS - 40/40 morfo:check PASS - svelte-check 0 errors / 0 warnings Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
// Footer / Clear / Cancel / Close — chrome shared via picker-shell;
// not declared here. Eidos `<DateRangePicker.Footer/Clear/Cancel/
// Close>` re-exports the `<PickerShell.…>` parts.
morfo: port 65 components + sium.lazy + morfo-check passes 66/66 All 65 soma components now consume their morfo as the cross-layer contract. createAttrs(morfo) and registerContract(morfo) overloads removed — the Morfo form is now mandatory. Each component provider has a 3-line morfo import + wire-up block instead of 20+ lines of inline declarations. Additions: sium/core/lazy.ts — lazy() combinator for recursive schemas (unblocks morfo's eventual lazy part-tree validation; tests included). sium/examples/ — booking, color, login, settings, signup, survey, tree form demos. Route demos at src/routes/test/sium/{booking,color,login,settings, signup,survey,tree}. Tooling: morfo-check.ts — now tolerates sibling parts sharing a physical element (Link variant of Item, etc.). Queries via allPartAttrs cross-scope. morfo-vocabulary-check.ts — 28 WARN (legitimate per-component vocabularies or subsets like switch missing "indeterminate"). All reviewed, none are bugs. Fixes caught by morfo-check: table: data-sorted / data-pinned marked severity:'optional' (only emitted when sorting/pinning active, not always). tree-grid: data-expanded on Row severity:'optional' (branches only). menubar: data-menubar-value declared on Trigger. splitter: data-splitter-panel-id declared on Panel. Verify: npm run check — 0 morfo errors (4 pre-existing in sium/examples, unrelated). npx vitest run src/uix/morfo — 7/7 tests pass. npm run smoke — 65/65 routes pass. npm run morfo:check — 66/66 morfos validate against real DOM. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
]
soma/morfo: typed createAttrs + 6 audit batches + form hang fix + A36 ## morfo: typed createAttrs - `types.ts`: all array fields are now `readonly` so morfos can be authored with `as const satisfies Morfo` without casts. - `createAttrs` is a generic `<const M extends MorfoShape>` that infers the emitted attr map from the morfo's literal shape. Typos like `attrs.trigerr` are now compile errors; autocomplete lists every valid part. - All 66 morfos migrated: `export const xMorfo = { ... } as const satisfies Morfo`. - Two latent bugs the new typing caught: `dateRangeFieldAttrs.root` and `timeRangeFieldAttrs.root` — legacy from the root→provider refactor, fixed to `.provider`. - Docs (morfo/README, COMPONENT_GUIDE) mandate `as const satisfies Morfo`; the older `: Morfo` annotation widens literals and loses autocomplete. ## Audit batches 1–7 (soma-audit-2026-04-20) Batch 1 — Keyboard a11y (A14/A12): - Tabs: `isFallbackTabStop(el)` using `untrack` → first trigger gets `tabindex=0` when no tab matches (WCAG 2.1.1 was failing). - RatingGroup: `dir` prop + `getDirectionalKeys(dir, 'horizontal')` for RTL. - Accordion P1-1/P1-6 dismissed: roving/labelledby already correct per APG. Batch 2 — A33 reactive collections: Select `labelRegistry` and NavigationMenu `triggerRefs` migrated to `SvelteMap`. Batch 3 — A31 O(N²) fix: RadioGroup lifts `hasSelection` + `isFallbackTabStop` to the provider with `untrack`-wrapped DOM walk. Per-item derivations drop from O(N²) to O(1) per trigger. Batch 4 — Morfo aria sync: toast / time-field / date-field / tabs / tag-group / navigation-menu declare every aria the provider emits (14 entries across 6 files). Batch 5 — Accessible naming props: Tabs.List, ToggleGroup, TreeView, NavigationMenu expose `aria-label?` / `aria-labelledby?` with explicit "required unless labelledby is set" JSDoc. Batch 6 — A30 cleanup: Checkbox `setLabelId` and 5 trigger-ref providers (select/tooltip/link-preview/dropdown-menu/context-menu) migrated from `$effect(() => parent.ref = opts.ref)` to the `Provider` base's `onRefChange` callback (fires via attachRef inside `untrack`). Batch 7 — A11 wrapper thinning: stepper/tree-view wrappers removed `ctx.get()`, providers expose proxy derivations; time/date-range-field inputs use `untrack(() => …)` for one-shot id registration; menubar content's 40-line keyboard nav moved to `MenubarMenuProvider.onContentKeydown`; color-picker area + channel-slider pointer state machines moved to the providers with `onpointerdown/move/up` emitted via `props`. form-auto-fields deferred with justification (reflective schema renderer, not a state-holding wrapper). ## Form hang fix (A36) `runValidate` entered the `isPromiseLike` branch even for sync schemas because sium's Standard-Schema adapter declares `validate: async`. The fallback `return { errors, issues }` read both reactive vars inside the validation `$effect` while the `.then(...)` microtask wrote them → microtask-mediated loop, silent to Svelte's sync effect-depth guard. Symptom: kitchen-sink hung the tab on mount with onChange / onBlur. Fix: `return untrack(() => ({ errors, issues }))`. Regression locked by two new 5s-timeout tests in `form-auto-fields.svelte.test.ts`. Pattern codified as A36 in COMPONENT_GUIDE; CLAUDE.md count updated to A1–A36 / 39 items. ## Verification - `npm run check`: 0 errors in soma/morfo scope (sema demo pre-existing errors untouched). - `npx vitest run src/uix/soma src/uix/morfo`: all tests green (94 + 7 = 101 tests, inc. 2 new form regression tests). - `npm run smoke`: 65/65 routes. - `npx tsx scripts/morfo-check.ts`: 66/66 morfos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
} as const satisfies Morfo;

Powered by TurnKey Linux.