feat(ui): use motion for page, tab, switch and press gestures animation#2406
feat(ui): use motion for page, tab, switch and press gestures animation#2406bajrangCoder wants to merge 18 commits into
Conversation
- Replaced choppy CSS transitions on page open/close with pure GPU-accelerated fade animations using motion.dev. - Implemented a sliding active tab indicator using transform scaleX and translate3d, tracked dynamically via MutationObserver to support programmatic changes. - Refactored switch toggle check handle to use a real DOM element with snappy spring physics. - Added spring press scaling gestures (scale: 0.985) on list items, back arrows, and side buttons.
Greptile SummaryThis PR integrates the Motion library to replace CSS-only transitions with WAAPI-driven animations across the app's core UI surfaces. All new JavaScript-driven animations correctly guard against the
Confidence Score: 4/5Safe to merge with the minor hover-cleanup pattern addressed; the core animation paths and no-animation guards are correctly implemented throughout. The animations are well-guarded throughout, the passive-listener bug is fixed, the CSS transition conflicts are removed, and the tab indicator restore lifecycle is correctly hooked into the show event rather than willconnect. The remaining new observations are minor: the hover cleanup writes a hard-coded transparent inline style instead of clearing it, and page event listeners registered in tabView.js are never paired with off() calls. Neither causes a user-visible defect in current usage. src/components/settingsPage.js (hover cleanup inline-style pattern) and src/components/tabView.js (page listener accumulation). Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant WCPage
participant PageHandler
participant TabView
participant Motion
Note over User,Motion: Page open
User->>WCPage: navigate to page
WCPage->>Motion: animate(opacity 0 to 1, 140ms)
WCPage->>TabView: connectedCallback - show event
TabView->>Motion: animate indicator to active tab (spring)
Note over User,Motion: Tab switch
User->>TabView: click tab / swipe
TabView->>TabView: changeTab() classList update
TabView->>Motion: animate indicator (spring stiffness 380)
Note over User,Motion: Page swap
WCPage->>PageHandler: onshow - handlePagesForSmoothExperience
PageHandler->>WCPage: replaceEl (detach, add placeholder)
WCPage-->>TabView: willdisconnect - observer.disconnect()
PageHandler->>WCPage: restoreEl - onRestore - willconnect
WCPage-->>TabView: willconnect - observer.observe()
WCPage->>TabView: connectedCallback - show - update()
TabView->>Motion: re-animate indicator to current active tab
Note over User,Motion: Page close
User->>WCPage: back button press animation via Motion
WCPage->>Motion: animate(opacity 1 to 0, 120ms)
Motion-->>WCPage: then() remove() and handler.remove()
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant WCPage
participant PageHandler
participant TabView
participant Motion
Note over User,Motion: Page open
User->>WCPage: navigate to page
WCPage->>Motion: animate(opacity 0 to 1, 140ms)
WCPage->>TabView: connectedCallback - show event
TabView->>Motion: animate indicator to active tab (spring)
Note over User,Motion: Tab switch
User->>TabView: click tab / swipe
TabView->>TabView: changeTab() classList update
TabView->>Motion: animate indicator (spring stiffness 380)
Note over User,Motion: Page swap
WCPage->>PageHandler: onshow - handlePagesForSmoothExperience
PageHandler->>WCPage: replaceEl (detach, add placeholder)
WCPage-->>TabView: willdisconnect - observer.disconnect()
PageHandler->>WCPage: restoreEl - onRestore - willconnect
WCPage-->>TabView: willconnect - observer.observe()
WCPage->>TabView: connectedCallback - show - update()
TabView->>Motion: re-animate indicator to current active tab
Note over User,Motion: Page close
User->>WCPage: back button press animation via Motion
WCPage->>Motion: animate(opacity 1 to 0, 120ms)
Motion-->>WCPage: then() remove() and handler.remove()
Reviews (6): Last reviewed commit: "fix" | Re-trigger Greptile |
Uh oh!
There was an error while loading. Please reload this page.