@rootnative/inertia 0.0.0-alpha.2 → 0.0.0-alpha.3
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 +15 -1
- package/dist/chunk-5RCMIJGZ.js +8 -0
- package/dist/chunk-6FENLMCA.mjs +257 -0
- package/dist/chunk-E4MDU4YV.mjs +6 -0
- package/dist/chunk-FSPQVLBF.mjs +6 -0
- package/dist/chunk-GJD4VVAS.mjs +103 -0
- package/dist/chunk-JWHKMNYA.js +112 -0
- package/dist/chunk-K7ICHCTZ.js +54 -0
- package/dist/chunk-KARV7QKF.mjs +6 -0
- package/dist/chunk-KVSJWO5X.js +1011 -0
- package/dist/chunk-NJYRN3WG.js +8 -0
- package/dist/chunk-R3ODWDTI.js +8 -0
- package/dist/chunk-RJNR7CFN.mjs +6 -0
- package/dist/chunk-S4AEU72O.js +8 -0
- package/dist/chunk-SFRNO6AW.js +267 -0
- package/dist/chunk-UM3WVSKQ.mjs +6 -0
- package/dist/chunk-UMFBAFZP.js +8 -0
- package/dist/chunk-UXK4YCT6.mjs +1003 -0
- package/dist/chunk-W6IS4HAK.mjs +52 -0
- package/dist/gestureLayer/index.js +10 -272
- package/dist/gestureLayer/index.mjs +5 -267
- package/dist/index.js +122 -1457
- package/dist/index.mjs +19 -1400
- package/dist/motion/Image.js +8 -1173
- package/dist/motion/Image.mjs +4 -1172
- package/dist/motion/Pressable.js +8 -1173
- package/dist/motion/Pressable.mjs +4 -1172
- package/dist/motion/ScrollView.js +8 -1173
- package/dist/motion/ScrollView.mjs +4 -1172
- package/dist/motion/Text.js +8 -1173
- package/dist/motion/Text.mjs +4 -1172
- package/dist/motion/View.js +8 -1173
- package/dist/motion/View.mjs +4 -1172
- package/dist/touch/index.js +3 -45
- package/dist/touch/index.mjs +2 -44
- package/package.json +1 -1
package/dist/touch/index.js
CHANGED
|
@@ -1,52 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkSFRNO6AW_js = require('../chunk-SFRNO6AW.js');
|
|
3
4
|
var react = require('react');
|
|
4
5
|
var reactNative = require('react-native');
|
|
5
6
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
6
7
|
|
|
7
|
-
// src/touch/useTouchDrag.ts
|
|
8
|
-
|
|
9
|
-
// src/transitions/spring.ts
|
|
10
|
-
var DEFAULT_SPRING = {
|
|
11
|
-
tension: 170,
|
|
12
|
-
friction: 26,
|
|
13
|
-
mass: 1
|
|
14
|
-
};
|
|
15
|
-
function springToReanimated(t) {
|
|
16
|
-
"worklet";
|
|
17
|
-
return {
|
|
18
|
-
stiffness: t.tension ?? DEFAULT_SPRING.tension,
|
|
19
|
-
damping: t.friction ?? DEFAULT_SPRING.friction,
|
|
20
|
-
mass: t.mass ?? DEFAULT_SPRING.mass,
|
|
21
|
-
velocity: t.velocity,
|
|
22
|
-
restSpeedThreshold: t.restSpeedThreshold,
|
|
23
|
-
restDisplacementThreshold: t.restDisplacementThreshold
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
var DEFAULT_TIMING_DURATION = 250;
|
|
27
|
-
function buildReleaseAnimation(transition, toValue) {
|
|
28
|
-
"worklet";
|
|
29
|
-
if (transition.type === "no-animation") return toValue;
|
|
30
|
-
if (transition.type === "decay") {
|
|
31
|
-
const cfg = { velocity: transition.velocity ?? 0 };
|
|
32
|
-
if (transition.deceleration !== void 0) {
|
|
33
|
-
cfg.deceleration = transition.deceleration;
|
|
34
|
-
}
|
|
35
|
-
if (transition.clamp !== void 0) cfg.clamp = transition.clamp;
|
|
36
|
-
return reactNativeReanimated.withDecay(cfg);
|
|
37
|
-
}
|
|
38
|
-
if (transition.type === "timing") {
|
|
39
|
-
const e = transition.easing;
|
|
40
|
-
const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? reactNativeReanimated.Easing.inOut(reactNativeReanimated.Easing.ease);
|
|
41
|
-
return reactNativeReanimated.withTiming(toValue, {
|
|
42
|
-
duration: transition.duration ?? DEFAULT_TIMING_DURATION,
|
|
43
|
-
easing: easingFn
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return reactNativeReanimated.withSpring(toValue, springToReanimated(transition));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/touch/useTouchDrag.ts
|
|
50
8
|
function useTouchDrag(options = {}) {
|
|
51
9
|
const { axis = "both", constraints, elastic = 0 } = options;
|
|
52
10
|
const dragX = reactNativeReanimated.useSharedValue(0);
|
|
@@ -90,14 +48,14 @@ function useTouchDrag(options = {}) {
|
|
|
90
48
|
if (result) {
|
|
91
49
|
if (result.x && lockX) {
|
|
92
50
|
const toX = "to" in result.x ? result.x.to : x;
|
|
93
|
-
dragX.value = buildReleaseAnimation(
|
|
51
|
+
dragX.value = chunkSFRNO6AW_js.buildReleaseAnimation(
|
|
94
52
|
result.x,
|
|
95
53
|
toX
|
|
96
54
|
);
|
|
97
55
|
}
|
|
98
56
|
if (result.y && lockY) {
|
|
99
57
|
const toY = "to" in result.y ? result.y.to : y;
|
|
100
|
-
dragY.value = buildReleaseAnimation(
|
|
58
|
+
dragY.value = chunkSFRNO6AW_js.buildReleaseAnimation(
|
|
101
59
|
result.y,
|
|
102
60
|
toY
|
|
103
61
|
);
|
package/dist/touch/index.mjs
CHANGED
|
@@ -1,50 +1,8 @@
|
|
|
1
|
+
import { buildReleaseAnimation } from '../chunk-6FENLMCA.mjs';
|
|
1
2
|
import { useMemo } from 'react';
|
|
2
3
|
import { PanResponder } from 'react-native';
|
|
3
|
-
import { useSharedValue, useAnimatedStyle
|
|
4
|
+
import { useSharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
|
4
5
|
|
|
5
|
-
// src/touch/useTouchDrag.ts
|
|
6
|
-
|
|
7
|
-
// src/transitions/spring.ts
|
|
8
|
-
var DEFAULT_SPRING = {
|
|
9
|
-
tension: 170,
|
|
10
|
-
friction: 26,
|
|
11
|
-
mass: 1
|
|
12
|
-
};
|
|
13
|
-
function springToReanimated(t) {
|
|
14
|
-
"worklet";
|
|
15
|
-
return {
|
|
16
|
-
stiffness: t.tension ?? DEFAULT_SPRING.tension,
|
|
17
|
-
damping: t.friction ?? DEFAULT_SPRING.friction,
|
|
18
|
-
mass: t.mass ?? DEFAULT_SPRING.mass,
|
|
19
|
-
velocity: t.velocity,
|
|
20
|
-
restSpeedThreshold: t.restSpeedThreshold,
|
|
21
|
-
restDisplacementThreshold: t.restDisplacementThreshold
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var DEFAULT_TIMING_DURATION = 250;
|
|
25
|
-
function buildReleaseAnimation(transition, toValue) {
|
|
26
|
-
"worklet";
|
|
27
|
-
if (transition.type === "no-animation") return toValue;
|
|
28
|
-
if (transition.type === "decay") {
|
|
29
|
-
const cfg = { velocity: transition.velocity ?? 0 };
|
|
30
|
-
if (transition.deceleration !== void 0) {
|
|
31
|
-
cfg.deceleration = transition.deceleration;
|
|
32
|
-
}
|
|
33
|
-
if (transition.clamp !== void 0) cfg.clamp = transition.clamp;
|
|
34
|
-
return withDecay(cfg);
|
|
35
|
-
}
|
|
36
|
-
if (transition.type === "timing") {
|
|
37
|
-
const e = transition.easing;
|
|
38
|
-
const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? Easing.inOut(Easing.ease);
|
|
39
|
-
return withTiming(toValue, {
|
|
40
|
-
duration: transition.duration ?? DEFAULT_TIMING_DURATION,
|
|
41
|
-
easing: easingFn
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return withSpring(toValue, springToReanimated(transition));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/touch/useTouchDrag.ts
|
|
48
6
|
function useTouchDrag(options = {}) {
|
|
49
7
|
const { axis = "both", constraints, elastic = 0 } = options;
|
|
50
8
|
const dragX = useSharedValue(0);
|
package/package.json
CHANGED