Skip to content

Drop repaint's dead version-shortcuts slot, and draw a screenshot's controls with the library's offered - #7130

Merged
leaf-agent merged 1 commit into
mainfrom
nightly/runtime-cleanups
Nov 25, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
nightly/runtime-cleanups

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Two cleanups from the nightly survey. Neither changes what a page draws.

  • repaint.js's paintVersionShortcuts slot was dead. The Painters typedef declared it and each frame called p.paintVersionShortcuts?.(), but neither mountRepaint call in browser/leaf.js (live page or export) passes such a painter, and nothing else in browser/ names it. The slot and the call are removed.
  • shot-view.js had its own copy of offered. Its render() defined offered(cls, pressable) as a ref around offerElement, which is what offered in runtime/lib/controls.js already is (elementDirective("offered", offerElement)). The screenshot now imports the library's directive, and its caption uses it too. Lit's ref re-runs a callback that changed, and an inline arrow is new each render, so the copy already wrote on every render, as the directive does; both write through keeps. With the screenshot gone as its only outside importer, offerElement is no longer exported (knip flags it otherwise), and the library header names offer and offered as the forms that mark a field or a box.

The survey also flagged drafts.js importing the framework as ./framework.js, the one backward import #7113 recorded for it; #7119 moves framework.js beside drafts.js and drops that entry, so this PR leaves it alone.

Verified: pre-commit on the changed files (eslint, oxfmt, knip, dependency-cruiser) passes; pnpm run check:browser passes; pnpm run test:runtime passes 1130 of 1130; the screenshot tests test_shot_controls_have_disjoint_targets_and_labels_stay_passive, test_shot_inspects_either_original_without_flipping_or_moving, test_a_shot_takes_a_view_pressed_as_the_page_shows_and_keeps_its_divider and test_a_shot_opens_in_the_view_its_author_names pass. No regression test is added, since no behavior changes.

…ontrols with the library's offered

Two cleanups the nightly survey found, neither changing what a page draws:

- `repaint.js` declared a `paintVersionShortcuts` painter and called it each frame, but no caller of `mountRepaint` passes one (`browser/leaf.js` supplies the live and export painters), so the slot and its call are removed.
- `shot-view.js` built its own `offered(cls, pressable)` as a `ref` around `offerElement`. That is what `offered` in `runtime/lib/controls.js` already is, so the screenshot now imports the library's directive. Both write through `keeps` on every render, since an inline `ref` callback is new on each render. With its one outside caller gone, `offerElement` stops being exported, and the library's header names `offer` and `offered` as the forms that mark a field or box.
@leaf-agent
leaf-agent merged commit b6fe8a3 into main Nov 25, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the nightly/runtime-cleanups branch November 25, 2026 07:05
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.

1 participant