@tamagui/animations-react-native 1.110.5 → 1.111.0
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/dist/cjs/createAnimations.native.js +92 -184
- package/dist/cjs/createAnimations.native.js.map +2 -2
- package/dist/esm/createAnimations.native.js +94 -185
- package/dist/esm/createAnimations.native.js.map +2 -2
- package/dist/esm/createAnimations.native.mjs +327 -0
- package/dist/esm/createAnimations.native.mjs.map +1 -0
- package/dist/esm/index.native.js +1 -1
- package/dist/esm/index.native.mjs +2 -0
- package/dist/esm/index.native.mjs.map +1 -0
- package/dist/esm/polyfill.native.mjs +2 -0
- package/dist/esm/polyfill.native.mjs.map +1 -0
- package/package.json +5 -5
|
@@ -3,110 +3,6 @@ import { ResetPresence, usePresence } from "@tamagui/use-presence";
|
|
|
3
3
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
4
|
import { useEvent } from "@tamagui/web";
|
|
5
5
|
import { Animated } from "react-native";
|
|
6
|
-
function _array_like_to_array(arr, len) {
|
|
7
|
-
(len == null || len > arr.length) && (len = arr.length);
|
|
8
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9
|
-
return arr2;
|
|
10
|
-
}
|
|
11
|
-
function _array_with_holes(arr) {
|
|
12
|
-
if (Array.isArray(arr)) return arr;
|
|
13
|
-
}
|
|
14
|
-
function _array_without_holes(arr) {
|
|
15
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
16
|
-
}
|
|
17
|
-
function _define_property(obj, key, value) {
|
|
18
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
19
|
-
value,
|
|
20
|
-
enumerable: !0,
|
|
21
|
-
configurable: !0,
|
|
22
|
-
writable: !0
|
|
23
|
-
}) : obj[key] = value, obj;
|
|
24
|
-
}
|
|
25
|
-
function _iterable_to_array(iter) {
|
|
26
|
-
if (typeof Symbol < "u" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
27
|
-
}
|
|
28
|
-
function _iterable_to_array_limit(arr, i) {
|
|
29
|
-
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
30
|
-
if (_i != null) {
|
|
31
|
-
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
32
|
-
try {
|
|
33
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
34
|
-
;
|
|
35
|
-
} catch (err) {
|
|
36
|
-
_d = !0, _e = err;
|
|
37
|
-
} finally {
|
|
38
|
-
try {
|
|
39
|
-
!_n && _i.return != null && _i.return();
|
|
40
|
-
} finally {
|
|
41
|
-
if (_d) throw _e;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return _arr;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function _non_iterable_rest() {
|
|
48
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
49
|
-
}
|
|
50
|
-
function _non_iterable_spread() {
|
|
51
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
52
|
-
}
|
|
53
|
-
function _object_spread(target) {
|
|
54
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
55
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
56
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
57
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
58
|
-
}))), ownKeys2.forEach(function(key) {
|
|
59
|
-
_define_property(target, key, source[key]);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return target;
|
|
63
|
-
}
|
|
64
|
-
function ownKeys(object, enumerableOnly) {
|
|
65
|
-
var keys = Object.keys(object);
|
|
66
|
-
if (Object.getOwnPropertySymbols) {
|
|
67
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
68
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
69
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
70
|
-
})), keys.push.apply(keys, symbols);
|
|
71
|
-
}
|
|
72
|
-
return keys;
|
|
73
|
-
}
|
|
74
|
-
function _object_spread_props(target, source) {
|
|
75
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
76
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
77
|
-
}), target;
|
|
78
|
-
}
|
|
79
|
-
function _object_without_properties(source, excluded) {
|
|
80
|
-
if (source == null) return {};
|
|
81
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
82
|
-
if (Object.getOwnPropertySymbols) {
|
|
83
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
84
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
85
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
86
|
-
}
|
|
87
|
-
return target;
|
|
88
|
-
}
|
|
89
|
-
function _object_without_properties_loose(source, excluded) {
|
|
90
|
-
if (source == null) return {};
|
|
91
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
92
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
93
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
94
|
-
return target;
|
|
95
|
-
}
|
|
96
|
-
function _sliced_to_array(arr, i) {
|
|
97
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
98
|
-
}
|
|
99
|
-
function _to_consumable_array(arr) {
|
|
100
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
101
|
-
}
|
|
102
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
103
|
-
if (o) {
|
|
104
|
-
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
105
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
106
|
-
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
107
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
6
|
var animatedStyleKey = {
|
|
111
7
|
transform: !0,
|
|
112
8
|
opacity: !0
|
|
@@ -118,7 +14,7 @@ var animatedStyleKey = {
|
|
|
118
14
|
borderRightColor: !0,
|
|
119
15
|
borderTopColor: !0,
|
|
120
16
|
borderBottomColor: !0
|
|
121
|
-
}, costlyToAnimateStyleKey =
|
|
17
|
+
}, costlyToAnimateStyleKey = {
|
|
122
18
|
borderRadius: !0,
|
|
123
19
|
borderTopLeftRadius: !0,
|
|
124
20
|
borderTopRightRadius: !0,
|
|
@@ -128,8 +24,9 @@ var animatedStyleKey = {
|
|
|
128
24
|
borderLeftWidth: !0,
|
|
129
25
|
borderRightWidth: !0,
|
|
130
26
|
borderTopWidth: !0,
|
|
131
|
-
borderBottomWidth: !0
|
|
132
|
-
|
|
27
|
+
borderBottomWidth: !0,
|
|
28
|
+
...colorStyleKey
|
|
29
|
+
}, AnimatedView = Animated.View, AnimatedText = Animated.Text;
|
|
133
30
|
function useAnimatedNumber(initial) {
|
|
134
31
|
var state = React.useRef(null);
|
|
135
32
|
return state.current || (state.current = {
|
|
@@ -139,23 +36,21 @@ function useAnimatedNumber(initial) {
|
|
|
139
36
|
type: "spring"
|
|
140
37
|
}
|
|
141
38
|
}), {
|
|
142
|
-
getInstance
|
|
39
|
+
getInstance() {
|
|
143
40
|
return state.current.val;
|
|
144
41
|
},
|
|
145
|
-
getValue
|
|
42
|
+
getValue() {
|
|
146
43
|
return state.current.val._value;
|
|
147
44
|
},
|
|
148
|
-
stop
|
|
45
|
+
stop() {
|
|
149
46
|
var _state_current_composite;
|
|
150
47
|
(_state_current_composite = state.current.composite) === null || _state_current_composite === void 0 || _state_current_composite.stop(), state.current.composite = null;
|
|
151
48
|
},
|
|
152
|
-
setValue
|
|
153
|
-
var
|
|
49
|
+
setValue(next) {
|
|
50
|
+
var { type, ...config } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
154
51
|
type: "spring"
|
|
155
|
-
}, onFinish = arguments.length > 2 ? arguments[2] : void 0,
|
|
156
|
-
|
|
157
|
-
]), val = state.current.val, handleFinish = onFinish ? function(param) {
|
|
158
|
-
var finished = param.finished;
|
|
52
|
+
}, onFinish = arguments.length > 2 ? arguments[2] : void 0, val = state.current.val, handleFinish = onFinish ? function(param) {
|
|
53
|
+
var { finished } = param;
|
|
159
54
|
return finished ? onFinish() : null;
|
|
160
55
|
} : void 0;
|
|
161
56
|
if (type === "direct")
|
|
@@ -163,25 +58,27 @@ function useAnimatedNumber(initial) {
|
|
|
163
58
|
else if (type === "spring") {
|
|
164
59
|
var _state_current_composite;
|
|
165
60
|
(_state_current_composite = state.current.composite) === null || _state_current_composite === void 0 || _state_current_composite.stop();
|
|
166
|
-
var composite = Animated.spring(val,
|
|
61
|
+
var composite = Animated.spring(val, {
|
|
62
|
+
...config,
|
|
167
63
|
toValue: next,
|
|
168
64
|
useNativeDriver: !isWeb
|
|
169
|
-
})
|
|
65
|
+
});
|
|
170
66
|
composite.start(handleFinish), state.current.composite = composite;
|
|
171
67
|
} else {
|
|
172
68
|
var _state_current_composite1;
|
|
173
69
|
(_state_current_composite1 = state.current.composite) === null || _state_current_composite1 === void 0 || _state_current_composite1.stop();
|
|
174
|
-
var composite1 = Animated.timing(val,
|
|
70
|
+
var composite1 = Animated.timing(val, {
|
|
71
|
+
...config,
|
|
175
72
|
toValue: next,
|
|
176
73
|
useNativeDriver: !isWeb
|
|
177
|
-
})
|
|
74
|
+
});
|
|
178
75
|
composite1.start(handleFinish), state.current.composite = composite1;
|
|
179
76
|
}
|
|
180
77
|
}
|
|
181
78
|
};
|
|
182
79
|
}
|
|
183
80
|
function useAnimatedNumberReaction(param, onValue) {
|
|
184
|
-
var value = param
|
|
81
|
+
var { value } = param, onChange = useEvent(function(current) {
|
|
185
82
|
onValue(current.value);
|
|
186
83
|
});
|
|
187
84
|
React.useEffect(function() {
|
|
@@ -209,7 +106,7 @@ function createAnimations(animations) {
|
|
|
209
106
|
usePresence,
|
|
210
107
|
ResetPresence,
|
|
211
108
|
useAnimations: function(param) {
|
|
212
|
-
var
|
|
109
|
+
var { props, onDidAnimate, style, componentState, presence } = param, isExiting = presence?.[0] === !1, sendExitComplete = presence?.[1], animateStyles = React.useRef({}), animatedTranforms = React.useRef([]), animationsState = React.useRef(/* @__PURE__ */ new WeakMap()), animateOnly = props.animateOnly || [], hasAnimateOnly = !!props.animateOnly, args = [
|
|
213
110
|
JSON.stringify(style),
|
|
214
111
|
componentState,
|
|
215
112
|
isExiting,
|
|
@@ -219,51 +116,7 @@ function createAnimations(animations) {
|
|
|
219
116
|
return animateOnly.length ? !animatedStyleKey[key] && animateOnly.indexOf(key) === -1 : !animatedStyleKey[key];
|
|
220
117
|
});
|
|
221
118
|
}, args), res = React.useMemo(function() {
|
|
222
|
-
var
|
|
223
|
-
var isColorStyleKey = colorStyleKey[key2], _ref = _sliced_to_array(isColorStyleKey ? [
|
|
224
|
-
0,
|
|
225
|
-
void 0
|
|
226
|
-
] : getValue(valIn), 2), val2 = _ref[0], type = _ref[1], animateToValue = val2, value = animated || new Animated.Value(val2), curInterpolation = animationsState.current.get(value), interpolateArgs;
|
|
227
|
-
if (type) {
|
|
228
|
-
var _curInterpolation_current;
|
|
229
|
-
interpolateArgs = getInterpolated((_curInterpolation_current = curInterpolation == null ? void 0 : curInterpolation.current) !== null && _curInterpolation_current !== void 0 ? _curInterpolation_current : value._value, val2, type), animationsState.current.set(value, {
|
|
230
|
-
interpolation: value.interpolate(interpolateArgs),
|
|
231
|
-
current: val2
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
if (isColorStyleKey && (animateToValue = curInterpolation != null && curInterpolation.animateToValue ? 0 : 1, interpolateArgs = getColorInterpolated(
|
|
235
|
-
curInterpolation == null ? void 0 : curInterpolation.current,
|
|
236
|
-
// valIn is the next color
|
|
237
|
-
valIn,
|
|
238
|
-
animateToValue
|
|
239
|
-
), animationsState.current.set(value, {
|
|
240
|
-
current: valIn,
|
|
241
|
-
interpolation: value.interpolate(interpolateArgs),
|
|
242
|
-
animateToValue: curInterpolation != null && curInterpolation.animateToValue ? 0 : 1
|
|
243
|
-
})), value) {
|
|
244
|
-
var animationConfig = getAnimationConfig(key2, animations, props.animation), resolve, promise = new Promise(function(res2) {
|
|
245
|
-
resolve = res2;
|
|
246
|
-
});
|
|
247
|
-
completions.push(promise), runners.push(function() {
|
|
248
|
-
var getAnimation = function() {
|
|
249
|
-
return Animated[animationConfig.type || "spring"](value, _object_spread({
|
|
250
|
-
toValue: animateToValue,
|
|
251
|
-
useNativeDriver: !isWeb && !isThereNoNativeStyleKeys
|
|
252
|
-
}, animationConfig));
|
|
253
|
-
};
|
|
254
|
-
value.stopAnimation();
|
|
255
|
-
var animation = animationConfig.delay ? Animated.sequence([
|
|
256
|
-
Animated.delay(animationConfig.delay),
|
|
257
|
-
getAnimation()
|
|
258
|
-
]) : getAnimation();
|
|
259
|
-
animation.start(function(param2) {
|
|
260
|
-
var finished = param2.finished;
|
|
261
|
-
finished && resolve();
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
return process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F4A0} animate", key2, "from (".concat(value._value, ") to"), valIn, "(".concat(val2, ")"), "type", type, "interpolate", interpolateArgs), value;
|
|
266
|
-
}, runners = [], completions = [], nonAnimatedStyle = {};
|
|
119
|
+
var runners = [], completions = [], nonAnimatedStyle = {};
|
|
267
120
|
for (var key in style) {
|
|
268
121
|
var val = style[key];
|
|
269
122
|
if (animatedStyleKey[key] == null && !costlyToAnimateStyleKey[key]) {
|
|
@@ -286,10 +139,14 @@ function createAnimations(animations) {
|
|
|
286
139
|
var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
|
287
140
|
try {
|
|
288
141
|
for (var _iterator = val.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
|
|
289
|
-
var
|
|
142
|
+
var [index, transform] = _step.value, _animatedTranforms_current_index;
|
|
290
143
|
if (transform) {
|
|
291
144
|
var tkey = Object.keys(transform)[0], currentTransform = (_animatedTranforms_current_index = animatedTranforms.current[index]) === null || _animatedTranforms_current_index === void 0 ? void 0 : _animatedTranforms_current_index[tkey];
|
|
292
|
-
animatedTranforms.current[index] =
|
|
145
|
+
animatedTranforms.current[index] = {
|
|
146
|
+
[tkey]: update(tkey, currentTransform, transform[tkey])
|
|
147
|
+
}, animatedTranforms.current = [
|
|
148
|
+
...animatedTranforms.current
|
|
149
|
+
];
|
|
293
150
|
}
|
|
294
151
|
}
|
|
295
152
|
} catch (err) {
|
|
@@ -304,18 +161,21 @@ function createAnimations(animations) {
|
|
|
304
161
|
}
|
|
305
162
|
}
|
|
306
163
|
}
|
|
307
|
-
var animatedStyle =
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
164
|
+
var animatedStyle = {
|
|
165
|
+
...Object.fromEntries(Object.entries(animateStyles.current).map(function(param2) {
|
|
166
|
+
var [k, v] = param2, _animationsState_current_get;
|
|
167
|
+
return [
|
|
168
|
+
k,
|
|
169
|
+
((_animationsState_current_get = animationsState.current.get(v)) === null || _animationsState_current_get === void 0 ? void 0 : _animationsState_current_get.interpolation) || v
|
|
170
|
+
];
|
|
171
|
+
})),
|
|
314
172
|
transform: animatedTranforms.current.map(function(r) {
|
|
315
173
|
var _animationsState_current_get, key2 = Object.keys(r)[0], val2 = ((_animationsState_current_get = animationsState.current.get(r[key2])) === null || _animationsState_current_get === void 0 ? void 0 : _animationsState_current_get.interpolation) || r[key2];
|
|
316
|
-
return
|
|
174
|
+
return {
|
|
175
|
+
[key2]: val2
|
|
176
|
+
};
|
|
317
177
|
})
|
|
318
|
-
}
|
|
178
|
+
};
|
|
319
179
|
return {
|
|
320
180
|
runners,
|
|
321
181
|
completions,
|
|
@@ -324,6 +184,52 @@ function createAnimations(animations) {
|
|
|
324
184
|
animatedStyle
|
|
325
185
|
]
|
|
326
186
|
};
|
|
187
|
+
function update(key2, animated, valIn) {
|
|
188
|
+
var isColorStyleKey = colorStyleKey[key2], [val2, type] = isColorStyleKey ? [
|
|
189
|
+
0,
|
|
190
|
+
void 0
|
|
191
|
+
] : getValue(valIn), animateToValue = val2, value = animated || new Animated.Value(val2), curInterpolation = animationsState.current.get(value), interpolateArgs;
|
|
192
|
+
if (type) {
|
|
193
|
+
var _curInterpolation_current;
|
|
194
|
+
interpolateArgs = getInterpolated((_curInterpolation_current = curInterpolation?.current) !== null && _curInterpolation_current !== void 0 ? _curInterpolation_current : value._value, val2, type), animationsState.current.set(value, {
|
|
195
|
+
interpolation: value.interpolate(interpolateArgs),
|
|
196
|
+
current: val2
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (isColorStyleKey && (animateToValue = curInterpolation?.animateToValue ? 0 : 1, interpolateArgs = getColorInterpolated(
|
|
200
|
+
curInterpolation?.current,
|
|
201
|
+
// valIn is the next color
|
|
202
|
+
valIn,
|
|
203
|
+
animateToValue
|
|
204
|
+
), animationsState.current.set(value, {
|
|
205
|
+
current: valIn,
|
|
206
|
+
interpolation: value.interpolate(interpolateArgs),
|
|
207
|
+
animateToValue: curInterpolation?.animateToValue ? 0 : 1
|
|
208
|
+
})), value) {
|
|
209
|
+
var animationConfig = getAnimationConfig(key2, animations, props.animation), resolve, promise = new Promise(function(res2) {
|
|
210
|
+
resolve = res2;
|
|
211
|
+
});
|
|
212
|
+
completions.push(promise), runners.push(function() {
|
|
213
|
+
value.stopAnimation();
|
|
214
|
+
function getAnimation() {
|
|
215
|
+
return Animated[animationConfig.type || "spring"](value, {
|
|
216
|
+
toValue: animateToValue,
|
|
217
|
+
useNativeDriver: !isWeb && !isThereNoNativeStyleKeys,
|
|
218
|
+
...animationConfig
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
var animation = animationConfig.delay ? Animated.sequence([
|
|
222
|
+
Animated.delay(animationConfig.delay),
|
|
223
|
+
getAnimation()
|
|
224
|
+
]) : getAnimation();
|
|
225
|
+
animation.start(function(param2) {
|
|
226
|
+
var { finished } = param2;
|
|
227
|
+
finished && resolve();
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return process.env.NODE_ENV === "development" && props.debug === "verbose" && console.info(" \u{1F4A0} animate", key2, `from (${value._value}) to`, valIn, `(${val2})`, "type", type, "interpolate", interpolateArgs), value;
|
|
232
|
+
}
|
|
327
233
|
}, args);
|
|
328
234
|
return useIsomorphicLayoutEffect(function() {
|
|
329
235
|
res.runners.forEach(function(r) {
|
|
@@ -331,7 +237,7 @@ function createAnimations(animations) {
|
|
|
331
237
|
});
|
|
332
238
|
var cancel = !1;
|
|
333
239
|
return Promise.all(res.completions).then(function() {
|
|
334
|
-
cancel || (onDidAnimate
|
|
240
|
+
cancel || (onDidAnimate?.(), isExiting && sendExitComplete?.());
|
|
335
241
|
}), function() {
|
|
336
242
|
cancel = !0;
|
|
337
243
|
};
|
|
@@ -363,8 +269,8 @@ function getInterpolated(current, next) {
|
|
|
363
269
|
current,
|
|
364
270
|
next
|
|
365
271
|
], outputRange = [
|
|
366
|
-
|
|
367
|
-
|
|
272
|
+
`${current}${postfix}`,
|
|
273
|
+
`${next}${postfix}`
|
|
368
274
|
];
|
|
369
275
|
return next < current && (inputRange.reverse(), outputRange.reverse()), {
|
|
370
276
|
inputRange,
|
|
@@ -381,11 +287,14 @@ function getAnimationConfig(key, animations, animation) {
|
|
|
381
287
|
var _animation__key, conf = (_animation__key = (_animation_ = animation[1]) === null || _animation_ === void 0 ? void 0 : _animation_[key]) !== null && _animation__key !== void 0 ? _animation__key : (_animation_1 = animation[1]) === null || _animation_1 === void 0 ? void 0 : _animation_1[shortKey];
|
|
382
288
|
conf && (typeof conf == "string" ? type = conf : (type = conf.type || type, extraConf = conf));
|
|
383
289
|
} else {
|
|
384
|
-
var _animation_key, val = (_animation_key = animation
|
|
385
|
-
type = val
|
|
290
|
+
var _animation_key, val = (_animation_key = animation?.[key]) !== null && _animation_key !== void 0 ? _animation_key : animation?.[shortKey];
|
|
291
|
+
type = val?.type, extraConf = val;
|
|
386
292
|
}
|
|
387
293
|
var found = animations[type];
|
|
388
|
-
return
|
|
294
|
+
return {
|
|
295
|
+
...found,
|
|
296
|
+
...extraConf
|
|
297
|
+
};
|
|
389
298
|
}
|
|
390
299
|
var transformShorthands = {
|
|
391
300
|
x: "translateX",
|
|
@@ -399,7 +308,7 @@ function getValue(input) {
|
|
|
399
308
|
return [
|
|
400
309
|
input
|
|
401
310
|
];
|
|
402
|
-
var _input_match,
|
|
311
|
+
var _input_match, [_, number, after] = (_input_match = input.match(/([-0-9]+)(deg|%|px)/)) !== null && _input_match !== void 0 ? _input_match : [];
|
|
403
312
|
return [
|
|
404
313
|
+number,
|
|
405
314
|
after
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/core/animations-react-native/src/createAnimations.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAOA,WAAW;AAClB,SAASC,eAAeC,mBAAmB;AAC3C,SAASC,OAAOC,iCAAiC;AAOjD,SAASC,gBAAgB;AAEzB,SAASC,gBAAgB
|
|
5
|
-
"names": ["React", "ResetPresence", "usePresence", "isWeb", "useIsomorphicLayoutEffect", "useEvent", "Animated", "animatedStyleKey", "transform", "opacity", "colorStyleKey", "backgroundColor", "color", "borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor", "costlyToAnimateStyleKey", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "borderWidth", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth", "AnimatedView", "View", "AnimatedText", "Text", "useAnimatedNumber", "initial", "state", "useRef", "current", "composite", "val", "Value", "strategy", "type", "getInstance", "getValue", "stop", "setValue", "next", "
|
|
4
|
+
"mappings": "AAAA,OAAOA,WAAW;AAClB,SAASC,eAAeC,mBAAmB;AAC3C,SAASC,OAAOC,iCAAiC;AAOjD,SAASC,gBAAgB;AAEzB,SAASC,gBAAgB;AAwBzB,IAAMC,mBAAmB;EACvBC,WAAW;EACXC,SAAS;AACX,GAEMC,gBAAgB;EACpBC,iBAAiB;EACjBC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,kBAAkB;EAClBC,gBAAgB;EAChBC,mBAAmB;AACrB,GAGMC,0BAA0B;EAC9BC,cAAc;EACdC,qBAAqB;EACrBC,sBAAsB;EACtBC,wBAAwB;EACxBC,yBAAyB;EACzBC,aAAa;EACbC,iBAAiB;EACjBC,kBAAkB;EAClBC,gBAAgB;EAChBC,mBAAmB;EACnB,GAAGlB;AAEL,GAEamB,eAAevB,SAASwB,MACxBC,eAAezB,SAAS0B;AAE9B,SAASC,kBACdC,SAAe;AAEf,MAAMC,QAAQnC,MAAMoC,OAClB,IAAA;AAMF,SAAKD,MAAME,YACTF,MAAME,UAAU;IACdC,WAAW;IACXC,KAAK,IAAIjC,SAASkC,MAAMN,OAAAA;IACxBO,UAAU;MAAEC,MAAM;IAAS;EAC7B,IAGK;IACLC,cAAAA;AACE,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,QAAnBoC,oBAAAA,SAAAA,mBAAuBA,eAAAA,UAAU,CAAA,OAAE,QAAZA,iBAAAA,SAAAA,SAAAA,aAAe0B,QAAAA;AACnD,IAAII,SACE,OAAOA,QAAS,WAClBrH,OAAOqH,QAEPrH,OAAQqH,KAAarH,QAAQA,MAC7BgH,YAAYK;EAGlB,OAAO;QACO9B,gBAAN1F,OAAM0F,iBAAAA,YAAYpC,GAAAA,OAAI,QAAhBoC,mBAAAA,SAAAA,iBAAoBA,YAAY0B,QAAAA;AAC5CjH,WAAOH,KAAKG,MACZgH,YAAYnH;EACd;AACA,MAAMyH,QAAQ3F,WAAW3B,IAAAA;AACzB,SAAO;IACL,GAAGsH;IACH,GAAGN;EACL;AACF;AAGA,IAAME,sBAAsB;EAC1BK,GAAG;EACHC,GAAG;EACHC,YAAY;EACZC,YAAY;AACd;AAEA,SAASxH,SAASyH,OAAsB;MAAEC,UAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAU;AAClD,MAAI,OAAOD,SAAU;AACnB,WAAO;MAACA;;MAEiBA,cAArB,CAACE,GAAGC,QAAQC,KAAAA,KAASJ,eAAAA,MAAMK,MAAM,qBAAA,OAAA,QAAZL,iBAAAA,SAAAA,eAAsC,CAAA;AACjE,SAAO;IAAC,CAACG;IAAQC;;AACnB;",
|
|
5
|
+
"names": ["React", "ResetPresence", "usePresence", "isWeb", "useIsomorphicLayoutEffect", "useEvent", "Animated", "animatedStyleKey", "transform", "opacity", "colorStyleKey", "backgroundColor", "color", "borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor", "costlyToAnimateStyleKey", "borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "borderWidth", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth", "AnimatedView", "View", "AnimatedText", "Text", "useAnimatedNumber", "initial", "state", "useRef", "current", "composite", "val", "Value", "strategy", "type", "getInstance", "getValue", "stop", "setValue", "next", "config", "onFinish", "handleFinish", "finished", "undefined", "spring", "toValue", "useNativeDriver", "start", "timing", "useAnimatedNumberReaction", "onValue", "value", "onChange", "useEffect", "id", "addListener", "removeListener", "useAnimatedNumberStyle", "getStyle", "createAnimations", "animations", "isReactNative", "useAnimations", "props", "onDidAnimate", "style", "componentState", "presence", "isExiting", "sendExitComplete", "animateStyles", "animatedTranforms", "animationsState", "WeakMap", "animateOnly", "hasAnimateOnly", "args", "JSON", "stringify", "isThereNoNativeStyleKeys", "useMemo", "Object", "keys", "some", "key", "length", "indexOf", "res", "runners", "completions", "nonAnimatedStyle", "includes", "update", "console", "warn", "entries", "index", "tkey", "currentTransform", "animatedStyle", "fromEntries", "map", "param", "k", "v", "get", "interpolation", "r", "animated", "valIn", "isColorStyleKey", "animateToValue", "curInterpolation", "interpolateArgs", "getInterpolated", "set", "interpolate", "getColorInterpolated", "animationConfig", "getAnimationConfig", "animation", "resolve", "promise", "Promise", "push", "stopAnimation", "getAnimation", "delay", "sequence", "process", "env", "NODE_ENV", "info", "forEach", "cancel", "all", "then", "response", "inputStyle", "currentColor", "nextColor", "inputRange", "outputRange", "reverse", "postfix", "extraConf", "shortKey", "transformShorthands", "Array", "isArray", "conf", "found", "x", "y", "translateX", "translateY", "input", "isColor", "_", "number", "after", "match"]
|
|
6
6
|
}
|