@tamagui/animations-react-native 2.7.7 → 3.0.0-beta.1093.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/cjs/createAnimations.native.cjs +692 -0
  2. package/dist/cjs/createAnimations.native.js +643 -597
  3. package/dist/cjs/createAnimations.native.js.map +1 -1
  4. package/dist/cjs/index.cjs +19 -13
  5. package/dist/cjs/index.native.cjs +21 -0
  6. package/dist/cjs/index.native.js +12 -13
  7. package/dist/cjs/index.native.js.map +1 -1
  8. package/dist/cjs/polyfill.cjs +2 -2
  9. package/dist/cjs/polyfill.native.cjs +5 -0
  10. package/dist/cjs/polyfill.native.js +2 -1
  11. package/dist/cjs/polyfill.native.js.map +1 -1
  12. package/dist/cjs/types.cjs +16 -0
  13. package/dist/cjs/types.native.cjs +18 -0
  14. package/dist/cjs/types.native.js +20 -0
  15. package/dist/cjs/types.native.js.map +1 -0
  16. package/dist/esm/createAnimations.native.js +621 -567
  17. package/dist/esm/createAnimations.native.js.map +1 -1
  18. package/dist/esm/index.js +6 -2
  19. package/dist/esm/index.js.map +1 -1
  20. package/dist/esm/index.mjs +6 -2
  21. package/dist/esm/index.mjs.map +1 -1
  22. package/dist/esm/index.native.js +2 -2
  23. package/dist/esm/polyfill.mjs +2 -1
  24. package/dist/esm/polyfill.mjs.map +1 -1
  25. package/dist/esm/polyfill.native.js +2 -1
  26. package/dist/esm/polyfill.native.js.map +1 -1
  27. package/dist/esm/types.mjs +0 -0
  28. package/dist/esm/types.native.js +0 -0
  29. package/package.json +15 -10
  30. package/src/{createAnimations.tsx → createAnimations.native.tsx} +277 -137
  31. package/src/index.native.ts +3 -0
  32. package/src/index.ts +20 -2
  33. package/src/types.ts +4 -0
  34. package/types/{createAnimations.d.ts → createAnimations.native.d.ts} +5 -14
  35. package/types/createAnimations.native.d.ts.map +11 -0
  36. package/types/index.d.ts +10 -2
  37. package/types/index.d.ts.map +2 -2
  38. package/types/index.native.d.ts +4 -0
  39. package/types/index.native.d.ts.map +11 -0
  40. package/types/types.d.ts +5 -0
  41. package/types/types.d.ts.map +11 -0
  42. package/dist/cjs/createAnimations.cjs +0 -566
  43. package/dist/esm/createAnimations.mjs +0 -524
  44. package/dist/esm/createAnimations.mjs.map +0 -1
  45. package/dist/esm/index.native.js.map +0 -1
  46. package/types/createAnimations.d.ts.map +0 -11
@@ -1,566 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
30
- }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
34
- var createAnimations_exports = {};
35
- __export(createAnimations_exports, {
36
- AnimatedText: () => AnimatedText,
37
- AnimatedView: () => AnimatedView,
38
- createAnimations: () => createAnimations,
39
- useAnimatedNumber: () => useAnimatedNumber,
40
- useAnimatedNumberReaction: () => useAnimatedNumberReaction,
41
- useAnimatedNumberStyle: () => useAnimatedNumberStyle,
42
- useAnimatedNumbersStyle: () => useAnimatedNumbersStyle
43
- });
44
- module.exports = __toCommonJS(createAnimations_exports);
45
- var import_animation_helpers = require("@tamagui/animation-helpers");
46
- var import_constants = require("@tamagui/constants");
47
- var import_use_presence = require("@tamagui/use-presence");
48
- var import_web = require("@tamagui/web");
49
- var import_react = __toESM(require("react"), 1);
50
- var import_react_native = require("react-native-web");
51
- const isFabric = !import_constants.isWeb && typeof global !== "undefined" && !!global.__nativeFabricUIManager;
52
- const resolveDynamicValue = (value, isDark) => {
53
- if (value && typeof value === "object" && "dynamic" in value) {
54
- const dynamicValue = isDark ? value.dynamic.dark : value.dynamic.light;
55
- return dynamicValue;
56
- }
57
- return value;
58
- };
59
- const animatedStyleKey = {
60
- transform: true,
61
- opacity: true
62
- };
63
- const colorStyleKey = {
64
- backgroundColor: true,
65
- color: true,
66
- borderColor: true,
67
- borderLeftColor: true,
68
- borderRightColor: true,
69
- borderTopColor: true,
70
- borderBottomColor: true
71
- };
72
- const layoutStyleKey = {
73
- height: true,
74
- width: true,
75
- minHeight: true,
76
- maxHeight: true,
77
- minWidth: true,
78
- maxWidth: true
79
- };
80
- function hasAnimatedLayoutKey(style, isDark, animateOnly) {
81
- for (const key in layoutStyleKey) {
82
- if (animateOnly && !animateOnly.includes(key)) continue;
83
- if (typeof resolveDynamicValue(style[key], isDark) === "number") return true;
84
- }
85
- return false;
86
- }
87
- function isAnimatableColor(value) {
88
- if (typeof value !== "string") return false;
89
- if (value === "") return false;
90
- if (value.includes("var(") || value.includes("calc(")) return false;
91
- return true;
92
- }
93
- const costlyToAnimateStyleKey = {
94
- borderRadius: true,
95
- borderTopLeftRadius: true,
96
- borderTopRightRadius: true,
97
- borderBottomLeftRadius: true,
98
- borderBottomRightRadius: true,
99
- borderWidth: true,
100
- borderLeftWidth: true,
101
- borderRightWidth: true,
102
- borderTopWidth: true,
103
- borderBottomWidth: true,
104
- ...colorStyleKey
105
- };
106
- const AnimatedView = import_react_native.Animated.View;
107
- const AnimatedText = import_react_native.Animated.Text;
108
- function useAnimatedNumber(initial) {
109
- const state = import_react.default.useRef(null);
110
- if (!state.current) {
111
- state.current = {
112
- composite: null,
113
- val: new import_react_native.Animated.Value(initial),
114
- strategy: {
115
- type: "spring"
116
- }
117
- };
118
- }
119
- return {
120
- getInstance() {
121
- return state.current.val;
122
- },
123
- getValue() {
124
- return state.current.val["_value"];
125
- },
126
- stop() {
127
- state.current.composite?.stop();
128
- state.current.composite = null;
129
- },
130
- setValue(next, {
131
- type,
132
- ...config
133
- } = {
134
- type: "spring"
135
- }, onFinish) {
136
- const val = state.current.val;
137
- const handleFinish = onFinish ? ({
138
- finished
139
- }) => finished ? onFinish() : null : void 0;
140
- if (type === "direct") {
141
- val.setValue(next);
142
- } else if (type === "spring") {
143
- state.current.composite?.stop();
144
- const composite = import_react_native.Animated.spring(val, {
145
- ...config,
146
- toValue: next,
147
- useNativeDriver: isFabric
148
- });
149
- composite.start(handleFinish);
150
- state.current.composite = composite;
151
- } else {
152
- state.current.composite?.stop();
153
- const composite = import_react_native.Animated.timing(val, {
154
- ...config,
155
- toValue: next,
156
- useNativeDriver: isFabric
157
- });
158
- composite.start(handleFinish);
159
- state.current.composite = composite;
160
- }
161
- }
162
- };
163
- }
164
- const useAnimatedNumberReaction = ({
165
- value
166
- }, onValue) => {
167
- const onChange = (0, import_web.useEvent)(current => {
168
- onValue(current.value);
169
- });
170
- import_react.default.useEffect(() => {
171
- const id = value.getInstance().addListener(onChange);
172
- return () => {
173
- value.getInstance().removeListener(id);
174
- };
175
- }, [value, onChange]);
176
- };
177
- const useAnimatedNumberStyle = (value, getStyle) => {
178
- return getStyle(value.getInstance());
179
- };
180
- const useAnimatedNumbersStyle = (vals, getStyle) => {
181
- return getStyle(...vals.map(v => v.getInstance()));
182
- };
183
- function createAnimations(animations, options) {
184
- const nativeDriver = options?.useNativeDriver ?? isFabric;
185
- return {
186
- isReactNative: true,
187
- inputStyle: "value",
188
- outputStyle: "inline",
189
- avoidReRenders: true,
190
- animations,
191
- needsCustomComponent: true,
192
- View: AnimatedView,
193
- Text: AnimatedText,
194
- useAnimatedNumber,
195
- useAnimatedNumberReaction,
196
- useAnimatedNumberStyle,
197
- useAnimatedNumbersStyle,
198
- usePresence: import_use_presence.usePresence,
199
- ResetPresence: import_use_presence.ResetPresence,
200
- useAnimations: ({
201
- props,
202
- onDidAnimate,
203
- style,
204
- componentState,
205
- presence,
206
- stateRef,
207
- useStyleEmitter
208
- }) => {
209
- const isDisabled = import_constants.isWeb && componentState.unmounted === true;
210
- const isExiting = presence?.[0] === false;
211
- const sendExitComplete = presence?.[1];
212
- const [, themeState] = (0, import_web.useThemeWithState)({});
213
- const isDark = themeState?.scheme === "dark" || themeState?.name?.startsWith("dark");
214
- const animateStyles = import_react.default.useRef({});
215
- const animatedTranforms = import_react.default.useRef([]);
216
- const animationsState = import_react.default.useRef(/* @__PURE__ */new WeakMap());
217
- const pseudoActiveRef = import_react.default.useRef(false);
218
- const exitCycleIdRef = import_react.default.useRef(0);
219
- const exitCompletedRef = import_react.default.useRef(false);
220
- const wasExitingRef = import_react.default.useRef(false);
221
- const justStartedExiting = isExiting && !wasExitingRef.current;
222
- const justStoppedExiting = !isExiting && wasExitingRef.current;
223
- if (justStartedExiting) {
224
- exitCycleIdRef.current++;
225
- exitCompletedRef.current = false;
226
- }
227
- if (justStoppedExiting) {
228
- exitCycleIdRef.current++;
229
- }
230
- const animateOnly = props.animateOnly || [];
231
- const hasTransitionOnly = !!props.animateOnly;
232
- const isEntering = !!componentState.unmounted;
233
- const wasEnteringRef = import_react.default.useRef(isEntering);
234
- const justFinishedEntering = wasEnteringRef.current && !isEntering;
235
- import_react.default.useEffect(() => {
236
- wasEnteringRef.current = isEntering;
237
- });
238
- const args = [JSON.stringify(style), componentState, isExiting, !!onDidAnimate, isDark, justFinishedEntering, hasTransitionOnly];
239
- const res = import_react.default.useMemo(() => {
240
- const runners = [];
241
- const completions = [];
242
- const animationState = isExiting ? "exit" : isEntering || justFinishedEntering ? "enter" : "default";
243
- const nonAnimatedStyle = {};
244
- const useNativeDriverForNode = nativeDriver && !hasAnimatedLayoutKey(style, isDark, hasTransitionOnly ? animateOnly : void 0);
245
- const seenAnimateKeys = /* @__PURE__ */new Set();
246
- let sawTransform = false;
247
- let transformCount = 0;
248
- for (const key in style) {
249
- const rawVal = style[key];
250
- const val = resolveDynamicValue(rawVal, isDark);
251
- if (val === void 0) continue;
252
- if (isDisabled) {
253
- continue;
254
- }
255
- if (animatedStyleKey[key] == null && !costlyToAnimateStyleKey[key] && !layoutStyleKey[key]) {
256
- nonAnimatedStyle[key] = val;
257
- continue;
258
- }
259
- if (hasTransitionOnly && !animateOnly.includes(key)) {
260
- nonAnimatedStyle[key] = val;
261
- continue;
262
- }
263
- if (layoutStyleKey[key] && typeof val !== "number") {
264
- nonAnimatedStyle[key] = val;
265
- continue;
266
- }
267
- if (colorStyleKey[key] && !isAnimatableColor(val)) {
268
- nonAnimatedStyle[key] = val;
269
- continue;
270
- }
271
- if (key !== "transform") {
272
- animateStyles.current[key] = update(key, animateStyles.current[key], val);
273
- seenAnimateKeys.add(key);
274
- continue;
275
- }
276
- if (!val) continue;
277
- if (typeof val === "string") {
278
- console.warn(`Warning: Tamagui can't animate string transforms yet!`);
279
- continue;
280
- }
281
- sawTransform = true;
282
- for (const transform of val) {
283
- if (!transform) continue;
284
- const index = transformCount++;
285
- const tkey = Object.keys(transform)[0];
286
- const currentTransform = animatedTranforms.current[index]?.[tkey];
287
- animatedTranforms.current[index] = {
288
- [tkey]: update(tkey, currentTransform, transform[tkey])
289
- };
290
- animatedTranforms.current = [...animatedTranforms.current];
291
- }
292
- }
293
- if (!isExiting && !isDisabled && !pseudoActiveRef.current) {
294
- for (const k in animateStyles.current) {
295
- if (!seenAnimateKeys.has(k)) delete animateStyles.current[k];
296
- }
297
- if (!sawTransform) {
298
- if (animatedTranforms.current.length) animatedTranforms.current = [];
299
- } else if (animatedTranforms.current.length > transformCount) {
300
- animatedTranforms.current = animatedTranforms.current.slice(0, transformCount);
301
- }
302
- }
303
- const animatedTransformStyle = animatedTranforms.current.length > 0 ? {
304
- transform: animatedTranforms.current.map(r => {
305
- const key = Object.keys(r)[0];
306
- const val = animationsState.current.get(r[key])?.interpolation || r[key];
307
- return {
308
- [key]: val
309
- };
310
- })
311
- } : {};
312
- const animatedStyle = {
313
- ...Object.fromEntries(Object.entries(animateStyles.current).map(([k, v]) => [k, animationsState.current.get(v)?.interpolation || v])),
314
- ...animatedTransformStyle
315
- };
316
- return {
317
- runners,
318
- completions,
319
- style: [nonAnimatedStyle, animatedStyle]
320
- };
321
- function update(key, animated, valIn) {
322
- const isColorStyleKey = colorStyleKey[key];
323
- const [val, type] = isColorStyleKey ? [0, void 0] : getValue(valIn);
324
- let animateToValue = val;
325
- const value = animated || new import_react_native.Animated.Value(val);
326
- const curInterpolation = animationsState.current.get(value);
327
- let interpolateArgs;
328
- if (type) {
329
- interpolateArgs = getInterpolated(curInterpolation?.current ?? value["_value"], val, type);
330
- animationsState.current.set(value, {
331
- interpolation: value.interpolate(interpolateArgs),
332
- current: val
333
- });
334
- }
335
- if (isColorStyleKey) {
336
- animateToValue = curInterpolation?.animateToValue ? 0 : 1;
337
- interpolateArgs = getColorInterpolated(curInterpolation?.current,
338
- // valIn is the next color
339
- valIn, animateToValue);
340
- animationsState.current.set(value, {
341
- current: valIn,
342
- interpolation: value.interpolate(interpolateArgs),
343
- animateToValue: curInterpolation?.animateToValue ? 0 : 1
344
- });
345
- }
346
- if (value) {
347
- const animationConfig = getAnimationConfig(key, animations, props.transition, animationState);
348
- let resolve;
349
- const promise = new Promise(res2 => {
350
- resolve = res2;
351
- });
352
- completions.push(promise);
353
- runners.push(() => {
354
- value.stopAnimation();
355
- function getAnimation() {
356
- return import_react_native.Animated[animationConfig.type || "spring"](value, {
357
- toValue: animateToValue,
358
- ...animationConfig,
359
- useNativeDriver: useNativeDriverForNode
360
- });
361
- }
362
- const animation = animationConfig.delay ? import_react_native.Animated.sequence([import_react_native.Animated.delay(animationConfig.delay), getAnimation()]) : getAnimation();
363
- animation.start(({
364
- finished
365
- }) => {
366
- if (finished || isExiting) {
367
- resolve();
368
- }
369
- });
370
- });
371
- }
372
- if (process.env.NODE_ENV === "development") {
373
- if (props["debug"] === "verbose") {
374
- console.info(" \u{1F4A0} animate", key, `from (${value["_value"]}) to`, valIn, `(${val})`, "type", type, "interpolate", interpolateArgs);
375
- }
376
- }
377
- return value;
378
- }
379
- }, args);
380
- import_react.default.useEffect(() => {
381
- wasExitingRef.current = isExiting;
382
- });
383
- (0, import_constants.useIsomorphicLayoutEffect)(() => {
384
- res.runners.forEach(r => r());
385
- const cycleId = exitCycleIdRef.current;
386
- if (res.completions.length === 0) {
387
- onDidAnimate?.();
388
- if (isExiting && !exitCompletedRef.current) {
389
- exitCompletedRef.current = true;
390
- sendExitComplete?.();
391
- }
392
- return;
393
- }
394
- let cancel = false;
395
- Promise.all(res.completions).then(() => {
396
- if (cancel) return;
397
- if (isExiting && cycleId !== exitCycleIdRef.current) return;
398
- if (isExiting && exitCompletedRef.current) return;
399
- onDidAnimate?.();
400
- if (isExiting) {
401
- exitCompletedRef.current = true;
402
- sendExitComplete?.();
403
- }
404
- });
405
- return () => {
406
- cancel = true;
407
- };
408
- }, args);
409
- useStyleEmitter?.((nextStyle, _effectiveTransition, pseudoActive) => {
410
- pseudoActiveRef.current = pseudoActive === true;
411
- const runners = [];
412
- const seenAnimateKeys = /* @__PURE__ */new Set();
413
- let transformCount = 0;
414
- let animatedShapeChanged = false;
415
- const useNativeDriverForNode = nativeDriver && !hasAnimatedLayoutKey(nextStyle, isDark) && !Object.keys(animateStyles.current).some(key => layoutStyleKey[key]);
416
- for (const key in nextStyle) {
417
- const rawVal = nextStyle[key];
418
- const val = resolveDynamicValue(rawVal, isDark);
419
- if (val === void 0) continue;
420
- if (key === "transform" && Array.isArray(val)) {
421
- for (const transform of val) {
422
- if (!transform) continue;
423
- const index = transformCount++;
424
- const tkey = Object.keys(transform)[0];
425
- const currentTransform = animatedTranforms.current[index]?.[tkey];
426
- if (!currentTransform) animatedShapeChanged = true;
427
- animatedTranforms.current[index] = {
428
- [tkey]: update(tkey, currentTransform, transform[tkey])
429
- };
430
- }
431
- } else if (animatedStyleKey[key] != null || costlyToAnimateStyleKey[key] || layoutStyleKey[key]) {
432
- if (layoutStyleKey[key] && typeof val !== "number") continue;
433
- if (colorStyleKey[key] && !isAnimatableColor(val)) continue;
434
- if (!animateStyles.current[key]) animatedShapeChanged = true;
435
- animateStyles.current[key] = update(key, animateStyles.current[key], val);
436
- seenAnimateKeys.add(key);
437
- }
438
- }
439
- for (const key in animateStyles.current) {
440
- if (!seenAnimateKeys.has(key)) {
441
- delete animateStyles.current[key];
442
- animatedShapeChanged = true;
443
- }
444
- }
445
- if (animatedTranforms.current.length > transformCount) {
446
- animatedTranforms.current = animatedTranforms.current.slice(0, transformCount);
447
- animatedShapeChanged = true;
448
- }
449
- runners.forEach(r => r());
450
- if (animatedShapeChanged && stateRef.current.nextState) {
451
- stateRef.current.baseSetStateShallow?.(stateRef.current.nextState);
452
- }
453
- function update(key, animated, valIn) {
454
- const isColor = colorStyleKey[key];
455
- const [numVal, type] = isColor ? [0, void 0] : getValue(valIn);
456
- let animateToValue = numVal;
457
- const value = animated || new import_react_native.Animated.Value(numVal);
458
- const curInterpolation = animationsState.current.get(value);
459
- if (type) {
460
- animationsState.current.set(value, {
461
- interpolation: value.interpolate(getInterpolated(curInterpolation?.current ?? value["_value"], numVal, type)),
462
- current: numVal
463
- });
464
- }
465
- if (isColor) {
466
- animateToValue = curInterpolation?.animateToValue ? 0 : 1;
467
- animationsState.current.set(value, {
468
- current: valIn,
469
- interpolation: value.interpolate(getColorInterpolated(curInterpolation?.current, valIn, animateToValue)),
470
- animateToValue: curInterpolation?.animateToValue ? 0 : 1
471
- });
472
- }
473
- const animationConfig = getAnimationConfig(key, animations, props.transition, "default");
474
- runners.push(() => {
475
- value.stopAnimation();
476
- const anim = import_react_native.Animated[animationConfig.type || "spring"](value, {
477
- toValue: animateToValue,
478
- ...animationConfig,
479
- useNativeDriver: useNativeDriverForNode
480
- });
481
- (animationConfig.delay ? import_react_native.Animated.sequence([import_react_native.Animated.delay(animationConfig.delay), anim]) : anim).start();
482
- });
483
- return value;
484
- }
485
- });
486
- if (process.env.NODE_ENV === "development") {
487
- if (props["debug"] === "verbose") {
488
- console.info(`Animated`, {
489
- response: res,
490
- inputStyle: style,
491
- isExiting
492
- });
493
- }
494
- }
495
- return res;
496
- }
497
- };
498
- }
499
- function getColorInterpolated(currentColor, nextColor, animateToValue) {
500
- const inputRange = [0, 1];
501
- const outputRange = [currentColor ? currentColor : nextColor, nextColor];
502
- if (animateToValue === 0) {
503
- outputRange.reverse();
504
- }
505
- return {
506
- inputRange,
507
- outputRange
508
- };
509
- }
510
- function getInterpolated(current, next, postfix = "deg") {
511
- if (next === current) {
512
- current = next - 1e-9;
513
- }
514
- const inputRange = [current, next];
515
- const outputRange = [`${current}${postfix}`, `${next}${postfix}`];
516
- if (next < current) {
517
- inputRange.reverse();
518
- outputRange.reverse();
519
- }
520
- return {
521
- inputRange,
522
- outputRange
523
- };
524
- }
525
- function getAnimationConfig(key, animations, transition, animationState = "default") {
526
- const normalized = (0, import_animation_helpers.normalizeTransition)(transition);
527
- const shortKey = transformShorthands[key];
528
- const propAnimation = normalized.properties[key] ?? normalized.properties[shortKey];
529
- let animationType = null;
530
- let extraConf = {};
531
- if (typeof propAnimation === "string") {
532
- animationType = propAnimation;
533
- } else if (propAnimation && typeof propAnimation === "object") {
534
- animationType = propAnimation.type || (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
535
- extraConf = propAnimation;
536
- } else {
537
- animationType = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
538
- }
539
- if (normalized.delay && !extraConf.delay) {
540
- extraConf = {
541
- ...extraConf,
542
- delay: normalized.delay
543
- };
544
- }
545
- const found = animationType ? animations[animationType] : {};
546
- return {
547
- ...found,
548
- // Apply global spring config overrides (from transition={['bouncy', { stiffness: 1000 }]})
549
- ...normalized.config,
550
- // Property-specific config takes highest precedence
551
- ...extraConf
552
- };
553
- }
554
- const transformShorthands = {
555
- x: "translateX",
556
- y: "translateY",
557
- translateX: "x",
558
- translateY: "y"
559
- };
560
- function getValue(input, isColor = false) {
561
- if (typeof input !== "string") {
562
- return [input];
563
- }
564
- const [_, number, after] = input.match(/([-0-9]+)(deg|%|px)/) ?? [];
565
- return [+number, after];
566
- }