Collapsible tree view working. separating out ClickOnly events for non-focusable stateful components

This commit is contained in:
Dustin Swan 2026-02-15 11:13:07 -07:00
parent fec18486d8
commit 69407cd25b
No known key found for this signature in database
GPG key ID: 30D46587E2100467
3 changed files with 43 additions and 20 deletions

View file

@ -93,15 +93,13 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
}
const viewResult = instance.view(instance.state);
let viewUI = viewResult;
if (ui.focusable) {
viewUI = {
kind: 'clickable',
child: viewUI,
onClick: (coords: any) => ({ _tag: 'FocusAndClick', _0: fullKey, _1: coords })
};
}
const viewUI = {
kind: 'clickable',
child: viewResult,
onClick: ui.focusable
? (coords: any) => ({ _tag: 'FocusAndClick', _0: fullKey, _1: coords })
: (coords: any) => ({ _tag: 'ClickOnly', _0: fullKey, _1: coords })
};
return expandStateful(viewUI, [...path, ui.key], renderedKeys);
}
@ -191,6 +189,13 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
return;
}
if (event._tag === 'ClickOnly') {
const componentKey = event._0;
const coords = event._1;
handleComponentEvent(componentKey, { _tag: 'Clicked', _0: coords });
return;
}
if (event._tag === 'Rebind') {
store.rebind(event._0, event._1, event._2);
return;