diff --git a/src/uix/morfo/components/tree-view.ts b/src/uix/morfo/components/tree-view.ts index ce3a4ec63..ff0941f37 100644 --- a/src/uix/morfo/components/tree-view.ts +++ b/src/uix/morfo/components/tree-view.ts @@ -32,22 +32,28 @@ export const treeViewMorfo = { // sección desplegable)." Tree expand fits exactly. Was // misclassified as `shift.navigate` (which is for context/regime // change, not content revealing). + // + // Target is `branch` (not `item`): items are leaves — they + // don't expand. The data-event-* stamp lands on the branch + // element (`data-tree-view-branch`), which is what the sema + // pack selector targets. name: 'emerge-expand', semantic: { family: 'emerge', verb: 'expand', - target: v.partRef('item'), + target: v.partRef('branch'), sequence: 'post' } }, { // Collapse a node — per book cap. 26: "emerge.collapse — una - // región se contrae." + // región se contrae." Target is `branch` for the same reason + // as emerge-expand above. name: 'emerge-collapse', semantic: { family: 'emerge', verb: 'collapse', - target: v.partRef('item'), + target: v.partRef('branch'), sequence: 'post' } } diff --git a/src/uix/sema/components/tree-view.ts b/src/uix/sema/components/tree-view.ts index b56e5b82b..7dedaf779 100644 --- a/src/uix/sema/components/tree-view.ts +++ b/src/uix/sema/components/tree-view.ts @@ -6,10 +6,12 @@ import type { Sema } from '../sema-map'; /** * TreeView perceptual defaults — SOFT EMERGE + COMMIT. * - * TreeView has three event surfaces, all targeting the `item` part: - * - `commit-select` (commit.select, affirm) — leaf or branch selected - * - `emerge-expand` (emerge.expand) — branch reveals children - * - `emerge-collapse` (emerge.collapse) — branch hides children + * TreeView has three event surfaces: + * - `commit-select` on `item` — leaf or branch selected (affirm intent + * via family deltas). Item part covers both leaves and branches + * from the selection standpoint. + * - `emerge-expand` on `branch` — branch reveals children. + * - `emerge-collapse` on `branch` — branch hides children. * * Strategy (book cap. 22 §10 + cap. 26 emerge open/close discipline): * - EXPAND: `emerge.soft` (gain 0.08) — content reveals, ascending @@ -21,15 +23,14 @@ import type { Sema } from '../sema-map'; * content surfaces elsewhere), and the select chime mustn't * compete with that downstream signal. * - * Note on target: morfo declares all three events targeting `item` - * (leaves). Branches also have role="treeitem" but a different part - * marker (`data-tree-view-branch`). If branches end up emitting at - * runtime without the `data-tree-view-item` marker, this cascade will - * miss them — a known concern noted in the morfo declaration audit. - * The pack follows the morfo declaration verbatim; any mismatch is a - * morfo-level fix outside this pack's scope. + * Target split: expand/collapse target `branch` because items are + * leaves — they don't expand. The DOM marker on a branch is + * `data-tree-view-branch`, distinct from `data-tree-view-item`. The + * selectors below honour that split. */ +const onBranch = (matchers?: Parameters>[2]) => + semaSelector(treeViewMorfo, 'branch', matchers); const onItem = (matchers?: Parameters>[2]) => semaSelector(treeViewMorfo, 'item', matchers); @@ -37,11 +38,11 @@ export const treeViewSema: Sema = { name: 'tree-view', cascade: [ { - selector: onItem({ eventName: 'emerge-expand' }), + selector: onBranch({ eventName: 'emerge-expand' }), sound: soundTuning('emerge.soft') }, { - selector: onItem({ eventName: 'emerge-collapse' }), + selector: onBranch({ eventName: 'emerge-collapse' }), sound: soundTuning('emerge.exit.soft') }, {