mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-16 03:09:33 +01:00
The Director's cut rebuilt the whole wire with replaceChildren on every refresh (every 4 s poll and SSE burst of a running turn), so it never followed new events and a rebuild could throw the reader's place, focus and hover away. Rows are now keyed by event id and headings by the row they head (a panel that changes kind or number as the turn grows keeps its heading node). Unchanged nodes are reused, a changed row is patched in place (a running tag flips to its result on the same node), new rows are inserted in order with a short transform and opacity entrance, and a new turn replaces the list. _storyEventRow still builds every row. While the wire follows, it glides to the newest row with a critically damped spring on animation frames: a burst of updates moves the target and the glide keeps its speed, so there is no stop and restart. Measured against the browser's own smooth scrollTo on a growing transcript, the spring moved a median 8 px a frame over ~25 frames with no stalls, while scrollTo snapped at ~41 px a frame over ~10 frames and its read of the new scrollHeight forced a layout inside the update (a 57 ms long task). Scrolling up by hand (wheel, touch, scroll keys, the scrollbar) stops following and shows a pill that counts the rows that came in since; clicking it, or scrolling back to the bottom, follows again. The glide only moves down and is never read as the reader scrolling up. A running newest turn, and the Director's cut turned on during one, open at the bottom, following; a finished turn opens at the top. Under prefers-reduced-motion there is no entrance and the list jumps. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>