react-native-reanimated 3.9.0-rc.0 → 3.9.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.
Files changed (297) hide show
  1. package/Common/cpp/Fabric/ShadowTreeCloner.cpp +2 -1
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +11 -4
  3. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +5 -3
  4. package/apple/REAModule.mm +14 -29
  5. package/apple/REANodesManager.mm +7 -6
  6. package/lib/module/Animated.js.map +1 -1
  7. package/lib/module/ConfigHelper.js.map +1 -1
  8. package/lib/module/animationBuilder.js.map +1 -1
  9. package/lib/module/createAnimatedComponent/InlinePropManager.js +2 -2
  10. package/lib/module/createAnimatedComponent/InlinePropManager.js.map +1 -1
  11. package/lib/module/createAnimatedComponent/JSPropsUpdater.js +4 -4
  12. package/lib/module/createAnimatedComponent/JSPropsUpdater.js.map +1 -1
  13. package/lib/module/createAnimatedComponent/JSPropsUpdater.web.js.map +1 -1
  14. package/lib/module/createAnimatedComponent/PropsFilter.js +5 -5
  15. package/lib/module/createAnimatedComponent/PropsFilter.js.map +1 -1
  16. package/lib/module/createAnimatedComponent/commonTypes.js.map +1 -1
  17. package/lib/module/createAnimatedComponent/createAnimatedComponent.js +33 -33
  18. package/lib/module/createAnimatedComponent/createAnimatedComponent.js.map +1 -1
  19. package/lib/module/createAnimatedComponent/getViewInfo.js +2 -2
  20. package/lib/module/createAnimatedComponent/getViewInfo.js.map +1 -1
  21. package/lib/module/createAnimatedComponent/index.js.map +1 -1
  22. package/lib/module/createAnimatedComponent/setAndForwardRef.js +4 -5
  23. package/lib/module/createAnimatedComponent/setAndForwardRef.js.map +1 -1
  24. package/lib/module/createAnimatedComponent/utils.js.map +1 -1
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/index.web.js +1 -2
  27. package/lib/module/index.web.js.map +1 -1
  28. package/lib/module/mock.js +3 -8
  29. package/lib/module/mock.js.map +1 -1
  30. package/lib/module/propsAllowlists.js.map +1 -1
  31. package/lib/module/reanimated2/Bezier.js.map +1 -1
  32. package/lib/module/reanimated2/Colors.js +4 -11
  33. package/lib/module/reanimated2/Colors.js.map +1 -1
  34. package/lib/module/reanimated2/Easing.js +3 -7
  35. package/lib/module/reanimated2/Easing.js.map +1 -1
  36. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +3 -3
  37. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  38. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  39. package/lib/module/reanimated2/NativeReanimated/index.web.js.map +1 -1
  40. package/lib/module/reanimated2/PlatformChecker.js +1 -0
  41. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  42. package/lib/module/reanimated2/PropAdapters.js +1 -1
  43. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  44. package/lib/module/reanimated2/PropsRegistry.js.map +1 -1
  45. package/lib/module/reanimated2/Sensor.js +2 -2
  46. package/lib/module/reanimated2/Sensor.js.map +1 -1
  47. package/lib/module/reanimated2/SensorContainer.js +2 -2
  48. package/lib/module/reanimated2/SensorContainer.js.map +1 -1
  49. package/lib/module/reanimated2/UpdateLayoutAnimations.js.map +1 -1
  50. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  51. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  52. package/lib/module/reanimated2/WorkletEventHandler.js +74 -31
  53. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  54. package/lib/module/reanimated2/animation/clamp.js.map +1 -1
  55. package/lib/module/reanimated2/animation/commonTypes.js.map +1 -1
  56. package/lib/module/reanimated2/animation/decay/decay.js.map +1 -1
  57. package/lib/module/reanimated2/animation/decay/index.js.map +1 -1
  58. package/lib/module/reanimated2/animation/decay/rigidDecay.js.map +1 -1
  59. package/lib/module/reanimated2/animation/decay/rubberBandDecay.js.map +1 -1
  60. package/lib/module/reanimated2/animation/decay/utils.js.map +1 -1
  61. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  62. package/lib/module/reanimated2/animation/index.js.map +1 -1
  63. package/lib/module/reanimated2/animation/repeat.js +1 -6
  64. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  65. package/lib/module/reanimated2/animation/sequence.js +1 -5
  66. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  67. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  68. package/lib/module/reanimated2/animation/springUtils.js +8 -10
  69. package/lib/module/reanimated2/animation/springUtils.js.map +1 -1
  70. package/lib/module/reanimated2/animation/styleAnimation.js +5 -4
  71. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  72. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  73. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js +1 -2
  74. package/lib/module/reanimated2/animation/transformationMatrix/matrixUtils.js.map +1 -1
  75. package/lib/module/reanimated2/animation/util.js.map +1 -1
  76. package/lib/module/reanimated2/commonTypes.js +2 -0
  77. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  78. package/lib/module/reanimated2/component/FlatList.js +1 -0
  79. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  80. package/lib/module/reanimated2/component/Image.js +1 -0
  81. package/lib/module/reanimated2/component/Image.js.map +1 -1
  82. package/lib/module/reanimated2/component/LayoutAnimationConfig.js +1 -0
  83. package/lib/module/reanimated2/component/LayoutAnimationConfig.js.map +1 -1
  84. package/lib/module/reanimated2/component/PerformanceMonitor.js +3 -4
  85. package/lib/module/reanimated2/component/PerformanceMonitor.js.map +1 -1
  86. package/lib/module/reanimated2/component/ScrollView.js +1 -0
  87. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  88. package/lib/module/reanimated2/component/Text.js +1 -0
  89. package/lib/module/reanimated2/component/Text.js.map +1 -1
  90. package/lib/module/reanimated2/component/View.js +1 -0
  91. package/lib/module/reanimated2/component/View.js.map +1 -1
  92. package/lib/module/reanimated2/core.js +2 -4
  93. package/lib/module/reanimated2/core.js.map +1 -1
  94. package/lib/module/reanimated2/errors.js +7 -8
  95. package/lib/module/reanimated2/errors.js.map +1 -1
  96. package/lib/module/reanimated2/fabricUtils.js +4 -4
  97. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  98. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  99. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +2 -2
  100. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  101. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  102. package/lib/module/reanimated2/frameCallback/index.js.map +1 -1
  103. package/lib/module/reanimated2/globals.d.js.map +1 -1
  104. package/lib/module/reanimated2/helperTypes.js.map +1 -1
  105. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  106. package/lib/module/reanimated2/hook/index.js.map +1 -1
  107. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +1 -0
  108. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  109. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +3 -4
  110. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  111. package/lib/module/reanimated2/hook/useAnimatedProps.js.map +1 -1
  112. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -0
  113. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  114. package/lib/module/reanimated2/hook/useAnimatedRef.js +1 -1
  115. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  116. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +3 -1
  117. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  118. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  119. package/lib/module/reanimated2/hook/useAnimatedStyle.js +3 -6
  120. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  121. package/lib/module/reanimated2/hook/useDerivedValue.js +3 -1
  122. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  123. package/lib/module/reanimated2/hook/useEvent.js +4 -5
  124. package/lib/module/reanimated2/hook/useEvent.js.map +1 -1
  125. package/lib/module/reanimated2/hook/useFrameCallback.js +1 -2
  126. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  127. package/lib/module/reanimated2/hook/useHandler.js +3 -1
  128. package/lib/module/reanimated2/hook/useHandler.js.map +1 -1
  129. package/lib/module/reanimated2/hook/useReducedMotion.js.map +1 -1
  130. package/lib/module/reanimated2/hook/useScrollViewOffset.js +14 -6
  131. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  132. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  133. package/lib/module/reanimated2/hook/useWorkletCallback.js.map +1 -1
  134. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  135. package/lib/module/reanimated2/index.js.map +1 -1
  136. package/lib/module/reanimated2/initializers.js +1 -5
  137. package/lib/module/reanimated2/initializers.js.map +1 -1
  138. package/lib/module/reanimated2/interpolateColor.js +2 -6
  139. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  140. package/lib/module/reanimated2/interpolation.js +1 -1
  141. package/lib/module/reanimated2/interpolation.js.map +1 -1
  142. package/lib/module/reanimated2/isSharedValue.js.map +1 -1
  143. package/lib/module/reanimated2/jestUtils.js +3 -6
  144. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  145. package/lib/module/reanimated2/jestUtils.web.js.map +1 -1
  146. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +4 -5
  147. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  148. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -1
  149. package/lib/module/reanimated2/js-reanimated/index.js +2 -2
  150. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  151. package/lib/module/reanimated2/js-reanimated/react-native-web.d.js.map +1 -1
  152. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +4 -2
  153. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  154. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +8 -11
  155. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  156. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +8 -9
  157. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  158. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  159. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  160. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +1 -2
  161. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  162. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +22 -22
  163. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  164. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +22 -22
  165. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  166. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +26 -26
  167. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  168. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +10 -10
  169. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  170. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +6 -6
  171. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  172. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +10 -10
  173. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  174. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +18 -18
  175. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  176. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +18 -18
  177. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  178. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +10 -10
  179. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  180. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +34 -34
  181. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  182. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  183. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +4 -4
  184. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  185. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +4 -4
  186. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  187. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +4 -4
  188. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  189. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +4 -4
  190. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  191. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +4 -4
  192. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  193. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +4 -4
  194. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  195. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  196. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  197. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js +4 -6
  198. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/ProgressTransitionManager.js.map +1 -1
  199. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js +4 -6
  200. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.js.map +1 -1
  201. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/SharedTransition.web.js.map +1 -1
  202. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  203. package/lib/module/reanimated2/layoutReanimation/web/animation/Bounce.web.js.map +1 -1
  204. package/lib/module/reanimated2/layoutReanimation/web/animation/Fade.web.js.map +1 -1
  205. package/lib/module/reanimated2/layoutReanimation/web/animation/Flip.web.js.map +1 -1
  206. package/lib/module/reanimated2/layoutReanimation/web/animation/Lightspeed.web.js.map +1 -1
  207. package/lib/module/reanimated2/layoutReanimation/web/animation/Pinwheel.web.js.map +1 -1
  208. package/lib/module/reanimated2/layoutReanimation/web/animation/Roll.web.js.map +1 -1
  209. package/lib/module/reanimated2/layoutReanimation/web/animation/Rotate.web.js.map +1 -1
  210. package/lib/module/reanimated2/layoutReanimation/web/animation/Slide.web.js.map +1 -1
  211. package/lib/module/reanimated2/layoutReanimation/web/animation/Stretch.web.js.map +1 -1
  212. package/lib/module/reanimated2/layoutReanimation/web/animation/Zoom.web.js.map +1 -1
  213. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js +0 -2
  214. package/lib/module/reanimated2/layoutReanimation/web/animationParser.js.map +1 -1
  215. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js +1 -2
  216. package/lib/module/reanimated2/layoutReanimation/web/animationsManager.js.map +1 -1
  217. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js +3 -1
  218. package/lib/module/reanimated2/layoutReanimation/web/componentStyle.js.map +1 -1
  219. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js +6 -7
  220. package/lib/module/reanimated2/layoutReanimation/web/componentUtils.js.map +1 -1
  221. package/lib/module/reanimated2/layoutReanimation/web/config.js.map +1 -1
  222. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js +2 -2
  223. package/lib/module/reanimated2/layoutReanimation/web/createAnimation.js.map +1 -1
  224. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js +4 -4
  225. package/lib/module/reanimated2/layoutReanimation/web/domUtils.js.map +1 -1
  226. package/lib/module/reanimated2/layoutReanimation/web/index.js.map +1 -1
  227. package/lib/module/reanimated2/layoutReanimation/web/transition/Fading.web.js.map +1 -1
  228. package/lib/module/reanimated2/layoutReanimation/web/transition/Linear.web.js.map +1 -1
  229. package/lib/module/reanimated2/layoutReanimation/web/transition/Sequenced.web.js.map +1 -1
  230. package/lib/module/reanimated2/mappers.js +2 -4
  231. package/lib/module/reanimated2/mappers.js.map +1 -1
  232. package/lib/module/reanimated2/mockedRequestAnimationFrame.js.map +1 -1
  233. package/lib/module/reanimated2/mutables.js +2 -4
  234. package/lib/module/reanimated2/mutables.js.map +1 -1
  235. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  236. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  237. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -1
  238. package/lib/module/reanimated2/platform-specific/jsVersion.js +1 -1
  239. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -1
  240. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js +2 -4
  241. package/lib/module/reanimated2/platformFunctions/dispatchCommand.js.map +1 -1
  242. package/lib/module/reanimated2/platformFunctions/dispatchCommand.web.js.map +1 -1
  243. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js +2 -2
  244. package/lib/module/reanimated2/platformFunctions/getRelativeCoords.js.map +1 -1
  245. package/lib/module/reanimated2/platformFunctions/index.js.map +1 -1
  246. package/lib/module/reanimated2/platformFunctions/measure.js.map +1 -1
  247. package/lib/module/reanimated2/platformFunctions/measure.web.js.map +1 -1
  248. package/lib/module/reanimated2/platformFunctions/scrollTo.js.map +1 -1
  249. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js +1 -1
  250. package/lib/module/reanimated2/platformFunctions/scrollTo.web.js.map +1 -1
  251. package/lib/module/reanimated2/platformFunctions/setGestureState.js.map +1 -1
  252. package/lib/module/reanimated2/platformFunctions/setGestureState.web.js.map +1 -1
  253. package/lib/module/reanimated2/platformFunctions/setNativeProps.js.map +1 -1
  254. package/lib/module/reanimated2/platformFunctions/setNativeProps.web.js.map +1 -1
  255. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  256. package/lib/module/reanimated2/publicGlobals.js.map +1 -1
  257. package/lib/module/reanimated2/runtimes.js +11 -19
  258. package/lib/module/reanimated2/runtimes.js.map +1 -1
  259. package/lib/module/reanimated2/screenTransition/RNScreensTurboModule.js.map +1 -1
  260. package/lib/module/reanimated2/screenTransition/animationManager.js.map +1 -1
  261. package/lib/module/reanimated2/screenTransition/commonTypes.js.map +1 -1
  262. package/lib/module/reanimated2/screenTransition/index.js.map +1 -1
  263. package/lib/module/reanimated2/screenTransition/presets.js.map +1 -1
  264. package/lib/module/reanimated2/screenTransition/styleUpdater.js.map +1 -1
  265. package/lib/module/reanimated2/screenTransition/swipeSimulator.js +1 -1
  266. package/lib/module/reanimated2/screenTransition/swipeSimulator.js.map +1 -1
  267. package/lib/module/reanimated2/shareableMappingCache.js.map +1 -1
  268. package/lib/module/reanimated2/shareables.js +2 -4
  269. package/lib/module/reanimated2/shareables.js.map +1 -1
  270. package/lib/module/reanimated2/threads.js +9 -34
  271. package/lib/module/reanimated2/threads.js.map +1 -1
  272. package/lib/module/reanimated2/valueSetter.js +1 -2
  273. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  274. package/lib/module/reanimated2/valueUnpacker.js.map +1 -1
  275. package/lib/module/specs/NativeReanimatedModule.js.map +1 -1
  276. package/lib/typescript/reanimated2/WorkletEventHandler.d.ts +16 -9
  277. package/lib/typescript/reanimated2/component/LayoutAnimationConfig.d.ts +1 -1
  278. package/lib/typescript/reanimated2/component/PerformanceMonitor.d.ts +2 -1
  279. package/lib/typescript/reanimated2/hook/commonTypes.d.ts +5 -0
  280. package/lib/typescript/reanimated2/hook/useEvent.d.ts +2 -3
  281. package/lib/typescript/reanimated2/platform-specific/jsVersion.d.ts +1 -1
  282. package/package.json +18 -14
  283. package/plugin/build/plugin.js +7 -2
  284. package/src/createAnimatedComponent/PropsFilter.tsx +1 -1
  285. package/src/createAnimatedComponent/createAnimatedComponent.tsx +29 -33
  286. package/src/reanimated2/WorkletEventHandler.ts +98 -39
  287. package/src/reanimated2/animation/styleAnimation.ts +8 -6
  288. package/src/reanimated2/hook/commonTypes.ts +9 -0
  289. package/src/reanimated2/hook/useEvent.ts +4 -4
  290. package/src/reanimated2/hook/useScrollViewOffset.ts +21 -5
  291. package/src/reanimated2/js-reanimated/JSReanimated.ts +6 -3
  292. package/src/reanimated2/layoutReanimation/web/animationsManager.ts +1 -1
  293. package/src/reanimated2/layoutReanimation/web/componentStyle.ts +3 -1
  294. package/src/reanimated2/layoutReanimation/web/componentUtils.ts +1 -1
  295. package/src/reanimated2/layoutReanimation/web/createAnimation.ts +2 -2
  296. package/src/reanimated2/platform-specific/jsVersion.ts +1 -1
  297. package/src/reanimated2/platformFunctions/getRelativeCoords.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"names":["Animations","TransitionType","WebEasings","convertTransformToString","TransitionGenerator","scheduleAnimationCleanup","_updatePropsJS","ReduceMotion","isReducedMotion","LayoutAnimationType","setDummyPosition","snapshots","getEasingFromConfig","config","easingName","easingV","name","toString","getRandomDelay","maxDelay","arguments","length","undefined","Math","floor","random","getDelayFromConfig","shouldRandomizeDelay","randomizeDelay","delay","delayV","getReducedMotionFromConfig","reduceMotionV","Never","Always","getDurationFromConfig","isLayoutTransition","animationName","defaultDuration","duration","durationV","getCallbackFromConfig","callbackV","getReversedFromConfig","reversed","extractTransformFromStyle","style","transform","Error","Array","isArray","i","_style$i","getProcessedConfig","animationType","initialAnimationName","LAYOUT","easing","callback","saveSnapshot","element","rect","getBoundingClientRect","snapshot","top","left","width","height","scrollOffsets","getElementScrollValue","set","setElementAnimation","animationConfig","existingTransform","animationDuration","animationDelay","animationTimingFunction","onanimationend","_animationConfig$call","call","removeEventListener","animationCancelHandler","_animationConfig$call2","onanimationstart","ENTERING","visibility","_component","addEventListener","handleLayoutTransition","transitionData","LINEAR","SEQUENCED","FADING","transformCopy","structuredClone","push","current","scrollTopOffset","scrollLeftOffset","scrollTop","scrollLeft","parentElement","handleExitingAnimation","parent","offsetParent","dummy","cloneNode","reanimatedDummy","firstChild","appendChild","get","currentScrollTopOffset","lastScrollTopOffset","currentScrollLeftOffset","lastScrollLeftOffset","originalOnAnimationEnd","event","contains","removedAfterAnimation","removeChild"],"sources":["componentUtils.ts"],"sourcesContent":["'use strict';\n\nimport type { TransformsStyle } from 'react-native';\nimport { Animations, TransitionType, WebEasings } from './config';\nimport type {\n AnimationCallback,\n AnimationConfig,\n AnimationNames,\n CustomConfig,\n WebEasingsNames,\n} from './config';\nimport { convertTransformToString } from './animationParser';\nimport type { TransitionData } from './animationParser';\nimport { TransitionGenerator } from './createAnimation';\nimport { scheduleAnimationCleanup } from './domUtils';\nimport { _updatePropsJS } from '../../js-reanimated';\nimport type { ReanimatedHTMLElement } from '../../js-reanimated';\nimport { ReduceMotion } from '../../commonTypes';\nimport type { StyleProps } from '../../commonTypes';\nimport { isReducedMotion } from '../../PlatformChecker';\nimport { LayoutAnimationType } from '../animationBuilder/commonTypes';\nimport type { ReanimatedSnapshot, ScrollOffsets } from './componentStyle';\nimport { setDummyPosition, snapshots } from './componentStyle';\n\nfunction getEasingFromConfig(config: CustomConfig): string {\n const easingName =\n config.easingV && config.easingV.name in WebEasings\n ? (config.easingV.name as WebEasingsNames)\n : 'linear';\n\n return `cubic-bezier(${WebEasings[easingName].toString()})`;\n}\n\nfunction getRandomDelay(maxDelay = 1000) {\n return Math.floor(Math.random() * (maxDelay + 1)) / 1000;\n}\n\nfunction getDelayFromConfig(config: CustomConfig): number {\n const shouldRandomizeDelay = config.randomizeDelay;\n\n const delay = shouldRandomizeDelay ? getRandomDelay() : 0;\n\n if (!config.delayV) {\n return delay;\n }\n\n return shouldRandomizeDelay\n ? getRandomDelay(config.delayV)\n : config.delayV / 1000;\n}\n\nexport function getReducedMotionFromConfig(config: CustomConfig) {\n if (!config.reduceMotionV) {\n return isReducedMotion();\n }\n\n switch (config.reduceMotionV) {\n case ReduceMotion.Never:\n return false;\n case ReduceMotion.Always:\n return true;\n default:\n return isReducedMotion();\n }\n}\n\nfunction getDurationFromConfig(\n config: CustomConfig,\n isLayoutTransition: boolean,\n animationName: AnimationNames\n): number {\n const defaultDuration = isLayoutTransition\n ? 0.3\n : Animations[animationName].duration;\n\n return config.durationV !== undefined\n ? config.durationV / 1000\n : defaultDuration;\n}\n\nfunction getCallbackFromConfig(config: CustomConfig): AnimationCallback {\n return config.callbackV !== undefined ? config.callbackV : null;\n}\n\nfunction getReversedFromConfig(config: CustomConfig) {\n return !!config.reversed;\n}\n\nexport function extractTransformFromStyle(style: StyleProps) {\n if (!style) {\n return;\n }\n\n if (typeof style.transform === 'string') {\n throw new Error('[Reanimated] String transform is currently unsupported.');\n }\n\n if (!Array.isArray(style)) {\n return style.transform;\n }\n\n // Only last transform should be considered\n for (let i = style.length - 1; i >= 0; --i) {\n if (style[i]?.transform) {\n return style[i].transform;\n }\n }\n}\n\nexport function getProcessedConfig(\n animationName: string,\n animationType: LayoutAnimationType,\n config: CustomConfig,\n initialAnimationName: AnimationNames\n): AnimationConfig {\n return {\n animationName,\n animationType,\n duration: getDurationFromConfig(\n config,\n animationType === LayoutAnimationType.LAYOUT,\n initialAnimationName\n ),\n delay: getDelayFromConfig(config),\n easing: getEasingFromConfig(config),\n callback: getCallbackFromConfig(config),\n reversed: getReversedFromConfig(config),\n };\n}\n\nexport function saveSnapshot(element: HTMLElement) {\n const rect = element.getBoundingClientRect();\n\n const snapshot: ReanimatedSnapshot = {\n top: rect.top,\n left: rect.left,\n width: rect.width,\n height: rect.height,\n scrollOffsets: getElementScrollValue(element),\n };\n\n snapshots.set(element, snapshot);\n}\n\nexport function setElementAnimation(\n element: HTMLElement,\n animationConfig: AnimationConfig,\n existingTransform?: TransformsStyle['transform']\n) {\n const { animationName, duration, delay, easing } = animationConfig;\n\n element.style.animationName = animationName;\n element.style.animationDuration = `${duration}s`;\n element.style.animationDelay = `${delay}s`;\n element.style.animationTimingFunction = easing;\n\n element.onanimationend = () => {\n animationConfig.callback?.(true);\n element.removeEventListener('animationcancel', animationCancelHandler);\n };\n\n const animationCancelHandler = () => {\n animationConfig.callback?.(false);\n element.removeEventListener('animationcancel', animationCancelHandler);\n };\n\n // Here we have to use `addEventListener` since element.onanimationcancel doesn't work on chrome\n element.onanimationstart = () => {\n if (animationConfig.animationType === LayoutAnimationType.ENTERING) {\n _updatePropsJS(\n { visibility: 'initial' },\n { _component: element as ReanimatedHTMLElement }\n );\n }\n\n element.addEventListener('animationcancel', animationCancelHandler);\n element.style.transform = convertTransformToString(existingTransform);\n };\n\n if (!(animationName in Animations)) {\n scheduleAnimationCleanup(animationName, duration + delay);\n }\n}\n\nexport function handleLayoutTransition(\n element: HTMLElement,\n animationConfig: AnimationConfig,\n transitionData: TransitionData,\n existingTransform: TransformsStyle['transform'] | undefined\n) {\n const { animationName } = animationConfig;\n\n let animationType;\n\n switch (animationName) {\n case 'LinearTransition':\n animationType = TransitionType.LINEAR;\n break;\n case 'SequencedTransition':\n animationType = TransitionType.SEQUENCED;\n break;\n case 'FadingTransition':\n animationType = TransitionType.FADING;\n break;\n default:\n animationType = TransitionType.LINEAR;\n break;\n }\n\n animationConfig.animationName = TransitionGenerator(\n animationType,\n transitionData,\n existingTransform\n );\n\n const transformCopy = existingTransform\n ? structuredClone(existingTransform)\n : [];\n\n // @ts-ignore `existingTransform` cannot be string because in that case\n // we throw error in `extractTransformFromStyle`\n transformCopy.push(transitionData);\n element.style.transform = convertTransformToString(transformCopy);\n\n setElementAnimation(element, animationConfig, existingTransform);\n}\n\nfunction getElementScrollValue(element: HTMLElement): ScrollOffsets {\n let current: HTMLElement | null = element;\n\n const scrollOffsets: ScrollOffsets = {\n scrollTopOffset: 0,\n scrollLeftOffset: 0,\n };\n\n while (current) {\n if (current.scrollTop !== 0 && scrollOffsets.scrollTopOffset === 0) {\n scrollOffsets.scrollTopOffset = current.scrollTop;\n }\n\n if (current.scrollLeft !== 0 && scrollOffsets.scrollLeftOffset === 0) {\n scrollOffsets.scrollLeftOffset = current.scrollLeft;\n }\n\n current = current.parentElement;\n }\n\n return scrollOffsets;\n}\n\nexport function handleExitingAnimation(\n element: HTMLElement,\n animationConfig: AnimationConfig\n) {\n const parent = element.offsetParent;\n const dummy = element.cloneNode() as ReanimatedHTMLElement;\n dummy.reanimatedDummy = true;\n\n element.style.animationName = '';\n // We hide current element so only its copy with proper animation will be displayed\n element.style.visibility = 'hidden';\n\n // After cloning the element, we want to move all children from original element to its clone. This is because original element\n // will be unmounted, therefore when this code executes in child component, parent will be either empty or removed soon.\n // Using element.cloneNode(true) doesn't solve the problem, because it creates copy of children and we won't be able to set their animations\n //\n // This loop works because appendChild() moves element into its new parent instead of copying it\n while (element.firstChild) {\n dummy.appendChild(element.firstChild);\n }\n\n setElementAnimation(dummy, animationConfig);\n parent?.appendChild(dummy);\n\n const snapshot = snapshots.get(element)!;\n\n const scrollOffsets = getElementScrollValue(element);\n\n // Scroll does not trigger snapshoting, therefore if we start exiting animation after\n // scrolling through parent component, dummy will end up in wrong place. In order to fix that\n // we keep last known scroll position in snapshot and then adjust dummy position based on\n // last known scroll offset and current scroll offset\n\n const currentScrollTopOffset = scrollOffsets.scrollTopOffset;\n const lastScrollTopOffset = snapshot.scrollOffsets.scrollTopOffset;\n\n if (currentScrollTopOffset !== lastScrollTopOffset) {\n snapshot.top += lastScrollTopOffset - currentScrollTopOffset;\n }\n\n const currentScrollLeftOffset = scrollOffsets.scrollLeftOffset;\n const lastScrollLeftOffset = snapshot.scrollOffsets.scrollLeftOffset;\n\n if (currentScrollLeftOffset !== lastScrollLeftOffset) {\n snapshot.left += lastScrollLeftOffset - currentScrollLeftOffset;\n }\n\n snapshots.set(dummy, snapshot);\n\n setDummyPosition(dummy, snapshot);\n\n const originalOnAnimationEnd = dummy.onanimationend;\n\n dummy.onanimationend = function (event: AnimationEvent) {\n if (parent?.contains(dummy)) {\n dummy.removedAfterAnimation = true;\n parent.removeChild(dummy);\n }\n\n // Given that this function overrides onAnimationEnd, it won't be null\n originalOnAnimationEnd?.call(this, event);\n };\n\n dummy.addEventListener('animationcancel', () => {\n if (parent?.contains(dummy)) {\n dummy.removedAfterAnimation = true;\n parent.removeChild(dummy);\n }\n });\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,UAAU,EAAEC,cAAc,EAAEC,UAAU,QAAQ,UAAU;AAQjE,SAASC,wBAAwB,QAAQ,mBAAmB;AAE5D,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,wBAAwB,QAAQ,YAAY;AACrD,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,mBAAmB,QAAQ,iCAAiC;AAErE,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,kBAAkB;AAE9D,SAASC,mBAAmBA,CAACC,MAAoB,EAAU;EACzD,MAAMC,UAAU,GACdD,MAAM,CAACE,OAAO,IAAIF,MAAM,CAACE,OAAO,CAACC,IAAI,IAAId,UAAU,GAC9CW,MAAM,CAACE,OAAO,CAACC,IAAI,GACpB,QAAQ;EAEd,OAAQ,gBAAed,UAAU,CAACY,UAAU,CAAC,CAACG,QAAQ,EAAG,GAAE;AAC7D;AAEA,SAASC,cAAcA,CAAA,EAAkB;EAAA,IAAjBC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG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Ec,QAAQ,CAACZ,KAAK,CAAC,EAAE;MAC3BA,KAAK,CAACa,qBAAqB,GAAG,IAAI;MAClCf,MAAM,CAACgB,WAAW,CAACd,KAAK,CAAC;IAC3B;EACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"names":["Animations","TransitionType","WebEasings","convertTransformToString","TransitionGenerator","scheduleAnimationCleanup","_updatePropsJS","ReduceMotion","isReducedMotion","LayoutAnimationType","setDummyPosition","snapshots","getEasingFromConfig","config","easingName","easingV","name","toString","getRandomDelay","maxDelay","Math","floor","random","getDelayFromConfig","shouldRandomizeDelay","randomizeDelay","delay","delayV","getReducedMotionFromConfig","reduceMotionV","Never","Always","getDurationFromConfig","isLayoutTransition","animationName","defaultDuration","duration","durationV","undefined","getCallbackFromConfig","callbackV","getReversedFromConfig","reversed","extractTransformFromStyle","style","transform","Error","Array","isArray","i","length","_style$i","getProcessedConfig","animationType","initialAnimationName","LAYOUT","easing","callback","saveSnapshot","element","rect","getBoundingClientRect","snapshot","top","left","width","height","scrollOffsets","getElementScrollValue","set","setElementAnimation","animationConfig","existingTransform","animationDuration","animationDelay","animationTimingFunction","onanimationend","_animationConfig$call","call","removeEventListener","animationCancelHandler","_animationConfig$call2","onanimationstart","ENTERING","visibility","_component","addEventListener","handleLayoutTransition","transitionData","LINEAR","SEQUENCED","FADING","transformCopy","structuredClone","push","current","scrollTopOffset","scrollLeftOffset","scrollTop","scrollLeft","parentElement","handleExitingAnimation","parent","offsetParent","dummy","cloneNode","reanimatedDummy","firstChild","appendChild","get","currentScrollTopOffset","lastScrollTopOffset","currentScrollLeftOffset","lastScrollLeftOffset","originalOnAnimationEnd","event","contains","removedAfterAnimation","removeChild"],"sources":["componentUtils.ts"],"sourcesContent":["'use strict';\n\nimport type { TransformsStyle } from 'react-native';\nimport { Animations, TransitionType, WebEasings } from './config';\nimport type {\n AnimationCallback,\n AnimationConfig,\n AnimationNames,\n CustomConfig,\n WebEasingsNames,\n} from './config';\nimport { convertTransformToString } from './animationParser';\nimport type { TransitionData } from './animationParser';\nimport { TransitionGenerator } from './createAnimation';\nimport { scheduleAnimationCleanup } from './domUtils';\nimport { _updatePropsJS } from '../../js-reanimated';\nimport type { ReanimatedHTMLElement } from '../../js-reanimated';\nimport { ReduceMotion } from '../../commonTypes';\nimport type { StyleProps } from '../../commonTypes';\nimport { isReducedMotion } from '../../PlatformChecker';\nimport { LayoutAnimationType } from '../animationBuilder/commonTypes';\nimport type { ReanimatedSnapshot, ScrollOffsets } from './componentStyle';\nimport { setDummyPosition, snapshots } from './componentStyle';\n\nfunction getEasingFromConfig(config: CustomConfig): string {\n const easingName =\n config.easingV && config.easingV.name in WebEasings\n ? (config.easingV.name as WebEasingsNames)\n : 'linear';\n\n return `cubic-bezier(${WebEasings[easingName].toString()})`;\n}\n\nfunction getRandomDelay(maxDelay = 1000) {\n return Math.floor(Math.random() * (maxDelay + 1)) / 1000;\n}\n\nfunction getDelayFromConfig(config: CustomConfig): number {\n const shouldRandomizeDelay = config.randomizeDelay;\n\n const delay = shouldRandomizeDelay ? getRandomDelay() : 0;\n\n if (!config.delayV) {\n return delay;\n }\n\n return shouldRandomizeDelay\n ? getRandomDelay(config.delayV)\n : config.delayV / 1000;\n}\n\nexport function getReducedMotionFromConfig(config: CustomConfig) {\n if (!config.reduceMotionV) {\n return isReducedMotion();\n }\n\n switch (config.reduceMotionV) {\n case ReduceMotion.Never:\n return false;\n case ReduceMotion.Always:\n return true;\n default:\n return isReducedMotion();\n }\n}\n\nfunction getDurationFromConfig(\n config: CustomConfig,\n isLayoutTransition: boolean,\n animationName: AnimationNames\n): number {\n const defaultDuration = isLayoutTransition\n ? 0.3\n : Animations[animationName].duration;\n\n return config.durationV !== undefined\n ? config.durationV / 1000\n : defaultDuration;\n}\n\nfunction getCallbackFromConfig(config: CustomConfig): AnimationCallback {\n return config.callbackV !== undefined ? config.callbackV : null;\n}\n\nfunction getReversedFromConfig(config: CustomConfig) {\n return !!config.reversed;\n}\n\nexport function extractTransformFromStyle(style: StyleProps) {\n if (!style) {\n return;\n }\n\n if (typeof style.transform === 'string') {\n throw new Error('[Reanimated] String transform is currently unsupported.');\n }\n\n if (!Array.isArray(style)) {\n return style.transform;\n }\n\n // Only last transform should be considered\n for (let i = style.length - 1; i >= 0; --i) {\n if (style[i]?.transform) {\n return style[i].transform;\n }\n }\n}\n\nexport function getProcessedConfig(\n animationName: string,\n animationType: LayoutAnimationType,\n config: CustomConfig,\n initialAnimationName: AnimationNames\n): AnimationConfig {\n return {\n animationName,\n animationType,\n duration: getDurationFromConfig(\n config,\n animationType === LayoutAnimationType.LAYOUT,\n initialAnimationName\n ),\n delay: getDelayFromConfig(config),\n easing: getEasingFromConfig(config),\n callback: getCallbackFromConfig(config),\n reversed: getReversedFromConfig(config),\n };\n}\n\nexport function saveSnapshot(element: HTMLElement) {\n const rect = element.getBoundingClientRect();\n\n const snapshot: ReanimatedSnapshot = {\n top: rect.top,\n left: rect.left,\n width: rect.width,\n height: rect.height,\n scrollOffsets: getElementScrollValue(element),\n };\n\n snapshots.set(element, snapshot);\n}\n\nexport function setElementAnimation(\n element: HTMLElement,\n animationConfig: AnimationConfig,\n existingTransform?: TransformsStyle['transform']\n) {\n const { animationName, duration, delay, easing } = animationConfig;\n\n element.style.animationName = animationName;\n element.style.animationDuration = `${duration}s`;\n element.style.animationDelay = `${delay}s`;\n element.style.animationTimingFunction = easing;\n\n element.onanimationend = () => {\n animationConfig.callback?.(true);\n element.removeEventListener('animationcancel', animationCancelHandler);\n };\n\n const animationCancelHandler = () => {\n animationConfig.callback?.(false);\n element.removeEventListener('animationcancel', animationCancelHandler);\n };\n\n // Here we have to use `addEventListener` since element.onanimationcancel doesn't work on chrome\n element.onanimationstart = () => {\n if (animationConfig.animationType === LayoutAnimationType.ENTERING) {\n _updatePropsJS(\n { visibility: 'initial' },\n { _component: element as ReanimatedHTMLElement }\n );\n }\n\n element.addEventListener('animationcancel', animationCancelHandler);\n element.style.transform = convertTransformToString(existingTransform);\n };\n\n if (!(animationName in Animations)) {\n scheduleAnimationCleanup(animationName, duration + delay);\n }\n}\n\nexport function handleLayoutTransition(\n element: HTMLElement,\n animationConfig: AnimationConfig,\n transitionData: TransitionData,\n existingTransform: TransformsStyle['transform'] | undefined\n) {\n const { animationName } = animationConfig;\n\n let animationType;\n\n switch (animationName) {\n case 'LinearTransition':\n animationType = TransitionType.LINEAR;\n break;\n case 'SequencedTransition':\n animationType = TransitionType.SEQUENCED;\n break;\n case 'FadingTransition':\n animationType = TransitionType.FADING;\n break;\n default:\n animationType = TransitionType.LINEAR;\n break;\n }\n\n animationConfig.animationName = TransitionGenerator(\n animationType,\n transitionData,\n existingTransform\n );\n\n const transformCopy = existingTransform\n ? structuredClone(existingTransform)\n : [];\n\n // @ts-ignore `existingTransform` cannot be string because in that case\n // we throw error in `extractTransformFromStyle`\n transformCopy.push(transitionData);\n element.style.transform = convertTransformToString(transformCopy);\n\n setElementAnimation(element, animationConfig, existingTransform);\n}\n\nfunction getElementScrollValue(element: HTMLElement): ScrollOffsets {\n let current: HTMLElement | null = element;\n\n const scrollOffsets: ScrollOffsets = {\n scrollTopOffset: 0,\n scrollLeftOffset: 0,\n };\n\n while (current) {\n if (current.scrollTop !== 0 && scrollOffsets.scrollTopOffset === 0) {\n scrollOffsets.scrollTopOffset = current.scrollTop;\n }\n\n if (current.scrollLeft !== 0 && scrollOffsets.scrollLeftOffset === 0) {\n scrollOffsets.scrollLeftOffset = current.scrollLeft;\n }\n\n current = current.parentElement;\n }\n\n return scrollOffsets;\n}\n\nexport function handleExitingAnimation(\n element: HTMLElement,\n animationConfig: AnimationConfig\n) {\n const parent = element.offsetParent;\n const dummy = element.cloneNode() as ReanimatedHTMLElement;\n dummy.reanimatedDummy = true;\n\n element.style.animationName = '';\n // We hide current element so only its copy with proper animation will be displayed\n element.style.visibility = 'hidden';\n\n // After cloning the element, we want to move all children from original element to its clone. This is because original element\n // will be unmounted, therefore when this code executes in child component, parent will be either empty or removed soon.\n // Using element.cloneNode(true) doesn't solve the problem, because it creates copy of children and we won't be able to set their animations\n //\n // This loop works because appendChild() moves element into its new parent instead of copying it\n while (element.firstChild) {\n dummy.appendChild(element.firstChild);\n }\n\n setElementAnimation(dummy, animationConfig);\n parent?.appendChild(dummy);\n\n const snapshot = snapshots.get(element)!;\n\n const scrollOffsets = getElementScrollValue(element);\n\n // Scroll does not trigger snapshotting, therefore if we start exiting animation after\n // scrolling through parent component, dummy will end up in wrong place. In order to fix that\n // we keep last known scroll position in snapshot and then adjust dummy position based on\n // last known scroll offset and current scroll offset\n\n const currentScrollTopOffset = scrollOffsets.scrollTopOffset;\n const lastScrollTopOffset = snapshot.scrollOffsets.scrollTopOffset;\n\n if (currentScrollTopOffset !== lastScrollTopOffset) {\n snapshot.top += lastScrollTopOffset - currentScrollTopOffset;\n }\n\n const currentScrollLeftOffset = scrollOffsets.scrollLeftOffset;\n const lastScrollLeftOffset = snapshot.scrollOffsets.scrollLeftOffset;\n\n if (currentScrollLeftOffset !== lastScrollLeftOffset) {\n snapshot.left += lastScrollLeftOffset - currentScrollLeftOffset;\n }\n\n snapshots.set(dummy, snapshot);\n\n setDummyPosition(dummy, snapshot);\n\n const originalOnAnimationEnd = dummy.onanimationend;\n\n dummy.onanimationend = function (event: AnimationEvent) {\n if (parent?.contains(dummy)) {\n dummy.removedAfterAnimation = true;\n parent.removeChild(dummy);\n }\n\n // Given that this function overrides onAnimationEnd, it won't be null\n originalOnAnimationEnd?.call(this, event);\n };\n\n dummy.addEventListener('animationcancel', () => {\n if (parent?.contains(dummy)) {\n dummy.removedAfterAnimation = true;\n parent.removeChild(dummy);\n }\n });\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,UAAU,EAAEC,cAAc,EAAEC,UAAU,QAAQ,UAAU;AAQjE,SAASC,wBAAwB,QAAQ,mBAAmB;AAE5D,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,wBAAwB,QAAQ,YAAY;AACrD,SAASC,cAAc,QAAQ,qBAAqB;AAEpD,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AAC5B,cAAc;EAEnD4B,KAAK,CAAC5B,cAAc,GAAG,UAAUuC,KAAqB,EAAE;IACtD,IAAIb,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEc,QAAQ,CAACZ,KAAK,CAAC,EAAE;MAC3BA,KAAK,CAACa,qBAAqB,GAAG,IAAI;MAClCf,MAAM,CAACgB,WAAW,CAACd,KAAK,CAAC;IAC3B;;IAEA;IACAU,sBAAsB,aAAtBA,sBAAsB,eAAtBA,sBAAsB,CAAEpC,IAAI,CAAC,IAAI,EAAEqC,KAAK,CAAC;EAC3C,CAAC;EAEDX,KAAK,CAAClB,gBAAgB,CAAC,iBAAiB,EAAE,MAAM;IAC9C,IAAIgB,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEc,QAAQ,CAACZ,KAAK,CAAC,EAAE;MAC3BA,KAAK,CAACa,qBAAqB,GAAG,IAAI;MAClCf,MAAM,CAACgB,WAAW,CAACd,KAAK,CAAC;IAC3B;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["BounceIn","BounceInData","BounceOut","BounceOutData","FadeIn","FadeInData","FadeOut","FadeOutData","FlipIn","FlipInData","FlipOut","FlipOutData","LightSpeedIn","LightSpeedInData","LightSpeedOut","LightSpeedOutData","Pinwheel","PinwheelData","RollIn","RollInData","RollOut","RollOutData","RotateIn","RotateInData","RotateOut","RotateOutData","SlideIn","SlideInData","SlideOut","SlideOutData","StretchIn","StretchInData","StretchOut","StretchOutData","ZoomIn","ZoomInData","ZoomOut","ZoomOutData","TransitionType","AnimationsData","Animations","WebEasings","linear","ease","quad","cubic","sin","circle","exp"],"sources":["config.ts"],"sourcesContent":["'use strict';\nimport type { ReduceMotion } from '../../commonTypes';\nimport type { LayoutAnimationType } from '../animationBuilder/commonTypes';\nimport {\n BounceIn,\n BounceInData,\n BounceOut,\n BounceOutData,\n} from './animation/Bounce.web';\nimport { FadeIn, FadeInData, FadeOut, FadeOutData } from './animation/Fade.web';\nimport { FlipIn, FlipInData, FlipOut, FlipOutData } from './animation/Flip.web';\nimport {\n LightSpeedIn,\n LightSpeedInData,\n LightSpeedOut,\n LightSpeedOutData,\n} from './animation/Lightspeed.web';\nimport { Pinwheel, PinwheelData } from './animation/Pinwheel.web';\nimport { RollIn, RollInData, RollOut, RollOutData } from './animation/Roll.web';\nimport {\n RotateIn,\n RotateInData,\n RotateOut,\n RotateOutData,\n} from './animation/Rotate.web';\nimport {\n SlideIn,\n SlideInData,\n SlideOut,\n SlideOutData,\n} from './animation/Slide.web';\nimport {\n StretchIn,\n StretchInData,\n StretchOut,\n StretchOutData,\n} from './animation/Stretch.web';\nimport { ZoomIn, ZoomInData, ZoomOut, ZoomOutData } from './animation/Zoom.web';\n\nimport type { AnimationData } from './animationParser';\n\nexport type AnimationCallback = ((finished: boolean) => void) | null;\n\nexport interface AnimationConfig {\n animationName: string;\n animationType: LayoutAnimationType;\n duration: number;\n delay: number;\n easing: string;\n callback: AnimationCallback;\n reversed: boolean;\n}\n\nexport interface CustomConfig {\n easingV?: () => number;\n durationV?: number;\n delayV?: number;\n randomizeDelay?: boolean;\n reduceMotionV?: ReduceMotion;\n callbackV?: AnimationCallback;\n reversed?: boolean;\n}\n\nexport enum TransitionType {\n LINEAR,\n SEQUENCED,\n FADING,\n}\n\nexport const AnimationsData: Record<string, AnimationData> = {\n ...FadeInData,\n ...FadeOutData,\n ...BounceInData,\n ...BounceOutData,\n ...FlipInData,\n ...FlipOutData,\n ...StretchInData,\n ...StretchOutData,\n ...ZoomInData,\n ...ZoomOutData,\n ...SlideInData,\n ...SlideOutData,\n ...LightSpeedInData,\n ...LightSpeedOutData,\n ...PinwheelData,\n ...RotateInData,\n ...RotateOutData,\n ...RollInData,\n ...RollOutData,\n};\n\nexport const Animations = {\n ...FadeIn,\n ...FadeOut,\n ...BounceIn,\n ...BounceOut,\n ...FlipIn,\n ...FlipOut,\n ...StretchIn,\n ...StretchOut,\n ...ZoomIn,\n ...ZoomOut,\n ...SlideIn,\n ...SlideOut,\n ...LightSpeedIn,\n ...LightSpeedOut,\n ...Pinwheel,\n ...RotateIn,\n ...RotateOut,\n ...RollIn,\n ...RollOut,\n};\n\n// Those are the easings that can be implemented using Bezier curves.\n// Others should be done as CSS animations\nexport const WebEasings = {\n linear: [0, 0, 1, 1],\n ease: [0.42, 0, 1, 1],\n quad: [0.11, 0, 0.5, 0],\n cubic: [0.32, 0, 0.67, 0],\n sin: [0.12, 0, 0.39, 0],\n circle: [0.55, 0, 1, 0.45],\n exp: [0.7, 0, 0.84, 0],\n};\n\nexport type AnimationNames = keyof typeof Animations;\nexport type LayoutTransitionsNames = keyof typeof AnimationsData;\nexport type WebEasingsNames = keyof typeof WebEasings;\n"],"mappings":"AAAA,YAAY;;AAGZ,SACEA,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,aAAa,QACR,wBAAwB;AAC/B,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,sBAAsB;AAC/E,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,sBAAsB;AAC/E,SACEC,YAAY,EACZC,gBAAgB,EAChBC,aAAa,EACbC,iBAAiB,QACZ,4BAA4B;AACnC,SAASC,QAAQ,EAAEC,YAAY,QAAQ,0BAA0B;AACjE,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,sBAAsB;AAC/E,SACEC,QAAQ,EACRC,YAAY,EACZC,SAAS,EACTC,aAAa,QACR,wBAAwB;AAC/B,SACEC,OAAO,EACPC,WAAW,EACXC,QAAQ,EACRC,YAAY,QACP,uBAAuB;AAC9B,SACEC,SAAS,EACTC,aAAa,EACbC,UAAU,EACVC,cAAc,QACT,yBAAyB;AAChC,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,sBAAsB;AA0B/E,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA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EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;EACvBC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC;EAC1BC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC"}
1
+ {"version":3,"names":["BounceIn","BounceInData","BounceOut","BounceOutData","FadeIn","FadeInData","FadeOut","FadeOutData","FlipIn","FlipInData","FlipOut","FlipOutData","LightSpeedIn","LightSpeedInData","LightSpeedOut","LightSpeedOutData","Pinwheel","PinwheelData","RollIn","RollInData","RollOut","RollOutData","RotateIn","RotateInData","RotateOut","RotateOutData","SlideIn","SlideInData","SlideOut","SlideOutData","StretchIn","StretchInData","StretchOut","StretchOutData","ZoomIn","ZoomInData","ZoomOut","ZoomOutData","TransitionType","AnimationsData","Animations","WebEasings","linear","ease","quad","cubic","sin","circle","exp"],"sources":["config.ts"],"sourcesContent":["'use strict';\nimport type { ReduceMotion } from '../../commonTypes';\nimport type { LayoutAnimationType } from '../animationBuilder/commonTypes';\nimport {\n BounceIn,\n BounceInData,\n BounceOut,\n BounceOutData,\n} from './animation/Bounce.web';\nimport { FadeIn, FadeInData, FadeOut, FadeOutData } from './animation/Fade.web';\nimport { FlipIn, FlipInData, FlipOut, FlipOutData } from './animation/Flip.web';\nimport {\n LightSpeedIn,\n LightSpeedInData,\n LightSpeedOut,\n LightSpeedOutData,\n} from './animation/Lightspeed.web';\nimport { Pinwheel, PinwheelData } from './animation/Pinwheel.web';\nimport { RollIn, RollInData, RollOut, RollOutData } from './animation/Roll.web';\nimport {\n RotateIn,\n RotateInData,\n RotateOut,\n RotateOutData,\n} from './animation/Rotate.web';\nimport {\n SlideIn,\n SlideInData,\n SlideOut,\n SlideOutData,\n} from './animation/Slide.web';\nimport {\n StretchIn,\n StretchInData,\n StretchOut,\n StretchOutData,\n} from './animation/Stretch.web';\nimport { ZoomIn, ZoomInData, ZoomOut, ZoomOutData } from './animation/Zoom.web';\n\nimport type { AnimationData } from './animationParser';\n\nexport type AnimationCallback = ((finished: boolean) => void) | null;\n\nexport interface AnimationConfig {\n animationName: string;\n animationType: LayoutAnimationType;\n duration: number;\n delay: number;\n easing: string;\n callback: AnimationCallback;\n reversed: boolean;\n}\n\nexport interface CustomConfig {\n easingV?: () => number;\n durationV?: number;\n delayV?: number;\n randomizeDelay?: boolean;\n reduceMotionV?: ReduceMotion;\n callbackV?: AnimationCallback;\n reversed?: boolean;\n}\n\nexport enum TransitionType {\n LINEAR,\n SEQUENCED,\n FADING,\n}\n\nexport const AnimationsData: Record<string, AnimationData> = {\n ...FadeInData,\n ...FadeOutData,\n ...BounceInData,\n ...BounceOutData,\n ...FlipInData,\n ...FlipOutData,\n ...StretchInData,\n ...StretchOutData,\n ...ZoomInData,\n ...ZoomOutData,\n ...SlideInData,\n ...SlideOutData,\n ...LightSpeedInData,\n ...LightSpeedOutData,\n ...PinwheelData,\n ...RotateInData,\n ...RotateOutData,\n ...RollInData,\n ...RollOutData,\n};\n\nexport const Animations = {\n ...FadeIn,\n ...FadeOut,\n ...BounceIn,\n ...BounceOut,\n ...FlipIn,\n ...FlipOut,\n ...StretchIn,\n ...StretchOut,\n ...ZoomIn,\n ...ZoomOut,\n ...SlideIn,\n ...SlideOut,\n ...LightSpeedIn,\n ...LightSpeedOut,\n ...Pinwheel,\n ...RotateIn,\n ...RotateOut,\n ...RollIn,\n ...RollOut,\n};\n\n// Those are the easings that can be implemented using Bezier curves.\n// Others should be done as CSS animations\nexport const WebEasings = {\n linear: [0, 0, 1, 1],\n ease: [0.42, 0, 1, 1],\n quad: [0.11, 0, 0.5, 0],\n cubic: [0.32, 0, 0.67, 0],\n sin: [0.12, 0, 0.39, 0],\n circle: [0.55, 0, 1, 0.45],\n exp: [0.7, 0, 0.84, 0],\n};\n\nexport type AnimationNames = keyof typeof Animations;\nexport type LayoutTransitionsNames = keyof typeof AnimationsData;\nexport type WebEasingsNames = keyof typeof WebEasings;\n"],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AU;EACb,GAAGE;AACL,CAAC;AAED,OAAO,MAAMmB,UAAU,GAAG;EACxB,GAAGpC,MAAM;EACT,GAAGE,OAAO;EACV,GAAGN,QAAQ;EACX,GAAGE,SAAS;EACZ,GAAGM,MAAM;EACT,GAAGE,OAAO;EACV,GAAGoB,SAAS;EACZ,GAAGE,UAAU;EACb,GAAGE,MAAM;EACT,GAAGE,OAAO;EACV,GAAGV,OAAO;EACV,GAAGE,QAAQ;EACX,GAAGhB,YAAY;EACf,GAAGE,aAAa;EAChB,GAAGE,QAAQ;EACX,GAAGM,QAAQ;EACX,GAAGE,SAAS;EACZ,GAAGN,MAAM;EACT,GAAGE;AACL,CAAC;;AAED;AACA;AACA,OAAO,MAAMqB,UAAU,GAAG;EACxBC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACpBC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACrBC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;EACvBC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;EACzBC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;EACvBC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC;EAC1BC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC","ignoreList":[]}
@@ -8,7 +8,7 @@ import { FadingTransition } from './transition/Fading.web';
8
8
  import { insertWebAnimation } from './domUtils';
9
9
 
10
10
  // Translate values are passed as numbers. However, if `translate` property receives number, it will not automatically
11
- // convert it to `px`. Therefore if we want to keep exisitng transform we have to add 'px' suffix to each of translate values
11
+ // convert it to `px`. Therefore if we want to keep existing transform we have to add 'px' suffix to each of translate values
12
12
  // that are present inside transform.
13
13
  function addPxToTranslate(existingTransform) {
14
14
  // @ts-ignore `existingTransform` cannot be string because in that case
@@ -30,7 +30,7 @@ function addPxToTranslate(existingTransform) {
30
30
  return newTransform;
31
31
  }
32
32
 
33
- // In order to keep exisitng transform throughout animation, we have to add it to each of keyframe step.
33
+ // In order to keep existing transform throughout animation, we have to add it to each of keyframe step.
34
34
  function addExistingTransform(newAnimationData, newTransform) {
35
35
  for (const keyframeStepProperties of Object.values(newAnimationData.style)) {
36
36
  if (!keyframeStepProperties.transform) {
@@ -1 +1 @@
1
- {"version":3,"names":["Animations","AnimationsData","TransitionType","convertAnimationObjectToKeyframes","LinearTransition","SequencedTransition","FadingTransition","insertWebAnimation","addPxToTranslate","existingTransform","newTransform","map","transformProp","newTransformProp","key","value","Object","entries","includes","addExistingTransform","newAnimationData","keyframeStepProperties","values","style","transform","Array","prototype","unshift","apply","createAnimationWithExistingTransform","animationName","layoutTransition","structuredClone","keyframeName","generateNextCustomKeyframeName","name","keyframe","customKeyframeCounter","TransitionGenerator","transitionType","transitionData","transitionKeyframeName","transitionObject","LINEAR","SEQUENCED","FADING","transitionKeyframe"],"sources":["createAnimation.ts"],"sourcesContent":["'use strict';\n\nimport { Animations, AnimationsData, TransitionType } from './config';\nimport { convertAnimationObjectToKeyframes } from './animationParser';\nimport type {\n AnimationData,\n ReanimatedWebTransformProperties,\n TransitionData,\n} from './animationParser';\nimport type { TransformsStyle } from 'react-native';\nimport { LinearTransition } from './transition/Linear.web';\nimport { SequencedTransition } from './transition/Sequenced.web';\nimport { FadingTransition } from './transition/Fading.web';\nimport { insertWebAnimation } from './domUtils';\n\n// Translate values are passed as numbers. However, if `translate` property receives number, it will not automatically\n// convert it to `px`. Therefore if we want to keep exisitng transform we have to add 'px' suffix to each of translate values\n// that are present inside transform.\nfunction addPxToTranslate(\n existingTransform: NonNullable<TransformsStyle['transform']>\n) {\n type RNTransformProp = (typeof existingTransform)[number];\n\n // @ts-ignore `existingTransform` cannot be string because in that case\n // we throw error in `extractTransformFromStyle`\n const newTransform = existingTransform.map(\n (transformProp: RNTransformProp) => {\n const newTransformProp: ReanimatedWebTransformProperties = {};\n for (const [key, value] of Object.entries(transformProp)) {\n if (key.includes('translate')) {\n // @ts-ignore After many trials we decided to ignore this error - it says that we cannot use 'key' to index this object.\n // Sadly it doesn't go away after using cast `key as keyof TransformProperties`.\n newTransformProp[key] = `${value}px`;\n } else {\n // @ts-ignore same as above.\n newTransformProp[key] = value;\n }\n }\n return newTransformProp;\n }\n );\n\n return newTransform;\n}\n\n// In order to keep exisitng transform throughout animation, we have to add it to each of keyframe step.\nfunction addExistingTransform(\n newAnimationData: AnimationData,\n newTransform: ReanimatedWebTransformProperties[]\n) {\n for (const keyframeStepProperties of Object.values(newAnimationData.style)) {\n if (!keyframeStepProperties.transform) {\n // If transform doesn't exist, we add only transform that already exists\n keyframeStepProperties.transform = newTransform;\n } else {\n // We insert existing transformations before ours.\n Array.prototype.unshift.apply(\n keyframeStepProperties.transform,\n newTransform\n );\n }\n }\n}\n\n/**\n * Modifies default animation by preserving transformations that given element already contains.\n *\n * @param animationName - Name of the animation to be modified (e.g. `FadeIn`).\n * @param existingTransform - Transform values that element already contains.\n * @returns Animation parsed to keyframe string.\n */\nexport function createAnimationWithExistingTransform(\n animationName: string,\n existingTransform: NonNullable<TransformsStyle['transform']>,\n layoutTransition?: AnimationData\n) {\n let newAnimationData;\n\n if (layoutTransition) {\n newAnimationData = layoutTransition;\n } else {\n if (!(animationName in Animations)) {\n return '';\n }\n newAnimationData = structuredClone(AnimationsData[animationName]);\n }\n\n const keyframeName = generateNextCustomKeyframeName();\n\n newAnimationData.name = keyframeName;\n\n const newTransform = addPxToTranslate(existingTransform);\n\n addExistingTransform(newAnimationData, newTransform);\n\n const keyframe = convertAnimationObjectToKeyframes(newAnimationData);\n\n insertWebAnimation(keyframeName, keyframe);\n\n return keyframeName;\n}\n\nlet customKeyframeCounter = 0;\n\nfunction generateNextCustomKeyframeName() {\n return `REA${customKeyframeCounter++}`;\n}\n\n/**\n * Creates transition of given type, appends it to stylesheet and returns keyframe name.\n *\n * @param transitionType - Type of transition (e.g. LINEAR).\n * @param transitionData - Object containing data for transforms (translateX, scaleX,...).\n * @returns Keyframe name that represents transition.\n */\nexport function TransitionGenerator(\n transitionType: TransitionType,\n transitionData: TransitionData,\n existingTransform: TransformsStyle['transform'] | undefined\n) {\n const transitionKeyframeName = generateNextCustomKeyframeName();\n let transitionObject;\n\n switch (transitionType) {\n case TransitionType.LINEAR:\n transitionObject = LinearTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.SEQUENCED:\n transitionObject = SequencedTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.FADING:\n transitionObject = FadingTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n }\n\n if (existingTransform) {\n return createAnimationWithExistingTransform(\n '',\n existingTransform,\n transitionObject\n );\n }\n\n const transitionKeyframe =\n convertAnimationObjectToKeyframes(transitionObject);\n\n insertWebAnimation(transitionKeyframeName, transitionKeyframe);\n\n return transitionKeyframeName;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,UAAU,EAAEC,cAAc,EAAEC,cAAc,QAAQ,UAAU;AACrE,SAASC,iCAAiC,QAAQ,mBAAmB;AAOrE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,kBAAkB,QAAQ,YAAY;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,iBAA4D,EAC5D;EAGA;EACA;EACA,MAAMC,YAAY,GAAGD,iBAAiB,CAACE,GAAG,CACvCC,aAA8B,IAAK;IAClC,MAAMC,gBAAkD,GAAG,CAAC,CAAC;IAC7D,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,aAAa,CAAC,EAAE;MACxD,I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iC,CAACiB,gBAAgB,CAAC;EAEpEb,kBAAkB,CAAC0B,YAAY,EAAEG,QAAQ,CAAC;EAE1C,OAAOH,YAAY;AACrB;AAEA,IAAII,qBAAqB,GAAG,CAAC;AAE7B,SAASH,8BAA8BA,CAAA,EAAG;EACxC,OAAQ,MAAKG,qBAAqB,EAAG,EAAC;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,cAA8B,EAC9BC,cAA8B,EAC9B/B,iBAA2D,EAC3D;EACA,MAAMgC,sBAAsB,GAAGP,8BAA8B,EAAE;EAC/D,IAAIQ,gBAAgB;EAEpB,QAAQH,cAAc;IACpB,KAAKrC,cAAc,CAACyC,MAAM;MACxBD,gBAAgB,GAAGtC,gBAAgB,CACjCqC,sBAAsB,EACtBD,cAAc,CACf;MACD;IACF,KAAKtC,cAAc,CAAC0C,SAAS;MAC3BF,gBAAgB,GAAGrC,mBAAmB,CACpCoC,sBAAsB,EACtBD,cAAc,CACf;MACD;IACF,KAAKtC,cAAc,CAAC2C,MAAM;MACxBH,gBAAgB,GAAGpC,gBAAgB,CACjCmC,sBAAsB,EACtBD,cAAc,CACf;MACD;EAAM;EAGV,IAAI/B,iBAAiB,EAAE;IACrB,OAAOoB,oCAAoC,CACzC,EAAE,EACFpB,iBAAiB,EACjBiC,gBAAgB,CACjB;EACH;EAEA,MAAMI,kBAAkB,GACtB3C,iCAAiC,CAACuC,gBAAgB,CAAC;EAErDnC,kBAAkB,CAACkC,sBAAsB,EAAEK,kBAAkB,CAAC;EAE9D,OAAOL,sBAAsB;AAC/B"}
1
+ {"version":3,"names":["Animations","AnimationsData","TransitionType","convertAnimationObjectToKeyframes","LinearTransition","SequencedTransition","FadingTransition","insertWebAnimation","addPxToTranslate","existingTransform","newTransform","map","transformProp","newTransformProp","key","value","Object","entries","includes","addExistingTransform","newAnimationData","keyframeStepProperties","values","style","transform","Array","prototype","unshift","apply","createAnimationWithExistingTransform","animationName","layoutTransition","structuredClone","keyframeName","generateNextCustomKeyframeName","name","keyframe","customKeyframeCounter","TransitionGenerator","transitionType","transitionData","transitionKeyframeName","transitionObject","LINEAR","SEQUENCED","FADING","transitionKeyframe"],"sources":["createAnimation.ts"],"sourcesContent":["'use strict';\n\nimport { Animations, AnimationsData, TransitionType } from './config';\nimport { convertAnimationObjectToKeyframes } from './animationParser';\nimport type {\n AnimationData,\n ReanimatedWebTransformProperties,\n TransitionData,\n} from './animationParser';\nimport type { TransformsStyle } from 'react-native';\nimport { LinearTransition } from './transition/Linear.web';\nimport { SequencedTransition } from './transition/Sequenced.web';\nimport { FadingTransition } from './transition/Fading.web';\nimport { insertWebAnimation } from './domUtils';\n\n// Translate values are passed as numbers. However, if `translate` property receives number, it will not automatically\n// convert it to `px`. Therefore if we want to keep existing transform we have to add 'px' suffix to each of translate values\n// that are present inside transform.\nfunction addPxToTranslate(\n existingTransform: NonNullable<TransformsStyle['transform']>\n) {\n type RNTransformProp = (typeof existingTransform)[number];\n\n // @ts-ignore `existingTransform` cannot be string because in that case\n // we throw error in `extractTransformFromStyle`\n const newTransform = existingTransform.map(\n (transformProp: RNTransformProp) => {\n const newTransformProp: ReanimatedWebTransformProperties = {};\n for (const [key, value] of Object.entries(transformProp)) {\n if (key.includes('translate')) {\n // @ts-ignore After many trials we decided to ignore this error - it says that we cannot use 'key' to index this object.\n // Sadly it doesn't go away after using cast `key as keyof TransformProperties`.\n newTransformProp[key] = `${value}px`;\n } else {\n // @ts-ignore same as above.\n newTransformProp[key] = value;\n }\n }\n return newTransformProp;\n }\n );\n\n return newTransform;\n}\n\n// In order to keep existing transform throughout animation, we have to add it to each of keyframe step.\nfunction addExistingTransform(\n newAnimationData: AnimationData,\n newTransform: ReanimatedWebTransformProperties[]\n) {\n for (const keyframeStepProperties of Object.values(newAnimationData.style)) {\n if (!keyframeStepProperties.transform) {\n // If transform doesn't exist, we add only transform that already exists\n keyframeStepProperties.transform = newTransform;\n } else {\n // We insert existing transformations before ours.\n Array.prototype.unshift.apply(\n keyframeStepProperties.transform,\n newTransform\n );\n }\n }\n}\n\n/**\n * Modifies default animation by preserving transformations that given element already contains.\n *\n * @param animationName - Name of the animation to be modified (e.g. `FadeIn`).\n * @param existingTransform - Transform values that element already contains.\n * @returns Animation parsed to keyframe string.\n */\nexport function createAnimationWithExistingTransform(\n animationName: string,\n existingTransform: NonNullable<TransformsStyle['transform']>,\n layoutTransition?: AnimationData\n) {\n let newAnimationData;\n\n if (layoutTransition) {\n newAnimationData = layoutTransition;\n } else {\n if (!(animationName in Animations)) {\n return '';\n }\n newAnimationData = structuredClone(AnimationsData[animationName]);\n }\n\n const keyframeName = generateNextCustomKeyframeName();\n\n newAnimationData.name = keyframeName;\n\n const newTransform = addPxToTranslate(existingTransform);\n\n addExistingTransform(newAnimationData, newTransform);\n\n const keyframe = convertAnimationObjectToKeyframes(newAnimationData);\n\n insertWebAnimation(keyframeName, keyframe);\n\n return keyframeName;\n}\n\nlet customKeyframeCounter = 0;\n\nfunction generateNextCustomKeyframeName() {\n return `REA${customKeyframeCounter++}`;\n}\n\n/**\n * Creates transition of given type, appends it to stylesheet and returns keyframe name.\n *\n * @param transitionType - Type of transition (e.g. LINEAR).\n * @param transitionData - Object containing data for transforms (translateX, scaleX,...).\n * @returns Keyframe name that represents transition.\n */\nexport function TransitionGenerator(\n transitionType: TransitionType,\n transitionData: TransitionData,\n existingTransform: TransformsStyle['transform'] | undefined\n) {\n const transitionKeyframeName = generateNextCustomKeyframeName();\n let transitionObject;\n\n switch (transitionType) {\n case TransitionType.LINEAR:\n transitionObject = LinearTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.SEQUENCED:\n transitionObject = SequencedTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n case TransitionType.FADING:\n transitionObject = FadingTransition(\n transitionKeyframeName,\n transitionData\n );\n break;\n }\n\n if (existingTransform) {\n return createAnimationWithExistingTransform(\n '',\n existingTransform,\n transitionObject\n );\n }\n\n const transitionKeyframe =\n convertAnimationObjectToKeyframes(transitionObject);\n\n insertWebAnimation(transitionKeyframeName, transitionKeyframe);\n\n return transitionKeyframeName;\n}\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,UAAU,EAAEC,cAAc,EAAEC,cAAc,QAAQ,UAAU;AACrE,SAASC,iCAAiC,QAAQ,mBAAmB;AAOrE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,mBAAmB,QAAQ,4BAA4B;AAChE,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,kBAAkB,QAAQ,YAAY;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgBA,CACvBC,iBAA4D,EAC5D;EAGA;EACA;EACA,MAAMC,YAAY,GAAGD,iBAAiB,CAACE,GAAG,CACvCC,aAA8B,IAAK;IAClC,MAAMC,gBAAkD,GAAG,CAAC,CAAC;IAC7D,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,aAAa,CAAC,EAAE;MACxD,IAAIE,GAAG,CAACI,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC7B;QACA;QACAL,gBAAgB,CAACC,GAAG,CAAC,GAAI,GAAEC,KAAM,IAAG;MACtC,CAAC,MAAM;QACL;QACAF,gBAAgB,CAACC,GAAG,CAAC,GAAGC,KAAK;MAC/B;IACF;IACA,OAAOF,gBAAgB;EACzB,CACF,CAAC;EAED,OAAOH,YAAY;AACrB;;AAEA;AACA,SAASS,oBAAoBA,CAC3BC,gBAA+B,EAC/BV,YAAgD,EAChD;EACA,KAAK,MAAMW,sBAAsB,IAAIL,MAAM,CAACM,MAAM,CAACF,gBAAgB,CAACG,KAAK,CAAC,EAAE;IAC1E,IAAI,CAACF,sBAAsB,CAACG,SAAS,EAAE;MACrC;MACAH,sBAAsB,CAACG,SAAS,GAAGd,YAAY;IACjD,CAAC,MAAM;MACL;MACAe,KAAK,CAACC,SAAS,CAACC,OAAO,CAACC,KAAK,CAC3BP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AgB,GAAGrC,mBAAmB,CACpCoC,sBAAsB,EACtBD,cACF,CAAC;MACD;IACF,KAAKtC,cAAc,CAAC2C,MAAM;MACxBH,gBAAgB,GAAGpC,gBAAgB,CACjCmC,sBAAsB,EACtBD,cACF,CAAC;MACD;EACJ;EAEA,IAAI/B,iBAAiB,EAAE;IACrB,OAAOoB,oCAAoC,CACzC,EAAE,EACFpB,iBAAiB,EACjBiC,gBACF,CAAC;EACH;EAEA,MAAMI,kBAAkB,GACtB3C,iCAAiC,CAACuC,gBAAgB,CAAC;EAErDnC,kBAAkB,CAACkC,sBAAsB,EAAEK,kBAAkB,CAAC;EAE9D,OAAOL,sBAAsB;AAC/B","ignoreList":[]}
@@ -70,7 +70,7 @@ function removeWebAnimation(animationName) {
70
70
  if (currentAnimationIndex === undefined) {
71
71
  throw new Error('[Reanimated] Failed to obtain animation index.');
72
72
  }
73
- (_styleTag$sheet = styleTag.sheet) === null || _styleTag$sheet === void 0 ? void 0 : _styleTag$sheet.deleteRule(currentAnimationIndex);
73
+ (_styleTag$sheet = styleTag.sheet) === null || _styleTag$sheet === void 0 || _styleTag$sheet.deleteRule(currentAnimationIndex);
74
74
  animationNameList.splice(currentAnimationIndex, 1);
75
75
  animationNameToIndex.delete(animationName);
76
76
  for (let i = currentAnimationIndex; i < animationNameList.length; ++i) {
@@ -107,7 +107,7 @@ function reattachElementToAncestor(child, parent) {
107
107
  parent.removeChild(child);
108
108
 
109
109
  // Given that this function overrides onAnimationEnd, it won't be null
110
- originalOnAnimationEnd === null || originalOnAnimationEnd === void 0 ? void 0 : originalOnAnimationEnd.call(this, event);
110
+ originalOnAnimationEnd === null || originalOnAnimationEnd === void 0 || originalOnAnimationEnd.call(this, event);
111
111
  };
112
112
  }
113
113
  function findDescendantWithExitingAnimation(node, root) {
@@ -125,7 +125,7 @@ function findDescendantWithExitingAnimation(node, root) {
125
125
  }
126
126
  }
127
127
  function checkIfScreenWasChanged(mutationTarget) {
128
- var _mutationTarget$react, _mutationTarget$react2, _mutationTarget$react3;
128
+ var _mutationTarget$react;
129
129
  let reactFiberKey = '__reactFiber';
130
130
  for (const key of Object.keys(mutationTarget)) {
131
131
  if (key.startsWith('__reactFiber')) {
@@ -133,7 +133,7 @@ function checkIfScreenWasChanged(mutationTarget) {
133
133
  break;
134
134
  }
135
135
  }
136
- return ((_mutationTarget$react = mutationTarget[reactFiberKey]) === null || _mutationTarget$react === void 0 ? void 0 : (_mutationTarget$react2 = _mutationTarget$react.child) === null || _mutationTarget$react2 === void 0 ? void 0 : (_mutationTarget$react3 = _mutationTarget$react2.memoizedProps) === null || _mutationTarget$react3 === void 0 ? void 0 : _mutationTarget$react3.navigation) !== undefined;
136
+ return ((_mutationTarget$react = mutationTarget[reactFiberKey]) === null || _mutationTarget$react === void 0 || (_mutationTarget$react = _mutationTarget$react.child) === null || _mutationTarget$react === void 0 || (_mutationTarget$react = _mutationTarget$react.memoizedProps) === null || _mutationTarget$react === void 0 ? void 0 : _mutationTarget$react.navigation) !== undefined;
137
137
  }
138
138
  export function addHTMLMutationObserver() {
139
139
  if (isObserverSet || !isWindowAvailable()) {
@@ -1 +1 @@
1
- {"version":3,"names":["isWindowAvailable","setDummyPosition","snapshots","Animations","PREDEFINED_WEB_ANIMATIONS_ID","CUSTOM_WEB_ANIMATIONS_ID","animationNameToIndex","Map","animationNameList","isObserverSet","configureWebLayoutAnimations","document","getElementById","predefinedAnimationsStyleTag","createElement","id","onload","sheet","console","error","animationName","insertRule","style","customAnimationsStyleTag","head","appendChild","insertWebAnimation","keyframe","styleTag","unshift","set","i","length","nextAnimationName","nextAnimationIndex","get","undefined","Error","removeWebAnimation","_styleTag$sheet","currentAnimationIndex","deleteRule","splice","delete","timeoutScale","frameDurationMs","minimumFrames","scheduleAnimationCleanup","animationDuration","timeoutValue","Math","max","setTimeout","reattachElementToAncestor","child","parent","childSnapshot","removedAfterAnimation","originalOnAnimationEnd","onanimationend","event","removeChild","call","findDescendantWithExitingAnimation","node","root","HTMLElement","reanimatedDummy","children","Array","from","checkIfScreenWasChanged","mutationTarget","_mutationTarget$react","_mutationTarget$react2","_mutationTarget$react3","reactFiberKey","key","Object","keys","startsWith","memoizedProps","navigation","addHTMLMutationObserver","observer","MutationObserver","mutationsList","rootMutation","target","removedNodes","observe","body","childList","subtree","areDOMRectsEqual","r1","r2","x","y","width","height"],"sources":["domUtils.ts"],"sourcesContent":["'use strict';\n\nimport type { ReanimatedHTMLElement } from '../../js-reanimated';\nimport { isWindowAvailable } from '../../PlatformChecker';\nimport { setDummyPosition, snapshots } from './componentStyle';\nimport { Animations } from './config';\nimport type { AnimationNames } from './config';\n\nconst PREDEFINED_WEB_ANIMATIONS_ID = 'ReanimatedPredefinedWebAnimationsStyle';\nconst CUSTOM_WEB_ANIMATIONS_ID = 'ReanimatedCustomWebAnimationsStyle';\n\n// Since we cannot remove keyframe from DOM by its name, we have to store its id\nconst animationNameToIndex = new Map<string, number>();\nconst animationNameList: string[] = [];\n\nlet isObserverSet = false;\n\n/**\n * Creates `HTMLStyleElement`, inserts it into DOM and then inserts CSS rules into the stylesheet.\n * If style element already exists, nothing happens.\n */\nexport function configureWebLayoutAnimations() {\n if (\n !isWindowAvailable() || // Without this check SSR crashes because document is undefined (NextExample on CI)\n document.getElementById(PREDEFINED_WEB_ANIMATIONS_ID) !== null\n ) {\n return;\n }\n\n const predefinedAnimationsStyleTag = document.createElement('style');\n predefinedAnimationsStyleTag.id = PREDEFINED_WEB_ANIMATIONS_ID;\n\n predefinedAnimationsStyleTag.onload = () => {\n if (!predefinedAnimationsStyleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n for (const animationName in Animations) {\n predefinedAnimationsStyleTag.sheet.insertRule(\n Animations[animationName as AnimationNames].style\n );\n }\n };\n\n const customAnimationsStyleTag = document.createElement('style');\n customAnimationsStyleTag.id = CUSTOM_WEB_ANIMATIONS_ID;\n\n document.head.appendChild(predefinedAnimationsStyleTag);\n document.head.appendChild(customAnimationsStyleTag);\n}\n\nexport function insertWebAnimation(animationName: string, keyframe: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n if (!styleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n styleTag.sheet.insertRule(keyframe, 0);\n animationNameList.unshift(animationName);\n animationNameToIndex.set(animationName, 0);\n\n for (let i = 1; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex + 1);\n }\n}\n\nfunction removeWebAnimation(animationName: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n const currentAnimationIndex = animationNameToIndex.get(animationName);\n\n if (currentAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n styleTag.sheet?.deleteRule(currentAnimationIndex);\n animationNameList.splice(currentAnimationIndex, 1);\n animationNameToIndex.delete(animationName);\n\n for (let i = currentAnimationIndex; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex - 1);\n }\n}\n\nconst timeoutScale = 1.25; // We use this value to enlarge timeout duration. It can prove useful if animation lags.\nconst frameDurationMs = 16; // Just an approximation.\nconst minimumFrames = 10;\n\nexport function scheduleAnimationCleanup(\n animationName: string,\n animationDuration: number\n) {\n // If duration is very short, we want to keep remove delay to at least 10 frames\n // In our case it is exactly 160/1099 s, which is approximately 0.15s\n const timeoutValue = Math.max(\n animationDuration * timeoutScale * 1000,\n animationDuration + frameDurationMs * minimumFrames\n );\n\n setTimeout(() => removeWebAnimation(animationName), timeoutValue);\n}\n\nfunction reattachElementToAncestor(child: ReanimatedHTMLElement, parent: Node) {\n const childSnapshot = snapshots.get(child);\n\n if (!childSnapshot) {\n console.error('[Reanimated] Failed to obtain snapshot.');\n return;\n }\n\n // We use that so we don't end up in infinite loop\n child.removedAfterAnimation = true;\n parent.appendChild(child);\n\n setDummyPosition(child, childSnapshot);\n\n const originalOnAnimationEnd = child.onanimationend;\n\n child.onanimationend = function (event: AnimationEvent) {\n parent.removeChild(child);\n\n // Given that this function overrides onAnimationEnd, it won't be null\n originalOnAnimationEnd?.call(this, event);\n };\n}\n\nfunction findDescendantWithExitingAnimation(\n node: ReanimatedHTMLElement,\n root: Node\n) {\n // Node could be something else than HTMLElement, for example TextNode (treated as plain text, not as HTML object),\n // therefore it won't have children prop and calling Array.from(node.children) will cause error.\n if (!(node instanceof HTMLElement)) {\n return;\n }\n\n if (node.reanimatedDummy && node.removedAfterAnimation === undefined) {\n reattachElementToAncestor(node, root);\n }\n\n const children = Array.from(node.children);\n\n for (let i = 0; i < children.length; ++i) {\n findDescendantWithExitingAnimation(\n children[i] as ReanimatedHTMLElement,\n root\n );\n }\n}\n\ntype FiberNodeKey = `__reactFiber${string}`;\n\ninterface FiberNode {\n memoizedProps?: {\n navigation?: unknown;\n };\n\n child?: FiberNode;\n}\n\ntype WithFiberNode = {\n [key: FiberNodeKey]: FiberNode;\n};\n\ntype MaybeWithFiberNode = Partial<WithFiberNode>;\n\nfunction checkIfScreenWasChanged(\n mutationTarget: ReanimatedHTMLElement & MaybeWithFiberNode\n) {\n let reactFiberKey: FiberNodeKey = '__reactFiber';\n\n for (const key of Object.keys(mutationTarget)) {\n if (key.startsWith('__reactFiber')) {\n reactFiberKey = key as FiberNodeKey;\n break;\n }\n }\n\n return (\n mutationTarget[reactFiberKey]?.child?.memoizedProps?.navigation !==\n undefined\n );\n}\n\nexport function addHTMLMutationObserver() {\n if (isObserverSet || !isWindowAvailable()) {\n return;\n }\n\n isObserverSet = true;\n\n const observer = new MutationObserver((mutationsList) => {\n const rootMutation = mutationsList[mutationsList.length - 1];\n\n if (\n checkIfScreenWasChanged(\n rootMutation.target as ReanimatedHTMLElement & MaybeWithFiberNode\n )\n ) {\n return;\n }\n\n for (let i = 0; i < rootMutation.removedNodes.length; ++i) {\n findDescendantWithExitingAnimation(\n rootMutation.removedNodes[i] as ReanimatedHTMLElement,\n rootMutation.target\n );\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\nexport function areDOMRectsEqual(r1: DOMRect, r2: DOMRect) {\n // There are 4 more fields, but checking these should suffice\n return (\n r1.x === r2.x &&\n r1.y === r2.y &&\n r1.width === r2.width &&\n r1.height === r2.height\n );\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,kBAAkB;AAC9D,SAASC,UAAU,QAAQ,UAAU;AAGrC,MAAMC,4BAA4B,GAAG,wCAAwC;AAC7E,MAAMC,wBAAwB,GAAG,oCAAoC;;AAErE;AACA,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,EAAkB;AACtD,MAAMC,iBAA2B,GAAG,EAAE;AAEtC,IAAIC,aAAa,GAAG,KAAK;;AAEzB;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAA,EAAG;EAC7C,IACE,CAACV,iBAAiB,EAAE;EAAI;EACxBW,QAAQ,CAACC,cAAc,CAACR,4BAA4B,CAAC,KAAK,IAAI,EAC9D;IACA;EACF;EAEA,MAAMS,4BAA4B,GAAGF,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EACpED,4BAA4B,CAACE,EAAE,GAAGX,4BAA4B;EAE9DS,4BAA4B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CAAC,GAAGwD,YAAY,CAACE,YAAY,CAACzD,MAAM,EAAE,EAAED,CAAC,EAAE;MACzDgC,kCAAkC,CAChCwB,YAAY,CAACE,YAAY,CAAC1D,CAAC,CAAC,EAC5BwD,YAAY,CAACC,MAAM,CACpB;IACH;EACF,CAAC,CAAC;EAEFJ,QAAQ,CAACM,OAAO,CAAC/E,QAAQ,CAACgF,IAAI,EAAE;IAAEC,SAAS,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;AACrE;AAEA,OAAO,SAASC,gBAAgBA,CAACC,EAAW,EAAEC,EAAW,EAAE;EACzD;EACA,OACED,EAAE,CAACE,CAAC,KAAKD,EAAE,CAACC,CAAC,IACbF,EAAE,CAACG,CAAC,KAAKF,EAAE,CAACE,CAAC,IACbH,EAAE,CAACI,KAAK,KAAKH,EAAE,CAACG,KAAK,IACrBJ,EAAE,CAACK,MAAM,KAAKJ,EAAE,CAACI,MAAM;AAE3B"}
1
+ {"version":3,"names":["isWindowAvailable","setDummyPosition","snapshots","Animations","PREDEFINED_WEB_ANIMATIONS_ID","CUSTOM_WEB_ANIMATIONS_ID","animationNameToIndex","Map","animationNameList","isObserverSet","configureWebLayoutAnimations","document","getElementById","predefinedAnimationsStyleTag","createElement","id","onload","sheet","console","error","animationName","insertRule","style","customAnimationsStyleTag","head","appendChild","insertWebAnimation","keyframe","styleTag","unshift","set","i","length","nextAnimationName","nextAnimationIndex","get","undefined","Error","removeWebAnimation","_styleTag$sheet","currentAnimationIndex","deleteRule","splice","delete","timeoutScale","frameDurationMs","minimumFrames","scheduleAnimationCleanup","animationDuration","timeoutValue","Math","max","setTimeout","reattachElementToAncestor","child","parent","childSnapshot","removedAfterAnimation","originalOnAnimationEnd","onanimationend","event","removeChild","call","findDescendantWithExitingAnimation","node","root","HTMLElement","reanimatedDummy","children","Array","from","checkIfScreenWasChanged","mutationTarget","_mutationTarget$react","reactFiberKey","key","Object","keys","startsWith","memoizedProps","navigation","addHTMLMutationObserver","observer","MutationObserver","mutationsList","rootMutation","target","removedNodes","observe","body","childList","subtree","areDOMRectsEqual","r1","r2","x","y","width","height"],"sources":["domUtils.ts"],"sourcesContent":["'use strict';\n\nimport type { ReanimatedHTMLElement } from '../../js-reanimated';\nimport { isWindowAvailable } from '../../PlatformChecker';\nimport { setDummyPosition, snapshots } from './componentStyle';\nimport { Animations } from './config';\nimport type { AnimationNames } from './config';\n\nconst PREDEFINED_WEB_ANIMATIONS_ID = 'ReanimatedPredefinedWebAnimationsStyle';\nconst CUSTOM_WEB_ANIMATIONS_ID = 'ReanimatedCustomWebAnimationsStyle';\n\n// Since we cannot remove keyframe from DOM by its name, we have to store its id\nconst animationNameToIndex = new Map<string, number>();\nconst animationNameList: string[] = [];\n\nlet isObserverSet = false;\n\n/**\n * Creates `HTMLStyleElement`, inserts it into DOM and then inserts CSS rules into the stylesheet.\n * If style element already exists, nothing happens.\n */\nexport function configureWebLayoutAnimations() {\n if (\n !isWindowAvailable() || // Without this check SSR crashes because document is undefined (NextExample on CI)\n document.getElementById(PREDEFINED_WEB_ANIMATIONS_ID) !== null\n ) {\n return;\n }\n\n const predefinedAnimationsStyleTag = document.createElement('style');\n predefinedAnimationsStyleTag.id = PREDEFINED_WEB_ANIMATIONS_ID;\n\n predefinedAnimationsStyleTag.onload = () => {\n if (!predefinedAnimationsStyleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n for (const animationName in Animations) {\n predefinedAnimationsStyleTag.sheet.insertRule(\n Animations[animationName as AnimationNames].style\n );\n }\n };\n\n const customAnimationsStyleTag = document.createElement('style');\n customAnimationsStyleTag.id = CUSTOM_WEB_ANIMATIONS_ID;\n\n document.head.appendChild(predefinedAnimationsStyleTag);\n document.head.appendChild(customAnimationsStyleTag);\n}\n\nexport function insertWebAnimation(animationName: string, keyframe: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n if (!styleTag.sheet) {\n console.error(\n '[Reanimated] Failed to create layout animations stylesheet.'\n );\n return;\n }\n\n styleTag.sheet.insertRule(keyframe, 0);\n animationNameList.unshift(animationName);\n animationNameToIndex.set(animationName, 0);\n\n for (let i = 1; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex + 1);\n }\n}\n\nfunction removeWebAnimation(animationName: string) {\n // Without this check SSR crashes because document is undefined (NextExample on CI)\n if (!isWindowAvailable()) {\n return;\n }\n\n const styleTag = document.getElementById(\n CUSTOM_WEB_ANIMATIONS_ID\n ) as HTMLStyleElement;\n\n const currentAnimationIndex = animationNameToIndex.get(animationName);\n\n if (currentAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n styleTag.sheet?.deleteRule(currentAnimationIndex);\n animationNameList.splice(currentAnimationIndex, 1);\n animationNameToIndex.delete(animationName);\n\n for (let i = currentAnimationIndex; i < animationNameList.length; ++i) {\n const nextAnimationName = animationNameList[i];\n const nextAnimationIndex = animationNameToIndex.get(nextAnimationName);\n\n if (nextAnimationIndex === undefined) {\n throw new Error('[Reanimated] Failed to obtain animation index.');\n }\n\n animationNameToIndex.set(animationNameList[i], nextAnimationIndex - 1);\n }\n}\n\nconst timeoutScale = 1.25; // We use this value to enlarge timeout duration. It can prove useful if animation lags.\nconst frameDurationMs = 16; // Just an approximation.\nconst minimumFrames = 10;\n\nexport function scheduleAnimationCleanup(\n animationName: string,\n animationDuration: number\n) {\n // If duration is very short, we want to keep remove delay to at least 10 frames\n // In our case it is exactly 160/1099 s, which is approximately 0.15s\n const timeoutValue = Math.max(\n animationDuration * timeoutScale * 1000,\n animationDuration + frameDurationMs * minimumFrames\n );\n\n setTimeout(() => removeWebAnimation(animationName), timeoutValue);\n}\n\nfunction reattachElementToAncestor(child: ReanimatedHTMLElement, parent: Node) {\n const childSnapshot = snapshots.get(child);\n\n if (!childSnapshot) {\n console.error('[Reanimated] Failed to obtain snapshot.');\n return;\n }\n\n // We use that so we don't end up in infinite loop\n child.removedAfterAnimation = true;\n parent.appendChild(child);\n\n setDummyPosition(child, childSnapshot);\n\n const originalOnAnimationEnd = child.onanimationend;\n\n child.onanimationend = function (event: AnimationEvent) {\n parent.removeChild(child);\n\n // Given that this function overrides onAnimationEnd, it won't be null\n originalOnAnimationEnd?.call(this, event);\n };\n}\n\nfunction findDescendantWithExitingAnimation(\n node: ReanimatedHTMLElement,\n root: Node\n) {\n // Node could be something else than HTMLElement, for example TextNode (treated as plain text, not as HTML object),\n // therefore it won't have children prop and calling Array.from(node.children) will cause error.\n if (!(node instanceof HTMLElement)) {\n return;\n }\n\n if (node.reanimatedDummy && node.removedAfterAnimation === undefined) {\n reattachElementToAncestor(node, root);\n }\n\n const children = Array.from(node.children);\n\n for (let i = 0; i < children.length; ++i) {\n findDescendantWithExitingAnimation(\n children[i] as ReanimatedHTMLElement,\n root\n );\n }\n}\n\ntype FiberNodeKey = `__reactFiber${string}`;\n\ninterface FiberNode {\n memoizedProps?: {\n navigation?: unknown;\n };\n\n child?: FiberNode;\n}\n\ntype WithFiberNode = {\n [key: FiberNodeKey]: FiberNode;\n};\n\ntype MaybeWithFiberNode = Partial<WithFiberNode>;\n\nfunction checkIfScreenWasChanged(\n mutationTarget: ReanimatedHTMLElement & MaybeWithFiberNode\n) {\n let reactFiberKey: FiberNodeKey = '__reactFiber';\n\n for (const key of Object.keys(mutationTarget)) {\n if (key.startsWith('__reactFiber')) {\n reactFiberKey = key as FiberNodeKey;\n break;\n }\n }\n\n return (\n mutationTarget[reactFiberKey]?.child?.memoizedProps?.navigation !==\n undefined\n );\n}\n\nexport function addHTMLMutationObserver() {\n if (isObserverSet || !isWindowAvailable()) {\n return;\n }\n\n isObserverSet = true;\n\n const observer = new MutationObserver((mutationsList) => {\n const rootMutation = mutationsList[mutationsList.length - 1];\n\n if (\n checkIfScreenWasChanged(\n rootMutation.target as ReanimatedHTMLElement & MaybeWithFiberNode\n )\n ) {\n return;\n }\n\n for (let i = 0; i < rootMutation.removedNodes.length; ++i) {\n findDescendantWithExitingAnimation(\n rootMutation.removedNodes[i] as ReanimatedHTMLElement,\n rootMutation.target\n );\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\nexport function areDOMRectsEqual(r1: DOMRect, r2: DOMRect) {\n // There are 4 more fields, but checking these should suffice\n return (\n r1.x === r2.x &&\n r1.y === r2.y &&\n r1.width === r2.width &&\n r1.height === r2.height\n );\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,SAASA,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,kBAAkB;AAC9D,SAASC,UAAU,QAAQ,UAAU;AAGrC,MAAMC,4BAA4B,GAAG,wCAAwC;AAC7E,MAAMC,wBAAwB,GAAG,oCAAoC;;AAErE;AACA,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAiB,CAAC;AACtD,MAAMC,iBAA2B,GAAG,EAAE;AAEtC,IAAIC,aAAa,GAAG,KAAK;;AAEzB;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAAA,EAAG;EAC7C,IACE,CAACV,iBAAiB,CAAC,CAAC;EAAI;EACxBW,QAAQ,CAACC,cAAc,CAACR,4BAA4B,CAAC,KAAK,IAAI,EAC9D;IACA;EACF;EAEA,MAAMS,4BAA4B,GAAGF,QAAQ,CAACG,aAAa,CAAC,OAAO,CAAC;EACpED,4BAA4B,CAACE,EAAE,GAAGX,4BAA4B;EAE9DS,4BAA4B,CAACG,MAAM,GAAG,MAAM;IAC1C,IAAI,CAACH,4BAA4B,CAACI,KAAK,EAAE;MACvCC,OAAO,CAACC,KAAK,CACX,6DACF,CAAC;MACD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D,YAAY,CAACC,MACf,CAAC;IACH;EACF,CAAC,CAAC;EAEFJ,QAAQ,CAACM,OAAO,CAAC7E,QAAQ,CAAC8E,IAAI,EAAE;IAAEC,SAAS,EAAE,IAAI;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;AACrE;AAEA,OAAO,SAASC,gBAAgBA,CAACC,EAAW,EAAEC,EAAW,EAAE;EACzD;EACA,OACED,EAAE,CAACE,CAAC,KAAKD,EAAE,CAACC,CAAC,IACbF,EAAE,CAACG,CAAC,KAAKF,EAAE,CAACE,CAAC,IACbH,EAAE,CAACI,KAAK,KAAKH,EAAE,CAACG,KAAK,IACrBJ,EAAE,CAACK,MAAM,KAAKJ,EAAE,CAACI,MAAM;AAE3B","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["startWebLayoutAnimation","tryActivateLayoutTransition","getReducedMotionFromConfig","saveSnapshot","configureWebLayoutAnimations"],"sources":["index.ts"],"sourcesContent":["'use strict';\n\nexport {\n startWebLayoutAnimation,\n tryActivateLayoutTransition,\n} from './animationsManager';\n\nexport { getReducedMotionFromConfig, saveSnapshot } from './componentUtils';\n\nexport { configureWebLayoutAnimations } from './domUtils';\n"],"mappings":"AAAA,YAAY;;AAEZ,SACEA,uBAAuB,EACvBC,2BAA2B,QACtB,qBAAqB;AAE5B,SAASC,0BAA0B,EAAEC,YAAY,QAAQ,kBAAkB;AAE3E,SAASC,4BAA4B,QAAQ,YAAY"}
1
+ {"version":3,"names":["startWebLayoutAnimation","tryActivateLayoutTransition","getReducedMotionFromConfig","saveSnapshot","configureWebLayoutAnimations"],"sources":["index.ts"],"sourcesContent":["'use strict';\n\nexport {\n startWebLayoutAnimation,\n tryActivateLayoutTransition,\n} from './animationsManager';\n\nexport { getReducedMotionFromConfig, saveSnapshot } from './componentUtils';\n\nexport { configureWebLayoutAnimations } from './domUtils';\n"],"mappings":"AAAA,YAAY;;AAEZ,SACEA,uBAAuB,EACvBC,2BAA2B,QACtB,qBAAqB;AAE5B,SAASC,0BAA0B,EAAEC,YAAY,QAAQ,kBAAkB;AAE3E,SAASC,4BAA4B,QAAQ,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["FadingTransition","name","transitionData","translateX","translateY","scaleX","scaleY","fadingTransition","style","opacity","transform","scale","duration"],"sources":["Fading.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\n\nexport function FadingTransition(name: string, transitionData: TransitionData) {\n const { translateX, translateY, scaleX, scaleY } = transitionData;\n\n const fadingTransition = {\n name,\n style: {\n 0: {\n opacity: 1,\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 20: {\n opacity: 0,\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 60: {\n opacity: 0,\n transform: [\n {\n translateX: '0px',\n translateY: '0px',\n scale: `1,1`,\n },\n ],\n },\n 100: {\n opacity: 1,\n transform: [\n {\n translateX: '0px',\n translateY: '0px',\n scale: `1,1`,\n },\n ],\n },\n },\n duration: 300,\n };\n\n return fadingTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,OAAO,SAASA,gBAAgBA,CAACC,IAAY,EAAEC,cAA8B,EAAE;EAC7E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,cAAc;EAEjE,MAAMK,gBAAgB,GAAG;IACvBN,IAAI;IACJO,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BO,KAAK,EAAG,GAAEN,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,EAAE,EAAE;QACFG,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BO,KAAK,EAAG,GAAEN,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,EAAE,EAAE;QACFG,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAE,KAAK;UACjBC,UAAU,EAAE,KAAK;UACjBO,KAAK,EAAG;QACV,CAAC;MAEL,CAAC;MACD,GAAG,EAAE;QACHF,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAE,KAAK;UACjBC,UAAU,EAAE,KAAK;UACjBO,KAAK,EAAG;QACV,CAAC;MAEL;IACF,CAAC;IACDC,QAAQ,EAAE;EACZ,CAAC;EAED,OAAOL,gBAAgB;AACzB"}
1
+ {"version":3,"names":["FadingTransition","name","transitionData","translateX","translateY","scaleX","scaleY","fadingTransition","style","opacity","transform","scale","duration"],"sources":["Fading.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\n\nexport function FadingTransition(name: string, transitionData: TransitionData) {\n const { translateX, translateY, scaleX, scaleY } = transitionData;\n\n const fadingTransition = {\n name,\n style: {\n 0: {\n opacity: 1,\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 20: {\n opacity: 0,\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 60: {\n opacity: 0,\n transform: [\n {\n translateX: '0px',\n translateY: '0px',\n scale: `1,1`,\n },\n ],\n },\n 100: {\n opacity: 1,\n transform: [\n {\n translateX: '0px',\n translateY: '0px',\n scale: `1,1`,\n },\n ],\n },\n },\n duration: 300,\n };\n\n return fadingTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,OAAO,SAASA,gBAAgBA,CAACC,IAAY,EAAEC,cAA8B,EAAE;EAC7E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,cAAc;EAEjE,MAAMK,gBAAgB,GAAG;IACvBN,IAAI;IACJO,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BO,KAAK,EAAG,GAAEN,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,EAAE,EAAE;QACFG,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BO,KAAK,EAAG,GAAEN,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,EAAE,EAAE;QACFG,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAE,KAAK;UACjBC,UAAU,EAAE,KAAK;UACjBO,KAAK,EAAG;QACV,CAAC;MAEL,CAAC;MACD,GAAG,EAAE;QACHF,OAAO,EAAE,CAAC;QACVC,SAAS,EAAE,CACT;UACEP,UAAU,EAAE,KAAK;UACjBC,UAAU,EAAE,KAAK;UACjBO,KAAK,EAAG;QACV,CAAC;MAEL;IACF,CAAC;IACDC,QAAQ,EAAE;EACZ,CAAC;EAED,OAAOL,gBAAgB;AACzB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["LinearTransition","name","transitionData","translateX","translateY","scaleX","scaleY","linearTransition","style","transform","scale","duration"],"sources":["Linear.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\n\nexport function LinearTransition(name: string, transitionData: TransitionData) {\n const { translateX, translateY, scaleX, scaleY } = transitionData;\n\n const linearTransition = {\n name,\n style: {\n 0: {\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n },\n duration: 300,\n };\n\n return linearTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,OAAO,SAASA,gBAAgBA,CAACC,IAAY,EAAEC,cAA8B,EAAE;EAC7E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,cAAc;EAEjE,MAAMK,gBAAgB,GAAG;IACvBN,IAAI;IACJO,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,SAAS,EAAE,CACT;UACEN,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BM,KAAK,EAAG,GAAEL,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL;IACF,CAAC;IACDK,QAAQ,EAAE;EACZ,CAAC;EAED,OAAOJ,gBAAgB;AACzB"}
1
+ {"version":3,"names":["LinearTransition","name","transitionData","translateX","translateY","scaleX","scaleY","linearTransition","style","transform","scale","duration"],"sources":["Linear.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\n\nexport function LinearTransition(name: string, transitionData: TransitionData) {\n const { translateX, translateY, scaleX, scaleY } = transitionData;\n\n const linearTransition = {\n name,\n style: {\n 0: {\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n },\n duration: 300,\n };\n\n return linearTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,OAAO,SAASA,gBAAgBA,CAACC,IAAY,EAAEC,cAA8B,EAAE;EAC7E,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGJ,cAAc;EAEjE,MAAMK,gBAAgB,GAAG;IACvBN,IAAI;IACJO,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,SAAS,EAAE,CACT;UACEN,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BM,KAAK,EAAG,GAAEL,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL;IACF,CAAC;IACDK,QAAQ,EAAE;EACZ,CAAC;EAED,OAAOJ,gBAAgB;AACzB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["SequencedTransition","name","transitionData","translateX","translateY","scaleX","scaleY","reversed","scaleValue","sequencedTransition","style","transform","scale","duration"],"sources":["Sequenced.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\n\nexport function SequencedTransition(\n name: string,\n transitionData: TransitionData\n) {\n const { translateX, translateY, scaleX, scaleY, reversed } = transitionData;\n\n const scaleValue = reversed ? `1,${scaleX}` : `${scaleY},1`;\n\n const sequencedTransition = {\n name,\n style: {\n 0: {\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 50: {\n transform: [\n {\n translateX: reversed ? `${translateX}px` : '0px',\n translateY: reversed ? '0px' : `${translateY}px`,\n scale: scaleValue,\n },\n ],\n },\n 100: {\n transform: [{ translateX: '0px', translateY: '0px', scale: '1,1' }],\n },\n },\n duration: 300,\n };\n\n return sequencedTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,OAAO,SAASA,mBAAmBA,CACjCC,IAAY,EACZC,cAA8B,EAC9B;EACA,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGL,cAAc;EAE3E,MAAMM,UAAU,GAAGD,QAAQ,GAAI,KAAIF,MAAO,EAAC,GAAI,GAAEC,MAAO,IAAG;EAE3D,MAAMG,mBAAmB,GAAG;IAC1BR,IAAI;IACJS,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,SAAS,EAAE,CACT;UACER,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BQ,KAAK,EAAG,GAAEP,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,EAAE,EAAE;QACFK,SAAS,EAAE,CACT;UACER,UAAU,EAAEI,QAAQ,GAAI,GAAEJ,UAAW,IAAG,GAAG,KAAK;UAChDC,UAAU,EAAEG,QAAQ,GAAG,KAAK,GAAI,GAAEH,UAAW,IAAG;UAChDQ,KAAK,EAAEJ;QACT,CAAC;MAEL,CAAC;MACD,GAAG,EAAE;QACHG,SAAS,EAAE,CAAC;UAAER,UAAU,EAAE,KAAK;UAAEC,UAAU,EAAE,KAAK;UAAEQ,KAAK,EAAE;QAAM,CAAC;MACpE;IACF,CAAC;IACDC,QAAQ,EAAE;EACZ,CAAC;EAED,OAAOJ,mBAAmB;AAC5B"}
1
+ {"version":3,"names":["SequencedTransition","name","transitionData","translateX","translateY","scaleX","scaleY","reversed","scaleValue","sequencedTransition","style","transform","scale","duration"],"sources":["Sequenced.web.ts"],"sourcesContent":["'use strict';\nimport type { TransitionData } from '../animationParser';\n\nexport function SequencedTransition(\n name: string,\n transitionData: TransitionData\n) {\n const { translateX, translateY, scaleX, scaleY, reversed } = transitionData;\n\n const scaleValue = reversed ? `1,${scaleX}` : `${scaleY},1`;\n\n const sequencedTransition = {\n name,\n style: {\n 0: {\n transform: [\n {\n translateX: `${translateX}px`,\n translateY: `${translateY}px`,\n scale: `${scaleX},${scaleY}`,\n },\n ],\n },\n 50: {\n transform: [\n {\n translateX: reversed ? `${translateX}px` : '0px',\n translateY: reversed ? '0px' : `${translateY}px`,\n scale: scaleValue,\n },\n ],\n },\n 100: {\n transform: [{ translateX: '0px', translateY: '0px', scale: '1,1' }],\n },\n },\n duration: 300,\n };\n\n return sequencedTransition;\n}\n"],"mappings":"AAAA,YAAY;;AAGZ,OAAO,SAASA,mBAAmBA,CACjCC,IAAY,EACZC,cAA8B,EAC9B;EACA,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGL,cAAc;EAE3E,MAAMM,UAAU,GAAGD,QAAQ,GAAI,KAAIF,MAAO,EAAC,GAAI,GAAEC,MAAO,IAAG;EAE3D,MAAMG,mBAAmB,GAAG;IAC1BR,IAAI;IACJS,KAAK,EAAE;MACL,CAAC,EAAE;QACDC,SAAS,EAAE,CACT;UACER,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BC,UAAU,EAAG,GAAEA,UAAW,IAAG;UAC7BQ,KAAK,EAAG,GAAEP,MAAO,IAAGC,MAAO;QAC7B,CAAC;MAEL,CAAC;MACD,EAAE,EAAE;QACFK,SAAS,EAAE,CACT;UACER,UAAU,EAAEI,QAAQ,GAAI,GAAEJ,UAAW,IAAG,GAAG,KAAK;UAChDC,UAAU,EAAEG,QAAQ,GAAG,KAAK,GAAI,GAAEH,UAAW,IAAG;UAChDQ,KAAK,EAAEJ;QACT,CAAC;MAEL,CAAC;MACD,GAAG,EAAE;QACHG,SAAS,EAAE,CAAC;UAAER,UAAU,EAAE,KAAK;UAAEC,UAAU,EAAE,KAAK;UAAEQ,KAAK,EAAE;QAAM,CAAC;MACpE;IACF,CAAC;IACDC,QAAQ,EAAE;EACZ,CAAC;EAED,OAAOJ,mBAAmB;AAC5B","ignoreList":[]}
@@ -166,9 +166,7 @@ function createMapperRegistry() {
166
166
  };
167
167
  }
168
168
  let MAPPER_ID = 9999;
169
- export function startMapper(worklet) {
170
- let inputs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
171
- let outputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
169
+ export function startMapper(worklet, inputs = [], outputs = []) {
172
170
  const mapperID = MAPPER_ID += 1;
173
171
  runOnUI(() => {
174
172
  let mapperRegistry = global.__mapperRegistry;
@@ -182,7 +180,7 @@ export function startMapper(worklet) {
182
180
  export function stopMapper(mapperID) {
183
181
  runOnUI(() => {
184
182
  const mapperRegistry = global.__mapperRegistry;
185
- mapperRegistry === null || mapperRegistry === void 0 ? void 0 : mapperRegistry.stop(mapperID);
183
+ mapperRegistry === null || mapperRegistry === void 0 || mapperRegistry.stop(mapperID);
186
184
  })();
187
185
  }
188
186
  //# sourceMappingURL=mappers.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isJest","runOnUI","isSharedValue","IS_JEST","createMapperRegistry","mappers","Map","sortedMappers","runRequested","processingMappers","updateMappersOrder","pre","forEach","mapper","outputs","output","preMappers","get","undefined","set","push","visited","Set","newOrder","dfs","add","input","inputs","preMapper","has","mapperRun","size","length","dirty","worklet","maybeRequestUpdates","requestAnimationFrame","queueMicrotask","extractInputs","resultArray","Array","isArray","Object","getPrototypeOf","prototype","element","values","start","mapperID","id","sv","addListener","stop","delete","removeListener","MAPPER_ID","startMapper","arguments","mapperRegistry","global","__mapperRegistry","stopMapper"],"sources":["mappers.ts"],"sourcesContent":["'use strict';\nimport type {\n MapperRawInputs,\n MapperOutputs,\n SharedValue,\n} from './commonTypes';\nimport { isJest } from './PlatformChecker';\nimport { runOnUI } from './threads';\nimport { isSharedValue } from './isSharedValue';\n\nconst IS_JEST = isJest();\n\ntype MapperExtractedInputs = SharedValue[];\n\ntype Mapper = {\n id: number;\n dirty: boolean;\n worklet: () => void;\n inputs: MapperExtractedInputs;\n outputs?: MapperOutputs;\n};\n\nfunction createMapperRegistry() {\n 'worklet';\n const mappers = new Map<number, Mapper>();\n let sortedMappers: Mapper[] = [];\n\n let runRequested = false;\n let processingMappers = false;\n\n function updateMappersOrder() {\n // sort mappers topologically\n // the algorithm here takes adventage of a fact that the topological order\n // of a transposed graph is a reverse topological order of the original graph\n // The graph in our case consists of mappers and an edge between two mappers\n // A and B exists if there is a shared value that's on A's output lists and on\n // B's input list.\n //\n // We don't need however to calculate that graph as it is easier to work with\n // the transposed version of it that can be calculated ad-hoc. For the transposed\n // version to be traversed we use \"pre\" map that maps share value to mappers that\n // output that shared value. Then we can infer all the outgoing edges for a given\n // mapper simply by scanning it's input list and checking if any of the shared values\n // from that list exists in the \"pre\" map. If they do, then we have an edge between\n // that mapper and the mappers from the \"pre\" list for the given shared value.\n //\n // For topological sorting we use a dfs-based approach that requires the graph to\n // be traversed in dfs order and each node after being processed lands at the\n // beginning of the topological order list. Since we traverse a transposed graph,\n // instead of reversing that order we can use a normal array and push processed\n // mappers to the end. There is no need to reverse that array after we are done.\n const pre = new Map(); // map from sv -> mapper that outputs that sv\n mappers.forEach((mapper) => {\n if (mapper.outputs) {\n for (const output of mapper.outputs) {\n const preMappers = pre.get(output);\n if (preMappers === undefined) {\n pre.set(output, [mapper]);\n } else {\n preMappers.push(mapper);\n }\n }\n }\n });\n const visited = new Set();\n const newOrder: Mapper[] = [];\n function dfs(mapper: Mapper) {\n visited.add(mapper);\n for (const input of mapper.inputs) {\n const preMappers = pre.get(input);\n if (preMappers) {\n for (const preMapper of preMappers) {\n if (!visited.has(preMapper)) {\n dfs(preMapper);\n }\n }\n }\n }\n newOrder.push(mapper);\n }\n mappers.forEach((mapper) => {\n if (!visited.has(mapper)) {\n dfs(mapper);\n }\n });\n sortedMappers = newOrder;\n }\n\n function mapperRun() {\n runRequested = false;\n if (processingMappers) {\n return;\n }\n try {\n processingMappers = true;\n if (mappers.size !== sortedMappers.length) {\n updateMappersOrder();\n }\n for (const mapper of sortedMappers) {\n if (mapper.dirty) {\n mapper.dirty = false;\n mapper.worklet();\n }\n }\n } finally {\n processingMappers = false;\n }\n }\n\n function maybeRequestUpdates() {\n if (IS_JEST) {\n // On Jest environment we avoid using queueMicrotask as that'd require test\n // to advance the clock manually. This on other hand would require tests\n // to know how many times mappers need to run. As we don't want tests to\n // make any assumptions on that number it is easier to execute mappers\n // immediately for testing purposes and only expect test to advance timers\n // if they want to make any assertions on the effects of animations being run.\n mapperRun();\n } else if (!runRequested) {\n if (processingMappers) {\n // In general, we should avoid having mappers trigger updates as this may\n // result in unpredictable behavior. Specifically, the updated value can\n // be read by mappers that run later in the same frame but previous mappers\n // would access the old value. Updating mappers during the mapper-run phase\n // breaks the order in which we should execute the mappers. However, doing\n // that is still a possibility and there are some instances where people use\n // the API in that way, hence we need to prevent mapper-run phase falling into\n // an infinite loop. We do that by detecting when mapper-run is requested while\n // we are already in mapper-run phase, and in that case we use `requestAnimationFrame`\n // instead of `queueMicrotask` which will schedule mapper run for the next\n // frame instead of queuing another set of updates in the same frame.\n requestAnimationFrame(mapperRun);\n } else {\n queueMicrotask(mapperRun);\n }\n runRequested = true;\n }\n }\n\n function extractInputs(\n inputs: unknown,\n resultArray: MapperExtractedInputs\n ): MapperExtractedInputs {\n if (Array.isArray(inputs)) {\n for (const input of inputs) {\n input && extractInputs(input, resultArray);\n }\n } else if (isSharedValue(inputs)) {\n resultArray.push(inputs);\n } else if (Object.getPrototypeOf(inputs) === Object.prototype) {\n // we only extract inputs recursively from \"plain\" objects here, if object\n // is of a derivative class (e.g. HostObject on web, or Map) we don't scan\n // it recursively\n for (const element of Object.values(inputs as Record<string, unknown>)) {\n element && extractInputs(element, resultArray);\n }\n }\n return resultArray;\n }\n\n return {\n start: (\n mapperID: number,\n worklet: () => void,\n inputs: MapperRawInputs,\n outputs?: MapperOutputs\n ) => {\n const mapper: Mapper = {\n id: mapperID,\n dirty: true,\n worklet,\n inputs: extractInputs(inputs, []),\n outputs,\n };\n mappers.set(mapper.id, mapper);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.addListener(mapper.id, () => {\n mapper.dirty = true;\n maybeRequestUpdates();\n });\n }\n maybeRequestUpdates();\n },\n stop: (mapperID: number) => {\n const mapper = mappers.get(mapperID);\n if (mapper) {\n mappers.delete(mapper.id);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.removeListener(mapper.id);\n }\n }\n },\n };\n}\n\nlet MAPPER_ID = 9999;\n\nexport function startMapper(\n worklet: () => void,\n inputs: MapperRawInputs = [],\n outputs: MapperOutputs = []\n): number {\n const mapperID = (MAPPER_ID += 1);\n\n runOnUI(() => {\n let mapperRegistry = global.__mapperRegistry;\n if (mapperRegistry === undefined) {\n mapperRegistry = global.__mapperRegistry = createMapperRegistry();\n }\n mapperRegistry.start(mapperID, worklet, inputs, outputs);\n })();\n\n return mapperID;\n}\n\nexport function stopMapper(mapperID: number): void {\n runOnUI(() => {\n const mapperRegistry = global.__mapperRegistry;\n mapperRegistry?.stop(mapperID);\n })();\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,MAAMC,OAAO,GAAGH,MAAM,EAAE;AAYxB,SAASI,oBAAoBA,CAAA,EAAG;EAC9B,SAAS;;EACT,MAAMC,OAAO,GAAG,IAAIC,GAAG,EAAkB;EACzC,IAAIC,aAAuB,GAAG,EAAE;EAEhC,IAAIC,YAAY,GAAG,KAAK;EACxB,IAAIC,iBAAiB,GAAG,KAAK;EAE7B,SAASC,kBAAkBA,CAAA,EAAG;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMC,GAAG,GAAG,IAAIL,GAAG,EAAE,CAAC,CAAC;IACvBD,OAAO,CAACO,OAAO,CAAEC,MAAM,IAAK;MAC1B,IAAIA,MAAM,CAACC,OAAO,EAAE;QAClB,KAAK,MAAMC,MAAM,IAAIF,MAAM,CAACC,OAAO,EAAE;UACnC,MAAME,UAAU,GAAGL,GAAG,CAACM,GAAG,CAACF,MAAM,CAAC;UAClC,IAAIC,UAAU,KAAKE,SAAS,EAAE;YAC5BP,GAAG,CAACQ,GAAG,CAACJ,MAAM,EAAE,CAACF,MAAM,CAAC,CAAC;UAC3B,CAAC,MAAM;YACLG,UAAU,CAACI,IAAI,CAACP,MAAM,CAAC;UACzB;QACF;MACF;IACF,CAAC,CAAC;IACF,MAAMQ,OAAO,GAAG,IAAIC,GAAG,EAAE;IACzB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;AACjB;AAEA,OAAO,SAASa,UAAUA,CAACb,QAAgB,EAAQ;EACjD/C,OAAO,CAAC,MAAM;IACZ,MAAMyD,cAAc,GAAGC,MAAM,CAACC,gBAAgB;IAC9CF,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEN,IAAI,CAACJ,QAAQ,CAAC;EAChC,CAAC,CAAC,EAAE;AACN"}
1
+ {"version":3,"names":["isJest","runOnUI","isSharedValue","IS_JEST","createMapperRegistry","mappers","Map","sortedMappers","runRequested","processingMappers","updateMappersOrder","pre","forEach","mapper","outputs","output","preMappers","get","undefined","set","push","visited","Set","newOrder","dfs","add","input","inputs","preMapper","has","mapperRun","size","length","dirty","worklet","maybeRequestUpdates","requestAnimationFrame","queueMicrotask","extractInputs","resultArray","Array","isArray","Object","getPrototypeOf","prototype","element","values","start","mapperID","id","sv","addListener","stop","delete","removeListener","MAPPER_ID","startMapper","mapperRegistry","global","__mapperRegistry","stopMapper"],"sources":["mappers.ts"],"sourcesContent":["'use strict';\nimport type {\n MapperRawInputs,\n MapperOutputs,\n SharedValue,\n} from './commonTypes';\nimport { isJest } from './PlatformChecker';\nimport { runOnUI } from './threads';\nimport { isSharedValue } from './isSharedValue';\n\nconst IS_JEST = isJest();\n\ntype MapperExtractedInputs = SharedValue[];\n\ntype Mapper = {\n id: number;\n dirty: boolean;\n worklet: () => void;\n inputs: MapperExtractedInputs;\n outputs?: MapperOutputs;\n};\n\nfunction createMapperRegistry() {\n 'worklet';\n const mappers = new Map<number, Mapper>();\n let sortedMappers: Mapper[] = [];\n\n let runRequested = false;\n let processingMappers = false;\n\n function updateMappersOrder() {\n // sort mappers topologically\n // the algorithm here takes adventage of a fact that the topological order\n // of a transposed graph is a reverse topological order of the original graph\n // The graph in our case consists of mappers and an edge between two mappers\n // A and B exists if there is a shared value that's on A's output lists and on\n // B's input list.\n //\n // We don't need however to calculate that graph as it is easier to work with\n // the transposed version of it that can be calculated ad-hoc. For the transposed\n // version to be traversed we use \"pre\" map that maps share value to mappers that\n // output that shared value. Then we can infer all the outgoing edges for a given\n // mapper simply by scanning it's input list and checking if any of the shared values\n // from that list exists in the \"pre\" map. If they do, then we have an edge between\n // that mapper and the mappers from the \"pre\" list for the given shared value.\n //\n // For topological sorting we use a dfs-based approach that requires the graph to\n // be traversed in dfs order and each node after being processed lands at the\n // beginning of the topological order list. Since we traverse a transposed graph,\n // instead of reversing that order we can use a normal array and push processed\n // mappers to the end. There is no need to reverse that array after we are done.\n const pre = new Map(); // map from sv -> mapper that outputs that sv\n mappers.forEach((mapper) => {\n if (mapper.outputs) {\n for (const output of mapper.outputs) {\n const preMappers = pre.get(output);\n if (preMappers === undefined) {\n pre.set(output, [mapper]);\n } else {\n preMappers.push(mapper);\n }\n }\n }\n });\n const visited = new Set();\n const newOrder: Mapper[] = [];\n function dfs(mapper: Mapper) {\n visited.add(mapper);\n for (const input of mapper.inputs) {\n const preMappers = pre.get(input);\n if (preMappers) {\n for (const preMapper of preMappers) {\n if (!visited.has(preMapper)) {\n dfs(preMapper);\n }\n }\n }\n }\n newOrder.push(mapper);\n }\n mappers.forEach((mapper) => {\n if (!visited.has(mapper)) {\n dfs(mapper);\n }\n });\n sortedMappers = newOrder;\n }\n\n function mapperRun() {\n runRequested = false;\n if (processingMappers) {\n return;\n }\n try {\n processingMappers = true;\n if (mappers.size !== sortedMappers.length) {\n updateMappersOrder();\n }\n for (const mapper of sortedMappers) {\n if (mapper.dirty) {\n mapper.dirty = false;\n mapper.worklet();\n }\n }\n } finally {\n processingMappers = false;\n }\n }\n\n function maybeRequestUpdates() {\n if (IS_JEST) {\n // On Jest environment we avoid using queueMicrotask as that'd require test\n // to advance the clock manually. This on other hand would require tests\n // to know how many times mappers need to run. As we don't want tests to\n // make any assumptions on that number it is easier to execute mappers\n // immediately for testing purposes and only expect test to advance timers\n // if they want to make any assertions on the effects of animations being run.\n mapperRun();\n } else if (!runRequested) {\n if (processingMappers) {\n // In general, we should avoid having mappers trigger updates as this may\n // result in unpredictable behavior. Specifically, the updated value can\n // be read by mappers that run later in the same frame but previous mappers\n // would access the old value. Updating mappers during the mapper-run phase\n // breaks the order in which we should execute the mappers. However, doing\n // that is still a possibility and there are some instances where people use\n // the API in that way, hence we need to prevent mapper-run phase falling into\n // an infinite loop. We do that by detecting when mapper-run is requested while\n // we are already in mapper-run phase, and in that case we use `requestAnimationFrame`\n // instead of `queueMicrotask` which will schedule mapper run for the next\n // frame instead of queuing another set of updates in the same frame.\n requestAnimationFrame(mapperRun);\n } else {\n queueMicrotask(mapperRun);\n }\n runRequested = true;\n }\n }\n\n function extractInputs(\n inputs: unknown,\n resultArray: MapperExtractedInputs\n ): MapperExtractedInputs {\n if (Array.isArray(inputs)) {\n for (const input of inputs) {\n input && extractInputs(input, resultArray);\n }\n } else if (isSharedValue(inputs)) {\n resultArray.push(inputs);\n } else if (Object.getPrototypeOf(inputs) === Object.prototype) {\n // we only extract inputs recursively from \"plain\" objects here, if object\n // is of a derivative class (e.g. HostObject on web, or Map) we don't scan\n // it recursively\n for (const element of Object.values(inputs as Record<string, unknown>)) {\n element && extractInputs(element, resultArray);\n }\n }\n return resultArray;\n }\n\n return {\n start: (\n mapperID: number,\n worklet: () => void,\n inputs: MapperRawInputs,\n outputs?: MapperOutputs\n ) => {\n const mapper: Mapper = {\n id: mapperID,\n dirty: true,\n worklet,\n inputs: extractInputs(inputs, []),\n outputs,\n };\n mappers.set(mapper.id, mapper);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.addListener(mapper.id, () => {\n mapper.dirty = true;\n maybeRequestUpdates();\n });\n }\n maybeRequestUpdates();\n },\n stop: (mapperID: number) => {\n const mapper = mappers.get(mapperID);\n if (mapper) {\n mappers.delete(mapper.id);\n sortedMappers = [];\n for (const sv of mapper.inputs) {\n sv.removeListener(mapper.id);\n }\n }\n },\n };\n}\n\nlet MAPPER_ID = 9999;\n\nexport function startMapper(\n worklet: () => void,\n inputs: MapperRawInputs = [],\n outputs: MapperOutputs = []\n): number {\n const mapperID = (MAPPER_ID += 1);\n\n runOnUI(() => {\n let mapperRegistry = global.__mapperRegistry;\n if (mapperRegistry === undefined) {\n mapperRegistry = global.__mapperRegistry = createMapperRegistry();\n }\n mapperRegistry.start(mapperID, worklet, inputs, outputs);\n })();\n\n return mapperID;\n}\n\nexport function stopMapper(mapperID: number): void {\n runOnUI(() => {\n const mapperRegistry = global.__mapperRegistry;\n mapperRegistry?.stop(mapperID);\n })();\n}\n"],"mappings":"AAAA,YAAY;;AAMZ,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,MAAMC,OAAO,GAAGH,MAAM,CAAC,CAAC;AAYxB,SAASI,oBAAoBA,CAAA,EAAG;EAC9B,SAAS;;EACT,MAAMC,OAAO,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACzC,IAAIC,aAAuB,GAAG,EAAE;EAEhC,IAAIC,YAAY,GAAG,KAAK;EACxB,IAAIC,iBAAiB,GAAG,KAAK;EAE7B,SAASC,kBAAkBA,CAAA,EAAG;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAMC,GAAG,GAAG,IAAIL,GAAG,CAAC,CAAC,CAAC,CAAC;IACvBD,OAAO,CAACO,OAAO,CAAEC,MAAM,IAAK;MAC1B,IAAIA,MAAM,CAACC,OAAO,EAAE;QAClB,KAAK,MAAMC,MAAM,IAAIF,MAAM,CAACC,OAAO,EAAE;UACnC,MAAME,UAAU,GAAGL,GAAG,CAACM,GAAG,CAACF,MAAM,CAAC;UAClC,IAAIC,UAAU,KAAKE,SAAS,EAAE;YAC5BP,GAAG,CAACQ,GAAG,CAACJ,MAAM,EAAE,CAACF,MAAM,CAAC,CAAC;UAC3B,CAAC,MAAM;YACLG,UAAU,CAACI,IAAI,CAACP,MAAM,CAAC;UACzB;QACF;MACF;IACF,CAAC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;EACjD/C,OAAO,CAAC,MAAM;IACZ,MAAMwD,cAAc,GAAGC,MAAM,CAACC,gBAAgB;IAC9CF,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAEL,IAAI,CAACJ,QAAQ,CAAC;EAChC,CAAC,CAAC,CAAC,CAAC;AACN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["mockedRequestAnimationFrame","callback","setTimeout","performance","now"],"sources":["mockedRequestAnimationFrame.ts"],"sourcesContent":["'use strict';\n\n// This is Jest implementation of `requestAnimationFrame` that is required\n// by React Native for test purposes.\nexport function mockedRequestAnimationFrame(\n callback: (timestamp: number) => void\n): ReturnType<typeof setTimeout> {\n return setTimeout(() => callback(performance.now()), 0);\n}\n"],"mappings":"AAAA,YAAY;;AAEZ;AACA;AACA,OAAO,SAASA,2BAA2BA,CACzCC,QAAqC,EACN;EAC/B,OAAOC,UAAU,CAAC,MAAMD,QAAQ,CAACE,WAAW,CAACC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AACzD"}
1
+ {"version":3,"names":["mockedRequestAnimationFrame","callback","setTimeout","performance","now"],"sources":["mockedRequestAnimationFrame.ts"],"sourcesContent":["'use strict';\n\n// This is Jest implementation of `requestAnimationFrame` that is required\n// by React Native for test purposes.\nexport function mockedRequestAnimationFrame(\n callback: (timestamp: number) => void\n): ReturnType<typeof setTimeout> {\n return setTimeout(() => callback(performance.now()), 0);\n}\n"],"mappings":"AAAA,YAAY;;AAEZ;AACA;AACA,OAAO,SAASA,2BAA2BA,CACzCC,QAAqC,EACN;EAC/B,OAAOC,UAAU,CAAC,MAAMD,QAAQ,CAACE,WAAW,CAACC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzD","ignoreList":[]}
@@ -33,8 +33,7 @@ export function makeUIMutable(initial) {
33
33
  get _value() {
34
34
  return value;
35
35
  },
36
- modify: function (modifier) {
37
- let forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
36
+ modify: (modifier, forceUpdate = true) => {
38
37
  valueSetter(self, modifier !== undefined ? modifier(value) : value, forceUpdate);
39
38
  },
40
39
  addListener: (id, listener) => {
@@ -93,8 +92,7 @@ export function makeMutable(initial) {
93
92
  }
94
93
  throw new Error('[Reanimated] Reading from `_value` directly is only possible on the UI runtime. Perhaps you passed an Animated Style to a non-animated component?');
95
94
  },
96
- modify: function (modifier) {
97
- let forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
95
+ modify: (modifier, forceUpdate = true) => {
98
96
  if (!SHOULD_BE_USE_WEB) {
99
97
  runOnUI(() => {
100
98
  mutable.modify(modifier, forceUpdate);
@@ -1 +1 @@
1
- {"version":3,"names":["shouldBeUseWeb","makeShareableCloneRecursive","shareableMappingCache","executeOnUIRuntimeSync","runOnUI","valueSetter","SHOULD_BE_USE_WEB","makeUIMutable","initial","listeners","Map","value","self","newValue","_value","forEach","listener","modify","modifier","forceUpdate","arguments","length","undefined","addListener","id","set","removeListener","delete","_animation","_isReanimatedSharedValue","makeMutable","handle","__init","mutable","uiValueGetter","sv","Error"],"sources":["mutables.ts"],"sourcesContent":["'use strict';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport type { Mutable } from './commonTypes';\nimport { makeShareableCloneRecursive } from './shareables';\nimport { shareableMappingCache } from './shareableMappingCache';\nimport { executeOnUIRuntimeSync, runOnUI } from './threads';\nimport { valueSetter } from './valueSetter';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\ntype Listener<Value> = (newValue: Value) => void;\n\nexport function makeUIMutable<Value>(initial: Value): Mutable<Value> {\n 'worklet';\n\n const listeners = new Map<number, Listener<Value>>();\n let value = initial;\n\n const self: Mutable<Value> = {\n set value(newValue) {\n valueSetter(self, newValue);\n },\n get value() {\n return value;\n },\n /**\n * _value prop should only be accessed by the valueSetter implementation\n * which may make the decision about updating the mutable value depending\n * on the provided new value. All other places should only attempt to modify\n * the mutable by assigning to value prop directly.\n */\n set _value(newValue: Value) {\n value = newValue;\n listeners.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): Value {\n return value;\n },\n modify: (modifier, forceUpdate = true) => {\n valueSetter(\n self,\n modifier !== undefined ? modifier(value) : value,\n forceUpdate\n );\n },\n addListener: (id: number, listener: Listener<Value>) => {\n listeners.set(id, listener);\n },\n removeListener: (id: number) => {\n listeners.delete(id);\n },\n _animation: null,\n _isReanimatedSharedValue: true,\n };\n return self;\n}\n\nexport function makeMutable<Value>(initial: Value): Mutable<Value> {\n let value: Value = initial;\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return makeUIMutable(initial);\n },\n });\n // listeners can only work on JS thread on Web and jest environments\n const listeners = SHOULD_BE_USE_WEB\n ? new Map<number, Listener<Value>>()\n : undefined;\n const mutable: Mutable<Value> = {\n set value(newValue) {\n if (SHOULD_BE_USE_WEB) {\n valueSetter(mutable, newValue);\n } else {\n runOnUI(() => {\n mutable.value = newValue;\n })();\n }\n },\n get value(): Value {\n if (SHOULD_BE_USE_WEB) {\n return value;\n }\n const uiValueGetter = executeOnUIRuntimeSync((sv: Mutable<Value>) => {\n return sv.value;\n });\n return uiValueGetter(mutable);\n },\n set _value(newValue: Value) {\n if (!SHOULD_BE_USE_WEB) {\n throw new Error(\n '[Reanimated] Setting `_value` directly is only possible on the UI runtime. Perhaps you want to assign to `value` instead?'\n );\n }\n value = newValue;\n listeners!.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): Value {\n if (SHOULD_BE_USE_WEB) {\n return value;\n }\n throw new Error(\n '[Reanimated] Reading from `_value` directly is only possible on the UI runtime. Perhaps you passed an Animated Style to a non-animated component?'\n );\n },\n\n modify: (modifier, forceUpdate = true) => {\n if (!SHOULD_BE_USE_WEB) {\n runOnUI(() => {\n mutable.modify(modifier, forceUpdate);\n })();\n } else {\n valueSetter(\n mutable,\n modifier !== undefined ? modifier(mutable.value) : mutable.value,\n forceUpdate\n );\n }\n },\n addListener: (id: number, listener: Listener<Value>) => {\n if (!SHOULD_BE_USE_WEB) {\n throw new Error(\n '[Reanimated] Adding listeners is only possible on the UI runtime.'\n );\n }\n listeners!.set(id, listener);\n },\n removeListener: (id: number) => {\n if (!SHOULD_BE_USE_WEB) {\n throw new Error(\n '[Reanimated] Removing listeners is only possible on the UI runtime.'\n );\n }\n listeners!.delete(id);\n },\n _isReanimatedSharedValue: true,\n };\n shareableMappingCache.set(mutable, handle);\n return mutable;\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,cAAc,QAAQ,mBAAmB;AAElD,SAASC,2BAA2B,QAAQ,cAAc;AAC1D,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,sBAAsB,EAAEC,OAAO,QAAQ,WAAW;AAC3D,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,iBAAiB,GAAGN,cAAc,EAAE;AAI1C,OAAO,SAASO,aAAaA,CAAQC,OAAc,EAAkB;EACnE,SAAS;;EAET,MAAMC,SAAS,GAAG,IAAIC,GAAG,EAA2B;EACpD,IAAIC,KAAK,GAAGH,OAAO;EAEnB,MAAMI,IAAoB,GAAG;IAC3B,IAAID,KAAKA,CAACE,QAAQ,EAAE;MAClBR,WAAW,CAACO,IAAI,EAAEC,QAAQ,CAAC;IAC7B,CAAC;IACD,IAAIF,KAAKA,CAAA,EAAG;MACV,OAAOA,KAAK;IACd,CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IACI,IAAIG,MAAMA,CAACD,QAAe,EAAE;MAC1BF,KAAK,GAAGE,QAAQ;MAChBJ,SAAS,CAACM,OAAO,CAAEC,QAAQ,IAAK;QAC9BA,QAAQ,CAACH,QAAQ,CAAC;MACpB,CAAC,CAAC;IACJ,CAAC;IACD,IAAIC,MAAMA,CAAA,EAAU;MAClB,OAAOH,KAAK;IACd,CAAC;IACDM,MAAM,EAAE,SAAAA,CAACC,QAAQ,EAAyB;MAAA,IAAvBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF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3B,SAAS,CAAEkB,MAAM,CAACH,EAAE,CAAC;IACvB,CAAC;IACDK,wBAAwB,EAAE;EAC5B,CAAC;EACD3B,qBAAqB,CAACuB,GAAG,CAACQ,OAAO,EAAEF,MAAM,CAAC;EAC1C,OAAOE,OAAO;AAChB"}
1
+ {"version":3,"names":["shouldBeUseWeb","makeShareableCloneRecursive","shareableMappingCache","executeOnUIRuntimeSync","runOnUI","valueSetter","SHOULD_BE_USE_WEB","makeUIMutable","initial","listeners","Map","value","self","newValue","_value","forEach","listener","modify","modifier","forceUpdate","undefined","addListener","id","set","removeListener","delete","_animation","_isReanimatedSharedValue","makeMutable","handle","__init","mutable","uiValueGetter","sv","Error"],"sources":["mutables.ts"],"sourcesContent":["'use strict';\nimport { shouldBeUseWeb } from './PlatformChecker';\nimport type { Mutable } from './commonTypes';\nimport { makeShareableCloneRecursive } from './shareables';\nimport { shareableMappingCache } from './shareableMappingCache';\nimport { executeOnUIRuntimeSync, runOnUI } from './threads';\nimport { valueSetter } from './valueSetter';\n\nconst SHOULD_BE_USE_WEB = shouldBeUseWeb();\n\ntype Listener<Value> = (newValue: Value) => void;\n\nexport function makeUIMutable<Value>(initial: Value): Mutable<Value> {\n 'worklet';\n\n const listeners = new Map<number, Listener<Value>>();\n let value = initial;\n\n const self: Mutable<Value> = {\n set value(newValue) {\n valueSetter(self, newValue);\n },\n get value() {\n return value;\n },\n /**\n * _value prop should only be accessed by the valueSetter implementation\n * which may make the decision about updating the mutable value depending\n * on the provided new value. All other places should only attempt to modify\n * the mutable by assigning to value prop directly.\n */\n set _value(newValue: Value) {\n value = newValue;\n listeners.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): Value {\n return value;\n },\n modify: (modifier, forceUpdate = true) => {\n valueSetter(\n self,\n modifier !== undefined ? modifier(value) : value,\n forceUpdate\n );\n },\n addListener: (id: number, listener: Listener<Value>) => {\n listeners.set(id, listener);\n },\n removeListener: (id: number) => {\n listeners.delete(id);\n },\n _animation: null,\n _isReanimatedSharedValue: true,\n };\n return self;\n}\n\nexport function makeMutable<Value>(initial: Value): Mutable<Value> {\n let value: Value = initial;\n const handle = makeShareableCloneRecursive({\n __init: () => {\n 'worklet';\n return makeUIMutable(initial);\n },\n });\n // listeners can only work on JS thread on Web and jest environments\n const listeners = SHOULD_BE_USE_WEB\n ? new Map<number, Listener<Value>>()\n : undefined;\n const mutable: Mutable<Value> = {\n set value(newValue) {\n if (SHOULD_BE_USE_WEB) {\n valueSetter(mutable, newValue);\n } else {\n runOnUI(() => {\n mutable.value = newValue;\n })();\n }\n },\n get value(): Value {\n if (SHOULD_BE_USE_WEB) {\n return value;\n }\n const uiValueGetter = executeOnUIRuntimeSync((sv: Mutable<Value>) => {\n return sv.value;\n });\n return uiValueGetter(mutable);\n },\n set _value(newValue: Value) {\n if (!SHOULD_BE_USE_WEB) {\n throw new Error(\n '[Reanimated] Setting `_value` directly is only possible on the UI runtime. Perhaps you want to assign to `value` instead?'\n );\n }\n value = newValue;\n listeners!.forEach((listener) => {\n listener(newValue);\n });\n },\n get _value(): Value {\n if (SHOULD_BE_USE_WEB) {\n return value;\n }\n throw new Error(\n '[Reanimated] Reading from `_value` directly is only possible on the UI runtime. Perhaps you passed an Animated Style to a non-animated component?'\n );\n },\n\n modify: (modifier, forceUpdate = true) => {\n if (!SHOULD_BE_USE_WEB) {\n runOnUI(() => {\n mutable.modify(modifier, forceUpdate);\n })();\n } else {\n valueSetter(\n mutable,\n modifier !== undefined ? modifier(mutable.value) : mutable.value,\n forceUpdate\n );\n }\n },\n addListener: (id: number, listener: Listener<Value>) => {\n if (!SHOULD_BE_USE_WEB) {\n throw new Error(\n '[Reanimated] Adding listeners is only possible on the UI runtime.'\n );\n }\n listeners!.set(id, listener);\n },\n removeListener: (id: number) => {\n if (!SHOULD_BE_USE_WEB) {\n throw new Error(\n '[Reanimated] Removing listeners is only possible on the UI runtime.'\n );\n }\n listeners!.delete(id);\n },\n _isReanimatedSharedValue: true,\n };\n shareableMappingCache.set(mutable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AIC,MAAMA,CAAA,EAAU;MAClB,IAAIR,iBAAiB,EAAE;QACrB,OAAOK,KAAK;MACd;MACA,MAAM,IAAIuB,KAAK,CACb,mJACF,CAAC;IACH,CAAC;IAEDjB,MAAM,EAAEA,CAACC,QAAQ,EAAEC,WAAW,GAAG,IAAI,KAAK;MACxC,IAAI,CAACb,iBAAiB,EAAE;QACtBF,OAAO,CAAC,MAAM;UACZ2B,OAAO,CAACd,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC;QACvC,CAAC,CAAC,CAAC,CAAC;MACN,CAAC,MAAM;QACLd,WAAW,CACT0B,OAAO,EACPb,QAAQ,KAAKE,SAAS,GAAGF,QAAQ,CAACa,OAAO,CAACpB,KAAK,CAAC,GAAGoB,OAAO,CAACpB,KAAK,EAChEQ,WACF,CAAC;MACH;IACF,CAAC;IACDE,WAAW,EAAEA,CAACC,EAAU,EAAEN,QAAyB,KAAK;MACtD,IAAI,CAACV,iBAAiB,EAAE;QACtB,MAAM,IAAI4B,KAAK,CACb,mEACF,CAAC;MACH;MACAzB,SAAS,CAAEc,GAAG,CAACD,EAAE,EAAEN,QAAQ,CAAC;IAC9B,CAAC;IACDQ,cAAc,EAAGF,EAAU,IAAK;MAC9B,IAAI,CAAChB,iBAAiB,EAAE;QACtB,MAAM,IAAI4B,KAAK,CACb,qEACF,CAAC;MACH;MACAzB,SAAS,CAAEgB,MAAM,CAACH,EAAE,CAAC;IACvB,CAAC;IACDK,wBAAwB,EAAE;EAC5B,CAAC;EACDzB,qBAAqB,CAACqB,GAAG,CAACQ,OAAO,EAAEF,MAAM,CAAC;EAC1C,OAAOE,OAAO;AAChB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["default","RNRenderer"],"sources":["RNRenderer.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n'use strict';\nexport { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';\n"],"mappings":"AAAA;AACA;AACA,YAAY;;AACZ,SAASA,OAAO,IAAIC,UAAU,QAAQ,mDAAmD"}
1
+ {"version":3,"names":["default","RNRenderer"],"sources":["RNRenderer.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n'use strict';\nexport { default as RNRenderer } from 'react-native/Libraries/Renderer/shims/ReactNative';\n"],"mappings":"AAAA;AACA;AACA,YAAY;;AACZ,SAASA,OAAO,IAAIC,UAAU,QAAQ,mDAAmD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["module","exports"],"sources":["RNRenderer.web.ts"],"sourcesContent":["'use strict';\n// RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.\nmodule.exports = null;\n"],"mappings":"AAAA,YAAY;;AACZ;AACAA,MAAM,CAACC,OAAO,GAAG,IAAI"}
1
+ {"version":3,"names":["module","exports"],"sources":["RNRenderer.web.ts"],"sourcesContent":["'use strict';\n// RNRender is not used for web. An export is still defined to eliminate warnings from bundlers such as esbuild.\nmodule.exports = null;\n"],"mappings":"AAAA,YAAY;;AACZ;AACAA,MAAM,CAACC,OAAO,GAAG,IAAI","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","warn","ok","matchVersion","Error","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["'use strict';\nimport { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n console.warn(\n `[Reanimated] Couldn't determine the version of the native part of Reanimated.\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#couldnt-determine-the-version-of-the-native-part-of-reanimated\\` for more details.`\n );\n return;\n }\n const ok = matchVersion(jsVersion, cppVersion);\n if (!ok) {\n throw new Error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs ${cppVersion}).\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#mismatch-between-javascript-part-and-native-part-of-reanimated\\` for more details.`\n );\n }\n}\n\n// This is used only in test files, therefore it is reported by ts-prune (which is desired)\n// ts-prune-ignore-next\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5BC,OAAO,CAACC,IAAI,CACT;AACP,4KAA4K,CACvK;IACD;EACF;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACT,SAAS,EAAEE,UAAU,CAAC;EAC9C,IAAI,CAACM,EAAE,EAAE;IACP,MAAM,IAAIE,KAAK,CACZ,gFAA+EV,SAAU,OAAME,UAAW;AACjH,4KAA4K,CACvK;EACH;AACF;;AAEA;AACA;AACA,OAAO,SAASO,YAAYA,CAACE,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF"}
1
+ {"version":3,"names":["jsVersion","checkCppVersion","cppVersion","global","_REANIMATED_VERSION_CPP","undefined","console","warn","ok","matchVersion","Error","version1","version2","match","major1","minor1","split","major2","minor2"],"sources":["checkCppVersion.ts"],"sourcesContent":["'use strict';\nimport { jsVersion } from './jsVersion';\n\nexport function checkCppVersion() {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n if (cppVersion === undefined) {\n console.warn(\n `[Reanimated] Couldn't determine the version of the native part of Reanimated.\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#couldnt-determine-the-version-of-the-native-part-of-reanimated\\` for more details.`\n );\n return;\n }\n const ok = matchVersion(jsVersion, cppVersion);\n if (!ok) {\n throw new Error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs ${cppVersion}).\n See \\`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#mismatch-between-javascript-part-and-native-part-of-reanimated\\` for more details.`\n );\n }\n}\n\n// This is used only in test files, therefore it is reported by ts-prune (which is desired)\n// ts-prune-ignore-next\nexport function matchVersion(version1: string, version2: string) {\n if (version1.match(/^\\d+\\.\\d+\\.\\d+$/) && version2.match(/^\\d+\\.\\d+\\.\\d+$/)) {\n // x.y.z, compare only major and minor, skip patch\n const [major1, minor1] = version1.split('.');\n const [major2, minor2] = version2.split('.');\n return major1 === major2 && minor1 === minor2;\n } else {\n // alpha, beta or rc, compare everything\n return version1 === version2;\n }\n}\n"],"mappings":"AAAA,YAAY;;AACZ,SAASA,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,UAAU,GAAGC,MAAM,CAACC,uBAAuB;EACjD,IAAIF,UAAU,KAAKG,SAAS,EAAE;IAC5BC,OAAO,CAACC,IAAI,CACT;AACP,4KACI,CAAC;IACD;EACF;EACA,MAAMC,EAAE,GAAGC,YAAY,CAACT,SAAS,EAAEE,UAAU,CAAC;EAC9C,IAAI,CAACM,EAAE,EAAE;IACP,MAAM,IAAIE,KAAK,CACZ,gFAA+EV,SAAU,OAAME,UAAW;AACjH,4KACI,CAAC;EACH;AACF;;AAEA;AACA;AACA,OAAO,SAASO,YAAYA,CAACE,QAAgB,EAAEC,QAAgB,EAAE;EAC/D,IAAID,QAAQ,CAACE,KAAK,CAAC,iBAAiB,CAAC,IAAID,QAAQ,CAACC,KAAK,CAAC,iBAAiB,CAAC,EAAE;IAC1E;IACA,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGJ,QAAQ,CAACK,KAAK,CAAC,GAAG,CAAC;IAC5C,MAAM,CAACC,MAAM,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAOF,MAAM,KAAKG,MAAM,IAAIF,MAAM,KAAKG,MAAM;EAC/C,CAAC,MAAM;IACL;IACA,OAAOP,QAAQ,KAAKC,QAAQ;EAC9B;AACF","ignoreList":[]}
@@ -5,5 +5,5 @@
5
5
  * with the version used to build the native part of the library in runtime.
6
6
  * Remember to keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '3.9.0-rc.0';
8
+ export const jsVersion = '3.9.0';
9
9
  //# sourceMappingURL=jsVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nexport const jsVersion = '3.9.0-rc.0';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,YAAY"}
1
+ {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nexport const jsVersion = '3.9.0';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,OAAO","ignoreList":[]}
@@ -10,20 +10,18 @@ import { isChromeDebugger, isFabric, isJest, shouldBeUseWeb } from '../PlatformC
10
10
  * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/dispatchCommand
11
11
  */
12
12
  export let dispatchCommand;
13
- function dispatchCommandFabric(animatedRef, commandName) {
13
+ function dispatchCommandFabric(animatedRef, commandName, args = []) {
14
14
  'worklet';
15
15
 
16
- let args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
17
16
  if (!_WORKLET) {
18
17
  return;
19
18
  }
20
19
  const shadowNodeWrapper = animatedRef();
21
20
  global._dispatchCommandFabric(shadowNodeWrapper, commandName, args);
22
21
  }
23
- function dispatchCommandPaper(animatedRef, commandName) {
22
+ function dispatchCommandPaper(animatedRef, commandName, args = []) {
24
23
  'worklet';
25
24
 
26
- let args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
27
25
  if (!_WORKLET) {
28
26
  return;
29
27
  }