@rootnative/inertia 0.0.3 → 0.0.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 +92 -5
- package/README.md +9 -3
- package/dist/{chunk-OQV66TBQ.mjs → chunk-27MKBTSG.mjs} +1 -1
- package/dist/{chunk-3XTVY34H.js → chunk-27U6766G.js} +2 -2
- package/dist/{chunk-4PEHWDAZ.js → chunk-4NAMD62I.js} +7 -7
- package/dist/chunk-67GHRCF6.js +8 -0
- package/dist/{chunk-SGUHE5CX.mjs → chunk-COEJVWRZ.mjs} +1 -1
- package/dist/chunk-GPOMFIIU.js +8 -0
- package/dist/{chunk-BQQTHG2V.mjs → chunk-GTJ6VAH5.mjs} +1 -1
- package/dist/chunk-K63LXGKS.js +8 -0
- package/dist/{chunk-46P57VMY.mjs → chunk-OAUWLPQH.mjs} +1 -1
- package/dist/{chunk-7AOERN53.js → chunk-OBRGJAST.js} +3 -3
- package/dist/{chunk-RGNX6UZN.mjs → chunk-OW5XTGVN.mjs} +2 -2
- package/dist/{chunk-PTRF47DA.js → chunk-PM6CVGXJ.js} +11 -3
- package/dist/{chunk-W5MC3P4N.js → chunk-QQVDZKSD.js} +2 -2
- package/dist/{chunk-CY7Y64C3.mjs → chunk-REYL77RE.mjs} +11 -4
- package/dist/{chunk-CSODMRJ7.mjs → chunk-RIVVBABB.mjs} +597 -134
- package/dist/{chunk-BP3Y2SHQ.js → chunk-VQ5D35UA.js} +617 -152
- package/dist/{chunk-O22NXXCZ.mjs → chunk-XSK5MNUH.mjs} +1 -1
- package/dist/{chunk-R63GIUNU.mjs → chunk-Z3HCJ43H.mjs} +1 -1
- package/dist/gestureLayer/index.d.mts +2 -2
- package/dist/gestureLayer/index.d.ts +2 -2
- package/dist/gestureLayer/index.js +10 -10
- package/dist/gestureLayer/index.mjs +3 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +48 -169
- package/dist/index.mjs +17 -137
- package/dist/motion/Image.d.mts +1 -1
- package/dist/motion/Image.d.ts +1 -1
- package/dist/motion/Image.js +5 -5
- package/dist/motion/Image.mjs +4 -4
- package/dist/motion/Pressable.d.mts +1 -1
- package/dist/motion/Pressable.d.ts +1 -1
- package/dist/motion/Pressable.js +5 -5
- package/dist/motion/Pressable.mjs +4 -4
- package/dist/motion/ScrollView.d.mts +1 -1
- package/dist/motion/ScrollView.d.ts +1 -1
- package/dist/motion/ScrollView.js +5 -5
- package/dist/motion/ScrollView.mjs +4 -4
- package/dist/motion/Text.d.mts +1 -1
- package/dist/motion/Text.d.ts +1 -1
- package/dist/motion/Text.js +5 -5
- package/dist/motion/Text.mjs +4 -4
- package/dist/motion/View.d.mts +1 -1
- package/dist/motion/View.d.ts +1 -1
- package/dist/motion/View.js +5 -5
- package/dist/motion/View.mjs +4 -4
- package/dist/touch/index.d.mts +1 -1
- package/dist/touch/index.d.ts +1 -1
- package/dist/touch/index.js +3 -3
- package/dist/touch/index.mjs +1 -1
- package/dist/{types-G1dBU2IQ.d.mts → types-BQgLJeQG.d.mts} +85 -14
- package/dist/{types-G1dBU2IQ.d.ts → types-BQgLJeQG.d.ts} +85 -14
- package/dist/{useGesture-D1e4ixJo.d.ts → useGesture-B0_CzOUz.d.ts} +1 -1
- package/dist/{useGesture-RFY6kTL3.d.mts → useGesture-DfaTx-3t.d.mts} +1 -1
- package/llms.txt +3 -1
- package/package.json +1 -1
- package/src/index.ts +2 -1
- package/src/internal/boxShadow.ts +177 -6
- package/src/internal/nonWorkletWarning.ts +4 -6
- package/src/internal/warnOnce.ts +28 -0
- package/src/layout/index.ts +10 -0
- package/src/layout/measureWindow.ts +135 -0
- package/src/layout/sharedRegistry.ts +107 -18
- package/src/layout/useSharedLayout.ts +256 -91
- package/src/motion/createMotionComponent.tsx +497 -74
- package/src/motion/installCheck.ts +1 -1
- package/src/transitions/index.ts +1 -1
- package/src/transitions/resolveSequence.ts +12 -0
- package/src/types.ts +155 -12
- package/src/values/useColorTransition.ts +1 -1
- package/dist/chunk-FNVFV4EY.js +0 -8
- package/dist/chunk-FWQOXA43.js +0 -8
- package/dist/chunk-KBP4LR75.js +0 -8
package/dist/motion/Image.d.ts
CHANGED
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 chunkGPOMFIIU_js = require('../chunk-GPOMFIIU.js');
|
|
4
|
+
require('../chunk-VQ5D35UA.js');
|
|
5
|
+
require('../chunk-OBRGJAST.js');
|
|
6
|
+
require('../chunk-PM6CVGXJ.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 chunkGPOMFIIU_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-XSK5MNUH.mjs';
|
|
2
|
+
import '../chunk-RIVVBABB.mjs';
|
|
3
|
+
import '../chunk-Z3HCJ43H.mjs';
|
|
4
|
+
import '../chunk-REYL77RE.mjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { M as MotionComponent } from '../types-
|
|
3
|
+
import { M as MotionComponent } from '../types-BQgLJeQG.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { M as MotionComponent } from '../types-
|
|
3
|
+
import { M as MotionComponent } from '../types-BQgLJeQG.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Animatable `Pressable`. The `gesture` prop's `pressed` sub-state hooks into
|
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 chunk27U6766G_js = require('../chunk-27U6766G.js');
|
|
4
|
+
require('../chunk-VQ5D35UA.js');
|
|
5
|
+
require('../chunk-OBRGJAST.js');
|
|
6
|
+
require('../chunk-PM6CVGXJ.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 chunk27U6766G_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-OAUWLPQH.mjs';
|
|
2
|
+
import '../chunk-RIVVBABB.mjs';
|
|
3
|
+
import '../chunk-Z3HCJ43H.mjs';
|
|
4
|
+
import '../chunk-REYL77RE.mjs';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkQQVDZKSD_js = require('../chunk-QQVDZKSD.js');
|
|
4
|
+
require('../chunk-VQ5D35UA.js');
|
|
5
|
+
require('../chunk-OBRGJAST.js');
|
|
6
|
+
require('../chunk-PM6CVGXJ.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 chunkQQVDZKSD_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-27MKBTSG.mjs';
|
|
2
|
+
import '../chunk-RIVVBABB.mjs';
|
|
3
|
+
import '../chunk-Z3HCJ43H.mjs';
|
|
4
|
+
import '../chunk-REYL77RE.mjs';
|
package/dist/motion/Text.d.mts
CHANGED
package/dist/motion/Text.d.ts
CHANGED
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 chunk67GHRCF6_js = require('../chunk-67GHRCF6.js');
|
|
4
|
+
require('../chunk-VQ5D35UA.js');
|
|
5
|
+
require('../chunk-OBRGJAST.js');
|
|
6
|
+
require('../chunk-PM6CVGXJ.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 chunk67GHRCF6_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-COEJVWRZ.mjs';
|
|
2
|
+
import '../chunk-RIVVBABB.mjs';
|
|
3
|
+
import '../chunk-Z3HCJ43H.mjs';
|
|
4
|
+
import '../chunk-REYL77RE.mjs';
|
package/dist/motion/View.d.mts
CHANGED
package/dist/motion/View.d.ts
CHANGED
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 chunkK63LXGKS_js = require('../chunk-K63LXGKS.js');
|
|
4
|
+
require('../chunk-VQ5D35UA.js');
|
|
5
|
+
require('../chunk-OBRGJAST.js');
|
|
6
|
+
require('../chunk-PM6CVGXJ.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 chunkK63LXGKS_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-GTJ6VAH5.mjs';
|
|
2
|
+
import '../chunk-RIVVBABB.mjs';
|
|
3
|
+
import '../chunk-Z3HCJ43H.mjs';
|
|
4
|
+
import '../chunk-REYL77RE.mjs';
|
package/dist/touch/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PanResponderInstance } from 'react-native';
|
|
2
2
|
import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { T as TransitionConfig } from '../types-
|
|
3
|
+
import { T as TransitionConfig } from '../types-BQgLJeQG.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/touch/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PanResponderInstance } from 'react-native';
|
|
2
2
|
import { useAnimatedStyle, SharedValue } from 'react-native-reanimated';
|
|
3
|
-
import { T as TransitionConfig } from '../types-
|
|
3
|
+
import { T as TransitionConfig } from '../types-BQgLJeQG.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/touch/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPM6CVGXJ_js = require('../chunk-PM6CVGXJ.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 = chunkPM6CVGXJ_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 = chunkPM6CVGXJ_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-REYL77RE.mjs';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { PanResponder } from 'react-native';
|
|
4
4
|
import { useSharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, ComponentProps, Ref, ReactElement } from 'react';
|
|
2
|
-
import { StyleProp } from 'react-native';
|
|
2
|
+
import { StyleProp, BoxShadowValue } from 'react-native';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A single animation step's destination, optionally overriding the transition
|
|
@@ -154,6 +154,50 @@ type AnimatableTransformExtras = {
|
|
|
154
154
|
rotateX?: AnimatableValue<number>;
|
|
155
155
|
rotateY?: AnimatableValue<number>;
|
|
156
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* Target shape for the `boxShadow` key on `animate` / `initial` / `exit`: a
|
|
159
|
+
* CSS `box-shadow` string, or RN's own array-of-layers form.
|
|
160
|
+
*
|
|
161
|
+
* Both endpoints of a `boxShadow` animation are normalized to a common layer
|
|
162
|
+
* count on the JS thread, so a two-layer shadow can animate to a one-layer one
|
|
163
|
+
* (the short side is padded with a transparent layer, as CSS transitions do).
|
|
164
|
+
* A layer that is `inset` on one side and not the other is not interpolable
|
|
165
|
+
* and throws.
|
|
166
|
+
*/
|
|
167
|
+
type BoxShadowInput = string | ReadonlyArray<BoxShadowValue>;
|
|
168
|
+
/**
|
|
169
|
+
* Keys whose animatable form deliberately departs from the generic
|
|
170
|
+
* `AnimatableValue<S[K]>` mapping.
|
|
171
|
+
*
|
|
172
|
+
* `boxShadow` is the only member. Its natural value is already an array, which
|
|
173
|
+
* collides head-on with `AnimatableValue`'s keyframe-sequence form — nothing
|
|
174
|
+
* distinguishes `[layerA, layerB]` (one two-layer shadow) from a two-step
|
|
175
|
+
* sequence. The array slot is given to layers, which is the shape RN itself
|
|
176
|
+
* uses and by far the common case, and sequences are unsupported on this key.
|
|
177
|
+
* This mirrors the single-value-only contract `shadowOffset` has carried since
|
|
178
|
+
* `0.0.1`. Per-property transitions are unaffected: `transition={{ boxShadow:
|
|
179
|
+
* { type: 'timing' } }}` works as it does for every other key.
|
|
180
|
+
*
|
|
181
|
+
* Conditional on `S` so the key only appears where the underlying style
|
|
182
|
+
* actually has it, rather than being bolted onto every primitive.
|
|
183
|
+
*/
|
|
184
|
+
type AnimatableStructuredExtras<S> = 'boxShadow' extends keyof S ? {
|
|
185
|
+
boxShadow?: BoxShadowInput;
|
|
186
|
+
} : {};
|
|
187
|
+
/**
|
|
188
|
+
* The `transform: [...]` array form, passed through as the underlying style
|
|
189
|
+
* types it. Inertia reads transform entries out of the array (see
|
|
190
|
+
* `styleValueFor` in `createMotionComponent`) rather than treating the array as
|
|
191
|
+
* an animatable scalar, so it is exempted from the `AnimatableValue` mapping —
|
|
192
|
+
* wrapping it there would offer a nonsensical `transform: [[...], [...]]`
|
|
193
|
+
* keyframe form.
|
|
194
|
+
*
|
|
195
|
+
* Conditional on `S` for the same reason as `boxShadow`: only appears where the
|
|
196
|
+
* underlying style actually has it.
|
|
197
|
+
*/
|
|
198
|
+
type AnimatableTransformArray<S> = 'transform' extends keyof S ? {
|
|
199
|
+
transform?: S['transform'];
|
|
200
|
+
} : {};
|
|
157
201
|
/**
|
|
158
202
|
* The animation state shape inferred from the underlying component's style
|
|
159
203
|
* prop. We narrow to the value side of `style` so consumers see ViewStyle on
|
|
@@ -166,11 +210,33 @@ type AnimatableTransformExtras = {
|
|
|
166
210
|
* accepts any key. Excluding functions first keeps inference tight.
|
|
167
211
|
*/
|
|
168
212
|
type _StyleValue<T> = Exclude<T, (...args: any[]) => any>;
|
|
213
|
+
/**
|
|
214
|
+
* The style keys Inertia's runtime actually drives — the type-level mirror of
|
|
215
|
+
* `ALL_KEYS` in `createMotionComponent`, minus the `shadowOffset*` synthetics
|
|
216
|
+
* (consumers write the nested `shadowOffset` object, not the axes) and minus
|
|
217
|
+
* `boxShadow` (handled by `AnimatableStructuredExtras`, whose value shape
|
|
218
|
+
* deliberately departs from `AnimatableValue`).
|
|
219
|
+
*
|
|
220
|
+
* **This list and `ALL_KEYS` must stay in sync.** They are separate because one
|
|
221
|
+
* is a type and the other is a runtime array, and TypeScript can't derive the
|
|
222
|
+
* former from a value living in a module that imports this one. The direction
|
|
223
|
+
* that matters: a key here but not in `ALL_KEYS` typechecks and then silently
|
|
224
|
+
* does nothing at runtime — which is precisely the defect this type was
|
|
225
|
+
* introduced to kill. `animate-keys.test-d.tsx` pins the two together.
|
|
226
|
+
*
|
|
227
|
+
* Before 0.0.5 this type mapped over the component's *entire* style surface, so
|
|
228
|
+
* `animate={{ paddingTop: 40 }}` compiled cleanly and was then dropped on the
|
|
229
|
+
* floor — no error, no warning. That contradicted the library's own headline
|
|
230
|
+
* differentiator (wrong props should error, not go unnoticed), so the mapping is
|
|
231
|
+
* now an intersection: a key must be both animatable by Inertia *and* present on
|
|
232
|
+
* the underlying component's style prop.
|
|
233
|
+
*/
|
|
234
|
+
type AnimatableStyleKey = 'translateX' | 'translateY' | 'scaleX' | 'scaleY' | 'opacity' | 'width' | 'height' | 'borderRadius' | 'shadowOpacity' | 'shadowRadius' | 'elevation' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderWidth' | 'borderTopWidth' | 'borderRightWidth' | 'borderBottomWidth' | 'borderLeftWidth' | 'top' | 'right' | 'bottom' | 'left' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingHorizontal' | 'paddingVertical' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'marginHorizontal' | 'marginVertical' | 'flex' | 'flexGrow' | 'flexShrink' | 'fontSize' | 'letterSpacing' | 'lineHeight' | 'zIndex' | 'gap' | 'rowGap' | 'columnGap' | 'backgroundColor' | 'borderColor' | 'color' | 'tintColor' | 'shadowColor' | 'shadowOffset';
|
|
169
235
|
type AnimateStyle<C> = C extends {
|
|
170
236
|
style?: infer Raw;
|
|
171
237
|
} ? _StyleValue<Raw> extends StyleProp<infer S> ? {
|
|
172
|
-
[K in keyof S]?: AnimatableValue<S[K]>;
|
|
173
|
-
} & AnimatableTransformExtras : never : never;
|
|
238
|
+
[K in keyof S as K extends AnimatableStyleKey ? K : never]?: K extends 'boxShadow' | 'transform' ? never : AnimatableValue<S[K]>;
|
|
239
|
+
} & AnimatableTransformExtras & AnimatableStructuredExtras<S> & AnimatableTransformArray<S> : never : never;
|
|
174
240
|
interface AnimationCallbackInfo<S> {
|
|
175
241
|
/**
|
|
176
242
|
* The animatable key that just settled — typically a `keyof S` (e.g.
|
|
@@ -339,19 +405,24 @@ interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
|
|
|
339
405
|
* recorded rect to its natural position via a FLIP transform stack.
|
|
340
406
|
*
|
|
341
407
|
* Reanimated 4 removed the `sharedTransitionTag` API — `layoutId` is the
|
|
342
|
-
* Inertia-side measure-based replacement. Rects are recorded in
|
|
343
|
-
*
|
|
344
|
-
* source and target
|
|
345
|
-
*
|
|
346
|
-
*
|
|
408
|
+
* Inertia-side measure-based replacement. Rects are recorded in **window**
|
|
409
|
+
* coordinates wherever the host can be measured synchronously (Fabric),
|
|
410
|
+
* which is what lets a source and target sit under containers at different
|
|
411
|
+
* screen offsets; elsewhere both fall back to the parent-relative
|
|
412
|
+
* coordinates `onLayout` reports. A source and target that ended up in
|
|
413
|
+
* different spaces skip the animation rather than play a wrong one.
|
|
347
414
|
*
|
|
348
415
|
* The same `transition` prop drives the FLIP animation (spring by
|
|
349
416
|
* default; `'timing'` honored; `'decay'` downgrades to spring; reduced
|
|
350
|
-
* motion skips the transition).
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
417
|
+
* motion skips the transition). Alongside the rect, a fixed set of style
|
|
418
|
+
* keys is carried from the source and crossfaded out on that same
|
|
419
|
+
* transition: `opacity`, `borderRadius`, `backgroundColor`, `borderColor`,
|
|
420
|
+
* `color`, `tintColor`. Transform keys are not carried — the FLIP owns
|
|
421
|
+
* them — and a key only participates when the element already has a value
|
|
422
|
+
* for it, from a record or from its static `style`.
|
|
423
|
+
*
|
|
424
|
+
* Two simultaneously-mounted primitives sharing the same `layoutId` are
|
|
425
|
+
* undefined behavior; pick a primitive per id at a time.
|
|
355
426
|
*/
|
|
356
427
|
layoutId?: string;
|
|
357
428
|
/**
|
|
@@ -385,4 +456,4 @@ interface MotionComponent<C extends ComponentType<any>> {
|
|
|
385
456
|
displayName?: string;
|
|
386
457
|
}
|
|
387
458
|
|
|
388
|
-
export type { AnimatableValue as A, 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, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
|
|
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, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, ComponentProps, Ref, ReactElement } from 'react';
|
|
2
|
-
import { StyleProp } from 'react-native';
|
|
2
|
+
import { StyleProp, BoxShadowValue } from 'react-native';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A single animation step's destination, optionally overriding the transition
|
|
@@ -154,6 +154,50 @@ type AnimatableTransformExtras = {
|
|
|
154
154
|
rotateX?: AnimatableValue<number>;
|
|
155
155
|
rotateY?: AnimatableValue<number>;
|
|
156
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* Target shape for the `boxShadow` key on `animate` / `initial` / `exit`: a
|
|
159
|
+
* CSS `box-shadow` string, or RN's own array-of-layers form.
|
|
160
|
+
*
|
|
161
|
+
* Both endpoints of a `boxShadow` animation are normalized to a common layer
|
|
162
|
+
* count on the JS thread, so a two-layer shadow can animate to a one-layer one
|
|
163
|
+
* (the short side is padded with a transparent layer, as CSS transitions do).
|
|
164
|
+
* A layer that is `inset` on one side and not the other is not interpolable
|
|
165
|
+
* and throws.
|
|
166
|
+
*/
|
|
167
|
+
type BoxShadowInput = string | ReadonlyArray<BoxShadowValue>;
|
|
168
|
+
/**
|
|
169
|
+
* Keys whose animatable form deliberately departs from the generic
|
|
170
|
+
* `AnimatableValue<S[K]>` mapping.
|
|
171
|
+
*
|
|
172
|
+
* `boxShadow` is the only member. Its natural value is already an array, which
|
|
173
|
+
* collides head-on with `AnimatableValue`'s keyframe-sequence form — nothing
|
|
174
|
+
* distinguishes `[layerA, layerB]` (one two-layer shadow) from a two-step
|
|
175
|
+
* sequence. The array slot is given to layers, which is the shape RN itself
|
|
176
|
+
* uses and by far the common case, and sequences are unsupported on this key.
|
|
177
|
+
* This mirrors the single-value-only contract `shadowOffset` has carried since
|
|
178
|
+
* `0.0.1`. Per-property transitions are unaffected: `transition={{ boxShadow:
|
|
179
|
+
* { type: 'timing' } }}` works as it does for every other key.
|
|
180
|
+
*
|
|
181
|
+
* Conditional on `S` so the key only appears where the underlying style
|
|
182
|
+
* actually has it, rather than being bolted onto every primitive.
|
|
183
|
+
*/
|
|
184
|
+
type AnimatableStructuredExtras<S> = 'boxShadow' extends keyof S ? {
|
|
185
|
+
boxShadow?: BoxShadowInput;
|
|
186
|
+
} : {};
|
|
187
|
+
/**
|
|
188
|
+
* The `transform: [...]` array form, passed through as the underlying style
|
|
189
|
+
* types it. Inertia reads transform entries out of the array (see
|
|
190
|
+
* `styleValueFor` in `createMotionComponent`) rather than treating the array as
|
|
191
|
+
* an animatable scalar, so it is exempted from the `AnimatableValue` mapping —
|
|
192
|
+
* wrapping it there would offer a nonsensical `transform: [[...], [...]]`
|
|
193
|
+
* keyframe form.
|
|
194
|
+
*
|
|
195
|
+
* Conditional on `S` for the same reason as `boxShadow`: only appears where the
|
|
196
|
+
* underlying style actually has it.
|
|
197
|
+
*/
|
|
198
|
+
type AnimatableTransformArray<S> = 'transform' extends keyof S ? {
|
|
199
|
+
transform?: S['transform'];
|
|
200
|
+
} : {};
|
|
157
201
|
/**
|
|
158
202
|
* The animation state shape inferred from the underlying component's style
|
|
159
203
|
* prop. We narrow to the value side of `style` so consumers see ViewStyle on
|
|
@@ -166,11 +210,33 @@ type AnimatableTransformExtras = {
|
|
|
166
210
|
* accepts any key. Excluding functions first keeps inference tight.
|
|
167
211
|
*/
|
|
168
212
|
type _StyleValue<T> = Exclude<T, (...args: any[]) => any>;
|
|
213
|
+
/**
|
|
214
|
+
* The style keys Inertia's runtime actually drives — the type-level mirror of
|
|
215
|
+
* `ALL_KEYS` in `createMotionComponent`, minus the `shadowOffset*` synthetics
|
|
216
|
+
* (consumers write the nested `shadowOffset` object, not the axes) and minus
|
|
217
|
+
* `boxShadow` (handled by `AnimatableStructuredExtras`, whose value shape
|
|
218
|
+
* deliberately departs from `AnimatableValue`).
|
|
219
|
+
*
|
|
220
|
+
* **This list and `ALL_KEYS` must stay in sync.** They are separate because one
|
|
221
|
+
* is a type and the other is a runtime array, and TypeScript can't derive the
|
|
222
|
+
* former from a value living in a module that imports this one. The direction
|
|
223
|
+
* that matters: a key here but not in `ALL_KEYS` typechecks and then silently
|
|
224
|
+
* does nothing at runtime — which is precisely the defect this type was
|
|
225
|
+
* introduced to kill. `animate-keys.test-d.tsx` pins the two together.
|
|
226
|
+
*
|
|
227
|
+
* Before 0.0.5 this type mapped over the component's *entire* style surface, so
|
|
228
|
+
* `animate={{ paddingTop: 40 }}` compiled cleanly and was then dropped on the
|
|
229
|
+
* floor — no error, no warning. That contradicted the library's own headline
|
|
230
|
+
* differentiator (wrong props should error, not go unnoticed), so the mapping is
|
|
231
|
+
* now an intersection: a key must be both animatable by Inertia *and* present on
|
|
232
|
+
* the underlying component's style prop.
|
|
233
|
+
*/
|
|
234
|
+
type AnimatableStyleKey = 'translateX' | 'translateY' | 'scaleX' | 'scaleY' | 'opacity' | 'width' | 'height' | 'borderRadius' | 'shadowOpacity' | 'shadowRadius' | 'elevation' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderWidth' | 'borderTopWidth' | 'borderRightWidth' | 'borderBottomWidth' | 'borderLeftWidth' | 'top' | 'right' | 'bottom' | 'left' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingHorizontal' | 'paddingVertical' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'marginHorizontal' | 'marginVertical' | 'flex' | 'flexGrow' | 'flexShrink' | 'fontSize' | 'letterSpacing' | 'lineHeight' | 'zIndex' | 'gap' | 'rowGap' | 'columnGap' | 'backgroundColor' | 'borderColor' | 'color' | 'tintColor' | 'shadowColor' | 'shadowOffset';
|
|
169
235
|
type AnimateStyle<C> = C extends {
|
|
170
236
|
style?: infer Raw;
|
|
171
237
|
} ? _StyleValue<Raw> extends StyleProp<infer S> ? {
|
|
172
|
-
[K in keyof S]?: AnimatableValue<S[K]>;
|
|
173
|
-
} & AnimatableTransformExtras : never : never;
|
|
238
|
+
[K in keyof S as K extends AnimatableStyleKey ? K : never]?: K extends 'boxShadow' | 'transform' ? never : AnimatableValue<S[K]>;
|
|
239
|
+
} & AnimatableTransformExtras & AnimatableStructuredExtras<S> & AnimatableTransformArray<S> : never : never;
|
|
174
240
|
interface AnimationCallbackInfo<S> {
|
|
175
241
|
/**
|
|
176
242
|
* The animatable key that just settled — typically a `keyof S` (e.g.
|
|
@@ -339,19 +405,24 @@ interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
|
|
|
339
405
|
* recorded rect to its natural position via a FLIP transform stack.
|
|
340
406
|
*
|
|
341
407
|
* Reanimated 4 removed the `sharedTransitionTag` API — `layoutId` is the
|
|
342
|
-
* Inertia-side measure-based replacement. Rects are recorded in
|
|
343
|
-
*
|
|
344
|
-
* source and target
|
|
345
|
-
*
|
|
346
|
-
*
|
|
408
|
+
* Inertia-side measure-based replacement. Rects are recorded in **window**
|
|
409
|
+
* coordinates wherever the host can be measured synchronously (Fabric),
|
|
410
|
+
* which is what lets a source and target sit under containers at different
|
|
411
|
+
* screen offsets; elsewhere both fall back to the parent-relative
|
|
412
|
+
* coordinates `onLayout` reports. A source and target that ended up in
|
|
413
|
+
* different spaces skip the animation rather than play a wrong one.
|
|
347
414
|
*
|
|
348
415
|
* The same `transition` prop drives the FLIP animation (spring by
|
|
349
416
|
* default; `'timing'` honored; `'decay'` downgrades to spring; reduced
|
|
350
|
-
* motion skips the transition).
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
417
|
+
* motion skips the transition). Alongside the rect, a fixed set of style
|
|
418
|
+
* keys is carried from the source and crossfaded out on that same
|
|
419
|
+
* transition: `opacity`, `borderRadius`, `backgroundColor`, `borderColor`,
|
|
420
|
+
* `color`, `tintColor`. Transform keys are not carried — the FLIP owns
|
|
421
|
+
* them — and a key only participates when the element already has a value
|
|
422
|
+
* for it, from a record or from its static `style`.
|
|
423
|
+
*
|
|
424
|
+
* Two simultaneously-mounted primitives sharing the same `layoutId` are
|
|
425
|
+
* undefined behavior; pick a primitive per id at a time.
|
|
355
426
|
*/
|
|
356
427
|
layoutId?: string;
|
|
357
428
|
/**
|
|
@@ -385,4 +456,4 @@ interface MotionComponent<C extends ComponentType<any>> {
|
|
|
385
456
|
displayName?: string;
|
|
386
457
|
}
|
|
387
458
|
|
|
388
|
-
export type { AnimatableValue as A, 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, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
|
|
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, VariantController as V, TransitionInput as a, TransitionName as b, AnimateStyle as c, AnimationCallbackInfo as d, EasingFunction as e, EasingFunctionFactory as f, GestureSubStates as g, MotionProps as h, NoAnimationTransition as i, RepeatConfig as j, SequenceStep as k, TimingTransition as l, Transition as m, VariantsMap as n };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SharedValue } from 'react-native-reanimated';
|
|
2
|
-
import { a as TransitionInput, G as GestureLayerTransitions } from './types-
|
|
2
|
+
import { a as TransitionInput, G as GestureLayerTransitions } from './types-BQgLJeQG.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 { a as TransitionInput, G as GestureLayerTransitions } from './types-
|
|
2
|
+
import { a as TransitionInput, G as GestureLayerTransitions } from './types-BQgLJeQG.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Handler bag returned by `useGesture`. Spread on a `Pressable` to drive the
|
package/llms.txt
CHANGED
|
@@ -140,7 +140,9 @@ Color: `backgroundColor`, `borderColor`, `color`, `tintColor` (Image only), `sha
|
|
|
140
140
|
|
|
141
141
|
Nested object: `shadowOffset: { width, height }`. The only nested-object style on the surface — internally decomposes into two synthetic axis SVs that the worklet recomposes into a single `shadowOffset` prop. `0.0.1` supports the **single-value form only** (`{ width: 0, height: 4 }`); sequences / array keyframes / per-axis transition splits are out of scope, drop to `useMotionValue` for those.
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
Structured: `boxShadow` — the cross-platform CSS shadow form, as a CSS string (`'0px 4px 8px rgba(0,0,0,0.3)'`, px lengths only) or RN's `BoxShadowValue[]`. Endpoints are normalized on the JS thread and padded to a common layer count (CSS-transition semantics), so layer counts may differ between `initial` and `animate`; every length and color interpolates per layer. `inset` is carried as a static per-layer flag, not interpolated — a layer inset on one side only throws. **No sequences on this key** (the array slot means layers, not keyframes) and **not accepted in `gesture` sub-states** (dev-warns and is ignored; drive it from `animate`, or interpolate manually with `useShadow`). Don't animate it alongside the native `shadow*` keys on one element — two shadow systems at once; Inertia dev-warns.
|
|
144
|
+
|
|
145
|
+
Auto-layout transitions ship via the `layout` prop (`true` / `TransitionConfig`) on every `Motion.*` primitive — see Layout. Shared element transitions ship via the `layoutId` prop: pair the same id on a source and target `Motion.*` and Inertia FLIPs between them on mount (1s TTL). Alongside the rect, a fixed set of style keys is carried from the source and crossfaded out on the same transition — `opacity`, `borderRadius`, `backgroundColor`, `borderColor`, `color`, `tintColor` — but only for keys the element already has a value for, from a record or its static `style`; transform keys are not carried because the FLIP owns them. Rects are measured in **window** coordinates via `measureInWindow` where the host resolves it synchronously (Fabric), which is what lets source and target sit under differently-offset parents; elsewhere both fall back to parent-relative `onLayout` coords. A source and target in different coordinate spaces skip the animation rather than play a wrong one. A still-mounted source is re-measured when the target lays out, so an ancestor scroll (which never fires `onLayout`) doesn't offset the transition.
|
|
144
146
|
|
|
145
147
|
## Optional adapter packages
|
|
146
148
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@rootnative/inertia` — declarative animation primitives for React Native.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Public surface: `Motion.View` / `Motion.Text` / `Motion.Image` /
|
|
5
5
|
* `Motion.Pressable` / `Motion.ScrollView`, with `initial` / `animate` /
|
|
6
6
|
* `exit` / `transition` / `variants` / `gesture` / `controller` /
|
|
7
7
|
* `onAnimationEnd` props. Sequences, repeats (single-value and
|
|
@@ -82,6 +82,7 @@ export type {
|
|
|
82
82
|
AnimatableValue,
|
|
83
83
|
AnimateStyle,
|
|
84
84
|
AnimationCallbackInfo,
|
|
85
|
+
BoxShadowInput,
|
|
85
86
|
DecayTransition,
|
|
86
87
|
EasingFunction,
|
|
87
88
|
EasingFunctionFactory,
|