Repository navigation
feat(core): one progress module for the motion foundation - #9755
Conversation
progressCurve, mapProgress, mapRange and presentedProgressVelocity in motion/progress.ts, internal, one velocity unit (progress per second). Rebuilt on main from the pull request's own change, without the open dependency chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Requesting changes: the module looks correct, and its 12 tests, tsc and ESLint pass, but it adds a second copy of math the motion folder already has.
Blocking
progressCurve(progress.ts:56–70) duplicates the privatespringProgressinanimatedLayout.ts:144–151(same solve, same 0.001 settle epsilon, same exact landing, identical output), so please buildspringProgressonprogressCurveor replace it, leaving one implementation.
Non-blocking
- The file header (
progress.ts:3–39) runs well past the roughly 12-line header limit and repeats themapProgressandpresentedProgressVelocityJSDoc; trimming it to@file,@input,@output,@positionandSYNC:would fix both. - The
STEPcomment (progress.ts:49) restates the name, andmapProgresssteps the driver's own units rather than a progress, so a clearer name such asFINITE_DIFFERENCE_STEPcan replace it.
[Automated review]
| epsilon = SETTLING_EPSILON, | ||
| }: {velocity?: number; epsilon?: number} = {}, | ||
| ): MotionCurve { | ||
| const curve = solveSpring(toSpring(spring), {from: 0, to: 1, velocity}); |
There was a problem hiding this comment.
This is the same construction as the private springProgress in packages/core/src/motion/animatedLayout.ts:144–151 (unit move, settleTime(0.001), exact landing); for the settle spring and three others the two agree bit for bit. Please build springProgress on progressCurve (durationMs = Math.max(1, progress.duration * 1000), remaining = t => 1 - progress.at(t / 1000)) or replace it, so one implementation remains.
| type SpringDescription, | ||
| } from './spring'; | ||
|
|
||
| /** The step of the finite differences taken on a progress. */ |
There was a problem hiding this comment.
Non-blocking: the comment restates the name, and mapProgress takes this step on the driver's own value (px for a sheet's y), not on a progress. Suggest renaming to FINITE_DIFFERENCE_STEP and dropping the comment.
| * An interrupted motion continues from what is on screen: the | ||
| * block reads the presented values and velocities from the animator at one | ||
| * `now` (`get`, `getVelocity`), restarts a path from those values, and starts | ||
| * its progress with the presented velocity projected on the path's tangent | ||
| * at its start, v·t / (t·t), where t = d(values)/dp. Channels are weighted | ||
| * into one unit first (px per unit of scale, say), so a scale and a | ||
| * translation count alike. | ||
| * | ||
| * A companion follows a driving curve through `mapProgress`, most often | ||
| * with `mapRange`: `mapProgress(sheetY, mapRange([closedY, openY], [0, dim]))` | ||
| * dims a scrim as a sheet rises. Played on another animator, it stays in | ||
| * lockstep only when it starts with its driver: pass the driver's start, | ||
| * `scrim.play({opacity}, {at: start})` with `start = await handle.started` | ||
| * (or one shared `at` for both calls); two calls from rest otherwise each | ||
| * start at their own commit. |
There was a problem hiding this comment.
Non-blocking: these paragraphs take the header to 37 lines (the convention is about 12) and repeat the JSDoc of presentedProgressVelocity and mapProgress. Suggest keeping @file, @input, @output, @position and SYNC:, and moving the lockstep sentence into the mapProgress JSDoc.
…ressCurve CodeBunny on #9755: springProgress solved the same spring as progressCurve. It now reads progressCurve (remaining = 1 - progress), so one implementation remains. Same curve, same settle epsilon (0.001) and duration.
There was a problem hiding this comment.
Recommending approval: springProgress in animatedLayout.ts now reads progressCurve, so one spring-progress implementation remains, and the glide's curve is unchanged (same duration, every frame within 1.1e-16 of the move).
Non-blocking
- The
progress.tsfile header (lines 3–39) still runs well past the roughly 12-line header limit and repeats themapProgressandpresentedProgressVelocityJSDoc; trimming it to@file,@input,@output,@positionandSYNC:would fix both. - The
STEPcomment (progress.ts:49) restates the name and describes a step on a progress, whilemapProgresssteps the driver's own units; a name such asFINITE_DIFFERENCE_STEPcan replace it.
[Automated review]
…#8080) * feat(core): one progress module for the motion foundation progressCurve, mapProgress, mapRange and presentedProgressVelocity in motion/progress.ts, internal, one velocity unit (progress per second). Rebuilt on main from the pull request's own change, without the open dependency chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]> * refactor(animatedLayout): take the settle spring's progress from progressCurve CodeBunny on #9755: springProgress solved the same spring as progressCurve. It now reads progressCurve (remaining = 1 - progress), so one implementation remains. Same curve, same settle epsilon (0.001) and duration. * feat(core): the rect morph's paths, the rect a grow-out presentation shows at each progress lerpPath, edgeGrowPath, each path's restartFrom and morphCurves in motion/morphPath.ts, internal. Pure geometry over a progress curve: the caller chooses the timing. Rebuilt on the progress module from the pull request's own change, without the open chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]> * Merge remote-tracking branch 'origin/main' into motion/morph-path # Conflicts: # packages/core/src/motion/README.md * feat(core): one rect morph for touch presentations that grow out of a source rect createRectMorph in motion/rectMorph.ts, internal: present along a path and dismiss back onto a copy or the element, each continuing the other from the rect on screen. Rebuilt on main from the pull request's own change and ported to main's engine (createMotionAnimator). Timing follows the owner's rule for touch motion: present and dismiss take a motion, either a theme duration and easing (a tap, a key, the program) or a spring (a gesture's release, from its velocity). timedProgressCurve joins the progress helpers. architecture:react-component-runtime INV12 records the implementation gap: the size-change glide moves onto the morph next. Co-authored-by: Cindy Zhang <[email protected]> * feat(TextInput, TextArea, NumberInput): fields stay above the keyboard Each passes its input to `useMobileKeyboard` from its own render, with no prop and no Effect of its own. On focus the field decides where it is: inside a keyboard target such as a Tall BottomSheet it moves nothing; in an app's bar docked at the viewport's bottom, the bar rides the keyboard, its bottom on the keyboard's top; in scrolling content, its nearest scroller, the document included, scrolls it 10 px above the keyboard in the keyboard's report. In a fixed container the app positions itself, a scroller around the field reveals it, and with none the browser's own reveal stays. Its first tap and focus moves into it arrive without the browser's reveal where the module places the field, so the page never pans there. A scroll area does not gain the range it lacks at its end yet. Where a field's scroll area cannot place it, the document reveals it, in the page and in a fixed container where the document's scroll moves the container, as in Safari while its keyboard shows; elsewhere Core scrolls the document back. Where the document cannot scroll far enough, as at a short page's end in Chrome, a pan of the visual viewport takes the rest in the same frame (`panVisualViewportTo`): a probe fixed in the layout viewport is scrolled into view, as the reveal-pan watch puts a pan back. The watch takes Core's own pan as the new rest. Firefox for Android does not pan for the probe. A page with nothing to scroll keeps the browser's own reveal. On Chrome's show, a docked bar first sets its field 4 px above the keyboard's top at once, as the Tall sheet does, and only the rest rides, so Chrome's own pan finds the field clear. Every viewport report now feeds the ride's reveal-pan watch, so a pan Chrome still makes is put back, and a pan made at one keyboard height goes back at the next. Under Remove animations, Gboard first reports a keyboard 48 px tall, and Chrome may then reveal the bar's field itself: it scrolls the page behind the bar, then pans. In Chrome, the ride's watch scrolls the document back as well, when the scroll and the pan centre the field as Chrome's reveal does; the app's own scroll to another element stays. On iOS, a reveal that places the field rises on the browser's smooth scroll from the keyboard's first report, which comes as the keyboard starts to slide, so the field rises beside it (`risesSmoothly`, which reads Core's iOS WebKit check, `isIosWebKit`). The scroll back records where the rise is headed, and a rise still on its way when the keyboard changes height carries on from its target. Under Reduce Motion, in a theme that reduces motion for everyone, and in Chrome, which checks the field in the resize's own commit, the reveal moves at once. The rise and the scroll back ask the motion module's new `reducesMotion`, beside `reducedMotionFade`, which now uses it, so a theme that reduces motion for everyone counts as the setting for both. A scroll area's reveal goes through its own `scrollBy` with an explicit behavior where it has one, so a smooth `scroll-behavior` on the area cannot slow an instant reveal, as the Tall sheet's reveal already does. When the keyboard closes, each scroller a reveal moved scrolls back to where it was (keyboardScrollBack.ts), on the browser's smooth scroll. Safari on iOS reports the keyboard gone about half a second after the blur that closes it, once it is down. There the scroll back starts at that blur, once the focus change settles on nothing that brings up a keyboard with no finger on the screen, and slides down beside the keyboard; the report only confirms it. A finger then can be a tap that brings the keyboard back, so the report decides, as elsewhere and under Reduce Motion, where the scroll lands at once. Safari applies a scripted scroll a frame late, so a scroll set each frame jitters. A scroller the person scrolled meanwhile keeps their scroll. A field that gains focus during the slide stops the scroll back where the page is (`stopKeyboardScrollBack`), and its reveal goes on from there as Core's own scroll. A sandbox page puts three fields in the middle of a page that scrolls the document. Each field's `.keyboard.test.tsx` drives the keyboard module's test double. Mobile keyboard stories on TextInput place the fields low in the page, a TextInput in a toolbar fixed at the bottom (docked, floating above the edge, or with its own `translate`), a last field at the end of a short page and of a scroll area, a scroll area low on the page, a scroll area in a floating panel and in a full-viewport panel, and a field in a sheet of a set height. Firefox for Android can carry the reveal's document scroll as a visual-viewport offset, show the document where it was before the reveal at the keyboard's hide report, and turn the offset back into a document scroll only after it. The scroll back then waits up to a second for the first document scroll: one that lands where Core left the document is the browser's own, and the scroll back follows it. A touch, a keyboard that comes back, the field's page going, or the wait's end puts nothing back. The reveal-pan watch's touch flag now holds through a report that comes while a finger is on the screen. In Firefox the toolbar hides in a drag, which changes the measured keyboard height mid-drag; the watch then took the drag's own pan for the browser's and put it back. The input stream now counts the fingers on the screen from touch events (`isTouchOnScreen`), only while `touchend` and `touchcancel` are heard. A native pan keeps a finger there, though its `pointercancel` drops the press from `getDownPresses`, so that record cannot serve. The watch's shared touch subscription hears those two types, and a report reads the count. After the show's first reveal, a keyboard report reveals nothing while a press that started after the last reveal is down. In Firefox the toolbar hides in a drag, and the reveal re-applied itself with small scrolls under the person's finger. The report's height is kept, so the field stays where the person put it, and a later report with the finger up reveals it as before. The press that focused the field holds nothing: a long press focuses with the finger still down, and Gboard can report a 48 px keyboard first, then its full height. The input stream also counts the touches that start (`getTouchStartCount`), and each reveal notes that count. The keyboard module reads the finger count through `isFingerOnScreen`: a finger down at the keyboard's last hide counts no more until a touch starts, since a touch whose target leaves the page ends at a node the window never hears. The count includes a stylus, whose drag moves the page as a finger does. Nine unit tests cover the scroll back from the blur on iOS: it starts at the blur and the report moves nothing more; focus that moves on to another field or into a frame keeps the page; a finger on the screen at the blur leaves it to the report; a person's scroll stands; Reduce Motion waits for the report; a field focused again during the slide stops the scroll back and rises from where the page is, or stays where a touch stopped it with nothing left to raise; and the next close goes back to the first place, at a blur or at a report. Six unit tests cover the scroll back: the page's smooth scroll at the report (nothing before it), Reduce Motion, a theme that reduces motion, a person's scroll kept, a scroll area after Back, and a focus move to another field. Firefox-shaped cases carry the reveal as an offset and close the keyboard before the fold: the scroll back follows the fold, a touch-drag control keeps the page, only the first document scroll counts, and each way the wait ends leaves no scroll listener. Safari's and Chrome's close sequences still decide at the report, with no wait. A Firefox-shaped drag grows the viewport twice with the finger down and finds no put-back; after the finger is up, a browser pan is put back. Another drags the page with the toolbar hiding twice and finds no reveal scroll until the finger is up. A long press focuses the field while Gboard grows from 48 to 290 px, and the field is revealed at 290; the next show's first reveal runs again under the same press, and a press that starts after the reveal holds the next report until it lifts. After the keyboard goes with no finger down, a long press that brings it back is revealed with that press still down. Another holds a report while the long press's finger stays down after a second finger tapped and lifted. Another misses a touch's end, as when its target leaves the page, and finds a browser pan put back once the keyboard has hidden and shown again. The input stream's tests count fingers through a second finger, a cancel and a native pan's `pointercancel`, count nothing while a touch end could go unheard, and count the touches that start. Six cover the rise on iOS: its smooth scroll, Reduce Motion, a theme that reduces motion, the scroll back after a rise drawn later, a rise carried on at a new height, and no second reveal while a scroll area's rise is drawn. Their CSS.supports stub answers both of Safari's forms, a property and value or a condition. Another drives a scroll area with a smooth `scroll-behavior` and finds its own `scrollBy` called at once. Two in the motion module cover `reducesMotion`: the setting, and a theme that reduces motion for everyone. * fix(rectMorph): a handed-in animator stays on the element through a copy dismissal CodeBunny on #9769: a dismissal onto a copy detached the animator, and a handed-in one was never attached again, so its owner's writes stopped reaching the element. Only the morph's own animator lets go now. Co-authored-by: Cindy Zhang <[email protected]> * fix(motion): one timed curve keeps a retargeted velocity, for the pager and the morph CodeBunny on #9769: solveAnimatedPageScroll already played this curve and keeps the velocity of the move it retargets. timedCurve in progress.ts is now that one curve; the pager and the morph's timed motion call it, so a timed present that interrupts a dismissal keeps its velocity. The INV12 note states the system only. File header and comments trimmed. Co-authored-by: Cindy Zhang <[email protected]> * fix(rectMorph): a timed motion from rest plays its easing as given CodeBunny on #9769: with nothing in flight the morph handed timedCurve a velocity of 0, which it treats as a retarget and uses to cancel the easing's starting slope. Only a motion in flight hands its velocity on now; tests check a present from rest and a dismissal from a settled present against the easing itself. Header and comments shortened. Co-authored-by: Cindy Zhang <[email protected]> * docs(rectMorph): the timing follows the component's motion record The type's doc, the example and the changeset name no rule of their own about which input plays which timing: each play takes the timing the adopting component's motion record names (AST-094 FR45). Co-authored-by: Christopher Chedeau <[email protected]> * docs(AST-099): TextInput, TextArea and NumberInput meet FR9 FR9's scrolling-content bullet adds the spec owners' sentence: where a browser carries out the document's scroll by moving the visual viewport, that offset is the reveal, not a pan. Gap 2 is met. Gaps 1, 10 and 11 say what the three fields now do. Gap 11 keeps the missing scroll range as the fix; until a scroller gains it, Core pans the visual viewport where the document cannot scroll far enough. Two verification rows cover Firefox for Android (the offset equals the computed reveal) and Chrome (no pan added after Core places the field). Chrome's names the cases Core pans, and fails a field Core pans that ends other than 10 CSS px above the keyboard. In Firefox for Android the pan moves nothing where the page has no scroll range; Gap 11 names those cases. The device-evidence row records that a docked toolbar resting under the keyboard while a field outside it has focus is not a failure. BottomSheet's height doc says what such a field gets in a sheet that is not a fully expanded Tall sheet. FR9's scrolling-content bullet adds the close: each scroller that revealed the field scrolls back to where it was before the reveal, and a scroll the person made while the keyboard showed is kept. A verification row covers a field in the middle of a page that scrolls the document. FR9's scrolling-content bullet adds the open: on iOS the field rises on the browser's own smooth scroll beside the keyboard's slide, settling within 0.15 s after the keyboard settles, and it moves in one frame under Reduce Motion, in a theme that reduces motion for everyone, and in other browsers. A verification row reads every drawn frame of the rise. Gap 13 records Chrome's rise, which stays in one frame because Chrome checks the field in the resize's own commit; Firefox for Android takes the same path. The device-evidence row's failure for a reveal later than the keyboard's report notes that on iOS the rise starts in that frame and settles as FR9 states. FR9's scrolling-content bullet adds the hold: a show's first report always places the field, and a later report that comes while a finger is down, after a touch has begun since the field's last placement, moves nothing. FR9's close adds that at the hide report, Firefox for Android can still show the document where it was before the reveal, and turns the reveal back into a document scroll only after that report; the scroll back follows that scroll. A row closes the keyboard with Back in Firefox for Android at normal speed and on a slow profile. The input-fields family's FR13 status says the same: the three fields meet FR13 through FR9, apart from Gap 11. FR9's close now starts the scroll back at the blur that closes the keyboard in Safari on iOS, beside the keyboard's slide; the report that the keyboard has gone comes later and only confirms it. Elsewhere it starts at that report, and under Reduce Motion, and in a theme that reduces motion for everyone, it lands at once there. A scroller the person scrolled keeps the person's scroll, a finger on the screen at the blur leaves the scroll back to the report, and a field that gains focus during the slide stops the scroll back where the page is. Safari's close row reads every drawn frame from Done until the page rests, and adds a tap on the field 80 ms and 150 ms after Done. The open sentence is rewrapped, word for word. * Merge main into motion/morph-path * Merge motion/morph-path into motion/rect-morph Main renamed the engine's factory to createMotionEngine. The merge takes that name in the test bundle and in rectMorph and its tests. * fix(rectMorph): AST-094 links the morph; the proof imports a safe test The morph's comment cited AST-094 FR45 as its only link to that record. AST-094 now lists the file, and the comment keeps the fact without the citation. The proof imports `test` from the a11y-spec package, whose contexts reach no remote host, as main's lint asks. * test(SnapPaging): the pager's bundle lists the progress module The pager's timed settle takes its curve from motion/progress.ts, so the hook adds that module over Carousel alone. The bundle test lists it as pager code. * test(motion): the popover's proofs read Popover's live geometry The morph's popover proofs played a copy of Popover's growth that had drifted: it lacked the overlap rule, so an overlapping popover grew from its left edge where Popover grows from its top. The proofs now import popoverCollapsedState, popoverFrame and frameOf from Popover. A new overlapping case, which the deleted copy fails, pins the growth from the top edge. * Merge motion/morph-path into motion/rect-morph * refactor(motion): one eased progress, with a retargeted velocity The rect morph's timedProgressCurve played, from rest, the curve that easedProgress already plays for Popover, SegmentedControl and the layout glide. easedProgress moves into progress.ts and takes an optional velocity: the Hermite carry that the pager and the morph use. From rest its values do not change. Its velocity is a central difference that stays inside the curve, and from rest it starts on the curve's own slope. timedProgressCurve goes, and timedCurve maps easedProgress onto values, keeping only its carry for no distance. * test(motion): the popover's turn-around reads Popover's live curves The morph's turn-around proof compared restartFrom with lines written in the test, so a change to Popover's readState or surfaceCurves left it green. Popover exports both for the proofs, which now replay its own turn-around. morphPath.ts's header keeps only its tags: the paths' own JSDoc says the rest. * Merge motion/morph-path into motion/rect-morph * docs(changeset): the rect morph's note names the eased-progress move The note said timedProgressCurve joins the progress helpers, which this pull request no longer adds. It now says easedProgress moves to them with a retargeted velocity, and timedCurve joins them. * Merge main into motion/rect-morph Main's Popover touch growth, which plays on the surface and floors its opacity curve with motion/opacityFloor.ts, meets the rect morph's move of easedProgress into motion/progress.ts in the imports of popoverSurfaceMotion.ts. The merge keeps both: the floor's import, and easedProgress from progress. * test(motion): the popover's turn-around compares opacity as drawn Popover's surface curves now stop their opacity at 0 or a floor above it. Past its end, a turn-around toward the source takes the popover path's opacity below 0, where Popover's stops at 0. An opacity draws clamped to 0 through 1, so both draw 0. The proof now compares the two as drawn, which holds with Popover's curves before and after the floor. * Merge motion/morph-path into motion/rect-morph * Merge main * fix(motion): a popover's morph never reads an opacity below 0 A popover's grow path read its opacity on a straight line, so before its start and past its end it went below 0: a turn-around toward the source read -0.025 at 1.05. An opacity below 0 draws as 0, so opacityAt now stops at 0. The popover proofs compare opacities as drawn, since Popover's own model still reads below 0 there. * Merge motion/morph-path into motion/rect-morph * feat(DropdownMenu): a finger or a pen opens the menu as it presses Under a finger or a pen, a DropdownMenu or MoreMenu trigger opens its menu as it is pressed, instead of after a 500 ms hold (spec:AST-094 FR29, FR43). Inside a scroll view it opens once the 150 ms content-touch delay passes with no scroll, so a scroll that starts on the trigger still scrolls. The finger that opened the menu picks a row only after moving 10 px. presentation="popover" keeps the previous behavior. useMenuPress with no longPressDelayMs follows the same rules, and longPressDelayMs: 500 keeps the previous hold. * test(motion): the morph proofs drop the menu's old straight line The anchored menu's case modeled a straight line from a 22 px square on its control. The menu now grows out of its trigger on Popover's edge path, which the popover cases already check, so the case no longer describes any presentation's model. The file header follows. * Merge main * Merge main * docs(DropdownMenu): open-on-press notes name the anchored menu A menu shown as a bottom sheet still opens at the tap's click, so the release note names the anchored menu, as the press does. The hook's doc names a finger or a pen on every device, as the hook acts. * Merge main * sandbox: a page to try a menu's press under a finger A raw page that scrolls with the document. Its Actions menu sits in a fixed top bar, so it opens as a finger presses it, and a slide onto a row runs that row once. Its More menu sits in the page, so a flick that starts on it scrolls the page. The bar shows which row ran and how many times. * Merge main * Merge the open-on-press change into the rect morph stack * feat(DropdownMenu): a finger's open grows the menu out of its trigger Under a finger or a pen, a DropdownMenu or MoreMenu grows out of its trigger as it opens and shrinks back into it as it closes. It plays on the shared rect morph, on the popover's path and timing, so it grows as a Popover does. A tap's open grows as a hold's does: the open at a tap's lift used to take the mouse's path. The grow's code loads at the first touch on the page or on a trigger. A mouse, the keyboard and presentation="popover" keep the layer's own entrance. * fix(DropdownMenu): under Reduce Motion a finger's open only fades in Under Reduce Motion, a finger's open played the grow, which the animator turns into a dip: for its first half the menu sat collapsed at the trigger. A resting mouse's click then missed the row it rested on. The open now keeps the layer's own entrance, which only fades in where the menu rests, as before the grow. FR21 and the changeset say so. * test(DropdownMenu): touch specs wait out a finger's grow A finger's grow starts a frame after the open, or once its code arrives, and holds input until its curve ends. The press specs now wait for three still frames, and the entrance-hold spec waits for the grow to start and for its natural end. Finishing its animations from a script leaves the grow's hold in place until its curve ends. * refactor(core): one Reduce Motion predicate for the animator and menu The menu's glue copied the animator's Reduce Motion read. A leaf module now holds the one predicate: the person's setting, or a theme that reduces motion for everyone. The animator, the Reduced Motion policy and the glue call it. It imports no motion code, so the glue reads it without the animator in DropdownMenu's static bundle. No behavior changes. * fix(DropdownMenu): every copy of Core shares the grow's one load The menu kept its loaded grow code, the load in flight and the replaceable import in module scope. Every copy of Core now shares them under a registered key. A change to the module's calls bumps the version, so each copy then keeps its own. * fix(DropdownMenu): taps stay off the page until the menu shows Under a coarse primary pointer, the grow takes its input hold at its first frame. Before that frame, a tap reached the page: on an open with the code loaded, and on the first open between the code's arrival and the grow. A hold now lasts from the open until the grow's first frame. The press model's unit cases stub the presentation's hold, as jsdom never ends the grow. * docs(AST-094): FR31 grows once the grow's code is loaded Until the code is loaded, an open fades. Only an open before the code first loads in a page session can fade: the first open, or an open after a failed load. * Merge main * docs(AST-094): FR31's faded open closes with no shrink An open before the grow's code loads fades, and its close plays no shrink, as the DropdownMenu record's FR21 states. * fix(keyboard): the scroll back's records are one per page across copies keyboardScrollBack.ts keeps its four per-window stores under registered shared keys, as main now keeps the rest of the keyboard model. A swizzled copy's field and the package's field then note into one record, so one scroll back runs per page. The shared-identity check flagged the four module-scope stores after the merge of main. focusKeyboard.shared.test.tsx gains a case: the package sees where a copy's scroll for the keyboard is headed. * fix(DropdownMenu): the grow's code loads through the shared loader The grow's code now loads through the shared module loader that the menu's bottom sheet uses, as the import boundaries require. A failed load warns once in development builds, and the next open still asks again. The DropdownMenu record's FR21 names when the code loads: at a trigger's first touch, or the page's first touch where touch is the primary input. * Merge main * fix(keyboard): a field focused as it mounts starts its session at attach A TextInput, TextArea or NumberInput with hasAutoFocus has focus before the keyboard path attaches, so no later focus event starts its session, and it kept only the browser's own reveal. keepFieldAboveKeyboard now starts the session at attach when the field already has focus. Every other route is unchanged. Each field's keyboard test gains a hasAutoFocus case, which fails without the fix. * Merge main * Merge the open-on-press change into the rect morph stack * Merge main and the open-on-press change * Merge commit 'ebb9ddecc0219bc6eaf3caf40b6e4e45f81dc0e5' into motion/rect-morph * fix(motion): existing callers keep easedProgress's values; the pager and the rect morph use timedCurve easedProgress moves to the progress helpers byte for byte, so Popover and SegmentedControl read the same positions and velocities as on main. timedCurve is the pager's curve as on main, with one change: from rest, its velocity at t <= 0 is the curve's own starting slope. The rect morph plays its timed motion on timedCurve from 0 to 1. callerMotionValues.test.ts pins easedProgress and the pager on a fixed grid, bit for bit, to main's values. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * test(paging): a retarget at the first instant goes on at the starting speed A linear move of 300 px over 0.3 s, retargeted at t = 0, reads 0 px/s on main, so the retarget starts from rest. Now it reads about 1000 px/s, the curve's own starting slope, and the retarget keeps that speed. The position stays continuous. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * test(paging): a 0 ms move is on its target at once, at rest On main a 0 ms animated scroll reads NaN at t = 0 and its start position before it. timedCurve's 0 ms guard puts it on its target with no speed, as the rect morph's 0 ms timing does. * test(motion): compare the callers' values with copies of the earlier functions A float64 hash of easedProgress's values is not the same on every platform: macOS arm64 and CI's Linux give different hashes for main's code. The test now keeps copies of easedProgress and solveAnimatedPageScroll as they are on main (ebb9dde), and checks that the shipped functions give the same number, bit for bit (Object.is), for each position and velocity on the grid. From rest, the pager's velocity at t <= 0 stays the one value left out. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * Merge the open-on-press change into the rect morph stack * Merge the rect morph's new head * refactor(core): one useMenuPress for every menu * refactor(keyboard): read Reduce Motion through reducedMotionFade The keyboard path asks the Reduced Motion policy that already serves motion the animator does not drive: reducedMotionFade(element) is null when motion is not reduced. That answer counts the person's setting and a theme that reduces motion for everyone, as before. reducesMotion, which this branch added to reducedMotion.ts, goes, so reducedMotion.ts, its test and the motion README are as on main. Behavior is unchanged. * refactor(keyboard): the scroll back lives in keyboardTarget.ts keyboardTarget.ts, the scroll back's only caller, already imports everything it uses, so the scroll back moves there verbatim and its functions become private. keyboardScrollBack.ts and its five exports go. Its four stores keep their shared keys, now named for keyboardTarget. focusKeyboard.shared.test.tsx is as on main: the shared-identity source check covers the stores. Behavior is unchanged. * docs(AST-099): name the keyboard module's new cross-module exports Current-state impact names the five exports the keyboard path adds and why each one is needed: the input stream's two touch counts, keyboardHeight's finger read and visual-viewport pan, and keyboardTarget's clearance at the first report. * Merge the open-on-press change into the rect morph stack * Merge the open-on-press change's rework * docs(AST-099): Gap 19, a field in a modal sheet shorter than tall FR9's implementation gaps gain Gap 19. A modal BottomSheet shorter than tall is a full-viewport dialog with no scroller, and BottomSheet's keyboard path runs only for a tall sheet. So a field there keeps the browser's own reveal, and Chrome on Android pans the page. * refactor(DropdownMenu): grow with the page, on Popover's surface motion * docs(Popover): name the surface motion options DropdownMenu passes * Merge main * Merge main * Merge the open-on-press change into the rect morph stack * Merge the open-on-press change's main merge * test(DropdownMenu): read the row under a held finger once the grow rests * docs(AST-099): name Gap 19 where the fields meet FR9 The implementation-gaps lead, Gap 2 and family:input-fields' FR13 status line say TextInput, TextArea and NumberInput meet FR9 apart from the missing scroll range. They now also name Gap 19, a modal BottomSheet shorter than tall. * refactor(input): one touch reader in the input stream isTouchOnScreen and getTouchStartCount become one reader, getTouches. It returns the record the stream already keeps: the fingers on the screen and how many touches started. The keyboard module reads it at each of its five places. No behavior changes, and the same tests pass through the one reader. * docs(AST-099): name the input stream's one touch reader AST-099's current-state list names getTouches, the one reader that replaces isTouchOnScreen and getTouchStartCount. * Merge commit '7e7fbae0fa0ba389ad37fafdb26e6495fab19fd4' into motion/rect-morph # Conflicts: # packages/core/src/SegmentedControl/useSegmentedSelectionMotion.ts * Merge main into the rect morph stack * Merge main and the rect morph stack's live head * docs(AST-094): name the morph path module * Merge commit '6176b9dccc1986b83713e4c9dcf39688e7c5b3e6' into motion/rect-morph * docs(AST-094): name the rect morph module * refactor(Popover): name the tap hold until the grow's first frame * Merge main into the rect morph stack * Merge main and the rect morph stack's live head * refactor(DropdownMenu): grow on Popover's own surface motion * Merge main, without the rect morph stack * fix(Popover): grow from the trigger's box without its press scale * Merge main for useCommittedRefInto * fix(DropdownMenu): commit presentSurfaceRef through useCommittedRefInto * refactor(DropdownMenu): read the click's press from the press model * docs(DropdownMenu): record the press report and the entrance without one * docs(DropdownMenu): word the press records in the present tense * Merge main for the press model's committed refs * fix(DropdownMenu): mark a finger's open only where the menu opens * Merge main * fix(DropdownMenu): tie a finger's open to its gesture * fix(core): keep the keyboard store apart from copies of another shape The hide's touch count changes the keyboard store's shape, so its shared key moves to version 2. A copy of Core built against the earlier shape keeps its own store, as spec:AST-110 FR3 requires. A case puts an earlier copy's listening store under version 1: the package keeps its own store and reads its own height, and the other store keeps its height and shape. On version 1 the package reads the other copy's 300 px. touchQueries.ts's comment also names the scroll back from the blur among isIosWebKit's readers. * fix(DropdownMenu): an open from code plays the layer's entrance A Reduce Motion comment drops a claim a reduced-motion theme breaks. * Merge main * refactor(core): state the keyboard store's constraint in its comment The version comment now says what the store holds and why a copy of Core with another store shape keeps its own, instead of how the version came to change. * Merge main for the menu press's touch identifier * fix(DropdownMenu): under Reduce Motion a menu fades out where it stands * Merge main * Merge main for the menu's show and hide refs at commit * Merge main * fix(DropdownMenu): say Reduce Motion fades only on a coarse pointer * Merge main for the layer's show from another trigger * Merge main * Merge main * Merge main for the alert dialog's touch motion and the swipe actions * Merge main for the popover's focus-return target * fix(Layer): an exit copy keeps the padding and colors of what it copies * Merge the exit copy fix, with main * test(DropdownMenu): a finger's close copy draws the menu's rows in place * test(Layer): the browser's popover style reaches the exit copy * docs(DropdownMenu): the press model's record says why no engine fits * Merge the exit copy fix's test update * Merge main into the exit copy fix * Merge main for the kept-inside hold's release * Merge main into the exit copy fix * Merge main * Merge main * Merge main * fix(DropdownMenu): a finger's open that waits still grows * Merge main * Merge main * docs(keyboard): record Back in Firefox for Android as a gap Main shows it too. * docs(keyboard): say that Gap 21 shows more often on main * Merge #9777 * docs(keyboard): narrow the changeset for Back in Firefox for Android Gap 21 names FR9 and no longer names main. * test(DropdownMenu): pin a waiting finger open that another press leaves * Merge main * Merge #9777 * Merge main * Merge #9777 * Merge main * Merge main * Merge main * Merge main * Merge main * fix(DropdownMenu): one top-layer shield for a finger's open A finger's open raised two viewport shields: the hold until the grow's first frame keyed on the menu's surface, and the entrance hold on its popover. Each showed its shield in the top layer, which forces a style update in the open's task. The touch presentation's holds now key on the top-layer popover around the surface (holdLayerOf), so they share one shield. The gap until the first frame stays held over the viewport. * Merge main * ci: record the Chromium time of the new DropdownMenu touch-grow spec The pr-interaction leg that ran it took 13.2 s for its 11 tests, timed as recordLog times a file. Without a time, fewer than nine in ten of the interaction specs on main plus this change have one. * Merge main * Merge main * Merge main Co-authored-by: Cindy Zhang <[email protected]>
… on (#11859) * feat(core): one progress module for the motion foundation progressCurve, mapProgress, mapRange and presentedProgressVelocity in motion/progress.ts, internal, one velocity unit (progress per second). Rebuilt on main from the pull request's own change, without the open dependency chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]> * refactor(animatedLayout): take the settle spring's progress from progressCurve CodeBunny on #9755: springProgress solved the same spring as progressCurve. It now reads progressCurve (remaining = 1 - progress), so one implementation remains. Same curve, same settle epsilon (0.001) and duration. * feat(core): the rect morph's paths, the rect a grow-out presentation shows at each progress lerpPath, edgeGrowPath, each path's restartFrom and morphCurves in motion/morphPath.ts, internal. Pure geometry over a progress curve: the caller chooses the timing. Rebuilt on the progress module from the pull request's own change, without the open chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]> * Merge remote-tracking branch 'origin/main' into motion/morph-path # Conflicts: # packages/core/src/motion/README.md * feat(core): one rect morph for touch presentations that grow out of a source rect createRectMorph in motion/rectMorph.ts, internal: present along a path and dismiss back onto a copy or the element, each continuing the other from the rect on screen. Rebuilt on main from the pull request's own change and ported to main's engine (createMotionAnimator). Timing follows the owner's rule for touch motion: present and dismiss take a motion, either a theme duration and easing (a tap, a key, the program) or a spring (a gesture's release, from its velocity). timedProgressCurve joins the progress helpers. architecture:react-component-runtime INV12 records the implementation gap: the size-change glide moves onto the morph next. Co-authored-by: Cindy Zhang <[email protected]> * feat(TextInput, TextArea, NumberInput): fields stay above the keyboard Each passes its input to `useMobileKeyboard` from its own render, with no prop and no Effect of its own. On focus the field decides where it is: inside a keyboard target such as a Tall BottomSheet it moves nothing; in an app's bar docked at the viewport's bottom, the bar rides the keyboard, its bottom on the keyboard's top; in scrolling content, its nearest scroller, the document included, scrolls it 10 px above the keyboard in the keyboard's report. In a fixed container the app positions itself, a scroller around the field reveals it, and with none the browser's own reveal stays. Its first tap and focus moves into it arrive without the browser's reveal where the module places the field, so the page never pans there. A scroll area does not gain the range it lacks at its end yet. Where a field's scroll area cannot place it, the document reveals it, in the page and in a fixed container where the document's scroll moves the container, as in Safari while its keyboard shows; elsewhere Core scrolls the document back. Where the document cannot scroll far enough, as at a short page's end in Chrome, a pan of the visual viewport takes the rest in the same frame (`panVisualViewportTo`): a probe fixed in the layout viewport is scrolled into view, as the reveal-pan watch puts a pan back. The watch takes Core's own pan as the new rest. Firefox for Android does not pan for the probe. A page with nothing to scroll keeps the browser's own reveal. On Chrome's show, a docked bar first sets its field 4 px above the keyboard's top at once, as the Tall sheet does, and only the rest rides, so Chrome's own pan finds the field clear. Every viewport report now feeds the ride's reveal-pan watch, so a pan Chrome still makes is put back, and a pan made at one keyboard height goes back at the next. Under Remove animations, Gboard first reports a keyboard 48 px tall, and Chrome may then reveal the bar's field itself: it scrolls the page behind the bar, then pans. In Chrome, the ride's watch scrolls the document back as well, when the scroll and the pan centre the field as Chrome's reveal does; the app's own scroll to another element stays. On iOS, a reveal that places the field rises on the browser's smooth scroll from the keyboard's first report, which comes as the keyboard starts to slide, so the field rises beside it (`risesSmoothly`, which reads Core's iOS WebKit check, `isIosWebKit`). The scroll back records where the rise is headed, and a rise still on its way when the keyboard changes height carries on from its target. Under Reduce Motion, in a theme that reduces motion for everyone, and in Chrome, which checks the field in the resize's own commit, the reveal moves at once. The rise and the scroll back ask the motion module's new `reducesMotion`, beside `reducedMotionFade`, which now uses it, so a theme that reduces motion for everyone counts as the setting for both. A scroll area's reveal goes through its own `scrollBy` with an explicit behavior where it has one, so a smooth `scroll-behavior` on the area cannot slow an instant reveal, as the Tall sheet's reveal already does. When the keyboard closes, each scroller a reveal moved scrolls back to where it was (keyboardScrollBack.ts), on the browser's smooth scroll. Safari on iOS reports the keyboard gone about half a second after the blur that closes it, once it is down. There the scroll back starts at that blur, once the focus change settles on nothing that brings up a keyboard with no finger on the screen, and slides down beside the keyboard; the report only confirms it. A finger then can be a tap that brings the keyboard back, so the report decides, as elsewhere and under Reduce Motion, where the scroll lands at once. Safari applies a scripted scroll a frame late, so a scroll set each frame jitters. A scroller the person scrolled meanwhile keeps their scroll. A field that gains focus during the slide stops the scroll back where the page is (`stopKeyboardScrollBack`), and its reveal goes on from there as Core's own scroll. A sandbox page puts three fields in the middle of a page that scrolls the document. Each field's `.keyboard.test.tsx` drives the keyboard module's test double. Mobile keyboard stories on TextInput place the fields low in the page, a TextInput in a toolbar fixed at the bottom (docked, floating above the edge, or with its own `translate`), a last field at the end of a short page and of a scroll area, a scroll area low on the page, a scroll area in a floating panel and in a full-viewport panel, and a field in a sheet of a set height. Firefox for Android can carry the reveal's document scroll as a visual-viewport offset, show the document where it was before the reveal at the keyboard's hide report, and turn the offset back into a document scroll only after it. The scroll back then waits up to a second for the first document scroll: one that lands where Core left the document is the browser's own, and the scroll back follows it. A touch, a keyboard that comes back, the field's page going, or the wait's end puts nothing back. The reveal-pan watch's touch flag now holds through a report that comes while a finger is on the screen. In Firefox the toolbar hides in a drag, which changes the measured keyboard height mid-drag; the watch then took the drag's own pan for the browser's and put it back. The input stream now counts the fingers on the screen from touch events (`isTouchOnScreen`), only while `touchend` and `touchcancel` are heard. A native pan keeps a finger there, though its `pointercancel` drops the press from `getDownPresses`, so that record cannot serve. The watch's shared touch subscription hears those two types, and a report reads the count. After the show's first reveal, a keyboard report reveals nothing while a press that started after the last reveal is down. In Firefox the toolbar hides in a drag, and the reveal re-applied itself with small scrolls under the person's finger. The report's height is kept, so the field stays where the person put it, and a later report with the finger up reveals it as before. The press that focused the field holds nothing: a long press focuses with the finger still down, and Gboard can report a 48 px keyboard first, then its full height. The input stream also counts the touches that start (`getTouchStartCount`), and each reveal notes that count. The keyboard module reads the finger count through `isFingerOnScreen`: a finger down at the keyboard's last hide counts no more until a touch starts, since a touch whose target leaves the page ends at a node the window never hears. The count includes a stylus, whose drag moves the page as a finger does. Nine unit tests cover the scroll back from the blur on iOS: it starts at the blur and the report moves nothing more; focus that moves on to another field or into a frame keeps the page; a finger on the screen at the blur leaves it to the report; a person's scroll stands; Reduce Motion waits for the report; a field focused again during the slide stops the scroll back and rises from where the page is, or stays where a touch stopped it with nothing left to raise; and the next close goes back to the first place, at a blur or at a report. Six unit tests cover the scroll back: the page's smooth scroll at the report (nothing before it), Reduce Motion, a theme that reduces motion, a person's scroll kept, a scroll area after Back, and a focus move to another field. Firefox-shaped cases carry the reveal as an offset and close the keyboard before the fold: the scroll back follows the fold, a touch-drag control keeps the page, only the first document scroll counts, and each way the wait ends leaves no scroll listener. Safari's and Chrome's close sequences still decide at the report, with no wait. A Firefox-shaped drag grows the viewport twice with the finger down and finds no put-back; after the finger is up, a browser pan is put back. Another drags the page with the toolbar hiding twice and finds no reveal scroll until the finger is up. A long press focuses the field while Gboard grows from 48 to 290 px, and the field is revealed at 290; the next show's first reveal runs again under the same press, and a press that starts after the reveal holds the next report until it lifts. After the keyboard goes with no finger down, a long press that brings it back is revealed with that press still down. Another holds a report while the long press's finger stays down after a second finger tapped and lifted. Another misses a touch's end, as when its target leaves the page, and finds a browser pan put back once the keyboard has hidden and shown again. The input stream's tests count fingers through a second finger, a cancel and a native pan's `pointercancel`, count nothing while a touch end could go unheard, and count the touches that start. Six cover the rise on iOS: its smooth scroll, Reduce Motion, a theme that reduces motion, the scroll back after a rise drawn later, a rise carried on at a new height, and no second reveal while a scroll area's rise is drawn. Their CSS.supports stub answers both of Safari's forms, a property and value or a condition. Another drives a scroll area with a smooth `scroll-behavior` and finds its own `scrollBy` called at once. Two in the motion module cover `reducesMotion`: the setting, and a theme that reduces motion for everyone. * fix(rectMorph): a handed-in animator stays on the element through a copy dismissal CodeBunny on #9769: a dismissal onto a copy detached the animator, and a handed-in one was never attached again, so its owner's writes stopped reaching the element. Only the morph's own animator lets go now. Co-authored-by: Cindy Zhang <[email protected]> * fix(motion): one timed curve keeps a retargeted velocity, for the pager and the morph CodeBunny on #9769: solveAnimatedPageScroll already played this curve and keeps the velocity of the move it retargets. timedCurve in progress.ts is now that one curve; the pager and the morph's timed motion call it, so a timed present that interrupts a dismissal keeps its velocity. The INV12 note states the system only. File header and comments trimmed. Co-authored-by: Cindy Zhang <[email protected]> * fix(rectMorph): a timed motion from rest plays its easing as given CodeBunny on #9769: with nothing in flight the morph handed timedCurve a velocity of 0, which it treats as a retarget and uses to cancel the easing's starting slope. Only a motion in flight hands its velocity on now; tests check a present from rest and a dismissal from a settled present against the easing itself. Header and comments shortened. Co-authored-by: Cindy Zhang <[email protected]> * docs(rectMorph): the timing follows the component's motion record The type's doc, the example and the changeset name no rule of their own about which input plays which timing: each play takes the timing the adopting component's motion record names (AST-094 FR45). Co-authored-by: Christopher Chedeau <[email protected]> * docs(AST-099): TextInput, TextArea and NumberInput meet FR9 FR9's scrolling-content bullet adds the spec owners' sentence: where a browser carries out the document's scroll by moving the visual viewport, that offset is the reveal, not a pan. Gap 2 is met. Gaps 1, 10 and 11 say what the three fields now do. Gap 11 keeps the missing scroll range as the fix; until a scroller gains it, Core pans the visual viewport where the document cannot scroll far enough. Two verification rows cover Firefox for Android (the offset equals the computed reveal) and Chrome (no pan added after Core places the field). Chrome's names the cases Core pans, and fails a field Core pans that ends other than 10 CSS px above the keyboard. In Firefox for Android the pan moves nothing where the page has no scroll range; Gap 11 names those cases. The device-evidence row records that a docked toolbar resting under the keyboard while a field outside it has focus is not a failure. BottomSheet's height doc says what such a field gets in a sheet that is not a fully expanded Tall sheet. FR9's scrolling-content bullet adds the close: each scroller that revealed the field scrolls back to where it was before the reveal, and a scroll the person made while the keyboard showed is kept. A verification row covers a field in the middle of a page that scrolls the document. FR9's scrolling-content bullet adds the open: on iOS the field rises on the browser's own smooth scroll beside the keyboard's slide, settling within 0.15 s after the keyboard settles, and it moves in one frame under Reduce Motion, in a theme that reduces motion for everyone, and in other browsers. A verification row reads every drawn frame of the rise. Gap 13 records Chrome's rise, which stays in one frame because Chrome checks the field in the resize's own commit; Firefox for Android takes the same path. The device-evidence row's failure for a reveal later than the keyboard's report notes that on iOS the rise starts in that frame and settles as FR9 states. FR9's scrolling-content bullet adds the hold: a show's first report always places the field, and a later report that comes while a finger is down, after a touch has begun since the field's last placement, moves nothing. FR9's close adds that at the hide report, Firefox for Android can still show the document where it was before the reveal, and turns the reveal back into a document scroll only after that report; the scroll back follows that scroll. A row closes the keyboard with Back in Firefox for Android at normal speed and on a slow profile. The input-fields family's FR13 status says the same: the three fields meet FR13 through FR9, apart from Gap 11. FR9's close now starts the scroll back at the blur that closes the keyboard in Safari on iOS, beside the keyboard's slide; the report that the keyboard has gone comes later and only confirms it. Elsewhere it starts at that report, and under Reduce Motion, and in a theme that reduces motion for everyone, it lands at once there. A scroller the person scrolled keeps the person's scroll, a finger on the screen at the blur leaves the scroll back to the report, and a field that gains focus during the slide stops the scroll back where the page is. Safari's close row reads every drawn frame from Done until the page rests, and adds a tap on the field 80 ms and 150 ms after Done. The open sentence is rewrapped, word for word. * Merge main into motion/morph-path * Merge motion/morph-path into motion/rect-morph Main renamed the engine's factory to createMotionEngine. The merge takes that name in the test bundle and in rectMorph and its tests. * fix(rectMorph): AST-094 links the morph; the proof imports a safe test The morph's comment cited AST-094 FR45 as its only link to that record. AST-094 now lists the file, and the comment keeps the fact without the citation. The proof imports `test` from the a11y-spec package, whose contexts reach no remote host, as main's lint asks. * test(SnapPaging): the pager's bundle lists the progress module The pager's timed settle takes its curve from motion/progress.ts, so the hook adds that module over Carousel alone. The bundle test lists it as pager code. * test(motion): the popover's proofs read Popover's live geometry The morph's popover proofs played a copy of Popover's growth that had drifted: it lacked the overlap rule, so an overlapping popover grew from its left edge where Popover grows from its top. The proofs now import popoverCollapsedState, popoverFrame and frameOf from Popover. A new overlapping case, which the deleted copy fails, pins the growth from the top edge. * Merge motion/morph-path into motion/rect-morph * refactor(motion): one eased progress, with a retargeted velocity The rect morph's timedProgressCurve played, from rest, the curve that easedProgress already plays for Popover, SegmentedControl and the layout glide. easedProgress moves into progress.ts and takes an optional velocity: the Hermite carry that the pager and the morph use. From rest its values do not change. Its velocity is a central difference that stays inside the curve, and from rest it starts on the curve's own slope. timedProgressCurve goes, and timedCurve maps easedProgress onto values, keeping only its carry for no distance. * test(motion): the popover's turn-around reads Popover's live curves The morph's turn-around proof compared restartFrom with lines written in the test, so a change to Popover's readState or surfaceCurves left it green. Popover exports both for the proofs, which now replay its own turn-around. morphPath.ts's header keeps only its tags: the paths' own JSDoc says the rest. * Merge motion/morph-path into motion/rect-morph * docs(changeset): the rect morph's note names the eased-progress move The note said timedProgressCurve joins the progress helpers, which this pull request no longer adds. It now says easedProgress moves to them with a retargeted velocity, and timedCurve joins them. * Merge main into motion/rect-morph Main's Popover touch growth, which plays on the surface and floors its opacity curve with motion/opacityFloor.ts, meets the rect morph's move of easedProgress into motion/progress.ts in the imports of popoverSurfaceMotion.ts. The merge keeps both: the floor's import, and easedProgress from progress. * test(motion): the popover's turn-around compares opacity as drawn Popover's surface curves now stop their opacity at 0 or a floor above it. Past its end, a turn-around toward the source takes the popover path's opacity below 0, where Popover's stops at 0. An opacity draws clamped to 0 through 1, so both draw 0. The proof now compares the two as drawn, which holds with Popover's curves before and after the floor. * Merge motion/morph-path into motion/rect-morph * Merge main * fix(motion): a popover's morph never reads an opacity below 0 A popover's grow path read its opacity on a straight line, so before its start and past its end it went below 0: a turn-around toward the source read -0.025 at 1.05. An opacity below 0 draws as 0, so opacityAt now stops at 0. The popover proofs compare opacities as drawn, since Popover's own model still reads below 0 there. * Merge motion/morph-path into motion/rect-morph * feat(DropdownMenu): a finger or a pen opens the menu as it presses Under a finger or a pen, a DropdownMenu or MoreMenu trigger opens its menu as it is pressed, instead of after a 500 ms hold (spec:AST-094 FR29, FR43). Inside a scroll view it opens once the 150 ms content-touch delay passes with no scroll, so a scroll that starts on the trigger still scrolls. The finger that opened the menu picks a row only after moving 10 px. presentation="popover" keeps the previous behavior. useMenuPress with no longPressDelayMs follows the same rules, and longPressDelayMs: 500 keeps the previous hold. * test(motion): the morph proofs drop the menu's old straight line The anchored menu's case modeled a straight line from a 22 px square on its control. The menu now grows out of its trigger on Popover's edge path, which the popover cases already check, so the case no longer describes any presentation's model. The file header follows. * Merge main * Merge main * docs(DropdownMenu): open-on-press notes name the anchored menu A menu shown as a bottom sheet still opens at the tap's click, so the release note names the anchored menu, as the press does. The hook's doc names a finger or a pen on every device, as the hook acts. * Merge main * sandbox: a page to try a menu's press under a finger A raw page that scrolls with the document. Its Actions menu sits in a fixed top bar, so it opens as a finger presses it, and a slide onto a row runs that row once. Its More menu sits in the page, so a flick that starts on it scrolls the page. The bar shows which row ran and how many times. * Merge main * Merge the open-on-press change into the rect morph stack * feat(DropdownMenu): a finger's open grows the menu out of its trigger Under a finger or a pen, a DropdownMenu or MoreMenu grows out of its trigger as it opens and shrinks back into it as it closes. It plays on the shared rect morph, on the popover's path and timing, so it grows as a Popover does. A tap's open grows as a hold's does: the open at a tap's lift used to take the mouse's path. The grow's code loads at the first touch on the page or on a trigger. A mouse, the keyboard and presentation="popover" keep the layer's own entrance. * fix(DropdownMenu): under Reduce Motion a finger's open only fades in Under Reduce Motion, a finger's open played the grow, which the animator turns into a dip: for its first half the menu sat collapsed at the trigger. A resting mouse's click then missed the row it rested on. The open now keeps the layer's own entrance, which only fades in where the menu rests, as before the grow. FR21 and the changeset say so. * test(DropdownMenu): touch specs wait out a finger's grow A finger's grow starts a frame after the open, or once its code arrives, and holds input until its curve ends. The press specs now wait for three still frames, and the entrance-hold spec waits for the grow to start and for its natural end. Finishing its animations from a script leaves the grow's hold in place until its curve ends. * refactor(core): one Reduce Motion predicate for the animator and menu The menu's glue copied the animator's Reduce Motion read. A leaf module now holds the one predicate: the person's setting, or a theme that reduces motion for everyone. The animator, the Reduced Motion policy and the glue call it. It imports no motion code, so the glue reads it without the animator in DropdownMenu's static bundle. No behavior changes. * fix(DropdownMenu): every copy of Core shares the grow's one load The menu kept its loaded grow code, the load in flight and the replaceable import in module scope. Every copy of Core now shares them under a registered key. A change to the module's calls bumps the version, so each copy then keeps its own. * fix(DropdownMenu): taps stay off the page until the menu shows Under a coarse primary pointer, the grow takes its input hold at its first frame. Before that frame, a tap reached the page: on an open with the code loaded, and on the first open between the code's arrival and the grow. A hold now lasts from the open until the grow's first frame. The press model's unit cases stub the presentation's hold, as jsdom never ends the grow. * docs(AST-094): FR31 grows once the grow's code is loaded Until the code is loaded, an open fades. Only an open before the code first loads in a page session can fade: the first open, or an open after a failed load. * Merge main * docs(AST-094): FR31's faded open closes with no shrink An open before the grow's code loads fades, and its close plays no shrink, as the DropdownMenu record's FR21 states. * fix(keyboard): the scroll back's records are one per page across copies keyboardScrollBack.ts keeps its four per-window stores under registered shared keys, as main now keeps the rest of the keyboard model. A swizzled copy's field and the package's field then note into one record, so one scroll back runs per page. The shared-identity check flagged the four module-scope stores after the merge of main. focusKeyboard.shared.test.tsx gains a case: the package sees where a copy's scroll for the keyboard is headed. * fix(DropdownMenu): the grow's code loads through the shared loader The grow's code now loads through the shared module loader that the menu's bottom sheet uses, as the import boundaries require. A failed load warns once in development builds, and the next open still asks again. The DropdownMenu record's FR21 names when the code loads: at a trigger's first touch, or the page's first touch where touch is the primary input. * Merge main * fix(keyboard): a field focused as it mounts starts its session at attach A TextInput, TextArea or NumberInput with hasAutoFocus has focus before the keyboard path attaches, so no later focus event starts its session, and it kept only the browser's own reveal. keepFieldAboveKeyboard now starts the session at attach when the field already has focus. Every other route is unchanged. Each field's keyboard test gains a hasAutoFocus case, which fails without the fix. * Merge main * Merge the open-on-press change into the rect morph stack * Merge main and the open-on-press change * Merge commit 'ebb9ddecc0219bc6eaf3caf40b6e4e45f81dc0e5' into motion/rect-morph * fix(motion): existing callers keep easedProgress's values; the pager and the rect morph use timedCurve easedProgress moves to the progress helpers byte for byte, so Popover and SegmentedControl read the same positions and velocities as on main. timedCurve is the pager's curve as on main, with one change: from rest, its velocity at t <= 0 is the curve's own starting slope. The rect morph plays its timed motion on timedCurve from 0 to 1. callerMotionValues.test.ts pins easedProgress and the pager on a fixed grid, bit for bit, to main's values. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * test(paging): a retarget at the first instant goes on at the starting speed A linear move of 300 px over 0.3 s, retargeted at t = 0, reads 0 px/s on main, so the retarget starts from rest. Now it reads about 1000 px/s, the curve's own starting slope, and the retarget keeps that speed. The position stays continuous. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * test(paging): a 0 ms move is on its target at once, at rest On main a 0 ms animated scroll reads NaN at t = 0 and its start position before it. timedCurve's 0 ms guard puts it on its target with no speed, as the rect morph's 0 ms timing does. * test(motion): compare the callers' values with copies of the earlier functions A float64 hash of easedProgress's values is not the same on every platform: macOS arm64 and CI's Linux give different hashes for main's code. The test now keeps copies of easedProgress and solveAnimatedPageScroll as they are on main (ebb9dde), and checks that the shipped functions give the same number, bit for bit (Object.is), for each position and velocity on the grid. From rest, the pager's velocity at t <= 0 stays the one value left out. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * Merge the open-on-press change into the rect morph stack * Merge the rect morph's new head * refactor(core): one useMenuPress for every menu * refactor(keyboard): read Reduce Motion through reducedMotionFade The keyboard path asks the Reduced Motion policy that already serves motion the animator does not drive: reducedMotionFade(element) is null when motion is not reduced. That answer counts the person's setting and a theme that reduces motion for everyone, as before. reducesMotion, which this branch added to reducedMotion.ts, goes, so reducedMotion.ts, its test and the motion README are as on main. Behavior is unchanged. * refactor(keyboard): the scroll back lives in keyboardTarget.ts keyboardTarget.ts, the scroll back's only caller, already imports everything it uses, so the scroll back moves there verbatim and its functions become private. keyboardScrollBack.ts and its five exports go. Its four stores keep their shared keys, now named for keyboardTarget. focusKeyboard.shared.test.tsx is as on main: the shared-identity source check covers the stores. Behavior is unchanged. * docs(AST-099): name the keyboard module's new cross-module exports Current-state impact names the five exports the keyboard path adds and why each one is needed: the input stream's two touch counts, keyboardHeight's finger read and visual-viewport pan, and keyboardTarget's clearance at the first report. * Merge the open-on-press change into the rect morph stack * Merge the open-on-press change's rework * docs(AST-099): Gap 19, a field in a modal sheet shorter than tall FR9's implementation gaps gain Gap 19. A modal BottomSheet shorter than tall is a full-viewport dialog with no scroller, and BottomSheet's keyboard path runs only for a tall sheet. So a field there keeps the browser's own reveal, and Chrome on Android pans the page. * refactor(DropdownMenu): grow with the page, on Popover's surface motion * docs(Popover): name the surface motion options DropdownMenu passes * Merge main * Merge main * Merge the open-on-press change into the rect morph stack * Merge the open-on-press change's main merge * test(DropdownMenu): read the row under a held finger once the grow rests * docs(AST-099): name Gap 19 where the fields meet FR9 The implementation-gaps lead, Gap 2 and family:input-fields' FR13 status line say TextInput, TextArea and NumberInput meet FR9 apart from the missing scroll range. They now also name Gap 19, a modal BottomSheet shorter than tall. * refactor(input): one touch reader in the input stream isTouchOnScreen and getTouchStartCount become one reader, getTouches. It returns the record the stream already keeps: the fingers on the screen and how many touches started. The keyboard module reads it at each of its five places. No behavior changes, and the same tests pass through the one reader. * docs(AST-099): name the input stream's one touch reader AST-099's current-state list names getTouches, the one reader that replaces isTouchOnScreen and getTouchStartCount. * Merge commit '7e7fbae0fa0ba389ad37fafdb26e6495fab19fd4' into motion/rect-morph # Conflicts: # packages/core/src/SegmentedControl/useSegmentedSelectionMotion.ts * Merge main into the rect morph stack * Merge main and the rect morph stack's live head * docs(AST-094): name the morph path module * Merge commit '6176b9dccc1986b83713e4c9dcf39688e7c5b3e6' into motion/rect-morph * docs(AST-094): name the rect morph module * refactor(Popover): name the tap hold until the grow's first frame * Merge main into the rect morph stack * Merge main and the rect morph stack's live head * refactor(DropdownMenu): grow on Popover's own surface motion * Merge main, without the rect morph stack * fix(Popover): grow from the trigger's box without its press scale * Merge main for useCommittedRefInto * fix(DropdownMenu): commit presentSurfaceRef through useCommittedRefInto * refactor(DropdownMenu): read the click's press from the press model * docs(DropdownMenu): record the press report and the entrance without one * docs(DropdownMenu): word the press records in the present tense * Merge main for the press model's committed refs * fix(DropdownMenu): mark a finger's open only where the menu opens * Merge main * fix(DropdownMenu): tie a finger's open to its gesture * fix(core): keep the keyboard store apart from copies of another shape The hide's touch count changes the keyboard store's shape, so its shared key moves to version 2. A copy of Core built against the earlier shape keeps its own store, as spec:AST-110 FR3 requires. A case puts an earlier copy's listening store under version 1: the package keeps its own store and reads its own height, and the other store keeps its height and shape. On version 1 the package reads the other copy's 300 px. touchQueries.ts's comment also names the scroll back from the blur among isIosWebKit's readers. * fix(DropdownMenu): an open from code plays the layer's entrance A Reduce Motion comment drops a claim a reduced-motion theme breaks. * Merge main * refactor(core): state the keyboard store's constraint in its comment The version comment now says what the store holds and why a copy of Core with another store shape keeps its own, instead of how the version came to change. * Merge main for the menu press's touch identifier * fix(DropdownMenu): under Reduce Motion a menu fades out where it stands * Merge main * Merge main for the menu's show and hide refs at commit * Merge main * fix(DropdownMenu): say Reduce Motion fades only on a coarse pointer * Merge main for the layer's show from another trigger * Merge main * Merge main * Merge main for the alert dialog's touch motion and the swipe actions * Merge main for the popover's focus-return target * fix(Layer): an exit copy keeps the padding and colors of what it copies * Merge the exit copy fix, with main * test(DropdownMenu): a finger's close copy draws the menu's rows in place * test(Layer): the browser's popover style reaches the exit copy * docs(DropdownMenu): the press model's record says why no engine fits * Merge the exit copy fix's test update * Merge main into the exit copy fix * Merge main for the kept-inside hold's release * fix(menu press): cancel a pick's touchend on the node the touch began on A finger's pick that closes the menu can take its row out of the document before the touch's touchend arrives: a pick in a submenu does. The browser still sends that touchend to the row, but the window, where the click guard listened, never receives it. So the touchend went uncancelled, and the browser's click for it reached the control under the finger once a busy main thread had outlasted the 400 ms click guard. The menu press model now keeps the node the touch began on, from the touchstart that names the touch, and the click guard also listens for the touchend there. One listener cancels it, and both stop together. The menu still closes at the pick. * Merge main into the exit copy fix * Merge main * Merge main * Merge main * Merge main * Merge main * fix(DropdownMenu): a finger's open that waits still grows * Merge main * Merge main * Merge main * docs(keyboard): record Back in Firefox for Android as a gap Main shows it too. * docs(keyboard): say that Gap 21 shows more often on main * Merge #9777 * Merge #8080 * docs(keyboard): narrow the changeset for Back in Firefox for Android Gap 21 names FR9 and no longer names main. * test(DropdownMenu): pin a waiting finger open that another press leaves * Merge main * Merge #9777 * Merge #8080 * Merge main * Merge #9777 * Merge #8080 * Merge main * Merge #8080 * Merge main * Merge #8080 * Merge main * Merge #8080 * Merge main * Merge #8080 * Merge main * Merge #8080 * fix(DropdownMenu): one top-layer shield for a finger's open A finger's open raised two viewport shields: the hold until the grow's first frame keyed on the menu's surface, and the entrance hold on its popover. Each showed its shield in the top layer, which forces a style update in the open's task. The touch presentation's holds now key on the top-layer popover around the surface (holdLayerOf), so they share one shield. The gap until the first frame stays held over the viewport. * Merge #8080 * Merge main * Merge #8080 * ci: record the Chromium time of the new DropdownMenu touch-grow spec The pr-interaction leg that ran it took 13.2 s for its 11 tests, timed as recordLog times a file. Without a time, fewer than nine in ten of the interaction specs on main plus this change have one. * Merge #8080 * ci: record the Chromium time of the new DropdownMenu tap-through spec The pr-interaction leg that ran it took 10 s for its 3 tests, timed as recordLog times a file. Without a time, fewer than nine in ten of the interaction specs on main plus this change have one. * Merge main * Merge #8080 * Merge main * Merge #8080 * Merge main * Merge #8080 Co-authored-by: Cindy Zhang <[email protected]>
…12179) * feat(core): one progress module for the motion foundation progressCurve, mapProgress, mapRange and presentedProgressVelocity in motion/progress.ts, internal, one velocity unit (progress per second). Rebuilt on main from the pull request's own change, without the open dependency chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]> * refactor(animatedLayout): take the settle spring's progress from progressCurve CodeBunny on #9755: springProgress solved the same spring as progressCurve. It now reads progressCurve (remaining = 1 - progress), so one implementation remains. Same curve, same settle epsilon (0.001) and duration. * feat(core): the rect morph's paths, the rect a grow-out presentation shows at each progress lerpPath, edgeGrowPath, each path's restartFrom and morphCurves in motion/morphPath.ts, internal. Pure geometry over a progress curve: the caller chooses the timing. Rebuilt on the progress module from the pull request's own change, without the open chain it no longer needs. Co-authored-by: Cindy Zhang <[email protected]> * Merge remote-tracking branch 'origin/main' into motion/morph-path # Conflicts: # packages/core/src/motion/README.md * feat(core): one rect morph for touch presentations that grow out of a source rect createRectMorph in motion/rectMorph.ts, internal: present along a path and dismiss back onto a copy or the element, each continuing the other from the rect on screen. Rebuilt on main from the pull request's own change and ported to main's engine (createMotionAnimator). Timing follows the owner's rule for touch motion: present and dismiss take a motion, either a theme duration and easing (a tap, a key, the program) or a spring (a gesture's release, from its velocity). timedProgressCurve joins the progress helpers. architecture:react-component-runtime INV12 records the implementation gap: the size-change glide moves onto the morph next. Co-authored-by: Cindy Zhang <[email protected]> * feat(TextInput, TextArea, NumberInput): fields stay above the keyboard Each passes its input to `useMobileKeyboard` from its own render, with no prop and no Effect of its own. On focus the field decides where it is: inside a keyboard target such as a Tall BottomSheet it moves nothing; in an app's bar docked at the viewport's bottom, the bar rides the keyboard, its bottom on the keyboard's top; in scrolling content, its nearest scroller, the document included, scrolls it 10 px above the keyboard in the keyboard's report. In a fixed container the app positions itself, a scroller around the field reveals it, and with none the browser's own reveal stays. Its first tap and focus moves into it arrive without the browser's reveal where the module places the field, so the page never pans there. A scroll area does not gain the range it lacks at its end yet. Where a field's scroll area cannot place it, the document reveals it, in the page and in a fixed container where the document's scroll moves the container, as in Safari while its keyboard shows; elsewhere Core scrolls the document back. Where the document cannot scroll far enough, as at a short page's end in Chrome, a pan of the visual viewport takes the rest in the same frame (`panVisualViewportTo`): a probe fixed in the layout viewport is scrolled into view, as the reveal-pan watch puts a pan back. The watch takes Core's own pan as the new rest. Firefox for Android does not pan for the probe. A page with nothing to scroll keeps the browser's own reveal. On Chrome's show, a docked bar first sets its field 4 px above the keyboard's top at once, as the Tall sheet does, and only the rest rides, so Chrome's own pan finds the field clear. Every viewport report now feeds the ride's reveal-pan watch, so a pan Chrome still makes is put back, and a pan made at one keyboard height goes back at the next. Under Remove animations, Gboard first reports a keyboard 48 px tall, and Chrome may then reveal the bar's field itself: it scrolls the page behind the bar, then pans. In Chrome, the ride's watch scrolls the document back as well, when the scroll and the pan centre the field as Chrome's reveal does; the app's own scroll to another element stays. On iOS, a reveal that places the field rises on the browser's smooth scroll from the keyboard's first report, which comes as the keyboard starts to slide, so the field rises beside it (`risesSmoothly`, which reads Core's iOS WebKit check, `isIosWebKit`). The scroll back records where the rise is headed, and a rise still on its way when the keyboard changes height carries on from its target. Under Reduce Motion, in a theme that reduces motion for everyone, and in Chrome, which checks the field in the resize's own commit, the reveal moves at once. The rise and the scroll back ask the motion module's new `reducesMotion`, beside `reducedMotionFade`, which now uses it, so a theme that reduces motion for everyone counts as the setting for both. A scroll area's reveal goes through its own `scrollBy` with an explicit behavior where it has one, so a smooth `scroll-behavior` on the area cannot slow an instant reveal, as the Tall sheet's reveal already does. When the keyboard closes, each scroller a reveal moved scrolls back to where it was (keyboardScrollBack.ts), on the browser's smooth scroll. Safari on iOS reports the keyboard gone about half a second after the blur that closes it, once it is down. There the scroll back starts at that blur, once the focus change settles on nothing that brings up a keyboard with no finger on the screen, and slides down beside the keyboard; the report only confirms it. A finger then can be a tap that brings the keyboard back, so the report decides, as elsewhere and under Reduce Motion, where the scroll lands at once. Safari applies a scripted scroll a frame late, so a scroll set each frame jitters. A scroller the person scrolled meanwhile keeps their scroll. A field that gains focus during the slide stops the scroll back where the page is (`stopKeyboardScrollBack`), and its reveal goes on from there as Core's own scroll. A sandbox page puts three fields in the middle of a page that scrolls the document. Each field's `.keyboard.test.tsx` drives the keyboard module's test double. Mobile keyboard stories on TextInput place the fields low in the page, a TextInput in a toolbar fixed at the bottom (docked, floating above the edge, or with its own `translate`), a last field at the end of a short page and of a scroll area, a scroll area low on the page, a scroll area in a floating panel and in a full-viewport panel, and a field in a sheet of a set height. Firefox for Android can carry the reveal's document scroll as a visual-viewport offset, show the document where it was before the reveal at the keyboard's hide report, and turn the offset back into a document scroll only after it. The scroll back then waits up to a second for the first document scroll: one that lands where Core left the document is the browser's own, and the scroll back follows it. A touch, a keyboard that comes back, the field's page going, or the wait's end puts nothing back. The reveal-pan watch's touch flag now holds through a report that comes while a finger is on the screen. In Firefox the toolbar hides in a drag, which changes the measured keyboard height mid-drag; the watch then took the drag's own pan for the browser's and put it back. The input stream now counts the fingers on the screen from touch events (`isTouchOnScreen`), only while `touchend` and `touchcancel` are heard. A native pan keeps a finger there, though its `pointercancel` drops the press from `getDownPresses`, so that record cannot serve. The watch's shared touch subscription hears those two types, and a report reads the count. After the show's first reveal, a keyboard report reveals nothing while a press that started after the last reveal is down. In Firefox the toolbar hides in a drag, and the reveal re-applied itself with small scrolls under the person's finger. The report's height is kept, so the field stays where the person put it, and a later report with the finger up reveals it as before. The press that focused the field holds nothing: a long press focuses with the finger still down, and Gboard can report a 48 px keyboard first, then its full height. The input stream also counts the touches that start (`getTouchStartCount`), and each reveal notes that count. The keyboard module reads the finger count through `isFingerOnScreen`: a finger down at the keyboard's last hide counts no more until a touch starts, since a touch whose target leaves the page ends at a node the window never hears. The count includes a stylus, whose drag moves the page as a finger does. Nine unit tests cover the scroll back from the blur on iOS: it starts at the blur and the report moves nothing more; focus that moves on to another field or into a frame keeps the page; a finger on the screen at the blur leaves it to the report; a person's scroll stands; Reduce Motion waits for the report; a field focused again during the slide stops the scroll back and rises from where the page is, or stays where a touch stopped it with nothing left to raise; and the next close goes back to the first place, at a blur or at a report. Six unit tests cover the scroll back: the page's smooth scroll at the report (nothing before it), Reduce Motion, a theme that reduces motion, a person's scroll kept, a scroll area after Back, and a focus move to another field. Firefox-shaped cases carry the reveal as an offset and close the keyboard before the fold: the scroll back follows the fold, a touch-drag control keeps the page, only the first document scroll counts, and each way the wait ends leaves no scroll listener. Safari's and Chrome's close sequences still decide at the report, with no wait. A Firefox-shaped drag grows the viewport twice with the finger down and finds no put-back; after the finger is up, a browser pan is put back. Another drags the page with the toolbar hiding twice and finds no reveal scroll until the finger is up. A long press focuses the field while Gboard grows from 48 to 290 px, and the field is revealed at 290; the next show's first reveal runs again under the same press, and a press that starts after the reveal holds the next report until it lifts. After the keyboard goes with no finger down, a long press that brings it back is revealed with that press still down. Another holds a report while the long press's finger stays down after a second finger tapped and lifted. Another misses a touch's end, as when its target leaves the page, and finds a browser pan put back once the keyboard has hidden and shown again. The input stream's tests count fingers through a second finger, a cancel and a native pan's `pointercancel`, count nothing while a touch end could go unheard, and count the touches that start. Six cover the rise on iOS: its smooth scroll, Reduce Motion, a theme that reduces motion, the scroll back after a rise drawn later, a rise carried on at a new height, and no second reveal while a scroll area's rise is drawn. Their CSS.supports stub answers both of Safari's forms, a property and value or a condition. Another drives a scroll area with a smooth `scroll-behavior` and finds its own `scrollBy` called at once. Two in the motion module cover `reducesMotion`: the setting, and a theme that reduces motion for everyone. * fix(rectMorph): a handed-in animator stays on the element through a copy dismissal CodeBunny on #9769: a dismissal onto a copy detached the animator, and a handed-in one was never attached again, so its owner's writes stopped reaching the element. Only the morph's own animator lets go now. Co-authored-by: Cindy Zhang <[email protected]> * fix(motion): one timed curve keeps a retargeted velocity, for the pager and the morph CodeBunny on #9769: solveAnimatedPageScroll already played this curve and keeps the velocity of the move it retargets. timedCurve in progress.ts is now that one curve; the pager and the morph's timed motion call it, so a timed present that interrupts a dismissal keeps its velocity. The INV12 note states the system only. File header and comments trimmed. Co-authored-by: Cindy Zhang <[email protected]> * fix(rectMorph): a timed motion from rest plays its easing as given CodeBunny on #9769: with nothing in flight the morph handed timedCurve a velocity of 0, which it treats as a retarget and uses to cancel the easing's starting slope. Only a motion in flight hands its velocity on now; tests check a present from rest and a dismissal from a settled present against the easing itself. Header and comments shortened. Co-authored-by: Cindy Zhang <[email protected]> * docs(rectMorph): the timing follows the component's motion record The type's doc, the example and the changeset name no rule of their own about which input plays which timing: each play takes the timing the adopting component's motion record names (AST-094 FR45). Co-authored-by: Christopher Chedeau <[email protected]> * docs(AST-099): TextInput, TextArea and NumberInput meet FR9 FR9's scrolling-content bullet adds the spec owners' sentence: where a browser carries out the document's scroll by moving the visual viewport, that offset is the reveal, not a pan. Gap 2 is met. Gaps 1, 10 and 11 say what the three fields now do. Gap 11 keeps the missing scroll range as the fix; until a scroller gains it, Core pans the visual viewport where the document cannot scroll far enough. Two verification rows cover Firefox for Android (the offset equals the computed reveal) and Chrome (no pan added after Core places the field). Chrome's names the cases Core pans, and fails a field Core pans that ends other than 10 CSS px above the keyboard. In Firefox for Android the pan moves nothing where the page has no scroll range; Gap 11 names those cases. The device-evidence row records that a docked toolbar resting under the keyboard while a field outside it has focus is not a failure. BottomSheet's height doc says what such a field gets in a sheet that is not a fully expanded Tall sheet. FR9's scrolling-content bullet adds the close: each scroller that revealed the field scrolls back to where it was before the reveal, and a scroll the person made while the keyboard showed is kept. A verification row covers a field in the middle of a page that scrolls the document. FR9's scrolling-content bullet adds the open: on iOS the field rises on the browser's own smooth scroll beside the keyboard's slide, settling within 0.15 s after the keyboard settles, and it moves in one frame under Reduce Motion, in a theme that reduces motion for everyone, and in other browsers. A verification row reads every drawn frame of the rise. Gap 13 records Chrome's rise, which stays in one frame because Chrome checks the field in the resize's own commit; Firefox for Android takes the same path. The device-evidence row's failure for a reveal later than the keyboard's report notes that on iOS the rise starts in that frame and settles as FR9 states. FR9's scrolling-content bullet adds the hold: a show's first report always places the field, and a later report that comes while a finger is down, after a touch has begun since the field's last placement, moves nothing. FR9's close adds that at the hide report, Firefox for Android can still show the document where it was before the reveal, and turns the reveal back into a document scroll only after that report; the scroll back follows that scroll. A row closes the keyboard with Back in Firefox for Android at normal speed and on a slow profile. The input-fields family's FR13 status says the same: the three fields meet FR13 through FR9, apart from Gap 11. FR9's close now starts the scroll back at the blur that closes the keyboard in Safari on iOS, beside the keyboard's slide; the report that the keyboard has gone comes later and only confirms it. Elsewhere it starts at that report, and under Reduce Motion, and in a theme that reduces motion for everyone, it lands at once there. A scroller the person scrolled keeps the person's scroll, a finger on the screen at the blur leaves the scroll back to the report, and a field that gains focus during the slide stops the scroll back where the page is. Safari's close row reads every drawn frame from Done until the page rests, and adds a tap on the field 80 ms and 150 ms after Done. The open sentence is rewrapped, word for word. * Merge main into motion/morph-path * Merge motion/morph-path into motion/rect-morph Main renamed the engine's factory to createMotionEngine. The merge takes that name in the test bundle and in rectMorph and its tests. * fix(rectMorph): AST-094 links the morph; the proof imports a safe test The morph's comment cited AST-094 FR45 as its only link to that record. AST-094 now lists the file, and the comment keeps the fact without the citation. The proof imports `test` from the a11y-spec package, whose contexts reach no remote host, as main's lint asks. * test(SnapPaging): the pager's bundle lists the progress module The pager's timed settle takes its curve from motion/progress.ts, so the hook adds that module over Carousel alone. The bundle test lists it as pager code. * test(motion): the popover's proofs read Popover's live geometry The morph's popover proofs played a copy of Popover's growth that had drifted: it lacked the overlap rule, so an overlapping popover grew from its left edge where Popover grows from its top. The proofs now import popoverCollapsedState, popoverFrame and frameOf from Popover. A new overlapping case, which the deleted copy fails, pins the growth from the top edge. * Merge motion/morph-path into motion/rect-morph * refactor(motion): one eased progress, with a retargeted velocity The rect morph's timedProgressCurve played, from rest, the curve that easedProgress already plays for Popover, SegmentedControl and the layout glide. easedProgress moves into progress.ts and takes an optional velocity: the Hermite carry that the pager and the morph use. From rest its values do not change. Its velocity is a central difference that stays inside the curve, and from rest it starts on the curve's own slope. timedProgressCurve goes, and timedCurve maps easedProgress onto values, keeping only its carry for no distance. * test(motion): the popover's turn-around reads Popover's live curves The morph's turn-around proof compared restartFrom with lines written in the test, so a change to Popover's readState or surfaceCurves left it green. Popover exports both for the proofs, which now replay its own turn-around. morphPath.ts's header keeps only its tags: the paths' own JSDoc says the rest. * Merge motion/morph-path into motion/rect-morph * docs(changeset): the rect morph's note names the eased-progress move The note said timedProgressCurve joins the progress helpers, which this pull request no longer adds. It now says easedProgress moves to them with a retargeted velocity, and timedCurve joins them. * Merge main into motion/rect-morph Main's Popover touch growth, which plays on the surface and floors its opacity curve with motion/opacityFloor.ts, meets the rect morph's move of easedProgress into motion/progress.ts in the imports of popoverSurfaceMotion.ts. The merge keeps both: the floor's import, and easedProgress from progress. * test(motion): the popover's turn-around compares opacity as drawn Popover's surface curves now stop their opacity at 0 or a floor above it. Past its end, a turn-around toward the source takes the popover path's opacity below 0, where Popover's stops at 0. An opacity draws clamped to 0 through 1, so both draw 0. The proof now compares the two as drawn, which holds with Popover's curves before and after the floor. * Merge motion/morph-path into motion/rect-morph * Merge main * fix(motion): a popover's morph never reads an opacity below 0 A popover's grow path read its opacity on a straight line, so before its start and past its end it went below 0: a turn-around toward the source read -0.025 at 1.05. An opacity below 0 draws as 0, so opacityAt now stops at 0. The popover proofs compare opacities as drawn, since Popover's own model still reads below 0 there. * Merge motion/morph-path into motion/rect-morph * feat(DropdownMenu): a finger or a pen opens the menu as it presses Under a finger or a pen, a DropdownMenu or MoreMenu trigger opens its menu as it is pressed, instead of after a 500 ms hold (spec:AST-094 FR29, FR43). Inside a scroll view it opens once the 150 ms content-touch delay passes with no scroll, so a scroll that starts on the trigger still scrolls. The finger that opened the menu picks a row only after moving 10 px. presentation="popover" keeps the previous behavior. useMenuPress with no longPressDelayMs follows the same rules, and longPressDelayMs: 500 keeps the previous hold. * test(motion): the morph proofs drop the menu's old straight line The anchored menu's case modeled a straight line from a 22 px square on its control. The menu now grows out of its trigger on Popover's edge path, which the popover cases already check, so the case no longer describes any presentation's model. The file header follows. * Merge main * Merge main * docs(DropdownMenu): open-on-press notes name the anchored menu A menu shown as a bottom sheet still opens at the tap's click, so the release note names the anchored menu, as the press does. The hook's doc names a finger or a pen on every device, as the hook acts. * Merge main * sandbox: a page to try a menu's press under a finger A raw page that scrolls with the document. Its Actions menu sits in a fixed top bar, so it opens as a finger presses it, and a slide onto a row runs that row once. Its More menu sits in the page, so a flick that starts on it scrolls the page. The bar shows which row ran and how many times. * Merge main * Merge the open-on-press change into the rect morph stack * feat(DropdownMenu): a finger's open grows the menu out of its trigger Under a finger or a pen, a DropdownMenu or MoreMenu grows out of its trigger as it opens and shrinks back into it as it closes. It plays on the shared rect morph, on the popover's path and timing, so it grows as a Popover does. A tap's open grows as a hold's does: the open at a tap's lift used to take the mouse's path. The grow's code loads at the first touch on the page or on a trigger. A mouse, the keyboard and presentation="popover" keep the layer's own entrance. * fix(DropdownMenu): under Reduce Motion a finger's open only fades in Under Reduce Motion, a finger's open played the grow, which the animator turns into a dip: for its first half the menu sat collapsed at the trigger. A resting mouse's click then missed the row it rested on. The open now keeps the layer's own entrance, which only fades in where the menu rests, as before the grow. FR21 and the changeset say so. * test(DropdownMenu): touch specs wait out a finger's grow A finger's grow starts a frame after the open, or once its code arrives, and holds input until its curve ends. The press specs now wait for three still frames, and the entrance-hold spec waits for the grow to start and for its natural end. Finishing its animations from a script leaves the grow's hold in place until its curve ends. * refactor(core): one Reduce Motion predicate for the animator and menu The menu's glue copied the animator's Reduce Motion read. A leaf module now holds the one predicate: the person's setting, or a theme that reduces motion for everyone. The animator, the Reduced Motion policy and the glue call it. It imports no motion code, so the glue reads it without the animator in DropdownMenu's static bundle. No behavior changes. * fix(DropdownMenu): every copy of Core shares the grow's one load The menu kept its loaded grow code, the load in flight and the replaceable import in module scope. Every copy of Core now shares them under a registered key. A change to the module's calls bumps the version, so each copy then keeps its own. * fix(DropdownMenu): taps stay off the page until the menu shows Under a coarse primary pointer, the grow takes its input hold at its first frame. Before that frame, a tap reached the page: on an open with the code loaded, and on the first open between the code's arrival and the grow. A hold now lasts from the open until the grow's first frame. The press model's unit cases stub the presentation's hold, as jsdom never ends the grow. * docs(AST-094): FR31 grows once the grow's code is loaded Until the code is loaded, an open fades. Only an open before the code first loads in a page session can fade: the first open, or an open after a failed load. * Merge main * docs(AST-094): FR31's faded open closes with no shrink An open before the grow's code loads fades, and its close plays no shrink, as the DropdownMenu record's FR21 states. * fix(keyboard): the scroll back's records are one per page across copies keyboardScrollBack.ts keeps its four per-window stores under registered shared keys, as main now keeps the rest of the keyboard model. A swizzled copy's field and the package's field then note into one record, so one scroll back runs per page. The shared-identity check flagged the four module-scope stores after the merge of main. focusKeyboard.shared.test.tsx gains a case: the package sees where a copy's scroll for the keyboard is headed. * fix(DropdownMenu): the grow's code loads through the shared loader The grow's code now loads through the shared module loader that the menu's bottom sheet uses, as the import boundaries require. A failed load warns once in development builds, and the next open still asks again. The DropdownMenu record's FR21 names when the code loads: at a trigger's first touch, or the page's first touch where touch is the primary input. * Merge main * fix(keyboard): a field focused as it mounts starts its session at attach A TextInput, TextArea or NumberInput with hasAutoFocus has focus before the keyboard path attaches, so no later focus event starts its session, and it kept only the browser's own reveal. keepFieldAboveKeyboard now starts the session at attach when the field already has focus. Every other route is unchanged. Each field's keyboard test gains a hasAutoFocus case, which fails without the fix. * Merge main * Merge the open-on-press change into the rect morph stack * Merge main and the open-on-press change * Merge commit 'ebb9ddecc0219bc6eaf3caf40b6e4e45f81dc0e5' into motion/rect-morph * fix(motion): existing callers keep easedProgress's values; the pager and the rect morph use timedCurve easedProgress moves to the progress helpers byte for byte, so Popover and SegmentedControl read the same positions and velocities as on main. timedCurve is the pager's curve as on main, with one change: from rest, its velocity at t <= 0 is the curve's own starting slope. The rect morph plays its timed motion on timedCurve from 0 to 1. callerMotionValues.test.ts pins easedProgress and the pager on a fixed grid, bit for bit, to main's values. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * test(paging): a retarget at the first instant goes on at the starting speed A linear move of 300 px over 0.3 s, retargeted at t = 0, reads 0 px/s on main, so the retarget starts from rest. Now it reads about 1000 px/s, the curve's own starting slope, and the retarget keeps that speed. The position stays continuous. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * test(paging): a 0 ms move is on its target at once, at rest On main a 0 ms animated scroll reads NaN at t = 0 and its start position before it. timedCurve's 0 ms guard puts it on its target with no speed, as the rect morph's 0 ms timing does. * test(motion): compare the callers' values with copies of the earlier functions A float64 hash of easedProgress's values is not the same on every platform: macOS arm64 and CI's Linux give different hashes for main's code. The test now keeps copies of easedProgress and solveAnimatedPageScroll as they are on main (ebb9dde), and checks that the shipped functions give the same number, bit for bit (Object.is), for each position and velocity on the grid. From rest, the pager's velocity at t <= 0 stays the one value left out. Based on vjeux's test (vjeux/astryx coverage/rect-morph-first-instant) * Merge the open-on-press change into the rect morph stack * Merge the rect morph's new head * refactor(core): one useMenuPress for every menu * refactor(keyboard): read Reduce Motion through reducedMotionFade The keyboard path asks the Reduced Motion policy that already serves motion the animator does not drive: reducedMotionFade(element) is null when motion is not reduced. That answer counts the person's setting and a theme that reduces motion for everyone, as before. reducesMotion, which this branch added to reducedMotion.ts, goes, so reducedMotion.ts, its test and the motion README are as on main. Behavior is unchanged. * refactor(keyboard): the scroll back lives in keyboardTarget.ts keyboardTarget.ts, the scroll back's only caller, already imports everything it uses, so the scroll back moves there verbatim and its functions become private. keyboardScrollBack.ts and its five exports go. Its four stores keep their shared keys, now named for keyboardTarget. focusKeyboard.shared.test.tsx is as on main: the shared-identity source check covers the stores. Behavior is unchanged. * docs(AST-099): name the keyboard module's new cross-module exports Current-state impact names the five exports the keyboard path adds and why each one is needed: the input stream's two touch counts, keyboardHeight's finger read and visual-viewport pan, and keyboardTarget's clearance at the first report. * Merge the open-on-press change into the rect morph stack * Merge the open-on-press change's rework * docs(AST-099): Gap 19, a field in a modal sheet shorter than tall FR9's implementation gaps gain Gap 19. A modal BottomSheet shorter than tall is a full-viewport dialog with no scroller, and BottomSheet's keyboard path runs only for a tall sheet. So a field there keeps the browser's own reveal, and Chrome on Android pans the page. * refactor(DropdownMenu): grow with the page, on Popover's surface motion * docs(Popover): name the surface motion options DropdownMenu passes * Merge main * Merge main * Merge the open-on-press change into the rect morph stack * Merge the open-on-press change's main merge * test(DropdownMenu): read the row under a held finger once the grow rests * docs(AST-099): name Gap 19 where the fields meet FR9 The implementation-gaps lead, Gap 2 and family:input-fields' FR13 status line say TextInput, TextArea and NumberInput meet FR9 apart from the missing scroll range. They now also name Gap 19, a modal BottomSheet shorter than tall. * refactor(input): one touch reader in the input stream isTouchOnScreen and getTouchStartCount become one reader, getTouches. It returns the record the stream already keeps: the fingers on the screen and how many touches started. The keyboard module reads it at each of its five places. No behavior changes, and the same tests pass through the one reader. * docs(AST-099): name the input stream's one touch reader AST-099's current-state list names getTouches, the one reader that replaces isTouchOnScreen and getTouchStartCount. * Merge commit '7e7fbae0fa0ba389ad37fafdb26e6495fab19fd4' into motion/rect-morph # Conflicts: # packages/core/src/SegmentedControl/useSegmentedSelectionMotion.ts * Merge main into the rect morph stack * Merge main and the rect morph stack's live head * docs(AST-094): name the morph path module * Merge commit '6176b9dccc1986b83713e4c9dcf39688e7c5b3e6' into motion/rect-morph * docs(AST-094): name the rect morph module * refactor(Popover): name the tap hold until the grow's first frame * Merge main into the rect morph stack * Merge main and the rect morph stack's live head * refactor(DropdownMenu): grow on Popover's own surface motion * Merge main, without the rect morph stack * fix(Popover): grow from the trigger's box without its press scale * Merge main for useCommittedRefInto * fix(DropdownMenu): commit presentSurfaceRef through useCommittedRefInto * refactor(DropdownMenu): read the click's press from the press model * docs(DropdownMenu): record the press report and the entrance without one * docs(DropdownMenu): word the press records in the present tense * Merge main for the press model's committed refs * fix(DropdownMenu): mark a finger's open only where the menu opens * Merge main * fix(DropdownMenu): tie a finger's open to its gesture * fix(core): keep the keyboard store apart from copies of another shape The hide's touch count changes the keyboard store's shape, so its shared key moves to version 2. A copy of Core built against the earlier shape keeps its own store, as spec:AST-110 FR3 requires. A case puts an earlier copy's listening store under version 1: the package keeps its own store and reads its own height, and the other store keeps its height and shape. On version 1 the package reads the other copy's 300 px. touchQueries.ts's comment also names the scroll back from the blur among isIosWebKit's readers. * fix(DropdownMenu): an open from code plays the layer's entrance A Reduce Motion comment drops a claim a reduced-motion theme breaks. * Merge main * refactor(core): state the keyboard store's constraint in its comment The version comment now says what the store holds and why a copy of Core with another store shape keeps its own, instead of how the version came to change. * Merge main for the menu press's touch identifier * fix(DropdownMenu): under Reduce Motion a menu fades out where it stands * Merge main * Merge main for the menu's show and hide refs at commit * Merge main * fix(DropdownMenu): say Reduce Motion fades only on a coarse pointer * Merge main for the layer's show from another trigger * Merge main * Merge main * Merge main for the alert dialog's touch motion and the swipe actions * Merge main for the popover's focus-return target * fix(Layer): an exit copy keeps the padding and colors of what it copies * Merge the exit copy fix, with main * test(DropdownMenu): a finger's close copy draws the menu's rows in place * test(Layer): the browser's popover style reaches the exit copy * docs(DropdownMenu): the press model's record says why no engine fits * Merge the exit copy fix's test update * Merge main into the exit copy fix * Merge main for the kept-inside hold's release * fix(menu press): cancel a pick's touchend on the node the touch began on A finger's pick that closes the menu can take its row out of the document before the touch's touchend arrives: a pick in a submenu does. The browser still sends that touchend to the row, but the window, where the click guard listened, never receives it. So the touchend went uncancelled, and the browser's click for it reached the control under the finger once a busy main thread had outlasted the 400 ms click guard. The menu press model now keeps the node the touch began on, from the touchstart that names the touch, and the click guard also listens for the touchend there. One listener cancels it, and both stop together. The menu still closes at the pick. * Merge main into the exit copy fix * Merge main * Merge main * Merge main * Merge main * Merge main * fix(DropdownMenu): a finger's open that waits still grows * fix(menu press): swallow a Home Screen app's late click after a pick * test(menu press): a later tap still acts; cite the records exercised * Merge main * Merge main * Merge main * docs(keyboard): record Back in Firefox for Android as a gap Main shows it too. * docs(keyboard): say that Gap 21 shows more often on main * Merge #9777 * Merge #8080 * Merge #11859 * docs(keyboard): narrow the changeset for Back in Firefox for Android Gap 21 names FR9 and no longer names main. * test(DropdownMenu): pin a waiting finger open that another press leaves * Merge main * Merge #9777 * Merge #8080 * Merge #11859 * Merge main * Merge #9777 * Merge #8080 * Merge #11859 * Merge main * Merge #8080 * Merge #11859 * Merge main * Merge #8080 * Merge #11859 * Merge main * Merge #8080 * Merge #11859 * Merge main * Merge #8080 * Merge #11859 * Merge #11859 * Merge main * Merge #8080 * fix(DropdownMenu): a pick's late click stays guarded after touchend WebKit in a Home Screen web app can still send the mousedown, mouseup and click after a menu pick's cancelled touchend, also when the touch's touchstart was cancelable. The menu press model's click guard now stays armed after that touchend, until the next pointerdown or the 400 ms window. It takes only the browser's own late events there (isTrusted, through utils/eventTrust.ts): a page's dispatchEvent or click() still acts. A click whose detail is 0 still acts. Other arms keep the early disarm. * fix(DropdownMenu): one top-layer shield for a finger's open A finger's open raised two viewport shields: the hold until the grow's first frame keyed on the menu's surface, and the entrance hold on its popover. Each showed its shield in the top layer, which forces a style update in the open's task. The touch presentation's holds now key on the top-layer popover around the surface (holdLayerOf), so they share one shield. The gap until the first frame stays held over the viewport. * Merge #8080 * Merge #11859 * refactor(clickGuard): keep the trust read in clickGuard.ts The trust read belongs to the guard, so it stays in the guard's module. The read and its test-only setter now live in utils/clickGuard.ts, beside __resetClickGuardForTest, and utils/eventTrust.ts is gone. No behavior changes; the tests change only their import. * fix(clickGuard): register the trust read like the guard's state The trust read is module state that the test-only setter changes, so it sits under a registered key (sharedKey and realmValue), as the guard's own state does. A second copy of Core then reads trust the same way. * Merge main * chore: re-trigger the preview deployment (empty commit; tree unchanged) Co-authored-by: Cindy Zhang <[email protected]>
Supersedes #8497 by @vjeux, which stays the author of this commit. #8497's branch carries the whole open chain under #8360, about 27,000 lines against
main. This module needs nothing from that chain: everything it imports (Animator,MotionCurveandMotionPropertyfrommotion/animator;solveSpring,toSpring,SETTLING_EPSILONandSpringDescriptionfrommotion/spring) is already onmain. So this pull request is #8497's own change alone, rebuilt onmain.Maintainer impact
Motions that move several properties along one path (a popover growing out of its button while it fades in, a scrim's dim following a sheet) all need the same four pieces of math. Without one module, each presentation keeps its own copy. Several open motion pull requests build on this one.
Intended invariant
No behavior change. The module is internal, and no component imports it yet. It follows
spec:AST-094FR3 and FR6, with one velocity unit throughout: progress per second.Change
A new internal module,
motion/progress.ts, with its unit test, a README row and a[chore]changeset.animatedLayout's privatespringProgressnow readsprogressCurveinstead of solving the same spring itself, so one implementation remains (same curve, same 0.001 settle epsilon and duration):progressCurve(spring, {velocity, epsilon}): a spring's progress from 0 to 1 as a closed-form curve, exactly 1 once it settles;mapProgress(driver, f): a curve that follows another throughf;mapRange(input, output, {clamp}): the clamped linear map most companions use;presentedProgressVelocity: the progress velocity that continues what an animator shows.Evidence
main; feat(core): one progress module for the motion foundation #8497 can't merge as it stands (it carries an open chain).tscis clean against currentmain, and the 12 progress tests pass.animatedLayout's settle curve is the same spring, read as 1 − progress; the motion, List and TreeList suites pass (1,042 tests).Scope
Testing
pnpm exec vitest run packages/core/src/motion/progress.test.ts: 12 passed.useAnimatedLayout, List and TreeList suites: 1,042 passed.pnpm exec tsc -p packages/core --noEmit: clean.pnpm check:knowledge,pnpm check:changesets: pass.pnpm review:pre: 0 findings; 335 authored lines.Co-authored-by: Cindy Zhang (rebuilt on
mainfor the motion foundation stack).