fix(morfo): checkbox commit events sequence pre -> post (kills 244ms check lag)

The REAL cause of the slow checkbox (not the stroke duration). The checkbox provider
flips its checked state inside the trigger HANDLER, and the morfo declared the commit
events with sequence: 'pre' — so the runtime ran `await runEmit()` BEFORE the handler.
emit() awaits the visual-channel hold (~240ms), so the functional state change (and
thus data-state) waited the full perceptual hold before flipping. Measured: click ->
data-state='checked' took 244ms.

Fix: commit-toggle-check / commit-toggle-uncheck -> sequence: 'post' (handler runs
FIRST, state flips immediately, the celebratory pulse emits after). This is the
doctrine for control commits (runtime.svelte.ts §577: "toggle's commit-toggle... the
pulse arrives AFTER the state has flipped"). Toggle + Switch were already 'post';
checkbox was the outlier. Measured after: 244ms -> 46ms.

Verified the siblings are NOT affected: radio-group (47ms) and tabs (31ms) are also
'pre' but flip state in the call-site (not the handler), so no lag — left unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
active-uix
dev 4 months ago
parent e6fd014d43
commit cd8343849d

@ -22,7 +22,10 @@ export const checkboxMorfo = {
verb: 'toggle', verb: 'toggle',
target: v.partRef('provider'), target: v.partRef('provider'),
intent: 'affirm', intent: 'affirm',
sequence: 'pre' // 'post': flip the checked state FIRST (data-state updates
// immediately), then emit the celebratory pulse. 'pre' made the
// functional check wait for the perceptual hold (~240ms) → laggy.
sequence: 'post'
} }
}, },
{ {
@ -37,7 +40,7 @@ export const checkboxMorfo = {
verb: 'toggle', verb: 'toggle',
target: v.partRef('provider'), target: v.partRef('provider'),
intent: 'neutral', intent: 'neutral',
sequence: 'pre' sequence: 'post'
} }
} }
], ],

Loading…
Cancel
Save

Powered by TurnKey Linux.