Repository navigation
Draw lf-timeline as an Effect UI component - #7400
Conversation
The timeline is now an Effect UI component on the widget adapter, and its Lit view module is gone. The step is the Model's; Previous, Next, Home, End, a step row, a mark and a comment's reveal are messages; keeping the step for the tab and saying it aloud are Commands of two new services, KeepInTab and Announce. The ruler's width and font arrive from a stream mount, and the widget's declarations to Leaf (lfCommands, lfParts, its reading's problems) come from a mount on the view's root that re-says lf-layout and lf-commands after each draw that moves the step or layout. Shared changes it needed: - The adapter draws a light widget into a display: contents box after the authored children instead of emptying the element, since Leaf's delivery and revisions put authored children back; the timeline's stylesheet hides the authored lanes while the drawing shows. - widget-services.js imports Leaf's application only as NextOnMe runs, so the adapter loads on a plain page and the timeline stays portable. - controls.js exports offerAttributes and selectableAttributes for views that build their own elements; time-axis.js exports axisTicks for a non-Lit view. - The vendor bundle exports Mount, Stream and Queue (+84 KB unminified). Visible differences: none in the stills beyond subpixel text rendering in the step list. Behavioral: a reveal from a comment steps the timeline a fiber turn later instead of synchronously. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
leaf-agent
left a comment
There was a problem hiding this comment.
The NextOnMe dynamic import keeps the timeline loading on a plain page, but the rule it serves is stated for that one service, and the sibling ports add services to the same module that break it. #7395 adds import { navigateToDatum, obligationActions } from "./host/application.js" to widget-services.js, and #7399 adds static imports of host/application.js, records/thread/held-news.js and records/thread/state.js. Whichever of those lands after this one turns tests/smoke/test_plain_page.py red for lf-timeline again. CI will catch it, but the widget-services.js header could state the rule for the whole module (it loads in any document, so a service that needs Leaf imports it as it runs), so the next service follows it without rediscovering it.
The module loads in any document, so every service that needs Leaf's host, records or another module reading what Leaf composes imports it dynamically as it runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
time-axis.js now gives its ticks and gridlines as renderer-neutral marks (axisMarks), which timeAxis draws with Lit and lf-timeline draws with Effect UI, so the axis's class names stay in the library and out of the package. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
<!-- claude-projects-attribution: {"github_login":"max-sixty"} -->
_Requested by **Maximilian** · [project
thread](https://claude.ai/code/project/chan_01HAT2svakg1fTA5kitqhX9w?thread=cmsg_01HAT2svakg1fTA5kitqhX9wAWrHoDSUn5ogNyh9ijmSrr)_
Ports `lf-motion` from Lit to an Effect UI component and deletes
`motion-view.js`.
**Design.** A decorating widget (`shadow: true`): the transport draws in
the shadow root and a `<slot>` shows the authored previews. The Model
holds the clock (time, speed, playing) and what the page reports
(reduced motion, whether recordings stand in the study, a refused
playback, a frame that threw). `renderFrame` is a prop. Post-commit DOM
work is two mounts: `DriveStudy` on the slot draws the frame at the
clock's time and seeks, plays, pauses and reads the videos (its own rAF
loop while recordings play); `OfferPlay` on the button draws its symbol
and declares the Play command. An `onAnimationFrame` subscription runs
the illustration clock; window blur and tab hiding are subscriptions;
input inside the previews is heard on the slot. The clock's resting time
and speed go to the tab store through a new `KeepInTab` command.
**Shared modules (kept small):**
- `effect-widget.js`: `properties` (element properties that are props,
as `BrowserHost.defineElement`'s are) and `members` (element properties
over the Model: `get` reads it, `set` sends a message). These carry
`renderFrame` and `currentTime`. A property the page set before the tag
was defined is taken at upgrade, so either module may load first.
- Effect UI vendor entry adds `HtmlSubscription`. (`KeepInTab`, the lazy
`application.js` import, the `offerAttributes` export and
`Mount`/`Queue`/`Stream` came with #7400.)
**Styling.** The transport is styled with `lf-motion::part(...)` in
`defaults.css`, so it looks the same off Leaf (`portable.css` holds
package defaults, and shadow trees get no styles there). `lf-motion`
sets `--lf-reading-face: inherit`, because a declared shadow root resets
the reading face on `:host`, which would strip the page's look from the
slotted previews.
**Differences:**
- Stills for `motion-controls` (default, phone, dark) and
`playground-inline-end` are pixel-identical (0 px). The only style diff
is the transport moving from a light-DOM `div.lf-motion-transport` into
the shadow root as `div.lf-motion-study`.
- A failing frame's box stands in the shadow root, under the transport,
rather than as a light-DOM child. The Play label may read Pause for one
microtask flush before a first frame that throws turns it back.
- If a study is detached mid-play and put back, it resumes at the last
resting time the tab kept (pause, seek, speed), not where it was
detached. `currentTime` on a detached study still reads where it
stopped.
- `lf-inspect` pauses the study from anywhere inside it. User input
pauses it only inside the previews, as before.
- The element's `duration` getter is gone (nothing used it).
**Tests.** New `tests/runtime/lf-motion-story.test.mjs` covers `update`
(clock, end, interruption, seek and clamp, recordings' clock, nothing to
play, draw failure, reduced motion). Browser tests: the failure box
locator and the first-paint check now read the shadow root, and the
revision test drops its light-DOM-transport assertion. Passing locally:
`tests/browser/widgets/test_motion.py`,
`tests/journeys/widgets/test_motion.py`,
`tests/smoke/test_plain_page.py`, `pnpm run check`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
> _This was written by Claude Code on behalf of max-sixty_
---
_Generated by [Claude Code](https://claude.ai/code)_
---------
Co-authored-by: Claude <[email protected]>
`leaf-dev interface --base` now reports the names the Effect UI ports made available to packages. Before this change it read functions from `widget-api.js` and `portable-api.js` alone, so it reported nothing for them. Run on each port's own commit against its parent, it now reports additions for every one of #7374, #7378, #7397, #7399, #7400 and #7395. For example, against the commit before #7374 it lists `/runtime/effect-widget.js`, `/runtime/widget-services.js` and `/vendor/effect-ui.js` as modules, `defineWidget`, `widgetProps` and the eight `widget-services.js` exports as functions, and Effect UI's 16 exports. The census now reads every module `$public-modules` lists outside the library, with each module's exports, including the vendored ones. It also reads every mark any reference gives, which adds 21 documented marks it missed, such as `data-lf-focus-visible`, and the chrome parts `package-themes.md` lists. Root `AGENTS.md`'s "Keep the package interface small" now names the public modules and their exports as part of the interface, and the references that gave Lit as the only way to follow a page reading, or `widget-api.js` as the only module to import, now name the Effect UI forms too. What the move to Effect UI keeps and retires is left to the guidance change that states Max's call on it. To weigh: a vendored module's exports count as names, so a Lit bump that adds an export shows as an addition. A widget's own `part` names are its package's, so the census doesn't count them. A function's options count as part of that function, so `--base` doesn't list them. Asked for by Max from the parts-column-scroll page and in the session. Codex reviewed five rounds. Tests: `dev/tests/model/test_interface.py`, `tests/runtime/widget-api.test.mjs`. Evals: `widget-controller-lifetime` and `widget-ratings-recorded-by-leaf`, 12/12 on both arms. > _This was written by Claude Code on behalf of max-sixty_
Requested by Maximilian · project thread
This PR ports
lf-timelinefrom a Lit view to an Effect UI component on the widget adapter, and deletestimeline-view.js.The widget
aria-label, and the step time the tab kept. Runs, lanes and events refer to one another by index, so the reading compares by value.PressedStepControlfor Previous, Next, Home and End, which are said aloud;PickedStepfor a row or a mark;RevealedEventfor following a comment; andMeasuredRuler.widget-services.js,KeepInTab(tabStore.set) andAnnounce(lf-announce).MeasureRulerreports the ruler's size through a size observer, and again when fonts load or the print media changes.OfferSymboldraws the action's symbol on Previous and Next throughofferActionElement.DeclareTimelinesetslfCommandsandlfPartson the element and reports the reading's problems aserrors. After each draw that moves the step or the layout, it dispatcheslf-layoutandlf-commandsagain.Shared modules
effect-widget.js: a light (non-shadow) widget now draws into adisplay: contentsbox after the element's authored children, not into the element itself. Effect UI empties the container it mounts into, and Leaf's delivery and revisions put the authored children back beside the drawing, so the lanes showed twice. The timeline's stylesheet now hides its authored lanes while the drawing shows (lf-timeline:has(.lf-timeline-view) > …), in place of the JShiddenattribute. No other widget used the light mode.widget-services.js: its header states the rule for the whole module. The module loads in any document, so a service that needs Leaf's host or records imports them dynamically as it runs.NextOnMenow does this, so the adapter loads on a page without Leaf and the timeline stays portable (tests/smoke/test_plain_page.py).lib/controls.js: exportsofferAttributesand a newselectableAttributes. They are the attribute forms ofofferedandselectableOffered, for a view that builds its own elements.lib/time-axis.js: gives its ticks and gridlines as marks that any renderer draws (axisMarks).timeAxisnow draws those marks with Lit forlf-traceand the playwright timeline, and the timeline draws them with Effect UI. The axis's class names stay in the library.effect-ui.jsnow exportsMount,StreamandQueue, which adds about 84 KB.Differences
leaf-dev stills --base origin/mainontimeline-steps,timeline-step-listandauthored-timeline-keyboarddiffers only in subpixel text rendering on the first step row: about 550 px of antialiasing, with no change in layout or ink. The DOM path also gains the new box element.lfParts.reveal), Home and End now step the timeline after a fiber turn rather than synchronously inside the call. Every event is drawn at every step, so the part a reveal names is always present.Checks
pnpm run checkandpnpm run test:runtime(1185 pass).tests/runtime/lf-timeline.test.mjs, which mounts the drawing in happy-dom, andlf-timeline-story.test.mjs, which testsupdateas a Story.tests/browser/widgets/test_timeline.py, in Chromium and Firefox.tests/smoke/test_plain_page.py.test_render_anchors.py.NextOnMechange.🤖 Generated with Claude Code
https://claude.ai/code/session_01V22NWd3erndyoj2G9LEP7y
Generated by Claude Code