@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stableSig, isTopLevelTransition } from './chunk-
|
|
1
|
+
import { stableSig, isTopLevelTransition } from './chunk-TU2XFPAK.mjs';
|
|
2
2
|
import { createContext, useContext, useMemo } from 'react';
|
|
3
3
|
import { useReducedMotion } from 'react-native-reanimated';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -3,16 +3,22 @@ import { withSequence, Easing, withDecay, withTiming, withSpring, withRepeat, wi
|
|
|
3
3
|
|
|
4
4
|
// src/transitions/easing.ts
|
|
5
5
|
|
|
6
|
-
// src/internal/
|
|
6
|
+
// src/internal/warnOnce.ts
|
|
7
7
|
var warned = /* @__PURE__ */ new Set();
|
|
8
|
-
function
|
|
8
|
+
function warnOnce(key, message) {
|
|
9
9
|
if (!__DEV__) return;
|
|
10
|
-
if (typeof process !== "undefined" && process.env?.JEST_WORKER_ID) return;
|
|
11
10
|
if (warned.has(key)) return;
|
|
12
11
|
warned.add(key);
|
|
13
12
|
console.warn(message);
|
|
14
13
|
}
|
|
15
14
|
|
|
15
|
+
// src/internal/nonWorkletWarning.ts
|
|
16
|
+
function warnNonWorkletOnce(key, message) {
|
|
17
|
+
if (!__DEV__) return;
|
|
18
|
+
if (typeof process !== "undefined" && process.env?.JEST_WORKER_ID) return;
|
|
19
|
+
warnOnce(key, message);
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
// src/transitions/easing.ts
|
|
17
23
|
function ensureWorkletEasing(easing) {
|
|
18
24
|
if (!easing) return void 0;
|
|
@@ -270,4 +276,4 @@ function stableStringify(v) {
|
|
|
270
276
|
return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
|
|
271
277
|
}
|
|
272
278
|
|
|
273
|
-
export { DEFAULT_SPRING, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce };
|
|
279
|
+
export { DEFAULT_SPRING, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce, warnOnce };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7A6WTXNK_js = require('./chunk-7A6WTXNK.js');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -32,7 +32,7 @@ function MotionConfig({
|
|
|
32
32
|
children
|
|
33
33
|
}) {
|
|
34
34
|
const parent = useMotionConfig();
|
|
35
|
-
const transitionsSig =
|
|
35
|
+
const transitionsSig = chunk7A6WTXNK_js.stableSig(transitions);
|
|
36
36
|
const value = react.useMemo(
|
|
37
37
|
() => ({
|
|
38
38
|
reducedMotion: reducedMotion ?? parent.reducedMotion,
|
|
@@ -66,7 +66,7 @@ function resolveNamedTransitionProp(transition, registry) {
|
|
|
66
66
|
if (typeof transition === "string") {
|
|
67
67
|
return lookupNamedTransition(transition, registry);
|
|
68
68
|
}
|
|
69
|
-
if (
|
|
69
|
+
if (chunk7A6WTXNK_js.isTopLevelTransition(transition)) return transition;
|
|
70
70
|
const map = transition;
|
|
71
71
|
let out = null;
|
|
72
72
|
for (const key in map) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMYE5NMXW_js = require('./chunk-MYE5NMXW.js');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
|
|
6
|
-
var MotionScrollView =
|
|
6
|
+
var MotionScrollView = chunkMYE5NMXW_js.createMotionComponent(reactNative.ScrollView);
|
|
7
7
|
|
|
8
8
|
exports.MotionScrollView = MotionScrollView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
|
|
2
|
-
import { U as UseGestureHandlers } from '../useGesture-
|
|
3
|
-
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-
|
|
2
|
+
import { U as UseGestureHandlers } from '../useGesture-_IKkS8Dv.mjs';
|
|
3
|
+
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-37pN82yh.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
|
|
2
|
-
import { U as UseGestureHandlers } from '../useGesture-
|
|
3
|
-
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-
|
|
2
|
+
import { U as UseGestureHandlers } from '../useGesture-Cl4uzZIr.js';
|
|
3
|
+
import { a as TransitionInput, G as GestureLayerTransitions } from '../types-37pN82yh.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'react-native';
|
|
6
6
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkD5KAHWMC_js = require('../chunk-D5KAHWMC.js');
|
|
4
|
+
var chunkWVRCKOPO_js = require('../chunk-WVRCKOPO.js');
|
|
5
|
+
var chunk7A6WTXNK_js = require('../chunk-7A6WTXNK.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactNativeReanimated = require('react-native-reanimated');
|
|
8
8
|
|
|
9
9
|
function useGestureLayer(states, options = {}) {
|
|
10
10
|
const { disabled: isDisabled = false, transition: transitionInput } = options;
|
|
11
|
-
const shouldReduceMotion =
|
|
12
|
-
const transition =
|
|
11
|
+
const shouldReduceMotion = chunkWVRCKOPO_js.useShouldReduceMotion();
|
|
12
|
+
const transition = chunkWVRCKOPO_js.resolveNamedTransitionProp(
|
|
13
13
|
transitionInput,
|
|
14
|
-
|
|
14
|
+
chunkWVRCKOPO_js.useNamedTransitions()
|
|
15
15
|
);
|
|
16
|
-
const gesture =
|
|
16
|
+
const gesture = chunkD5KAHWMC_js.useGesture(transition);
|
|
17
17
|
const disabledProgress = reactNativeReanimated.useSharedValue(0);
|
|
18
|
-
const transitionSig =
|
|
18
|
+
const transitionSig = chunk7A6WTXNK_js.stableSig(transition);
|
|
19
19
|
react.useEffect(() => {
|
|
20
20
|
const target = isDisabled ? 1 : 0;
|
|
21
21
|
const cfg = shouldReduceMotion ? { type: "no-animation" } : disabledTransition(transition) ?? { type: "spring" };
|
|
22
|
-
disabledProgress.value =
|
|
22
|
+
disabledProgress.value = chunk7A6WTXNK_js.resolveTransition(cfg, target);
|
|
23
23
|
}, [isDisabled, shouldReduceMotion, transitionSig, disabledProgress]);
|
|
24
24
|
const meta = react.useMemo(() => {
|
|
25
25
|
const layers = {
|
|
@@ -154,7 +154,7 @@ function useGestureLayer(states, options = {}) {
|
|
|
154
154
|
}
|
|
155
155
|
function disabledTransition(transition) {
|
|
156
156
|
if (!transition) return void 0;
|
|
157
|
-
if (
|
|
157
|
+
if (chunk7A6WTXNK_js.isTopLevelTransition(transition)) return transition;
|
|
158
158
|
return void 0;
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useGesture } from '../chunk-
|
|
2
|
-
import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions } from '../chunk-
|
|
3
|
-
import { stableSig, resolveTransition, isTopLevelTransition } from '../chunk-
|
|
1
|
+
import { useGesture } from '../chunk-K3CLP74S.mjs';
|
|
2
|
+
import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions } from '../chunk-QKC3APP4.mjs';
|
|
3
|
+
import { stableSig, resolveTransition, isTopLevelTransition } from '../chunk-TU2XFPAK.mjs';
|
|
4
4
|
import { useEffect, useMemo } from 'react';
|
|
5
5
|
import { useSharedValue, useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -2,11 +2,11 @@ import * as react from 'react';
|
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
|
|
5
|
-
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-
|
|
6
|
-
export { c as AnimateStyle, d as AnimationCallbackInfo, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-
|
|
5
|
+
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-37pN82yh.mjs';
|
|
6
|
+
export { c as AnimateStyle, d as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-37pN82yh.mjs';
|
|
7
7
|
import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
|
8
8
|
export { SharedValue } from 'react-native-reanimated';
|
|
9
|
-
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-
|
|
9
|
+
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-_IKkS8Dv.mjs';
|
|
10
10
|
export { MotionImage } from './motion/Image.mjs';
|
|
11
11
|
export { MotionPressable } from './motion/Pressable.mjs';
|
|
12
12
|
export { MotionScrollView } from './motion/ScrollView.mjs';
|
|
@@ -414,7 +414,7 @@ declare function useBooleanSpring(active: boolean, springConfig?: SpringTransiti
|
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
416
|
* Color style keys understood by React Native that this hook can target.
|
|
417
|
-
* Sticks to the keys that exist on the
|
|
417
|
+
* Sticks to the keys that exist on the animatable surface so the
|
|
418
418
|
* returned style fragment is always a legal RN style.
|
|
419
419
|
*/
|
|
420
420
|
type ColorStyleKey = 'backgroundColor' | 'color' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'tintColor' | 'shadowColor';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import * as react from 'react';
|
|
|
2
2
|
import { ComponentType, ReactNode } from 'react';
|
|
3
3
|
import * as react_native from 'react-native';
|
|
4
4
|
import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
|
|
5
|
-
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-
|
|
6
|
-
export { c as AnimateStyle, d as AnimationCallbackInfo, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-
|
|
5
|
+
import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-37pN82yh.js';
|
|
6
|
+
export { c as AnimateStyle, d as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-37pN82yh.js';
|
|
7
7
|
import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
|
|
8
8
|
export { SharedValue } from 'react-native-reanimated';
|
|
9
|
-
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-
|
|
9
|
+
export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-Cl4uzZIr.js';
|
|
10
10
|
export { MotionImage } from './motion/Image.js';
|
|
11
11
|
export { MotionPressable } from './motion/Pressable.js';
|
|
12
12
|
export { MotionScrollView } from './motion/ScrollView.js';
|
|
@@ -414,7 +414,7 @@ declare function useBooleanSpring(active: boolean, springConfig?: SpringTransiti
|
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
416
|
* Color style keys understood by React Native that this hook can target.
|
|
417
|
-
* Sticks to the keys that exist on the
|
|
417
|
+
* Sticks to the keys that exist on the animatable surface so the
|
|
418
418
|
* returned style fragment is always a legal RN style.
|
|
419
419
|
*/
|
|
420
420
|
type ColorStyleKey = 'backgroundColor' | 'color' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'tintColor' | 'shadowColor';
|
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
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 chunkD5KAHWMC_js = require('./chunk-D5KAHWMC.js');
|
|
4
|
+
var chunkVLDIFL3F_js = require('./chunk-VLDIFL3F.js');
|
|
5
|
+
var chunkTVFNJ25Z_js = require('./chunk-TVFNJ25Z.js');
|
|
6
|
+
var chunk5SRD2WCO_js = require('./chunk-5SRD2WCO.js');
|
|
7
|
+
var chunkCENTULW6_js = require('./chunk-CENTULW6.js');
|
|
8
|
+
var chunkXMEVPEMH_js = require('./chunk-XMEVPEMH.js');
|
|
9
|
+
var chunkMYE5NMXW_js = require('./chunk-MYE5NMXW.js');
|
|
10
|
+
var chunkWVRCKOPO_js = require('./chunk-WVRCKOPO.js');
|
|
11
|
+
var chunk7A6WTXNK_js = require('./chunk-7A6WTXNK.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: chunkVLDIFL3F_js.MotionView,
|
|
19
|
+
Text: chunkTVFNJ25Z_js.MotionText,
|
|
20
|
+
Image: chunk5SRD2WCO_js.MotionImage,
|
|
21
|
+
Pressable: chunkCENTULW6_js.MotionPressable,
|
|
22
|
+
ScrollView: chunkXMEVPEMH_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 = chunkWVRCKOPO_js.useShouldReduceMotion();
|
|
27
|
+
const resolved = chunkWVRCKOPO_js.resolveNamedTransition(transition, chunkWVRCKOPO_js.useNamedTransitions());
|
|
28
|
+
const cfgSig = chunk7A6WTXNK_js.stableSig(resolved);
|
|
29
29
|
react.useEffect(() => {
|
|
30
30
|
const cfg = shouldReduceMotion ? { type: "no-animation" } : resolved ?? { type: "spring" };
|
|
31
|
-
output.value =
|
|
31
|
+
output.value = chunk7A6WTXNK_js.resolveTransition(cfg, target);
|
|
32
32
|
}, [target, cfgSig, shouldReduceMotion]);
|
|
33
33
|
react.useEffect(
|
|
34
34
|
() => () => reactNativeReanimated.cancelAnimation(output),
|
|
@@ -39,22 +39,22 @@ function useAnimation(target, transition) {
|
|
|
39
39
|
return output;
|
|
40
40
|
}
|
|
41
41
|
function useAnimator() {
|
|
42
|
-
const registry =
|
|
43
|
-
const shouldReduceMotion =
|
|
42
|
+
const registry = chunkWVRCKOPO_js.useNamedTransitions();
|
|
43
|
+
const shouldReduceMotion = chunkWVRCKOPO_js.useShouldReduceMotion();
|
|
44
44
|
const registryRef = react.useRef(registry);
|
|
45
45
|
registryRef.current = registry;
|
|
46
46
|
const reduceMotionRef = react.useRef(shouldReduceMotion);
|
|
47
47
|
reduceMotionRef.current = shouldReduceMotion;
|
|
48
48
|
return react.useCallback((value, to, transition) => {
|
|
49
|
-
const resolved =
|
|
49
|
+
const resolved = chunkWVRCKOPO_js.resolveNamedTransition(transition, registryRef.current);
|
|
50
50
|
const cfg = reduceMotionRef.current ? { type: "no-animation" } : resolved ?? { type: "spring" };
|
|
51
|
-
value.value =
|
|
51
|
+
value.value = chunk7A6WTXNK_js.resolveTransition(cfg, to);
|
|
52
52
|
}, []);
|
|
53
53
|
}
|
|
54
54
|
function useSpring(target, config) {
|
|
55
|
-
const spring = resolveSpringInput(config,
|
|
55
|
+
const spring = resolveSpringInput(config, chunkWVRCKOPO_js.useNamedTransitions());
|
|
56
56
|
const reanimConfig = react.useMemo(
|
|
57
|
-
() =>
|
|
57
|
+
() => chunk7A6WTXNK_js.springToReanimated(spring ?? {}),
|
|
58
58
|
// Keyed on the resolved primitive fields rather than the `config` object
|
|
59
59
|
// identity: callers routinely pass a fresh object literal each render, so
|
|
60
60
|
// depending on `config` itself would rebuild the Reanimated config on
|
|
@@ -99,7 +99,7 @@ function useSpring(target, config) {
|
|
|
99
99
|
}
|
|
100
100
|
function resolveSpringInput(config, registry) {
|
|
101
101
|
if (typeof config !== "string") return config;
|
|
102
|
-
const cfg =
|
|
102
|
+
const cfg = chunkWVRCKOPO_js.lookupNamedTransition(config, registry);
|
|
103
103
|
if (cfg.type === void 0 || cfg.type === "spring") return cfg;
|
|
104
104
|
if (__DEV__) {
|
|
105
105
|
console.warn(
|
|
@@ -296,7 +296,7 @@ function useTransform(arg1, inputRange, outputRange, options) {
|
|
|
296
296
|
if (reactNativeWorklets.isWorkletFunction(userFn)) {
|
|
297
297
|
producer = userFn;
|
|
298
298
|
} else {
|
|
299
|
-
|
|
299
|
+
chunk7A6WTXNK_js.warnNonWorkletOnce(
|
|
300
300
|
"useTransform-transformer",
|
|
301
301
|
"[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."
|
|
302
302
|
);
|
|
@@ -352,127 +352,6 @@ function useScroll() {
|
|
|
352
352
|
onScroll: handler
|
|
353
353
|
};
|
|
354
354
|
}
|
|
355
|
-
|
|
356
|
-
// src/internal/boxShadow.ts
|
|
357
|
-
var LENGTH = /^[+-]?(\d+\.?\d*|\.\d+)(px)?$/i;
|
|
358
|
-
var UNIT_LIKE = /^[+-]?(\d+\.?\d*|\.\d+)[a-z%]+$/i;
|
|
359
|
-
function invalid(input, reason) {
|
|
360
|
-
return new Error(
|
|
361
|
-
`[inertia] parseBoxShadow: ${reason} in ${JSON.stringify(input)}. Expected CSS box-shadow syntax with px lengths: '[inset] <offset-x> <offset-y> [blur] [spread] [color], ...'`
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
function splitLayers(input) {
|
|
365
|
-
const layers = [];
|
|
366
|
-
let depth = 0;
|
|
367
|
-
let start = 0;
|
|
368
|
-
for (let i = 0; i < input.length; i++) {
|
|
369
|
-
const ch = input[i];
|
|
370
|
-
if (ch === "(") depth++;
|
|
371
|
-
else if (ch === ")") depth--;
|
|
372
|
-
else if (ch === "," && depth === 0) {
|
|
373
|
-
layers.push(input.slice(start, i));
|
|
374
|
-
start = i + 1;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
layers.push(input.slice(start));
|
|
378
|
-
return layers;
|
|
379
|
-
}
|
|
380
|
-
function tokenize(layer) {
|
|
381
|
-
const tokens = [];
|
|
382
|
-
let depth = 0;
|
|
383
|
-
let current = "";
|
|
384
|
-
for (const ch of layer) {
|
|
385
|
-
if (ch === "(") depth++;
|
|
386
|
-
else if (ch === ")") depth--;
|
|
387
|
-
if (depth === 0 && /\s/.test(ch)) {
|
|
388
|
-
if (current) tokens.push(current);
|
|
389
|
-
current = "";
|
|
390
|
-
} else {
|
|
391
|
-
current += ch;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (current) tokens.push(current);
|
|
395
|
-
return tokens;
|
|
396
|
-
}
|
|
397
|
-
function parseBoxShadow(input) {
|
|
398
|
-
const trimmed = input.trim();
|
|
399
|
-
if (trimmed === "") throw invalid(input, "empty string");
|
|
400
|
-
if (trimmed.toLowerCase() === "none") return [];
|
|
401
|
-
return splitLayers(trimmed).map((layerString) => {
|
|
402
|
-
const tokens = tokenize(layerString.trim());
|
|
403
|
-
if (tokens.length === 0) throw invalid(input, "empty layer");
|
|
404
|
-
const lengths = [];
|
|
405
|
-
let color;
|
|
406
|
-
let inset = false;
|
|
407
|
-
for (const token of tokens) {
|
|
408
|
-
if (token.toLowerCase() === "inset") {
|
|
409
|
-
if (inset) throw invalid(input, "duplicate 'inset'");
|
|
410
|
-
inset = true;
|
|
411
|
-
} else if (LENGTH.test(token)) {
|
|
412
|
-
lengths.push(parseFloat(token));
|
|
413
|
-
} else if (UNIT_LIKE.test(token)) {
|
|
414
|
-
throw invalid(input, `unsupported unit in ${JSON.stringify(token)}`);
|
|
415
|
-
} else {
|
|
416
|
-
if (color !== void 0) throw invalid(input, "multiple colors");
|
|
417
|
-
color = token;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
if (lengths.length < 2 || lengths.length > 4) {
|
|
421
|
-
throw invalid(input, `expected 2-4 lengths, got ${lengths.length}`);
|
|
422
|
-
}
|
|
423
|
-
const [offsetX = 0, offsetY = 0, blurRadius = 0, spreadDistance = 0] = lengths;
|
|
424
|
-
if (blurRadius < 0) throw invalid(input, "negative blur radius");
|
|
425
|
-
return {
|
|
426
|
-
offsetX,
|
|
427
|
-
offsetY,
|
|
428
|
-
blurRadius,
|
|
429
|
-
spreadDistance,
|
|
430
|
-
color: color ?? "black",
|
|
431
|
-
inset
|
|
432
|
-
};
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
function resolveBoxShadowInput(input) {
|
|
436
|
-
if (input === void 0) return [];
|
|
437
|
-
if (typeof input === "string") return parseBoxShadow(input);
|
|
438
|
-
return input.map((layer) => ({
|
|
439
|
-
offsetX: layer.offsetX,
|
|
440
|
-
offsetY: layer.offsetY,
|
|
441
|
-
blurRadius: layer.blurRadius ?? 0,
|
|
442
|
-
spreadDistance: layer.spreadDistance ?? 0,
|
|
443
|
-
color: layer.color ?? "black",
|
|
444
|
-
inset: layer.inset ?? false
|
|
445
|
-
}));
|
|
446
|
-
}
|
|
447
|
-
function pairBoxShadowLayers(from, to) {
|
|
448
|
-
const count = Math.max(from.length, to.length);
|
|
449
|
-
const pairs = [];
|
|
450
|
-
for (let i = 0; i < count; i++) {
|
|
451
|
-
const a = from[i];
|
|
452
|
-
const b = to[i];
|
|
453
|
-
const fromLayer = a ?? invisibleLayer(b.inset);
|
|
454
|
-
const toLayer = b ?? invisibleLayer(a.inset);
|
|
455
|
-
if (fromLayer.inset !== toLayer.inset) {
|
|
456
|
-
throw new Error(
|
|
457
|
-
`[inertia] useShadow: boxShadow layer ${i} is 'inset' on one side but not the other \u2014 inset cannot be interpolated. Give both sides the same inset-ness (pad with a transparent layer if needed).`
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
pairs.push({ from: fromLayer, to: toLayer });
|
|
461
|
-
}
|
|
462
|
-
return pairs;
|
|
463
|
-
}
|
|
464
|
-
function invisibleLayer(inset) {
|
|
465
|
-
return {
|
|
466
|
-
offsetX: 0,
|
|
467
|
-
offsetY: 0,
|
|
468
|
-
blurRadius: 0,
|
|
469
|
-
spreadDistance: 0,
|
|
470
|
-
color: "transparent",
|
|
471
|
-
inset
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// src/values/useShadow.ts
|
|
476
355
|
function useShadow({
|
|
477
356
|
from,
|
|
478
357
|
to,
|
|
@@ -483,9 +362,9 @@ function useShadow({
|
|
|
483
362
|
const hasElevation = from.elevation !== void 0 || to.elevation !== void 0;
|
|
484
363
|
const hasColor = from.shadowColor !== void 0 || to.shadowColor !== void 0;
|
|
485
364
|
const hasOffset = from.shadowOffset !== void 0 || to.shadowOffset !== void 0;
|
|
486
|
-
const boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? pairBoxShadowLayers(
|
|
487
|
-
resolveBoxShadowInput(from.boxShadow),
|
|
488
|
-
resolveBoxShadowInput(to.boxShadow)
|
|
365
|
+
const boxShadowPairs = from.boxShadow !== void 0 || to.boxShadow !== void 0 ? chunkMYE5NMXW_js.pairBoxShadowLayers(
|
|
366
|
+
chunkMYE5NMXW_js.resolveBoxShadowInput(from.boxShadow),
|
|
367
|
+
chunkMYE5NMXW_js.resolveBoxShadowInput(to.boxShadow)
|
|
489
368
|
) : [];
|
|
490
369
|
const opacityFrom = from.shadowOpacity ?? 0;
|
|
491
370
|
const opacityTo = to.shadowOpacity ?? 0;
|
|
@@ -584,79 +463,79 @@ function useVariants(variants, initial) {
|
|
|
584
463
|
|
|
585
464
|
Object.defineProperty(exports, "useGesture", {
|
|
586
465
|
enumerable: true,
|
|
587
|
-
get: function () { return
|
|
466
|
+
get: function () { return chunkD5KAHWMC_js.useGesture; }
|
|
588
467
|
});
|
|
589
468
|
Object.defineProperty(exports, "MotionView", {
|
|
590
469
|
enumerable: true,
|
|
591
|
-
get: function () { return
|
|
470
|
+
get: function () { return chunkVLDIFL3F_js.MotionView; }
|
|
592
471
|
});
|
|
593
472
|
Object.defineProperty(exports, "MotionText", {
|
|
594
473
|
enumerable: true,
|
|
595
|
-
get: function () { return
|
|
474
|
+
get: function () { return chunkTVFNJ25Z_js.MotionText; }
|
|
596
475
|
});
|
|
597
476
|
Object.defineProperty(exports, "MotionImage", {
|
|
598
477
|
enumerable: true,
|
|
599
|
-
get: function () { return
|
|
478
|
+
get: function () { return chunk5SRD2WCO_js.MotionImage; }
|
|
600
479
|
});
|
|
601
480
|
Object.defineProperty(exports, "MotionPressable", {
|
|
602
481
|
enumerable: true,
|
|
603
|
-
get: function () { return
|
|
482
|
+
get: function () { return chunkCENTULW6_js.MotionPressable; }
|
|
604
483
|
});
|
|
605
484
|
Object.defineProperty(exports, "MotionScrollView", {
|
|
606
485
|
enumerable: true,
|
|
607
|
-
get: function () { return
|
|
486
|
+
get: function () { return chunkXMEVPEMH_js.MotionScrollView; }
|
|
608
487
|
});
|
|
609
488
|
Object.defineProperty(exports, "Presence", {
|
|
610
489
|
enumerable: true,
|
|
611
|
-
get: function () { return
|
|
490
|
+
get: function () { return chunkMYE5NMXW_js.Presence; }
|
|
612
491
|
});
|
|
613
492
|
Object.defineProperty(exports, "createMotionComponent", {
|
|
614
493
|
enumerable: true,
|
|
615
|
-
get: function () { return
|
|
494
|
+
get: function () { return chunkMYE5NMXW_js.createMotionComponent; }
|
|
616
495
|
});
|
|
617
496
|
Object.defineProperty(exports, "usePresence", {
|
|
618
497
|
enumerable: true,
|
|
619
|
-
get: function () { return
|
|
498
|
+
get: function () { return chunkMYE5NMXW_js.usePresence; }
|
|
620
499
|
});
|
|
621
500
|
Object.defineProperty(exports, "MotionConfig", {
|
|
622
501
|
enumerable: true,
|
|
623
|
-
get: function () { return
|
|
502
|
+
get: function () { return chunkWVRCKOPO_js.MotionConfig; }
|
|
624
503
|
});
|
|
625
504
|
Object.defineProperty(exports, "resolveNamedTransition", {
|
|
626
505
|
enumerable: true,
|
|
627
|
-
get: function () { return
|
|
506
|
+
get: function () { return chunkWVRCKOPO_js.resolveNamedTransition; }
|
|
628
507
|
});
|
|
629
508
|
Object.defineProperty(exports, "useMotionConfig", {
|
|
630
509
|
enumerable: true,
|
|
631
|
-
get: function () { return
|
|
510
|
+
get: function () { return chunkWVRCKOPO_js.useMotionConfig; }
|
|
632
511
|
});
|
|
633
512
|
Object.defineProperty(exports, "useNamedTransitions", {
|
|
634
513
|
enumerable: true,
|
|
635
|
-
get: function () { return
|
|
514
|
+
get: function () { return chunkWVRCKOPO_js.useNamedTransitions; }
|
|
636
515
|
});
|
|
637
516
|
Object.defineProperty(exports, "useShouldReduceMotion", {
|
|
638
517
|
enumerable: true,
|
|
639
|
-
get: function () { return
|
|
518
|
+
get: function () { return chunkWVRCKOPO_js.useShouldReduceMotion; }
|
|
640
519
|
});
|
|
641
520
|
Object.defineProperty(exports, "buildReleaseAnimation", {
|
|
642
521
|
enumerable: true,
|
|
643
|
-
get: function () { return
|
|
522
|
+
get: function () { return chunk7A6WTXNK_js.buildReleaseAnimation; }
|
|
644
523
|
});
|
|
645
524
|
Object.defineProperty(exports, "cubicBezier", {
|
|
646
525
|
enumerable: true,
|
|
647
|
-
get: function () { return
|
|
526
|
+
get: function () { return chunk7A6WTXNK_js.cubicBezier; }
|
|
648
527
|
});
|
|
649
528
|
Object.defineProperty(exports, "ensureWorkletEasing", {
|
|
650
529
|
enumerable: true,
|
|
651
|
-
get: function () { return
|
|
530
|
+
get: function () { return chunk7A6WTXNK_js.ensureWorkletEasing; }
|
|
652
531
|
});
|
|
653
532
|
Object.defineProperty(exports, "resolveAnimatableValue", {
|
|
654
533
|
enumerable: true,
|
|
655
|
-
get: function () { return
|
|
534
|
+
get: function () { return chunk7A6WTXNK_js.resolveAnimatableValue; }
|
|
656
535
|
});
|
|
657
536
|
Object.defineProperty(exports, "resolveTransition", {
|
|
658
537
|
enumerable: true,
|
|
659
|
-
get: function () { return
|
|
538
|
+
get: function () { return chunk7A6WTXNK_js.resolveTransition; }
|
|
660
539
|
});
|
|
661
540
|
exports.Motion = Motion;
|
|
662
541
|
exports.useAnimation = useAnimation;
|