@rootnative/inertia 0.0.0-alpha.4 → 0.0.0-alpha.5
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 +16 -0
- package/dist/{chunk-5I3G43XA.js → chunk-2HYD2ZBK.js} +2 -2
- package/dist/chunk-3UTJJ4A3.js +8 -0
- package/dist/{chunk-Q6ZTMLTI.js → chunk-4PEHWDAZ.js} +7 -7
- package/dist/chunk-4QGXK6TF.js +8 -0
- package/dist/{chunk-WPPLZNM4.mjs → chunk-6SMPIOIC.mjs} +1 -1
- package/dist/{chunk-6EP3S2PN.js → chunk-7AOERN53.js} +3 -3
- package/dist/{chunk-6UQ4KA6V.js → chunk-7UDYEFBU.js} +22 -22
- package/dist/{chunk-K4KR5BIS.mjs → chunk-ALRHDFZE.mjs} +1 -1
- package/dist/{chunk-QQJSBIXV.mjs → chunk-CWLFUYIY.mjs} +1 -1
- package/dist/{chunk-6FENLMCA.mjs → chunk-CY7Y64C3.mjs} +17 -1
- package/dist/{chunk-I76OC6RX.mjs → chunk-DWCLIBYO.mjs} +2 -2
- package/dist/{chunk-IJNVUM5U.mjs → chunk-JVBXPF2G.mjs} +1 -1
- package/dist/{chunk-OBE7KTMK.mjs → chunk-NXDJZD6A.mjs} +1 -1
- package/dist/{chunk-SFRNO6AW.js → chunk-PTRF47DA.js} +17 -0
- package/dist/{chunk-L2EVRKSC.mjs → chunk-R63GIUNU.mjs} +1 -1
- package/dist/{chunk-ZQUCQRZT.mjs → chunk-RGNX6UZN.mjs} +2 -2
- package/dist/{chunk-OM5FXU4I.js → chunk-TDSO63CJ.js} +2 -2
- package/dist/chunk-Z7HIOFKQ.js +8 -0
- package/dist/gestureLayer/index.js +10 -10
- package/dist/gestureLayer/index.mjs +3 -3
- package/dist/index.d.mts +19 -11
- package/dist/index.d.ts +19 -11
- package/dist/index.js +52 -44
- package/dist/index.mjs +28 -20
- package/dist/motion/Image.js +5 -5
- package/dist/motion/Image.mjs +4 -4
- package/dist/motion/Pressable.js +5 -5
- package/dist/motion/Pressable.mjs +4 -4
- package/dist/motion/ScrollView.js +5 -5
- package/dist/motion/ScrollView.mjs +4 -4
- package/dist/motion/Text.js +5 -5
- package/dist/motion/Text.mjs +4 -4
- package/dist/motion/View.js +5 -5
- package/dist/motion/View.mjs +4 -4
- package/dist/touch/index.js +3 -3
- package/dist/touch/index.mjs +1 -1
- package/package.json +2 -2
- package/src/internal/nonWorkletWarning.ts +41 -0
- package/src/layout/resolveLayout.ts +3 -2
- package/src/transitions/easing.ts +13 -8
- package/src/values/useTransform.ts +28 -12
- package/dist/chunk-NDKVHL3N.js +0 -8
- package/dist/chunk-SCTX5Z7I.js +0 -8
- package/dist/chunk-WZGMAXKC.js +0 -8
package/dist/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
3
|
+
var chunk4PEHWDAZ_js = require('./chunk-4PEHWDAZ.js');
|
|
4
|
+
var chunk4QGXK6TF_js = require('./chunk-4QGXK6TF.js');
|
|
5
|
+
var chunkZ7HIOFKQ_js = require('./chunk-Z7HIOFKQ.js');
|
|
6
|
+
var chunk3UTJJ4A3_js = require('./chunk-3UTJJ4A3.js');
|
|
7
|
+
var chunkTDSO63CJ_js = require('./chunk-TDSO63CJ.js');
|
|
8
|
+
var chunk2HYD2ZBK_js = require('./chunk-2HYD2ZBK.js');
|
|
9
|
+
var chunk7UDYEFBU_js = require('./chunk-7UDYEFBU.js');
|
|
10
|
+
var chunk7AOERN53_js = require('./chunk-7AOERN53.js');
|
|
11
|
+
var chunkPTRF47DA_js = require('./chunk-PTRF47DA.js');
|
|
12
12
|
var react = require('react');
|
|
13
13
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
14
14
|
var reactNativeWorklets = require('react-native-worklets');
|
|
15
15
|
|
|
16
16
|
// src/motion/index.ts
|
|
17
17
|
var Motion = {
|
|
18
|
-
View:
|
|
19
|
-
Text:
|
|
20
|
-
Image:
|
|
21
|
-
Pressable:
|
|
22
|
-
ScrollView:
|
|
18
|
+
View: chunk4QGXK6TF_js.MotionView,
|
|
19
|
+
Text: chunkZ7HIOFKQ_js.MotionText,
|
|
20
|
+
Image: chunk3UTJJ4A3_js.MotionImage,
|
|
21
|
+
Pressable: chunkTDSO63CJ_js.MotionPressable,
|
|
22
|
+
ScrollView: chunk2HYD2ZBK_js.MotionScrollView
|
|
23
23
|
};
|
|
24
24
|
function useAnimation(target, transition) {
|
|
25
25
|
const output = reactNativeReanimated.useSharedValue(target);
|
|
26
|
-
const shouldReduceMotion =
|
|
27
|
-
const resolved =
|
|
28
|
-
const cfgSig =
|
|
26
|
+
const shouldReduceMotion = chunk7AOERN53_js.useShouldReduceMotion();
|
|
27
|
+
const resolved = chunk7AOERN53_js.resolveNamedTransition(transition, chunk7AOERN53_js.useNamedTransitions());
|
|
28
|
+
const cfgSig = chunkPTRF47DA_js.stableSig(resolved);
|
|
29
29
|
react.useEffect(() => {
|
|
30
30
|
const cfg = shouldReduceMotion ? { type: "no-animation" } : resolved ?? { type: "spring" };
|
|
31
|
-
output.value =
|
|
31
|
+
output.value = chunkPTRF47DA_js.resolveTransition(cfg, target);
|
|
32
32
|
}, [target, cfgSig, shouldReduceMotion]);
|
|
33
33
|
return output;
|
|
34
34
|
}
|
|
35
35
|
function useSpring(target, config) {
|
|
36
|
-
const spring = resolveSpringInput(config,
|
|
36
|
+
const spring = resolveSpringInput(config, chunk7AOERN53_js.useNamedTransitions());
|
|
37
37
|
const reanimConfig = react.useMemo(
|
|
38
|
-
() =>
|
|
38
|
+
() => chunkPTRF47DA_js.springToReanimated(spring ?? {}),
|
|
39
39
|
// Keyed on the resolved primitive fields rather than the `config` object
|
|
40
40
|
// identity: callers routinely pass a fresh object literal each render, so
|
|
41
41
|
// depending on `config` itself would rebuild the Reanimated config on
|
|
@@ -74,7 +74,7 @@ function useSpring(target, config) {
|
|
|
74
74
|
}
|
|
75
75
|
function resolveSpringInput(config, registry) {
|
|
76
76
|
if (typeof config !== "string") return config;
|
|
77
|
-
const cfg =
|
|
77
|
+
const cfg = chunk7AOERN53_js.lookupNamedTransition(config, registry);
|
|
78
78
|
if (cfg.type === void 0 || cfg.type === "spring") return cfg;
|
|
79
79
|
if (__DEV__) {
|
|
80
80
|
console.warn(
|
|
@@ -107,10 +107,18 @@ function useTransform(arg1, inputRange, outputRange, options) {
|
|
|
107
107
|
let producer;
|
|
108
108
|
if (typeof arg1 === "function") {
|
|
109
109
|
const userFn = arg1;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (reactNativeWorklets.isWorkletFunction(userFn)) {
|
|
111
|
+
producer = userFn;
|
|
112
|
+
} else {
|
|
113
|
+
chunkPTRF47DA_js.warnNonWorkletOnce(
|
|
114
|
+
"useTransform-transformer",
|
|
115
|
+
"[inertia] useTransform: the transformer is not a worklet, so the shared values it reads can't be tracked as dependencies \u2014 the derived value will only refresh on React re-renders, and native builds reject plain functions on the UI thread. Add the 'worklet' directive as the first statement of the transformer."
|
|
116
|
+
);
|
|
117
|
+
producer = () => {
|
|
118
|
+
"worklet";
|
|
119
|
+
return userFn();
|
|
120
|
+
};
|
|
121
|
+
}
|
|
114
122
|
} else {
|
|
115
123
|
const source = arg1;
|
|
116
124
|
const input = inputRange;
|
|
@@ -240,79 +248,79 @@ function useVariants(variants, initial) {
|
|
|
240
248
|
|
|
241
249
|
Object.defineProperty(exports, "useGesture", {
|
|
242
250
|
enumerable: true,
|
|
243
|
-
get: function () { return
|
|
251
|
+
get: function () { return chunk4PEHWDAZ_js.useGesture; }
|
|
244
252
|
});
|
|
245
253
|
Object.defineProperty(exports, "MotionView", {
|
|
246
254
|
enumerable: true,
|
|
247
|
-
get: function () { return
|
|
255
|
+
get: function () { return chunk4QGXK6TF_js.MotionView; }
|
|
248
256
|
});
|
|
249
257
|
Object.defineProperty(exports, "MotionText", {
|
|
250
258
|
enumerable: true,
|
|
251
|
-
get: function () { return
|
|
259
|
+
get: function () { return chunkZ7HIOFKQ_js.MotionText; }
|
|
252
260
|
});
|
|
253
261
|
Object.defineProperty(exports, "MotionImage", {
|
|
254
262
|
enumerable: true,
|
|
255
|
-
get: function () { return
|
|
263
|
+
get: function () { return chunk3UTJJ4A3_js.MotionImage; }
|
|
256
264
|
});
|
|
257
265
|
Object.defineProperty(exports, "MotionPressable", {
|
|
258
266
|
enumerable: true,
|
|
259
|
-
get: function () { return
|
|
267
|
+
get: function () { return chunkTDSO63CJ_js.MotionPressable; }
|
|
260
268
|
});
|
|
261
269
|
Object.defineProperty(exports, "MotionScrollView", {
|
|
262
270
|
enumerable: true,
|
|
263
|
-
get: function () { return
|
|
271
|
+
get: function () { return chunk2HYD2ZBK_js.MotionScrollView; }
|
|
264
272
|
});
|
|
265
273
|
Object.defineProperty(exports, "Presence", {
|
|
266
274
|
enumerable: true,
|
|
267
|
-
get: function () { return
|
|
275
|
+
get: function () { return chunk7UDYEFBU_js.Presence; }
|
|
268
276
|
});
|
|
269
277
|
Object.defineProperty(exports, "createMotionComponent", {
|
|
270
278
|
enumerable: true,
|
|
271
|
-
get: function () { return
|
|
279
|
+
get: function () { return chunk7UDYEFBU_js.createMotionComponent; }
|
|
272
280
|
});
|
|
273
281
|
Object.defineProperty(exports, "usePresence", {
|
|
274
282
|
enumerable: true,
|
|
275
|
-
get: function () { return
|
|
283
|
+
get: function () { return chunk7UDYEFBU_js.usePresence; }
|
|
276
284
|
});
|
|
277
285
|
Object.defineProperty(exports, "MotionConfig", {
|
|
278
286
|
enumerable: true,
|
|
279
|
-
get: function () { return
|
|
287
|
+
get: function () { return chunk7AOERN53_js.MotionConfig; }
|
|
280
288
|
});
|
|
281
289
|
Object.defineProperty(exports, "resolveNamedTransition", {
|
|
282
290
|
enumerable: true,
|
|
283
|
-
get: function () { return
|
|
291
|
+
get: function () { return chunk7AOERN53_js.resolveNamedTransition; }
|
|
284
292
|
});
|
|
285
293
|
Object.defineProperty(exports, "useMotionConfig", {
|
|
286
294
|
enumerable: true,
|
|
287
|
-
get: function () { return
|
|
295
|
+
get: function () { return chunk7AOERN53_js.useMotionConfig; }
|
|
288
296
|
});
|
|
289
297
|
Object.defineProperty(exports, "useNamedTransitions", {
|
|
290
298
|
enumerable: true,
|
|
291
|
-
get: function () { return
|
|
299
|
+
get: function () { return chunk7AOERN53_js.useNamedTransitions; }
|
|
292
300
|
});
|
|
293
301
|
Object.defineProperty(exports, "useShouldReduceMotion", {
|
|
294
302
|
enumerable: true,
|
|
295
|
-
get: function () { return
|
|
303
|
+
get: function () { return chunk7AOERN53_js.useShouldReduceMotion; }
|
|
296
304
|
});
|
|
297
305
|
Object.defineProperty(exports, "buildReleaseAnimation", {
|
|
298
306
|
enumerable: true,
|
|
299
|
-
get: function () { return
|
|
307
|
+
get: function () { return chunkPTRF47DA_js.buildReleaseAnimation; }
|
|
300
308
|
});
|
|
301
309
|
Object.defineProperty(exports, "cubicBezier", {
|
|
302
310
|
enumerable: true,
|
|
303
|
-
get: function () { return
|
|
311
|
+
get: function () { return chunkPTRF47DA_js.cubicBezier; }
|
|
304
312
|
});
|
|
305
313
|
Object.defineProperty(exports, "ensureWorkletEasing", {
|
|
306
314
|
enumerable: true,
|
|
307
|
-
get: function () { return
|
|
315
|
+
get: function () { return chunkPTRF47DA_js.ensureWorkletEasing; }
|
|
308
316
|
});
|
|
309
317
|
Object.defineProperty(exports, "resolveAnimatableValue", {
|
|
310
318
|
enumerable: true,
|
|
311
|
-
get: function () { return
|
|
319
|
+
get: function () { return chunkPTRF47DA_js.resolveAnimatableValue; }
|
|
312
320
|
});
|
|
313
321
|
Object.defineProperty(exports, "resolveTransition", {
|
|
314
322
|
enumerable: true,
|
|
315
|
-
get: function () { return
|
|
323
|
+
get: function () { return chunkPTRF47DA_js.resolveTransition; }
|
|
316
324
|
});
|
|
317
325
|
exports.Motion = Motion;
|
|
318
326
|
exports.useAnimation = useAnimation;
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export { useGesture } from './chunk-
|
|
2
|
-
import { MotionView } from './chunk-
|
|
3
|
-
export { MotionView } from './chunk-
|
|
4
|
-
import { MotionText } from './chunk-
|
|
5
|
-
export { MotionText } from './chunk-
|
|
6
|
-
import { MotionImage } from './chunk-
|
|
7
|
-
export { MotionImage } from './chunk-
|
|
8
|
-
import { MotionPressable } from './chunk-
|
|
9
|
-
export { MotionPressable } from './chunk-
|
|
10
|
-
import { MotionScrollView } from './chunk-
|
|
11
|
-
export { MotionScrollView } from './chunk-
|
|
12
|
-
export { Presence, createMotionComponent, usePresence } from './chunk-
|
|
13
|
-
import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-
|
|
14
|
-
export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-
|
|
15
|
-
import { stableSig, resolveTransition, springToReanimated } from './chunk-
|
|
16
|
-
export { buildReleaseAnimation, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveTransition } from './chunk-
|
|
1
|
+
export { useGesture } from './chunk-RGNX6UZN.mjs';
|
|
2
|
+
import { MotionView } from './chunk-6SMPIOIC.mjs';
|
|
3
|
+
export { MotionView } from './chunk-6SMPIOIC.mjs';
|
|
4
|
+
import { MotionText } from './chunk-JVBXPF2G.mjs';
|
|
5
|
+
export { MotionText } from './chunk-JVBXPF2G.mjs';
|
|
6
|
+
import { MotionImage } from './chunk-ALRHDFZE.mjs';
|
|
7
|
+
export { MotionImage } from './chunk-ALRHDFZE.mjs';
|
|
8
|
+
import { MotionPressable } from './chunk-NXDJZD6A.mjs';
|
|
9
|
+
export { MotionPressable } from './chunk-NXDJZD6A.mjs';
|
|
10
|
+
import { MotionScrollView } from './chunk-CWLFUYIY.mjs';
|
|
11
|
+
export { MotionScrollView } from './chunk-CWLFUYIY.mjs';
|
|
12
|
+
export { Presence, createMotionComponent, usePresence } from './chunk-DWCLIBYO.mjs';
|
|
13
|
+
import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-R63GIUNU.mjs';
|
|
14
|
+
export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-R63GIUNU.mjs';
|
|
15
|
+
import { stableSig, resolveTransition, springToReanimated, warnNonWorkletOnce } from './chunk-CY7Y64C3.mjs';
|
|
16
|
+
export { buildReleaseAnimation, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveTransition } from './chunk-CY7Y64C3.mjs';
|
|
17
17
|
import { useEffect, useMemo, useRef } from 'react';
|
|
18
18
|
import { useSharedValue, withSpring, useAnimatedReaction, useAnimatedStyle, interpolateColor, useDerivedValue, Extrapolation, useAnimatedScrollHandler, interpolate } from 'react-native-reanimated';
|
|
19
19
|
import { isWorkletFunction } from 'react-native-worklets';
|
|
@@ -112,10 +112,18 @@ function useTransform(arg1, inputRange, outputRange, options) {
|
|
|
112
112
|
let producer;
|
|
113
113
|
if (typeof arg1 === "function") {
|
|
114
114
|
const userFn = arg1;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
if (isWorkletFunction(userFn)) {
|
|
116
|
+
producer = userFn;
|
|
117
|
+
} else {
|
|
118
|
+
warnNonWorkletOnce(
|
|
119
|
+
"useTransform-transformer",
|
|
120
|
+
"[inertia] useTransform: the transformer is not a worklet, so the shared values it reads can't be tracked as dependencies \u2014 the derived value will only refresh on React re-renders, and native builds reject plain functions on the UI thread. Add the 'worklet' directive as the first statement of the transformer."
|
|
121
|
+
);
|
|
122
|
+
producer = () => {
|
|
123
|
+
"worklet";
|
|
124
|
+
return userFn();
|
|
125
|
+
};
|
|
126
|
+
}
|
|
119
127
|
} else {
|
|
120
128
|
const source = arg1;
|
|
121
129
|
const input = inputRange;
|
package/dist/motion/Image.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk3UTJJ4A3_js = require('../chunk-3UTJJ4A3.js');
|
|
4
|
+
require('../chunk-7UDYEFBU.js');
|
|
5
|
+
require('../chunk-7AOERN53.js');
|
|
6
|
+
require('../chunk-PTRF47DA.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionImage", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk3UTJJ4A3_js.MotionImage; }
|
|
13
13
|
});
|
package/dist/motion/Image.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionImage } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionImage } from '../chunk-ALRHDFZE.mjs';
|
|
2
|
+
import '../chunk-DWCLIBYO.mjs';
|
|
3
|
+
import '../chunk-R63GIUNU.mjs';
|
|
4
|
+
import '../chunk-CY7Y64C3.mjs';
|
package/dist/motion/Pressable.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkTDSO63CJ_js = require('../chunk-TDSO63CJ.js');
|
|
4
|
+
require('../chunk-7UDYEFBU.js');
|
|
5
|
+
require('../chunk-7AOERN53.js');
|
|
6
|
+
require('../chunk-PTRF47DA.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionPressable", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkTDSO63CJ_js.MotionPressable; }
|
|
13
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionPressable } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionPressable } from '../chunk-NXDJZD6A.mjs';
|
|
2
|
+
import '../chunk-DWCLIBYO.mjs';
|
|
3
|
+
import '../chunk-R63GIUNU.mjs';
|
|
4
|
+
import '../chunk-CY7Y64C3.mjs';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk2HYD2ZBK_js = require('../chunk-2HYD2ZBK.js');
|
|
4
|
+
require('../chunk-7UDYEFBU.js');
|
|
5
|
+
require('../chunk-7AOERN53.js');
|
|
6
|
+
require('../chunk-PTRF47DA.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionScrollView", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk2HYD2ZBK_js.MotionScrollView; }
|
|
13
13
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionScrollView } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionScrollView } from '../chunk-CWLFUYIY.mjs';
|
|
2
|
+
import '../chunk-DWCLIBYO.mjs';
|
|
3
|
+
import '../chunk-R63GIUNU.mjs';
|
|
4
|
+
import '../chunk-CY7Y64C3.mjs';
|
package/dist/motion/Text.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkZ7HIOFKQ_js = require('../chunk-Z7HIOFKQ.js');
|
|
4
|
+
require('../chunk-7UDYEFBU.js');
|
|
5
|
+
require('../chunk-7AOERN53.js');
|
|
6
|
+
require('../chunk-PTRF47DA.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionText", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkZ7HIOFKQ_js.MotionText; }
|
|
13
13
|
});
|
package/dist/motion/Text.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionText } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionText } from '../chunk-JVBXPF2G.mjs';
|
|
2
|
+
import '../chunk-DWCLIBYO.mjs';
|
|
3
|
+
import '../chunk-R63GIUNU.mjs';
|
|
4
|
+
import '../chunk-CY7Y64C3.mjs';
|
package/dist/motion/View.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunk4QGXK6TF_js = require('../chunk-4QGXK6TF.js');
|
|
4
|
+
require('../chunk-7UDYEFBU.js');
|
|
5
|
+
require('../chunk-7AOERN53.js');
|
|
6
|
+
require('../chunk-PTRF47DA.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "MotionView", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunk4QGXK6TF_js.MotionView; }
|
|
13
13
|
});
|
package/dist/motion/View.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MotionView } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
export { MotionView } from '../chunk-6SMPIOIC.mjs';
|
|
2
|
+
import '../chunk-DWCLIBYO.mjs';
|
|
3
|
+
import '../chunk-R63GIUNU.mjs';
|
|
4
|
+
import '../chunk-CY7Y64C3.mjs';
|
package/dist/touch/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPTRF47DA_js = require('../chunk-PTRF47DA.js');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var reactNative = require('react-native');
|
|
6
6
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
@@ -48,14 +48,14 @@ function useTouchDrag(options = {}) {
|
|
|
48
48
|
if (result) {
|
|
49
49
|
if (result.x && lockX) {
|
|
50
50
|
const toX = "to" in result.x ? result.x.to : x;
|
|
51
|
-
dragX.value =
|
|
51
|
+
dragX.value = chunkPTRF47DA_js.buildReleaseAnimation(
|
|
52
52
|
result.x,
|
|
53
53
|
toX
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
if (result.y && lockY) {
|
|
57
57
|
const toY = "to" in result.y ? result.y.to : y;
|
|
58
|
-
dragY.value =
|
|
58
|
+
dragY.value = chunkPTRF47DA_js.buildReleaseAnimation(
|
|
59
59
|
result.y,
|
|
60
60
|
toY
|
|
61
61
|
);
|
package/dist/touch/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildReleaseAnimation } from '../chunk-
|
|
1
|
+
import { buildReleaseAnimation } from '../chunk-CY7Y64C3.mjs';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { PanResponder } from 'react-native';
|
|
4
4
|
import { useSharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rootnative/inertia",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.5",
|
|
4
4
|
"description": "Declarative animation primitives for React Native, built on react-native-reanimated.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "RootNative",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"scripts": {
|
|
143
143
|
"build": "tsup",
|
|
144
144
|
"dev": "tsup --watch",
|
|
145
|
-
"typecheck": "tsc --noEmit",
|
|
145
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
|
|
146
146
|
"test": "jest",
|
|
147
147
|
"size": "size-limit",
|
|
148
148
|
"size:why": "size-limit --why",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const __DEV__: boolean
|
|
2
|
+
|
|
3
|
+
// The core package intentionally has no Node types — declare the minimal
|
|
4
|
+
// shape needed for the Jest detection below (guarded by a typeof check, so
|
|
5
|
+
// environments without `process` are fine).
|
|
6
|
+
declare const process: { env?: Record<string, string | undefined> } | undefined
|
|
7
|
+
|
|
8
|
+
const warned = new Set<string>()
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Dev-only, once-per-key warning for plain (non-worklet) functions handed to
|
|
12
|
+
* surfaces that need real worklets — `useTransform` transformers and custom
|
|
13
|
+
* `timing.easing` functions.
|
|
14
|
+
*
|
|
15
|
+
* Why this can't be papered over with an auto-wrap: wrapping a plain
|
|
16
|
+
* function in a `'worklet'`-directive closure captures the *function
|
|
17
|
+
* reference*, not the shared values it reads. Even when the consumer's
|
|
18
|
+
* Babel plugin workletizes the wrapper, its `__closure` contains only the
|
|
19
|
+
* opaque JS function — Reanimated cannot extract the shared values read
|
|
20
|
+
* inside it as dependencies (so derived values never refresh), and native
|
|
21
|
+
* builds reject the plain function when the closure is serialized to the UI
|
|
22
|
+
* thread. The only correct authoring is the `'worklet'` directive on the
|
|
23
|
+
* consumer's own function, where *their* Babel pass captures the real
|
|
24
|
+
* closure.
|
|
25
|
+
*
|
|
26
|
+
* Suppressed under Jest: the shared Reanimated/worklets test stubs report
|
|
27
|
+
* every function as non-worklet, which would turn the warning into noise in
|
|
28
|
+
* every consumer's test suite.
|
|
29
|
+
*/
|
|
30
|
+
export function warnNonWorkletOnce(key: string, message: string): void {
|
|
31
|
+
if (!__DEV__) return
|
|
32
|
+
if (typeof process !== 'undefined' && process.env?.JEST_WORKER_ID) return
|
|
33
|
+
if (warned.has(key)) return
|
|
34
|
+
warned.add(key)
|
|
35
|
+
console.warn(message)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @internal — test-only hook to reset the once-per-key state. */
|
|
39
|
+
export function __resetNonWorkletWarningsForTests(): void {
|
|
40
|
+
warned.clear()
|
|
41
|
+
}
|
|
@@ -13,8 +13,9 @@ export type LayoutProp = boolean | TransitionConfig | undefined
|
|
|
13
13
|
* - `true` → default spring with the library's tuned tension / friction / mass.
|
|
14
14
|
* - `{ type: 'spring', ... }` → spring with react-spring vocabulary, bridged
|
|
15
15
|
* into `springify().damping().stiffness().mass()` via `springToReanimated`.
|
|
16
|
-
* - `{ type: 'timing', ... }` → `.duration().easing()`.
|
|
17
|
-
*
|
|
16
|
+
* - `{ type: 'timing', ... }` → `.duration().easing()`. Custom easing fns
|
|
17
|
+
* must be worklets (Reanimated 3.9+ validates this); plain functions
|
|
18
|
+
* dev-warn via `ensureWorkletEasing`.
|
|
18
19
|
* - `{ type: 'decay', ... }` → silently downgrades to spring; decay doesn't
|
|
19
20
|
* have a clear target for a layout transition.
|
|
20
21
|
*
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
// `isWorkletFunction` lives in `react-native-worklets` (the Reanimated 4 peer
|
|
2
2
|
// dep); Reanimated's own re-export is deprecated.
|
|
3
3
|
import { isWorkletFunction } from 'react-native-worklets'
|
|
4
|
+
import { warnNonWorkletOnce } from '../internal/nonWorkletWarning'
|
|
4
5
|
import { type EasingInput } from '../types'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Reanimated 3.9+ validates that easing functions used in nested-transition
|
|
8
9
|
* contexts (variants, sequences, per-property maps) are worklets, and crashes
|
|
9
|
-
* with `[Reanimated] The easing function is not a worklet` otherwise.
|
|
10
|
-
* library accepts plain functions on the public surface; this helper wraps
|
|
11
|
-
* them so consumers don't have to think about the worklet boundary.
|
|
10
|
+
* with `[Reanimated] The easing function is not a worklet` otherwise.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* wrapper
|
|
12
|
+
* Custom easing functions MUST therefore be worklets — put the `'worklet'`
|
|
13
|
+
* directive as the function's first statement (Reanimated's built-in
|
|
14
|
+
* `Easing.*` helpers and inertia's `cubicBezier()` already are). A plain
|
|
15
|
+
* function warns in dev and falls back to a directive-wrapped call-through;
|
|
16
|
+
* that wrapper works on web (single-threaded) but its closure holds the
|
|
17
|
+
* opaque plain function, which native builds reject when the transition's
|
|
18
|
+
* config is serialized to the UI thread.
|
|
18
19
|
*
|
|
19
20
|
* Reanimated 4 changed `Easing.bezier(...)` to return an
|
|
20
21
|
* `EasingFunctionFactory` (`{ factory: () => EasingFunction }`) rather than
|
|
@@ -34,6 +35,10 @@ export function ensureWorkletEasing(
|
|
|
34
35
|
// ends up in the transition config.
|
|
35
36
|
const fn = isEasingFactory(easing) ? easing.factory() : easing
|
|
36
37
|
if (isWorkletFunction(fn)) return fn
|
|
38
|
+
warnNonWorkletOnce(
|
|
39
|
+
'timing-easing',
|
|
40
|
+
"[inertia] timing easing: the provided easing function is not a worklet. The fallback wrapper works on web but native builds reject it when the transition runs on the UI thread. Add the 'worklet' directive as the first statement of the easing function, or use Reanimated's Easing.* helpers / inertia's cubicBezier(), which are already worklets.",
|
|
41
|
+
)
|
|
37
42
|
const wrapped = (t: number) => {
|
|
38
43
|
'worklet'
|
|
39
44
|
return fn(t)
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
// `react-native-worklets` is a required peer of Reanimated 4, so the direct
|
|
11
11
|
// import is always available wherever Inertia is.
|
|
12
12
|
import { isWorkletFunction } from 'react-native-worklets'
|
|
13
|
+
import { warnNonWorkletOnce } from '../internal/nonWorkletWarning'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Extrapolation behavior at the edges of the input range. Mirrors
|
|
@@ -36,9 +37,17 @@ export interface UseTransformOptions {
|
|
|
36
37
|
* const distance = useTransform(() => Math.sqrt(x.value ** 2 + y.value ** 2))
|
|
37
38
|
* ```
|
|
38
39
|
*
|
|
39
|
-
* The transformer
|
|
40
|
-
*
|
|
41
|
-
*
|
|
40
|
+
* The transformer MUST be a worklet — put the `'worklet'` directive as its
|
|
41
|
+
* first statement so the consumer's Babel plugin captures the shared values
|
|
42
|
+
* it reads as its closure. It runs on the UI thread on every frame where
|
|
43
|
+
* any read shared value changes.
|
|
44
|
+
*
|
|
45
|
+
* A plain function cannot work here, and the hook warns in dev when it gets
|
|
46
|
+
* one: the best-effort wrapper it falls back to closes over the opaque
|
|
47
|
+
* function reference, not the shared values read inside it, so Reanimated
|
|
48
|
+
* can't track them as dependencies — the derived value only refreshes on
|
|
49
|
+
* React re-renders, and native builds reject the plain function when the
|
|
50
|
+
* closure crosses to the UI thread.
|
|
42
51
|
*/
|
|
43
52
|
export function useTransform<T>(transformer: () => T): SharedValue<T>
|
|
44
53
|
|
|
@@ -80,16 +89,23 @@ export function useTransform<T>(
|
|
|
80
89
|
// interpolation) is decided once at JS time, never at frame time.
|
|
81
90
|
let producer: () => unknown
|
|
82
91
|
if (typeof arg1 === 'function') {
|
|
83
|
-
// Transformer overload.
|
|
84
|
-
//
|
|
85
|
-
//
|
|
92
|
+
// Transformer overload. Must be a worklet — the directive-wrapped
|
|
93
|
+
// fallback below is best-effort only (its closure holds the opaque
|
|
94
|
+
// function, not the shared values read inside it, so dependency
|
|
95
|
+
// tracking cannot work — see `warnNonWorkletOnce`).
|
|
86
96
|
const userFn = arg1 as () => T
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
if (isWorkletFunction(userFn)) {
|
|
98
|
+
producer = userFn
|
|
99
|
+
} else {
|
|
100
|
+
warnNonWorkletOnce(
|
|
101
|
+
'useTransform-transformer',
|
|
102
|
+
"[inertia] useTransform: the transformer is not a worklet, so the shared values it reads can't be tracked as dependencies — the derived value will only refresh on React re-renders, and native builds reject plain functions on the UI thread. Add the 'worklet' directive as the first statement of the transformer.",
|
|
103
|
+
)
|
|
104
|
+
producer = () => {
|
|
105
|
+
'worklet'
|
|
106
|
+
return userFn()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
93
109
|
} else {
|
|
94
110
|
// Interpolation overload. We pre-resolve everything JS-side so the
|
|
95
111
|
// worklet body only consumes flat values.
|
package/dist/chunk-NDKVHL3N.js
DELETED
package/dist/chunk-SCTX5Z7I.js
DELETED