@depup/react-native-worklets 0.11.3-depup.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 (457) hide show
  1. package/.worklets/dummy.md +1 -0
  2. package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.cpp +64 -0
  3. package/Common/cpp/worklets/AnimationFrameQueue/AnimationFrameBatchinator.h +38 -0
  4. package/Common/cpp/worklets/Compat/Holders.h +25 -0
  5. package/Common/cpp/worklets/Compat/StableApi.cpp +145 -0
  6. package/Common/cpp/worklets/Compat/StableApi.h +128 -0
  7. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +729 -0
  8. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +126 -0
  9. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +81 -0
  10. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +76 -0
  11. package/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +95 -0
  12. package/Common/cpp/worklets/Registries/EventHandlerRegistry.h +44 -0
  13. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +10 -0
  14. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +43 -0
  15. package/Common/cpp/worklets/RunLoop/AsyncQueue.h +14 -0
  16. package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.cpp +69 -0
  17. package/Common/cpp/worklets/RunLoop/AsyncQueueImpl.h +48 -0
  18. package/Common/cpp/worklets/RunLoop/EventLoop.cpp +103 -0
  19. package/Common/cpp/worklets/RunLoop/EventLoop.h +52 -0
  20. package/Common/cpp/worklets/SharedItems/MemoryManager.cpp +60 -0
  21. package/Common/cpp/worklets/SharedItems/MemoryManager.h +29 -0
  22. package/Common/cpp/worklets/SharedItems/Serializable.cpp +373 -0
  23. package/Common/cpp/worklets/SharedItems/Serializable.h +413 -0
  24. package/Common/cpp/worklets/SharedItems/SerializableFactory.cpp +172 -0
  25. package/Common/cpp/worklets/SharedItems/SerializableFactory.h +85 -0
  26. package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.cpp +71 -0
  27. package/Common/cpp/worklets/SharedItems/SerializableRemoteFunction.h +75 -0
  28. package/Common/cpp/worklets/SharedItems/Shareable.cpp +84 -0
  29. package/Common/cpp/worklets/SharedItems/Shareable.h +43 -0
  30. package/Common/cpp/worklets/SharedItems/Synchronizable.cpp +59 -0
  31. package/Common/cpp/worklets/SharedItems/Synchronizable.h +57 -0
  32. package/Common/cpp/worklets/SharedItems/SynchronizableAccess.cpp +78 -0
  33. package/Common/cpp/worklets/SharedItems/SynchronizableAccess.h +45 -0
  34. package/Common/cpp/worklets/SharedItems/UnpackerLoader.h +78 -0
  35. package/Common/cpp/worklets/Tools/FeatureFlags.cpp +18 -0
  36. package/Common/cpp/worklets/Tools/FeatureFlags.h +44 -0
  37. package/Common/cpp/worklets/Tools/JSISerializer.cpp +312 -0
  38. package/Common/cpp/worklets/Tools/JSISerializer.h +42 -0
  39. package/Common/cpp/worklets/Tools/JSLogger.cpp +92 -0
  40. package/Common/cpp/worklets/Tools/JSLogger.h +48 -0
  41. package/Common/cpp/worklets/Tools/JSScheduler.cpp +21 -0
  42. package/Common/cpp/worklets/Tools/JSScheduler.h +35 -0
  43. package/Common/cpp/worklets/Tools/PlatformLogger.h +16 -0
  44. package/Common/cpp/worklets/Tools/RNRuntimeStatus.h +27 -0
  45. package/Common/cpp/worklets/Tools/ScriptBuffer.h +56 -0
  46. package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +75 -0
  47. package/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -0
  48. package/Common/cpp/worklets/Tools/UIScheduler.cpp +19 -0
  49. package/Common/cpp/worklets/Tools/UIScheduler.h +22 -0
  50. package/Common/cpp/worklets/Tools/VersionUtils.cpp +61 -0
  51. package/Common/cpp/worklets/Tools/VersionUtils.h +24 -0
  52. package/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +34 -0
  53. package/Common/cpp/worklets/Tools/WorkletEventHandler.h +44 -0
  54. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +30 -0
  55. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +222 -0
  56. package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +116 -0
  57. package/Common/cpp/worklets/Tools/WorkletsVersion.cpp +46 -0
  58. package/Common/cpp/worklets/Tools/WorkletsVersion.h +18 -0
  59. package/Common/cpp/worklets/WorkletRuntime/BundleModeConfig.h +17 -0
  60. package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.cpp +45 -0
  61. package/Common/cpp/worklets/WorkletRuntime/HermesProfiling.h +12 -0
  62. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +68 -0
  63. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +24 -0
  64. package/Common/cpp/worklets/WorkletRuntime/RuntimeBindings.h +59 -0
  65. package/Common/cpp/worklets/WorkletRuntime/RuntimeData.h +38 -0
  66. package/Common/cpp/worklets/WorkletRuntime/RuntimeHolder.h +19 -0
  67. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +122 -0
  68. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +75 -0
  69. package/Common/cpp/worklets/WorkletRuntime/ScriptLoader.h +116 -0
  70. package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.cpp +14 -0
  71. package/Common/cpp/worklets/WorkletRuntime/UIRuntimeDecorator.h +15 -0
  72. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.cpp +58 -0
  73. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +100 -0
  74. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +327 -0
  75. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +256 -0
  76. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -0
  77. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +320 -0
  78. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +36 -0
  79. package/LICENSE +20 -0
  80. package/README.md +43 -0
  81. package/RNWorklets.podspec +94 -0
  82. package/android/CMakeLists.txt +108 -0
  83. package/android/build.gradle.kts +369 -0
  84. package/android/fix-prefab.gradle.kts +56 -0
  85. package/android/generate-stub-pch.gradle.kts +84 -0
  86. package/android/gradle.properties +25 -0
  87. package/android/proguard-rules.pro +3 -0
  88. package/android/settings.gradle.kts +21 -0
  89. package/android/src/main/AndroidManifest.xml +2 -0
  90. package/android/src/main/cpp/WorkletsPCH.h +26 -0
  91. package/android/src/main/cpp/worklets/android/AndroidUIScheduler.cpp +66 -0
  92. package/android/src/main/cpp/worklets/android/AndroidUIScheduler.h +38 -0
  93. package/android/src/main/cpp/worklets/android/AnimationFrameCallback.h +30 -0
  94. package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.cpp +66 -0
  95. package/android/src/main/cpp/worklets/android/JScriptBufferWrapper.h +48 -0
  96. package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.cpp +51 -0
  97. package/android/src/main/cpp/worklets/android/JWorkletRuntimeWrapper.h +43 -0
  98. package/android/src/main/cpp/worklets/android/PlatformLogger.cpp +31 -0
  99. package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +203 -0
  100. package/android/src/main/cpp/worklets/android/WorkletsModule.h +75 -0
  101. package/android/src/main/cpp/worklets/android/WorkletsOnLoad.cpp +19 -0
  102. package/android/src/main/java/com/swmansion/worklets/AndroidUIScheduler.kt +56 -0
  103. package/android/src/main/java/com/swmansion/worklets/ScriptBufferWrapper.kt +103 -0
  104. package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.kt +42 -0
  105. package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameCallback.kt +14 -0
  106. package/android/src/main/java/com/swmansion/worklets/runloop/AnimationFrameQueue.kt +112 -0
  107. package/android/src/networking/com/swmansion/worklets/WorkletRuntimeWrapper.kt +27 -0
  108. package/android/src/networking/com/swmansion/worklets/WorkletsHeaderUtil.kt +30 -0
  109. package/android/src/networking/com/swmansion/worklets/WorkletsModule.kt +187 -0
  110. package/android/src/networking/com/swmansion/worklets/WorkletsNetworkEventUtil.kt +272 -0
  111. package/android/src/networking/com/swmansion/worklets/WorkletsNetworking.kt +1124 -0
  112. package/android/src/networking/com/swmansion/worklets/WorkletsOkHttpCallUtil.kt +40 -0
  113. package/android/src/networking/com/swmansion/worklets/WorkletsProgressListener.kt +13 -0
  114. package/android/src/networking/com/swmansion/worklets/WorkletsProgressRequestBody.kt +98 -0
  115. package/android/src/networking/com/swmansion/worklets/WorkletsProgressResponseBody.kt +60 -0
  116. package/android/src/networking/com/swmansion/worklets/WorkletsProgressiveStringDecoder.kt +87 -0
  117. package/android/src/networking/com/swmansion/worklets/WorkletsRequestBodyUtil.kt +181 -0
  118. package/android/src/no-networking/com/swmansion/worklets/WorkletsModule.kt +143 -0
  119. package/apple/worklets/apple/AnimationFrameQueue.h +15 -0
  120. package/apple/worklets/apple/AnimationFrameQueue.mm +145 -0
  121. package/apple/worklets/apple/AssertJavaScriptQueue.h +14 -0
  122. package/apple/worklets/apple/AssertTurboModuleManagerQueue.h +12 -0
  123. package/apple/worklets/apple/IOSUIScheduler.h +14 -0
  124. package/apple/worklets/apple/IOSUIScheduler.mm +29 -0
  125. package/apple/worklets/apple/Networking/WorkletsNetworking.h +25 -0
  126. package/apple/worklets/apple/Networking/WorkletsNetworking.mm +707 -0
  127. package/apple/worklets/apple/PlatformLogger.mm +31 -0
  128. package/apple/worklets/apple/SlowAnimations.h +8 -0
  129. package/apple/worklets/apple/SlowAnimations.mm +45 -0
  130. package/apple/worklets/apple/WorkletsDisplayLink.h +21 -0
  131. package/apple/worklets/apple/WorkletsModule.h +28 -0
  132. package/apple/worklets/apple/WorkletsModule.mm +177 -0
  133. package/bundleMode/index.d.ts +6 -0
  134. package/bundleMode/index.js +182 -0
  135. package/bundleMode/shims/reactNativeShim.js +21 -0
  136. package/bundleMode/shims/turboModuleRegistryShim.js +47 -0
  137. package/changes.json +58 -0
  138. package/compatibility.json +29 -0
  139. package/jest/pluginTestUtils.ts +16 -0
  140. package/jest/resolver.js +18 -0
  141. package/lib/module/WorkletsModule/NativeWorklets.js +4 -0
  142. package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
  143. package/lib/module/WorkletsModule/NativeWorklets.native.js +199 -0
  144. package/lib/module/WorkletsModule/NativeWorklets.native.js.map +1 -0
  145. package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
  146. package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
  147. package/lib/module/bundleMode/metroOverrides.native.js +26 -0
  148. package/lib/module/bundleMode/metroOverrides.native.js.map +1 -0
  149. package/lib/module/bundleMode/network.native.js +44 -0
  150. package/lib/module/bundleMode/network.native.js.map +1 -0
  151. package/lib/module/debug/bundleMode.js +6 -0
  152. package/lib/module/debug/bundleMode.js.map +1 -0
  153. package/lib/module/debug/bundleMode.native.js +11 -0
  154. package/lib/module/debug/bundleMode.native.js.map +1 -0
  155. package/lib/module/debug/checkCppVersion.js +29 -0
  156. package/lib/module/debug/checkCppVersion.js.map +1 -0
  157. package/lib/module/debug/errors.native.js +67 -0
  158. package/lib/module/debug/errors.native.js.map +1 -0
  159. package/lib/module/debug/jsVersion.js +9 -0
  160. package/lib/module/debug/jsVersion.js.map +1 -0
  161. package/lib/module/debug/logger.js +15 -0
  162. package/lib/module/debug/logger.js.map +1 -0
  163. package/lib/module/debug/slowAnimations.js +7 -0
  164. package/lib/module/debug/slowAnimations.js.map +1 -0
  165. package/lib/module/debug/slowAnimations.native.js +17 -0
  166. package/lib/module/debug/slowAnimations.native.js.map +1 -0
  167. package/lib/module/deprecated.js +27 -0
  168. package/lib/module/deprecated.js.map +1 -0
  169. package/lib/module/featureFlags/featureFlags.js +12 -0
  170. package/lib/module/featureFlags/featureFlags.js.map +1 -0
  171. package/lib/module/featureFlags/featureFlags.native.js +51 -0
  172. package/lib/module/featureFlags/featureFlags.native.js.map +1 -0
  173. package/lib/module/featureFlags/staticFlags.json +6 -0
  174. package/lib/module/featureFlags/types.js +16 -0
  175. package/lib/module/featureFlags/types.js.map +1 -0
  176. package/lib/module/guardImplementation.native.js +17 -0
  177. package/lib/module/guardImplementation.native.js.map +1 -0
  178. package/lib/module/index.js +26 -0
  179. package/lib/module/index.js.map +1 -0
  180. package/lib/module/initializers/initializers.js +24 -0
  181. package/lib/module/initializers/initializers.js.map +1 -0
  182. package/lib/module/initializers/initializers.native.js +195 -0
  183. package/lib/module/initializers/initializers.native.js.map +1 -0
  184. package/lib/module/memory/bundleUnpacker.native.js +38 -0
  185. package/lib/module/memory/bundleUnpacker.native.js.map +1 -0
  186. package/lib/module/memory/customSerializableUnpacker.native.js +20 -0
  187. package/lib/module/memory/customSerializableUnpacker.native.js.map +1 -0
  188. package/lib/module/memory/isShareable.js +8 -0
  189. package/lib/module/memory/isShareable.js.map +1 -0
  190. package/lib/module/memory/isSynchronizable.js +8 -0
  191. package/lib/module/memory/isSynchronizable.js.map +1 -0
  192. package/lib/module/memory/remoteFunctionUnpacker.native.js +18 -0
  193. package/lib/module/memory/remoteFunctionUnpacker.native.js.map +1 -0
  194. package/lib/module/memory/serializable.js +18 -0
  195. package/lib/module/memory/serializable.js.map +1 -0
  196. package/lib/module/memory/serializable.native.js +619 -0
  197. package/lib/module/memory/serializable.native.js.map +1 -0
  198. package/lib/module/memory/serializableMappingCache.js +11 -0
  199. package/lib/module/memory/serializableMappingCache.js.map +1 -0
  200. package/lib/module/memory/serializableMappingCache.native.js +29 -0
  201. package/lib/module/memory/serializableMappingCache.native.js.map +1 -0
  202. package/lib/module/memory/shareable.js +18 -0
  203. package/lib/module/memory/shareable.js.map +1 -0
  204. package/lib/module/memory/shareable.native.js +42 -0
  205. package/lib/module/memory/shareable.native.js.map +1 -0
  206. package/lib/module/memory/shareableGuestUnpacker.native.js +105 -0
  207. package/lib/module/memory/shareableGuestUnpacker.native.js.map +1 -0
  208. package/lib/module/memory/shareableHostUnpacker.native.js +20 -0
  209. package/lib/module/memory/shareableHostUnpacker.native.js.map +1 -0
  210. package/lib/module/memory/synchronizable.js +6 -0
  211. package/lib/module/memory/synchronizable.js.map +1 -0
  212. package/lib/module/memory/synchronizable.native.js +9 -0
  213. package/lib/module/memory/synchronizable.native.js.map +1 -0
  214. package/lib/module/memory/synchronizableUnpacker.native.js +47 -0
  215. package/lib/module/memory/synchronizableUnpacker.native.js.map +1 -0
  216. package/lib/module/memory/types.js +12 -0
  217. package/lib/module/memory/types.js.map +1 -0
  218. package/lib/module/memory/valueUnpacker.native.js +52 -0
  219. package/lib/module/memory/valueUnpacker.native.js.map +1 -0
  220. package/lib/module/mock.js +85 -0
  221. package/lib/module/mock.js.map +1 -0
  222. package/lib/module/package.json +1 -0
  223. package/lib/module/platformChecker.js +4 -0
  224. package/lib/module/platformChecker.js.map +1 -0
  225. package/lib/module/platformChecker.native.js +4 -0
  226. package/lib/module/platformChecker.native.js.map +1 -0
  227. package/lib/module/privateGlobals.d.js +7 -0
  228. package/lib/module/privateGlobals.d.js.map +1 -0
  229. package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
  230. package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
  231. package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
  232. package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
  233. package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
  234. package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
  235. package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +71 -0
  236. package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
  237. package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
  238. package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
  239. package/lib/module/runLoop/workletRuntime/index.js +19 -0
  240. package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
  241. package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
  242. package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
  243. package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
  244. package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
  245. package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
  246. package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
  247. package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
  248. package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
  249. package/lib/module/runtimeKind.js +92 -0
  250. package/lib/module/runtimeKind.js.map +1 -0
  251. package/lib/module/runtimes.js +36 -0
  252. package/lib/module/runtimes.js.map +1 -0
  253. package/lib/module/runtimes.native.js +379 -0
  254. package/lib/module/runtimes.native.js.map +1 -0
  255. package/lib/module/specs/NativeWorkletsModule.js +5 -0
  256. package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
  257. package/lib/module/specs/index.js +10 -0
  258. package/lib/module/specs/index.js.map +1 -0
  259. package/lib/module/threads.js +60 -0
  260. package/lib/module/threads.js.map +1 -0
  261. package/lib/module/threads.native.js +295 -0
  262. package/lib/module/threads.native.js.map +1 -0
  263. package/lib/module/types.js +5 -0
  264. package/lib/module/types.js.map +1 -0
  265. package/lib/module/workletFunction.js +36 -0
  266. package/lib/module/workletFunction.js.map +1 -0
  267. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +3 -0
  268. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
  269. package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts +3 -0
  270. package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts.map +1 -0
  271. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +59 -0
  272. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
  273. package/lib/typescript/bundleMode/metroOverrides.native.d.ts +9 -0
  274. package/lib/typescript/bundleMode/metroOverrides.native.d.ts.map +1 -0
  275. package/lib/typescript/bundleMode/network.native.d.ts +7 -0
  276. package/lib/typescript/bundleMode/network.native.d.ts.map +1 -0
  277. package/lib/typescript/debug/bundleMode.d.ts +2 -0
  278. package/lib/typescript/debug/bundleMode.d.ts.map +1 -0
  279. package/lib/typescript/debug/bundleMode.native.d.ts +2 -0
  280. package/lib/typescript/debug/bundleMode.native.d.ts.map +1 -0
  281. package/lib/typescript/debug/checkCppVersion.d.ts +3 -0
  282. package/lib/typescript/debug/checkCppVersion.d.ts.map +1 -0
  283. package/lib/typescript/debug/errors.native.d.ts +13 -0
  284. package/lib/typescript/debug/errors.native.d.ts.map +1 -0
  285. package/lib/typescript/debug/jsVersion.d.ts +7 -0
  286. package/lib/typescript/debug/jsVersion.d.ts.map +1 -0
  287. package/lib/typescript/debug/logger.d.ts +5 -0
  288. package/lib/typescript/debug/logger.d.ts.map +1 -0
  289. package/lib/typescript/debug/slowAnimations.d.ts +2 -0
  290. package/lib/typescript/debug/slowAnimations.d.ts.map +1 -0
  291. package/lib/typescript/debug/slowAnimations.native.d.ts +11 -0
  292. package/lib/typescript/debug/slowAnimations.native.d.ts.map +1 -0
  293. package/lib/typescript/deprecated.d.ts +19 -0
  294. package/lib/typescript/deprecated.d.ts.map +1 -0
  295. package/lib/typescript/featureFlags/featureFlags.d.ts +5 -0
  296. package/lib/typescript/featureFlags/featureFlags.d.ts.map +1 -0
  297. package/lib/typescript/featureFlags/featureFlags.native.d.ts +6 -0
  298. package/lib/typescript/featureFlags/featureFlags.native.d.ts.map +1 -0
  299. package/lib/typescript/featureFlags/types.d.ts +23 -0
  300. package/lib/typescript/featureFlags/types.d.ts.map +1 -0
  301. package/lib/typescript/guardImplementation.native.d.ts +3 -0
  302. package/lib/typescript/guardImplementation.native.d.ts.map +1 -0
  303. package/lib/typescript/index.d.ts +19 -0
  304. package/lib/typescript/index.d.ts.map +1 -0
  305. package/lib/typescript/initializers/initializers.d.ts +2 -0
  306. package/lib/typescript/initializers/initializers.d.ts.map +1 -0
  307. package/lib/typescript/initializers/initializers.native.d.ts +19 -0
  308. package/lib/typescript/initializers/initializers.native.d.ts.map +1 -0
  309. package/lib/typescript/memory/bundleUnpacker.native.d.ts +7 -0
  310. package/lib/typescript/memory/bundleUnpacker.native.d.ts.map +1 -0
  311. package/lib/typescript/memory/customSerializableUnpacker.native.d.ts +3 -0
  312. package/lib/typescript/memory/customSerializableUnpacker.native.d.ts.map +1 -0
  313. package/lib/typescript/memory/isShareable.d.ts +3 -0
  314. package/lib/typescript/memory/isShareable.d.ts.map +1 -0
  315. package/lib/typescript/memory/isSynchronizable.d.ts +3 -0
  316. package/lib/typescript/memory/isSynchronizable.d.ts.map +1 -0
  317. package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts +3 -0
  318. package/lib/typescript/memory/remoteFunctionUnpacker.native.d.ts.map +1 -0
  319. package/lib/typescript/memory/serializable.d.ts +7 -0
  320. package/lib/typescript/memory/serializable.d.ts.map +1 -0
  321. package/lib/typescript/memory/serializable.native.d.ts +37 -0
  322. package/lib/typescript/memory/serializable.native.d.ts.map +1 -0
  323. package/lib/typescript/memory/serializableMappingCache.d.ts +6 -0
  324. package/lib/typescript/memory/serializableMappingCache.d.ts.map +1 -0
  325. package/lib/typescript/memory/serializableMappingCache.native.d.ts +13 -0
  326. package/lib/typescript/memory/serializableMappingCache.native.d.ts.map +1 -0
  327. package/lib/typescript/memory/shareable.d.ts +15 -0
  328. package/lib/typescript/memory/shareable.d.ts.map +1 -0
  329. package/lib/typescript/memory/shareable.native.d.ts +15 -0
  330. package/lib/typescript/memory/shareable.native.d.ts.map +1 -0
  331. package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts +4 -0
  332. package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts.map +1 -0
  333. package/lib/typescript/memory/shareableHostUnpacker.native.d.ts +4 -0
  334. package/lib/typescript/memory/shareableHostUnpacker.native.d.ts.map +1 -0
  335. package/lib/typescript/memory/synchronizable.d.ts +3 -0
  336. package/lib/typescript/memory/synchronizable.d.ts.map +1 -0
  337. package/lib/typescript/memory/synchronizable.native.d.ts +3 -0
  338. package/lib/typescript/memory/synchronizable.native.d.ts.map +1 -0
  339. package/lib/typescript/memory/synchronizableUnpacker.native.d.ts +4 -0
  340. package/lib/typescript/memory/synchronizableUnpacker.native.d.ts.map +1 -0
  341. package/lib/typescript/memory/types.d.ts +136 -0
  342. package/lib/typescript/memory/types.d.ts.map +1 -0
  343. package/lib/typescript/memory/valueUnpacker.native.d.ts +7 -0
  344. package/lib/typescript/memory/valueUnpacker.native.d.ts.map +1 -0
  345. package/lib/typescript/mock.d.ts +2 -0
  346. package/lib/typescript/mock.d.ts.map +1 -0
  347. package/lib/typescript/package.json +1 -0
  348. package/lib/typescript/platformChecker.d.ts +2 -0
  349. package/lib/typescript/platformChecker.d.ts.map +1 -0
  350. package/lib/typescript/platformChecker.native.d.ts +2 -0
  351. package/lib/typescript/platformChecker.native.d.ts.map +1 -0
  352. package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
  353. package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
  354. package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
  355. package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
  356. package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
  357. package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
  358. package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
  359. package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
  360. package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
  361. package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
  362. package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
  363. package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
  364. package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
  365. package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
  366. package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
  367. package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
  368. package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
  369. package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
  370. package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
  371. package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
  372. package/lib/typescript/runtimeKind.d.ts +56 -0
  373. package/lib/typescript/runtimeKind.d.ts.map +1 -0
  374. package/lib/typescript/runtimes.d.ts +15 -0
  375. package/lib/typescript/runtimes.d.ts.map +1 -0
  376. package/lib/typescript/runtimes.native.d.ts +155 -0
  377. package/lib/typescript/runtimes.native.d.ts.map +1 -0
  378. package/lib/typescript/specs/NativeWorkletsModule.d.ts +9 -0
  379. package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
  380. package/lib/typescript/specs/index.d.ts +3 -0
  381. package/lib/typescript/specs/index.d.ts.map +1 -0
  382. package/lib/typescript/threads.d.ts +8 -0
  383. package/lib/typescript/threads.d.ts.map +1 -0
  384. package/lib/typescript/threads.native.d.ts +125 -0
  385. package/lib/typescript/threads.native.d.ts.map +1 -0
  386. package/lib/typescript/types.d.ts +136 -0
  387. package/lib/typescript/types.d.ts.map +1 -0
  388. package/lib/typescript/workletFunction.d.ts +26 -0
  389. package/lib/typescript/workletFunction.d.ts.map +1 -0
  390. package/package.json +220 -0
  391. package/plugin/index.d.ts +168 -0
  392. package/plugin/index.js +2188 -0
  393. package/scripts/validate-react-native-version.js +43 -0
  394. package/scripts/worklets_utils.rb +94 -0
  395. package/src/WorkletsModule/NativeWorklets.native.ts +461 -0
  396. package/src/WorkletsModule/NativeWorklets.ts +5 -0
  397. package/src/WorkletsModule/workletsModuleProxy.ts +247 -0
  398. package/src/bundleMode/metroOverrides.native.ts +33 -0
  399. package/src/bundleMode/network.native.ts +63 -0
  400. package/src/debug/bundleMode.native.ts +18 -0
  401. package/src/debug/bundleMode.ts +5 -0
  402. package/src/debug/checkCppVersion.ts +34 -0
  403. package/src/debug/errors.native.ts +74 -0
  404. package/src/debug/jsVersion.ts +8 -0
  405. package/src/debug/logger.ts +16 -0
  406. package/src/debug/slowAnimations.native.ts +15 -0
  407. package/src/debug/slowAnimations.ts +6 -0
  408. package/src/deprecated.ts +38 -0
  409. package/src/featureFlags/featureFlags.native.ts +70 -0
  410. package/src/featureFlags/featureFlags.ts +20 -0
  411. package/src/featureFlags/staticFlags.json +6 -0
  412. package/src/featureFlags/types.ts +32 -0
  413. package/src/guardImplementation.native.ts +26 -0
  414. package/src/index.ts +95 -0
  415. package/src/initializers/initializers.native.ts +218 -0
  416. package/src/initializers/initializers.ts +24 -0
  417. package/src/memory/bundleUnpacker.native.ts +59 -0
  418. package/src/memory/customSerializableUnpacker.native.ts +30 -0
  419. package/src/memory/isShareable.ts +16 -0
  420. package/src/memory/isSynchronizable.ts +14 -0
  421. package/src/memory/remoteFunctionUnpacker.native.ts +27 -0
  422. package/src/memory/serializable.native.ts +889 -0
  423. package/src/memory/serializable.ts +36 -0
  424. package/src/memory/serializableMappingCache.native.ts +37 -0
  425. package/src/memory/serializableMappingCache.ts +12 -0
  426. package/src/memory/shareable.native.ts +68 -0
  427. package/src/memory/shareable.ts +27 -0
  428. package/src/memory/shareableGuestUnpacker.native.ts +168 -0
  429. package/src/memory/shareableHostUnpacker.native.ts +31 -0
  430. package/src/memory/synchronizable.native.ts +17 -0
  431. package/src/memory/synchronizable.ts +9 -0
  432. package/src/memory/synchronizableUnpacker.native.ts +65 -0
  433. package/src/memory/types.ts +191 -0
  434. package/src/memory/valueUnpacker.native.ts +79 -0
  435. package/src/mock.ts +111 -0
  436. package/src/platformChecker.native.ts +3 -0
  437. package/src/platformChecker.ts +4 -0
  438. package/src/privateGlobals.d.ts +127 -0
  439. package/src/runLoop/common/setImmediatePolyfill.ts +20 -0
  440. package/src/runLoop/common/setIntervalPolyfill.ts +38 -0
  441. package/src/runLoop/uiRuntime/mockedRequestAnimationFrame.ts +11 -0
  442. package/src/runLoop/uiRuntime/requestAnimationFrame.ts +87 -0
  443. package/src/runLoop/uiRuntime/setTimeoutPolyfill.ts +40 -0
  444. package/src/runLoop/workletRuntime/index.ts +18 -0
  445. package/src/runLoop/workletRuntime/queueMicrotask.ts +13 -0
  446. package/src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts +61 -0
  447. package/src/runLoop/workletRuntime/setTimeout.ts +37 -0
  448. package/src/runLoop/workletRuntime/taskQueue.ts +44 -0
  449. package/src/runtimeKind.ts +85 -0
  450. package/src/runtimes.native.ts +572 -0
  451. package/src/runtimes.ts +107 -0
  452. package/src/specs/NativeWorkletsModule.ts +11 -0
  453. package/src/specs/index.ts +13 -0
  454. package/src/threads.native.ts +408 -0
  455. package/src/threads.ts +110 -0
  456. package/src/types.ts +164 -0
  457. package/src/workletFunction.ts +41 -0
@@ -0,0 +1,10 @@
1
+ type Callback = () => void;
2
+ export type Queue = {
3
+ microtasks: Array<Callback>;
4
+ timeoutCallbacks: Map<number, Callback>;
5
+ };
6
+ export declare function setupTaskQueue(): void;
7
+ export declare function pushMicrotask(callback: Callback): void;
8
+ export declare function pushTask(callback: Callback, handlerId: number, delay: number): void;
9
+ export {};
10
+ //# sourceMappingURL=taskQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskQueue.d.ts","sourceRoot":"","sources":["../../../../src/runLoop/workletRuntime/taskQueue.ts"],"names":[],"mappings":"AAEA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACzC,CAAC;AAEF,wBAAgB,cAAc,SAqB7B;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,QAI/C;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAK5E"}
@@ -0,0 +1,56 @@
1
+ export declare enum RuntimeKind {
2
+ /**
3
+ * The React Native runtime, which is the main runtime for React Native where
4
+ * React exists and where components are rendered.
5
+ */
6
+ ReactNative = 1,
7
+ /**
8
+ * The UI runtime, which is a special runtime that executes on the UI thread,
9
+ * mostly used for animations and gestures.
10
+ */
11
+ UI = 2,
12
+ /** Additional runtime created on-demand by the user. */
13
+ Worker = 3
14
+ }
15
+ /**
16
+ * Programmatic way to check the current runtime kind. It's useful when you need
17
+ * specific implementations for different runtimes created by Worklets.
18
+ *
19
+ * For more optimized calls you can check the value of
20
+ * `globalThis.__RUNTIME_KIND` directly.
21
+ *
22
+ * @returns The kind of the current runtime.
23
+ */
24
+ export declare function getRuntimeKind(): RuntimeKind;
25
+ /**
26
+ * Checks if the current runtime is the [React Native
27
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#rn-runtime).
28
+ *
29
+ * @returns `true` if the current runtime is the React Native Runtime, `false`
30
+ * otherwise.
31
+ */
32
+ export declare function isRNRuntime(): boolean;
33
+ /**
34
+ * Checks if the current runtime is a [Worklet
35
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#worklet-runtime).
36
+ *
37
+ * @returns `true` if the current runtime is a Worklet Runtime, `false`
38
+ * otherwise.
39
+ */
40
+ export declare function isWorkletRuntime(): boolean;
41
+ /**
42
+ * Checks if the current runtime is the [UI
43
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#ui-runtime).
44
+ *
45
+ * @returns `true` if the current runtime is the UI Runtime, `false` otherwise.
46
+ */
47
+ export declare function isUIRuntime(): boolean;
48
+ /**
49
+ * Checks if the current runtime is a [Worker
50
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#worker-runtime).
51
+ *
52
+ * @returns `true` if the current runtime is a Worker Runtime, `false`
53
+ * otherwise.
54
+ */
55
+ export declare function isWorkerRuntime(): boolean;
56
+ //# sourceMappingURL=runtimeKind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeKind.d.ts","sourceRoot":"","sources":["../../src/runtimeKind.ts"],"names":[],"mappings":"AAEA,oBAAY,WAAW;IACrB;;;OAGG;IACH,WAAW,IAAI;IACf;;;OAGG;IACH,EAAE,IAAI;IACN,wDAAwD;IACxD,MAAM,IAAI;CACX;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAGrC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAG1C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAGrC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
@@ -0,0 +1,15 @@
1
+ import { RuntimeKind } from './runtimeKind';
2
+ import type { WorkletFunction, WorkletRuntime, WorkletRuntimeConfig } from './types';
3
+ export declare const UIRuntimeId = RuntimeKind.UI;
4
+ export declare function createWorkletRuntime(config?: WorkletRuntimeConfig): WorkletRuntime;
5
+ export declare function createWorkletRuntime(name?: string, initializer?: () => void): WorkletRuntime;
6
+ export declare function runOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue): WorkletFunction<Args, ReturnValue>;
7
+ export declare function scheduleOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
8
+ export declare function scheduleOnRuntimeWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
9
+ export declare function runOnRuntimeSync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
10
+ export declare function runOnRuntimeSyncWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
11
+ export declare function runOnRuntimeAsync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
12
+ export declare function runOnRuntimeAsyncWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
13
+ export declare function getUIRuntimeHolder(): object;
14
+ export declare function getUISchedulerHolder(): object;
15
+ //# sourceMappingURL=runtimes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimes.d.ts","sourceRoot":"","sources":["../../src/runtimes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAE1C,wBAAgB,oBAAoB,CAClC,MAAM,CAAC,EAAE,oBAAoB,GAC5B,cAAc,CAAC;AAElB,wBAAgB,oBAAoB,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,cAAc,CAAC;AAMlB,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAMtC,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAMR,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAQR,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAClE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAMf,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAQf,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AAMxB,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AAQxB,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -0,0 +1,155 @@
1
+ import type { WorkletFunction, WorkletRuntime, WorkletRuntimeConfig } from './types';
2
+ /**
3
+ * The ID of the [UI Worklet
4
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
5
+ */
6
+ export declare const UIRuntimeId: 2;
7
+ /**
8
+ * Lets you create a new JS runtime which can be used to run worklets possibly
9
+ * on different threads than JS or UI thread.
10
+ *
11
+ * @param config - Runtime configuration object - {@link WorkletRuntimeConfig}.
12
+ * @returns WorkletRuntime which is a
13
+ * `jsi::HostObject<worklets::WorkletRuntime>` - {@link WorkletRuntime}
14
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/createWorkletRuntime/
15
+ */
16
+ export declare function createWorkletRuntime(config?: WorkletRuntimeConfig): WorkletRuntime;
17
+ /**
18
+ * @deprecated Please use the new config object signature instead:
19
+ * `createWorkletRuntime({ name, initializer })`
20
+ *
21
+ * Lets you create a new JS runtime which can be used to run worklets possibly
22
+ * on different threads than JS or UI thread.
23
+ * @param name - A name used to identify the runtime which will appear in
24
+ * devices list in Chrome DevTools.
25
+ * @param initializer - An optional worklet that will be run synchronously on
26
+ * the same thread immediately after the runtime is created.
27
+ * @returns WorkletRuntime which is a
28
+ * `jsi::HostObject<worklets::WorkletRuntime>` - {@link WorkletRuntime}
29
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/createWorkletRuntime/
30
+ */
31
+ export declare function createWorkletRuntime(name?: string, initializer?: () => void): WorkletRuntime;
32
+ /**
33
+ * Lets you asynchronously run a
34
+ * [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
35
+ * on a [Worker
36
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime).
37
+ *
38
+ * Check
39
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
40
+ * for more information about the different runtime kinds.
41
+ *
42
+ * - The worklet is scheduled on the Worker Runtime's [Async
43
+ * Queue](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/Common/cpp/worklets/RunLoop/AsyncQueue.h)
44
+ *
45
+ * @param workletRuntime - The runtime to schedule the worklet on.
46
+ * @param worklet - The worklet to schedule.
47
+ * @param args - The arguments to pass to the worklet.
48
+ * @returns The return value of the worklet.
49
+ */
50
+ export declare function scheduleOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
51
+ /**
52
+ * Lets you asynchronously run a
53
+ * [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
54
+ * on a [Worker
55
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime)
56
+ * identified by the runtime's id.
57
+ *
58
+ * Check
59
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
60
+ * for more information about the different runtime kinds.
61
+ *
62
+ * - The worklet is scheduled on the Worker Runtime's [Async
63
+ * Queue](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/Common/cpp/worklets/RunLoop/AsyncQueue.h)
64
+ *
65
+ * @param runtimeId - The id of the runtime to schedule the worklet on.
66
+ * @param worklet - The worklet to schedule.
67
+ * @param args - The arguments to pass to the worklet.
68
+ * @returns The return value of the worklet.
69
+ */
70
+ export declare function scheduleOnRuntimeWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
71
+ /**
72
+ * @deprecated Use `scheduleOnRuntime` instead.
73
+ *
74
+ * Schedule a worklet to execute on the background queue.
75
+ */
76
+ export declare function runOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue): WorkletFunction<Args, ReturnValue>;
77
+ /**
78
+ * Lets you run a function synchronously on a [Worker
79
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime).
80
+ *
81
+ * - This function cannot be called from the [UI
82
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
83
+ * or another [Worker
84
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime),
85
+ * unless the [Bundle
86
+ * Mode](https://docs.swmansion.com/react-native-worklets/docs/bundleMode/) is
87
+ * enabled.
88
+ *
89
+ * @param workletRuntime - The runtime to run the worklet on.
90
+ * @param worklet - The worklet to run.
91
+ * @param args - The arguments to pass to the worklet.
92
+ * @returns The return value of the worklet.
93
+ */
94
+ export declare function runOnRuntimeSync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
95
+ /**
96
+ * Lets you run a function synchronously on a [Worklet
97
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worklet-runtime)
98
+ * identified by the runtime's id.
99
+ *
100
+ * - This function cannot be called from the [UI
101
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime)
102
+ * or a [Worker
103
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime),
104
+ * unless the [Bundle
105
+ * Mode](https://docs.swmansion.com/react-native-worklets/docs/bundleMode/) is
106
+ * enabled.
107
+ * - You can target the UI Runtime with this function by passing
108
+ * {@link UIRuntimeId} as the `runtimeId` argument.
109
+ *
110
+ * @param runtimeId - The id of the runtime to run the worklet on.
111
+ * @param worklet - The worklet to run.
112
+ * @param args - The arguments to pass to the worklet.
113
+ * @returns The return value of the worklet.
114
+ */
115
+ export declare function runOnRuntimeSyncWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
116
+ /**
117
+ * Lets you asynchronously run a
118
+ * [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
119
+ * on a [Worker
120
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime)
121
+ * and get the result via a Promise.
122
+ *
123
+ * - The worklet is scheduled on the Worker Runtime's Async Queue
124
+ * - Returns a Promise that resolves with the worklet's return value
125
+ *
126
+ * @param workletRuntime - The runtime to run the worklet on.
127
+ * @param worklet - The worklet to run.
128
+ * @param args - The arguments to pass to the worklet.
129
+ * @returns A Promise that resolves to the return value of the worklet.
130
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnRuntimeAsync
131
+ */
132
+ export declare function runOnRuntimeAsync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
133
+ /**
134
+ * Lets you asynchronously run a
135
+ * [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
136
+ * on a [Worker
137
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime)
138
+ * identified by the runtime's id.
139
+ *
140
+ * Check
141
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
142
+ * for more information about the different runtime kinds.
143
+ *
144
+ * - The worklet is scheduled on the Worker Runtime's [Async
145
+ * Queue](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/Common/cpp/worklets/RunLoop/AsyncQueue.h)
146
+ *
147
+ * @param runtimeId - The id of the runtime to schedule the worklet on.
148
+ * @param worklet - The worklet to schedule.
149
+ * @param args - The arguments to pass to the worklet.
150
+ * @returns The return value of the worklet.
151
+ */
152
+ export declare function runOnRuntimeAsyncWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
153
+ export declare function getUIRuntimeHolder(): object;
154
+ export declare function getUISchedulerHolder(): object;
155
+ //# sourceMappingURL=runtimes.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimes.native.d.ts","sourceRoot":"","sources":["../../src/runtimes.native.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAOjB;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAqB,CAAC,CAAC;AAE/C;;;;;;;;GAQG;AAEH,wBAAgB,oBAAoB,CAClC,MAAM,CAAC,EAAE,oBAAoB,GAC5B,cAAc,CAAC;AAElB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,cAAc,CAAC;AAiElB;;;;;;;;;;;;;;;;;GAiBG;AAGH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAqDR;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAqDR;;;;GAIG;AAGH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAmBtC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAClE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAgBb;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAwBf;;;;;;;;;;;;;;;GAeG;AAGH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AAoDxB;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AA6DxB,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -0,0 +1,9 @@
1
+ import { type TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ installTurboModule: (bundleModeEnabled: boolean) => boolean;
4
+ toggleSlowAnimationsOnUIRuntime: () => boolean;
5
+ start: () => boolean;
6
+ }
7
+ declare const _default: Spec | null;
8
+ export default _default;
9
+ //# sourceMappingURL=NativeWorkletsModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeWorkletsModule.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeWorkletsModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,OAAO,KAAK,OAAO,CAAC;IAC5D,+BAA+B,EAAE,MAAM,OAAO,CAAC;IAC/C,KAAK,EAAE,MAAM,OAAO,CAAC;CACtB;;AAED,wBAA+D"}
@@ -0,0 +1,3 @@
1
+ import type { Spec } from './NativeWorkletsModule';
2
+ export declare const WorkletsTurboModule: Spec | null | undefined;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/specs/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,eAAO,MAAM,mBAAmB,EAAE,IAAI,GAAG,IAAI,GAAG,SAMtC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function scheduleOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): void;
2
+ export declare function runOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => void;
3
+ export declare function runOnUISync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
4
+ export declare function executeOnUIRuntimeSync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => ReturnValue;
5
+ export declare function runOnJS<Args extends unknown[], ReturnValue>(fun: (...args: Args) => ReturnValue): (...args: Args) => void;
6
+ export declare function scheduleOnRN<Args extends unknown[], ReturnValue>(fun: (...args: Args) => ReturnValue, ...args: Args): void;
7
+ export declare function runOnUIAsync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
8
+ //# sourceMappingURL=threads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/threads.ts"],"names":[],"mappings":"AAKA,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAEN;AAED,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAIzB;AAED,wBAAgB,WAAW,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC7D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAMf,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;AAQlC,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GAClC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAEzB;AAED,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACnC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAMN;AAED,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAItB"}
@@ -0,0 +1,125 @@
1
+ import type { RemoteFunction } from './memory/types';
2
+ import type { WorkletFunction } from './types';
3
+ export declare function setupMicrotasks(): void;
4
+ /**
5
+ * Lets you schedule a function to be executed on the [UI
6
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
7
+ *
8
+ * - The callback executes asynchronously and doesn't return a value.
9
+ * - Passed function and args are automatically
10
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
11
+ * and serialized.
12
+ * - This function cannot be called from the [UI
13
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime)
14
+ * or a [Worker
15
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime),
16
+ * unless you have the [Bundle Mode](/docs/bundleMode/) enabled.
17
+ *
18
+ * @param fun - A reference to a function you want to schedule on the [UI
19
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
20
+ * @param args - Arguments to pass to the function.
21
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/scheduleOnUI
22
+ */
23
+ export declare function scheduleOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): void;
24
+ /**
25
+ * Lets you asynchronously run
26
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
27
+ * functions on the [UI
28
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/).
29
+ *
30
+ * This method does not schedule the work immediately but instead waits for
31
+ * other worklets to be scheduled within the same JS loop. It uses
32
+ * queueMicrotask to schedule all the worklets at once making sure they will run
33
+ * within the same frame boundaries on the UI thread.
34
+ *
35
+ * @param fun - A reference to a function you want to execute on the [UI
36
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/)
37
+ * from the [JavaScript
38
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/).
39
+ * @returns A function that accepts arguments for the function passed as the
40
+ * first argument.
41
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI @deprecated Use `scheduleOnUI` instead.
42
+ */
43
+ export declare function runOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => void;
44
+ /**
45
+ * Lets you run a function synchronously on the [UI
46
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime)
47
+ * from the [RN
48
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#rn-runtime).
49
+ * Passed function and args are automatically
50
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
51
+ * and serialized.
52
+ *
53
+ * - This function cannot be called from the [UI
54
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
55
+ * - This function cannot be called from a [Worker
56
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime).
57
+ *
58
+ * @param fun - A reference to a function you want to execute on the [UI
59
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
60
+ * @param args - Arguments to pass to the function.
61
+ * @returns The return value of the function passed as the first argument.
62
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUISync
63
+ */
64
+ export declare function runOnUISync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
65
+ export declare function executeOnUIRuntimeSync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => ReturnValue;
66
+ /**
67
+ * Lets you schedule a function to be executed on the RN runtime from any
68
+ * runtime. Check
69
+ * {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
70
+ * for more information about the different runtime kinds.
71
+ *
72
+ * Scheduling function from the RN Runtime (we are already on RN Runtime) simply
73
+ * uses `queueMicrotask`.
74
+ *
75
+ * When functions need to be scheduled from the UI Runtime, first function and
76
+ * args are serialized and then the system passes the scheduling responsibility
77
+ * to the JSScheduler. The JSScheduler then uses the RN CallInvoker to schedule
78
+ * the function asynchronously on the JavaScript thread by calling
79
+ * `jsCallInvoker_->invokeAsync()`.
80
+ *
81
+ * When called from a Worker Runtime, it uses the same JSScheduler mechanism.
82
+ *
83
+ * @param fun - A function you want to schedule on the RN runtime. A function
84
+ * can be a worklet, a remote function or a regular function.
85
+ * @param args - Arguments to pass to the function.
86
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/scheduleOnRN
87
+ */
88
+ export declare function scheduleOnRN<Args extends unknown[], ReturnValue>(fun: ((...args: Args) => ReturnValue) | RemoteFunction | WorkletFunction<Args, ReturnValue>, ...args: Args): void;
89
+ /**
90
+ * Lets you asynchronously run
91
+ * non-[workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
92
+ * functions that couldn't otherwise run on the [UI
93
+ * thread](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-thread).
94
+ * This applies to most external libraries as they don't have their functions
95
+ * marked with "worklet"; directive.
96
+ *
97
+ * @param fun - A reference to a function you want to execute on the JavaScript
98
+ * thread from the UI thread.
99
+ * @returns A function that accepts arguments for the function passed as the
100
+ * first argument.
101
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnJS
102
+ */
103
+ /** @deprecated Use `scheduleOnRN` instead. */
104
+ export declare function runOnJS<Args extends unknown[], ReturnValue>(fun: ((...args: Args) => ReturnValue) | RemoteFunction | WorkletFunction<Args, ReturnValue>): (...args: Args) => void;
105
+ /**
106
+ * Lets you asynchronously run
107
+ * [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
108
+ * functions on the [UI
109
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
110
+ *
111
+ * - This method does not schedule the work immediately but instead waits for
112
+ * other worklets to be scheduled within the same JS loop. It uses
113
+ * queueMicrotask to schedule all the worklets at once making sure they will
114
+ * run within the same frame boundaries on the UI thread.
115
+ *
116
+ * @param fun - A reference to a function you want to execute on the [UI
117
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
118
+ * from the [JavaScript
119
+ * Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#javascript-runtime).
120
+ * @returns A promise that resolves to the return value of the function passed
121
+ * as the first argument.
122
+ * @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUIAsync
123
+ */
124
+ export declare function runOnUIAsync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
125
+ //# sourceMappingURL=threads.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threads.native.d.ts","sourceRoot":"","sources":["../../src/threads.native.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,gBAAgB,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAiB9D,wBAAgB,eAAe,SA2B9B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AA4BR;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;AAiB3B;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,wBAAgB,WAAW,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC7D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAkBf,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;AAkBlC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,GAAG,EACC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,GAChC,cAAc,GACd,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EACtC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAqBN;AAED;;;;;;;;;;;;;GAaG;AACH,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,GAAG,EACC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,GAChC,cAAc,GACd,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GACrC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAKzB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CA0BtB"}
@@ -0,0 +1,136 @@
1
+ import type { RuntimeKind } from './runtimeKind';
2
+ /** Public globals to be exposed to the user. */
3
+ declare global {
4
+ /**
5
+ * @deprecated Use {@link __RUNTIME_KIND} instead.
6
+ *
7
+ * This global variable is a diagnostic/development tool.
8
+ *
9
+ * It's `true` on Worklet Runtimes and `false` on React Native Runtime.
10
+ */
11
+ var _WORKLET: boolean | undefined;
12
+ /**
13
+ * This ArrayBuffer contains the memory address of `jsi::Runtime` which is the
14
+ * Reanimated UI runtime.
15
+ */
16
+ var _WORKLET_RUNTIME: ArrayBuffer;
17
+ /**
18
+ * This global variable is used to determine the kind of the current runtime.
19
+ * You can use it directly to differentiate between runtimes. However, the
20
+ * recommended way for differentiating is to use the {@link getRuntimeKind}
21
+ * function.
22
+ *
23
+ * - Value _1_: React Native Runtime
24
+ * - Value _2_: UI Worklet Runtime
25
+ * - Value _3_: Worker Worklet Runtime
26
+ */
27
+ var __RUNTIME_KIND: RuntimeKind | 1 | 2 | 3;
28
+ /**
29
+ * Use it to schedule a function to be executed after all
30
+ * `requestAnimationFrame` callbacks but before the next frame is rendered.
31
+ * This is useful to collect all updates which happened when the animation
32
+ * frame queue was flushed.
33
+ *
34
+ * **Available only on the UI Runtime.**
35
+ */
36
+ var requestAnimationFrameFinalizer: (callback: () => void) => void;
37
+ }
38
+ export type WorkletRuntime = {
39
+ __hostObjectWorkletRuntime: never;
40
+ readonly name: string;
41
+ readonly runtimeId: number;
42
+ };
43
+ export type WorkletStackDetails = [
44
+ error: Error,
45
+ lineOffset: number,
46
+ columnOffset: number
47
+ ];
48
+ type WorkletClosure = Record<string, unknown>;
49
+ interface WorkletInitData {
50
+ /** Only when bytecode isn't toggled. */
51
+ code?: string;
52
+ /** Only in production builds and explicitly toggled. */
53
+ bytecode?: ArrayBuffer;
54
+ /** Only in dev builds. */
55
+ location?: string;
56
+ /** Only in dev builds. */
57
+ sourceMap?: string;
58
+ }
59
+ interface WorkletProps {
60
+ __closure: WorkletClosure;
61
+ __workletHash: number;
62
+ /** Only in Legacy Eval Mode. */
63
+ __initData?: WorkletInitData;
64
+ /** Only for Handles. */
65
+ __init?: () => unknown;
66
+ /** `__stackDetails` is removed after parsing. */
67
+ __stackDetails?: WorkletStackDetails;
68
+ /** Only in dev builds. */
69
+ __pluginVersion?: string;
70
+ }
71
+ export type WorkletFunction<TArgs extends unknown[] = unknown[], TReturn = unknown> = ((...args: TArgs) => TReturn) & WorkletProps;
72
+ export interface WorkletFactory<TArgs extends unknown[] = unknown[], TReturn = unknown, TClosureVariables extends Record<string, unknown> = Record<string, unknown>> {
73
+ (closureVariables: TClosureVariables): WorkletFunction<TArgs, TReturn>;
74
+ }
75
+ export type ValueUnpacker = WorkletFunction<[
76
+ objectToUnpack: unknown,
77
+ category?: string
78
+ ], unknown>;
79
+ export interface WorkletImport {
80
+ __bundleData: {
81
+ /** Name of the module which is the source of the import. */
82
+ source: string;
83
+ /** The name of the imported value. */
84
+ imported: string;
85
+ };
86
+ }
87
+ type WorkletRuntimeConfigBase = {
88
+ /** The name of the worklet runtime. */
89
+ name?: string;
90
+ /**
91
+ * A worklet that will be run immediately after the runtime is created and
92
+ * before any other worklets.
93
+ */
94
+ initializer?: () => void;
95
+ /**
96
+ * Time interval in milliseconds between polling of frame callbacks scheduled
97
+ * by requestAnimationFrame. If not specified, it defaults to 16 ms.
98
+ */
99
+ animationQueuePollingRate?: number;
100
+ /**
101
+ * Determines whether to enable the default Event Loop or not. The Event Loop
102
+ * provides implementations for `setTimeout`, `setImmediate`, `setInterval`,
103
+ * `requestAnimationFrame`, `queueMicrotask`, `clearTimeout`, `clearInterval`,
104
+ * `clearImmediate`, and `cancelAnimationFrame` methods. If not specified, it
105
+ * defaults to `true`.
106
+ */
107
+ enableEventLoop?: boolean;
108
+ };
109
+ /** Configuration object for creating a worklet runtime. */
110
+ export type WorkletRuntimeConfig = WorkletRuntimeConfigBase & ({
111
+ /**
112
+ * The queue used for scheduling worklets on this runtime.
113
+ *
114
+ * - `'default'` (the default): use the built-in queue implementation.
115
+ * - An object implementing the C++ `AsyncQueue` interface from
116
+ * `<worklets/RunLoop/AsyncQueue.h>`: use the provided custom queue.
117
+ * - `null`: do not attach any queue to the runtime.
118
+ */
119
+ queue?: 'default' | object | null;
120
+ useDefaultQueue?: never;
121
+ customQueue?: never;
122
+ } | {
123
+ queue?: never;
124
+ /** @deprecated Use {@link queue} instead. */
125
+ useDefaultQueue?: true;
126
+ /** @deprecated Use {@link queue} instead. */
127
+ customQueue?: never;
128
+ } | {
129
+ queue?: never;
130
+ /** @deprecated Use {@link queue} instead. */
131
+ useDefaultQueue: false;
132
+ /** @deprecated Use {@link queue} instead. */
133
+ customQueue?: object;
134
+ });
135
+ export {};
136
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,gDAAgD;AAChD,OAAO,CAAC,MAAM,CAAC;IACb;;;;;;OAMG;IACH,IAAI,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAElC;;;OAGG;IACH,IAAI,gBAAgB,EAAE,WAAW,CAAC;IAElC;;;;;;;;;OASG;IACH,IAAI,cAAc,EAAE,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAE5C;;;;;;;OAOG;IACH,IAAI,8BAA8B,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACpE;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,0BAA0B,EAAE,KAAK,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;CACrB,CAAC;AAEF,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,UAAU,eAAe;IACvB,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;IACvB,iDAAiD;IACjD,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,0BAA0B;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EACnC,OAAO,GAAG,OAAO,IACf,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc,CAC7B,KAAK,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EACnC,OAAO,GAAG,OAAO,EACjB,iBAAiB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE3E,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CACxE;AAED,MAAM,MAAM,aAAa,GAAG,eAAe,CACzC;IAAC,cAAc,EAAE,OAAO;IAAE,QAAQ,CAAC,EAAE,MAAM;CAAC,EAC5C,OAAO,CACR,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE;QACZ,4DAA4D;QAC5D,MAAM,EAAE,MAAM,CAAC;QACf,sCAAsC;QACtC,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,KAAK,wBAAwB,GAAG;IAC9B,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CACI;IACE;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,CAAC,EAAE,KAAK,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,6CAA6C;IAC7C,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,GACD;IACE,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,6CAA6C;IAC7C,eAAe,EAAE,KAAK,CAAC;IACvB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { WorkletFunction } from './types';
2
+ /**
3
+ * This function allows you to determine if a given function is a worklet. It
4
+ * only works with Worklets Babel plugin enabled. Unless you are doing something
5
+ * with internals of Worklets you shouldn't need to use this function.
6
+ *
7
+ * ### Note
8
+ *
9
+ * Do not call it before the worklet is declared, as it will always return false
10
+ * then. E.g.:
11
+ *
12
+ * ```ts
13
+ * isWorkletFunction(myWorklet); // Will always return false.
14
+ *
15
+ * function myWorklet() {
16
+ * 'worklet';
17
+ * }
18
+ * ```
19
+ *
20
+ * ### Maintainer note
21
+ *
22
+ * This function is supposed to be used only in the React Runtime. It always
23
+ * returns `false` in Worklet Runtimes.
24
+ */
25
+ export declare function isWorkletFunction<Args extends unknown[] = unknown[], ReturnValue = unknown>(value: unknown): value is WorkletFunction<Args, ReturnValue>;
26
+ //# sourceMappingURL=workletFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workletFunction.d.ts","sourceRoot":"","sources":["../../src/workletFunction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EAClC,WAAW,GAAG,OAAO,EACrB,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAU7D"}