@rootnative/inertia 0.0.3 → 0.0.4
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 +41 -5
- package/README.md +5 -3
- package/dist/{chunk-SGUHE5CX.mjs → chunk-4ASOELLA.mjs} +1 -1
- package/dist/{chunk-CSODMRJ7.mjs → chunk-55W7BNO2.mjs} +475 -83
- package/dist/chunk-5SRD2WCO.js +8 -0
- package/dist/{chunk-PTRF47DA.js → chunk-7A6WTXNK.js} +10 -3
- package/dist/{chunk-3XTVY34H.js → chunk-CENTULW6.js} +2 -2
- package/dist/{chunk-4PEHWDAZ.js → chunk-D5KAHWMC.js} +7 -7
- package/dist/{chunk-O22NXXCZ.mjs → chunk-J5Q46OPW.mjs} +1 -1
- package/dist/{chunk-RGNX6UZN.mjs → chunk-K3CLP74S.mjs} +2 -2
- package/dist/{chunk-BP3Y2SHQ.js → chunk-MYE5NMXW.js} +495 -101
- package/dist/{chunk-OQV66TBQ.mjs → chunk-NAOXQJ7U.mjs} +1 -1
- package/dist/{chunk-R63GIUNU.mjs → chunk-QKC3APP4.mjs} +1 -1
- package/dist/{chunk-46P57VMY.mjs → chunk-RF7J5FRM.mjs} +1 -1
- package/dist/{chunk-CY7Y64C3.mjs → chunk-TU2XFPAK.mjs} +10 -4
- package/dist/chunk-TVFNJ25Z.js +8 -0
- package/dist/chunk-VLDIFL3F.js +8 -0
- package/dist/{chunk-7AOERN53.js → chunk-WVRCKOPO.js} +3 -3
- package/dist/{chunk-W5MC3P4N.js → chunk-XMEVPEMH.js} +2 -2
- package/dist/{chunk-BQQTHG2V.mjs → chunk-YKGY22SB.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-37pN82yh.d.mts} +49 -14
- package/dist/{types-G1dBU2IQ.d.ts → types-37pN82yh.d.ts} +49 -14
- package/dist/{useGesture-D1e4ixJo.d.ts → useGesture-Cl4uzZIr.d.ts} +1 -1
- package/dist/{useGesture-RFY6kTL3.d.mts → useGesture-_IKkS8Dv.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 +378 -39
- package/src/motion/installCheck.ts +1 -1
- package/src/transitions/index.ts +1 -1
- package/src/types.ts +52 -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/src/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type ReactElement,
|
|
5
5
|
type Ref,
|
|
6
6
|
} from 'react'
|
|
7
|
-
import { type StyleProp } from 'react-native'
|
|
7
|
+
import { type BoxShadowValue, type StyleProp } from 'react-native'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A single animation step's destination, optionally overriding the transition
|
|
@@ -184,6 +184,39 @@ type AnimatableTransformExtras = {
|
|
|
184
184
|
rotateY?: AnimatableValue<number>
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Target shape for the `boxShadow` key on `animate` / `initial` / `exit`: a
|
|
189
|
+
* CSS `box-shadow` string, or RN's own array-of-layers form.
|
|
190
|
+
*
|
|
191
|
+
* Both endpoints of a `boxShadow` animation are normalized to a common layer
|
|
192
|
+
* count on the JS thread, so a two-layer shadow can animate to a one-layer one
|
|
193
|
+
* (the short side is padded with a transparent layer, as CSS transitions do).
|
|
194
|
+
* A layer that is `inset` on one side and not the other is not interpolable
|
|
195
|
+
* and throws.
|
|
196
|
+
*/
|
|
197
|
+
export type BoxShadowInput = string | ReadonlyArray<BoxShadowValue>
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Keys whose animatable form deliberately departs from the generic
|
|
201
|
+
* `AnimatableValue<S[K]>` mapping.
|
|
202
|
+
*
|
|
203
|
+
* `boxShadow` is the only member. Its natural value is already an array, which
|
|
204
|
+
* collides head-on with `AnimatableValue`'s keyframe-sequence form — nothing
|
|
205
|
+
* distinguishes `[layerA, layerB]` (one two-layer shadow) from a two-step
|
|
206
|
+
* sequence. The array slot is given to layers, which is the shape RN itself
|
|
207
|
+
* uses and by far the common case, and sequences are unsupported on this key.
|
|
208
|
+
* This mirrors the single-value-only contract `shadowOffset` has carried since
|
|
209
|
+
* `0.0.1`. Per-property transitions are unaffected: `transition={{ boxShadow:
|
|
210
|
+
* { type: 'timing' } }}` works as it does for every other key.
|
|
211
|
+
*
|
|
212
|
+
* Conditional on `S` so the key only appears where the underlying style
|
|
213
|
+
* actually has it, rather than being bolted onto every primitive.
|
|
214
|
+
*/
|
|
215
|
+
type AnimatableStructuredExtras<S> = 'boxShadow' extends keyof S
|
|
216
|
+
? { boxShadow?: BoxShadowInput }
|
|
217
|
+
: // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
218
|
+
{}
|
|
219
|
+
|
|
187
220
|
/**
|
|
188
221
|
* The animation state shape inferred from the underlying component's style
|
|
189
222
|
* prop. We narrow to the value side of `style` so consumers see ViewStyle on
|
|
@@ -200,7 +233,9 @@ type _StyleValue<T> = Exclude<T, (...args: any[]) => any>
|
|
|
200
233
|
|
|
201
234
|
export type AnimateStyle<C> = C extends { style?: infer Raw }
|
|
202
235
|
? _StyleValue<Raw> extends StyleProp<infer S>
|
|
203
|
-
? { [K in keyof S]?: AnimatableValue<S[K]> } &
|
|
236
|
+
? Omit<{ [K in keyof S]?: AnimatableValue<S[K]> }, 'boxShadow'> &
|
|
237
|
+
AnimatableTransformExtras &
|
|
238
|
+
AnimatableStructuredExtras<S>
|
|
204
239
|
: never
|
|
205
240
|
: never
|
|
206
241
|
|
|
@@ -379,19 +414,24 @@ export interface MotionProps<C, V extends VariantsMap<C> = VariantsMap<C>> {
|
|
|
379
414
|
* recorded rect to its natural position via a FLIP transform stack.
|
|
380
415
|
*
|
|
381
416
|
* Reanimated 4 removed the `sharedTransitionTag` API — `layoutId` is the
|
|
382
|
-
* Inertia-side measure-based replacement. Rects are recorded in
|
|
383
|
-
*
|
|
384
|
-
* source and target
|
|
385
|
-
*
|
|
386
|
-
*
|
|
417
|
+
* Inertia-side measure-based replacement. Rects are recorded in **window**
|
|
418
|
+
* coordinates wherever the host can be measured synchronously (Fabric),
|
|
419
|
+
* which is what lets a source and target sit under containers at different
|
|
420
|
+
* screen offsets; elsewhere both fall back to the parent-relative
|
|
421
|
+
* coordinates `onLayout` reports. A source and target that ended up in
|
|
422
|
+
* different spaces skip the animation rather than play a wrong one.
|
|
387
423
|
*
|
|
388
424
|
* The same `transition` prop drives the FLIP animation (spring by
|
|
389
425
|
* default; `'timing'` honored; `'decay'` downgrades to spring; reduced
|
|
390
|
-
* motion skips the transition).
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
426
|
+
* motion skips the transition). Alongside the rect, a fixed set of style
|
|
427
|
+
* keys is carried from the source and crossfaded out on that same
|
|
428
|
+
* transition: `opacity`, `borderRadius`, `backgroundColor`, `borderColor`,
|
|
429
|
+
* `color`, `tintColor`. Transform keys are not carried — the FLIP owns
|
|
430
|
+
* them — and a key only participates when the element already has a value
|
|
431
|
+
* for it, from a record or from its static `style`.
|
|
432
|
+
*
|
|
433
|
+
* Two simultaneously-mounted primitives sharing the same `layoutId` are
|
|
434
|
+
* undefined behavior; pick a primitive per id at a time.
|
|
395
435
|
*/
|
|
396
436
|
layoutId?: string
|
|
397
437
|
/**
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Color style keys understood by React Native that this hook can target.
|
|
9
|
-
* Sticks to the keys that exist on the
|
|
9
|
+
* Sticks to the keys that exist on the animatable surface so the
|
|
10
10
|
* returned style fragment is always a legal RN style.
|
|
11
11
|
*/
|
|
12
12
|
export type ColorStyleKey =
|
package/dist/chunk-FNVFV4EY.js
DELETED
package/dist/chunk-FWQOXA43.js
DELETED
package/dist/chunk-KBP4LR75.js
DELETED