@rootnative/inertia 0.0.9 → 0.0.11

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 (105) hide show
  1. package/CHANGELOG.md +95 -1
  2. package/README.md +8 -8
  3. package/dist/{chunk-MFAFB4K7.mjs → chunk-2Q6JMDYZ.mjs} +8 -10
  4. package/dist/chunk-2UREDR4Z.js +8 -0
  5. package/dist/{chunk-ZBHQPVWE.js → chunk-3PB27UIE.js} +2 -2
  6. package/dist/{chunk-IX6SEOSK.mjs → chunk-5EYIZG72.mjs} +60 -45
  7. package/dist/{chunk-EN4PN7X3.mjs → chunk-7RMSLKQQ.mjs} +1 -1
  8. package/dist/{chunk-6YIUETBF.mjs → chunk-DT2KVAAO.mjs} +1 -1
  9. package/dist/{chunk-L4JFECXU.mjs → chunk-FKJLPYGY.mjs} +6 -3
  10. package/dist/{chunk-E3ALFSH2.js → chunk-HBURWGCZ.js} +86 -71
  11. package/dist/chunk-JAJHKJC5.js +8 -0
  12. package/dist/chunk-JBMTTICC.js +8 -0
  13. package/dist/{chunk-GSUC4HWP.mjs → chunk-JGQ6YRDN.mjs} +1 -1
  14. package/dist/chunk-KFHZMFAX.js +23 -0
  15. package/dist/{chunk-M4766VUV.mjs → chunk-LHW4VNWD.mjs} +1 -1
  16. package/dist/{chunk-MUT6BTZS.js → chunk-NTG6PSGZ.js} +10 -7
  17. package/dist/chunk-OH46TGEA.mjs +20 -0
  18. package/dist/{chunk-6AN5X3YE.js → chunk-QDMSFRQR.js} +10 -11
  19. package/dist/{chunk-W7NTRSPD.mjs → chunk-QIRKPDXA.mjs} +118 -68
  20. package/dist/{chunk-WNVHPMBI.js → chunk-QX5JHRZ2.js} +118 -66
  21. package/dist/{chunk-6NOCY764.js → chunk-R7YD6L3D.js} +2 -2
  22. package/dist/{chunk-JBK5ZLMH.mjs → chunk-RO4XFTQ6.mjs} +1 -1
  23. package/dist/{chunk-QNLSCOR5.mjs → chunk-UGYBFAVY.mjs} +1 -1
  24. package/dist/{chunk-IHVMNOS4.js → chunk-XLKI2MSD.js} +2 -2
  25. package/dist/gestureLayer/index.d.mts +3 -3
  26. package/dist/gestureLayer/index.d.ts +3 -3
  27. package/dist/gestureLayer/index.js +12 -18
  28. package/dist/gestureLayer/index.mjs +5 -11
  29. package/dist/index.d.mts +108 -49
  30. package/dist/index.d.ts +108 -49
  31. package/dist/index.js +114 -91
  32. package/dist/index.mjs +66 -59
  33. package/dist/motion/FlatList.d.mts +2 -1
  34. package/dist/motion/FlatList.d.ts +2 -1
  35. package/dist/motion/FlatList.js +5 -5
  36. package/dist/motion/FlatList.mjs +4 -4
  37. package/dist/motion/Image.d.mts +2 -1
  38. package/dist/motion/Image.d.ts +2 -1
  39. package/dist/motion/Image.js +5 -5
  40. package/dist/motion/Image.mjs +4 -4
  41. package/dist/motion/Pressable.d.mts +2 -1
  42. package/dist/motion/Pressable.d.ts +2 -1
  43. package/dist/motion/Pressable.js +5 -5
  44. package/dist/motion/Pressable.mjs +4 -4
  45. package/dist/motion/ScrollView.d.mts +2 -1
  46. package/dist/motion/ScrollView.d.ts +2 -1
  47. package/dist/motion/ScrollView.js +5 -5
  48. package/dist/motion/ScrollView.mjs +4 -4
  49. package/dist/motion/Text.d.mts +2 -1
  50. package/dist/motion/Text.d.ts +2 -1
  51. package/dist/motion/Text.js +5 -5
  52. package/dist/motion/Text.mjs +4 -4
  53. package/dist/motion/View.d.mts +2 -1
  54. package/dist/motion/View.d.ts +2 -1
  55. package/dist/motion/View.js +5 -5
  56. package/dist/motion/View.mjs +4 -4
  57. package/dist/touch/index.d.mts +5 -3
  58. package/dist/touch/index.d.ts +5 -3
  59. package/dist/touch/index.js +16 -31
  60. package/dist/touch/index.mjs +11 -29
  61. package/dist/{types-DyJpG64F.d.mts → types-C5Zbs9MC.d.mts} +22 -4
  62. package/dist/{types-DyJpG64F.d.ts → types-C5Zbs9MC.d.ts} +22 -4
  63. package/dist/{useGesture-DbH46EBp.d.ts → useGesture-Be0ZhCWj.d.ts} +1 -1
  64. package/dist/{useGesture-CnZQnYHH.d.mts → useGesture-Ve8EGjTr.d.mts} +1 -1
  65. package/dist/useTranslateStyle-BDrOD97O.d.mts +58 -0
  66. package/dist/useTranslateStyle-BDrOD97O.d.ts +58 -0
  67. package/jest-preset.js +31 -2
  68. package/llms.txt +2 -1
  69. package/package.json +15 -12
  70. package/src/config/namedTransitions.ts +7 -9
  71. package/src/gestureLayer/index.ts +3 -0
  72. package/src/gestureLayer/useGestureLayer.ts +6 -9
  73. package/src/gestures/focusVisibility.ts +19 -17
  74. package/src/gestures/index.ts +1 -1
  75. package/src/index.ts +12 -0
  76. package/src/internal/boxShadow.ts +24 -2
  77. package/src/layout/resolveLayout.ts +4 -1
  78. package/src/layout/useSharedLayout.ts +2 -1
  79. package/src/motion/createMotionComponent.tsx +92 -44
  80. package/src/presence/Presence.tsx +5 -7
  81. package/src/touch/applyBounds.ts +30 -0
  82. package/src/touch/index.ts +1 -0
  83. package/src/touch/useTouchDrag.ts +18 -46
  84. package/src/transitions/constants.ts +14 -0
  85. package/src/transitions/easing.ts +23 -11
  86. package/src/transitions/index.ts +5 -0
  87. package/src/transitions/keys.ts +0 -2
  88. package/src/transitions/resolve.ts +86 -11
  89. package/src/transitions/resolveSequence.ts +45 -3
  90. package/src/transitions/runtime.ts +4 -7
  91. package/src/transitions/spring.ts +7 -2
  92. package/src/types.ts +23 -3
  93. package/src/values/extrapolation.ts +21 -0
  94. package/src/values/index.ts +3 -0
  95. package/src/values/useColorCascade.ts +3 -3
  96. package/src/values/useColorTransition.ts +17 -2
  97. package/src/values/useGesture.ts +9 -2
  98. package/src/values/useInterpolatedStyle.ts +13 -13
  99. package/src/values/useShadow.ts +36 -9
  100. package/src/values/useSpring.ts +34 -25
  101. package/src/values/useTransform.ts +24 -20
  102. package/src/values/useTranslateStyle.ts +47 -0
  103. package/dist/chunk-24NUL23E.js +0 -8
  104. package/dist/chunk-4XBX7KOD.js +0 -8
  105. package/dist/chunk-Z5USXWTE.js +0 -8
@@ -1,6 +1,7 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.mjs';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `Image`. Inherits `Image`'s prop surface, with `animate` /
@@ -1,6 +1,7 @@
1
1
  import { Image } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.js';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `Image`. Inherits `Image`'s prop surface, with `animate` /
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkZ5USXWTE_js = require('../chunk-Z5USXWTE.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
3
+ var chunkJAJHKJC5_js = require('../chunk-JAJHKJC5.js');
4
+ require('../chunk-HBURWGCZ.js');
5
+ require('../chunk-QDMSFRQR.js');
6
+ require('../chunk-QX5JHRZ2.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionImage", {
11
11
  enumerable: true,
12
- get: function () { return chunkZ5USXWTE_js.MotionImage; }
12
+ get: function () { return chunkJAJHKJC5_js.MotionImage; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionImage } from '../chunk-6YIUETBF.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionImage } from '../chunk-DT2KVAAO.mjs';
2
+ import '../chunk-5EYIZG72.mjs';
3
+ import '../chunk-2Q6JMDYZ.mjs';
4
+ import '../chunk-QIRKPDXA.mjs';
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import * as react_native from 'react-native';
3
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
3
+ import { M as MotionComponent } from '../types-C5Zbs9MC.mjs';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
@@ -1,6 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import * as react_native from 'react-native';
3
- import { M as MotionComponent } from '../types-DyJpG64F.js';
3
+ import { M as MotionComponent } from '../types-C5Zbs9MC.js';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk6NOCY764_js = require('../chunk-6NOCY764.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
3
+ var chunkR7YD6L3D_js = require('../chunk-R7YD6L3D.js');
4
+ require('../chunk-HBURWGCZ.js');
5
+ require('../chunk-QDMSFRQR.js');
6
+ require('../chunk-QX5JHRZ2.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionPressable", {
11
11
  enumerable: true,
12
- get: function () { return chunk6NOCY764_js.MotionPressable; }
12
+ get: function () { return chunkR7YD6L3D_js.MotionPressable; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionPressable } from '../chunk-JBK5ZLMH.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionPressable } from '../chunk-RO4XFTQ6.mjs';
2
+ import '../chunk-5EYIZG72.mjs';
3
+ import '../chunk-2Q6JMDYZ.mjs';
4
+ import '../chunk-QIRKPDXA.mjs';
@@ -1,6 +1,7 @@
1
1
  import { ScrollView } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.mjs';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `ScrollView`. Animations apply to the scroll container itself —
@@ -1,6 +1,7 @@
1
1
  import { ScrollView } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.js';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `ScrollView`. Animations apply to the scroll container itself —
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkZBHQPVWE_js = require('../chunk-ZBHQPVWE.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
3
+ var chunk3PB27UIE_js = require('../chunk-3PB27UIE.js');
4
+ require('../chunk-HBURWGCZ.js');
5
+ require('../chunk-QDMSFRQR.js');
6
+ require('../chunk-QX5JHRZ2.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionScrollView", {
11
11
  enumerable: true,
12
- get: function () { return chunkZBHQPVWE_js.MotionScrollView; }
12
+ get: function () { return chunk3PB27UIE_js.MotionScrollView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionScrollView } from '../chunk-M4766VUV.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionScrollView } from '../chunk-LHW4VNWD.mjs';
2
+ import '../chunk-5EYIZG72.mjs';
3
+ import '../chunk-2Q6JMDYZ.mjs';
4
+ import '../chunk-QIRKPDXA.mjs';
@@ -1,6 +1,7 @@
1
1
  import { Text } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.mjs';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `Text`. Inherits `Text`'s prop surface, with `animate` /
@@ -1,6 +1,7 @@
1
1
  import { Text } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.js';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `Text`. Inherits `Text`'s prop surface, with `animate` /
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk4XBX7KOD_js = require('../chunk-4XBX7KOD.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
3
+ var chunkJBMTTICC_js = require('../chunk-JBMTTICC.js');
4
+ require('../chunk-HBURWGCZ.js');
5
+ require('../chunk-QDMSFRQR.js');
6
+ require('../chunk-QX5JHRZ2.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionText", {
11
11
  enumerable: true,
12
- get: function () { return chunk4XBX7KOD_js.MotionText; }
12
+ get: function () { return chunkJBMTTICC_js.MotionText; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionText } from '../chunk-QNLSCOR5.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionText } from '../chunk-UGYBFAVY.mjs';
2
+ import '../chunk-5EYIZG72.mjs';
3
+ import '../chunk-2Q6JMDYZ.mjs';
4
+ import '../chunk-QIRKPDXA.mjs';
@@ -1,6 +1,7 @@
1
1
  import { View } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.mjs';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.mjs';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `View`. Inherits `View`'s prop surface, with `animate` /
@@ -1,6 +1,7 @@
1
1
  import { View } from 'react-native';
2
- import { M as MotionComponent } from '../types-DyJpG64F.js';
2
+ import { M as MotionComponent } from '../types-C5Zbs9MC.js';
3
3
  import 'react';
4
+ import 'react-native-reanimated';
4
5
 
5
6
  /**
6
7
  * Animatable `View`. Inherits `View`'s prop surface, with `animate` /
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunk24NUL23E_js = require('../chunk-24NUL23E.js');
4
- require('../chunk-E3ALFSH2.js');
5
- require('../chunk-6AN5X3YE.js');
6
- require('../chunk-WNVHPMBI.js');
3
+ var chunk2UREDR4Z_js = require('../chunk-2UREDR4Z.js');
4
+ require('../chunk-HBURWGCZ.js');
5
+ require('../chunk-QDMSFRQR.js');
6
+ require('../chunk-QX5JHRZ2.js');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "MotionView", {
11
11
  enumerable: true,
12
- get: function () { return chunk24NUL23E_js.MotionView; }
12
+ get: function () { return chunk2UREDR4Z_js.MotionView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionView } from '../chunk-GSUC4HWP.mjs';
2
- import '../chunk-IX6SEOSK.mjs';
3
- import '../chunk-MFAFB4K7.mjs';
4
- import '../chunk-W7NTRSPD.mjs';
1
+ export { MotionView } from '../chunk-JGQ6YRDN.mjs';
2
+ import '../chunk-5EYIZG72.mjs';
3
+ import '../chunk-2Q6JMDYZ.mjs';
4
+ import '../chunk-QIRKPDXA.mjs';
@@ -1,6 +1,8 @@
1
+ import { T as TranslateStyle } from '../useTranslateStyle-BDrOD97O.mjs';
2
+ export { a as applyBounds } from '../useTranslateStyle-BDrOD97O.mjs';
1
3
  import { PanResponderInstance } from 'react-native';
2
- import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
3
- import { T as TransitionConfig } from '../types-DyJpG64F.mjs';
4
+ import { SharedValue } from 'react-native-reanimated';
5
+ import { T as TransitionConfig } from '../types-C5Zbs9MC.mjs';
4
6
  import 'react';
5
7
 
6
8
  /**
@@ -14,7 +16,7 @@ interface UseTouchDragResult {
14
16
  /** Spread onto a `View` / `Pressable` to install the pan responder. */
15
17
  panHandlers: PanResponderInstance['panHandlers'];
16
18
  /** Stable animated `transform` style. */
17
- animatedStyle: ReturnType<typeof useAnimatedStyle>;
19
+ animatedStyle: TranslateStyle;
18
20
  /** Live x translation, persistent across gestures. */
19
21
  dragX: SharedValue<number>;
20
22
  /** Live y translation, persistent across gestures. */
@@ -1,6 +1,8 @@
1
+ import { T as TranslateStyle } from '../useTranslateStyle-BDrOD97O.js';
2
+ export { a as applyBounds } from '../useTranslateStyle-BDrOD97O.js';
1
3
  import { PanResponderInstance } from 'react-native';
2
- import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
3
- import { T as TransitionConfig } from '../types-DyJpG64F.js';
4
+ import { SharedValue } from 'react-native-reanimated';
5
+ import { T as TransitionConfig } from '../types-C5Zbs9MC.js';
4
6
  import 'react';
5
7
 
6
8
  /**
@@ -14,7 +16,7 @@ interface UseTouchDragResult {
14
16
  /** Spread onto a `View` / `Pressable` to install the pan responder. */
15
17
  panHandlers: PanResponderInstance['panHandlers'];
16
18
  /** Stable animated `transform` style. */
17
- animatedStyle: ReturnType<typeof useAnimatedStyle>;
19
+ animatedStyle: TranslateStyle;
18
20
  /** Live x translation, persistent across gestures. */
19
21
  dragX: SharedValue<number>;
20
22
  /** Live y translation, persistent across gestures. */
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkWNVHPMBI_js = require('../chunk-WNVHPMBI.js');
3
+ var chunkKFHZMFAX_js = require('../chunk-KFHZMFAX.js');
4
+ var chunkQX5JHRZ2_js = require('../chunk-QX5JHRZ2.js');
4
5
  var react = require('react');
5
6
  var reactNative = require('react-native');
6
7
  var reactNativeReanimated = require('react-native-reanimated');
@@ -19,22 +20,12 @@ function useTouchDrag(options = {}) {
19
20
  const top = constraints?.top;
20
21
  const bottom = constraints?.bottom;
21
22
  const elasticCoef = elastic;
22
- const { onDragStart, onDragEnd, onRelease } = options;
23
+ const callbacksRef = react.useRef(options);
24
+ callbacksRef.current = options;
23
25
  const responder = react.useMemo(
24
26
  () => buildResponder(),
25
27
  // eslint-disable-next-line react-hooks/exhaustive-deps
26
- [
27
- lockX,
28
- lockY,
29
- left,
30
- right,
31
- top,
32
- bottom,
33
- elasticCoef,
34
- onDragStart,
35
- onDragEnd,
36
- onRelease
37
- ]
28
+ [lockX, lockY, left, right, top, bottom, elasticCoef]
38
29
  );
39
30
  function buildResponder() {
40
31
  const handleEnd = (g) => {
@@ -43,19 +34,20 @@ function useTouchDrag(options = {}) {
43
34
  const y = dragY.value;
44
35
  const vx = g.vx * 1e3;
45
36
  const vy = g.vy * 1e3;
37
+ const { onRelease, onDragEnd } = callbacksRef.current;
46
38
  if (onRelease) {
47
39
  const result = onRelease({ x, y, velocity: { x: vx, y: vy } });
48
40
  if (result) {
49
41
  if (result.x && lockX) {
50
42
  const toX = "to" in result.x ? result.x.to : x;
51
- dragX.value = chunkWNVHPMBI_js.buildReleaseAnimation(
43
+ dragX.value = chunkQX5JHRZ2_js.buildReleaseAnimation(
52
44
  result.x,
53
45
  toX
54
46
  );
55
47
  }
56
48
  if (result.y && lockY) {
57
49
  const toY = "to" in result.y ? result.y.to : y;
58
- dragY.value = chunkWNVHPMBI_js.buildReleaseAnimation(
50
+ dragY.value = chunkQX5JHRZ2_js.buildReleaseAnimation(
59
51
  result.y,
60
52
  toY
61
53
  );
@@ -74,11 +66,11 @@ function useTouchDrag(options = {}) {
74
66
  startX.value = dragX.value;
75
67
  startY.value = dragY.value;
76
68
  isDragging.value = true;
77
- if (onDragStart) onDragStart();
69
+ callbacksRef.current.onDragStart?.();
78
70
  },
79
71
  onPanResponderMove: (_e, g) => {
80
72
  if (lockX) {
81
- dragX.value = applyBounds(
73
+ dragX.value = chunkKFHZMFAX_js.applyBounds(
82
74
  startX.value + g.dx,
83
75
  left,
84
76
  right,
@@ -86,7 +78,7 @@ function useTouchDrag(options = {}) {
86
78
  );
87
79
  }
88
80
  if (lockY) {
89
- dragY.value = applyBounds(
81
+ dragY.value = chunkKFHZMFAX_js.applyBounds(
90
82
  startY.value + g.dy,
91
83
  top,
92
84
  bottom,
@@ -98,9 +90,7 @@ function useTouchDrag(options = {}) {
98
90
  onPanResponderTerminate: (_e, g) => handleEnd(g)
99
91
  });
100
92
  }
101
- const animatedStyle = reactNativeReanimated.useAnimatedStyle(() => ({
102
- transform: [{ translateX: dragX.value }, { translateY: dragY.value }]
103
- }));
93
+ const animatedStyle = chunkKFHZMFAX_js.useTranslateStyle(dragX, dragY);
104
94
  return {
105
95
  panHandlers: responder.panHandlers,
106
96
  animatedStyle,
@@ -109,14 +99,9 @@ function useTouchDrag(options = {}) {
109
99
  isDragging
110
100
  };
111
101
  }
112
- function applyBounds(value, min, max, elastic) {
113
- if (min !== void 0 && value < min) {
114
- return elastic > 0 ? min + (value - min) * elastic : min;
115
- }
116
- if (max !== void 0 && value > max) {
117
- return elastic > 0 ? max + (value - max) * elastic : max;
118
- }
119
- return value;
120
- }
121
102
 
103
+ Object.defineProperty(exports, "applyBounds", {
104
+ enumerable: true,
105
+ get: function () { return chunkKFHZMFAX_js.applyBounds; }
106
+ });
122
107
  exports.useTouchDrag = useTouchDrag;
@@ -1,7 +1,9 @@
1
- import { buildReleaseAnimation } from '../chunk-W7NTRSPD.mjs';
2
- import { useMemo } from 'react';
1
+ import { applyBounds, useTranslateStyle } from '../chunk-OH46TGEA.mjs';
2
+ export { applyBounds } from '../chunk-OH46TGEA.mjs';
3
+ import { buildReleaseAnimation } from '../chunk-QIRKPDXA.mjs';
4
+ import { useRef, useMemo } from 'react';
3
5
  import { PanResponder } from 'react-native';
4
- import { useSharedValue, useAnimatedStyle } from 'react-native-reanimated';
6
+ import { useSharedValue } from 'react-native-reanimated';
5
7
 
6
8
  function useTouchDrag(options = {}) {
7
9
  const { axis = "both", constraints, elastic = 0 } = options;
@@ -17,22 +19,12 @@ function useTouchDrag(options = {}) {
17
19
  const top = constraints?.top;
18
20
  const bottom = constraints?.bottom;
19
21
  const elasticCoef = elastic;
20
- const { onDragStart, onDragEnd, onRelease } = options;
22
+ const callbacksRef = useRef(options);
23
+ callbacksRef.current = options;
21
24
  const responder = useMemo(
22
25
  () => buildResponder(),
23
26
  // eslint-disable-next-line react-hooks/exhaustive-deps
24
- [
25
- lockX,
26
- lockY,
27
- left,
28
- right,
29
- top,
30
- bottom,
31
- elasticCoef,
32
- onDragStart,
33
- onDragEnd,
34
- onRelease
35
- ]
27
+ [lockX, lockY, left, right, top, bottom, elasticCoef]
36
28
  );
37
29
  function buildResponder() {
38
30
  const handleEnd = (g) => {
@@ -41,6 +33,7 @@ function useTouchDrag(options = {}) {
41
33
  const y = dragY.value;
42
34
  const vx = g.vx * 1e3;
43
35
  const vy = g.vy * 1e3;
36
+ const { onRelease, onDragEnd } = callbacksRef.current;
44
37
  if (onRelease) {
45
38
  const result = onRelease({ x, y, velocity: { x: vx, y: vy } });
46
39
  if (result) {
@@ -72,7 +65,7 @@ function useTouchDrag(options = {}) {
72
65
  startX.value = dragX.value;
73
66
  startY.value = dragY.value;
74
67
  isDragging.value = true;
75
- if (onDragStart) onDragStart();
68
+ callbacksRef.current.onDragStart?.();
76
69
  },
77
70
  onPanResponderMove: (_e, g) => {
78
71
  if (lockX) {
@@ -96,9 +89,7 @@ function useTouchDrag(options = {}) {
96
89
  onPanResponderTerminate: (_e, g) => handleEnd(g)
97
90
  });
98
91
  }
99
- const animatedStyle = useAnimatedStyle(() => ({
100
- transform: [{ translateX: dragX.value }, { translateY: dragY.value }]
101
- }));
92
+ const animatedStyle = useTranslateStyle(dragX, dragY);
102
93
  return {
103
94
  panHandlers: responder.panHandlers,
104
95
  animatedStyle,
@@ -107,14 +98,5 @@ function useTouchDrag(options = {}) {
107
98
  isDragging
108
99
  };
109
100
  }
110
- function applyBounds(value, min, max, elastic) {
111
- if (min !== void 0 && value < min) {
112
- return elastic > 0 ? min + (value - min) * elastic : min;
113
- }
114
- if (max !== void 0 && value > max) {
115
- return elastic > 0 ? max + (value - max) * elastic : max;
116
- }
117
- return value;
118
- }
119
101
 
120
102
  export { useTouchDrag };
@@ -1,5 +1,6 @@
1
1
  import { ComponentType, ComponentProps, Ref, ReactElement } from 'react';
2
2
  import { StyleProp, BoxShadowValue } from 'react-native';
3
+ import { AnimatedProps } from 'react-native-reanimated';
3
4
 
4
5
  /**
5
6
  * A single animation step's destination, optionally overriding the transition
@@ -24,8 +25,6 @@ interface SpringTransition {
24
25
  friction?: number;
25
26
  mass?: number;
26
27
  velocity?: number;
27
- restSpeedThreshold?: number;
28
- restDisplacementThreshold?: number;
29
28
  delay?: number;
30
29
  repeat?: RepeatConfig;
31
30
  }
@@ -107,6 +106,15 @@ type NamedTransitions = Partial<Record<TransitionName, TransitionConfig>>;
107
106
  type TransitionInput = TransitionConfig | TransitionName;
108
107
  /**
109
108
  * Repeat config — one shape, not three flags. Default `alternate: true`.
109
+ *
110
+ * `count` is the total number of iterations, including the first pass, so
111
+ * `repeat: 2` plays the animation twice. A count below `1` runs the animation
112
+ * once and warns in dev.
113
+ *
114
+ * `alternate` reverses direction on every other pass for a single-value
115
+ * animation. It has no effect on a sequence (an array target): Reanimated
116
+ * restarts a sequence at its first step on every pass. Append the reverse
117
+ * steps to the sequence to alternate.
110
118
  */
111
119
  type RepeatConfig = number | 'infinite' | {
112
120
  count: number | 'infinite';
@@ -435,9 +443,19 @@ interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
435
443
  * Props of a Motion primitive for a given underlying component `C` and a
436
444
  * concrete variants map `V`: the component's own props (minus `style`, which
437
445
  * we replace with an animated style) intersected with the Motion props.
446
+ *
447
+ * `style` is taken from `AnimatedProps<…>`, not from `C` directly, because a
448
+ * Motion primitive renders `Animated.createAnimatedComponent(C)` — so the
449
+ * styles it accepts are the ones that animated component accepts. Reanimated
450
+ * 4.5 brands what `useAnimatedStyle` returns, and `ComponentProps<C>['style']`
451
+ * rejects a branded value, which would have made the sanctioned escape hatch
452
+ * (Principle 2: own your `useAnimatedStyle` over Inertia-driven shared values,
453
+ * then pass it to a `Motion.*` primitive) require a cast at every call site.
438
454
  */
439
455
  type MotionComponentProps<C extends ComponentType<any>, V extends VariantsMap<ComponentProps<C>> = VariantsMap<ComponentProps<C>>> = Omit<ComponentProps<C>, 'style'> & MotionProps<ComponentProps<C>, V> & {
440
- style?: ComponentProps<C>['style'];
456
+ style?: AnimatedProps<ComponentProps<C>> extends {
457
+ style?: infer S;
458
+ } ? S : ComponentProps<C>['style'];
441
459
  ref?: Ref<unknown>;
442
460
  };
443
461
  /**
@@ -456,4 +474,4 @@ interface MotionComponent<C extends ComponentType<any>> {
456
474
  displayName?: string;
457
475
  }
458
476
 
459
- export type { AnimatableValue as A, BoxShadowInput as B, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantsMap as V, MotionProps as a, TransitionInput as b, TransitionName as c, VariantController as d, AnimateStyle as e, AnimationCallbackInfo as f, EasingFunction as g, EasingFunctionFactory as h, GestureSubStates as i, NoAnimationTransition as j, RepeatConfig as k, SequenceStep as l, TimingTransition as m, Transition as n };
477
+ export type { AnimatableValue as A, BoxShadowInput as B, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantsMap as V, MotionProps as a, TransitionInput as b, TransitionName as c, VariantController as d, AnimateStyle as e, AnimationCallbackInfo as f, EasingFunction as g, EasingFunctionFactory as h, GestureSubStates as i, MotionComponentProps as j, NoAnimationTransition as k, RepeatConfig as l, SequenceStep as m, TimingTransition as n, Transition as o };
@@ -1,5 +1,6 @@
1
1
  import { ComponentType, ComponentProps, Ref, ReactElement } from 'react';
2
2
  import { StyleProp, BoxShadowValue } from 'react-native';
3
+ import { AnimatedProps } from 'react-native-reanimated';
3
4
 
4
5
  /**
5
6
  * A single animation step's destination, optionally overriding the transition
@@ -24,8 +25,6 @@ interface SpringTransition {
24
25
  friction?: number;
25
26
  mass?: number;
26
27
  velocity?: number;
27
- restSpeedThreshold?: number;
28
- restDisplacementThreshold?: number;
29
28
  delay?: number;
30
29
  repeat?: RepeatConfig;
31
30
  }
@@ -107,6 +106,15 @@ type NamedTransitions = Partial<Record<TransitionName, TransitionConfig>>;
107
106
  type TransitionInput = TransitionConfig | TransitionName;
108
107
  /**
109
108
  * Repeat config — one shape, not three flags. Default `alternate: true`.
109
+ *
110
+ * `count` is the total number of iterations, including the first pass, so
111
+ * `repeat: 2` plays the animation twice. A count below `1` runs the animation
112
+ * once and warns in dev.
113
+ *
114
+ * `alternate` reverses direction on every other pass for a single-value
115
+ * animation. It has no effect on a sequence (an array target): Reanimated
116
+ * restarts a sequence at its first step on every pass. Append the reverse
117
+ * steps to the sequence to alternate.
110
118
  */
111
119
  type RepeatConfig = number | 'infinite' | {
112
120
  count: number | 'infinite';
@@ -435,9 +443,19 @@ interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
435
443
  * Props of a Motion primitive for a given underlying component `C` and a
436
444
  * concrete variants map `V`: the component's own props (minus `style`, which
437
445
  * we replace with an animated style) intersected with the Motion props.
446
+ *
447
+ * `style` is taken from `AnimatedProps<…>`, not from `C` directly, because a
448
+ * Motion primitive renders `Animated.createAnimatedComponent(C)` — so the
449
+ * styles it accepts are the ones that animated component accepts. Reanimated
450
+ * 4.5 brands what `useAnimatedStyle` returns, and `ComponentProps<C>['style']`
451
+ * rejects a branded value, which would have made the sanctioned escape hatch
452
+ * (Principle 2: own your `useAnimatedStyle` over Inertia-driven shared values,
453
+ * then pass it to a `Motion.*` primitive) require a cast at every call site.
438
454
  */
439
455
  type MotionComponentProps<C extends ComponentType<any>, V extends VariantsMap<ComponentProps<C>> = VariantsMap<ComponentProps<C>>> = Omit<ComponentProps<C>, 'style'> & MotionProps<ComponentProps<C>, V> & {
440
- style?: ComponentProps<C>['style'];
456
+ style?: AnimatedProps<ComponentProps<C>> extends {
457
+ style?: infer S;
458
+ } ? S : ComponentProps<C>['style'];
441
459
  ref?: Ref<unknown>;
442
460
  };
443
461
  /**
@@ -456,4 +474,4 @@ interface MotionComponent<C extends ComponentType<any>> {
456
474
  displayName?: string;
457
475
  }
458
476
 
459
- export type { AnimatableValue as A, BoxShadowInput as B, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantsMap as V, MotionProps as a, TransitionInput as b, TransitionName as c, VariantController as d, AnimateStyle as e, AnimationCallbackInfo as f, EasingFunction as g, EasingFunctionFactory as h, GestureSubStates as i, NoAnimationTransition as j, RepeatConfig as k, SequenceStep as l, TimingTransition as m, Transition as n };
477
+ export type { AnimatableValue as A, BoxShadowInput as B, DecayTransition as D, EasingInput as E, GestureLayerTransitions as G, MotionComponent as M, NamedTransitions as N, PerPropertyTransition as P, RegisteredTransitions as R, SpringTransition as S, TransitionConfig as T, VariantsMap as V, MotionProps as a, TransitionInput as b, TransitionName as c, VariantController as d, AnimateStyle as e, AnimationCallbackInfo as f, EasingFunction as g, EasingFunctionFactory as h, GestureSubStates as i, MotionComponentProps as j, NoAnimationTransition as k, RepeatConfig as l, SequenceStep as m, TimingTransition as n, Transition as o };
@@ -1,5 +1,5 @@
1
1
  import { SharedValue } from 'react-native-reanimated';
2
- import { b as TransitionInput, G as GestureLayerTransitions } from './types-DyJpG64F.js';
2
+ import { b as TransitionInput, G as GestureLayerTransitions } from './types-C5Zbs9MC.js';
3
3
 
4
4
  /**
5
5
  * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the
@@ -1,5 +1,5 @@
1
1
  import { SharedValue } from 'react-native-reanimated';
2
- import { b as TransitionInput, G as GestureLayerTransitions } from './types-DyJpG64F.mjs';
2
+ import { b as TransitionInput, G as GestureLayerTransitions } from './types-C5Zbs9MC.mjs';
3
3
 
4
4
  /**
5
5
  * Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the