solidjs-motion 0.1.5 → 0.1.6
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.
- package/CHANGELOG.md +32 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/presence.tsx +13 -0
- package/src/primitives/createMotion.ts +40 -13
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,38 @@ All notable changes to `solidjs-motion` / `@solidjs-motion/motion` are documente
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.6] — 2026-05-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Nested motion inside `<Presence>` now reliably runs its first
|
|
13
|
+
animate.** Previously, motion's enter-readiness gate flipped true via
|
|
14
|
+
Presence's `beforeMount` callback unconditionally — but for nested
|
|
15
|
+
motion elements inside a deeper `<Presence>` whose `onEnter` fires
|
|
16
|
+
synchronously during render (while the surrounding tracked subtree is
|
|
17
|
+
still off-DOM in a wait-mode holding pen), this caused the diff
|
|
18
|
+
effect's first `animate(el, ...)` to fire against a disconnected
|
|
19
|
+
element. WAAPI ran the animation to completion off-DOM and silently
|
|
20
|
+
dropped `commitStyles`, so the element painted at its `initial` target
|
|
21
|
+
with no visible transition.
|
|
22
|
+
|
|
23
|
+
Both signals that could trip readiness now route through a shared
|
|
24
|
+
`isConnected` check: Presence's `beforeMount` callback AND the
|
|
25
|
+
microtask fallback flip ready only when `el.isConnected === true`,
|
|
26
|
+
otherwise schedule a `requestAnimationFrame` retry until connectedness
|
|
27
|
+
flips (or the owner is disposed). This handles three previously-broken
|
|
28
|
+
scenarios:
|
|
29
|
+
- Nested motion descendants of a Presence's tracked subtree
|
|
30
|
+
- Initial children of `<Presence initial={false}>` (appear=false)
|
|
31
|
+
- Direct tracked children whose nested `<Presence>` fires
|
|
32
|
+
`beforeMount` synchronously while the parent subtree is still
|
|
33
|
+
off-DOM (the canonical case: a page-transition wrapper around
|
|
34
|
+
routes that themselves contain `<Presence>`)
|
|
35
|
+
|
|
36
|
+
New regression test in `tests/presence.test.tsx` asserts a nested
|
|
37
|
+
motion descendant's animate target reaches the animate spy on both
|
|
38
|
+
initial mount AND on a `<Presence>` swap.
|
|
39
|
+
|
|
8
40
|
## [0.1.5] — 2026-05-21
|
|
9
41
|
|
|
10
42
|
### Fixed
|
package/dist/index.js
CHANGED
|
@@ -2097,10 +2097,20 @@ function createMotion(el, getOpts, config) {
|
|
|
2097
2097
|
const inPresence = presence.registerEnter !== void 0;
|
|
2098
2098
|
const [enterReady, setEnterReady] = createSignal(!inPresence);
|
|
2099
2099
|
if (inPresence && presence.registerEnter) {
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2100
|
+
let live = true;
|
|
2101
|
+
onCleanup(() => {
|
|
2102
|
+
live = false;
|
|
2103
2103
|
});
|
|
2104
|
+
const checkConnection = () => {
|
|
2105
|
+
if (!live) return;
|
|
2106
|
+
if (el.isConnected) {
|
|
2107
|
+
setEnterReady(true);
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
requestAnimationFrame(checkConnection);
|
|
2111
|
+
};
|
|
2112
|
+
presence.registerEnter(el, checkConnection);
|
|
2113
|
+
queueMicrotask(checkConnection);
|
|
2104
2114
|
}
|
|
2105
2115
|
const { setActive, onceExitComplete } = createGestureStateMachine({
|
|
2106
2116
|
el,
|