@humanspeak/svelte-motion 0.4.0 → 0.4.2

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.
@@ -91,27 +91,32 @@
91
91
  // which (a) breaks any CSS transition the consumer relies on for exit and
92
92
  // (b) makes `bind:this` references go stale.
93
93
  $effect.pre(() => {
94
- // Read `present` reactively first; assignments to module locals
95
- // happen inside the branches below.
94
+ // Read both reactive sources (`present` prop + `phase` $state)
95
+ // unconditionally at the top so the effect's dependency set is
96
+ // identical on every run. Under svelte 5.55.7, conditionally
97
+ // reading `phase` inside the branches below caused the effect to
98
+ // intermittently skip re-runs after `present` flipped through
99
+ // false → true → false — so cycle B never fired its mint and a
100
+ // stale consumer-captured `safeToRemove` from cycle A was the
101
+ // only callback available (#345).
96
102
  const current = present
97
- // First run: just record the steady state. Don't fire any exit/enter
98
- // signal — there's no transition to react to yet.
103
+ const currentPhase = phase
99
104
  if (prevPresent === undefined) {
100
105
  prevPresent = current
101
106
  return
102
107
  }
103
- if (prevPresent && !current && phase === 'idle') {
108
+ if (prevPresent && !current && currentPhase === 'idle') {
104
109
  phase = 'holding'
105
110
  currentSafeToRemove = mintSafeToRemove()
106
111
  animatePresence?.notifyExitStart()
107
- } else if (!prevPresent && current && phase === 'holding') {
112
+ } else if (!prevPresent && current && currentPhase === 'holding') {
108
113
  // Re-entry mid-hold cancels the exit accounting. Replacing the
109
114
  // slot invalidates the cycle's `safeToRemove` for any consumer
110
115
  // that captured it.
111
116
  phase = 'idle'
112
117
  currentSafeToRemove = noopSafeToRemove
113
118
  animatePresence?.notifyExitComplete()
114
- } else if (!prevPresent && current && phase === 'completed') {
119
+ } else if (!prevPresent && current && currentPhase === 'completed') {
115
120
  // Re-mounted after a previous exit fully completed.
116
121
  phase = 'idle'
117
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanspeak/svelte-motion",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Framer Motion for Svelte 5. Declarative motion.<tag> components with AnimatePresence exit animations, gestures (hover, tap, drag, focus, in-view), variants, FLIP layout animations, shared-layout transitions, spring physics, and scroll-linked motion values. The drop-in Framer Motion alternative for Svelte and SvelteKit.",
5
5
  "keywords": [
6
6
  "svelte",
@@ -95,8 +95,8 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "acorn": "^8.16.0",
98
- "motion": "^12.38.0",
99
- "motion-dom": "^12.38.0"
98
+ "motion": "^12.39.0",
99
+ "motion-dom": "^12.39.0"
100
100
  },
101
101
  "devDependencies": {
102
102
  "@changesets/cli": "^2.31.0",
@@ -114,7 +114,7 @@
114
114
  "@tailwindcss/vite": "^4.3.0",
115
115
  "@testing-library/jest-dom": "^6.9.1",
116
116
  "@testing-library/svelte": "^5.3.1",
117
- "@types/node": "^25.8.0",
117
+ "@types/node": "^25.9.0",
118
118
  "@vitest/coverage-v8": "^4.1.6",
119
119
  "eslint": "^10.4.0",
120
120
  "eslint-config-prettier": "10.1.8",
@@ -135,14 +135,14 @@
135
135
  "prettier-plugin-tailwindcss": "^0.8.0",
136
136
  "publint": "^0.3.21",
137
137
  "runed": "0.37.1",
138
- "svelte": "5.55.5",
138
+ "svelte": "^5.55.7",
139
139
  "svelte-check": "^4.4.8",
140
140
  "svg-tags": "^1.0.0",
141
141
  "tailwind-merge": "^3.6.0",
142
142
  "tailwind-variants": "^3.2.2",
143
143
  "tailwindcss": "^4.3.0",
144
144
  "tailwindcss-animate": "^1.0.7",
145
- "tsx": "^4.22.0",
145
+ "tsx": "^4.22.2",
146
146
  "typescript": "^6.0.3",
147
147
  "typescript-eslint": "^8.59.3",
148
148
  "vite": "^8.0.13",