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