Skip to content

Render visual review cases and controls with retained Lit templates - #2374

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

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

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Visual review renders its cases and controls synchronously with keyed Lit templates. Ref callbacks configure each shot before connection, and live bindings restore radio groups, sliders and selects when a scope change is refused. The inspector retains its native disclosure node, and case reordering retains the active comment editor, selection and focus.

Survey item 7: lf-visual-review.js changes from 1,001 to 954 lines (47 removed), and from 38,022 to 35,701 bytes. The render reads committed source data; mechanical repainting does not publish another semantic projection. After rejected source data, the error remains until the next valid source commit restores controls and rebinds the reading region and size observations to the new root.

Validation: independent code review and focused visual-review browser journeys, including rejected-source recovery, refused scope, source reorder, opacity keyboard control and inspector navigation. Paired startup and light/dark captures showed no added requests, browser errors or layout shifts.

This was written by Codex on behalf of max-sixty

@max-sixty
max-sixty merged commit e905ef4 into main Oct 11, 2026
6 checks passed
@max-sixty
max-sixty deleted the lit-widget-conversions branch October 11, 2026 07:33
leaf-agent added a commit that referenced this pull request Oct 11, 2026
The visual review journey now reaches its capture-detail assertion and
finishes without repeated keyboard-stop writes. [Main run
38133035955](https://github.com/max-sixty/leaf/actions/runs/38133035955)
failed because #2374's retained template omits the focus-detail row when
a case has no focus area, while the older test expected a hidden row.
Correcting that assertion exposed the run's teardown warning:
reachability briefly returned and re-lent `tabindex` and
`data-lf-lent-reach-stop` on the same shot host while the widget laid
out intermediate boxes.

The test now expects the absent row. The shared reachability painter
coalesces requests at the end of the script that changed layout, so it
lends a keyboard stop from the final box. The visual review journey and
its keyboard-controls companion pass locally, as do the scroller reach
and borrowed-stop tests, the authenticated visual review journey, and
all 342 runtime tests. Prettier and ESLint passed for the modified
runtime module.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 12, 2026
…ts by ref, and repaint only the pairs on an inspection choice (#2527)

Follow-up to the Lit conversion of `lf-visual-review` (#2374), covering
item #35 of the Lit-survey review (that review's numbering, not GitHub
issues) and the part of item #41 that touches this widget's tests.

**#35: cuts left by the conversion.**
- The inspector's radios declare their Enter/Space command with
`commandsOn` in the template, replacing the widget's own path: a cache
of ref callbacks, a `dataset` re-entry check and `commands(radio, …)`.
The radios no longer carry `data-mode`/`data-scope`/`data-scale`; the
one control archetype that selected on `data-mode` now selects on the
radio's `value`.
- Each case entry holds its `lf-shot` and article through the `ref`s the
template binds, so the post-render `querySelector` loop, the six
`shotHost.querySelector("lf-shot")` lookups and the unobserve-on-removal
loop are gone.
- Only the selected case's head, toolbar slot and stage are
size-observed, since hidden cases measure zero; observation moves with
the selection.
- An opacity tick repaints only the inspector and the pairs. A mode,
scope or size choice repaints the inspector, the pairs and the selected
pair's allocation, without re-rendering every case. `#remaining()` runs
once per render rather than once per case (it was quadratic in case
count), and the selected pair gets its allocation alone after the shared
choices instead of a second full inspection.
- A failed source (the `failSoft` view in `#show`) now discards its
cases, and the next good commit rebuilds them with the selection kept.
With entries held by ref, a failure left each entry's article null, and
the next-remaining control threw inside every page-wide key reflection.
- The focus-crop availability test has one home, `#focusAvailable()`,
and `type="button"` is dropped where `offered` already writes it.
- The `data-lf-gen="1" data-lf-said` markers stay as static attributes.
Lit cannot interpolate attribute names without a directive, and #2504
removed `said` so that the static markers are the one documented form.

Behaviour changed: none a reader sees. Enter on an inspector radio now
has a test; that test fails when the command's `run` is emptied.

**#41 (this widget's part).**
`test_visual_review_recovers_from_rejected_cases` no longer exists:
#2487 deleted it when the `visual-run` contract began refusing repeated
case ids, so no data reaches the failure view now. The reorder test
replaces its `node === old` check with what that identity gives the
user: after the reorder, Cmd/Ctrl+Z still undoes the typed draft (the
assertion fails when the editor is swapped for a copy with the same
value). `test_visual_review_ignores_a_late_load_from_detached_evidence`
now replaces the evidence through `data set`, as a new run would,
instead of swapping the `lf-shot` by hand behind Lit, and it now asserts
that the shown pair's box does not move when the detached evidence
finally loads. Its old assertion read the new shot's own image width,
which the old shot could never change; the new one fails when the layout
reads the detached shot's geometry.

**Line deltas**
- Hand-written source: `lf-visual-review.js` 940 → 917 (−23; +93/−116).
- Tests: +23/−27 (−4).

> _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