@rootnative/inertia 0.0.0-alpha.2 → 0.0.0-alpha.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.
@@ -0,0 +1,6 @@
1
+ import { createMotionComponent } from './chunk-I76OC6RX.mjs';
2
+ import { Text } from 'react-native';
3
+
4
+ var MotionText = createMotionComponent(Text);
5
+
6
+ export { MotionText };
@@ -0,0 +1,6 @@
1
+ import { createMotionComponent } from './chunk-I76OC6RX.mjs';
2
+ import { Image } from 'react-native';
3
+
4
+ var MotionImage = createMotionComponent(Image);
5
+
6
+ export { MotionImage };
@@ -0,0 +1,104 @@
1
+ import { stableSig, isTopLevelTransition } from './chunk-6FENLMCA.mjs';
2
+ import { createContext, useContext, useMemo } from 'react';
3
+ import { useReducedMotion } from 'react-native-reanimated';
4
+ import { jsx } from 'react/jsx-runtime';
5
+ import { Platform } from 'react-native';
6
+
7
+ var DEFAULT_MOTION_CONFIG = {
8
+ reducedMotion: "user",
9
+ transitions: {}
10
+ };
11
+ var MotionConfigContext = createContext(
12
+ DEFAULT_MOTION_CONFIG
13
+ );
14
+ function useMotionConfig() {
15
+ return useContext(MotionConfigContext);
16
+ }
17
+ function useNamedTransitions() {
18
+ return useMotionConfig().transitions;
19
+ }
20
+ function useShouldReduceMotion() {
21
+ const { reducedMotion } = useMotionConfig();
22
+ const osReduced = useReducedMotion();
23
+ if (reducedMotion === "never") return false;
24
+ if (reducedMotion === "always") return true;
25
+ return osReduced;
26
+ }
27
+ function MotionConfig({
28
+ reducedMotion,
29
+ transitions,
30
+ children
31
+ }) {
32
+ const parent = useMotionConfig();
33
+ const transitionsSig = stableSig(transitions);
34
+ const value = useMemo(
35
+ () => ({
36
+ reducedMotion: reducedMotion ?? parent.reducedMotion,
37
+ transitions: transitions ? { ...parent.transitions, ...transitions } : parent.transitions
38
+ }),
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ [reducedMotion, transitionsSig, parent]
41
+ );
42
+ return /* @__PURE__ */ jsx(MotionConfigContext.Provider, { value, children });
43
+ }
44
+
45
+ // src/config/namedTransitions.ts
46
+ var UNKNOWN_NAME_FALLBACK = { type: "spring" };
47
+ function lookupNamedTransition(name, registry) {
48
+ const cfg = registry[name];
49
+ if (cfg) return cfg;
50
+ if (__DEV__) {
51
+ console.warn(
52
+ `[inertia] Unknown transition name "${name}" \u2014 falling back to the default spring. Register it on a provider: <MotionConfig transitions={{ '${name}': { ... } }}>.`
53
+ );
54
+ }
55
+ return UNKNOWN_NAME_FALLBACK;
56
+ }
57
+ function resolveNamedTransition(input, registry) {
58
+ if (input === void 0) return void 0;
59
+ if (typeof input === "string") return lookupNamedTransition(input, registry);
60
+ return input;
61
+ }
62
+ function resolveNamedTransitionProp(transition, registry) {
63
+ if (transition === void 0) return void 0;
64
+ if (typeof transition === "string") {
65
+ return lookupNamedTransition(transition, registry);
66
+ }
67
+ if (isTopLevelTransition(transition)) return transition;
68
+ const map = transition;
69
+ let out = null;
70
+ for (const key in map) {
71
+ const value = map[key];
72
+ if (typeof value === "string") {
73
+ if (out === null) out = { ...map };
74
+ out[key] = lookupNamedTransition(value, registry);
75
+ }
76
+ }
77
+ return out ?? transition;
78
+ }
79
+ var modality = "keyboard";
80
+ var installed = false;
81
+ function setKeyboard() {
82
+ modality = "keyboard";
83
+ }
84
+ function setPointer() {
85
+ modality = "pointer";
86
+ }
87
+ function ensureInstalled() {
88
+ if (installed) return;
89
+ if (Platform.OS !== "web") return;
90
+ if (typeof document === "undefined") return;
91
+ document.addEventListener("keydown", setKeyboard, true);
92
+ document.addEventListener("mousedown", setPointer, true);
93
+ document.addEventListener("pointerdown", setPointer, true);
94
+ document.addEventListener("touchstart", setPointer, true);
95
+ installed = true;
96
+ }
97
+ ensureInstalled();
98
+ function isFocusVisible() {
99
+ if (Platform.OS !== "web") return true;
100
+ ensureInstalled();
101
+ return modality === "keyboard";
102
+ }
103
+
104
+ export { MotionConfig, isFocusVisible, lookupNamedTransition, resolveNamedTransition, resolveNamedTransitionProp, useMotionConfig, useNamedTransitions, useShouldReduceMotion };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunk6UQ4KA6V_js = require('./chunk-6UQ4KA6V.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionImage = chunk6UQ4KA6V_js.createMotionComponent(reactNative.Image);
7
+
8
+ exports.MotionImage = MotionImage;
@@ -0,0 +1,6 @@
1
+ import { createMotionComponent } from './chunk-I76OC6RX.mjs';
2
+ import { Pressable } from 'react-native';
3
+
4
+ var MotionPressable = createMotionComponent(Pressable);
5
+
6
+ export { MotionPressable };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunk6UQ4KA6V_js = require('./chunk-6UQ4KA6V.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionPressable = chunk6UQ4KA6V_js.createMotionComponent(reactNative.Pressable);
7
+
8
+ exports.MotionPressable = MotionPressable;
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ var chunk6EP3S2PN_js = require('./chunk-6EP3S2PN.js');
4
+ var chunkSFRNO6AW_js = require('./chunk-SFRNO6AW.js');
5
+ var react = require('react');
6
+ var reactNativeReanimated = require('react-native-reanimated');
7
+
8
+ function useGesture(transition) {
9
+ const pressed = reactNativeReanimated.useSharedValue(0);
10
+ const focused = reactNativeReanimated.useSharedValue(0);
11
+ const focusVisible = reactNativeReanimated.useSharedValue(0);
12
+ const hovered = reactNativeReanimated.useSharedValue(0);
13
+ const shouldReduceMotion = chunk6EP3S2PN_js.useShouldReduceMotion();
14
+ const resolved = chunk6EP3S2PN_js.resolveNamedTransitionProp(transition, chunk6EP3S2PN_js.useNamedTransitions());
15
+ const setLayer = react.useCallback(
16
+ (sv, layer, target) => {
17
+ const cfg = shouldReduceMotion ? { type: "no-animation" } : layerTransition(layer, resolved) ?? { type: "spring" };
18
+ sv.value = chunkSFRNO6AW_js.resolveTransition(cfg, target);
19
+ },
20
+ // The transition is intentionally read on every call rather than cooked
21
+ // into the dep array — a fresh literal each render would otherwise
22
+ // rebuild the handler bag and break composing consumers that key off
23
+ // handler identity. `transition` is read inside the callback closure;
24
+ // shared values are stable so the only dep that matters is the reduce-
25
+ // motion flag.
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ [shouldReduceMotion]
28
+ );
29
+ const handlers = react.useMemo(
30
+ () => ({
31
+ onPressIn: () => setLayer(pressed, "pressed", 1),
32
+ onPressOut: () => setLayer(pressed, "pressed", 0),
33
+ onHoverIn: () => setLayer(hovered, "hovered", 1),
34
+ onHoverOut: () => setLayer(hovered, "hovered", 0),
35
+ onFocus: () => {
36
+ setLayer(focused, "focused", 1);
37
+ if (chunk6EP3S2PN_js.isFocusVisible()) setLayer(focusVisible, "focusVisible", 1);
38
+ },
39
+ onBlur: () => {
40
+ setLayer(focused, "focused", 0);
41
+ setLayer(focusVisible, "focusVisible", 0);
42
+ }
43
+ }),
44
+ [setLayer, pressed, focused, focusVisible, hovered]
45
+ );
46
+ return { pressed, focused, focusVisible, hovered, handlers };
47
+ }
48
+ function layerTransition(layer, transition) {
49
+ if (!transition) return void 0;
50
+ if (chunkSFRNO6AW_js.isTopLevelTransition(transition)) return transition;
51
+ return transition[layer];
52
+ }
53
+
54
+ exports.useGesture = useGesture;
@@ -0,0 +1,6 @@
1
+ import { createMotionComponent } from './chunk-I76OC6RX.mjs';
2
+ import { ScrollView } from 'react-native';
3
+
4
+ var MotionScrollView = createMotionComponent(ScrollView);
5
+
6
+ export { MotionScrollView };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunk6UQ4KA6V_js = require('./chunk-6UQ4KA6V.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionView = chunk6UQ4KA6V_js.createMotionComponent(reactNative.View);
7
+
8
+ exports.MotionView = MotionView;
@@ -0,0 +1,267 @@
1
+ 'use strict';
2
+
3
+ var reactNativeWorklets = require('react-native-worklets');
4
+ var reactNativeReanimated = require('react-native-reanimated');
5
+
6
+ // src/transitions/easing.ts
7
+ function ensureWorkletEasing(easing) {
8
+ if (!easing) return void 0;
9
+ const fn = isEasingFactory(easing) ? easing.factory() : easing;
10
+ if (reactNativeWorklets.isWorkletFunction(fn)) return fn;
11
+ const wrapped = (t) => {
12
+ "worklet";
13
+ return fn(t);
14
+ };
15
+ return wrapped;
16
+ }
17
+ function isEasingFactory(value) {
18
+ return typeof value === "object" && value !== null && "factory" in value && typeof value.factory === "function";
19
+ }
20
+
21
+ // src/transitions/spring.ts
22
+ var DEFAULT_SPRING = {
23
+ tension: 170,
24
+ friction: 26,
25
+ mass: 1
26
+ };
27
+ function springToReanimated(t) {
28
+ "worklet";
29
+ return {
30
+ stiffness: t.tension ?? DEFAULT_SPRING.tension,
31
+ damping: t.friction ?? DEFAULT_SPRING.friction,
32
+ mass: t.mass ?? DEFAULT_SPRING.mass,
33
+ velocity: t.velocity,
34
+ restSpeedThreshold: t.restSpeedThreshold,
35
+ restDisplacementThreshold: t.restDisplacementThreshold
36
+ };
37
+ }
38
+
39
+ // src/transitions/resolve.ts
40
+ var DEFAULT_TIMING_DURATION = 250;
41
+ function buildSpring(cfg, toValue, cb) {
42
+ return reactNativeReanimated.withSpring(toValue, springToReanimated(cfg), cb);
43
+ }
44
+ function buildTiming(cfg, toValue, cb) {
45
+ return reactNativeReanimated.withTiming(
46
+ toValue,
47
+ {
48
+ duration: cfg.duration ?? DEFAULT_TIMING_DURATION,
49
+ easing: ensureWorkletEasing(cfg.easing) ?? reactNativeReanimated.Easing.inOut(reactNativeReanimated.Easing.ease)
50
+ },
51
+ cb
52
+ );
53
+ }
54
+ function buildDecay(cfg, cb) {
55
+ return reactNativeReanimated.withDecay(
56
+ {
57
+ velocity: cfg.velocity ?? 0,
58
+ deceleration: cfg.deceleration,
59
+ clamp: cfg.clamp
60
+ },
61
+ cb
62
+ );
63
+ }
64
+ function buildOne(cfg, toValue, cb) {
65
+ if (cfg.type === "no-animation") {
66
+ if (cb) cb(true, toValue);
67
+ return toValue;
68
+ }
69
+ if (cfg.type === "decay") return buildDecay(cfg, cb);
70
+ if (cfg.type === "timing") return buildTiming(cfg, toValue, cb);
71
+ return buildSpring(cfg, toValue, cb);
72
+ }
73
+ function applyRepeat(animation, repeat) {
74
+ if (repeat === void 0) return animation;
75
+ if (repeat === "infinite") {
76
+ return reactNativeReanimated.withRepeat(animation, -1, true);
77
+ }
78
+ if (typeof repeat === "number") {
79
+ return reactNativeReanimated.withRepeat(animation, repeat, true);
80
+ }
81
+ const count = repeat.count === "infinite" ? -1 : repeat.count;
82
+ const alternate = repeat.alternate ?? true;
83
+ return reactNativeReanimated.withRepeat(animation, count, alternate);
84
+ }
85
+ function applyDelay(animation, delay) {
86
+ if (!delay || delay <= 0) return animation;
87
+ return reactNativeReanimated.withDelay(delay, animation);
88
+ }
89
+ function resolveTransition(config, toValue, callback) {
90
+ const cfg = config ?? { type: "spring" };
91
+ const base = buildOne(cfg, toValue, callback);
92
+ const repeated = applyRepeat(base, repeatOf(cfg));
93
+ return applyDelay(repeated, delayOf(cfg));
94
+ }
95
+ function repeatOf(cfg) {
96
+ if (cfg.type === "no-animation" || cfg.type === "decay") return void 0;
97
+ return cfg.repeat;
98
+ }
99
+ function stripRepeat(cfg) {
100
+ if (!cfg) return cfg;
101
+ if (cfg.type === "no-animation" || cfg.type === "decay") return cfg;
102
+ if (cfg.repeat === void 0) return cfg;
103
+ const next = { ...cfg };
104
+ delete next.repeat;
105
+ return next;
106
+ }
107
+ function delayOf(cfg) {
108
+ if (cfg.type === "no-animation") return void 0;
109
+ return cfg.delay;
110
+ }
111
+ function isStepObject(v) {
112
+ return typeof v === "object" && v !== null && !Array.isArray(v) && "to" in v;
113
+ }
114
+ function resolveAnimatableValue(value, base, factory) {
115
+ if (Array.isArray(value)) {
116
+ const steps = value;
117
+ const stepBase = stripRepeat(base);
118
+ const animations = steps.map(
119
+ (step2, i) => resolveStep(step2, stepBase, factory?.("step", i))
120
+ );
121
+ const seq = reactNativeReanimated.withSequence(...animations);
122
+ return applyRepeat(seq, base ? repeatOf(base) : void 0);
123
+ }
124
+ const step = value;
125
+ const cb = factory?.("animation", void 0);
126
+ if (isStepObject(step)) {
127
+ return resolveStep(step, base, cb);
128
+ }
129
+ return resolveTransition(base, step, cb);
130
+ }
131
+ function resolveStep(step, base, cb) {
132
+ if (isStepObject(step)) {
133
+ const { to, ...override } = step;
134
+ const merged = mergeTransition(base, override);
135
+ return resolveTransition(merged, to, cb);
136
+ }
137
+ return resolveTransition(base, step, cb);
138
+ }
139
+ function mergeTransition(base, override) {
140
+ if (override.type && base && override.type !== base.type) {
141
+ return override;
142
+ }
143
+ return { ...base ?? { type: "spring" }, ...override };
144
+ }
145
+ var CSS_KEYWORDS = {
146
+ ease: [0.25, 0.1, 0.25, 1],
147
+ "ease-in": [0.42, 0, 1, 1],
148
+ "ease-out": [0, 0, 0.58, 1],
149
+ "ease-in-out": [0.42, 0, 0.58, 1]
150
+ };
151
+ var CSS_FUNCTION = /^cubic-bezier\((.*)\)$/;
152
+ function cubicBezier(first, y1, x2, y2) {
153
+ if (typeof first === "string") return fromCss(first);
154
+ return bezier(first, y1, x2, y2, void 0);
155
+ }
156
+ function fromCss(input) {
157
+ const token = input.trim().toLowerCase();
158
+ if (token === "linear") return reactNativeReanimated.Easing.linear;
159
+ const keyword = CSS_KEYWORDS[token];
160
+ if (keyword) return bezier(...keyword, input);
161
+ const match = CSS_FUNCTION.exec(token);
162
+ if (!match) {
163
+ throw new Error(
164
+ `[inertia] cubicBezier: unsupported easing token ${JSON.stringify(input)}. Expected four numbers, a 'cubic-bezier(x1, y1, x2, y2)' string, or one of the CSS keywords 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out'.`
165
+ );
166
+ }
167
+ const parts = match[1].split(",").map((p) => Number(p.trim()));
168
+ if (parts.length !== 4 || parts.some((n) => !Number.isFinite(n))) {
169
+ throw new Error(
170
+ `[inertia] cubicBezier: could not parse ${JSON.stringify(input)} \u2014 expected exactly four finite numbers inside cubic-bezier(...).`
171
+ );
172
+ }
173
+ return bezier(parts[0], parts[1], parts[2], parts[3], input);
174
+ }
175
+ function bezier(x1, y1, x2, y2, source) {
176
+ const describe = () => source !== void 0 ? JSON.stringify(source) : `cubicBezier(${x1}, ${y1}, ${x2}, ${y2})`;
177
+ for (const n of [x1, y1, x2, y2]) {
178
+ if (typeof n !== "number" || !Number.isFinite(n)) {
179
+ throw new Error(
180
+ `[inertia] cubicBezier: ${describe()} \u2014 every control point must be a finite number.`
181
+ );
182
+ }
183
+ }
184
+ if (x1 < 0 || x1 > 1 || x2 < 0 || x2 > 1) {
185
+ throw new Error(
186
+ `[inertia] cubicBezier: ${describe()} \u2014 x1 and x2 must be within [0, 1] (got x1=${x1}, x2=${x2}).`
187
+ );
188
+ }
189
+ return reactNativeReanimated.Easing.bezier(x1, y1, x2, y2);
190
+ }
191
+ var DEFAULT_TIMING_DURATION2 = 250;
192
+ function buildReleaseAnimation(transition, toValue) {
193
+ "worklet";
194
+ if (transition.type === "no-animation") return toValue;
195
+ if (transition.type === "decay") {
196
+ const cfg = { velocity: transition.velocity ?? 0 };
197
+ if (transition.deceleration !== void 0) {
198
+ cfg.deceleration = transition.deceleration;
199
+ }
200
+ if (transition.clamp !== void 0) cfg.clamp = transition.clamp;
201
+ return reactNativeReanimated.withDecay(cfg);
202
+ }
203
+ if (transition.type === "timing") {
204
+ const e = transition.easing;
205
+ const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? reactNativeReanimated.Easing.inOut(reactNativeReanimated.Easing.ease);
206
+ return reactNativeReanimated.withTiming(toValue, {
207
+ duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
208
+ easing: easingFn
209
+ });
210
+ }
211
+ return reactNativeReanimated.withSpring(toValue, springToReanimated(transition));
212
+ }
213
+
214
+ // src/transitions/keys.ts
215
+ var TRANSITION_CONFIG_KEYS = /* @__PURE__ */ new Set([
216
+ "type",
217
+ "tension",
218
+ "friction",
219
+ "mass",
220
+ "velocity",
221
+ "restSpeedThreshold",
222
+ "restDisplacementThreshold",
223
+ "duration",
224
+ "easing",
225
+ "delay",
226
+ "repeat",
227
+ "deceleration",
228
+ "clamp"
229
+ ]);
230
+ function isTopLevelTransition(t) {
231
+ if (t === null || typeof t !== "object") return false;
232
+ const keys = Object.keys(t);
233
+ if (keys.length === 0) return false;
234
+ return keys.every((k) => TRANSITION_CONFIG_KEYS.has(k));
235
+ }
236
+
237
+ // src/transitions/sig.ts
238
+ function stableSig(value) {
239
+ if (value === void 0) return "";
240
+ try {
241
+ return stableStringify(value);
242
+ } catch {
243
+ return String(value);
244
+ }
245
+ }
246
+ function stableStringify(v) {
247
+ if (v === null || typeof v !== "object") {
248
+ if (typeof v === "function" || v === void 0) return "null";
249
+ return JSON.stringify(v);
250
+ }
251
+ if (Array.isArray(v)) {
252
+ return "[" + v.map(stableStringify).join(",") + "]";
253
+ }
254
+ const obj = v;
255
+ const keys = Object.keys(obj).sort();
256
+ return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
257
+ }
258
+
259
+ exports.DEFAULT_SPRING = DEFAULT_SPRING;
260
+ exports.buildReleaseAnimation = buildReleaseAnimation;
261
+ exports.cubicBezier = cubicBezier;
262
+ exports.ensureWorkletEasing = ensureWorkletEasing;
263
+ exports.isTopLevelTransition = isTopLevelTransition;
264
+ exports.resolveAnimatableValue = resolveAnimatableValue;
265
+ exports.resolveTransition = resolveTransition;
266
+ exports.springToReanimated = springToReanimated;
267
+ exports.stableSig = stableSig;
@@ -0,0 +1,6 @@
1
+ import { createMotionComponent } from './chunk-I76OC6RX.mjs';
2
+ import { View } from 'react-native';
3
+
4
+ var MotionView = createMotionComponent(View);
5
+
6
+ export { MotionView };
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunk6UQ4KA6V_js = require('./chunk-6UQ4KA6V.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionText = chunk6UQ4KA6V_js.createMotionComponent(reactNative.Text);
7
+
8
+ exports.MotionText = MotionText;
@@ -0,0 +1,52 @@
1
+ import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions, isFocusVisible } from './chunk-L2EVRKSC.mjs';
2
+ import { resolveTransition, isTopLevelTransition } from './chunk-6FENLMCA.mjs';
3
+ import { useCallback, useMemo } from 'react';
4
+ import { useSharedValue } from 'react-native-reanimated';
5
+
6
+ function useGesture(transition) {
7
+ const pressed = useSharedValue(0);
8
+ const focused = useSharedValue(0);
9
+ const focusVisible = useSharedValue(0);
10
+ const hovered = useSharedValue(0);
11
+ const shouldReduceMotion = useShouldReduceMotion();
12
+ const resolved = resolveNamedTransitionProp(transition, useNamedTransitions());
13
+ const setLayer = useCallback(
14
+ (sv, layer, target) => {
15
+ const cfg = shouldReduceMotion ? { type: "no-animation" } : layerTransition(layer, resolved) ?? { type: "spring" };
16
+ sv.value = resolveTransition(cfg, target);
17
+ },
18
+ // The transition is intentionally read on every call rather than cooked
19
+ // into the dep array — a fresh literal each render would otherwise
20
+ // rebuild the handler bag and break composing consumers that key off
21
+ // handler identity. `transition` is read inside the callback closure;
22
+ // shared values are stable so the only dep that matters is the reduce-
23
+ // motion flag.
24
+ // eslint-disable-next-line react-hooks/exhaustive-deps
25
+ [shouldReduceMotion]
26
+ );
27
+ const handlers = useMemo(
28
+ () => ({
29
+ onPressIn: () => setLayer(pressed, "pressed", 1),
30
+ onPressOut: () => setLayer(pressed, "pressed", 0),
31
+ onHoverIn: () => setLayer(hovered, "hovered", 1),
32
+ onHoverOut: () => setLayer(hovered, "hovered", 0),
33
+ onFocus: () => {
34
+ setLayer(focused, "focused", 1);
35
+ if (isFocusVisible()) setLayer(focusVisible, "focusVisible", 1);
36
+ },
37
+ onBlur: () => {
38
+ setLayer(focused, "focused", 0);
39
+ setLayer(focusVisible, "focusVisible", 0);
40
+ }
41
+ }),
42
+ [setLayer, pressed, focused, focusVisible, hovered]
43
+ );
44
+ return { pressed, focused, focusVisible, hovered, handlers };
45
+ }
46
+ function layerTransition(layer, transition) {
47
+ if (!transition) return void 0;
48
+ if (isTopLevelTransition(transition)) return transition;
49
+ return transition[layer];
50
+ }
51
+
52
+ export { useGesture };