@rootnative/inertia 0.0.0-alpha.3 → 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.
Files changed (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{chunk-S4AEU72O.js → chunk-2HYD2ZBK.js} +2 -2
  3. package/dist/chunk-3UTJJ4A3.js +8 -0
  4. package/dist/{chunk-K7ICHCTZ.js → chunk-4PEHWDAZ.js} +7 -7
  5. package/dist/chunk-4QGXK6TF.js +8 -0
  6. package/dist/{chunk-RJNR7CFN.mjs → chunk-6SMPIOIC.mjs} +1 -1
  7. package/dist/{chunk-JWHKMNYA.js → chunk-7AOERN53.js} +4 -3
  8. package/dist/{chunk-KVSJWO5X.js → chunk-7UDYEFBU.js} +22 -22
  9. package/dist/{chunk-UM3WVSKQ.mjs → chunk-ALRHDFZE.mjs} +1 -1
  10. package/dist/{chunk-KARV7QKF.mjs → chunk-CWLFUYIY.mjs} +1 -1
  11. package/dist/{chunk-6FENLMCA.mjs → chunk-CY7Y64C3.mjs} +17 -1
  12. package/dist/{chunk-UXK4YCT6.mjs → chunk-DWCLIBYO.mjs} +2 -2
  13. package/dist/{chunk-FSPQVLBF.mjs → chunk-JVBXPF2G.mjs} +1 -1
  14. package/dist/{chunk-E4MDU4YV.mjs → chunk-NXDJZD6A.mjs} +1 -1
  15. package/dist/{chunk-SFRNO6AW.js → chunk-PTRF47DA.js} +17 -0
  16. package/dist/{chunk-GJD4VVAS.mjs → chunk-R63GIUNU.mjs} +2 -1
  17. package/dist/{chunk-W6IS4HAK.mjs → chunk-RGNX6UZN.mjs} +2 -2
  18. package/dist/{chunk-5RCMIJGZ.js → chunk-TDSO63CJ.js} +2 -2
  19. package/dist/chunk-Z7HIOFKQ.js +8 -0
  20. package/dist/gestureLayer/index.js +10 -10
  21. package/dist/gestureLayer/index.mjs +3 -3
  22. package/dist/index.d.mts +19 -11
  23. package/dist/index.d.ts +19 -11
  24. package/dist/index.js +52 -44
  25. package/dist/index.mjs +28 -20
  26. package/dist/motion/Image.js +5 -5
  27. package/dist/motion/Image.mjs +4 -4
  28. package/dist/motion/Pressable.js +5 -5
  29. package/dist/motion/Pressable.mjs +4 -4
  30. package/dist/motion/ScrollView.js +5 -5
  31. package/dist/motion/ScrollView.mjs +4 -4
  32. package/dist/motion/Text.js +5 -5
  33. package/dist/motion/Text.mjs +4 -4
  34. package/dist/motion/View.js +5 -5
  35. package/dist/motion/View.mjs +4 -4
  36. package/dist/touch/index.js +3 -3
  37. package/dist/touch/index.mjs +1 -1
  38. package/package.json +2 -2
  39. package/src/gestures/focusVisibility.ts +15 -4
  40. package/src/internal/nonWorkletWarning.ts +41 -0
  41. package/src/layout/resolveLayout.ts +3 -2
  42. package/src/transitions/easing.ts +13 -8
  43. package/src/values/useTransform.ts +28 -12
  44. package/dist/chunk-NJYRN3WG.js +0 -8
  45. package/dist/chunk-R3ODWDTI.js +0 -8
  46. package/dist/chunk-UMFBAFZP.js +0 -8
package/dist/index.js CHANGED
@@ -1,41 +1,41 @@
1
1
  'use strict';
2
2
 
3
- var chunkK7ICHCTZ_js = require('./chunk-K7ICHCTZ.js');
4
- var chunkNJYRN3WG_js = require('./chunk-NJYRN3WG.js');
5
- var chunkUMFBAFZP_js = require('./chunk-UMFBAFZP.js');
6
- var chunkR3ODWDTI_js = require('./chunk-R3ODWDTI.js');
7
- var chunk5RCMIJGZ_js = require('./chunk-5RCMIJGZ.js');
8
- var chunkS4AEU72O_js = require('./chunk-S4AEU72O.js');
9
- var chunkKVSJWO5X_js = require('./chunk-KVSJWO5X.js');
10
- var chunkJWHKMNYA_js = require('./chunk-JWHKMNYA.js');
11
- var chunkSFRNO6AW_js = require('./chunk-SFRNO6AW.js');
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: chunkNJYRN3WG_js.MotionView,
19
- Text: chunkUMFBAFZP_js.MotionText,
20
- Image: chunkR3ODWDTI_js.MotionImage,
21
- Pressable: chunk5RCMIJGZ_js.MotionPressable,
22
- ScrollView: chunkS4AEU72O_js.MotionScrollView
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 = chunkJWHKMNYA_js.useShouldReduceMotion();
27
- const resolved = chunkJWHKMNYA_js.resolveNamedTransition(transition, chunkJWHKMNYA_js.useNamedTransitions());
28
- const cfgSig = chunkSFRNO6AW_js.stableSig(resolved);
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 = chunkSFRNO6AW_js.resolveTransition(cfg, target);
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, chunkJWHKMNYA_js.useNamedTransitions());
36
+ const spring = resolveSpringInput(config, chunk7AOERN53_js.useNamedTransitions());
37
37
  const reanimConfig = react.useMemo(
38
- () => chunkSFRNO6AW_js.springToReanimated(spring ?? {}),
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 = chunkJWHKMNYA_js.lookupNamedTransition(config, registry);
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
- producer = reactNativeWorklets.isWorkletFunction(userFn) ? userFn : () => {
111
- "worklet";
112
- return userFn();
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 chunkK7ICHCTZ_js.useGesture; }
251
+ get: function () { return chunk4PEHWDAZ_js.useGesture; }
244
252
  });
245
253
  Object.defineProperty(exports, "MotionView", {
246
254
  enumerable: true,
247
- get: function () { return chunkNJYRN3WG_js.MotionView; }
255
+ get: function () { return chunk4QGXK6TF_js.MotionView; }
248
256
  });
249
257
  Object.defineProperty(exports, "MotionText", {
250
258
  enumerable: true,
251
- get: function () { return chunkUMFBAFZP_js.MotionText; }
259
+ get: function () { return chunkZ7HIOFKQ_js.MotionText; }
252
260
  });
253
261
  Object.defineProperty(exports, "MotionImage", {
254
262
  enumerable: true,
255
- get: function () { return chunkR3ODWDTI_js.MotionImage; }
263
+ get: function () { return chunk3UTJJ4A3_js.MotionImage; }
256
264
  });
257
265
  Object.defineProperty(exports, "MotionPressable", {
258
266
  enumerable: true,
259
- get: function () { return chunk5RCMIJGZ_js.MotionPressable; }
267
+ get: function () { return chunkTDSO63CJ_js.MotionPressable; }
260
268
  });
261
269
  Object.defineProperty(exports, "MotionScrollView", {
262
270
  enumerable: true,
263
- get: function () { return chunkS4AEU72O_js.MotionScrollView; }
271
+ get: function () { return chunk2HYD2ZBK_js.MotionScrollView; }
264
272
  });
265
273
  Object.defineProperty(exports, "Presence", {
266
274
  enumerable: true,
267
- get: function () { return chunkKVSJWO5X_js.Presence; }
275
+ get: function () { return chunk7UDYEFBU_js.Presence; }
268
276
  });
269
277
  Object.defineProperty(exports, "createMotionComponent", {
270
278
  enumerable: true,
271
- get: function () { return chunkKVSJWO5X_js.createMotionComponent; }
279
+ get: function () { return chunk7UDYEFBU_js.createMotionComponent; }
272
280
  });
273
281
  Object.defineProperty(exports, "usePresence", {
274
282
  enumerable: true,
275
- get: function () { return chunkKVSJWO5X_js.usePresence; }
283
+ get: function () { return chunk7UDYEFBU_js.usePresence; }
276
284
  });
277
285
  Object.defineProperty(exports, "MotionConfig", {
278
286
  enumerable: true,
279
- get: function () { return chunkJWHKMNYA_js.MotionConfig; }
287
+ get: function () { return chunk7AOERN53_js.MotionConfig; }
280
288
  });
281
289
  Object.defineProperty(exports, "resolveNamedTransition", {
282
290
  enumerable: true,
283
- get: function () { return chunkJWHKMNYA_js.resolveNamedTransition; }
291
+ get: function () { return chunk7AOERN53_js.resolveNamedTransition; }
284
292
  });
285
293
  Object.defineProperty(exports, "useMotionConfig", {
286
294
  enumerable: true,
287
- get: function () { return chunkJWHKMNYA_js.useMotionConfig; }
295
+ get: function () { return chunk7AOERN53_js.useMotionConfig; }
288
296
  });
289
297
  Object.defineProperty(exports, "useNamedTransitions", {
290
298
  enumerable: true,
291
- get: function () { return chunkJWHKMNYA_js.useNamedTransitions; }
299
+ get: function () { return chunk7AOERN53_js.useNamedTransitions; }
292
300
  });
293
301
  Object.defineProperty(exports, "useShouldReduceMotion", {
294
302
  enumerable: true,
295
- get: function () { return chunkJWHKMNYA_js.useShouldReduceMotion; }
303
+ get: function () { return chunk7AOERN53_js.useShouldReduceMotion; }
296
304
  });
297
305
  Object.defineProperty(exports, "buildReleaseAnimation", {
298
306
  enumerable: true,
299
- get: function () { return chunkSFRNO6AW_js.buildReleaseAnimation; }
307
+ get: function () { return chunkPTRF47DA_js.buildReleaseAnimation; }
300
308
  });
301
309
  Object.defineProperty(exports, "cubicBezier", {
302
310
  enumerable: true,
303
- get: function () { return chunkSFRNO6AW_js.cubicBezier; }
311
+ get: function () { return chunkPTRF47DA_js.cubicBezier; }
304
312
  });
305
313
  Object.defineProperty(exports, "ensureWorkletEasing", {
306
314
  enumerable: true,
307
- get: function () { return chunkSFRNO6AW_js.ensureWorkletEasing; }
315
+ get: function () { return chunkPTRF47DA_js.ensureWorkletEasing; }
308
316
  });
309
317
  Object.defineProperty(exports, "resolveAnimatableValue", {
310
318
  enumerable: true,
311
- get: function () { return chunkSFRNO6AW_js.resolveAnimatableValue; }
319
+ get: function () { return chunkPTRF47DA_js.resolveAnimatableValue; }
312
320
  });
313
321
  Object.defineProperty(exports, "resolveTransition", {
314
322
  enumerable: true,
315
- get: function () { return chunkSFRNO6AW_js.resolveTransition; }
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-W6IS4HAK.mjs';
2
- import { MotionView } from './chunk-RJNR7CFN.mjs';
3
- export { MotionView } from './chunk-RJNR7CFN.mjs';
4
- import { MotionText } from './chunk-FSPQVLBF.mjs';
5
- export { MotionText } from './chunk-FSPQVLBF.mjs';
6
- import { MotionImage } from './chunk-UM3WVSKQ.mjs';
7
- export { MotionImage } from './chunk-UM3WVSKQ.mjs';
8
- import { MotionPressable } from './chunk-E4MDU4YV.mjs';
9
- export { MotionPressable } from './chunk-E4MDU4YV.mjs';
10
- import { MotionScrollView } from './chunk-KARV7QKF.mjs';
11
- export { MotionScrollView } from './chunk-KARV7QKF.mjs';
12
- export { Presence, createMotionComponent, usePresence } from './chunk-UXK4YCT6.mjs';
13
- import { useShouldReduceMotion, resolveNamedTransition, useNamedTransitions, lookupNamedTransition } from './chunk-GJD4VVAS.mjs';
14
- export { MotionConfig, resolveNamedTransition, useMotionConfig, useNamedTransitions, useShouldReduceMotion } from './chunk-GJD4VVAS.mjs';
15
- import { stableSig, resolveTransition, springToReanimated } from './chunk-6FENLMCA.mjs';
16
- export { buildReleaseAnimation, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveTransition } from './chunk-6FENLMCA.mjs';
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
- producer = isWorkletFunction(userFn) ? userFn : () => {
116
- "worklet";
117
- return userFn();
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;
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkR3ODWDTI_js = require('../chunk-R3ODWDTI.js');
4
- require('../chunk-KVSJWO5X.js');
5
- require('../chunk-JWHKMNYA.js');
6
- require('../chunk-SFRNO6AW.js');
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 chunkR3ODWDTI_js.MotionImage; }
12
+ get: function () { return chunk3UTJJ4A3_js.MotionImage; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionImage } from '../chunk-UM3WVSKQ.mjs';
2
- import '../chunk-UXK4YCT6.mjs';
3
- import '../chunk-GJD4VVAS.mjs';
4
- import '../chunk-6FENLMCA.mjs';
1
+ export { MotionImage } from '../chunk-ALRHDFZE.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 chunk5RCMIJGZ_js = require('../chunk-5RCMIJGZ.js');
4
- require('../chunk-KVSJWO5X.js');
5
- require('../chunk-JWHKMNYA.js');
6
- require('../chunk-SFRNO6AW.js');
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 chunk5RCMIJGZ_js.MotionPressable; }
12
+ get: function () { return chunkTDSO63CJ_js.MotionPressable; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionPressable } from '../chunk-E4MDU4YV.mjs';
2
- import '../chunk-UXK4YCT6.mjs';
3
- import '../chunk-GJD4VVAS.mjs';
4
- import '../chunk-6FENLMCA.mjs';
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 chunkS4AEU72O_js = require('../chunk-S4AEU72O.js');
4
- require('../chunk-KVSJWO5X.js');
5
- require('../chunk-JWHKMNYA.js');
6
- require('../chunk-SFRNO6AW.js');
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 chunkS4AEU72O_js.MotionScrollView; }
12
+ get: function () { return chunk2HYD2ZBK_js.MotionScrollView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionScrollView } from '../chunk-KARV7QKF.mjs';
2
- import '../chunk-UXK4YCT6.mjs';
3
- import '../chunk-GJD4VVAS.mjs';
4
- import '../chunk-6FENLMCA.mjs';
1
+ export { MotionScrollView } from '../chunk-CWLFUYIY.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 chunkUMFBAFZP_js = require('../chunk-UMFBAFZP.js');
4
- require('../chunk-KVSJWO5X.js');
5
- require('../chunk-JWHKMNYA.js');
6
- require('../chunk-SFRNO6AW.js');
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 chunkUMFBAFZP_js.MotionText; }
12
+ get: function () { return chunkZ7HIOFKQ_js.MotionText; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionText } from '../chunk-FSPQVLBF.mjs';
2
- import '../chunk-UXK4YCT6.mjs';
3
- import '../chunk-GJD4VVAS.mjs';
4
- import '../chunk-6FENLMCA.mjs';
1
+ export { MotionText } from '../chunk-JVBXPF2G.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 chunkNJYRN3WG_js = require('../chunk-NJYRN3WG.js');
4
- require('../chunk-KVSJWO5X.js');
5
- require('../chunk-JWHKMNYA.js');
6
- require('../chunk-SFRNO6AW.js');
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 chunkNJYRN3WG_js.MotionView; }
12
+ get: function () { return chunk4QGXK6TF_js.MotionView; }
13
13
  });
@@ -1,4 +1,4 @@
1
- export { MotionView } from '../chunk-RJNR7CFN.mjs';
2
- import '../chunk-UXK4YCT6.mjs';
3
- import '../chunk-GJD4VVAS.mjs';
4
- import '../chunk-6FENLMCA.mjs';
1
+ export { MotionView } from '../chunk-6SMPIOIC.mjs';
2
+ import '../chunk-DWCLIBYO.mjs';
3
+ import '../chunk-R63GIUNU.mjs';
4
+ import '../chunk-CY7Y64C3.mjs';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkSFRNO6AW_js = require('../chunk-SFRNO6AW.js');
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 = chunkSFRNO6AW_js.buildReleaseAnimation(
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 = chunkSFRNO6AW_js.buildReleaseAnimation(
58
+ dragY.value = chunkPTRF47DA_js.buildReleaseAnimation(
59
59
  result.y,
60
60
  toY
61
61
  );
@@ -1,4 +1,4 @@
1
- import { buildReleaseAnimation } from '../chunk-6FENLMCA.mjs';
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",
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",
@@ -12,10 +12,15 @@ import { Platform } from 'react-native'
12
12
  * arrives via D-pad, screen reader, or hardware keyboard, all of which are
13
13
  * keyboard-equivalent — so `isFocusVisible()` is unconditionally `true`.
14
14
  *
15
- * The web listeners attach lazily on first call (capture phase, so they run
16
- * before the focus event reaches the focused element) and stay installed for
17
- * the lifetime of the document. They are passive and idle-cheap; the cost is
18
- * one boolean read per `onFocus` dispatch.
15
+ * The web listeners attach eagerly at module import (capture phase, so they
16
+ * run before the focus event reaches the focused element) and stay installed
17
+ * for the lifetime of the document. Eager installation matters: the very
18
+ * first interaction with a page can be the mouse click that focuses a
19
+ * gesture-wired element, and if the listeners only attached during that
20
+ * focus dispatch the mousedown would already have passed unobserved —
21
+ * leaving the default `'keyboard'` modality and drawing a focus ring for a
22
+ * pointer interaction. They are passive and idle-cheap; the cost is one
23
+ * boolean read per `onFocus` dispatch.
19
24
  */
20
25
 
21
26
  type InputModality = 'keyboard' | 'pointer'
@@ -44,6 +49,12 @@ function ensureInstalled(): void {
44
49
  installed = true
45
50
  }
46
51
 
52
+ // Install at import time so the pointer event that precedes the first focus
53
+ // is observed (see module doc above). `ensureInstalled` stays in
54
+ // `isFocusVisible` as a safety net for environments where `document` appears
55
+ // after import.
56
+ ensureInstalled()
57
+
47
58
  /**
48
59
  * `true` if the next `onFocus` should be treated as "focus-visible" (keyboard
49
60
  * focus). On native, always `true`. On web, reflects the most recent user
@@ -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()`. User easing fns are
17
- * auto-wrapped as worklets (Reanimated 3.9+ validates this).
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. The
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
- * If the input is already a worklet (has been processed by the worklets babel
14
- * plugin), it's returned as-is. Otherwise it's wrapped in a function whose
15
- * body declares the `'worklet'` directive when our source is processed by
16
- * the consumer's worklets babel plugin (the default Expo/RN setup), the
17
- * wrapper becomes a real worklet that captures the user fn via closure.
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)