Skip to content

Render trace controls and saved evidence with retained Lit templates - #2346

Merged
max-sixty merged 7 commits into
mainfrom
lit-widget-conversions
Oct 11, 2026
Merged

max-sixty merged 7 commits into
mainfrom
lit-widget-conversions

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The trace widget renders its controls, moments and saved-tree rows through one synchronous Lit view. Keyed templates replace the manual tree and bookmark node caches. Vis Timeline pins, Viewer.js figures and image zoom retain their existing owners; saved-tree navigation restores the reading place even when rows are recreated.

Survey item 8, measured after integrating authored-Moment entry-point selection and canonical vendor imports: lf-trace.js changes from 1,947 to 1,958 lines (11 added), while its size falls from 76,651 to 75,171 bytes. The conversion removes competing DOM ownership and manual tree/bookmark caches rather than reducing the line count.

Validation: independent code review and integration review; initial authored-Moment selection, exact bookmark and playback-gap/scope journeys passed. A paired browser probe retained a 369-pixel saved-tree reading place and the same native disclosure node through navigation; mouse selection, frame toggles and stepping passed. The refreshed startup probe loaded the same 248 code requests with 1,271 fewer code bytes, matching initial selection and no errors. A dark 390-pixel touch viewport had no horizontal overflow.

This was written by Codex on behalf of max-sixty

@max-sixty
max-sixty merged commit 57e2f7e into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the lit-widget-conversions branch October 11, 2026 04:44
max-sixty added a commit that referenced this pull request Oct 12, 2026
…puts (#2514)

Follow-up to #2346, from the review of the Lit survey PRs (item 36 in
that review's numbering, not a GitHub issue). It finishes the Lit
conversion of `lf-trace`, whose lifecycle already moved to
`whileConnected`/`frameFor` in #2503.

## Review item 36: `lf-trace` reads its Lit nodes through refs

- **Selector table removed.** After each render, a 22-entry table
queried the Lit output and stored nodes as public element properties
(`trace.play`, `trace.next`, `trace.body`, ...). The template now binds
each node the widget reads to a private `createRef()`. No test, widget
or tool outside the widget read those properties. Only the table read
the six transport classes `lf-trace-first`, `-previous`, `-next`,
`-zoom-in`, `-zoom-out` and `-zoom-fit`, so they are gone from the
markup.
- **`#viewState()` removed.** It built a bag of eleven values that
`#paint()` then unpacked. `#paint` now reads scope, extent, choices,
origin and moments itself. `#draw` passes only the selected point, its
saved tree and the tree rows, which it also uses for projection.
- **Other lookups after render.** The missing-image note, input badge
and point, and playback image are private fields. One helper now builds
the playback image, which `#placePlayback` used to build a second time.
Each capture figure keeps its canvas, image and status nodes, so
`#drawPicture` no longer queries the figure by class. Three
`images.find` calls now use `#imageById`. A Moment that targets a saved
element finds its row in the part inventory instead of through a
`data-lf-datum` query.
- **Hand-written labels.** The position, selection and image-zoom labels
are still written directly. A comment on `#drawTime` now says why: they
change on every playback frame or pinch step, and `#draw` re-renders and
re-projects.
- **Resize.** The window `resize` listener the review saw beside the
ResizeObserver was already removed in #2429, so the observer is the only
thing that calls `#resize`.

Behaviour that changed: none visible to the user.

| | hand-written source | tests |
|---|---|---|
| Item 36 (`lf-trace.js`) | −20 (+210 −230) | 0 |

## Validation

- These cases in `tests/test_render_playwright_trace.py` pass: comments
restoring an exact image, bookmarks, comparison pairing, transport and
playback, inspection through playback gaps and scope changes (it
includes the saved-tree place checks), zoom and pan, the hidden
recording, capture replacement, frames keeping saved elements, the play
press, images at their capture times, and idle presentation.
- Prettier and eslint pass.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants