@humanspeak/svelte-motion 0.1.22 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -140,10 +140,10 @@
|
|
|
140
140
|
const presenceKey = keyProp ?? `motion-${++keyCounter}`
|
|
141
141
|
|
|
142
142
|
// Track previous key for key-change detection (simulates React's key-based remounting)
|
|
143
|
-
//
|
|
144
|
-
let keyTrackerPrev =
|
|
145
|
-
let keyTrackerIsTransitioning =
|
|
146
|
-
let keyTransitionStopped =
|
|
143
|
+
// Plain variables (not $state) to avoid self-triggering the key-change $effect
|
|
144
|
+
let keyTrackerPrev = keyProp
|
|
145
|
+
let keyTrackerIsTransitioning = false
|
|
146
|
+
let keyTransitionStopped = false
|
|
147
147
|
|
|
148
148
|
// Compute merged transition without mutating props to avoid effect write loops
|
|
149
149
|
const mergedTransition = $derived<AnimationOptions>(
|
|
@@ -699,6 +699,14 @@
|
|
|
699
699
|
currentKey === keyTrackerPrev ||
|
|
700
700
|
keyTrackerPrev === undefined
|
|
701
701
|
) {
|
|
702
|
+
pwLog('[motion] key effect: early return', {
|
|
703
|
+
currentKey,
|
|
704
|
+
keyTrackerPrev,
|
|
705
|
+
isLoaded,
|
|
706
|
+
hasElement: !!element,
|
|
707
|
+
hasContext: !!context,
|
|
708
|
+
keyTrackerIsTransitioning
|
|
709
|
+
})
|
|
702
710
|
// Update prev for next comparison
|
|
703
711
|
if (currentKey !== keyTrackerPrev) {
|
|
704
712
|
keyTrackerPrev = currentKey
|
|
@@ -713,6 +721,7 @@
|
|
|
713
721
|
|
|
714
722
|
// Mark as transitioning to prevent re-entry
|
|
715
723
|
keyTrackerIsTransitioning = true
|
|
724
|
+
keyTransitionStopped = false
|
|
716
725
|
keyTrackerPrev = currentKey
|
|
717
726
|
|
|
718
727
|
// Run the key transition sequence
|
|
@@ -732,6 +741,11 @@
|
|
|
732
741
|
).finished
|
|
733
742
|
}
|
|
734
743
|
|
|
744
|
+
pwLog('[motion] key transition: exit done', {
|
|
745
|
+
keyTransitionStopped,
|
|
746
|
+
hasElement: !!element
|
|
747
|
+
})
|
|
748
|
+
|
|
735
749
|
// Check if component was unmounted during exit animation
|
|
736
750
|
if (keyTransitionStopped || !element) return
|
|
737
751
|
|
|
@@ -752,6 +766,7 @@
|
|
|
752
766
|
pwLog('[motion] key transition: running enter animation')
|
|
753
767
|
runAnimation()
|
|
754
768
|
} finally {
|
|
769
|
+
pwLog('[motion] key transition: finally', { keyTransitionStopped })
|
|
755
770
|
if (!keyTransitionStopped) {
|
|
756
771
|
keyTrackerIsTransitioning = false
|
|
757
772
|
}
|
|
@@ -762,6 +777,7 @@
|
|
|
762
777
|
|
|
763
778
|
// Cleanup on unmount
|
|
764
779
|
return () => {
|
|
780
|
+
pwLog('[motion] key effect: cleanup, stopping transition')
|
|
765
781
|
keyTransitionStopped = true
|
|
766
782
|
}
|
|
767
783
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humanspeak/svelte-motion",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "A lightweight animation library for Svelte 5 that provides smooth, hardware-accelerated animations. Features include spring physics, custom easing, and fluid transitions. Built on top of the motion library, it offers a simple API for creating complex animations with minimal code. Perfect for interactive UIs, micro-interactions, and engaging user experiences.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|