react-native-reanimated 3.0.2 → 3.1.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 (473) hide show
  1. package/Common/cpp/Fabric/FabricUtils.h +1 -1
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
  3. package/Common/cpp/SharedItems/Shareables.h +22 -0
  4. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
  5. package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
  6. package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
  7. package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
  8. package/RNReanimated.podspec +5 -2
  9. package/android/CMakeLists.txt +4 -0
  10. package/android/build.gradle +18 -10
  11. package/android/src/main/cpp/NativeProxy.cpp +316 -337
  12. package/android/src/main/cpp/NativeProxy.h +53 -11
  13. package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
  14. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
  15. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
  16. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
  17. package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
  18. package/ios/REANodesManager.h +1 -0
  19. package/ios/REANodesManager.mm +30 -4
  20. package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
  21. package/ios/native/NativeMethods.mm +1 -1
  22. package/ios/native/NativeProxy.mm +4 -1
  23. package/ios/native/REAIOSErrorHandler.mm +1 -1
  24. package/ios/native/REAIOSLogger.mm +1 -1
  25. package/ios/native/REAIOSScheduler.mm +1 -1
  26. package/ios/native/REAInitializer.mm +1 -1
  27. package/ios/native/REAMessageThread.mm +2 -2
  28. package/lib/commonjs/Animated.js +0 -8
  29. package/lib/commonjs/Animated.js.map +1 -1
  30. package/lib/commonjs/ConfigHelper.js +8 -19
  31. package/lib/commonjs/ConfigHelper.js.map +1 -1
  32. package/lib/commonjs/createAnimatedComponent.js +20 -158
  33. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  34. package/lib/commonjs/index.js +0 -9
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/index.web.js +0 -7
  37. package/lib/commonjs/index.web.js.map +1 -1
  38. package/lib/commonjs/reanimated2/Bezier.js +14 -34
  39. package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
  40. package/lib/commonjs/reanimated2/Colors.js +60 -132
  41. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  42. package/lib/commonjs/reanimated2/Easing.js +81 -34
  43. package/lib/commonjs/reanimated2/Easing.js.map +1 -1
  44. package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
  45. package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
  46. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
  47. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  48. package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
  49. package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
  50. package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
  51. package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
  52. package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
  53. package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
  54. package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
  55. package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
  56. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
  57. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
  58. package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
  59. package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
  60. package/lib/commonjs/reanimated2/animation/decay.js +7 -18
  61. package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
  62. package/lib/commonjs/reanimated2/animation/delay.js +0 -11
  63. package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
  64. package/lib/commonjs/reanimated2/animation/index.js +0 -8
  65. package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
  66. package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
  67. package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
  68. package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
  69. package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
  70. package/lib/commonjs/reanimated2/animation/spring.js +11 -23
  71. package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
  72. package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
  73. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  74. package/lib/commonjs/reanimated2/animation/timing.js +0 -11
  75. package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
  76. package/lib/commonjs/reanimated2/animation/util.js +11 -41
  77. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  78. package/lib/commonjs/reanimated2/commonTypes.js +16 -23
  79. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  80. package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
  81. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  82. package/lib/commonjs/reanimated2/component/Image.js +0 -4
  83. package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
  84. package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
  85. package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
  86. package/lib/commonjs/reanimated2/component/Text.js +0 -4
  87. package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
  88. package/lib/commonjs/reanimated2/component/View.js +0 -4
  89. package/lib/commonjs/reanimated2/component/View.js.map +1 -1
  90. package/lib/commonjs/reanimated2/core.js +6 -48
  91. package/lib/commonjs/reanimated2/core.js.map +1 -1
  92. package/lib/commonjs/reanimated2/errors.js +3 -14
  93. package/lib/commonjs/reanimated2/errors.js.map +1 -1
  94. package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
  95. package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
  96. package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
  97. package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
  98. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
  99. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  100. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
  101. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  102. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  103. package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
  104. package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
  105. package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
  106. package/lib/commonjs/reanimated2/hook/index.js +0 -12
  107. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  108. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
  109. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
  111. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
  113. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  114. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
  115. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  116. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
  117. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  118. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
  119. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  120. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
  121. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  122. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
  123. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  124. package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
  125. package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
  126. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
  127. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  128. package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
  129. package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
  130. package/lib/commonjs/reanimated2/hook/utils.js +8 -39
  131. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  132. package/lib/commonjs/reanimated2/index.js +0 -26
  133. package/lib/commonjs/reanimated2/index.js.map +1 -1
  134. package/lib/commonjs/reanimated2/initializers.js +21 -43
  135. package/lib/commonjs/reanimated2/initializers.js.map +1 -1
  136. package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
  137. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  138. package/lib/commonjs/reanimated2/interpolation.js +14 -29
  139. package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
  140. package/lib/commonjs/reanimated2/jestUtils.js +11 -44
  141. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  142. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
  143. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  144. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
  145. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  146. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
  147. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
  148. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
  149. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
  150. package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
  151. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  152. package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
  153. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  154. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
  155. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  156. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
  157. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  158. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
  159. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  160. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
  161. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  162. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
  163. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  164. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
  165. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  166. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
  167. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  168. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
  169. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  170. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
  171. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  172. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
  173. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  174. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
  175. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  176. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
  177. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  178. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
  179. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  180. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
  181. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  182. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
  183. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  184. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
  185. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  186. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
  187. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  188. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
  189. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  190. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
  191. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  192. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
  193. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  194. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
  195. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  196. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
  197. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  198. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
  199. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  200. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
  201. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  202. package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
  203. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  204. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
  205. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  206. package/lib/commonjs/reanimated2/mappers.js +26 -32
  207. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  208. package/lib/commonjs/reanimated2/mock.js +5 -15
  209. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  210. package/lib/commonjs/reanimated2/mutables.js +2 -28
  211. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  212. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
  213. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  214. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  215. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
  216. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
  217. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
  218. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
  219. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
  220. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
  221. package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
  222. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
  223. package/lib/commonjs/reanimated2/shareables.js +92 -49
  224. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  225. package/lib/commonjs/reanimated2/threads.js +42 -46
  226. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  227. package/lib/commonjs/reanimated2/utils.js +0 -5
  228. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  229. package/lib/commonjs/reanimated2/valueSetter.js +6 -21
  230. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  231. package/lib/commonjs/setAndForwardRef.js +3 -3
  232. package/lib/commonjs/setAndForwardRef.js.map +1 -1
  233. package/lib/module/Animated.js.map +1 -1
  234. package/lib/module/ConfigHelper.js +9 -15
  235. package/lib/module/ConfigHelper.js.map +1 -1
  236. package/lib/module/createAnimatedComponent.js +20 -139
  237. package/lib/module/createAnimatedComponent.js.map +1 -1
  238. package/lib/module/index.js +0 -2
  239. package/lib/module/index.js.map +1 -1
  240. package/lib/module/index.web.js.map +1 -1
  241. package/lib/module/reanimated2/Bezier.js +14 -33
  242. package/lib/module/reanimated2/Bezier.js.map +1 -1
  243. package/lib/module/reanimated2/Colors.js +59 -109
  244. package/lib/module/reanimated2/Colors.js.map +1 -1
  245. package/lib/module/reanimated2/Easing.js +37 -33
  246. package/lib/module/reanimated2/Easing.js.map +1 -1
  247. package/lib/module/reanimated2/NativeMethods.js +8 -15
  248. package/lib/module/reanimated2/NativeMethods.js.map +1 -1
  249. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
  250. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  251. package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
  252. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  253. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  254. package/lib/module/reanimated2/PropAdapters.js +12 -10
  255. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  256. package/lib/module/reanimated2/UpdateProps.js +3 -5
  257. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  258. package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
  259. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  260. package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
  261. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  262. package/lib/module/reanimated2/animation/decay.js +7 -15
  263. package/lib/module/reanimated2/animation/decay.js.map +1 -1
  264. package/lib/module/reanimated2/animation/delay.js +0 -9
  265. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  266. package/lib/module/reanimated2/animation/index.js.map +1 -1
  267. package/lib/module/reanimated2/animation/repeat.js +6 -20
  268. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  269. package/lib/module/reanimated2/animation/sequence.js +3 -18
  270. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  271. package/lib/module/reanimated2/animation/spring.js +11 -21
  272. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  273. package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
  274. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  275. package/lib/module/reanimated2/animation/timing.js +0 -8
  276. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  277. package/lib/module/reanimated2/animation/util.js +10 -33
  278. package/lib/module/reanimated2/animation/util.js.map +1 -1
  279. package/lib/module/reanimated2/commonTypes.js +12 -19
  280. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  281. package/lib/module/reanimated2/component/FlatList.js +0 -4
  282. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  283. package/lib/module/reanimated2/component/Image.js.map +1 -1
  284. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  285. package/lib/module/reanimated2/component/Text.js.map +1 -1
  286. package/lib/module/reanimated2/component/View.js.map +1 -1
  287. package/lib/module/reanimated2/core.js +6 -22
  288. package/lib/module/reanimated2/core.js.map +1 -1
  289. package/lib/module/reanimated2/errors.js +3 -13
  290. package/lib/module/reanimated2/errors.js.map +1 -1
  291. package/lib/module/reanimated2/fabricUtils.js +3 -3
  292. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  293. package/lib/module/reanimated2/fabricUtils.web.js +1 -1
  294. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  295. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
  296. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  297. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
  298. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  299. package/lib/module/reanimated2/globals.d.js.map +1 -1
  300. package/lib/module/reanimated2/hook/Hooks.js +3 -2
  301. package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
  302. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  303. package/lib/module/reanimated2/hook/index.js.map +1 -1
  304. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
  305. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  306. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
  307. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  308. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
  309. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  310. package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
  311. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  312. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
  313. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  314. package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
  315. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  316. package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
  317. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  318. package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
  319. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  320. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  321. package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
  322. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  323. package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
  324. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  325. package/lib/module/reanimated2/hook/utils.js +8 -21
  326. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  327. package/lib/module/reanimated2/index.js.map +1 -1
  328. package/lib/module/reanimated2/initializers.js +23 -37
  329. package/lib/module/reanimated2/initializers.js.map +1 -1
  330. package/lib/module/reanimated2/interpolateColor.js +5 -34
  331. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  332. package/lib/module/reanimated2/interpolation.js +13 -28
  333. package/lib/module/reanimated2/interpolation.js.map +1 -1
  334. package/lib/module/reanimated2/jestUtils.js +11 -35
  335. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  336. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
  337. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  338. package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
  339. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  340. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
  341. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
  342. package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
  343. package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
  344. package/lib/module/reanimated2/js-reanimated/global.js +2 -6
  345. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  346. package/lib/module/reanimated2/js-reanimated/index.js +3 -9
  347. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  348. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
  349. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  350. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
  351. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  352. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
  353. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  354. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
  355. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  356. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  357. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
  358. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  359. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
  360. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  361. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
  362. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  363. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
  364. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  365. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
  366. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  367. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
  368. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  369. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
  370. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  371. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
  372. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  373. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
  374. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  375. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
  376. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  377. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
  378. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  379. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  380. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
  381. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  382. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
  383. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  384. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
  385. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  386. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
  387. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  388. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
  389. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  390. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
  391. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  392. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  393. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  394. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
  395. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  396. package/lib/module/reanimated2/mappers.js +26 -25
  397. package/lib/module/reanimated2/mappers.js.map +1 -1
  398. package/lib/module/reanimated2/mock.js +5 -15
  399. package/lib/module/reanimated2/mock.js.map +1 -1
  400. package/lib/module/reanimated2/mutables.js +2 -19
  401. package/lib/module/reanimated2/mutables.js.map +1 -1
  402. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  403. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  404. package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
  405. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
  406. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
  407. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
  408. package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
  409. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
  410. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  411. package/lib/module/reanimated2/shareables.js +96 -44
  412. package/lib/module/reanimated2/shareables.js.map +1 -1
  413. package/lib/module/reanimated2/threads.js +39 -33
  414. package/lib/module/reanimated2/threads.js.map +1 -1
  415. package/lib/module/reanimated2/utils.js +0 -3
  416. package/lib/module/reanimated2/utils.js.map +1 -1
  417. package/lib/module/reanimated2/valueSetter.js +6 -19
  418. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  419. package/lib/module/setAndForwardRef.js +3 -2
  420. package/lib/module/setAndForwardRef.js.map +1 -1
  421. package/package.json +46 -40
  422. package/plugin/.eslintrc.js +7 -0
  423. package/plugin/README.md +241 -0
  424. package/plugin/build/plugin.js +714 -0
  425. package/plugin/build/plugin.js.map +7 -0
  426. package/plugin/index.js +1 -807
  427. package/plugin/package.json +23 -0
  428. package/plugin/src/buildWorkletString.ts +213 -0
  429. package/plugin/src/commonObjects.ts +60 -0
  430. package/plugin/src/injectVersion.ts +37 -0
  431. package/plugin/src/makeWorklet.ts +375 -0
  432. package/plugin/src/plugin.ts +49 -0
  433. package/plugin/src/processForCalleesWorklets.ts +106 -0
  434. package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
  435. package/plugin/src/processIfWorkletFunction.ts +55 -0
  436. package/plugin/src/processIfWorkletNode.ts +44 -0
  437. package/plugin/src/processInlineStylesWarning.ts +129 -0
  438. package/plugin/src/processWorkletObjectMethod.ts +31 -0
  439. package/plugin/src/types.ts +15 -0
  440. package/plugin/src/utils.ts +6 -0
  441. package/plugin/tsconfig.json +15 -0
  442. package/plugin/yarn.lock +2193 -0
  443. package/react-native-reanimated.d.ts +1 -0
  444. package/scripts/reanimated_utils.rb +2 -2
  445. package/src/createAnimatedComponent.tsx +2 -3
  446. package/src/reanimated2/Easing.ts +19 -0
  447. package/src/reanimated2/NativeMethods.ts +9 -4
  448. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
  449. package/src/reanimated2/UpdateProps.ts +2 -2
  450. package/src/reanimated2/animation/decay.ts +7 -1
  451. package/src/reanimated2/animation/styleAnimation.ts +5 -1
  452. package/src/reanimated2/core.ts +4 -4
  453. package/src/reanimated2/errors.ts +1 -0
  454. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
  455. package/src/reanimated2/globals.d.ts +71 -112
  456. package/src/reanimated2/hook/commonTypes.ts +1 -1
  457. package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
  458. package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
  459. package/src/reanimated2/initializers.ts +11 -8
  460. package/src/reanimated2/jestUtils.ts +0 -1
  461. package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
  462. package/src/reanimated2/js-reanimated/index.ts +1 -1
  463. package/src/reanimated2/mappers.ts +26 -4
  464. package/src/reanimated2/mock.ts +1 -0
  465. package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
  466. package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
  467. package/src/reanimated2/shareables.ts +107 -8
  468. package/src/reanimated2/threads.ts +36 -17
  469. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
  470. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
  471. package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
  472. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
  473. package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
@@ -1 +1 @@
1
- {"version":3,"names":["JSReanimated","NativeReanimated","constructor","Map","makeShareableClone","value","__hostObjectShareableJSRef","installCoreFunctions","_callGuard","_valueUnpacker","scheduleOnUI","worklet","requestAnimationFrame","registerEventHandler","_eventHash","_eventHandler","unregisterEventHandler","_","enableLayoutAnimations","console","warn","registerSensor","sensorType","interval","iosReferenceFrame","eventHandler","getSensorName","window","sensor","initializeSensor","callback","SensorType","ROTATION","qw","qx","qy","qz","quaternion","yaw","Math","atan2","pitch","sin","roll","interfaceOrientation","x","y","z","addEventListener","start","sensors","set","nextSensorId","unregisterSensor","id","get","undefined","stop","delete","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","config","referenceFrame","frequency","ACCELEROMETER","Accelerometer","GYROSCOPE","Gyroscope","GRAVITY","GravitySensor","MAGNETIC_FIELD","Magnetometer","AbsoluteOrientationSensor"],"sources":["JSReanimated.ts"],"sourcesContent":["import { NativeReanimated } from '../NativeReanimated/NativeReanimated';\nimport {\n SensorType,\n ShareableRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport { WebSensor } from './WebSensor';\n\nexport default class JSReanimated extends NativeReanimated {\n nextSensorId = 0;\n sensors = new Map<number, WebSensor>();\n\n constructor() {\n super(false);\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return { __hostObjectShareableJSRef: value };\n }\n\n installCoreFunctions(\n _callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n _valueUnpacker: <T>(value: T) => T\n ): void {\n // noop\n }\n\n scheduleOnUI<T>(worklet: ShareableRef<T>) {\n // @ts-ignore web implementation has still not been updated after the rewrite, this will be addressed once the web implementation updates are ready\n requestAnimationFrame(worklet);\n }\n\n registerEventHandler<T>(\n _eventHash: string,\n _eventHandler: ShareableRef<T>\n ): string {\n // noop\n return '';\n }\n\n unregisterEventHandler(_: string): void {\n // noop\n }\n\n enableLayoutAnimations() {\n console.warn(\n '[Reanimated] enableLayoutAnimations is not available for WEB yet'\n );\n }\n\n registerSensor(\n sensorType: SensorType,\n interval: number,\n iosReferenceFrame: number,\n eventHandler: (data: Value3D | ValueRotation) => void\n ): number {\n if (!(this.getSensorName(sensorType) in window)) {\n return -1;\n }\n\n const sensor: WebSensor = this.initializeSensor(sensorType, interval);\n let callback;\n if (sensorType === SensorType.ROTATION) {\n callback = () => {\n const [qw, qx, qy, qz] = sensor.quaternion;\n\n // reference: https://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion\n const yaw = Math.atan2(\n 2.0 * (qy * qz + qw * qx),\n qw * qw - qx * qx - qy * qy + qz * qz\n );\n const pitch = Math.sin(-2.0 * (qx * qz - qw * qy));\n const roll = Math.atan2(\n 2.0 * (qx * qy + qw * qz),\n qw * qw + qx * qx - qy * qy - qz * qz\n );\n eventHandler({\n qw,\n qx,\n qy,\n qz,\n yaw,\n pitch,\n roll,\n interfaceOrientation: 0,\n });\n };\n } else {\n callback = () => {\n const { x, y, z } = sensor;\n eventHandler({ x, y, z, interfaceOrientation: 0 });\n };\n }\n sensor.addEventListener('reading', callback);\n sensor.start();\n\n this.sensors.set(this.nextSensorId, sensor);\n return this.nextSensorId++;\n }\n\n unregisterSensor(id: number): void {\n const sensor: WebSensor | undefined = this.sensors.get(id);\n if (sensor !== undefined) {\n sensor.stop();\n this.sensors.delete(id);\n }\n }\n\n subscribeForKeyboardEvents(_: ShareableRef<number>): number {\n console.warn(\n '[Reanimated] useAnimatedKeyboard is not available on web yet.'\n );\n return -1;\n }\n\n unsubscribeFromKeyboardEvents(_: number): void {\n // noop\n }\n\n initializeSensor(sensorType: SensorType, interval: number): WebSensor {\n const config =\n interval <= 0\n ? { referenceFrame: 'device' }\n : { frequency: 1000 / interval };\n switch (sensorType) {\n case SensorType.ACCELEROMETER:\n return new window.Accelerometer(config);\n case SensorType.GYROSCOPE:\n return new window.Gyroscope(config);\n case SensorType.GRAVITY:\n return new window.GravitySensor(config);\n case SensorType.MAGNETIC_FIELD:\n return new window.Magnetometer(config);\n case SensorType.ROTATION:\n return new window.AbsoluteOrientationSensor(config);\n }\n }\n\n getSensorName(sensorType: SensorType): string {\n switch (sensorType) {\n case SensorType.ACCELEROMETER:\n return 'Accelerometer';\n case SensorType.GRAVITY:\n return 'GravitySensor';\n case SensorType.GYROSCOPE:\n return 'Gyroscope';\n case SensorType.MAGNETIC_FIELD:\n return 'Magnetometer';\n case SensorType.ROTATION:\n return 'AbsoluteOrientationSensor';\n }\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;;;AAQe,MAAMA,YAAN,SAA2BC,kCAA3B,CAA4C;EAIzDC,WAAW,GAAG;IACZ,MAAM,KAAN;;IADY,sCAHC,CAGD;;IAAA,iCAFJ,IAAIC,GAAJ,EAEI;EAEb;;EAEDC,kBAAkB,CAAIC,KAAJ,EAA+B;IAC/C,OAAO;MAAEC,0BAA0B,EAAED;IAA9B,CAAP;EAC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cAAc,EAAE;IAAlB,CADJ,GAEI;MAAEC,SAAS,EAAE,OAAOxC;IAApB,CAHN;;IAIA,QAAQD,UAAR;MACE,KAAKS,uBAAA,CAAWiC,aAAhB;QACE,OAAO,IAAIrC,MAAM,CAACsC,aAAX,CAAyBJ,MAAzB,CAAP;;MACF,KAAK9B,uBAAA,CAAWmC,SAAhB;QACE,OAAO,IAAIvC,MAAM,CAACwC,SAAX,CAAqBN,MAArB,CAAP;;MACF,KAAK9B,uBAAA,CAAWqC,OAAhB;QACE,OAAO,IAAIzC,MAAM,CAAC0C,aAAX,CAAyBR,MAAzB,CAAP;;MACF,KAAK9B,uBAAA,CAAWuC,cAAhB;QACE,OAAO,IAAI3C,MAAM,CAAC4C,YAAX,CAAwBV,MAAxB,CAAP;;MACF,KAAK9B,uBAAA,CAAWC,QAAhB;QACE,OAAO,IAAIL,MAAM,CAAC6C,yBAAX,CAAqCX,MAArC,CAAP;IAVJ;EAYD;;EAEDnC,aAAa,CAACJ,UAAD,EAAiC;IAC5C,QAAQA,UAAR;MACE,KAAKS,uBAAA,CAAWiC,aAAhB;QACE,OAAO,eAAP;;MACF,KAAKjC,uBAAA,CAAWqC,OAAhB;QACE,OAAO,eAAP;;MACF,KAAKrC,uBAAA,CAAWmC,SAAhB;QACE,OAAO,WAAP;;MACF,KAAKnC,uBAAA,CAAWuC,cAAhB;QACE,OAAO,cAAP;;MACF,KAAKvC,uBAAA,CAAWC,QAAhB;QACE,OAAO,2BAAP;IAVJ;EAYD;;AAlJwD"}
1
+ {"version":3,"names":["_NativeReanimated","require","_commonTypes","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","JSReanimated","NativeReanimated","constructor","Map","makeShareableClone","__hostObjectShareableJSRef","installCoreFunctions","_callGuard","_valueUnpacker","scheduleOnUI","worklet","requestAnimationFrame","registerEventHandler","_eventHash","_eventHandler","unregisterEventHandler","_","enableLayoutAnimations","console","warn","configureLayoutAnimation","registerSensor","sensorType","interval","iosReferenceFrame","eventHandler","getSensorName","window","sensor","initializeSensor","callback","SensorType","ROTATION","qw","qx","qy","qz","quaternion","yaw","Math","atan2","pitch","sin","roll","interfaceOrientation","x","y","z","addEventListener","start","sensors","set","nextSensorId","unregisterSensor","id","get","stop","delete","subscribeForKeyboardEvents","unsubscribeFromKeyboardEvents","config","referenceFrame","frequency","ACCELEROMETER","Accelerometer","GYROSCOPE","Gyroscope","GRAVITY","GravitySensor","MAGNETIC_FIELD","Magnetometer","AbsoluteOrientationSensor","exports","default"],"sources":["JSReanimated.ts"],"sourcesContent":["import { NativeReanimated } from '../NativeReanimated/NativeReanimated';\nimport {\n SensorType,\n ShareableRef,\n Value3D,\n ValueRotation,\n} from '../commonTypes';\nimport { WebSensor } from './WebSensor';\n\nexport default class JSReanimated extends NativeReanimated {\n nextSensorId = 0;\n sensors = new Map<number, WebSensor>();\n\n constructor() {\n super(false);\n }\n\n makeShareableClone<T>(value: T): ShareableRef<T> {\n return { __hostObjectShareableJSRef: value };\n }\n\n installCoreFunctions(\n _callGuard: <T extends Array<any>, U>(\n fn: (...args: T) => U,\n ...args: T\n ) => void,\n _valueUnpacker: <T>(value: T) => T\n ): void {\n // noop\n }\n\n scheduleOnUI<T>(worklet: ShareableRef<T>) {\n // @ts-ignore web implementation has still not been updated after the rewrite, this will be addressed once the web implementation updates are ready\n requestAnimationFrame(worklet);\n }\n\n registerEventHandler<T>(\n _eventHash: string,\n _eventHandler: ShareableRef<T>\n ): string {\n // noop\n return '';\n }\n\n unregisterEventHandler(_: string): void {\n // noop\n }\n\n enableLayoutAnimations() {\n console.warn(\n '[Reanimated] Layout Animations are not supported on web yet.'\n );\n }\n\n configureLayoutAnimation() {\n // no-op\n }\n\n registerSensor(\n sensorType: SensorType,\n interval: number,\n iosReferenceFrame: number,\n eventHandler: (data: Value3D | ValueRotation) => void\n ): number {\n if (!(this.getSensorName(sensorType) in window)) {\n return -1;\n }\n\n const sensor: WebSensor = this.initializeSensor(sensorType, interval);\n let callback;\n if (sensorType === SensorType.ROTATION) {\n callback = () => {\n const [qw, qx, qy, qz] = sensor.quaternion;\n\n // reference: https://stackoverflow.com/questions/5782658/extracting-yaw-from-a-quaternion\n const yaw = Math.atan2(\n 2.0 * (qy * qz + qw * qx),\n qw * qw - qx * qx - qy * qy + qz * qz\n );\n const pitch = Math.sin(-2.0 * (qx * qz - qw * qy));\n const roll = Math.atan2(\n 2.0 * (qx * qy + qw * qz),\n qw * qw + qx * qx - qy * qy - qz * qz\n );\n eventHandler({\n qw,\n qx,\n qy,\n qz,\n yaw,\n pitch,\n roll,\n interfaceOrientation: 0,\n });\n };\n } else {\n callback = () => {\n const { x, y, z } = sensor;\n eventHandler({ x, y, z, interfaceOrientation: 0 });\n };\n }\n sensor.addEventListener('reading', callback);\n sensor.start();\n\n this.sensors.set(this.nextSensorId, sensor);\n return this.nextSensorId++;\n }\n\n unregisterSensor(id: number): void {\n const sensor: WebSensor | undefined = this.sensors.get(id);\n if (sensor !== undefined) {\n sensor.stop();\n this.sensors.delete(id);\n }\n }\n\n subscribeForKeyboardEvents(_: ShareableRef<number>): number {\n console.warn(\n '[Reanimated] useAnimatedKeyboard is not available on web yet.'\n );\n return -1;\n }\n\n unsubscribeFromKeyboardEvents(_: number): void {\n // noop\n }\n\n initializeSensor(sensorType: SensorType, interval: number): WebSensor {\n const config =\n interval <= 0\n ? { referenceFrame: 'device' }\n : { frequency: 1000 / interval };\n switch (sensorType) {\n case SensorType.ACCELEROMETER:\n return new window.Accelerometer(config);\n case SensorType.GYROSCOPE:\n return new window.Gyroscope(config);\n case SensorType.GRAVITY:\n return new window.GravitySensor(config);\n case SensorType.MAGNETIC_FIELD:\n return new window.Magnetometer(config);\n case SensorType.ROTATION:\n return new window.AbsoluteOrientationSensor(config);\n }\n }\n\n getSensorName(sensorType: SensorType): string {\n switch (sensorType) {\n case SensorType.ACCELEROMETER:\n return 'Accelerometer';\n case SensorType.GRAVITY:\n return 'GravitySensor';\n case SensorType.GYROSCOPE:\n return 'Gyroscope';\n case SensorType.MAGNETIC_FIELD:\n return 'Magnetometer';\n case SensorType.ROTATION:\n return 'AbsoluteOrientationSensor';\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKwB,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAGT,MAAMU,YAAY,SAASC,kCAAgB,CAAC;EAIzDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,KAAK,CAAC;IAACzB,eAAA,uBAJA,CAAC;IAAAA,eAAA,kBACN,IAAI0B,GAAG,EAAqB;EAItC;EAEAC,kBAAkBA,CAAIxB,KAAQ,EAAmB;IAC/C,OAAO;MAAEyB,0BAA0B,EAAEzB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,CAAC3C,CAAS,EAAQ;IAC7C;EAAA;EAGFa,gBAAgBA,CAACP,UAAsB,EAAEC,QAAgB,EAAa;IACpE,MAAMqC,MAAM,GACVrC,QAAQ,IAAI,CAAC,GACT;MAAEsC,cAAc,EAAE;IAAS,CAAC,GAC5B;MAAEC,SAAS,EAAE,IAAI,GAAGvC;IAAS,CAAC;IACpC,QAAQD,UAAU;MAChB,KAAKS,uBAAU,CAACgC,aAAa;QAC3B,OAAO,IAAIpC,MAAM,CAACqC,aAAa,CAACJ,MAAM,CAAC;MACzC,KAAK7B,uBAAU,CAACkC,SAAS;QACvB,OAAO,IAAItC,MAAM,CAACuC,SAAS,CAACN,MAAM,CAAC;MACrC,KAAK7B,uBAAU,CAACoC,OAAO;QACrB,OAAO,IAAIxC,MAAM,CAACyC,aAAa,CAACR,MAAM,CAAC;MACzC,KAAK7B,uBAAU,CAACsC,cAAc;QAC5B,OAAO,IAAI1C,MAAM,CAAC2C,YAAY,CAACV,MAAM,CAAC;MACxC,KAAK7B,uBAAU,CAACC,QAAQ;QACtB,OAAO,IAAIL,MAAM,CAAC4C,yBAAyB,CAACX,MAAM,CAAC;IAAC;EAE1D;EAEAlC,aAAaA,CAACJ,UAAsB,EAAU;IAC5C,QAAQA,UAAU;MAChB,KAAKS,uBAAU,CAACgC,aAAa;QAC3B,OAAO,eAAe;MACxB,KAAKhC,uBAAU,CAACoC,OAAO;QACrB,OAAO,eAAe;MACxB,KAAKpC,uBAAU,CAACkC,SAAS;QACvB,OAAO,WAAW;MACpB,KAAKlC,uBAAU,CAACsC,cAAc;QAC5B,OAAO,cAAc;MACvB,KAAKtC,uBAAU,CAACC,QAAQ;QACtB,OAAO,2BAA2B;IAAC;EAEzC;AACF;AAACwC,OAAA,CAAAC,OAAA,GAAAzE,YAAA"}
@@ -4,60 +4,48 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _PlatformChecker = require("../PlatformChecker");
9
-
10
8
  var _MutableValue = _interopRequireDefault(require("./MutableValue"));
11
-
12
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
-
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
13
  class Mapper {
17
14
  constructor(module, mapper) {
18
15
  let inputs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
19
16
  let outputs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
20
-
21
17
  _defineProperty(this, "id", void 0);
22
-
23
18
  _defineProperty(this, "inputs", void 0);
24
-
25
19
  _defineProperty(this, "outputs", void 0);
26
-
27
20
  _defineProperty(this, "mapper", void 0);
28
-
29
21
  _defineProperty(this, "dirty", true);
30
-
31
22
  this.id = Mapper.MAPPER_ID++;
32
23
  this.inputs = this.extractMutablesFromArray(inputs);
33
24
  this.outputs = this.extractMutablesFromArray(outputs);
34
25
  this.mapper = mapper;
35
-
36
26
  const markDirty = () => {
37
27
  this.dirty = true;
38
28
  module.maybeRequestRender();
39
29
  };
40
-
41
30
  this.inputs.forEach(input => {
42
31
  input.addListener(markDirty);
43
32
  });
44
33
  }
45
-
46
34
  execute() {
47
35
  this.dirty = false;
48
36
  this.mapper();
49
37
  }
50
-
51
38
  extractMutablesFromArray(array) {
52
39
  const res = [];
53
-
54
40
  function extractMutables(value) {
55
- if (value == null) {// return;
41
+ if (value == null) {
42
+ // return;
56
43
  } else if (value instanceof _MutableValue.default) {
57
44
  res.push(value);
58
45
  } else if (Array.isArray(value)) {
59
46
  value.forEach(v => extractMutables(v));
60
- } else if (isWebDomElement(value)) {// do nothing on dom elements
47
+ } else if (isWebDomElement(value)) {
48
+ // do nothing on dom elements
61
49
  // without this check, we get a "Maximum call size exceeded error"
62
50
  } else if (typeof value === 'object') {
63
51
  Object.keys(value).forEach(key => {
@@ -65,32 +53,25 @@ class Mapper {
65
53
  });
66
54
  }
67
55
  }
68
-
69
56
  extractMutables(array);
70
57
  return res;
71
58
  }
72
-
73
59
  }
74
-
75
60
  exports.default = Mapper;
76
-
77
61
  _defineProperty(Mapper, "MAPPER_ID", 1);
78
-
79
62
  function isWebDomElement(value) {
80
63
  if (!(0, _PlatformChecker.shouldBeUseWeb)()) {
81
64
  return false;
82
- } // https://stackoverflow.com/a/384380/7869175
83
-
65
+ }
84
66
 
67
+ // https://stackoverflow.com/a/384380/7869175
85
68
  function isWebNode(o) {
86
69
  return typeof Node === 'object' ? o instanceof Node : o && typeof o === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string';
87
70
  }
88
-
89
71
  function isWebElement(o) {
90
72
  return typeof HTMLElement === 'object' ? o instanceof HTMLElement // DOM2
91
73
  : o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
92
74
  }
93
-
94
75
  return isWebNode(value) || isWebElement(value);
95
76
  }
96
77
  //# sourceMappingURL=Mapper.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Mapper","constructor","module","mapper","inputs","outputs","id","MAPPER_ID","extractMutablesFromArray","markDirty","dirty","maybeRequestRender","forEach","input","addListener","execute","array","res","extractMutables","value","MutableValue","push","Array","isArray","v","isWebDomElement","Object","keys","key","shouldBeUseWeb","isWebNode","o","Node","nodeType","nodeName","isWebElement","HTMLElement"],"sources":["Mapper.ts"],"sourcesContent":["import { NestedObjectValues } from '../commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport { JSReanimated } from './commonTypes';\nimport MutableValue from './MutableValue';\n\nexport default class Mapper<T> {\n static MAPPER_ID = 1;\n id: number;\n inputs: MutableValue<T>[];\n outputs: MutableValue<T>[];\n mapper: () => void;\n\n dirty = true;\n\n constructor(\n module: JSReanimated,\n mapper: () => void,\n inputs: NestedObjectValues<MutableValue<T>>[] = [],\n outputs: NestedObjectValues<MutableValue<T>>[] = []\n ) {\n this.id = Mapper.MAPPER_ID++;\n this.inputs = this.extractMutablesFromArray(inputs);\n this.outputs = this.extractMutablesFromArray(outputs);\n this.mapper = mapper;\n\n const markDirty = () => {\n this.dirty = true;\n module.maybeRequestRender();\n };\n\n this.inputs.forEach((input) => {\n input.addListener(markDirty);\n });\n }\n\n execute(): void {\n this.dirty = false;\n this.mapper();\n }\n\n extractMutablesFromArray<T>(\n array: NestedObjectValues<MutableValue<T>>\n ): MutableValue<T>[] {\n const res: MutableValue<T>[] = [];\n\n function extractMutables(value: NestedObjectValues<MutableValue<T>>) {\n if (value == null) {\n // return;\n } else if (value instanceof MutableValue) {\n res.push(value);\n } else if (Array.isArray(value)) {\n value.forEach((v) => extractMutables(v));\n } else if (isWebDomElement(value)) {\n // do nothing on dom elements\n // without this check, we get a \"Maximum call size exceeded error\"\n } else if (typeof value === 'object') {\n Object.keys(value).forEach((key) => {\n extractMutables(value[key]);\n });\n }\n }\n\n extractMutables(array);\n return res;\n }\n}\n\nfunction isWebDomElement(value: any) {\n if (!shouldBeUseWeb()) {\n return false;\n }\n\n // https://stackoverflow.com/a/384380/7869175\n function isWebNode(o: any) {\n return typeof Node === 'object'\n ? o instanceof Node\n : o &&\n typeof o === 'object' &&\n typeof o.nodeType === 'number' &&\n typeof o.nodeName === 'string';\n }\n\n function isWebElement(o: any) {\n return typeof HTMLElement === 'object'\n ? o instanceof HTMLElement // DOM2\n : o &&\n typeof o === 'object' &&\n o !== null &&\n o.nodeType === 1 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M,MAGA,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;QACpCO,MAAM,CAACC,IAAP,CAAYR,KAAZ,EAAmBP,OAAnB,CAA4BgB,GAAD,IAAS;UAClCV,eAAe,CAACC,KAAK,CAACS,GAAD,CAAN,CAAf;QACD,CAFD;MAGD;IACF;;IAEDV,eAAe,CAACF,KAAD,CAAf;IACA,OAAOC,GAAP;EACD;;AA3D4B;;;;gBAAVjB,M,eACA,C;;AA6DrB,SAASyB,eAAT,CAAyBN,KAAzB,EAAqC;EACnC,IAAI,CAAC,IAAAU,+BAAA,GAAL,EAAuB;IACrB,OAAO,KAAP;EACD,CAHkC,CAKnC;;;EACA,SAASC,SAAT,CAAmBC,CAAnB,EAA2B;IACzB,OAAO,OAAOC,IAAP,KAAgB,QAAhB,GACHD,CAAC,YAAYC,IADV,GAEHD,CAAC,IACC,OAAOA,CAAP,KAAa,QADf,IAEE,OAAOA,CAAC,CAACE,QAAT,KAAsB,QAFxB,IAGE,OAAOF,CAAC,CAACG,QAAT,KAAsB,QAL5B;EAMD;;EAED,SAASC,YAAT,CAAsBJ,CAAtB,EAA8B;IAC5B,OAAO,OAAOK,WAAP,KAAuB,QAAvB,GACHL,CAAC,YAAYK,WADV,CACsB;IADtB,EAEHL,CAAC,IACC,OAAOA,CAAP,KAAa,QADf,IAEEA,CAAC,KAAK,IAFR,IAGEA,CAAC,CAACE,QAAF,KAAe,CAHjB,IAIE,OAAOF,CAAC,CAACG,QAAT,KAAsB,QAN5B;EAOD;;EAED,OAAOJ,SAAS,CAACX,KAAD,CAAT,IAAoBgB,YAAY,CAAChB,KAAD,CAAvC;AACD"}
1
+ {"version":3,"names":["_PlatformChecker","require","_MutableValue","_interopRequireDefault","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Mapper","constructor","module","mapper","inputs","arguments","length","outputs","id","MAPPER_ID","extractMutablesFromArray","markDirty","dirty","maybeRequestRender","forEach","addListener","execute","array","extractMutables","MutableValue","push","Array","isArray","v","isWebDomElement","keys","exports","shouldBeUseWeb","isWebNode","o","Node","nodeType","nodeName","isWebElement","HTMLElement"],"sources":["Mapper.ts"],"sourcesContent":["import { NestedObjectValues } from '../commonTypes';\nimport { shouldBeUseWeb } from '../PlatformChecker';\nimport { JSReanimated } from './commonTypes';\nimport MutableValue from './MutableValue';\n\nexport default class Mapper<T> {\n static MAPPER_ID = 1;\n id: number;\n inputs: MutableValue<T>[];\n outputs: MutableValue<T>[];\n mapper: () => void;\n\n dirty = true;\n\n constructor(\n module: JSReanimated,\n mapper: () => void,\n inputs: NestedObjectValues<MutableValue<T>>[] = [],\n outputs: NestedObjectValues<MutableValue<T>>[] = []\n ) {\n this.id = Mapper.MAPPER_ID++;\n this.inputs = this.extractMutablesFromArray(inputs);\n this.outputs = this.extractMutablesFromArray(outputs);\n this.mapper = mapper;\n\n const markDirty = () => {\n this.dirty = true;\n module.maybeRequestRender();\n };\n\n this.inputs.forEach((input) => {\n input.addListener(markDirty);\n });\n }\n\n execute(): void {\n this.dirty = false;\n this.mapper();\n }\n\n extractMutablesFromArray<T>(\n array: NestedObjectValues<MutableValue<T>>\n ): MutableValue<T>[] {\n const res: MutableValue<T>[] = [];\n\n function extractMutables(value: NestedObjectValues<MutableValue<T>>) {\n if (value == null) {\n // return;\n } else if (value instanceof MutableValue) {\n res.push(value);\n } else if (Array.isArray(value)) {\n value.forEach((v) => extractMutables(v));\n } else if (isWebDomElement(value)) {\n // do nothing on dom elements\n // without this check, we get a \"Maximum call size exceeded error\"\n } else if (typeof value === 'object') {\n Object.keys(value).forEach((key) => {\n extractMutables(value[key]);\n });\n }\n }\n\n extractMutables(array);\n return res;\n }\n}\n\nfunction isWebDomElement(value: any) {\n if (!shouldBeUseWeb()) {\n return false;\n }\n\n // https://stackoverflow.com/a/384380/7869175\n function isWebNode(o: any) {\n return typeof Node === 'object'\n ? o instanceof Node\n : o &&\n typeof o === 'object' &&\n typeof o.nodeType === 'number' &&\n typeof o.nodeName === 'string';\n }\n\n function isWebElement(o: any) {\n return typeof HTMLElement === 'object'\n ? o instanceof HTMLElement // DOM2\n : o &&\n typeof o === 'object' &&\n o !== null &&\n o.nodeType === 1 &&\n typeof o.nodeName === 'string';\n }\n\n return isWebNode(value) || isWebElement(value);\n}\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0C,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAE3B,MAAMU,MAAM,CAAI;EAS7BC,WAAWA,CAC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 +4,56 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
-
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
10
  class MapperRegistry {
11
11
  constructor(module) {
12
12
  _defineProperty(this, "sortedMappers", []);
13
-
14
13
  _defineProperty(this, "mappers", new Map());
15
-
16
14
  _defineProperty(this, "_module", void 0);
17
-
18
15
  _defineProperty(this, "updatedSinceLastExecute", false);
19
-
20
16
  this._module = module;
21
17
  }
22
-
23
18
  startMapper(mapper) {
24
19
  this.mappers.set(mapper.id, mapper);
25
20
  this.updatedSinceLastExecute = true;
26
21
  return mapper.id;
27
22
  }
28
-
29
23
  stopMapper(id) {
30
24
  this.mappers.delete(id);
31
25
  this.updatedSinceLastExecute = true;
32
26
  }
33
-
34
27
  execute() {
35
28
  if (this.updatedSinceLastExecute) {
36
29
  this.updateOrder();
37
30
  this.updatedSinceLastExecute = false;
38
31
  }
39
-
40
32
  for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {
41
33
  const mapper = this.sortedMappers[i];
42
-
43
34
  if (mapper.dirty) {
44
35
  mapper.execute();
45
36
  }
46
37
  }
47
38
  }
48
-
49
39
  updateOrder() {
50
40
  const nodes = [...this.mappers.values()].map(mapper => new Node(mapper));
51
41
  const mappersById = {};
52
42
  this.mappers.forEach(mapper => {
53
43
  mappersById[mapper.id] = mapper;
54
- }); // create a graph from array of nodes
44
+ });
55
45
 
46
+ // create a graph from array of nodes
56
47
  for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {
57
48
  const node = nodes[i];
58
-
59
49
  if (node.mapper.outputs.length === 0) {
60
50
  continue;
61
51
  }
62
-
63
52
  for (let j = 0; j < nodesLen; ++j) {
64
53
  const restNode = nodes[j];
65
-
66
54
  if (i === j || restNode.mapper.inputs.length === 0) {
67
55
  continue;
68
56
  }
69
-
70
57
  for (let outi = 0, outputsLen = node.mapper.outputs.length; outi < outputsLen; ++outi) {
71
58
  for (let resti = 0, restLen = restNode.mapper.inputs.length; resti < restLen; ++resti) {
72
59
  if (node.mapper.outputs[outi]._id === restNode.mapper.inputs[resti]._id) {
@@ -76,71 +63,54 @@ class MapperRegistry {
76
63
  }
77
64
  }
78
65
  }
79
-
80
66
  const post = {};
81
67
  let postCounter = 1;
82
-
83
68
  const dfs = node => {
84
69
  const index = nodes.indexOf(node);
85
-
86
70
  if (index === -1) {
87
71
  // this node has already been handled
88
72
  return;
89
73
  }
90
-
91
74
  ++postCounter;
92
75
  nodes.splice(index, 1);
93
-
94
76
  if (node.children.length === 0 && nodes.length > 0) {
95
77
  post[node.mapper.id] = postCounter++;
96
78
  dfs(nodes[0]);
97
79
  return;
98
80
  }
99
-
100
81
  for (let i = 0, len = node.children.length; i < len; ++i) {
101
82
  dfs(node.children[i]);
102
83
  }
103
-
104
84
  post[node.mapper.id] = postCounter++;
105
85
  };
106
-
107
86
  while (nodes.length) dfs(nodes[0]);
108
-
109
87
  const postArray = Object.keys(post).map(key => {
110
88
  const num = parseInt(key);
111
89
  return [num, post[num]];
112
90
  });
113
91
  postArray.sort((a, b) => {
114
92
  return b[1] - a[1];
115
- }); // clear sorted mappers
93
+ });
116
94
 
95
+ // clear sorted mappers
117
96
  this.sortedMappers = [];
118
-
119
97
  for (let i = 0, len = postArray.length; i < len; ++i) {
120
98
  const [id] = postArray[i];
121
99
  this.sortedMappers.push(mappersById[id]);
122
100
  }
123
101
  }
124
-
125
102
  get needRunOnRender() {
126
103
  return this.updatedSinceLastExecute;
127
104
  }
128
-
129
105
  }
130
-
131
106
  exports.default = MapperRegistry;
132
-
133
107
  class Node {
134
108
  constructor(mapper) {
135
109
  let children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
136
-
137
110
  _defineProperty(this, "mapper", void 0);
138
-
139
111
  _defineProperty(this, "children", void 0);
140
-
141
112
  this.mapper = mapper;
142
113
  this.children = children;
143
114
  }
144
-
145
115
  }
146
116
  //# sourceMappingURL=MapperRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MapperRegistry","constructor","module","Map","_module","startMapper","mapper","mappers","set","id","updatedSinceLastExecute","stopMapper","delete","execute","updateOrder","i","len","sortedMappers","length","dirty","nodes","values","map","Node","mappersById","forEach","nodesLen","node","outputs","j","restNode","inputs","outi","outputsLen","resti","restLen","_id","children","push","post","postCounter","dfs","index","indexOf","splice","postArray","Object","keys","key","num","parseInt","sort","a","b","needRunOnRender"],"sources":["MapperRegistry.ts"],"sourcesContent":["import { JSReanimated } from './commonTypes';\nimport Mapper from './Mapper';\n\nexport default class MapperRegistry<T> {\n sortedMappers: Mapper<T>[] = [];\n mappers: Map<number, Mapper<T>> = new Map();\n _module: JSReanimated;\n\n updatedSinceLastExecute = false;\n\n constructor(module: JSReanimated) {\n this._module = module;\n }\n\n startMapper(mapper: Mapper<T>): number {\n this.mappers.set(mapper.id, mapper);\n this.updatedSinceLastExecute = true;\n return mapper.id;\n }\n\n stopMapper(id: number): void {\n this.mappers.delete(id);\n this.updatedSinceLastExecute = true;\n }\n\n execute(): void {\n if (this.updatedSinceLastExecute) {\n this.updateOrder();\n this.updatedSinceLastExecute = false;\n }\n\n for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {\n const mapper = this.sortedMappers[i];\n if (mapper.dirty) {\n mapper.execute();\n }\n }\n }\n\n updateOrder(): void {\n const nodes = [...this.mappers.values()].map((mapper) => new Node(mapper));\n\n const mappersById: Record<number, Mapper<T>> = {};\n this.mappers.forEach((mapper) => {\n mappersById[mapper.id] = mapper;\n });\n\n // create a graph from array of nodes\n for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {\n const node = nodes[i];\n if (node.mapper.outputs.length === 0) {\n continue;\n }\n for (let j = 0; j < nodesLen; ++j) {\n const restNode = nodes[j];\n if (i === j || restNode.mapper.inputs.length === 0) {\n continue;\n }\n for (\n let outi = 0, outputsLen = node.mapper.outputs.length;\n outi < outputsLen;\n ++outi\n ) {\n for (\n let resti = 0, restLen = restNode.mapper.inputs.length;\n resti < restLen;\n ++resti\n ) {\n if (\n node.mapper.outputs[outi]._id ===\n restNode.mapper.inputs[resti]._id\n ) {\n node.children.push(restNode);\n }\n }\n }\n }\n }\n\n const post: Record<number, number> = {};\n let postCounter = 1;\n const dfs = (node: Node<T>) => {\n const index = nodes.indexOf(node);\n if (index === -1) {\n // this node has already been handled\n return;\n }\n ++postCounter;\n nodes.splice(index, 1);\n if (node.children.length === 0 && nodes.length > 0) {\n post[node.mapper.id] = postCounter++;\n dfs(nodes[0]);\n return;\n }\n for (let i = 0, len = node.children.length; i < len; ++i) {\n dfs(node.children[i]);\n }\n post[node.mapper.id] = postCounter++;\n };\n\n while (nodes.length) dfs(nodes[0]);\n\n const postArray = Object.keys(post).map((key) => {\n const num = parseInt(key);\n return [num, post[num]];\n });\n postArray.sort((a, b) => {\n return b[1] - a[1];\n });\n\n // clear sorted mappers\n this.sortedMappers = [];\n\n for (let i = 0, len = postArray.length; i < len; ++i) {\n const [id] = postArray[i];\n this.sortedMappers.push(mappersById[id]);\n }\n }\n\n get needRunOnRender(): boolean {\n return this.updatedSinceLastExecute;\n }\n}\n\nclass Node<T> {\n mapper: Mapper<T>;\n children: Node<T>[];\n\n constructor(mapper: Mapper<T>, children = []) {\n this.mapper = mapper;\n this.children = children;\n }\n}\n"],"mappings":";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B,EAArB;;IAEA,KAAK,IAAIF,CAAC,GAAG,CAAR,EAAWC,GAAG,GAAG6B,SAAS,CAAC3B,MAAhC,EAAwCH,CAAC,GAAGC,GAA5C,EAAiD,EAAED,CAAnD,EAAsD;MACpD,MAAM,CAACN,EAAD,IAAOoC,SAAS,CAAC9B,CAAD,CAAtB;MACA,KAAKE,aAAL,CAAmBqB,IAAnB,CAAwBd,WAAW,CAACf,EAAD,CAAnC;IACD;EACF;;EAEkB,IAAf6C,eAAe,GAAY;IAC7B,OAAO,KAAK5C,uBAAZ;EACD;;AAtHoC;;;;AAyHvC,MAAMa,IAAN,CAAc;EAIZtB,WAAW,CAACK,MAAD,EAAmC;IAAA,IAAf+B,QAAe,uEAAJ,EAAI;;IAAA;;IAAA;;IAC5C,KAAK/B,MAAL,GAAcA,MAAd;IACA,KAAK+B,QAAL,GAAgBA,QAAhB;EACD;;AAPW"}
1
+ {"version":3,"names":["MapperRegistry","constructor","module","_defineProperty","Map","_module","startMapper","mapper","mappers","set","id","updatedSinceLastExecute","stopMapper","delete","execute","updateOrder","i","len","sortedMappers","length","dirty","nodes","values","map","Node","mappersById","forEach","nodesLen","node","outputs","j","restNode","inputs","outi","outputsLen","resti","restLen","_id","children","push","post","postCounter","dfs","index","indexOf","splice","postArray","Object","keys","key","num","parseInt","sort","a","b","needRunOnRender","exports","default","arguments","undefined"],"sources":["MapperRegistry.ts"],"sourcesContent":["import { JSReanimated } from './commonTypes';\nimport Mapper from './Mapper';\n\nexport default class MapperRegistry<T> {\n sortedMappers: Mapper<T>[] = [];\n mappers: Map<number, Mapper<T>> = new Map();\n _module: JSReanimated;\n\n updatedSinceLastExecute = false;\n\n constructor(module: JSReanimated) {\n this._module = module;\n }\n\n startMapper(mapper: Mapper<T>): number {\n this.mappers.set(mapper.id, mapper);\n this.updatedSinceLastExecute = true;\n return mapper.id;\n }\n\n stopMapper(id: number): void {\n this.mappers.delete(id);\n this.updatedSinceLastExecute = true;\n }\n\n execute(): void {\n if (this.updatedSinceLastExecute) {\n this.updateOrder();\n this.updatedSinceLastExecute = false;\n }\n\n for (let i = 0, len = this.sortedMappers.length; i < len; ++i) {\n const mapper = this.sortedMappers[i];\n if (mapper.dirty) {\n mapper.execute();\n }\n }\n }\n\n updateOrder(): void {\n const nodes = [...this.mappers.values()].map((mapper) => new Node(mapper));\n\n const mappersById: Record<number, Mapper<T>> = {};\n this.mappers.forEach((mapper) => {\n mappersById[mapper.id] = mapper;\n });\n\n // create a graph from array of nodes\n for (let i = 0, nodesLen = nodes.length; i < nodesLen; ++i) {\n const node = nodes[i];\n if (node.mapper.outputs.length === 0) {\n continue;\n }\n for (let j = 0; j < nodesLen; ++j) {\n const restNode = nodes[j];\n if (i === j || restNode.mapper.inputs.length === 0) {\n continue;\n }\n for (\n let outi = 0, outputsLen = node.mapper.outputs.length;\n outi < outputsLen;\n ++outi\n ) {\n for (\n let resti = 0, restLen = restNode.mapper.inputs.length;\n resti < restLen;\n ++resti\n ) {\n if (\n node.mapper.outputs[outi]._id ===\n restNode.mapper.inputs[resti]._id\n ) {\n node.children.push(restNode);\n }\n }\n }\n }\n }\n\n const post: Record<number, number> = {};\n let postCounter = 1;\n const dfs = (node: Node<T>) => {\n const index = nodes.indexOf(node);\n if (index === -1) {\n // this node has already been handled\n return;\n }\n ++postCounter;\n nodes.splice(index, 1);\n if (node.children.length === 0 && nodes.length > 0) {\n post[node.mapper.id] = postCounter++;\n dfs(nodes[0]);\n return;\n }\n for (let i = 0, len = node.children.length; i < len; ++i) {\n dfs(node.children[i]);\n }\n post[node.mapper.id] = postCounter++;\n };\n\n while (nodes.length) dfs(nodes[0]);\n\n const postArray = Object.keys(post).map((key) => {\n const num = parseInt(key);\n return [num, post[num]];\n });\n postArray.sort((a, b) => {\n return b[1] - a[1];\n });\n\n // clear sorted mappers\n this.sortedMappers = [];\n\n for (let i = 0, len = postArray.length; i < len; ++i) {\n const [id] = postArray[i];\n this.sortedMappers.push(mappersById[id]);\n }\n }\n\n get needRunOnRender(): boolean {\n return this.updatedSinceLastExecute;\n }\n}\n\nclass Node<T> {\n mapper: Mapper<T>;\n children: Node<T>[];\n\n constructor(mapper: Mapper<T>, children = []) {\n this.mapper = mapper;\n this.children = children;\n }\n}\n"],"mappings":";;;;;;;;;AAGe,MAAMA,cAAc,CAAI;EAOrCC,WAAWA,CAACC,MAAoB,EAAE;IAAAC,eAAA,wBANL,EAAE;IAAAA,eAAA,kBACG,IAAIC,GAAG,EAAE;IAAAD,eAAA;IAAAA,eAAA,kCAGjB,KAAK;IAG7B,IAAI,CAACE,OAAO,GAAGH,MAAM;EACvB;EAEAI,WAAWA,CAACC,MAAiB,EAAU;IACrC,IAAI,CAACC,OAAO,CAACC,GAAG,CAACF,MAAM,CAACG,EAAE,EAAEH,MAAM,CAAC;IACnC,IAAI,CAACI,uBAAuB,GAAG,IAAI;IACnC,OAAOJ,MAAM,CAACG,EAAE;EAClB;EAEAE,UAAUA,CAACF,EAAU,EAAQ;IAC3B,IAAI,CAACF,OAAO,CAACK,MAAM,CAACH,EAAE,CAAC;IACvB,IAAI,CAACC,uBAAuB,GAAG,IAAI;EACrC;EAEAG,OAAOA,CAAA,EAAS;IACd,IAAI,IAAI,CAACH,uBAAuB,EAAE;MAChC,IAAI,CAACI,WAAW,EAAE;MAClB,IAAI,CAACJ,uBAAuB,GAAG,KAAK;IACtC;IAEA,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAG,IAAI,CAACC,aAAa,CAACC,MAAM,EAAEH,CAAC,GAAGC,GAAG,EAAE,EAAED,CAAC,EAAE;MAC7D,MAAMT,MAAM,GAAG,IAAI,CAACW,aAAa,CAACF,CAAC,CAAC;MACpC,IAAIT,MAAM,CAACa,KAAK,EAAE;QAChBb,MAAM,CAACO,OAAO,EAAE;MAClB;IACF;EACF;EAEAC,WAAWA,CAAA,EAAS;IAClB,MAAMM,KAAK,GAAG,CAAC,GAAG,IAAI,CAACb,OAAO,CAACc,MAAM,EAAE,CAAC,CAACC,GA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C;IACFJ,SAAS,CAACM,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;MACvB,OAAOA,CAAC,CAAC,CAAC,CAAC,GAAGD,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC;;IAEF;IACA,IAAI,CAACnC,aAAa,GAAG,EAAE;IAEvB,KAAK,IAAIF,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAG6B,SAAS,CAAC3B,MAAM,EAAEH,CAAC,GAAGC,GAAG,EAAE,EAAED,CAAC,EAAE;MACpD,MAAM,CAACN,EAAE,CAAC,GAAGoC,SAAS,CAAC9B,CAAC,CAAC;MACzB,IAAI,CAACE,aAAa,CAACqB,IAAI,CAACd,WAAW,CAACf,EAAE,CAAC,CAAC;IAC1C;EACF;EAEA,IAAI6C,eAAeA,CAAA,EAAY;IAC7B,OAAO,IAAI,CAAC5C,uBAAuB;EACrC;AACF;AAAC6C,OAAA,CAAAC,OAAA,GAAAzD,cAAA;AAED,MAAMwB,IAAI,CAAI;EAIZvB,WAAWA,CAACM,MAAiB,EAAiB;IAAA,IAAf+B,QAAQ,GAAAoB,SAAA,CAAAvC,MAAA,QAAAuC,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,EAAE;IAAAvD,eAAA;IAAAA,eAAA;IAC1C,IAAI,CAACI,MAAM,GAAGA,MAAM;IACpB,IAAI,CAAC+B,QAAQ,GAAGA,QAAQ;EAC1B;AACF"}
@@ -4,54 +4,41 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
-
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
10
  class MutableValue {
11
11
  constructor(value, setter) {
12
12
  _defineProperty(this, "_id", void 0);
13
-
14
13
  _defineProperty(this, "_value", void 0);
15
-
16
14
  _defineProperty(this, "_setter", void 0);
17
-
18
15
  _defineProperty(this, "_animation", null);
19
-
20
16
  _defineProperty(this, "_listeners", []);
21
-
22
17
  this._id = MutableValue.MUTABLE_ID++;
23
18
  this._value = value;
24
19
  this._setter = setter;
25
20
  }
26
-
27
21
  get value() {
28
22
  return this._value;
29
23
  }
30
-
31
24
  set value(nextValue) {
32
25
  this._setter(nextValue);
33
- } // this changes the value finally and is supposed to be called from this._setter
34
-
26
+ }
35
27
 
28
+ // this changes the value finally and is supposed to be called from this._setter
36
29
  _setValue(newValue) {
37
30
  this._value = newValue;
38
-
39
31
  this._triggerListener();
40
32
  }
41
-
42
33
  addListener(listener) {
43
34
  this._listeners.push(listener);
44
35
  }
45
-
46
36
  _triggerListener() {
47
37
  for (let i = 0, len = this._listeners.length; i < len; ++i) {
48
38
  this._listeners[i]();
49
39
  }
50
40
  }
51
-
52
41
  }
53
-
54
42
  exports.default = MutableValue;
55
-
56
43
  _defineProperty(MutableValue, "MUTABLE_ID", 1);
57
44
  //# sourceMappingURL=MutableValue.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["MutableValue","constructor","value","setter","_id","MUTABLE_ID","_value","_setter","nextValue","_setValue","newValue","_triggerListener","addListener","listener","_listeners","push","i","len","length"],"sources":["MutableValue.ts"],"sourcesContent":["export default class MutableValue<T> {\n static MUTABLE_ID = 1;\n _id: number;\n _value: T;\n _setter: (value: T) => void;\n _animation = null;\n _listeners: (() => void)[] = [];\n\n constructor(value: T, setter: (value: T) => void) {\n this._id = MutableValue.MUTABLE_ID++;\n this._value = value;\n this._setter = setter;\n }\n\n get value(): T {\n return this._value;\n }\n\n set value(nextValue: T) {\n this._setter(nextValue);\n }\n\n // this changes the value finally and is supposed to be called from this._setter\n _setValue(newValue: T): void {\n this._value = newValue;\n this._triggerListener();\n }\n\n addListener(listener: () => void): void {\n this._listeners.push(listener);\n }\n\n _triggerListener(): void {\n for (let i = 0, len = this._listeners.length; i < len; ++i) {\n this._listeners[i]();\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAe,MAAMA,YAAN,CAAsB;EAQnCC,WAAW,CAACC,KAAD,EAAWC,MAAX,EAAuC;IAAA;;IAAA;;IAAA;;IAAA,oCAHrC,IAGqC;;IAAA,oCAFrB,EAEqB;;IAChD,KAAKC,GAAL,GAAWJ,YAAY,CAACK,UAAb,EAAX;IACA,KAAKC,MAAL,GAAcJ,KAAd;IACA,KAAKK,OAAL,GAAeJ,MAAf;EACD;;EAEQ,IAALD,KAAK,GAAM;IACb,OAAO,KAAKI,MAAZ;EACD;;EAEQ,IAALJ,KAAK,CAACM,SAAD,EAAe;IACtB,KAAKD,OAAL,CAAaC,SAAb;EACD,CApBkC,CAsBnC;;;EACAC,SAAS,CAACC,QAAD,EAAoB;IAC3B,KAAKJ,MAAL,GAAcI,QAAd;;IACA,KAAKC,gBAAL;EACD;;EAEDC,WAAW,CAACC,QAAD,EAA6B;IACtC,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBF,QAArB;EACD;;EAEDF,gBAAgB,GAAS;IACvB,KAAK,IAAIK,CAAC,GAAG,CAAR,EAAWC,GAAG,GAAG,KAAKH,UAAL,CAAgBI,MAAtC,EAA8CF,CAAC,GAAGC,GAAlD,EAAuD,EAAED,CAAzD,EAA4D;MAC1D,KAAKF,UAAL,CAAgBE,CAAhB;IACD;EACF;;AApCkC;;;;gBAAhBhB,Y,gBACC,C"}
1
+ {"version":3,"names":["MutableValue","constructor","value","setter","_defineProperty","_id","MUTABLE_ID","_value","_setter","nextValue","_setValue","newValue","_triggerListener","addListener","listener","_listeners","push","i","len","length","exports","default"],"sources":["MutableValue.ts"],"sourcesContent":["export default class MutableValue<T> {\n static MUTABLE_ID = 1;\n _id: number;\n _value: T;\n _setter: (value: T) => void;\n _animation = null;\n _listeners: (() => void)[] = [];\n\n constructor(value: T, setter: (value: T) => void) {\n this._id = MutableValue.MUTABLE_ID++;\n this._value = value;\n this._setter = setter;\n }\n\n get value(): T {\n return this._value;\n }\n\n set value(nextValue: T) {\n this._setter(nextValue);\n }\n\n // this changes the value finally and is supposed to be called from this._setter\n _setValue(newValue: T): void {\n this._value = newValue;\n this._triggerListener();\n }\n\n addListener(listener: () => void): void {\n this._listeners.push(listener);\n }\n\n _triggerListener(): void {\n for (let i = 0, len = this._listeners.length; i < len; ++i) {\n this._listeners[i]();\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAe,MAAMA,YAAY,CAAI;EAQnCC,WAAWA,CAACC,KAAQ,EAAEC,MAA0B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,qBAHrC,IAAI;IAAAA,eAAA,qBACY,EAAE;IAG7B,IAAI,CAACC,GAAG,GAAGL,YAAY,CAACM,UAAU,EAAE;IACpC,IAAI,CAACC,MAAM,GAAGL,KAAK;IACnB,IAAI,CAACM,OAAO,GAAGL,MAAM;EACvB;EAEA,IAAID,KAAKA,CAAA,EAAM;IACb,OAAO,IAAI,CAACK,MAAM;EACpB;EAEA,IAAIL,KAAKA,CAACO,SAAY,EAAE;IACtB,IAAI,CAACD,OAAO,CAACC,SAAS,CAAC;EACzB;;EAEA;EACAC,SAASA,CAACC,QAAW,EAAQ;IAC3B,IAAI,CAACJ,MAAM,GAAGI,QAAQ;IACtB,IAAI,CAACC,gBAAgB,EAAE;EACzB;EAEAC,WAAWA,CAACC,QAAoB,EAAQ;IACtC,IAAI,CAACC,UAAU,CAACC,IAAI,CAACF,QAAQ,CAAC;EAChC;EAEAF,gBAAgBA,CAAA,EAAS;IACvB,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAG,IAAI,CAACH,UAAU,CAACI,MAAM,EAAEF,CAAC,GAAGC,GAAG,EAAE,EAAED,CAAC,EAAE;MAC1D,IAAI,CAACF,UAAU,CAACE,CAAC,CAAC,EAAE;IACtB;EACF;AACF;AAACG,OAAA,CAAAC,OAAA,GAAArB,YAAA;AAAAI,eAAA,CArCoBJ,YAAY,gBACX,CAAC"}
@@ -4,10 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _PlatformChecker = require("../PlatformChecker");
9
-
10
8
  // In order to keep bundle size down, we treat this file as a polyfill for Web.
9
+
11
10
  const initializeGlobalsForWeb = () => {
12
11
  if ((0, _PlatformChecker.shouldBeUseWeb)()) {
13
12
  global._measure = () => {
@@ -21,22 +20,19 @@ const initializeGlobalsForWeb = () => {
21
20
  pageY: 0
22
21
  };
23
22
  };
24
-
25
23
  global._scrollTo = () => {
26
24
  console.warn("[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version");
27
25
  };
28
-
29
26
  global._dispatchCommand = () => {
30
27
  console.warn("[Reanimated] You can't use `scrollTo` or `dispatchCommand` methods with Chrome Debugger or with web version");
31
28
  };
32
-
33
29
  global._setGestureState = () => {
34
30
  console.warn("[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version");
35
31
  };
36
32
  }
37
-
38
33
  return true;
39
34
  };
35
+
40
36
  /*
41
37
  If a file doesn't export anything, tree shaking doesn't pack
42
38
  it into the JS bundle. In effect, the code inside of this file
@@ -44,9 +40,6 @@ const initializeGlobalsForWeb = () => {
44
40
  into a function, and we call this one during creating
45
41
  the module export object.
46
42
  */
47
-
48
-
49
43
  var _default = initializeGlobalsForWeb();
50
-
51
44
  exports.default = _default;
52
45
  //# sourceMappingURL=global.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["initializeGlobalsForWeb","shouldBeUseWeb","global","_measure","console","warn","x","y","width","height","pageX","pageY","_scrollTo","_dispatchCommand","_setGestureState"],"sources":["global.ts"],"sourcesContent":["// In order to keep bundle size down, we treat this file as a polyfill for Web.\n\nimport { shouldBeUseWeb } from '../PlatformChecker';\nconst initializeGlobalsForWeb = () => {\n if (shouldBeUseWeb()) {\n global._measure = () => {\n console.warn(\n \"[Reanimated] You can't use `measure` with Chrome Debugger or with web version\"\n );\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n };\n };\n global._scrollTo = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version\"\n );\n };\n global._dispatchCommand = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` or `dispatchCommand` methods with Chrome Debugger or with web version\"\n );\n };\n global._setGestureState = () => {\n console.warn(\n \"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version\"\n );\n };\n }\n return true;\n};\n\n/*\n If a file doesn't export anything, tree shaking doesn't pack\n it into the JS bundle. In effect, the code inside of this file\n will never execute. That is why we wrapped initialization code\n into a function, and we call this one during creating\n the module export object.\n*/\n\nexport default initializeGlobalsForWeb();\n"],"mappings":";;;;;;;AAEA;;AAFA;AAGA,MAAMA,uBAAuB,GAAG,MAAM;EACpC,IAAI,IAAAC,+BAAA,GAAJ,EAAsB;IACpBC,MAAM,CAACC,QAAP,GAAkB,MAAM;MACtBC,OAAO,CAACC,IAAR,CACE,+EADF;MAGA,OAAO;QACLC,CAAC,EAAE,CADE;QAELC,CAAC,EAAE,CAFE;QAGLC,KAAK,EAAE,CAHF;QAILC,MAAM,EAAE,CAJH;QAKLC,KAAK,EAAE,CALF;QAMLC,KAAK,EAAE;MANF,CAAP;IAQD,CAZD;;IAaAT,MAAM,CAACU,SAAP,GAAmB,MAAM;MACvBR,OAAO,CAACC,IAAR,CACE,gFADF;IAGD,CAJD;;IAKAH,MAAM,CAACW,gBAAP,GAA0B,MAAM;MAC9BT,OAAO,CAACC,IAAR,CACE,6GADF;IAGD,CAJD;;IAKAH,MAAM,CAACY,gBAAP,GAA0B,MAAM;MAC9BV,OAAO,CAACC,IAAR,CACE,uFADF;IAGD,CAJD;EAKD;;EACD,OAAO,IAAP;AACD,CAhCD;AAkCA;AACA;AACA;AACA;AACA;AACA;AACA;;;eAEeL,uBAAuB,E"}
1
+ {"version":3,"names":["_PlatformChecker","require","initializeGlobalsForWeb","shouldBeUseWeb","global","_measure","console","warn","x","y","width","height","pageX","pageY","_scrollTo","_dispatchCommand","_setGestureState","_default","exports","default"],"sources":["global.ts"],"sourcesContent":["// In order to keep bundle size down, we treat this file as a polyfill for Web.\n\nimport { shouldBeUseWeb } from '../PlatformChecker';\nconst initializeGlobalsForWeb = () => {\n if (shouldBeUseWeb()) {\n global._measure = () => {\n console.warn(\n \"[Reanimated] You can't use `measure` with Chrome Debugger or with web version\"\n );\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n pageX: 0,\n pageY: 0,\n };\n };\n global._scrollTo = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` with Chrome Debugger or with web version\"\n );\n };\n global._dispatchCommand = () => {\n console.warn(\n \"[Reanimated] You can't use `scrollTo` or `dispatchCommand` methods with Chrome Debugger or with web version\"\n );\n };\n global._setGestureState = () => {\n console.warn(\n \"[Reanimated] You can't use `setGestureState` with Chrome Debugger or with web version\"\n );\n };\n }\n return true;\n};\n\n/*\n If a file doesn't export anything, tree shaking doesn't pack\n it into the JS bundle. In effect, the code inside of this file\n will never execute. That is why we wrapped initialization code\n into a function, and we call this one during creating\n the module export object.\n*/\n\nexport default initializeGlobalsForWeb();\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,OAAA;AAFA;;AAGA,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EACpC,IAAI,IAAAC,+BAAc,GAAE,EAAE;IACpBC,MAAM,CAACC,QAAQ,GAAG,MAAM;MACtBC,OAAO,CAACC,IAAI,CACV,+EAA+E,CAChF;MACD,OAAO;QACLC,CAAC,EAAE,CAAC;QACJC,CAAC,EAAE,CAAC;QACJC,KAAK,EAAE,CAAC;QACRC,MAAM,EAAE,CAAC;QACTC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE;MACT,CAAC;IACH,CAAC;IACDT,MAAM,CAACU,SAAS,GAAG,MAAM;MACvBR,OAAO,CAACC,IAAI,CACV,gFAAgF,CACjF;IACH,CAAC;IACDH,MAAM,CAACW,gBAAgB,GAAG,MAAM;MAC9BT,OAAO,CAACC,IAAI,CACV,6GAA6G,CAC9G;IACH,CAAC;IACDH,MAAM,CAACY,gBAAgB,GAAG,MAAM;MAC9BV,OAAO,CAACC,IAAI,CACV,uFAAuF,CACxF;IACH,CAAC;EACH;EACA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAAAU,QAAA,GAQef,uBAAuB,EAAE;AAAAgB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports._updatePropsJS = void 0;
7
-
8
7
  var _JSReanimated = _interopRequireDefault(require("./JSReanimated"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const reanimatedJS = new _JSReanimated.default();
13
-
14
10
  global._makeShareableClone = c => c;
15
-
16
- global._scheduleOnJS = setImmediate;
17
-
11
+ global._scheduleOnJS = queueMicrotask;
18
12
  const _updatePropsJS = (updates, viewRef) => {
19
13
  if (viewRef._component) {
20
14
  const component = viewRef._component;
@@ -24,7 +18,6 @@ const _updatePropsJS = (updates, viewRef) => {
24
18
  acc[index][key] = value;
25
19
  return acc;
26
20
  }, [{}, {}]);
27
-
28
21
  if (typeof component.setNativeProps === 'function') {
29
22
  setNativeProps(component, rawStyles);
30
23
  } else if (Object.keys(component.props).length > 0) {
@@ -32,9 +25,7 @@ const _updatePropsJS = (updates, viewRef) => {
32
25
  if (!rawStyles[key]) {
33
26
  return;
34
27
  }
35
-
36
28
  const dashedKey = key.replace(/[A-Z]/g, m => '-' + m.toLowerCase());
37
-
38
29
  component._touchableNode.setAttribute(dashedKey, rawStyles[key]);
39
30
  });
40
31
  } else {
@@ -42,12 +33,11 @@ const _updatePropsJS = (updates, viewRef) => {
42
33
  }
43
34
  }
44
35
  };
45
-
46
36
  exports._updatePropsJS = _updatePropsJS;
47
-
48
37
  const setNativeProps = (component, style) => {
49
38
  const previousStyle = component.previousStyle ? component.previousStyle : {};
50
- const currentStyle = { ...previousStyle,
39
+ const currentStyle = {
40
+ ...previousStyle,
51
41
  ...style
52
42
  };
53
43
  component.previousStyle = currentStyle;
@@ -55,7 +45,6 @@ const setNativeProps = (component, style) => {
55
45
  style: currentStyle
56
46
  });
57
47
  };
58
-
59
48
  var _default = reanimatedJS;
60
49
  exports.default = _default;
61
50
  //# sourceMappingURL=index.js.map