@shopify/react-native-skia 0.1.213 → 0.1.215

Sign up to get free protection for your applications and to get access to all the features.
Files changed (327) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  3. package/cpp/api/JsiSkMatrix.h +31 -0
  4. package/cpp/api/JsiSkPath.h +15 -7
  5. package/cpp/api/JsiSkSurface.h +4 -1
  6. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  7. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  8. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  9. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  10. package/cpp/skia/include/codec/SkCodec.h +4 -3
  11. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  12. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  18. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  19. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  20. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  21. package/cpp/skia/include/core/SkBitmap.h +8 -8
  22. package/cpp/skia/include/core/SkCanvas.h +37 -50
  23. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  24. package/cpp/skia/include/core/SkColor.h +1 -1
  25. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  26. package/cpp/skia/include/core/SkColorTable.h +3 -0
  27. package/cpp/skia/include/core/SkColorType.h +2 -0
  28. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  29. package/cpp/skia/include/core/SkDocument.h +1 -0
  30. package/cpp/skia/include/core/SkFont.h +11 -2
  31. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  32. package/cpp/skia/include/core/SkGraphics.h +3 -13
  33. package/cpp/skia/include/core/SkImage.h +57 -111
  34. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  35. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  36. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  37. package/cpp/skia/include/core/SkM44.h +7 -3
  38. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  39. package/cpp/skia/include/core/SkMatrix.h +17 -17
  40. package/cpp/skia/include/core/SkMesh.h +71 -61
  41. package/cpp/skia/include/core/SkMilestone.h +1 -1
  42. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  43. package/cpp/skia/include/core/SkPaint.h +1 -1
  44. package/cpp/skia/include/core/SkPath.h +12 -4
  45. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  46. package/cpp/skia/include/core/SkPicture.h +19 -6
  47. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  48. package/cpp/skia/include/core/SkPixmap.h +2 -3
  49. package/cpp/skia/include/core/SkRRect.h +1 -1
  50. package/cpp/skia/include/core/SkRect.h +107 -110
  51. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  52. package/cpp/skia/include/core/SkRegion.h +7 -1
  53. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  54. package/cpp/skia/include/core/SkShader.h +9 -0
  55. package/cpp/skia/include/core/SkStream.h +9 -9
  56. package/cpp/skia/include/core/SkString.h +1 -1
  57. package/cpp/skia/include/core/SkSurface.h +14 -25
  58. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  59. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  60. package/cpp/skia/include/core/SkTypeface.h +7 -2
  61. package/cpp/skia/include/core/SkTypes.h +4 -12
  62. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  63. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  64. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  65. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  66. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  67. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  68. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  69. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  70. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  71. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  72. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  73. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  74. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  75. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  76. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  77. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  78. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  79. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  80. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  81. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  82. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  83. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  84. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  85. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  86. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  87. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  88. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  89. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  90. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  91. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  92. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  93. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  94. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  95. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  96. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  97. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  98. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  99. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  100. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  101. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  102. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  103. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  104. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  105. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  106. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  107. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  108. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  109. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  110. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  111. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  112. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  113. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  114. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  115. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  116. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  117. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  118. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  119. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  120. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  121. package/cpp/skia/include/utils/SkBase64.h +2 -2
  122. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  123. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  124. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  125. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  126. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  127. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  128. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  129. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  130. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  131. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  132. package/cpp/skia/src/core/SkChecksum.h +2 -1
  133. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  134. package/cpp/skia/src/core/SkTHash.h +19 -9
  135. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  136. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  137. package/lib/commonjs/animation/functions/interpolatePaths.d.ts +1 -1
  138. package/lib/commonjs/animation/functions/interpolatePaths.js +4 -4
  139. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  140. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  141. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  142. package/lib/commonjs/external/reanimated/index.d.ts +3 -1
  143. package/lib/commonjs/external/reanimated/index.js +30 -4
  144. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  145. package/lib/commonjs/external/reanimated/interpolators.d.ts +9 -0
  146. package/lib/commonjs/external/reanimated/interpolators.js +56 -0
  147. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -0
  148. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +8 -6
  149. package/lib/commonjs/external/reanimated/moduleWrapper.js +8 -18
  150. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  151. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  152. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  153. package/lib/commonjs/external/reanimated/useAnimatedImageValue.d.ts +2 -0
  154. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +53 -0
  155. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -0
  156. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +1 -0
  157. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +27 -0
  158. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  159. package/lib/commonjs/mock/index.js +8 -0
  160. package/lib/commonjs/mock/index.js.map +1 -1
  161. package/lib/commonjs/renderer/HostConfig.js +5 -5
  162. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  163. package/lib/commonjs/skia/core/AnimatedImage.d.ts +0 -1
  164. package/lib/commonjs/skia/core/AnimatedImage.js +1 -45
  165. package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
  166. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  167. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  168. package/lib/commonjs/skia/types/Matrix.d.ts +4 -0
  169. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  170. package/lib/commonjs/skia/types/Path/Path.d.ts +10 -9
  171. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  172. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +6 -0
  173. package/lib/commonjs/skia/web/JsiSkMatrix.js +33 -5
  174. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  175. package/lib/commonjs/skia/web/JsiSkPath.d.ts +9 -9
  176. package/lib/commonjs/skia/web/JsiSkPath.js +15 -2
  177. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  178. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  179. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  180. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  181. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  182. package/lib/commonjs/views/types.js +3 -0
  183. package/lib/commonjs/views/types.js.map +1 -1
  184. package/lib/module/animation/functions/interpolatePaths.d.ts +1 -1
  185. package/lib/module/animation/functions/interpolatePaths.js +4 -4
  186. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  187. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  188. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  189. package/lib/module/external/reanimated/index.d.ts +3 -1
  190. package/lib/module/external/reanimated/index.js +3 -1
  191. package/lib/module/external/reanimated/index.js.map +1 -1
  192. package/lib/module/external/reanimated/interpolators.d.ts +9 -0
  193. package/lib/module/external/reanimated/interpolators.js +34 -0
  194. package/lib/module/external/reanimated/interpolators.js.map +1 -0
  195. package/lib/module/external/reanimated/moduleWrapper.d.ts +8 -6
  196. package/lib/module/external/reanimated/moduleWrapper.js +5 -16
  197. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  198. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  199. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  200. package/lib/module/external/reanimated/useAnimatedImageValue.d.ts +2 -0
  201. package/lib/module/external/reanimated/useAnimatedImageValue.js +41 -0
  202. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -0
  203. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +1 -0
  204. package/lib/module/external/reanimated/useDerivedValueOnJS.js +16 -0
  205. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  206. package/lib/module/mock/index.js +8 -0
  207. package/lib/module/mock/index.js.map +1 -1
  208. package/lib/module/renderer/HostConfig.js +1 -1
  209. package/lib/module/renderer/HostConfig.js.map +1 -1
  210. package/lib/module/skia/core/AnimatedImage.d.ts +0 -1
  211. package/lib/module/skia/core/AnimatedImage.js +0 -40
  212. package/lib/module/skia/core/AnimatedImage.js.map +1 -1
  213. package/lib/module/skia/types/MaskFilter.js +3 -0
  214. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  215. package/lib/module/skia/types/Matrix.d.ts +4 -0
  216. package/lib/module/skia/types/Matrix.js.map +1 -1
  217. package/lib/module/skia/types/Path/Path.d.ts +10 -9
  218. package/lib/module/skia/types/Path/Path.js.map +1 -1
  219. package/lib/module/skia/web/JsiSkMatrix.d.ts +6 -0
  220. package/lib/module/skia/web/JsiSkMatrix.js +33 -5
  221. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  222. package/lib/module/skia/web/JsiSkPath.d.ts +9 -9
  223. package/lib/module/skia/web/JsiSkPath.js +15 -2
  224. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  225. package/lib/module/views/types.js +3 -0
  226. package/lib/module/views/types.js.map +1 -1
  227. package/lib/typescript/jestEnv.d.mts +5 -0
  228. package/lib/typescript/jestSetup.d.mts +1 -0
  229. package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +1 -1
  230. package/lib/typescript/src/external/reanimated/index.d.ts +3 -1
  231. package/lib/typescript/src/external/reanimated/interpolators.d.ts +9 -0
  232. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +8 -6
  233. package/lib/typescript/src/external/reanimated/useAnimatedImageValue.d.ts +2 -0
  234. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +1 -0
  235. package/lib/typescript/src/skia/core/AnimatedImage.d.ts +0 -1
  236. package/lib/typescript/src/skia/types/Matrix.d.ts +4 -0
  237. package/lib/typescript/src/skia/types/Path/Path.d.ts +10 -9
  238. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +6 -0
  239. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +9 -9
  240. package/libs/android/arm64-v8a/libskia.a +0 -0
  241. package/libs/android/arm64-v8a/libskottie.a +0 -0
  242. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  243. package/libs/android/arm64-v8a/libsksg.a +0 -0
  244. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  245. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  246. package/libs/android/arm64-v8a/libsvg.a +0 -0
  247. package/libs/android/armeabi-v7a/libskia.a +0 -0
  248. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  249. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  250. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  251. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  252. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  253. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  254. package/libs/android/x86/libskia.a +0 -0
  255. package/libs/android/x86/libskottie.a +0 -0
  256. package/libs/android/x86/libskparagraph.a +0 -0
  257. package/libs/android/x86/libsksg.a +0 -0
  258. package/libs/android/x86/libskshaper.a +0 -0
  259. package/libs/android/x86/libskunicode.a +0 -0
  260. package/libs/android/x86/libsvg.a +0 -0
  261. package/libs/android/x86_64/libskia.a +0 -0
  262. package/libs/android/x86_64/libskottie.a +0 -0
  263. package/libs/android/x86_64/libskparagraph.a +0 -0
  264. package/libs/android/x86_64/libsksg.a +0 -0
  265. package/libs/android/x86_64/libskshaper.a +0 -0
  266. package/libs/android/x86_64/libskunicode.a +0 -0
  267. package/libs/android/x86_64/libsvg.a +0 -0
  268. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  269. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  270. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  271. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  272. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  273. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  274. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  275. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  276. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  277. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  278. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  279. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  280. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  281. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  282. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  283. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  284. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  285. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  286. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  287. package/package.json +4 -3
  288. package/react-native-skia.podspec +1 -1
  289. package/src/animation/functions/interpolatePaths.ts +7 -4
  290. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  291. package/src/external/reanimated/index.ts +3 -1
  292. package/src/external/reanimated/interpolators.ts +89 -0
  293. package/src/external/reanimated/moduleWrapper.ts +38 -25
  294. package/src/external/reanimated/renderHelpers.ts +42 -2
  295. package/src/external/reanimated/useAnimatedImageValue.ts +51 -0
  296. package/src/external/reanimated/useDerivedValueOnJS.ts +25 -0
  297. package/src/mock/index.ts +5 -0
  298. package/src/renderer/HostConfig.ts +1 -1
  299. package/src/skia/core/AnimatedImage.ts +0 -47
  300. package/src/skia/types/Matrix.ts +4 -0
  301. package/src/skia/types/Path/Path.ts +10 -9
  302. package/src/skia/web/JsiSkMatrix.ts +33 -27
  303. package/src/skia/web/JsiSkPath.ts +15 -2
  304. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  305. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  306. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  307. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  308. package/cpp/skia/include/core/SkTime.h +0 -63
  309. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  310. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  311. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  312. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  313. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  314. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  315. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  316. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  317. package/globalJestSetup.js +0 -6
  318. package/lib/commonjs/external/reanimated/useSharedValueEffect.d.ts +0 -8
  319. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +0 -52
  320. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +0 -1
  321. package/lib/module/external/reanimated/useSharedValueEffect.d.ts +0 -8
  322. package/lib/module/external/reanimated/useSharedValueEffect.js +0 -42
  323. package/lib/module/external/reanimated/useSharedValueEffect.js.map +0 -1
  324. package/lib/typescript/globalJestSetup.d.ts +0 -2
  325. package/lib/typescript/src/external/reanimated/useSharedValueEffect.d.ts +0 -8
  326. package/src/external/reanimated/useSharedValueEffect.ts +0 -58
  327. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -124,6 +124,9 @@ struct ParagraphStyle {
124
124
  bool getReplaceTabCharacters() const { return fReplaceTabCharacters; }
125
125
  void setReplaceTabCharacters(bool value) { fReplaceTabCharacters = value; }
126
126
 
127
+ bool getApplyRoundingHack() const { return fApplyRoundingHack; }
128
+ void setApplyRoundingHack(bool value) { fApplyRoundingHack = value; }
129
+
127
130
  private:
128
131
  StrutStyle fStrutStyle;
129
132
  TextStyle fDefaultTextStyle;
@@ -136,6 +139,7 @@ private:
136
139
  TextHeightBehavior fTextHeightBehavior;
137
140
  bool fHintingIsOn;
138
141
  bool fReplaceTabCharacters;
142
+ bool fApplyRoundingHack = true;
139
143
  };
140
144
  } // namespace textlayout
141
145
  } // namespace skia
@@ -2,14 +2,16 @@
2
2
  #ifndef TypefaceFontProvider_DEFINED
3
3
  #define TypefaceFontProvider_DEFINED
4
4
 
5
+ #include "include/core/SkFontMgr.h"
6
+ #include "include/core/SkFontStyle.h"
7
+ #include "include/core/SkStream.h"
8
+ #include "include/core/SkString.h"
5
9
  #include "include/private/base/SkTArray.h"
6
10
  #include "src/core/SkTHash.h"
11
+
7
12
  #include <string>
8
13
  #include <unordered_map>
9
14
  #include <vector>
10
- #include "include/core/SkFontMgr.h"
11
- #include "include/core/SkStream.h"
12
- #include "include/core/SkString.h"
13
15
 
14
16
  namespace skia {
15
17
  namespace textlayout {
@@ -116,9 +116,13 @@ private:
116
116
  bool parseLengthUnitToken(SkSVGLength::Unit*);
117
117
  bool parseNamedColorToken(SkColor*);
118
118
  bool parseHexColorToken(SkColor*);
119
+ bool parseColorComponentScalarToken(int32_t*);
120
+ bool parseColorComponentIntegralToken(int32_t*);
121
+ bool parseColorComponentFractionalToken(int32_t*);
119
122
  bool parseColorComponentToken(int32_t*);
120
123
  bool parseColorToken(SkColor*);
121
124
  bool parseRGBColorToken(SkColor*);
125
+ bool parseRGBAColorToken(SkColor*);
122
126
  bool parseSVGColor(SkSVGColor*, SkSVGColor::Vars&&);
123
127
  bool parseSVGColorType(SkSVGColorType*);
124
128
  bool parseFuncIRI(SkSVGFuncIRI*);
@@ -9,9 +9,10 @@
9
9
  #define SkChecksum_DEFINED
10
10
 
11
11
  #include "include/core/SkString.h"
12
- #include "include/core/SkTypes.h"
13
12
  #include "include/private/base/SkAPI.h"
14
13
 
14
+ #include <cstddef>
15
+ #include <cstdint>
15
16
  #include <string>
16
17
  #include <string_view>
17
18
  #include <type_traits>
@@ -19,7 +19,7 @@
19
19
  #include "include/private/SkIDChangeListener.h"
20
20
  #include "include/private/SkPathRef.h"
21
21
  #include "include/private/base/SkDebug.h"
22
- #include "include/private/base/SkPathEnums.h"
22
+ #include "src/core/SkPathEnums.h"
23
23
 
24
24
  #include <cstdint>
25
25
  #include <iterator>
@@ -9,11 +9,12 @@
9
9
  #define SkTHash_DEFINED
10
10
 
11
11
  #include "include/core/SkTypes.h"
12
- #include "include/private/base/SkTemplates.h"
13
12
  #include "src/core/SkChecksum.h"
14
13
 
15
14
  #include <initializer_list>
15
+ #include <memory>
16
16
  #include <new>
17
+ #include <type_traits>
17
18
  #include <utility>
18
19
 
19
20
  namespace skia_private {
@@ -40,7 +41,7 @@ public:
40
41
  if (this != &that) {
41
42
  fCount = that.fCount;
42
43
  fCapacity = that.fCapacity;
43
- fSlots.reset(that.fCapacity);
44
+ fSlots.reset(new Slot[that.fCapacity]);
44
45
  for (int i = 0; i < fCapacity; i++) {
45
46
  fSlots[i] = that.fSlots[i];
46
47
  }
@@ -147,8 +148,8 @@ public:
147
148
 
148
149
  fCount = 0;
149
150
  fCapacity = capacity;
150
- AutoTArray<Slot> oldSlots = std::move(fSlots);
151
- fSlots = AutoTArray<Slot>(capacity);
151
+ std::unique_ptr<Slot[]> oldSlots = std::move(fSlots);
152
+ fSlots.reset(new Slot[capacity]);
152
153
 
153
154
  for (int i = 0; i < oldCapacity; i++) {
154
155
  Slot& s = oldSlots[i];
@@ -413,7 +414,7 @@ private:
413
414
 
414
415
  int fCount = 0,
415
416
  fCapacity = 0;
416
- AutoTArray<Slot> fSlots;
417
+ std::unique_ptr<Slot[]> fSlots;
417
418
  };
418
419
 
419
420
  // Maps K->V. A more user-friendly wrapper around THashTable, suitable for most use cases.
@@ -488,15 +489,24 @@ public:
488
489
  }
489
490
 
490
491
  // Call fn on every key/value pair in the table. You may mutate the value but not the key.
491
- template <typename Fn> // f(K, V*) or f(const K&, V*)
492
+ template <typename Fn, // f(K, V*) or f(const K&, V*)
493
+ std::enable_if_t<std::is_invocable_v<Fn, K, V*>>* = nullptr>
492
494
  void foreach(Fn&& fn) {
493
- fTable.foreach([&fn](Pair* p){ fn(p->first, &p->second); });
495
+ fTable.foreach([&fn](Pair* p) { fn(p->first, &p->second); });
494
496
  }
495
497
 
496
498
  // Call fn on every key/value pair in the table. You may not mutate anything.
497
- template <typename Fn> // f(K, V), f(const K&, V), f(K, const V&) or f(const K&, const V&).
499
+ template <typename Fn, // f(K, V), f(const K&, V), f(K, const V&) or f(const K&, const V&).
500
+ std::enable_if_t<std::is_invocable_v<Fn, K, V>>* = nullptr>
498
501
  void foreach(Fn&& fn) const {
499
- fTable.foreach([&fn](const Pair& p){ fn(p.first, p.second); });
502
+ fTable.foreach([&fn](const Pair& p) { fn(p.first, p.second); });
503
+ }
504
+
505
+ // Call fn on every key/value pair in the table. You may not mutate anything.
506
+ template <typename Fn, // f(Pair), or f(const Pair&)
507
+ std::enable_if_t<std::is_invocable_v<Fn, Pair>>* = nullptr>
508
+ void foreach(Fn&& fn) const {
509
+ fTable.foreach([&fn](const Pair& p) { fn(p); });
500
510
  }
501
511
 
502
512
  // Dereferencing an iterator gives back a key-value pair, suitable for structured binding.
@@ -88,7 +88,9 @@ bool RNSkMetalCanvasProvider::renderToCanvas(
88
88
  SkCanvas *canvas = skSurface->getCanvas();
89
89
  cb(canvas);
90
90
 
91
- skSurface->flushAndSubmit();
91
+ if (auto dContext = GrAsDirectContext(skSurface->recordingContext())) {
92
+ dContext->flushAndSubmit();
93
+ }
92
94
 
93
95
  id<MTLCommandBuffer> commandBuffer(
94
96
  [ThreadContextHolder::ThreadSkiaMetalContext
@@ -65,7 +65,7 @@ SkiaMetalSurfaceFactory::makeWindowedSurface(id<MTLTexture> texture, int width,
65
65
  GrMtlTextureInfo fbInfo;
66
66
  fbInfo.fTexture.retain((__bridge void *)texture);
67
67
 
68
- GrBackendRenderTarget backendRT(width, height, 1, fbInfo);
68
+ GrBackendRenderTarget backendRT(width, height, fbInfo);
69
69
 
70
70
  auto skSurface = SkSurfaces::WrapBackendRenderTarget(
71
71
  ThreadContextHolder::ThreadSkiaMetalContext.skContext.get(), backendRT,
@@ -16,4 +16,4 @@ import type { ExtrapolationType } from "./interpolate";
16
16
  * path2.lineTo(0, 100);
17
17
  * const path = interpolatePath(0.5, [0, 1], [path1, path2]);
18
18
  */
19
- export declare const interpolatePaths: (value: number, input: number[], outputRange: SkPath[], options?: ExtrapolationType) => SkPath;
19
+ export declare const interpolatePaths: (value: number, input: number[], outputRange: SkPath[], options?: ExtrapolationType, output?: SkPath) => SkPath;
@@ -9,11 +9,11 @@ var _typeddash = require("../../renderer/typeddash");
9
9
 
10
10
  var _interpolate = require("./interpolate");
11
11
 
12
- const lerp = (value, from, to, p1, p2) => {
12
+ const lerp = (value, from, to, p1, p2, output) => {
13
13
  "worklet";
14
14
 
15
15
  const t = (value - from) / (to - from);
16
- return p2.interpolate(p1, t);
16
+ return p2.interpolate(p1, t, output);
17
17
  };
18
18
  /**
19
19
  * Maps an input value within a range to an output path within a path range.
@@ -33,7 +33,7 @@ const lerp = (value, from, to, p1, p2) => {
33
33
  */
34
34
 
35
35
 
36
- const interpolatePaths = (value, input, outputRange, options) => {
36
+ const interpolatePaths = (value, input, outputRange, options, output) => {
37
37
  "worklet";
38
38
 
39
39
  const extrapolation = (0, _interpolate.validateInterpolationOptions)(options);
@@ -76,7 +76,7 @@ const interpolatePaths = (value, input, outputRange, options) => {
76
76
  }
77
77
  }
78
78
 
79
- return lerp(value, input[i], input[i + 1], outputRange[i], outputRange[i + 1]);
79
+ return lerp(value, input[i], input[i + 1], outputRange[i], outputRange[i + 1], output);
80
80
  };
81
81
 
82
82
  exports.interpolatePaths = interpolatePaths;
@@ -1 +1 @@
1
- {"version":3,"names":["lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","validateInterpolationOptions","extrapolateLeft","Extrapolate","CLAMP","EXTEND","IDENTITY","Error","exhaustiveCheck","length","extrapolateRight","i"],"sources":["interpolatePaths.ts"],"sourcesContent":["import type { SkPath } from \"../../skia/types\";\nimport { exhaustiveCheck } from \"../../renderer/typeddash\";\n\nimport type { ExtrapolationType } from \"./interpolate\";\nimport { validateInterpolationOptions, Extrapolate } from \"./interpolate\";\n\nconst lerp = (\n value: number,\n from: number,\n to: number,\n p1: SkPath,\n p2: SkPath\n) => {\n \"worklet\";\n const t = (value - from) / (to - from);\n return p2.interpolate(p1, t)!;\n};\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @param options - Extrapolation options\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n \"worklet\";\n const extrapolation = validateInterpolationOptions(options);\n if (value < input[0]) {\n switch (extrapolation.extrapolateLeft) {\n case Extrapolate.CLAMP:\n return outputRange[0];\n case Extrapolate.EXTEND:\n return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateLeft);\n }\n } else if (value > input[input.length - 1]) {\n switch (extrapolation.extrapolateRight) {\n case Extrapolate.CLAMP:\n return outputRange[outputRange.length - 1];\n case Extrapolate.EXTEND:\n return lerp(\n value,\n input[input.length - 2],\n input[input.length - 1],\n outputRange[input.length - 2],\n outputRange[input.length - 1]\n );\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateRight);\n }\n }\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n }\n return lerp(\n value,\n input[i],\n input[i + 1],\n outputRange[i],\n outputRange[i + 1]\n );\n};\n"],"mappings":";;;;;;;AACA;;AAGA;;AAEA,MAAMA,IAAI,GAAG,CACXC,KADW,EAEXC,IAFW,EAGXC,EAHW,EAIXC,EAJW,EAKXC,EALW,KAMR;EACH;;EACA,MAAMC,CAAC,GAAG,CAACL,KAAK,GAAGC,IAAT,KAAkBC,EAAE,GAAGD,IAAvB,CAAV;EACA,OAAOG,EAAE,CAACE,WAAH,CAAeH,EAAf,EAAmBE,CAAnB,CAAP;AACD,CAVD;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,gBAAgB,GAAG,CAC9BP,KAD8B,EAE9BQ,KAF8B,EAG9BC,WAH8B,EAI9BC,OAJ8B,KAK3B;EACH;;EACA,MAAMC,aAAa,GAAG,IAAAC,yCAAA,EAA6BF,OAA7B,CAAtB;;EACA,IAAIV,KAAK,GAAGQ,KAAK,CAAC,CAAD,CAAjB,EAAsB;IACpB,QAAQG,aAAa,CAACE,eAAtB;MACE,KAAKC,wBAAA,CAAYC,KAAjB;QACE,OAAON,WAAW,CAAC,CAAD,CAAlB;;MACF,KAAKK,wBAAA,CAAYE,MAAjB;QACE,OAAOjB,IAAI,CAACC,KAAD,EAAQQ,KAAK,CAAC,CAAD,CAAb,EAAkBA,KAAK,CAAC,CAAD,CAAvB,EAA4BC,WAAW,CAAC,CAAD,CAAvC,EAA4CA,WAAW,CAAC,CAAD,CAAvD,CAAX;;MACF,KAAKK,wBAAA,CAAYG,QAAjB;QACE,MAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;MAGF;QACE,IAAAC,0BAAA,EAAgBR,aAAa,CAACE,eAA9B;IAVJ;EAYD,CAbD,MAaO,IAAIb,KAAK,GAAGQ,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAAjB,EAAqC;IAC1C,QAAQT,aAAa,CAACU,gBAAtB;MACE,KAAKP,wBAAA,CAAYC,KAAjB;QACE,OAAON,WAAW,CAACA,WAAW,CAACW,MAAZ,GAAqB,CAAtB,CAAlB;;MACF,KAAKN,wBAAA,CAAYE,MAAjB;QACE,OAAOjB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAFI,EAGTZ,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAHI,EAITX,WAAW,CAACD,KAAK,CAACY,MAAN,GAAe,CAAhB,CAJF,EAKTX,WAAW,CAACD,KAAK,CAACY,MAAN,GAAe,CAAhB,CALF,CAAX;;MAOF,KAAKN,wBAAA,CAAYG,QAAjB;QACE,MAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;MAGF;QACE,IAAAC,0BAAA,EAAgBR,aAAa,CAACU,gBAA9B;IAhBJ;EAkBD;;EACD,IAAIC,CAAC,GAAG,CAAR;;EACA,OAAOA,CAAC,IAAId,KAAK,CAACY,MAAN,GAAe,CAA3B,EAA8BE,CAAC,EAA/B,EAAmC;IACjC,IAAItB,KAAK,IAAIQ,KAAK,CAACc,CAAD,CAAd,IAAqBtB,KAAK,IAAIQ,KAAK,CAACc,CAAC,GAAG,CAAL,CAAvC,EAAgD;MAC9C;IACD;EACF;;EACD,OAAOvB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACc,CAAD,CAFI,EAGTd,KAAK,CAACc,CAAC,GAAG,CAAL,CAHI,EAITb,WAAW,CAACa,CAAD,CAJF,EAKTb,WAAW,CAACa,CAAC,GAAG,CAAL,CALF,CAAX;AAOD,CAtDM"}
1
+ {"version":3,"names":["lerp","value","from","to","p1","p2","output","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","validateInterpolationOptions","extrapolateLeft","Extrapolate","CLAMP","EXTEND","IDENTITY","Error","exhaustiveCheck","length","extrapolateRight","i"],"sources":["interpolatePaths.ts"],"sourcesContent":["import type { SkPath } from \"../../skia/types\";\nimport { exhaustiveCheck } from \"../../renderer/typeddash\";\n\nimport type { ExtrapolationType } from \"./interpolate\";\nimport { validateInterpolationOptions, Extrapolate } from \"./interpolate\";\n\nconst lerp = (\n value: number,\n from: number,\n to: number,\n p1: SkPath,\n p2: SkPath,\n output?: SkPath\n) => {\n \"worklet\";\n const t = (value - from) / (to - from);\n return p2.interpolate(p1, t, output)!;\n};\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @param options - Extrapolation options\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType,\n output?: SkPath\n) => {\n \"worklet\";\n const extrapolation = validateInterpolationOptions(options);\n if (value < input[0]) {\n switch (extrapolation.extrapolateLeft) {\n case Extrapolate.CLAMP:\n return outputRange[0];\n case Extrapolate.EXTEND:\n return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateLeft);\n }\n } else if (value > input[input.length - 1]) {\n switch (extrapolation.extrapolateRight) {\n case Extrapolate.CLAMP:\n return outputRange[outputRange.length - 1];\n case Extrapolate.EXTEND:\n return lerp(\n value,\n input[input.length - 2],\n input[input.length - 1],\n outputRange[input.length - 2],\n outputRange[input.length - 1]\n );\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateRight);\n }\n }\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n }\n return lerp(\n value,\n input[i],\n input[i + 1],\n outputRange[i],\n outputRange[i + 1],\n output\n );\n};\n"],"mappings":";;;;;;;AACA;;AAGA;;AAEA,MAAMA,IAAI,GAAG,CACXC,KADW,EAEXC,IAFW,EAGXC,EAHW,EAIXC,EAJW,EAKXC,EALW,EAMXC,MANW,KAOR;EACH;;EACA,MAAMC,CAAC,GAAG,CAACN,KAAK,GAAGC,IAAT,KAAkBC,EAAE,GAAGD,IAAvB,CAAV;EACA,OAAOG,EAAE,CAACG,WAAH,CAAeJ,EAAf,EAAmBG,CAAnB,EAAsBD,MAAtB,CAAP;AACD,CAXD;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMG,gBAAgB,GAAG,CAC9BR,KAD8B,EAE9BS,KAF8B,EAG9BC,WAH8B,EAI9BC,OAJ8B,EAK9BN,MAL8B,KAM3B;EACH;;EACA,MAAMO,aAAa,GAAG,IAAAC,yCAAA,EAA6BF,OAA7B,CAAtB;;EACA,IAAIX,KAAK,GAAGS,KAAK,CAAC,CAAD,CAAjB,EAAsB;IACpB,QAAQG,aAAa,CAACE,eAAtB;MACE,KAAKC,wBAAA,CAAYC,KAAjB;QACE,OAAON,WAAW,CAAC,CAAD,CAAlB;;MACF,KAAKK,wBAAA,CAAYE,MAAjB;QACE,OAAOlB,IAAI,CAACC,KAAD,EAAQS,KAAK,CAAC,CAAD,CAAb,EAAkBA,KAAK,CAAC,CAAD,CAAvB,EAA4BC,WAAW,CAAC,CAAD,CAAvC,EAA4CA,WAAW,CAAC,CAAD,CAAvD,CAAX;;MACF,KAAKK,wBAAA,CAAYG,QAAjB;QACE,MAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;MAGF;QACE,IAAAC,0BAAA,EAAgBR,aAAa,CAACE,eAA9B;IAVJ;EAYD,CAbD,MAaO,IAAId,KAAK,GAAGS,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAAjB,EAAqC;IAC1C,QAAQT,aAAa,CAACU,gBAAtB;MACE,KAAKP,wBAAA,CAAYC,KAAjB;QACE,OAAON,WAAW,CAACA,WAAW,CAACW,MAAZ,GAAqB,CAAtB,CAAlB;;MACF,KAAKN,wBAAA,CAAYE,MAAjB;QACE,OAAOlB,IAAI,CACTC,KADS,EAETS,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAFI,EAGTZ,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAHI,EAITX,WAAW,CAACD,KAAK,CAACY,MAAN,GAAe,CAAhB,CAJF,EAKTX,WAAW,CAACD,KAAK,CAACY,MAAN,GAAe,CAAhB,CALF,CAAX;;MAOF,KAAKN,wBAAA,CAAYG,QAAjB;QACE,MAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;MAGF;QACE,IAAAC,0BAAA,EAAgBR,aAAa,CAACU,gBAA9B;IAhBJ;EAkBD;;EACD,IAAIC,CAAC,GAAG,CAAR;;EACA,OAAOA,CAAC,IAAId,KAAK,CAACY,MAAN,GAAe,CAA3B,EAA8BE,CAAC,EAA/B,EAAmC;IACjC,IAAIvB,KAAK,IAAIS,KAAK,CAACc,CAAD,CAAd,IAAqBvB,KAAK,IAAIS,KAAK,CAACc,CAAC,GAAG,CAAL,CAAvC,EAAgD;MAC9C;IACD;EACF;;EACD,OAAOxB,IAAI,CACTC,KADS,EAETS,KAAK,CAACc,CAAD,CAFI,EAGTd,KAAK,CAACc,CAAC,GAAG,CAAL,CAHI,EAITb,WAAW,CAACa,CAAD,CAJF,EAKTb,WAAW,CAACa,CAAC,GAAG,CAAL,CALF,EAMTlB,MANS,CAAX;AAQD,CAxDM"}
@@ -8,7 +8,11 @@ exports.processRect = exports.processRRect = exports.isEdge = void 0;
8
8
  var _Radius = require("./Radius");
9
9
 
10
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
11
- const isEdge = (pos, b) => pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height; // We have an issue to check property existence on JSI backed instances
11
+ const isEdge = (pos, b) => {
12
+ "worklet";
13
+
14
+ return pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height;
15
+ }; // We have an issue to check property existence on JSI backed instances
12
16
 
13
17
 
14
18
  exports.isEdge = isEdge;
@@ -1 +1 @@
1
- {"version":3,"names":["isEdge","pos","b","x","y","width","height","isRRectCtor","def","rect","undefined","isRectCtor","processRect","Skia","XYWHRect","processRRect","r","processRadius","RRectXY"],"sources":["Rect.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Skia, SkRect, Vector } from \"../../../skia/types\";\nimport type { RectCtor, RectDef, RRectCtor, RRectDef } from \"../../types\";\n\nimport { processRadius } from \"./Radius\";\n\nexport const isEdge = (pos: Vector, b: SkRect) =>\n pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height;\n\n// We have an issue to check property existence on JSI backed instances\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\n\nexport const processRect = (Skia: Skia, def: RectDef) => {\n if (isRectCtor(def)) {\n return Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (Skia: Skia, def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(Skia, def.r ?? 0);\n return Skia.RRectXY(\n Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height),\n r.x,\n r.y\n );\n } else {\n return def.rect;\n }\n};\n"],"mappings":";;;;;;;AAIA;;AAJA;AAMO,MAAMA,MAAM,GAAG,CAACC,GAAD,EAAcC,CAAd,KACpBD,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACC,CAAZ,IAAiBF,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACE,CAA7B,IAAkCH,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACG,KAA9C,IAAuDJ,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACI,MAD9D,C,CAGP;;;;;AACA,MAAMC,WAAW,GAAIC,GAAD,IACjBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB,C,CAEA;;;AACA,MAAMC,UAAU,GAAIH,GAAD,IAChBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB;;AAGO,MAAME,WAAW,GAAG,CAACC,IAAD,EAAaL,GAAb,KAA8B;EACvD,IAAIG,UAAU,CAACH,GAAD,CAAd,EAAqB;IACnB,OAAOK,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CAAP;EACD,CAFD,MAEO;IACL,OAAOE,GAAG,CAACC,IAAX;EACD;AACF,CANM;;;;AAQA,MAAMM,YAAY,GAAG,CAACF,IAAD,EAAaL,GAAb,KAA+B;EACzD,IAAID,WAAW,CAACC,GAAD,CAAf,EAAsB;IACpB,MAAMQ,CAAC,GAAG,IAAAC,qBAAA,EAAcJ,IAAd,EAAoBL,GAAG,CAACQ,CAAJ,IAAS,CAA7B,CAAV;IACA,OAAOH,IAAI,CAACK,OAAL,CACLL,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CADK,EAELU,CAAC,CAACb,CAFG,EAGLa,CAAC,CAACZ,CAHG,CAAP;EAKD,CAPD,MAOO;IACL,OAAOI,GAAG,CAACC,IAAX;EACD;AACF,CAXM"}
1
+ {"version":3,"names":["isEdge","pos","b","x","y","width","height","isRRectCtor","def","rect","undefined","isRectCtor","processRect","Skia","XYWHRect","processRRect","r","processRadius","RRectXY"],"sources":["Rect.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Skia, SkRect, Vector } from \"../../../skia/types\";\nimport type { RectCtor, RectDef, RRectCtor, RRectDef } from \"../../types\";\n\nimport { processRadius } from \"./Radius\";\n\nexport const isEdge = (pos: Vector, b: SkRect) => {\n \"worklet\";\n return (\n pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height\n );\n};\n\n// We have an issue to check property existence on JSI backed instances\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\n\nexport const processRect = (Skia: Skia, def: RectDef) => {\n if (isRectCtor(def)) {\n return Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (Skia: Skia, def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(Skia, def.r ?? 0);\n return Skia.RRectXY(\n Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height),\n r.x,\n r.y\n );\n } else {\n return def.rect;\n }\n};\n"],"mappings":";;;;;;;AAIA;;AAJA;AAMO,MAAMA,MAAM,GAAG,CAACC,GAAD,EAAcC,CAAd,KAA4B;EAChD;;EACA,OACED,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACC,CAAZ,IAAiBF,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACE,CAA7B,IAAkCH,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACG,KAA9C,IAAuDJ,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACI,MADrE;AAGD,CALM,C,CAOP;;;;;AACA,MAAMC,WAAW,GAAIC,GAAD,IACjBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB,C,CAEA;;;AACA,MAAMC,UAAU,GAAIH,GAAD,IAChBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB;;AAGO,MAAME,WAAW,GAAG,CAACC,IAAD,EAAaL,GAAb,KAA8B;EACvD,IAAIG,UAAU,CAACH,GAAD,CAAd,EAAqB;IACnB,OAAOK,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CAAP;EACD,CAFD,MAEO;IACL,OAAOE,GAAG,CAACC,IAAX;EACD;AACF,CANM;;;;AAQA,MAAMM,YAAY,GAAG,CAACF,IAAD,EAAaL,GAAb,KAA+B;EACzD,IAAID,WAAW,CAACC,GAAD,CAAf,EAAsB;IACpB,MAAMQ,CAAC,GAAG,IAAAC,qBAAA,EAAcJ,IAAd,EAAoBL,GAAG,CAACQ,CAAJ,IAAS,CAA7B,CAAV;IACA,OAAOH,IAAI,CAACK,OAAL,CACLL,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CADK,EAELU,CAAC,CAACb,CAFG,EAGLa,CAAC,CAACZ,CAHG,CAAP;EAKD,CAPD,MAOO;IACL,OAAOI,GAAG,CAACC,IAAX;EACD;AACF,CAXM"}
@@ -1,2 +1,4 @@
1
- export * from "./useSharedValueEffect";
1
+ export * from "./useAnimatedImageValue";
2
+ export * from "./useDerivedValueOnJS";
2
3
  export * from "./renderHelpers";
4
+ export * from "./interpolators";
@@ -4,15 +4,28 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var _useSharedValueEffect = require("./useSharedValueEffect");
7
+ var _useAnimatedImageValue = require("./useAnimatedImageValue");
8
8
 
9
- Object.keys(_useSharedValueEffect).forEach(function (key) {
9
+ Object.keys(_useAnimatedImageValue).forEach(function (key) {
10
10
  if (key === "default" || key === "__esModule") return;
11
- if (key in exports && exports[key] === _useSharedValueEffect[key]) return;
11
+ if (key in exports && exports[key] === _useAnimatedImageValue[key]) return;
12
12
  Object.defineProperty(exports, key, {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _useSharedValueEffect[key];
15
+ return _useAnimatedImageValue[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _useDerivedValueOnJS = require("./useDerivedValueOnJS");
21
+
22
+ Object.keys(_useDerivedValueOnJS).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _useDerivedValueOnJS[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _useDerivedValueOnJS[key];
16
29
  }
17
30
  });
18
31
  });
@@ -29,4 +42,17 @@ Object.keys(_renderHelpers).forEach(function (key) {
29
42
  }
30
43
  });
31
44
  });
45
+
46
+ var _interpolators = require("./interpolators");
47
+
48
+ Object.keys(_interpolators).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _interpolators[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _interpolators[key];
55
+ }
56
+ });
57
+ });
32
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useSharedValueEffect\";\nexport * from \"./renderHelpers\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useAnimatedImageValue\";\nexport * from \"./useDerivedValueOnJS\";\nexport * from \"./renderHelpers\";\nexport * from \"./interpolators\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,9 @@
1
+ import type { ExtrapolationType, SharedValue } from "react-native-reanimated";
2
+ import type { SkPath, SkPoint } from "../../skia/types";
3
+ export declare const notifyChange: (value: SharedValue<unknown>) => void;
4
+ export declare const useClock: () => SharedValue<number>;
5
+ export declare const usePathInterpolation: (value: SharedValue<number>, input: number[], outputRange: SkPath[], options?: ExtrapolationType) => SharedValue<SkPath>;
6
+ export declare const useVectorInterpolation: (value: SharedValue<number>, input: number[], outputRange: SkPoint[], options?: ExtrapolationType) => SharedValue<{
7
+ x: number;
8
+ y: number;
9
+ }>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVectorInterpolation = exports.usePathInterpolation = exports.useClock = exports.notifyChange = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _animation = require("../../animation");
11
+
12
+ var _skia = require("../../skia");
13
+
14
+ var _moduleWrapper = require("./moduleWrapper");
15
+
16
+ const notifyChange = value => {
17
+ "worklet"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+
19
+ value._value = value.value;
20
+ };
21
+
22
+ exports.notifyChange = notifyChange;
23
+
24
+ const useClock = () => {
25
+ const clock = (0, _moduleWrapper.useSharedValue)(0);
26
+ (0, _moduleWrapper.useFrameCallback)(info => {
27
+ clock.value = info.timeSinceFirstFrame;
28
+ });
29
+ return clock;
30
+ };
31
+ /**
32
+ * @worklet
33
+ */
34
+
35
+
36
+ exports.useClock = useClock;
37
+
38
+ const useInterpolator = (factory, value, interpolator, input, output, options) => {
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ const init = (0, _react.useMemo)(() => factory(), []);
41
+ const result = (0, _moduleWrapper.useSharedValue)(init);
42
+ (0, _moduleWrapper.useAnimatedReaction)(() => value.value, val => {
43
+ result.value = interpolator(val, input, output, options, result.value);
44
+ notifyChange(result);
45
+ }, [input, output, options]);
46
+ return result;
47
+ };
48
+
49
+ const usePathInterpolation = (value, input, outputRange, options) => useInterpolator(() => _skia.Skia.Path.Make(), value, _animation.interpolatePaths, input, outputRange, options);
50
+
51
+ exports.usePathInterpolation = usePathInterpolation;
52
+
53
+ const useVectorInterpolation = (value, input, outputRange, options) => useInterpolator(() => _skia.Skia.Point(0, 0), value, _animation.interpolateVector, input, outputRange, options);
54
+
55
+ exports.useVectorInterpolation = useVectorInterpolation;
56
+ //# sourceMappingURL=interpolators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["notifyChange","value","_value","useClock","clock","useSharedValue","useFrameCallback","info","timeSinceFirstFrame","useInterpolator","factory","interpolator","input","output","options","init","useMemo","result","useAnimatedReaction","val","usePathInterpolation","outputRange","Skia","Path","Make","interpolatePaths","useVectorInterpolation","Point","interpolateVector"],"sources":["interpolators.ts"],"sourcesContent":["import type { ExtrapolationType, SharedValue } from \"react-native-reanimated\";\nimport { useMemo } from \"react\";\n\nimport type { SkPath, SkPoint } from \"../../skia/types\";\nimport { interpolatePaths, interpolateVector } from \"../../animation\";\nimport { Skia } from \"../../skia\";\n\nimport {\n useAnimatedReaction,\n useFrameCallback,\n useSharedValue,\n} from \"./moduleWrapper\";\n\nexport const notifyChange = (value: SharedValue<unknown>) => {\n \"worklet\";\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (value as any)._value = value.value;\n};\n\nexport const useClock = () => {\n const clock = useSharedValue(0);\n useFrameCallback((info) => {\n clock.value = info.timeSinceFirstFrame;\n });\n return clock;\n};\n\n/**\n * @worklet\n */\ntype Interpolator<T> = (\n value: number,\n input: number[],\n output: T[],\n options: ExtrapolationType,\n result: T\n) => T;\n\nconst useInterpolator = <T>(\n factory: () => T,\n value: SharedValue<number>,\n interpolator: Interpolator<T>,\n input: number[],\n output: T[],\n options?: ExtrapolationType\n) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const init = useMemo(() => factory(), []);\n const result = useSharedValue(init);\n useAnimatedReaction(\n () => value.value,\n (val) => {\n result.value = interpolator(val, input, output, options, result.value);\n notifyChange(result);\n },\n [input, output, options]\n );\n return result;\n};\n\nexport const usePathInterpolation = (\n value: SharedValue<number>,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) =>\n useInterpolator(\n () => Skia.Path.Make(),\n value,\n interpolatePaths,\n input,\n outputRange,\n options\n );\n\nexport const useVectorInterpolation = (\n value: SharedValue<number>,\n input: number[],\n outputRange: SkPoint[],\n options?: ExtrapolationType\n) =>\n useInterpolator(\n () => Skia.Point(0, 0),\n value,\n interpolateVector,\n input,\n outputRange,\n options\n );\n"],"mappings":";;;;;;;AACA;;AAGA;;AACA;;AAEA;;AAMO,MAAMA,YAAY,GAAIC,KAAD,IAAiC;EAC3D,UAD2D,CAE3D;;EACCA,KAAD,CAAeC,MAAf,GAAwBD,KAAK,CAACA,KAA9B;AACD,CAJM;;;;AAMA,MAAME,QAAQ,GAAG,MAAM;EAC5B,MAAMC,KAAK,GAAG,IAAAC,6BAAA,EAAe,CAAf,CAAd;EACA,IAAAC,+BAAA,EAAkBC,IAAD,IAAU;IACzBH,KAAK,CAACH,KAAN,GAAcM,IAAI,CAACC,mBAAnB;EACD,CAFD;EAGA,OAAOJ,KAAP;AACD,CANM;AAQP;AACA;AACA;;;;;AASA,MAAMK,eAAe,GAAG,CACtBC,OADsB,EAEtBT,KAFsB,EAGtBU,YAHsB,EAItBC,KAJsB,EAKtBC,MALsB,EAMtBC,OANsB,KAOnB;EACH;EACA,MAAMC,IAAI,GAAG,IAAAC,cAAA,EAAQ,MAAMN,OAAO,EAArB,EAAyB,EAAzB,CAAb;EACA,MAAMO,MAAM,GAAG,IAAAZ,6BAAA,EAAeU,IAAf,CAAf;EACA,IAAAG,kCAAA,EACE,MAAMjB,KAAK,CAACA,KADd,EAEGkB,GAAD,IAAS;IACPF,MAAM,CAAChB,KAAP,GAAeU,YAAY,CAACQ,GAAD,EAAMP,KAAN,EAAaC,MAAb,EAAqBC,OAArB,EAA8BG,MAAM,CAAChB,KAArC,CAA3B;IACAD,YAAY,CAACiB,MAAD,CAAZ;EACD,CALH,EAME,CAACL,KAAD,EAAQC,MAAR,EAAgBC,OAAhB,CANF;EAQA,OAAOG,MAAP;AACD,CApBD;;AAsBO,MAAMG,oBAAoB,GAAG,CAClCnB,KADkC,EAElCW,KAFkC,EAGlCS,WAHkC,EAIlCP,OAJkC,KAMlCL,eAAe,CACb,MAAMa,UAAA,CAAKC,IAAL,CAAUC,IAAV,EADO,EAEbvB,KAFa,EAGbwB,2BAHa,EAIbb,KAJa,EAKbS,WALa,EAMbP,OANa,CANV;;;;AAeA,MAAMY,sBAAsB,GAAG,CACpCzB,KADoC,EAEpCW,KAFoC,EAGpCS,WAHoC,EAIpCP,OAJoC,KAMpCL,eAAe,CACb,MAAMa,UAAA,CAAKK,KAAL,CAAW,CAAX,EAAc,CAAd,CADO,EAEb1B,KAFa,EAGb2B,4BAHa,EAIbhB,KAJa,EAKbS,WALa,EAMbP,OANa,CANV"}
@@ -1,10 +1,12 @@
1
- import type { SharedValueType } from "../../renderer/processors/Animations";
1
+ import type { DependencyList } from "react";
2
+ import type { FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
2
3
  export declare const HAS_REANIMATED2: boolean;
3
4
  export declare const HAS_REANIMATED3: boolean;
4
5
  export declare function throwOnMissingReanimated(): void;
5
- export declare const useSharedValue: any;
6
- export declare const useFrameCallback: (...args: any[]) => any;
7
- export declare const startMapper: any;
8
- export declare const stopMapper: any;
6
+ export declare const useSharedValue: <T>(init: T, oneWayReadsOnly?: boolean) => SharedValue<T>;
7
+ export declare const useFrameCallback: (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) => FrameCallback;
8
+ export declare const startMapper: (worklet: () => void, inputs?: unknown[], outputs?: unknown[]) => number;
9
+ export declare const stopMapper: (mapperID: number) => void;
9
10
  export declare const runOnJS: any;
10
- export declare const isSharedValue: <T>(value: unknown) => value is SharedValueType<T>;
11
+ export declare const useAnimatedReaction: <T>(prepare: () => T, react: (v: T) => void, dependencies?: DependencyList) => void;
12
+ export declare const isSharedValue: <T>(value: unknown) => value is SharedValue<T>;
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.stopMapper = exports.startMapper = exports.runOnJS = exports.isSharedValue = exports.HAS_REANIMATED3 = exports.HAS_REANIMATED2 = void 0;
7
7
  exports.throwOnMissingReanimated = throwOnMissingReanimated;
8
- exports.useSharedValue = exports.useFrameCallback = void 0;
8
+ exports.useSharedValue = exports.useFrameCallback = exports.useAnimatedReaction = void 0;
9
9
 
10
- var _react = require("react");
11
-
12
- var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5;
10
+ var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5, _Reanimated6;
13
11
 
12
+ /* eslint-disable @typescript-eslint/no-explicit-any */
14
13
  // This one is needed for the deprecated useSharedValue function
15
14
  // We can remove it once we remove the deprecation
16
15
  let Reanimated2;
@@ -19,8 +18,7 @@ let reanimatedVersion;
19
18
 
20
19
  try {
21
20
  Reanimated2 = require("react-native-reanimated");
22
- reanimatedVersion = // eslint-disable-next-line import/extensions
23
- require("react-native-reanimated/package.json").version;
21
+ reanimatedVersion = require("react-native-reanimated/package.json").version;
24
22
 
25
23
  if (reanimatedVersion && (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))) {
26
24
  Reanimated3 = Reanimated2;
@@ -39,16 +37,7 @@ function throwOnMissingReanimated() {
39
37
  }
40
38
  }
41
39
 
42
- function throwOnMissingReanimated3() {
43
- if (!HAS_REANIMATED3) {
44
- throw new Error(`Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`);
45
- }
46
- }
47
-
48
- const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || (value => (0, _react.useMemo)(() => ({
49
- value
50
- }), [value]));
51
-
40
+ const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || throwOnMissingReanimated;
52
41
  exports.useSharedValue = useSharedValue;
53
42
  const useFrameCallback = ((_Reanimated2 = Reanimated2) === null || _Reanimated2 === void 0 ? void 0 : _Reanimated2.useFrameCallback) || throwOnMissingReanimated;
54
43
  exports.useFrameCallback = useFrameCallback;
@@ -58,10 +47,11 @@ const stopMapper = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === vo
58
47
  exports.stopMapper = stopMapper;
59
48
  const runOnJS = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void 0 ? void 0 : _Reanimated5.runOnJS) || throwOnMissingReanimated;
60
49
  exports.runOnJS = runOnJS;
50
+ const useAnimatedReaction = ((_Reanimated6 = Reanimated2) === null || _Reanimated6 === void 0 ? void 0 : _Reanimated6.useAnimatedReaction) || throwOnMissingReanimated;
51
+ exports.useAnimatedReaction = useAnimatedReaction;
61
52
 
62
53
  const isSharedValue = value => {
63
- throwOnMissingReanimated3();
64
- return !!value && Reanimated3.isSharedValue(value);
54
+ return !!value && (Reanimated3 ? Reanimated3.isSharedValue(value) : value.value !== undefined);
65
55
  };
66
56
 
67
57
  exports.isSharedValue = isSharedValue;
@@ -1 +1 @@
1
- {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","throwOnMissingReanimated3","useSharedValue","value","useMemo","useFrameCallback","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\nexport const useFrameCallback: (...args: any[]) => any =\n Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper = Reanimated2?.startMapper || throwOnMissingReanimated;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;;;;;;;;AACA;;;;AAIA;AACA;AAEA,IAAIA,WAAJ;AAEA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEA,SAASQ,wBAAT,GAAoC;EACzC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;AACF;;AAEM,MAAMU,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmB,IAAAC,cAAA,EAAQ,OAAO;EAAED;AAAF,CAAP,CAAR,EAA2B,CAACA,KAAD,CAA3B,CADpB,CADK;;;AAGA,MAAME,gBAAyC,GACpD,iBAAAf,WAAW,UAAX,oDAAae,gBAAb,KAAiCN,wBAD5B;;AAGA,MAAMO,WAAW,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,WAAb,KAA4BP,wBAAhD;;AACA,MAAMQ,UAAU,GAAG,iBAAAjB,WAAW,UAAX,oDAAaiB,UAAb,KAA2BR,wBAA9C;;AACA,MAAMS,OAAO,GAAG,iBAAAlB,WAAW,UAAX,oDAAakB,OAAb,KAAwBT,wBAAxC;;;AACA,MAAMU,aAAa,GACxBN,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACkB,aAAZ,CAA0BN,KAA1B,CAAlB;AACD,CALM"}
1
+ {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","useSharedValue","useFrameCallback","startMapper","stopMapper","runOnJS","useAnimatedReaction","isSharedValue","value","undefined"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DependencyList } from \"react\";\nimport type {\n FrameCallback,\n FrameInfo,\n SharedValue,\n} from \"react-native-reanimated\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion = require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nexport const useSharedValue: <T>(\n init: T,\n oneWayReadsOnly?: boolean\n) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;\n\nexport const useFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n autostart?: boolean\n) => FrameCallback = Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper: (\n worklet: () => void,\n inputs?: unknown[],\n outputs?: unknown[]\n) => number = Reanimated2?.startMapper || throwOnMissingReanimated;\n\nexport const stopMapper: (mapperID: number) => void =\n Reanimated2?.stopMapper || throwOnMissingReanimated;\n\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\n\nexport const useAnimatedReaction: <T>(\n prepare: () => T,\n react: (v: T) => void,\n dependencies?: DependencyList\n) => void = Reanimated2?.useAnimatedReaction || throwOnMissingReanimated;\n\nexport const isSharedValue = <T>(value: unknown): value is SharedValue<T> => {\n return (\n !!value &&\n (Reanimated3\n ? Reanimated3.isSharedValue(value)\n : (value as any).value !== undefined)\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA;AAQA;AACA;AAEA,IAAIA,WAAJ;AAEA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GAAGC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAApE;;EACA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CATD,CASE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEA,SAASQ,wBAAT,GAAoC;EACzC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAEM,MAAMC,cAGM,GAAG,gBAAAX,WAAW,UAAX,kDAAaW,cAAb,KAA+BF,wBAH9C;;AAKA,MAAMG,gBAGK,GAAG,iBAAAZ,WAAW,UAAX,oDAAaY,gBAAb,KAAiCH,wBAH/C;;AAKA,MAAMI,WAIF,GAAG,iBAAAb,WAAW,UAAX,oDAAaa,WAAb,KAA4BJ,wBAJnC;;AAMA,MAAMK,UAAsC,GACjD,iBAAAd,WAAW,UAAX,oDAAac,UAAb,KAA2BL,wBADtB;;AAGA,MAAMM,OAAO,GAAG,iBAAAf,WAAW,UAAX,oDAAae,OAAb,KAAwBN,wBAAxC;;AAEA,MAAMO,mBAIJ,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,mBAAb,KAAoCP,wBAJzC;;;AAMA,MAAMQ,aAAa,GAAOC,KAAJ,IAAgD;EAC3E,OACE,CAAC,CAACA,KAAF,KACCjB,WAAW,GACRA,WAAW,CAACgB,aAAZ,CAA0BC,KAA1B,CADQ,GAEPA,KAAD,CAAeA,KAAf,KAAyBC,SAH7B,CADF;AAMD,CAPM"}
@@ -14,7 +14,7 @@ var _moduleWrapper = require("./moduleWrapper");
14
14
  const _bindings = new WeakMap();
15
15
 
16
16
  function extractReanimatedProps(props) {
17
- if (!_moduleWrapper.HAS_REANIMATED3) {
17
+ if (!_moduleWrapper.HAS_REANIMATED3 && !_moduleWrapper.HAS_REANIMATED2) {
18
18
  return [props, {}];
19
19
  }
20
20
 
@@ -39,7 +39,52 @@ function extractReanimatedProps(props) {
39
39
  return [otherProps, reanimatedProps];
40
40
  }
41
41
 
42
+ function bindReanimatedProps2(container, node, reanimatedProps) {
43
+ const sharedValues = Object.values(reanimatedProps);
44
+
45
+ const previousMapperId = _bindings.get(node);
46
+
47
+ if (previousMapperId !== undefined) {
48
+ (0, _moduleWrapper.stopMapper)(previousMapperId);
49
+ }
50
+
51
+ if (sharedValues.length > 0) {
52
+ const viewId = container.getNativeId();
53
+ const {
54
+ SkiaViewApi
55
+ } = global;
56
+
57
+ const updateProps = () => {
58
+ for (const propName in reanimatedProps) {
59
+ node && node.setProp(propName, reanimatedProps[propName].value);
60
+ } // On React Native we use the SkiaViewApi to redraw because it can
61
+ // run on the worklet thread (container.redraw can't)
62
+ // if SkiaViewApi is undefined, we are on web and container.redraw()
63
+ // can safely be invoked
64
+
65
+
66
+ if (SkiaViewApi) {
67
+ SkiaViewApi.requestRedraw(viewId);
68
+ } else {
69
+ container.redraw();
70
+ }
71
+ };
72
+
73
+ const mapperId = (0, _moduleWrapper.startMapper)(() => {
74
+ "worklet";
75
+
76
+ (0, _moduleWrapper.runOnJS)(updateProps)();
77
+ }, sharedValues);
78
+
79
+ _bindings.set(node, mapperId);
80
+ }
81
+ }
82
+
42
83
  function bindReanimatedProps(container, node, reanimatedProps) {
84
+ if (_moduleWrapper.HAS_REANIMATED2) {
85
+ return bindReanimatedProps2(container, node, reanimatedProps);
86
+ }
87
+
43
88
  if (!_moduleWrapper.HAS_REANIMATED3) {
44
89
  return;
45
90
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_bindings","WeakMap","extractReanimatedProps","props","HAS_REANIMATED3","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps","container","node","sharedValues","Object","values","previousMapperId","get","undefined","stopMapper","length","viewId","getNativeId","SkiaViewApi","global","mapperId","startMapper","setProp","requestRedraw","redraw","set"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable reanimated/js-function-in-worklet */\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport {\n startMapper,\n stopMapper,\n isSharedValue,\n HAS_REANIMATED3,\n} from \"./moduleWrapper\";\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED3) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (!HAS_REANIMATED3) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = startMapper(() => {\n \"worklet\";\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":";;;;;;;;AAMA;;AANA;;AACA;AAYA,MAAMA,SAAS,GAAG,IAAIC,OAAJ,EAAlB;;AAEO,SAASC,sBAAT,CAAgCC,KAAhC,EAA2D;EAChE,IAAI,CAACC,8BAAL,EAAsB;IACpB,OAAO,CAACD,KAAD,EAAQ,EAAR,CAAP;EACD;;EACD,MAAME,eAAe,GAAG,EAAxB;EACA,MAAMC,UAAU,GAAG,EAAnB;;EACA,KAAK,MAAMC,QAAX,IAAuBJ,KAAvB,EAA8B;IAC5B,IAAII,QAAQ,KAAK,UAAjB,EAA6B;MAC3B;IACD;;IACD,MAAMC,SAAS,GAAGL,KAAK,CAACI,QAAD,CAAvB;;IACA,IAAI,IAAAE,4BAAA,EAAcD,SAAd,CAAJ,EAA8B;MAC5BH,eAAe,CAACE,QAAD,CAAf,GAA4BC,SAA5B;MACAF,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAS,CAACE,KAAjC;IACD,CAHD,MAGO;MACLJ,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAvB;IACD;EACF;;EACD,OAAO,CAACF,UAAD,EAAaD,eAAb,CAAP;AACD;;AAEM,SAASM,mBAAT,CACLC,SADK,EAELC,IAFK,EAGLR,eAHK,EAIL;EACA,IAAI,CAACD,8BAAL,EAAsB;IACpB;EACD;;EACD,MAAMU,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcX,eAAd,CAArB;;EACA,MAAMY,gBAAgB,GAAGjB,SAAS,CAACkB,GAAV,CAAcL,IAAd,CAAzB;;EACA,IAAII,gBAAgB,KAAKE,SAAzB,EAAoC;IAClC,IAAAC,yBAAA,EAAWH,gBAAX;EACD;;EACD,IAAIH,YAAY,CAACO,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGV,SAAS,CAACW,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;IACA,MAAMC,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,KAAK,MAAMpB,QAAX,IAAuBF,eAAvB,EAAwC;QACtCQ,IAAI,IAAIA,IAAI,CAACe,OAAL,CAAarB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BG,KAAjD,CAAR;MACD,CAJgC,CAKjC;MACA;MACA;MACA;;;MACA,IAAIc,WAAJ,EAAiB;QACfA,WAAW,CAACK,aAAZ,CAA0BP,MAA1B;MACD,CAFD,MAEO;QACLV,SAAS,CAACkB,MAAV;MACD;IACF,CAdgB,EAcdhB,YAdc,CAAjB;;IAeAd,SAAS,CAAC+B,GAAV,CAAclB,IAAd,EAAoBa,QAApB;EACD;AACF"}
1
+ {"version":3,"names":["_bindings","WeakMap","extractReanimatedProps","props","HAS_REANIMATED3","HAS_REANIMATED2","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps2","container","node","sharedValues","Object","values","previousMapperId","get","undefined","stopMapper","length","viewId","getNativeId","SkiaViewApi","global","updateProps","setProp","requestRedraw","redraw","mapperId","startMapper","runOnJS","set","bindReanimatedProps"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable reanimated/js-function-in-worklet */\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport {\n startMapper,\n stopMapper,\n isSharedValue,\n HAS_REANIMATED3,\n HAS_REANIMATED2,\n runOnJS,\n} from \"./moduleWrapper\";\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED3 && !HAS_REANIMATED2) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nfunction bindReanimatedProps2(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const updateProps = () => {\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n };\n const mapperId = startMapper(() => {\n \"worklet\";\n runOnJS(updateProps)();\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (HAS_REANIMATED2) {\n return bindReanimatedProps2(container, node, reanimatedProps);\n }\n if (!HAS_REANIMATED3) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = startMapper(() => {\n \"worklet\";\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":";;;;;;;;AAMA;;AANA;;AACA;AAcA,MAAMA,SAAS,GAAG,IAAIC,OAAJ,EAAlB;;AAEO,SAASC,sBAAT,CAAgCC,KAAhC,EAA2D;EAChE,IAAI,CAACC,8BAAD,IAAoB,CAACC,8BAAzB,EAA0C;IACxC,OAAO,CAACF,KAAD,EAAQ,EAAR,CAAP;EACD;;EACD,MAAMG,eAAe,GAAG,EAAxB;EACA,MAAMC,UAAU,GAAG,EAAnB;;EACA,KAAK,MAAMC,QAAX,IAAuBL,KAAvB,EAA8B;IAC5B,IAAIK,QAAQ,KAAK,UAAjB,EAA6B;MAC3B;IACD;;IACD,MAAMC,SAAS,GAAGN,KAAK,CAACK,QAAD,CAAvB;;IACA,IAAI,IAAAE,4BAAA,EAAcD,SAAd,CAAJ,EAA8B;MAC5BH,eAAe,CAACE,QAAD,CAAf,GAA4BC,SAA5B;MACAF,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAS,CAACE,KAAjC;IACD,CAHD,MAGO;MACLJ,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAvB;IACD;EACF;;EACD,OAAO,CAACF,UAAD,EAAaD,eAAb,CAAP;AACD;;AAED,SAASM,oBAAT,CACEC,SADF,EAEEC,IAFF,EAGER,eAHF,EAIE;EACA,MAAMS,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcX,eAAd,CAArB;;EACA,MAAMY,gBAAgB,GAAGlB,SAAS,CAACmB,GAAV,CAAcL,IAAd,CAAzB;;EACA,IAAII,gBAAgB,KAAKE,SAAzB,EAAoC;IAClC,IAAAC,yBAAA,EAAWH,gBAAX;EACD;;EACD,IAAIH,YAAY,CAACO,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGV,SAAS,CAACW,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;;IACA,MAAMC,WAAW,GAAG,MAAM;MACxB,KAAK,MAAMnB,QAAX,IAAuBF,eAAvB,EAAwC;QACtCQ,IAAI,IAAIA,IAAI,CAACc,OAAL,CAAapB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BG,KAAjD,CAAR;MACD,CAHuB,CAIxB;MACA;MACA;MACA;;;MACA,IAAIc,WAAJ,EAAiB;QACfA,WAAW,CAACI,aAAZ,CAA0BN,MAA1B;MACD,CAFD,MAEO;QACLV,SAAS,CAACiB,MAAV;MACD;IACF,CAbD;;IAcA,MAAMC,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,IAAAC,sBAAA,EAAQN,WAAR;IACD,CAHgB,EAGdZ,YAHc,CAAjB;;IAIAf,SAAS,CAACkC,GAAV,CAAcpB,IAAd,EAAoBiB,QAApB;EACD;AACF;;AAEM,SAASI,mBAAT,CACLtB,SADK,EAELC,IAFK,EAGLR,eAHK,EAIL;EACA,IAAID,8BAAJ,EAAqB;IACnB,OAAOO,oBAAoB,CAACC,SAAD,EAAYC,IAAZ,EAAkBR,eAAlB,CAA3B;EACD;;EACD,IAAI,CAACF,8BAAL,EAAsB;IACpB;EACD;;EACD,MAAMW,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcX,eAAd,CAArB;;EACA,MAAMY,gBAAgB,GAAGlB,SAAS,CAACmB,GAAV,CAAcL,IAAd,CAAzB;;EACA,IAAII,gBAAgB,KAAKE,SAAzB,EAAoC;IAClC,IAAAC,yBAAA,EAAWH,gBAAX;EACD;;EACD,IAAIH,YAAY,CAACO,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGV,SAAS,CAACW,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;IACA,MAAMK,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,KAAK,MAAMxB,QAAX,IAAuBF,eAAvB,EAAwC;QACtCQ,IAAI,IAAIA,IAAI,CAACc,OAAL,CAAapB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BG,KAAjD,CAAR;MACD,CAJgC,CAKjC;MACA;MACA;MACA;;;MACA,IAAIc,WAAJ,EAAiB;QACfA,WAAW,CAACI,aAAZ,CAA0BN,MAA1B;MACD,CAFD,MAEO;QACLV,SAAS,CAACiB,MAAV;MACD;IACF,CAdgB,EAcdf,YAdc,CAAjB;;IAeAf,SAAS,CAACkC,GAAV,CAAcpB,IAAd,EAAoBiB,QAApB;EACD;AACF"}
@@ -0,0 +1,2 @@
1
+ import type { DataSourceParam, SkImage } from "../../skia/types";
2
+ export declare const useAnimatedImageValue: (source: DataSourceParam) => import("react-native-reanimated").SharedValue<SkImage | null>;