Skip to content

✨ Motion M4: surfaces in the page bud, reshape in place and give way where they stand - #119

Merged
simonhull merged 6 commits into
mainfrom
feat/motion-m4
Nov 19, 2026
Merged

simonhull merged 6 commits into
mainfrom
feat/motion-m4

Conversation

@simonhull

Copy link
Copy Markdown
Owner

Motion milestone M4, "in the page" (plan 071), as approved 2026-11-19: A, Bud, with the first option of every decision 25–35.

What it does

One primitive, web/src/lib/morph/surface.ts, behind every surface in the page. A surface is one box at its true size and radius: while it moves, the engine's own box draws its look (fill, edges, shadow) and the element, clipped to that box, keeps only its words, which never move. At rest nothing of the engine is left.

  • Born at the press. watchPresses notes the control pressed; its place is read on the press only for a control that opens something (aria-haspopup, aria-expanded), one inside a surface, or one marked data-buds. Any other press (Play included) costs a closest and no layout read. A right-click's menu is born at the pointer, a submenu at its item's chevron, a toast and the selection bar at the floor. Bud on --morph-fast (editors on --morph), words @30 (@90).
  • Becoming is Reshape in place. The album ⋯'s Write ReplayGain… is the menu's own box reshaped, starting where the menu was actually drawn (the jump is gone); GainConfirm is now a face of the menu, not a second surface. The same goes for File info, a phone's Add to playlist, Undo's toast, the match sheet's review and its Back (no slide from the left), Export's steps and a merge's new plan. Old words give way as a picture and the new come @140 (@90 on a toast); the box's look (the confirm's fox edge and misprint) turns on the same spring.
  • Leaving is giving way where it stands: card and words as one layer on the exit spring, under whatever opens next. A menu opened again while it gives way takes over from where it had got to.
  • Closing the tag editor or the rules editor lays the page again in front (Morphs.layAgain, choreography laid-again): the editor's picture goes under main, and the page gathers 0.04 around the press.
  • Toasts are born at the floor at their own width, and a second is born in front of the first. Undo turns the toast into what it did, in place ("Brought back Low Tide", "3 songs taken out of Late drives", "Taking ReplayGain out of…" then "Took ReplayGain out of…").
  • The selection bar is born at the floor and its count is re-pressed in place. Rate and More bud from their buttons, and on a phone More becomes Add to playlist's list.
  • No scrims except the folder picker's backdrop, which dims where it stands; the folder picker is no longer a native <dialog> and buds from its button. No sheets on a phone: GainConfirm, Add to playlist, Sort, the merge confirm and the bar's More are the menu or confirm reshaped in place at the phone's width, clear of the island.
  • 4K: Floating and the toasts take the page's 1.25 size step (a 375 px menu and a 525 px confirm at 3840).
  • --curve-settle is gone from every surface, the selection bar and the toasts. Reduced motion: a 120 ms blend, shapes set at once.

Proof

  • web/e2e/surfaces.e2e.ts adds 13 structural tests on a clock slowed almost to a stop: the menu is born at the ⋯ at the ⋯'s size; the confirm is the same element and starts where the menu was drawn; the menu leaves in place; a reopen hands over; a submenu is born at its chevron; a toast is born at the floor and Undo changes it in place; a second toast stands in front; the bar is born at the floor and its count re-pressed; the editor goes under the page while the page's units arrive; the phone confirm stays in place with no scrim; reduced motion; the 4K step. The three phone tests that asserted sheets now assert the reshape, and Trash's Undo test asserts "Brought back".
  • Repeated: surfaces ×20, 240/240; surfaces journeys rooms moment ×10, 680/680; moment alone ×10, 160/160. One earlier run of the combined set lost 2 of 680 to landed timeouts in moment's 3840 tests under 16 workers. They didn't recur alone or in the next combined run.
  • GOWORK=off mise run check: exit 0 (170 e2e).

Perf

The browser suite (web/perf) on this branch and on a git archive of origin/main, with KITSUNE_PERF_PORT=15790. The Go speed tests were left out because no Go changed (main's own run tripped TestStreamFirstByteSpeed on this shared machine). The machine has no GPU and other sessions were running on it, so main itself breaks 6 budgets per full run. Two specs changed, because Undo's toast now stays to say what it did and a leaving toast's picture also has the .toast class: perf/trash.perf.ts and perf/playlists.perf.ts dismiss the toast after Undo and ignore pictures.

Full runs, one each (p95 ms):

Interaction 1k p95 base → branch 50k p95 base → branch Budget
Play a song from the Library 35.9 → 25.8 34.6 → 27.3 45 ms
Play a song from the Library, clicking a cell 40.0 → 27.4 35.2 → 27.0 45 ms
Play a song on its album page 23.5 → 72.0 ✗ 20.3 → 20.5 70 ms
Next 24.9 → 64.2 ✗ 22.4 → 24.5 35 ms
Previous 25.6 → 67.3 ✗ 26.8 → 29.7 45 ms
Star the song playing from the island, on screen 21.5 → 56.9 ✗ 19.4 → 20.2 30 ms
Shuffle on Now playing, press to Up next reordered 16.1 → 16.3 16.2 → 16.3 25 ms
Star a song, on screen 20.3 → 45.8 ✗ 17.3 → 21.6 30 ms
Open an album from the Library 63.8 → 93.6 66.4 → 66.6 120 ms
Library first rows, from page load 187.2 → 121.3 584.7 ✗ → 455.8 500 ms
Longest frame in a 2 s Library fling 33.4 ✗ → 16.8 33.4 ✗ → 16.8 32 ms
Longest frame while the Library sweeps the rail A to Z 33.4 → 16.8 66.8 → 50.1 75 ms
Search, keystroke to results 41.4 → 40.9 49.1 → 52.5 65 ms
Open the columns menu 16.9 → 17.0 17.5 → 17.2 30 ms
Open a song's ⋯ menu 16.4 → 16.4 16.3 → 16.4 25 ms
Move to Trash from a song's ⋯ menu, press to its row folding 19.6 → 33.7 40.6 ✗ → 34.2 36 ms
Shuffle the library, press to sound 23.8 → 23.7 29.4 → 30.1 50 ms
Next, in a shuffle 22.1 → 21.0 18.9 → 19.5 30 ms
Turn the Library's order round, click to rows 37.2 → 20.4 30.4 → 36.4 150 ms
A song ends, the next one sounds 6.8 → 4.0 6.2 → 4.1 12 ms
An album ends, the next down the Library sounds 9.6 → 5.6 8.3 → 5.6 12 ms
Play an album from its cover 30.8 → 26.5 28.5 → 25.1 50 ms
Play an album from its Library cover 32.1 → 26.0 29.9 → 25.8 45 ms
Longest frame while dragging a column across the Library header, 2 s 16.8 → 16.8 16.8 → 16.8 32 ms
Drop a column, release to rows in their new order 24.5 → 25.0 22.4 → 25.8 38 ms
Alt+→ on a column header, key to rows in their new order 33.2 → 35.0 30.1 → 35.9 47 ms
Open an artist with 800 songs from its album, click to Top songs' rows 82.8 → 115.1 97.7 → 97.3 235 ms
All N songs, click to the full list's rows 47.7 → 74.2 52.3 → 57.3 140 ms
An artist's songs, flat to by album, click to rows 57.2 → 97.0 52.9 → 62.3 120 ms
Play a song from an artist's flat list 19.3 → 22.1 19.0 → 21.2 45 ms
Longest frame in a 2 s fling of an artist's 800 songs 16.8 → 16.8 50.0 ✗ → 50.1 ✗ 32 ms
Page load to the restored island, paused 130.5 → 125.0 132.3 → 137.3 180 ms
Play an album from its cover on Home 35.8 → 27.2 31.7 → 69.1 ✗ 42 ms
Pick up where you left off: the Continue card's Play 28.8 → 23.4 27.3 → 26.5 40 ms
Back to Home from Albums, click to its rows 112.6 ✗ → 73.5 94.0 → 79.2 110 ms
Open a playlist of 500 songs from its card, click to its rows 70.0 → 62.6 58.1 → 56.2 90 ms
Add a song to a playlist from its menu, press to the toast 17.5 → 16.5 17.3 → 16.6 26 ms
Open a smart playlist of 500 songs (a text rule over 50k, the 500 least recently played) from its card, click to its rows 57.9 → 55.9 114.7 → 126.6 160 ms
Rules editor: press a star, to the count changed 134.3 → 134.1 147.6 → 134.4 200 ms
Open a file playlist of 500 songs (an .m3u8 at the top of the library) from its card, click to its rows 89.2 → 51.3 74.7 → 53.5 90 ms
Export: press Download on a playlist of 500 songs, to the download starting (the response's first byte) 45.8 → 39.8 44.9 → 40.4 70 ms
Organize: click it on the Server page, to the template's chips painted 39.1 → 34.7 35.2 → 41.5 55 ms
Duplicates: click its tab on Organize, to the first groups painted 51.0 → 48.7 96.8 → 113.2 300 ms
Organize: press Preview over the whole library, to the first album's rows 81.8 → 70.9 781.1 → 768.3 1100 ms

The first full branch run's 1k album block (Play on the album page, Next, Previous, both Stars) and its 50k Home cover play were outliers. None of those touches a surface. The alternating re-runs of those specs below put base and branch in the same band. Each spec runs base, branch, base, branch (p95 ms):

Interaction (alternating re-runs) 1k p95 base ×2 1k p95 branch ×2 50k p95 base ×2 50k p95 branch ×2
Play a song on its album page 40.0, 22.1 23.5, 26.7 21.3, 20.5 21.6, 22.3
Next 24.6, 25.7 21.8, 24.6 20.6, 23.2 22.9, 36.9 ✗
Previous 36.1, 31.7 26.6, 26.9 25.3, 26.7 26.6, 34.3
Star the song playing from the island, on screen 30.2 ✗, 22.0 18.9, 19.0 18.4, 20.1 18.5, 21.8
Shuffle on Now playing, press to Up next reordered 16.0, 16.5 16.3, 16.2 16.3, 16.2 16.3, 16.3
Star a song, on screen 20.6, 20.4 21.2, 18.9 17.0, 17.4 17.0, 20.6
Open an album from the Library 79.3, 66.5 65.1, 74.1 58.0, 63.5 67.3, 57.8
Move to Trash from a song's ⋯ menu, press to its row folding –, – 21.7, 17.9 –, – 41.9 ✗, 39.8 ✗
Play an album from its cover on Home 28.4, 43.3 ✗ 27.0, 44.7 ✗ 27.1, 28.8 27.5, 29.3
Pick up where you left off: the Continue card's Play 25.1, 29.6 24.3, 33.3 23.5, 24.6 24.2, 23.9
Back to Home from Albums, click to its rows 86.9, 85.8 75.5, 82.7 71.9, 72.1 75.5, 141.4 ✗
Open a playlist of 500 songs from its card, click to its rows –, – 53.3, 94.0 ✗ –, – 58.8, 86.1
Add a song to a playlist from its menu, press to the toast –, – 16.0, 16.9 –, – 18.7, 16.9

Trash's fold at 50k is the press that also closes a menu, so it was run twice more on its own, alternating. Base p95 was 35.1 and 28.6, branch 34.6 and 34.3; medians were 22.9 and 22.0 against 22.7 and 25.9. All are within the 36 ms budget. The menu opening (row-menu 16.4 → 16.4, columns-menu 17.0 → 17.2) and the add-to-playlist toast (16.5–16.9 against 17.5) are unchanged: a bud writes its first pose before the first paint and adds no frame.

Screenshots

Every press was caught at 0/12/30/55/110% of its settle: menu, confirm, close, submenu, toast, Undo, bar, count, popover, editor in and out, the phone's confirm and list, and the 4K confirm. They are kept outside the repo, in the session's scratchpad m4build-shots/. The boards' runtime (support.js) isn't on disk, so the build was compared with the boards' documented poses and lengths, not with rendered board frames.

Departures from the boards and decisions made

  • A surface gives way as one layer, card and words together, as the plan says the build does. The boards fade the words a beat after the card.
  • The control a surface came from doesn't unpress on the exit spring, because most controls have no pressed state yet.
  • Undo's words follow the app's toast phrasing: "Brought back X", "N songs taken out of / put back in P". A ReplayGain Undo says "Taking ReplayGain out of…" while its run goes, then what it did, in the same toast.
  • A phone's confirm reshapes to the corner the menu was asked for, pulled clear of the island. The Phone board keeps the menu's top.
  • Closing an editor lays the whole page's units again. For the rules editor that is more than the head and songs.
  • Not on the boards, built with the same verbs:
    • the rules editor
    • the match sheet: its scrim is gone, a press outside closes it, and its motion field is removed
    • the folder picker: a Tab-cycling modal of its own over a still dimming backdrop
    • the merge confirm, in place on a phone too
    • Export and Delete's confirm, with the buttons laid in front again (layInFront)
    • Sort on a phone, now a full-width menu that has lost the sheet's Done row
    • the not-found lines
  • --curve-settle stays in tokens.css for motion outside M4: the hero's growth, the island, the rail's letter, the shuffle card and a column's drop. The 140/180/200/240/260 ms lengths are gone rather than tokenised, because surfaces run on the springs.
  • Closing a tag editor that holds thousands of songs clones it once for its picture, about a frame's work, and only when it closes.

DESIGN.md (motion: Bud verb, "Surfaces in the page (M4)", Open drift) and the plan's Status line are updated in the docs repo, which this PR doesn't touch.

@simonhull
simonhull merged commit 7d68ebf into main Nov 19, 2026
10 checks passed
@simonhull
simonhull deleted the feat/motion-m4 branch November 19, 2026 19:48
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