react-voodoo 2.6.4 → 2.7.1

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.
Files changed (57) hide show
  1. package/.claude/scheduled_tasks.lock +1 -0
  2. package/README.md +23 -7
  3. package/coverage/clover.xml +2221 -0
  4. package/coverage/coverage-final.json +35 -0
  5. package/coverage/lcov-report/base.css +224 -0
  6. package/coverage/lcov-report/block-navigation.js +87 -0
  7. package/coverage/lcov-report/comps/Axis.js.html +391 -0
  8. package/coverage/lcov-report/comps/Draggable.js.html +1180 -0
  9. package/coverage/lcov-report/comps/Node.js.html +691 -0
  10. package/coverage/lcov-report/comps/Tweener.js.html +3637 -0
  11. package/coverage/lcov-report/comps/TweenerContext.js.html +127 -0
  12. package/coverage/lcov-report/comps/index.html +176 -0
  13. package/coverage/lcov-report/favicon.png +0 -0
  14. package/coverage/lcov-report/hooks/index.html +146 -0
  15. package/coverage/lcov-report/hooks/useReducedMotion.js.html +172 -0
  16. package/coverage/lcov-report/hooks/useTweener.js.html +130 -0
  17. package/coverage/lcov-report/hooks/useVoodoo.js.html +553 -0
  18. package/coverage/lcov-report/index.html +206 -0
  19. package/coverage/lcov-report/prettify.css +1 -0
  20. package/coverage/lcov-report/prettify.js +2 -0
  21. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  22. package/coverage/lcov-report/sorter.js +210 -0
  23. package/coverage/lcov-report/spells/asTweener.js.html +361 -0
  24. package/coverage/lcov-report/spells/index.html +131 -0
  25. package/coverage/lcov-report/spells/withTweener.js.html +262 -0
  26. package/coverage/lcov-report/utils/CssTweenAxis.js.html +721 -0
  27. package/coverage/lcov-report/utils/css/cssUtils.js.html +916 -0
  28. package/coverage/lcov-report/utils/css/demux/backgroundColor.js.html +115 -0
  29. package/coverage/lcov-report/utils/css/demux/boxShadow.js.html +115 -0
  30. package/coverage/lcov-report/utils/css/demux/filter.js.html +724 -0
  31. package/coverage/lcov-report/utils/css/demux/index.html +176 -0
  32. package/coverage/lcov-report/utils/css/demux/textShadow.js.html +115 -0
  33. package/coverage/lcov-report/utils/css/demux/transform.js.html +1006 -0
  34. package/coverage/lcov-report/utils/css/demux/typed/any.js.html +640 -0
  35. package/coverage/lcov-report/utils/css/demux/typed/bool.js.html +196 -0
  36. package/coverage/lcov-report/utils/css/demux/typed/color.js.html +322 -0
  37. package/coverage/lcov-report/utils/css/demux/typed/index.html +236 -0
  38. package/coverage/lcov-report/utils/css/demux/typed/length.js.html +562 -0
  39. package/coverage/lcov-report/utils/css/demux/typed/multi.js.html +298 -0
  40. package/coverage/lcov-report/utils/css/demux/typed/number.js.html +199 -0
  41. package/coverage/lcov-report/utils/css/demux/typed/ratio.js.html +199 -0
  42. package/coverage/lcov-report/utils/css/demux/typed/shadow.js.html +1060 -0
  43. package/coverage/lcov-report/utils/css/demux/typed/svgAttr.js.html +214 -0
  44. package/coverage/lcov-report/utils/css/index.html +146 -0
  45. package/coverage/lcov-report/utils/css/index.js.html +829 -0
  46. package/coverage/lcov-report/utils/css/prop.js.html +199 -0
  47. package/coverage/lcov-report/utils/dom.js.html +1309 -0
  48. package/coverage/lcov-report/utils/index.html +206 -0
  49. package/coverage/lcov-report/utils/inertia.js.html +2140 -0
  50. package/coverage/lcov-report/utils/motionPrefs.js.html +262 -0
  51. package/coverage/lcov-report/utils/react.js.html +199 -0
  52. package/coverage/lcov-report/utils/spring.js.html +397 -0
  53. package/coverage/lcov-report/utils/tweenTools.js.html +1003 -0
  54. package/coverage/lcov.info +4931 -0
  55. package/dist/react-voodoo.js +1 -1
  56. package/dist/react-voodoo.js.map +1 -1
  57. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"sessionId":"6c9df37f-1f1e-4466-9e55-24976b8775e6","pid":36465,"procStart":"400558","acquiredAt":1780727446778}
package/README.md CHANGED
@@ -37,6 +37,8 @@ This unlocks a set of features that are unique to the delta model:
37
37
  | **Additive multi-axis composition** | Each axis contributes a delta; they stack without coordination code. |
38
38
  | **Swipeable / draggable animations** | Drag gestures are mapped directly to axis positions with realistic momentum. |
39
39
  | **Predictive inertia** | The engine computes the final snap target *at the moment of release*, before the animation plays out — useful for preloading the next slide. |
40
+ | **Physical spring settle** | `settle: { stiffness, damping, mass }` — the landing curve is generated at release from the actual gesture velocity (closed-form, no per-frame integration), with per-waypoint overrides. |
41
+ | **Reduced-motion aware** | `reducedMotion: "user"` honors the OS *prefers-reduced-motion* setting: transitions jump to their predicted target, callbacks still fire, 1:1 dragging untouched. |
40
42
  | **SSR with correct initial styles** | Axes have a `defaultPosition`; styles are computed server-side and rendered inline — no flash on first paint. |
41
43
  | **DOM writes bypass React** | Style updates go straight to `node.style` via direct DOM writes, never triggering a re-render. |
42
44
  | **Multi-unit CSS via `calc()`** | Mix `%`, `px`, `vw`, `bw`/`bh` (box-relative units) in a single value — compiled to `calc()` automatically. |
@@ -52,7 +54,8 @@ This unlocks a set of features that are unique to the delta model:
52
54
  | Scroll-linked animation | ✅ | ✅ `useScroll` | ✅ | ⚠️ manual | ✅ | ✅ `ScrollObserver` |
53
55
  | Drag-linked animation | ✅ native | ✅ `drag` | ⚠️ manual | ✅ `@use-gesture` | ✅ gestures | ✅ `Draggable` |
54
56
  | **Additive multi-axis composition** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
55
- | Physics / momentum inertia | ✅ predictive | ✅ spring | ❌ | ✅ spring | ⚠️ limited | ✅ spring |
57
+ | Physics / momentum inertia | ✅ predictive + springs | ✅ spring | ❌ | ✅ spring | ⚠️ limited | ✅ spring |
58
+ | Reduced-motion (a11y) | ✅ built-in | ✅ built-in | ⚠️ manual | ✅ built-in | ✅ built-in | ⚠️ manual |
56
59
  | **Predictive snap target** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
57
60
  | **SSR — correct initial styles** | ✅ | ⚠️ flash | ⚠️ flash | ⚠️ flash | ⚠️ flash | ❌ |
58
61
  | Bypasses React render loop | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
@@ -60,7 +63,7 @@ This unlocks a set of features that are unique to the delta model:
60
63
  | SVG geometry attributes | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ |
61
64
  | Multitouch (drag multiple axes) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
62
65
  | Bundle size (approx. gzip) | ~18 kB | ~32 kB | ~35 kB | ~25 kB | ~4 kB | ~10 kB |
63
- | React dependency | 16 | ≥ 18 | none | ≥ 16 | none | none |
66
+ | React dependency | 16 – 19 | ≥ 18 | none | ≥ 16 | none | none |
64
67
 
65
68
  ---
66
69
 
@@ -113,7 +116,7 @@ and it disappears entirely once you have more than one axis compositing on the s
113
116
  npm install react-voodoo
114
117
  ```
115
118
 
116
- **Peer dependencies:** `react >= 16`, `react-dom >= 16`
119
+ **Peer dependencies:** `react` & `react-dom` 16 – 19
117
120
 
118
121
  ---
119
122
 
@@ -208,7 +211,11 @@ const Sample = ( {} ) => {
208
211
  // lock to only 1 drag direction
209
212
  dragDirectionLock: false,
210
213
  // allow dragging with mouse
211
- enableMouseDrag: false
214
+ enableMouseDrag: false,
215
+ // honor the OS prefers-reduced-motion setting : "user" | "always" | "never" (default)
216
+ // when active : eased scrolls & anims jump to their final state, inertia
217
+ // teleports to the predicted snap target ( callbacks still fire )
218
+ reducedMotion: "user"
212
219
  }
213
220
  );
214
221
  // get a named parent tweener
@@ -272,8 +279,17 @@ const Sample = ( {} ) => {
272
279
  onSnap: ( snapIndex, targetWayPointObj ) => {
273
280
  },
274
281
 
275
- // list of waypoints object ( only support auto snap 50/50 for now )
276
- wayPoints: [{ at: 100 }, { at: 200 }]
282
+ // settle easing : how the axis travels to the landing position
283
+ // ( default : easePolyOut )
284
+ // - any d3-ease fn name or custom easing fn
285
+ // - or a physical spring : the curve is generated at release from
286
+ // the actual gesture velocity ( velocity continuity + bounce ),
287
+ // the predictive waypoint snap stays authoritative
288
+ settle: { stiffness: 200, damping: 14 },
289
+
290
+ // list of waypoints ; gravity > 1 makes a waypoint stickier,
291
+ // a per-waypoint settle overrides the axis-level one
292
+ wayPoints: [{ at: 100 }, { at: 200, gravity: 2, settle: "easeCubicOut" }]
277
293
  }
278
294
  }
279
295
  />
@@ -327,7 +343,7 @@ const Sample = ( {} ) => {
327
343
  // mouseDrag={true} // listen for mouse drag ( default to false )
328
344
  // touchDrag={false} // listen for touch drag ( default to true )
329
345
 
330
- // button={1-3} // limit mouse drag to the specified event.button === ( default to 1; the left btn )
346
+ // button={0-2} // limit mouse drag to the specified event.button ( default to 0; the left btn )
331
347
 
332
348
  // * actually Draggable create it's own div node
333
349
  >