@hanzogui/animations-reanimated 7.3.1 → 8.0.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.
@@ -42,6 +42,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
42
42
  var import_animation_helpers = require("@hanzogui/animation-helpers");
43
43
  var import_core = require("@hanzogui/core");
44
44
  var import_use_presence = require("@hanzogui/use-presence");
45
+ var import_normalize_colors = __toESM(require("@react-native/normalize-colors"), 1);
45
46
  var import_react = __toESM(require("react"), 1);
46
47
  var import_react_native_reanimated = __toESM(require("react-native-reanimated"), 1);
47
48
  function _type_of(obj) {
@@ -57,6 +58,16 @@ var getDefaultExport = function (module2) {
57
58
  return mod;
58
59
  };
59
60
  var Animated = getDefaultExport(import_react_native_reanimated.default);
61
+ var silenceAnimatedComponentDevCheck = function (style) {
62
+ if (process.env.NODE_ENV !== "development" || import_core.isWeb || !style || (typeof style === "undefined" ? "undefined" : _type_of(style)) !== "object") {
63
+ return;
64
+ }
65
+ Object.defineProperty(style, "_requiresAnimatedComponent", {
66
+ configurable: true,
67
+ enumerable: false,
68
+ value: true
69
+ });
70
+ };
60
71
  var resolveDynamicValue = function (value, isDark) {
61
72
  if (value !== null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "dynamic" in value && _type_of(value.dynamic) === "object") {
62
73
  var dynamic = value.dynamic;
@@ -64,21 +75,372 @@ var resolveDynamicValue = function (value, isDark) {
64
75
  }
65
76
  return value;
66
77
  };
67
- var applyAnimation = function (targetValue, config, callback) {
78
+ var updateMapperState = import_core.isWeb ? function (state, emitted) {
79
+ state.value.emitted = emitted;
80
+ } : function (state, emitted) {
81
+ "worklet";
82
+
83
+ if (!globalThis._WORKLET) return;
84
+ state.modify(function (current) {
85
+ current.emitted = emitted;
86
+ return current;
87
+ }, false);
88
+ };
89
+ var cloneAnimationValue = function (value) {
90
+ if (Array.isArray(value)) {
91
+ return value.map(cloneAnimationValue);
92
+ }
93
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
94
+ var next = {};
95
+ for (var key in value) {
96
+ next[key] = cloneAnimationValue(value[key]);
97
+ }
98
+ return next;
99
+ }
100
+ return value;
101
+ };
102
+ var cloneStyleRecord = function (style) {
103
+ var next = {};
104
+ for (var key in style) {
105
+ next[key] = cloneAnimationValue(style[key]);
106
+ }
107
+ return next;
108
+ };
109
+ var cloneTransitionConfig = function (config) {
110
+ return cloneAnimationValue(config);
111
+ };
112
+ var getAnimatedTransforms = function (value) {
113
+ if (!Array.isArray(value)) return [];
114
+ return value.filter(function (item) {
115
+ return item !== null && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
116
+ });
117
+ };
118
+ var getRemovedAnimatedKeys = function (current, previous) {
119
+ var removedKeys = {};
120
+ var _iteratorNormalCompletion = true,
121
+ _didIteratorError = false,
122
+ _iteratorError = void 0;
123
+ try {
124
+ for (var _iterator = previous[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
125
+ var key = _step.value;
126
+ if (!current.has(key)) removedKeys[key] = true;
127
+ }
128
+ } catch (err) {
129
+ _didIteratorError = true;
130
+ _iteratorError = err;
131
+ } finally {
132
+ try {
133
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
134
+ _iterator.return();
135
+ }
136
+ } finally {
137
+ if (_didIteratorError) {
138
+ throw _iteratorError;
139
+ }
140
+ }
141
+ }
142
+ return removedKeys;
143
+ };
144
+ var getImplicitDefault = function (key, targetValue) {
145
+ "worklet";
146
+
147
+ var value = key === "opacity" || key === "scale" || key === "scaleX" || key === "scaleY" ? 1 : 0;
148
+ if (typeof targetValue !== "string") return value;
149
+ var suffixIndex = 0;
150
+ while (suffixIndex < targetValue.length) {
151
+ var character = targetValue[suffixIndex];
152
+ var code = character.charCodeAt(0);
153
+ if (code >= 48 && code <= 57 || character === "." || character === "-" || character === "+") {
154
+ suffixIndex++;
155
+ } else {
156
+ break;
157
+ }
158
+ }
159
+ return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
160
+ };
161
+ var COLOR_STYLE_KEYS = {
162
+ backgroundColor: true,
163
+ borderColor: true,
164
+ borderLeftColor: true,
165
+ borderRightColor: true,
166
+ borderTopColor: true,
167
+ borderBottomColor: true,
168
+ color: true
169
+ };
170
+ var toReanimatedColor = function (value) {
171
+ "worklet";
172
+
173
+ if (typeof value === "number") {
174
+ var color = value >>> 0;
175
+ var alpha = (color >>> 24 & 255) / 255;
176
+ var red = color >>> 16 & 255;
177
+ var green = color >>> 8 & 255;
178
+ var blue = color & 255;
179
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
180
+ }
181
+ if (typeof value !== "string") return value;
182
+ var trimmed = value.trim();
183
+ if (trimmed === "transparent") return "rgba(0, 0, 0, 0)";
184
+ return trimmed;
185
+ };
186
+ var isReanimatedColorHistory = function (value) {
187
+ "worklet";
188
+
189
+ var normalized = toReanimatedColor(value);
190
+ return typeof normalized === "string" && normalized.startsWith("rgba(");
191
+ };
192
+ var normalizeAnimationColor = function (value) {
193
+ if (typeof value === "number") {
194
+ return toReanimatedColor(value);
195
+ }
196
+ if (typeof value !== "string") return;
197
+ var color = (0, import_normalize_colors.default)(value);
198
+ if (color == null) return;
199
+ var red = Math.round((color & 4278190080) >>> 24);
200
+ var green = Math.round((color & 16711680) >>> 16);
201
+ var blue = Math.round((color & 65280) >>> 8);
202
+ var alpha = (color & 255) / 255;
203
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
204
+ };
205
+ var buildSnapshot = function (animated, statics, transforms, previousKeys, lastPainted) {
206
+ var snapshotAnimated = {};
207
+ var snapshotStatics = cloneStyleRecord(statics);
208
+ for (var key in snapshotStatics) {
209
+ if (!COLOR_STYLE_KEYS[key]) continue;
210
+ var normalized = normalizeAnimationColor(snapshotStatics[key]);
211
+ if (normalized !== void 0) snapshotStatics[key] = normalized;
212
+ }
213
+ for (var key1 in animated) {
214
+ if (key1 === "transform") continue;
215
+ var value = animated[key1];
216
+ if (COLOR_STYLE_KEYS[key1]) {
217
+ var normalized1 = normalizeAnimationColor(value);
218
+ if (normalized1 === void 0) {
219
+ snapshotStatics[key1] = cloneAnimationValue(value);
220
+ continue;
221
+ }
222
+ snapshotAnimated[key1] = normalized1;
223
+ } else {
224
+ snapshotAnimated[key1] = cloneAnimationValue(value);
225
+ }
226
+ }
227
+ var snapshotTransforms = transforms.map(cloneStyleRecord);
228
+ var keys = new Set(Object.keys(snapshotAnimated));
229
+ var _iteratorNormalCompletion = true,
230
+ _didIteratorError = false,
231
+ _iteratorError = void 0;
232
+ try {
233
+ for (var _iterator = snapshotTransforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
234
+ var transform = _step.value;
235
+ var key2 = Object.keys(transform)[0];
236
+ var value1 = key2 ? transform[key2] : void 0;
237
+ if (key2 && (typeof value1 === "number" || typeof value1 === "string")) {
238
+ keys.add(`transform:${key2}`);
239
+ }
240
+ }
241
+ } catch (err) {
242
+ _didIteratorError = true;
243
+ _iteratorError = err;
244
+ } finally {
245
+ try {
246
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
247
+ _iterator.return();
248
+ }
249
+ } finally {
250
+ if (_didIteratorError) {
251
+ throw _iteratorError;
252
+ }
253
+ }
254
+ }
255
+ var seeds = {};
256
+ var _iteratorNormalCompletion1 = true,
257
+ _didIteratorError1 = false,
258
+ _iteratorError1 = void 0;
259
+ try {
260
+ for (var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
261
+ var key3 = _step1.value;
262
+ var value2 = lastPainted[key3];
263
+ if (typeof value2 !== "number" && typeof value2 !== "string") continue;
264
+ if (value2 === "auto" || typeof value2 === "string" && value2.startsWith("calc")) {
265
+ continue;
266
+ }
267
+ if (COLOR_STYLE_KEYS[key3]) value2 = normalizeAnimationColor(value2);
268
+ if (value2 !== void 0) seeds[key3] = value2;
269
+ }
270
+ } catch (err) {
271
+ _didIteratorError1 = true;
272
+ _iteratorError1 = err;
273
+ } finally {
274
+ try {
275
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
276
+ _iterator1.return();
277
+ }
278
+ } finally {
279
+ if (_didIteratorError1) {
280
+ throw _iteratorError1;
281
+ }
282
+ }
283
+ }
284
+ var gatedKeys = {};
285
+ var _iteratorNormalCompletion2 = true,
286
+ _didIteratorError2 = false,
287
+ _iteratorError2 = void 0;
288
+ try {
289
+ for (var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
290
+ var key4 = _step2.value;
291
+ gatedKeys[key4] = true;
292
+ }
293
+ } catch (err) {
294
+ _didIteratorError2 = true;
295
+ _iteratorError2 = err;
296
+ } finally {
297
+ try {
298
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
299
+ _iterator2.return();
300
+ }
301
+ } finally {
302
+ if (_didIteratorError2) {
303
+ throw _iteratorError2;
304
+ }
305
+ }
306
+ }
307
+ var removedKeys = getRemovedAnimatedKeys(keys, previousKeys);
308
+ var painted = {
309
+ ...snapshotStatics,
310
+ ...snapshotAnimated
311
+ };
312
+ var staticTransforms = getAnimatedTransforms(snapshotStatics.transform);
313
+ delete painted.transform;
314
+ var _iteratorNormalCompletion3 = true,
315
+ _didIteratorError3 = false,
316
+ _iteratorError3 = void 0;
317
+ try {
318
+ for (var _iterator3 = staticTransforms[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
319
+ var transform1 = _step3.value;
320
+ var key5 = Object.keys(transform1)[0];
321
+ if (key5) painted[`transform:${key5}`] = transform1[key5];
322
+ }
323
+ } catch (err) {
324
+ _didIteratorError3 = true;
325
+ _iteratorError3 = err;
326
+ } finally {
327
+ try {
328
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
329
+ _iterator3.return();
330
+ }
331
+ } finally {
332
+ if (_didIteratorError3) {
333
+ throw _iteratorError3;
334
+ }
335
+ }
336
+ }
337
+ var _iteratorNormalCompletion4 = true,
338
+ _didIteratorError4 = false,
339
+ _iteratorError4 = void 0;
340
+ try {
341
+ for (var _iterator4 = snapshotTransforms[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
342
+ var transform2 = _step4.value;
343
+ var key6 = Object.keys(transform2)[0];
344
+ if (key6) painted[`transform:${key6}`] = transform2[key6];
345
+ }
346
+ } catch (err) {
347
+ _didIteratorError4 = true;
348
+ _iteratorError4 = err;
349
+ } finally {
350
+ try {
351
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
352
+ _iterator4.return();
353
+ }
354
+ } finally {
355
+ if (_didIteratorError4) {
356
+ throw _iteratorError4;
357
+ }
358
+ }
359
+ }
360
+ return {
361
+ value: {
362
+ animated: snapshotAnimated,
363
+ statics: snapshotStatics,
364
+ transforms: snapshotTransforms,
365
+ gatedKeys,
366
+ seeds,
367
+ removedKeys,
368
+ removeTransform: Object.keys(removedKeys).some(function (key7) {
369
+ return key7.startsWith("transform:");
370
+ }),
371
+ clearValue: import_core.isWeb ? "" : null
372
+ },
373
+ painted,
374
+ keys
375
+ };
376
+ };
377
+ var getGatedKeys = function (snapshot) {
378
+ return Object.keys(snapshot.gatedKeys);
379
+ };
380
+ var createReanimatedConfig = function (config) {
381
+ "worklet";
382
+
383
+ var next = {};
384
+ var source = config;
385
+ for (var key in source) {
386
+ if (key === "type" || key === "delay") continue;
387
+ var value = source[key];
388
+ if (value !== void 0) {
389
+ next[key] = value;
390
+ }
391
+ }
392
+ return next;
393
+ };
394
+ var applyAnimation = function (targetValue, config, callback, seedValue) {
68
395
  "worklet";
69
396
 
397
+ var validateStartAsColor = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
70
398
  var delay = config.delay;
399
+ var reanimatedConfig = createReanimatedConfig(config);
71
400
  var animatedValue;
72
401
  if (config.type === "timing") {
73
- animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, config, callback);
402
+ animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, reanimatedConfig, callback);
74
403
  } else {
75
- animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, config, callback);
404
+ animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, reanimatedConfig, callback);
405
+ }
406
+ if (seedValue !== void 0 || validateStartAsColor) {
407
+ var innerOnStart = animatedValue.onStart;
408
+ animatedValue.onStart = function (animation, value, timestamp, previousAnimation) {
409
+ "worklet";
410
+
411
+ var startValue = validateStartAsColor ? isReanimatedColorHistory(value) ? toReanimatedColor(value) : seedValue !== null && seedValue !== void 0 ? seedValue : targetValue : seedValue;
412
+ innerOnStart(animation, startValue, timestamp, previousAnimation);
413
+ };
76
414
  }
77
415
  if (delay && delay > 0) {
78
416
  animatedValue = (0, import_react_native_reanimated.withDelay)(delay, animatedValue);
79
417
  }
80
418
  return animatedValue;
81
419
  };
420
+ var animateSnapshotValue = function (key, implicitKey, targetValue, config, previouslyEmitted, seedValue, gated, currentlyExiting, exitCycleId, currentlyCompletingAnimation, didAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone) {
421
+ "worklet";
422
+
423
+ var validateStartAsColor = arguments.length > 13 && arguments[13] !== void 0 ? arguments[13] : false;
424
+ var cycleGated = gated && (currentlyExiting || currentlyCompletingAnimation);
425
+ if (!previouslyEmitted && seedValue === void 0 && !cycleGated) {
426
+ return targetValue;
427
+ }
428
+ var callback;
429
+ if (gated && currentlyExiting) {
430
+ callback = function (finished) {
431
+ "worklet";
432
+
433
+ (0, import_react_native_reanimated.runOnJS)(markExitKeyDone)(key, exitCycleId, finished !== null && finished !== void 0 ? finished : false);
434
+ };
435
+ } else if (gated && currentlyCompletingAnimation) {
436
+ callback = function (finished) {
437
+ "worklet";
438
+
439
+ (0, import_react_native_reanimated.runOnJS)(markDidAnimateKeyDone)(key, didAnimateCycleId, finished !== null && finished !== void 0 ? finished : false);
440
+ };
441
+ }
442
+ return applyAnimation(targetValue, config, callback, previouslyEmitted ? void 0 : seedValue !== null && seedValue !== void 0 ? seedValue : getImplicitDefault(implicitKey, targetValue), validateStartAsColor);
443
+ };
82
444
  var ANIMATABLE_PROPERTIES = {
83
445
  // Transform
84
446
  transform: true,
@@ -153,6 +515,23 @@ var canAnimateProperty = function (key, value, animateOnly) {
153
515
  if (animateOnly && !animateOnly.includes(key)) return false;
154
516
  return true;
155
517
  };
518
+ var splitAnimationStyles = function (style, isDark, disableAnimation, animateOnly) {
519
+ var animated = {};
520
+ var statics = {};
521
+ for (var key in style) {
522
+ var value = resolveDynamicValue(style[key], isDark);
523
+ if (value === void 0) continue;
524
+ if (!disableAnimation && canAnimateProperty(key, value, animateOnly)) {
525
+ animated[key] = cloneAnimationValue(value);
526
+ } else {
527
+ statics[key] = cloneAnimationValue(value);
528
+ }
529
+ }
530
+ return {
531
+ animated,
532
+ statics
533
+ };
534
+ };
156
535
  function createWebAnimatedComponent(defaultTag) {
157
536
  var isText = defaultTag === "span";
158
537
  var Component = Animated.createAnimatedComponent(/* @__PURE__ */(0, import_react.forwardRef)(function (propsIn, ref) {
@@ -195,27 +574,27 @@ function buildTransitionConfig(transition, animations, animationState, styleKeys
195
574
  var normalized = (0, import_animation_helpers.normalizeTransition)(transition);
196
575
  var effectiveKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
197
576
  var _animations_effectiveKey;
198
- var base = effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : {
577
+ var base = cloneTransitionConfig(effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : {
199
578
  type: "spring"
200
579
  } : {
201
580
  type: "spring"
202
- };
581
+ });
203
582
  if (normalized.delay) {
204
- base = {
583
+ base = cloneTransitionConfig({
205
584
  ...base,
206
585
  delay: normalized.delay
207
- };
586
+ });
208
587
  }
209
588
  if (normalized.config) {
210
- base = {
589
+ base = cloneTransitionConfig({
211
590
  ...base,
212
591
  ...normalized.config
213
- };
592
+ });
214
593
  if (base.type !== "timing" && normalized.config.duration !== void 0 && normalized.config.damping === void 0 && normalized.config.stiffness === void 0 && normalized.config.mass === void 0) {
215
- base = {
594
+ base = cloneTransitionConfig({
216
595
  ...base,
217
596
  type: "timing"
218
- };
597
+ });
219
598
  }
220
599
  }
221
600
  var propertyConfigs = {};
@@ -228,17 +607,17 @@ function buildTransitionConfig(transition, animations, animationState, styleKeys
228
607
  var propAnimation = normalized.properties[key];
229
608
  if (typeof propAnimation === "string") {
230
609
  var _animations_propAnimation;
231
- propertyConfigs[key] = (_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base;
610
+ propertyConfigs[key] = cloneTransitionConfig((_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base);
232
611
  } else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object") {
233
612
  var configType = propAnimation.type;
234
613
  var _animations_configType;
235
614
  var baseForProp = configType ? (_animations_configType = animations[configType]) !== null && _animations_configType !== void 0 ? _animations_configType : base : base;
236
- propertyConfigs[key] = {
615
+ propertyConfigs[key] = cloneTransitionConfig({
237
616
  ...baseForProp,
238
617
  ...propAnimation
239
- };
618
+ });
240
619
  } else {
241
- propertyConfigs[key] = base;
620
+ propertyConfigs[key] = cloneTransitionConfig(base);
242
621
  }
243
622
  }
244
623
  } catch (err) {
@@ -293,10 +672,10 @@ function getStyleKeys(style) {
293
672
  function createAnimations(animationsConfig) {
294
673
  var animations = {};
295
674
  for (var key in animationsConfig) {
296
- animations[key] = {
675
+ animations[key] = cloneTransitionConfig({
297
676
  type: "spring",
298
677
  ...animationsConfig[key]
299
- };
678
+ });
300
679
  }
301
680
  return {
302
681
  needsCustomComponent: true,
@@ -335,19 +714,22 @@ function createAnimations(animationsConfig) {
335
714
  sharedValue.value = next;
336
715
  onFinish === null || onFinish === void 0 ? void 0 : onFinish();
337
716
  } else {
338
- var cb = onFinish ? function () {
717
+ var cb = onFinish ? function (finished) {
339
718
  "worklet";
340
719
 
341
- (0, import_react_native_reanimated.runOnJS)(onFinish)();
720
+ if (finished !== false) {
721
+ (0, import_react_native_reanimated.runOnJS)(onFinish)();
722
+ }
342
723
  } : void 0;
724
+ var animationConfig = cloneTransitionConfig(config);
343
725
  if (import_core.isWeb) {
344
- sharedValue.value = config.type === "spring" ? (0, import_react_native_reanimated.withSpring)(next, config, cb) : (0, import_react_native_reanimated.withTiming)(next, config, cb);
726
+ sharedValue.value = applyAnimation(next, animationConfig, cb);
345
727
  } else {
346
- (0, import_react_native_reanimated.runOnUI)(function () {
728
+ (0, import_react_native_reanimated.runOnUI)(function (targetValue, animationConfig2) {
347
729
  "worklet";
348
730
 
349
- sharedValue.value = config.type === "spring" ? (0, import_react_native_reanimated.withSpring)(next, config, cb) : (0, import_react_native_reanimated.withTiming)(next, config, cb);
350
- })();
731
+ sharedValue.value = applyAnimation(targetValue, animationConfig2, cb);
732
+ })(next, animationConfig);
351
733
  }
352
734
  }
353
735
  },
@@ -390,17 +772,19 @@ function createAnimations(animationsConfig) {
390
772
 
391
773
  return getStyle(instance.value);
392
774
  });
393
- return (0, import_react_native_reanimated.useAnimatedStyle)(function () {
775
+ var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function () {
394
776
  "worklet";
395
777
 
396
778
  return styleVal.value;
397
779
  });
780
+ silenceAnimatedComponentDevCheck(animatedStyle);
781
+ return animatedStyle;
398
782
  },
399
783
  useAnimatedNumbersStyle(vals, getStyle) {
400
784
  var instances = vals.map(function (v) {
401
785
  return v.getInstance();
402
786
  });
403
- return (0, import_react_native_reanimated.useAnimatedStyle)(function () {
787
+ var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function () {
404
788
  "worklet";
405
789
 
406
790
  var currentValues = instances.map(function (inst) {
@@ -408,6 +792,8 @@ function createAnimations(animationsConfig) {
408
792
  });
409
793
  return getStyle(...currentValues);
410
794
  }, import_core.isWeb ? [getStyle, ...instances] : void 0);
795
+ silenceAnimatedComponentDevCheck(animatedStyle);
796
+ return animatedStyle;
411
797
  },
412
798
  // =========================================================================
413
799
  // useAnimations - Main animation hook for components
@@ -421,7 +807,8 @@ function createAnimations(animationsConfig) {
421
807
  useStyleEmitter,
422
808
  themeName,
423
809
  stateRef,
424
- styleState
810
+ styleState,
811
+ onDidAnimate
425
812
  } = animationProps;
426
813
  var isHydrating = componentState.unmounted === true;
427
814
  var isMounting = componentState.unmounted === "should-enter";
@@ -440,16 +827,36 @@ function createAnimations(animationsConfig) {
440
827
  var disableAnimation = isHydrating || !animationKey;
441
828
  var isDark = (themeName === null || themeName === void 0 ? void 0 : themeName.startsWith("dark")) || false;
442
829
  var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];
830
+ var onDidAnimateRef = (0, import_react.useRef)(onDidAnimate);
831
+ (0, import_core.useIsomorphicLayoutEffect)(function () {
832
+ onDidAnimateRef.current = onDidAnimate;
833
+ }, [onDidAnimate]);
834
+ var didAnimateCycleIdRef = (0, import_react.useRef)(0);
835
+ var pendingDidAnimateKeysRef = (0, import_react.useRef)(/* @__PURE__ */new Set());
836
+ var didAnimateCompletedRef = (0, import_react.useRef)(false);
837
+ var isCompletingAnimationRef = (0, import_react_native_reanimated.useSharedValue)(false);
838
+ var didAnimateCycleIdShared = (0, import_react_native_reanimated.useSharedValue)(0);
839
+ var markDidAnimateKeyDone = (0, import_core.useEvent)(function (key2, cycleId, finished) {
840
+ if (!finished || cycleId !== didAnimateCycleIdRef.current) return;
841
+ if (didAnimateCompletedRef.current) return;
842
+ pendingDidAnimateKeysRef.current.delete(key2);
843
+ if (pendingDidAnimateKeysRef.current.size === 0) {
844
+ var _onDidAnimateRef_current;
845
+ didAnimateCompletedRef.current = true;
846
+ isCompletingAnimationRef.value = false;
847
+ (_onDidAnimateRef_current = onDidAnimateRef.current) === null || _onDidAnimateRef_current === void 0 ? void 0 : _onDidAnimateRef_current.call(onDidAnimateRef);
848
+ }
849
+ });
443
850
  var exitCycleIdRef = (0, import_react.useRef)(0);
444
851
  var pendingExitKeysRef = (0, import_react.useRef)(/* @__PURE__ */new Set());
445
852
  var exitCompletedRef = (0, import_react.useRef)(false);
446
853
  var wasExitingRef = (0, import_react.useRef)(false);
447
854
  var justStartedExiting = isExiting && !wasExitingRef.current;
448
855
  var justStoppedExiting = !isExiting && wasExitingRef.current;
449
- var markExitKeyDone = (0, import_core.useEvent)(function (key3, cycleId, finished) {
856
+ var markExitKeyDone = (0, import_core.useEvent)(function (key2, cycleId, finished) {
450
857
  if (cycleId !== exitCycleIdRef.current) return;
451
858
  if (exitCompletedRef.current) return;
452
- pendingExitKeysRef.current.delete(key3);
859
+ pendingExitKeysRef.current.delete(key2);
453
860
  if (pendingExitKeysRef.current.size === 0) {
454
861
  exitCompletedRef.current = true;
455
862
  sendExitComplete === null || sendExitComplete === void 0 ? void 0 : sendExitComplete();
@@ -461,6 +868,9 @@ function createAnimations(animationsConfig) {
461
868
  exitCycleIdRef.current++;
462
869
  exitCompletedRef.current = false;
463
870
  pendingExitKeysRef.current.clear();
871
+ didAnimateCycleIdRef.current++;
872
+ pendingDidAnimateKeysRef.current.clear();
873
+ didAnimateCompletedRef.current = true;
464
874
  }
465
875
  if (justStoppedExiting) {
466
876
  exitCycleIdRef.current++;
@@ -469,44 +879,89 @@ function createAnimations(animationsConfig) {
469
879
  (0, import_core.useIsomorphicLayoutEffect)(function () {
470
880
  isExitingRef.value = isExiting;
471
881
  exitCycleIdShared.value = exitCycleIdRef.current;
472
- }, [isExiting, exitCycleIdRef.current]);
882
+ if (justStartedExiting) {
883
+ isCompletingAnimationRef.value = false;
884
+ didAnimateCycleIdShared.value = didAnimateCycleIdRef.current;
885
+ }
886
+ }, [isExiting, exitCycleIdRef.current, justStartedExiting]);
473
887
  import_react.default.useEffect(function () {
474
888
  wasExitingRef.current = isExiting;
475
889
  });
476
- var animatedTargetsRef = (0, import_react_native_reanimated.useSharedValue)(null);
477
- var staticTargetsRef = (0, import_react_native_reanimated.useSharedValue)(null);
478
- var transformTargetsRef = (0, import_react_native_reanimated.useSharedValue)(null);
890
+ var committedRenderKeysRef = (0, import_react.useRef)(/* @__PURE__ */new Set());
891
+ var lastPaintedRef = (0, import_react.useRef)({});
892
+ var carryRef = (0, import_react.useRef)({});
479
893
  var {
480
894
  animatedStyles,
481
- staticStyles
895
+ staticStyles,
896
+ nextCarry
482
897
  } = (0, import_react.useMemo)(function () {
483
- var animated = {};
484
- var staticStyles2 = {};
485
- var animateOnly2 = props.animateOnly;
486
- for (var key3 in style) {
487
- var rawValue = style[key3];
488
- var value = resolveDynamicValue(rawValue, isDark);
489
- if (value === void 0) continue;
490
- if (disableAnimation) {
491
- staticStyles2[key3] = value;
492
- continue;
493
- }
494
- if (canAnimateProperty(key3, value, animateOnly2)) {
495
- animated[key3] = value;
496
- } else {
497
- staticStyles2[key3] = value;
498
- }
898
+ var animateOnly = props.animateOnly;
899
+ var {
900
+ animated,
901
+ statics
902
+ } = splitAnimationStyles(style, isDark, disableAnimation, animateOnly);
903
+ var nextCarry2 = cloneStyleRecord(carryRef.current);
904
+ for (var key2 in nextCarry2) {
905
+ if (!(key2 in animated)) delete nextCarry2[key2];
499
906
  }
500
- if (isMounting) {
501
- for (var key1 in animated) {
502
- staticStyles2[key1] = animated[key1];
907
+ for (var key1 in animated) {
908
+ if (!(key1 in nextCarry2)) {
909
+ nextCarry2[key1] = cloneAnimationValue(animated[key1]);
503
910
  }
911
+ statics[key1] = nextCarry2[key1];
504
912
  }
505
913
  return {
506
914
  animatedStyles: animated,
507
- staticStyles: staticStyles2
915
+ staticStyles: statics,
916
+ nextCarry: nextCarry2
508
917
  };
509
- }, [disableAnimation, style, isDark, isMounting, props.animateOnly]);
918
+ }, [disableAnimation, style, isDark, props.animateOnly]);
919
+ var renderSnapshot = (0, import_react.useMemo)(function () {
920
+ return buildSnapshot(animatedStyles, staticStyles, getAnimatedTransforms(animatedStyles.transform), committedRenderKeysRef.current, lastPaintedRef.current);
921
+ }, [animatedStyles, staticStyles]);
922
+ var renderSnapshotRef = (0, import_react_native_reanimated.useSharedValue)({
923
+ animated: {},
924
+ statics: {},
925
+ transforms: [],
926
+ gatedKeys: {},
927
+ seeds: {},
928
+ removedKeys: {},
929
+ removeTransform: false,
930
+ clearValue: import_core.isWeb ? "" : null
931
+ });
932
+ var emitterSnapshotRef = (0, import_react_native_reanimated.useSharedValue)(null);
933
+ var emitterKeysRef = (0, import_react.useRef)(null);
934
+ (0, import_core.useIsomorphicLayoutEffect)(function () {
935
+ carryRef.current = nextCarry;
936
+ committedRenderKeysRef.current = renderSnapshot.keys;
937
+ lastPaintedRef.current = renderSnapshot.painted;
938
+ }, [nextCarry, renderSnapshot]);
939
+ var pseudoActiveRef = (0, import_react.useRef)(false);
940
+ var isExitingJSRef = (0, import_react.useRef)(false);
941
+ isExitingJSRef.current = isExiting;
942
+ var publishedSnapshotRef = (0, import_react.useRef)(null);
943
+ (0, import_core.useIsomorphicLayoutEffect)(function () {
944
+ var droppingLatch = (isExiting || !pseudoActiveRef.current) && emitterSnapshotRef.value !== null;
945
+ var emitterKeys = droppingLatch ? emitterKeysRef.current : null;
946
+ if (droppingLatch || publishedSnapshotRef.current !== renderSnapshot.value) {
947
+ var removedKeys = emitterKeys ? {
948
+ ...renderSnapshot.value.removedKeys,
949
+ ...getRemovedAnimatedKeys(renderSnapshot.keys, emitterKeys)
950
+ } : renderSnapshot.value.removedKeys;
951
+ renderSnapshotRef.value = {
952
+ ...renderSnapshot.value,
953
+ removedKeys,
954
+ removeTransform: Object.keys(removedKeys).some(function (key2) {
955
+ return key2.startsWith("transform:");
956
+ })
957
+ };
958
+ publishedSnapshotRef.current = renderSnapshot.value;
959
+ }
960
+ if (droppingLatch) {
961
+ emitterSnapshotRef.value = null;
962
+ emitterKeysRef.current = null;
963
+ }
964
+ });
510
965
  var {
511
966
  baseConfig,
512
967
  propertyConfigs
@@ -520,8 +975,8 @@ function createAnimations(animationsConfig) {
520
975
  propertyConfigs: {}
521
976
  };
522
977
  }
523
- return buildTransitionConfig(props.transition, animations, animationState, getStyleKeys(animatedStyles));
524
- }, [isHydrating, props.transition, animatedStyles, animationState]);
978
+ return buildTransitionConfig(effectiveTransition, animations, animationState, getStyleKeys(animatedStyles));
979
+ }, [isHydrating, effectiveTransition, animatedStyles, animationState]);
525
980
  var configRef = (0, import_react_native_reanimated.useSharedValue)({
526
981
  baseConfig,
527
982
  propertyConfigs,
@@ -529,130 +984,76 @@ function createAnimations(animationsConfig) {
529
984
  isHydrating
530
985
  });
531
986
  (0, import_core.useIsomorphicLayoutEffect)(function () {
532
- configRef.set({
987
+ configRef.value = {
533
988
  baseConfig,
534
989
  propertyConfigs,
535
990
  disableAnimation,
536
991
  isHydrating
537
- });
992
+ };
538
993
  }, [baseConfig, propertyConfigs, disableAnimation, isHydrating]);
539
- useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function (nextStyle, effectiveTransition2) {
540
- var animateOnly2 = props.animateOnly;
541
- var animated = {};
542
- var statics = {};
543
- var transforms2 = [];
994
+ useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function (nextStyle, effectiveTransition2, pseudoActive) {
995
+ if (isExitingJSRef.current) return;
996
+ pseudoActiveRef.current = pseudoActive === true;
997
+ var animateOnly = props.animateOnly;
544
998
  var transitionToUse = effectiveTransition2 !== null && effectiveTransition2 !== void 0 ? effectiveTransition2 : props.transition;
545
999
  var {
546
1000
  baseConfig: newBase,
547
1001
  propertyConfigs: newPropertyConfigs
548
1002
  } = buildTransitionConfig(transitionToUse, animations, animationState, getStyleKeys(nextStyle));
549
- configRef.set({
1003
+ configRef.value = {
550
1004
  baseConfig: newBase,
551
1005
  propertyConfigs: newPropertyConfigs,
552
- disableAnimation: configRef.get().disableAnimation,
553
- isHydrating: configRef.get().isHydrating
554
- });
555
- for (var key3 in nextStyle) {
556
- var rawValue = nextStyle[key3];
557
- var value = resolveDynamicValue(rawValue, isDark);
558
- if (value == void 0) continue;
559
- if (configRef.get().disableAnimation) {
560
- statics[key3] = value;
561
- continue;
562
- }
563
- if (key3 === "transform" && Array.isArray(value)) {
564
- var _iteratorNormalCompletion2 = true,
565
- _didIteratorError2 = false,
566
- _iteratorError2 = void 0;
567
- try {
568
- for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
569
- var t2 = _step2.value;
570
- if (t2 && (typeof t2 === "undefined" ? "undefined" : _type_of(t2)) === "object") {
571
- var tKey2 = Object.keys(t2)[0];
572
- var tVal = t2[tKey2];
573
- if (typeof tVal === "number" || typeof tVal === "string") {
574
- transforms2.push(t2);
575
- }
576
- }
577
- }
578
- } catch (err) {
579
- _didIteratorError2 = true;
580
- _iteratorError2 = err;
581
- } finally {
582
- try {
583
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
584
- _iterator2.return();
585
- }
586
- } finally {
587
- if (_didIteratorError2) {
588
- throw _iteratorError2;
589
- }
590
- }
591
- }
592
- continue;
593
- }
594
- if (canAnimateProperty(key3, value, animateOnly2)) {
595
- animated[key3] = value;
596
- } else {
597
- statics[key3] = value;
598
- }
599
- }
600
- animatedTargetsRef.set(animated);
601
- staticTargetsRef.set(statics);
602
- transformTargetsRef.set(transforms2);
1006
+ disableAnimation: configRef.value.disableAnimation,
1007
+ isHydrating: configRef.value.isHydrating
1008
+ };
1009
+ var _emitterKeysRef_current;
1010
+ var previousKeys = (_emitterKeysRef_current = emitterKeysRef.current) !== null && _emitterKeysRef_current !== void 0 ? _emitterKeysRef_current : committedRenderKeysRef.current;
1011
+ var {
1012
+ animated,
1013
+ statics
1014
+ } = splitAnimationStyles(nextStyle, isDark, configRef.value.disableAnimation, animateOnly);
1015
+ var snapshot = buildSnapshot(animated, statics, getAnimatedTransforms(animated.transform), previousKeys, lastPaintedRef.current);
1016
+ emitterSnapshotRef.value = snapshot.value;
1017
+ emitterKeysRef.current = snapshot.keys;
1018
+ lastPaintedRef.current = snapshot.painted;
603
1019
  if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
604
1020
  console.info("[animations-reanimated] useStyleEmitter update", {
605
1021
  animated,
606
1022
  statics,
607
- transforms: transforms2
1023
+ transforms: snapshot.value.transforms
608
1024
  });
609
1025
  }
610
1026
  });
611
1027
  var exitKeysRegistered = (0, import_react.useRef)(false);
612
1028
  if (justStartedExiting && sendExitComplete) {
613
- var exitKeys = [];
614
- var animateOnly = props.animateOnly;
615
- for (var key2 in animatedStyles) {
616
- if (key2 === "transform") continue;
617
- if (canAnimateProperty(key2, animatedStyles[key2], animateOnly)) {
618
- exitKeys.push(key2);
619
- }
620
- }
621
- var transforms = animatedStyles.transform;
622
- if (transforms && Array.isArray(transforms)) {
623
- var _iteratorNormalCompletion = true,
624
- _didIteratorError = false,
625
- _iteratorError = void 0;
626
- try {
627
- for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
628
- var t = _step.value;
629
- if (!t) continue;
630
- var tKey = Object.keys(t)[0];
631
- if (tKey) {
632
- if (animateOnly && !animateOnly.includes(tKey)) {
633
- continue;
634
- }
635
- exitKeys.push(`transform:${tKey}`);
636
- }
637
- }
638
- } catch (err) {
639
- _didIteratorError = true;
640
- _iteratorError = err;
641
- } finally {
642
- try {
643
- if (!_iteratorNormalCompletion && _iterator.return != null) {
644
- _iterator.return();
645
- }
646
- } finally {
647
- if (_didIteratorError) {
648
- throw _iteratorError;
649
- }
650
- }
651
- }
652
- }
1029
+ var exitKeys = getGatedKeys(renderSnapshot.value);
653
1030
  pendingExitKeysRef.current = new Set(exitKeys);
654
1031
  exitKeysRegistered.current = exitKeys.length > 0;
655
1032
  }
1033
+ var previousDidAnimateStyleRef = (0, import_react.useRef)(null);
1034
+ var didAnimateStyle = onDidAnimate ? JSON.stringify(style) : null;
1035
+ var previousDidAnimateStyle = previousDidAnimateStyleRef.current;
1036
+ var shouldRegisterDidAnimate = didAnimateStyle !== null && previousDidAnimateStyle !== null && previousDidAnimateStyle !== didAnimateStyle && !isExiting && !isEntering && !justFinishedEntering;
1037
+ var didAnimateKeys = shouldRegisterDidAnimate ? getGatedKeys(renderSnapshot.value) : [];
1038
+ (0, import_core.useIsomorphicLayoutEffect)(function () {
1039
+ if (didAnimateStyle === null) {
1040
+ previousDidAnimateStyleRef.current = null;
1041
+ isCompletingAnimationRef.value = false;
1042
+ return;
1043
+ }
1044
+ var previousStyleStillCurrent = previousDidAnimateStyleRef.current === previousDidAnimateStyle;
1045
+ previousDidAnimateStyleRef.current = didAnimateStyle;
1046
+ if (!shouldRegisterDidAnimate || !previousStyleStillCurrent) return;
1047
+ var cycleId = ++didAnimateCycleIdRef.current;
1048
+ pendingDidAnimateKeysRef.current = new Set(didAnimateKeys);
1049
+ didAnimateCompletedRef.current = didAnimateKeys.length === 0;
1050
+ isCompletingAnimationRef.value = didAnimateKeys.length > 0;
1051
+ didAnimateCycleIdShared.value = cycleId;
1052
+ if (didAnimateKeys.length === 0) {
1053
+ var _onDidAnimateRef_current;
1054
+ (_onDidAnimateRef_current = onDidAnimateRef.current) === null || _onDidAnimateRef_current === void 0 ? void 0 : _onDidAnimateRef_current.call(onDidAnimateRef);
1055
+ }
1056
+ }, [didAnimateStyle, shouldRegisterDidAnimate]);
656
1057
  import_react.default.useEffect(function () {
657
1058
  if (!justStartedExiting || !sendExitComplete) return;
658
1059
  if (!exitKeysRegistered.current && pendingExitKeysRef.current.size === 0) {
@@ -662,99 +1063,98 @@ function createAnimations(animationsConfig) {
662
1063
  }
663
1064
  }
664
1065
  }, [justStartedExiting, sendExitComplete]);
1066
+ var mapperStateRef = (0, import_react_native_reanimated.useSharedValue)({
1067
+ emitted: {}
1068
+ });
665
1069
  var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function () {
666
1070
  "worklet";
667
1071
 
668
- var _loop = function (key12) {
669
- if (key12 === "transform") return "continue";
670
- var targetValue = animatedValues[key12];
671
- var _config_propertyConfigs_key;
672
- var propConfig = (_config_propertyConfigs_key = config.propertyConfigs[key12]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig;
673
- var callback = void 0;
674
- if (currentlyExiting) {
675
- var capturedKey = key12;
676
- var capturedCycleId = currentCycleId;
677
- callback = function (finished) {
678
- "worklet";
679
-
680
- (0, import_react_native_reanimated.runOnJS)(markExitKeyDone)(capturedKey, capturedCycleId, finished !== null && finished !== void 0 ? finished : false);
681
- };
682
- }
683
- result[key12] = applyAnimation(targetValue, propConfig, callback);
684
- };
685
- if (disableAnimation || isHydrating) {
1072
+ var mapperState = mapperStateRef.value;
1073
+ var config = configRef.value;
1074
+ if (config.disableAnimation || config.isHydrating) {
1075
+ updateMapperState(mapperStateRef, {});
686
1076
  return {};
687
1077
  }
1078
+ var previouslyEmitted = mapperState.emitted;
1079
+ var emitted = {};
688
1080
  var result = {};
689
- var config = configRef.get();
690
- var emitterAnimated = animatedTargetsRef.value;
691
- var emitterStatic = staticTargetsRef.value;
692
- var emitterTransforms = transformTargetsRef.value;
693
- var hasEmitterUpdates = emitterAnimated !== null;
694
- var animatedValues = hasEmitterUpdates ? emitterAnimated : animatedStyles;
695
- var staticValues = hasEmitterUpdates ? emitterStatic : {};
1081
+ var emitterSnapshot = emitterSnapshotRef.value;
1082
+ var snapshot = emitterSnapshot !== null && emitterSnapshot !== void 0 ? emitterSnapshot : renderSnapshotRef.value;
1083
+ var animatedValues = snapshot.animated;
1084
+ var staticValues = snapshot.statics;
696
1085
  var currentlyExiting = isExitingRef.value;
697
1086
  var currentCycleId = exitCycleIdShared.value;
698
- for (var key3 in staticValues) {
699
- result[key3] = staticValues[key3];
1087
+ var currentlyCompletingAnimation = isCompletingAnimationRef.value;
1088
+ var currentDidAnimateCycleId = didAnimateCycleIdShared.value;
1089
+ for (var key2 in staticValues) {
1090
+ result[key2] = staticValues[key2];
1091
+ }
1092
+ for (var key1 in snapshot.removedKeys) {
1093
+ if (!key1.startsWith("transform:") && !(key1 in staticValues)) {
1094
+ result[key1] = snapshot.clearValue;
1095
+ }
1096
+ }
1097
+ for (var key22 in animatedValues) {
1098
+ if (key22 === "transform") continue;
1099
+ var targetValue = animatedValues[key22];
1100
+ emitted[key22] = true;
1101
+ if (typeof targetValue !== "number" && typeof targetValue !== "string") {
1102
+ result[key22] = targetValue;
1103
+ continue;
1104
+ }
1105
+ var _config_propertyConfigs_key;
1106
+ result[key22] = animateSnapshotValue(key22, key22, targetValue, (_config_propertyConfigs_key = config.propertyConfigs[key22]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig, !!previouslyEmitted[key22], snapshot.seeds[key22], !!snapshot.gatedKeys[key22], currentlyExiting, currentCycleId, currentlyCompletingAnimation, currentDidAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone, !!COLOR_STYLE_KEYS[key22]);
700
1107
  }
701
- for (var key1 in animatedValues) _loop(key1);
702
- var transforms2 = hasEmitterUpdates ? emitterTransforms : animatedStyles.transform;
703
- if (transforms2 && Array.isArray(transforms2)) {
1108
+ var transforms = snapshot.transforms;
1109
+ if (transforms.length > 0 || snapshot.removeTransform) {
704
1110
  var validTransforms = [];
705
- var _iteratorNormalCompletion2 = true,
706
- _didIteratorError2 = false,
707
- _iteratorError2 = void 0;
1111
+ var _iteratorNormalCompletion = true,
1112
+ _didIteratorError = false,
1113
+ _iteratorError = void 0;
708
1114
  try {
709
- var _loop1 = function () {
710
- var t2 = _step2.value;
711
- if (!t2) return "continue";
712
- var keys = Object.keys(t2);
713
- if (keys.length === 0) return "continue";
714
- var value = t2[keys[0]];
1115
+ for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1116
+ var t = _step.value;
1117
+ if (!t) continue;
1118
+ var keys = Object.keys(t);
1119
+ if (keys.length === 0) continue;
1120
+ var transformKey = keys[0];
1121
+ var value = t[transformKey];
715
1122
  if (typeof value === "number" || typeof value === "string") {
716
- var transformKey = Object.keys(t2)[0];
717
- var targetValue = t2[transformKey];
718
1123
  var _config_propertyConfigs_transformKey;
719
1124
  var propConfig = (_config_propertyConfigs_transformKey = config.propertyConfigs[transformKey]) !== null && _config_propertyConfigs_transformKey !== void 0 ? _config_propertyConfigs_transformKey : config.baseConfig;
720
- var callback = void 0;
721
- if (currentlyExiting) {
722
- var capturedKey = `transform:${transformKey}`;
723
- var capturedCycleId = currentCycleId;
724
- callback = function (finished) {
725
- "worklet";
726
-
727
- (0, import_react_native_reanimated.runOnJS)(markExitKeyDone)(capturedKey, capturedCycleId, finished !== null && finished !== void 0 ? finished : false);
728
- };
729
- }
1125
+ var subKey = `transform:${transformKey}`;
1126
+ emitted[subKey] = true;
730
1127
  validTransforms.push({
731
- [transformKey]: applyAnimation(targetValue, propConfig, callback)
1128
+ [transformKey]: animateSnapshotValue(subKey, transformKey, value, propConfig, !!previouslyEmitted[subKey], snapshot.seeds[subKey], !!snapshot.gatedKeys[subKey], currentlyExiting, currentCycleId, currentlyCompletingAnimation, currentDidAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone)
732
1129
  });
1130
+ } else {
1131
+ validTransforms.push(t);
733
1132
  }
734
- };
735
- for (var _iterator2 = transforms2[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) _loop1();
1133
+ }
736
1134
  } catch (err) {
737
- _didIteratorError2 = true;
738
- _iteratorError2 = err;
1135
+ _didIteratorError = true;
1136
+ _iteratorError = err;
739
1137
  } finally {
740
1138
  try {
741
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
742
- _iterator2.return();
1139
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1140
+ _iterator.return();
743
1141
  }
744
1142
  } finally {
745
- if (_didIteratorError2) {
746
- throw _iteratorError2;
1143
+ if (_didIteratorError) {
1144
+ throw _iteratorError;
747
1145
  }
748
1146
  }
749
1147
  }
750
- if (validTransforms.length > 0) {
1148
+ if (validTransforms.length > 0 || !("transform" in staticValues)) {
751
1149
  result.transform = validTransforms;
752
1150
  }
753
1151
  }
1152
+ updateMapperState(mapperStateRef, emitted);
754
1153
  return result;
755
- }, import_core.isWeb ? [animatedStyles, baseConfig, propertyConfigs, disableAnimation, isHydrating,
756
- // pass SharedValues so the mapper watches them on web (no babel plugin)
757
- animatedTargetsRef, staticTargetsRef, transformTargetsRef, isExitingRef, exitCycleIdShared, markExitKeyDone] : void 0);
1154
+ }, import_core.isWeb ? [
1155
+ // pass SharedValues so the stable mapper watches them on web (no babel plugin)
1156
+ renderSnapshotRef, emitterSnapshotRef, configRef, isExitingRef, exitCycleIdShared, markExitKeyDone, isCompletingAnimationRef, didAnimateCycleIdShared, markDidAnimateKeyDone] : void 0);
1157
+ silenceAnimatedComponentDevCheck(animatedStyle);
758
1158
  if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
759
1159
  console.info("[animations-reanimated] useAnimations", {
760
1160
  animationKey,