Skip to content

motion-sv@0.1.10

Choose a tag to compare

@hanielu hanielu released this 02 Feb 07:05
· 8 commits to main since this release

Patch Changes

  1. Add use-in-view and use-in-page-view

  2. πŸ› Bug Fix: AnimatePresence mode="wait" now works correctly in SvelteKit

    Fixed

    • AnimatePresence mode="wait" not working on first toggle in SvelteKit - Elements would appear immediately instead of waiting for the exit animation to complete. This was caused by SvelteKit's bundling optimization skipping the intro transition call, making the first outro call incorrectly identified as an intro.

    Changes

    • Added element exit state tracking via onoutrostart event to correctly distinguish between intro and outro transition calls
    • Used globalThis for internal WeakSet storage to ensure state persists across module boundaries in SvelteKit's bundling environment

    Details

    In SvelteKit, Svelte may optimize away the intro transition call when no animation is needed on mount. This caused the transition function to treat the first outro call as an intro (since the node hadn't been seen before), resulting in a skipped exit animation. The fix marks elements as "exiting" when onoutrostart fires, allowing the transition function to correctly identify outro calls regardless of whether an intro was previously triggered.