@shopify/react-native-skia 2.2.18 → 2.2.20

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 (436) hide show
  1. package/android/CMakeLists.txt +2 -0
  2. package/cpp/api/JsiSkCanvas.h +22 -0
  3. package/cpp/api/JsiSkDispatcher.cpp +9 -0
  4. package/cpp/api/JsiSkDispatcher.h +149 -0
  5. package/cpp/api/JsiSkImage.h +27 -9
  6. package/cpp/api/JsiSkPicture.h +22 -1
  7. package/cpp/api/JsiSkSurface.h +15 -10
  8. package/cpp/api/recorder/Drawings.h +64 -51
  9. package/cpp/api/recorder/JsiRecorder.h +3 -1
  10. package/cpp/api/recorder/RNRecorder.h +10 -4
  11. package/cpp/jsi/JsiHostObject.cpp +16 -0
  12. package/jestSetup.js +1 -1
  13. package/lib/commonjs/Platform/Platform.js.map +1 -1
  14. package/lib/commonjs/Platform/Platform.web.js +0 -1
  15. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  16. package/lib/commonjs/animation/functions/interpolate.js +0 -1
  17. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  18. package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
  19. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  20. package/lib/commonjs/external/reanimated/textures.js +31 -28
  21. package/lib/commonjs/external/reanimated/textures.js.map +1 -1
  22. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  23. package/lib/commonjs/renderer/Canvas.js +1 -3
  24. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  25. package/lib/commonjs/renderer/Offscreen.js +1 -7
  26. package/lib/commonjs/renderer/Offscreen.js.map +1 -1
  27. package/lib/commonjs/renderer/__tests__/e2e/setup/Paragraph.d.ts +1 -0
  28. package/lib/commonjs/renderer/__tests__/e2e/setup/SVG.d.ts +1 -0
  29. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  30. package/lib/commonjs/skia/core/Image.js.map +1 -1
  31. package/lib/commonjs/skia/core/SVG.web.js +9 -2
  32. package/lib/commonjs/skia/core/SVG.web.js.map +1 -1
  33. package/lib/commonjs/skia/types/JsiInstance.d.ts +1 -1
  34. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  35. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  36. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  37. package/lib/commonjs/skia/types/Shader/Shader.js +1 -3
  38. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  39. package/lib/commonjs/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
  40. package/lib/commonjs/skia/web/Host.d.ts +2 -1
  41. package/lib/commonjs/skia/web/Host.js +8 -0
  42. package/lib/commonjs/skia/web/Host.js.map +1 -1
  43. package/lib/commonjs/skia/web/JsiSkAnimatedImage.d.ts +0 -1
  44. package/lib/commonjs/skia/web/JsiSkAnimatedImage.js +0 -6
  45. package/lib/commonjs/skia/web/JsiSkAnimatedImage.js.map +1 -1
  46. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +0 -1
  47. package/lib/commonjs/skia/web/JsiSkCanvas.js +0 -6
  48. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  49. package/lib/commonjs/skia/web/JsiSkColor.js +0 -1
  50. package/lib/commonjs/skia/web/JsiSkColor.js.map +1 -1
  51. package/lib/commonjs/skia/web/JsiSkColorFilter.d.ts +0 -1
  52. package/lib/commonjs/skia/web/JsiSkColorFilter.js +0 -6
  53. package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
  54. package/lib/commonjs/skia/web/JsiSkContourMeasure.d.ts +0 -1
  55. package/lib/commonjs/skia/web/JsiSkContourMeasure.js +0 -6
  56. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
  57. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
  58. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +0 -6
  59. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  60. package/lib/commonjs/skia/web/JsiSkData.d.ts +0 -1
  61. package/lib/commonjs/skia/web/JsiSkData.js +0 -6
  62. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  63. package/lib/commonjs/skia/web/JsiSkDataFactory.js.map +1 -1
  64. package/lib/commonjs/skia/web/JsiSkFont.d.ts +0 -1
  65. package/lib/commonjs/skia/web/JsiSkFont.js +0 -6
  66. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  67. package/lib/commonjs/skia/web/JsiSkFontMgr.js +1 -1
  68. package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
  69. package/lib/commonjs/skia/web/JsiSkImage.d.ts +0 -1
  70. package/lib/commonjs/skia/web/JsiSkImage.js +0 -6
  71. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  72. package/lib/commonjs/skia/web/JsiSkImageFilter.d.ts +0 -1
  73. package/lib/commonjs/skia/web/JsiSkImageFilter.js +0 -6
  74. package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
  75. package/lib/commonjs/skia/web/JsiSkMaskFilter.d.ts +0 -1
  76. package/lib/commonjs/skia/web/JsiSkMaskFilter.js +0 -6
  77. package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
  78. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +0 -1
  79. package/lib/commonjs/skia/web/JsiSkMatrix.js +0 -6
  80. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  81. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +0 -1
  82. package/lib/commonjs/skia/web/JsiSkPaint.js +0 -6
  83. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  84. package/lib/commonjs/skia/web/JsiSkParagraph.d.ts +0 -1
  85. package/lib/commonjs/skia/web/JsiSkParagraph.js +0 -3
  86. package/lib/commonjs/skia/web/JsiSkParagraph.js.map +1 -1
  87. package/lib/commonjs/skia/web/JsiSkParagraphBuilder.d.ts +0 -1
  88. package/lib/commonjs/skia/web/JsiSkParagraphBuilder.js +0 -3
  89. package/lib/commonjs/skia/web/JsiSkParagraphBuilder.js.map +1 -1
  90. package/lib/commonjs/skia/web/JsiSkPath.d.ts +0 -1
  91. package/lib/commonjs/skia/web/JsiSkPath.js +0 -6
  92. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  93. package/lib/commonjs/skia/web/JsiSkPathEffect.d.ts +0 -1
  94. package/lib/commonjs/skia/web/JsiSkPathEffect.js +0 -6
  95. package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
  96. package/lib/commonjs/skia/web/JsiSkPicture.d.ts +0 -1
  97. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -6
  98. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  99. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +0 -1
  100. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +0 -6
  101. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  102. package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -2
  103. package/lib/commonjs/skia/web/JsiSkPoint.js +0 -6
  104. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  105. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +2 -2
  106. package/lib/commonjs/skia/web/JsiSkRRect.js +3 -6
  107. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  108. package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -2
  109. package/lib/commonjs/skia/web/JsiSkRSXform.js +0 -6
  110. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  111. package/lib/commonjs/skia/web/JsiSkRect.d.ts +0 -1
  112. package/lib/commonjs/skia/web/JsiSkRect.js +0 -6
  113. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  114. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
  115. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +0 -6
  116. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  117. package/lib/commonjs/skia/web/JsiSkSVG.d.ts +1 -1
  118. package/lib/commonjs/skia/web/JsiSkSVG.js +5 -8
  119. package/lib/commonjs/skia/web/JsiSkSVG.js.map +1 -1
  120. package/lib/commonjs/skia/web/JsiSkShader.d.ts +0 -1
  121. package/lib/commonjs/skia/web/JsiSkShader.js +0 -6
  122. package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
  123. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -1
  124. package/lib/commonjs/skia/web/JsiSkSurface.js +3 -6
  125. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  126. package/lib/commonjs/skia/web/JsiSkTextBlob.d.ts +0 -1
  127. package/lib/commonjs/skia/web/JsiSkTextBlob.js +0 -6
  128. package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
  129. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +0 -1
  130. package/lib/commonjs/skia/web/JsiSkTypeface.js +0 -6
  131. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  132. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -2
  133. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +0 -12
  134. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  135. package/lib/commonjs/skia/web/JsiSkVertices.d.ts +0 -1
  136. package/lib/commonjs/skia/web/JsiSkVertices.js +0 -6
  137. package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
  138. package/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +0 -1
  139. package/lib/commonjs/skia/web/JsiSkottieAnimation.js +0 -3
  140. package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -1
  141. package/lib/commonjs/skia/web/JsiVideo.d.ts +1 -0
  142. package/lib/commonjs/skia/web/JsiVideo.js +4 -1
  143. package/lib/commonjs/skia/web/JsiVideo.js.map +1 -1
  144. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  145. package/lib/commonjs/sksg/Container.web.js.map +1 -1
  146. package/lib/commonjs/sksg/Elements.js.map +1 -1
  147. package/lib/commonjs/sksg/Reconciler.js.map +1 -1
  148. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +4 -0
  149. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +4 -0
  150. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  151. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  152. package/lib/commonjs/sksg/StaticContainer.js.map +1 -1
  153. package/lib/commonjs/views/SkiaPictureView.web.js +3 -1
  154. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  155. package/lib/module/Platform/Platform.js.map +1 -1
  156. package/lib/module/Platform/Platform.web.js +0 -1
  157. package/lib/module/Platform/Platform.web.js.map +1 -1
  158. package/lib/module/animation/functions/interpolate.js +0 -1
  159. package/lib/module/animation/functions/interpolate.js.map +1 -1
  160. package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
  161. package/lib/module/dom/types/Drawings.js.map +1 -1
  162. package/lib/module/external/reanimated/textures.js +33 -30
  163. package/lib/module/external/reanimated/textures.js.map +1 -1
  164. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  165. package/lib/module/renderer/Canvas.js +1 -3
  166. package/lib/module/renderer/Canvas.js.map +1 -1
  167. package/lib/module/renderer/Offscreen.js +1 -8
  168. package/lib/module/renderer/Offscreen.js.map +1 -1
  169. package/lib/module/renderer/__tests__/e2e/setup/Paragraph.d.ts +1 -0
  170. package/lib/module/renderer/__tests__/e2e/setup/SVG.d.ts +1 -0
  171. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  172. package/lib/module/skia/core/Image.js.map +1 -1
  173. package/lib/module/skia/core/SVG.web.js +9 -2
  174. package/lib/module/skia/core/SVG.web.js.map +1 -1
  175. package/lib/module/skia/types/JsiInstance.d.ts +1 -1
  176. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  177. package/lib/module/skia/types/Matrix4.js.map +1 -1
  178. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  179. package/lib/module/skia/types/Shader/Shader.js +1 -3
  180. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  181. package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
  182. package/lib/module/skia/web/Host.d.ts +2 -1
  183. package/lib/module/skia/web/Host.js +8 -0
  184. package/lib/module/skia/web/Host.js.map +1 -1
  185. package/lib/module/skia/web/JsiSkAnimatedImage.d.ts +0 -1
  186. package/lib/module/skia/web/JsiSkAnimatedImage.js +0 -6
  187. package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -1
  188. package/lib/module/skia/web/JsiSkCanvas.d.ts +0 -1
  189. package/lib/module/skia/web/JsiSkCanvas.js +0 -6
  190. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  191. package/lib/module/skia/web/JsiSkColor.js +0 -1
  192. package/lib/module/skia/web/JsiSkColor.js.map +1 -1
  193. package/lib/module/skia/web/JsiSkColorFilter.d.ts +0 -1
  194. package/lib/module/skia/web/JsiSkColorFilter.js +0 -6
  195. package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
  196. package/lib/module/skia/web/JsiSkContourMeasure.d.ts +0 -1
  197. package/lib/module/skia/web/JsiSkContourMeasure.js +0 -6
  198. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  199. package/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
  200. package/lib/module/skia/web/JsiSkContourMeasureIter.js +0 -6
  201. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkData.d.ts +0 -1
  203. package/lib/module/skia/web/JsiSkData.js +0 -6
  204. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  205. package/lib/module/skia/web/JsiSkDataFactory.js.map +1 -1
  206. package/lib/module/skia/web/JsiSkFont.d.ts +0 -1
  207. package/lib/module/skia/web/JsiSkFont.js +0 -6
  208. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  209. package/lib/module/skia/web/JsiSkFontMgr.js +1 -1
  210. package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
  211. package/lib/module/skia/web/JsiSkImage.d.ts +0 -1
  212. package/lib/module/skia/web/JsiSkImage.js +0 -6
  213. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  214. package/lib/module/skia/web/JsiSkImageFilter.d.ts +0 -1
  215. package/lib/module/skia/web/JsiSkImageFilter.js +0 -6
  216. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
  217. package/lib/module/skia/web/JsiSkMaskFilter.d.ts +0 -1
  218. package/lib/module/skia/web/JsiSkMaskFilter.js +0 -6
  219. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
  220. package/lib/module/skia/web/JsiSkMatrix.d.ts +0 -1
  221. package/lib/module/skia/web/JsiSkMatrix.js +0 -6
  222. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  223. package/lib/module/skia/web/JsiSkPaint.d.ts +0 -1
  224. package/lib/module/skia/web/JsiSkPaint.js +0 -6
  225. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  226. package/lib/module/skia/web/JsiSkParagraph.d.ts +0 -1
  227. package/lib/module/skia/web/JsiSkParagraph.js +0 -3
  228. package/lib/module/skia/web/JsiSkParagraph.js.map +1 -1
  229. package/lib/module/skia/web/JsiSkParagraphBuilder.d.ts +0 -1
  230. package/lib/module/skia/web/JsiSkParagraphBuilder.js +0 -3
  231. package/lib/module/skia/web/JsiSkParagraphBuilder.js.map +1 -1
  232. package/lib/module/skia/web/JsiSkPath.d.ts +0 -1
  233. package/lib/module/skia/web/JsiSkPath.js +0 -6
  234. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  235. package/lib/module/skia/web/JsiSkPathEffect.d.ts +0 -1
  236. package/lib/module/skia/web/JsiSkPathEffect.js +0 -6
  237. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
  238. package/lib/module/skia/web/JsiSkPicture.d.ts +0 -1
  239. package/lib/module/skia/web/JsiSkPicture.js +0 -6
  240. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  241. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +0 -1
  242. package/lib/module/skia/web/JsiSkPictureRecorder.js +0 -6
  243. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  244. package/lib/module/skia/web/JsiSkPoint.d.ts +1 -2
  245. package/lib/module/skia/web/JsiSkPoint.js +0 -6
  246. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  247. package/lib/module/skia/web/JsiSkRRect.d.ts +2 -2
  248. package/lib/module/skia/web/JsiSkRRect.js +3 -6
  249. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  250. package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -2
  251. package/lib/module/skia/web/JsiSkRSXform.js +0 -6
  252. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  253. package/lib/module/skia/web/JsiSkRect.d.ts +0 -1
  254. package/lib/module/skia/web/JsiSkRect.js +0 -6
  255. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  256. package/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
  257. package/lib/module/skia/web/JsiSkRuntimeEffect.js +0 -6
  258. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  259. package/lib/module/skia/web/JsiSkSVG.d.ts +1 -1
  260. package/lib/module/skia/web/JsiSkSVG.js +5 -8
  261. package/lib/module/skia/web/JsiSkSVG.js.map +1 -1
  262. package/lib/module/skia/web/JsiSkShader.d.ts +0 -1
  263. package/lib/module/skia/web/JsiSkShader.js +0 -6
  264. package/lib/module/skia/web/JsiSkShader.js.map +1 -1
  265. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -1
  266. package/lib/module/skia/web/JsiSkSurface.js +3 -6
  267. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  268. package/lib/module/skia/web/JsiSkTextBlob.d.ts +0 -1
  269. package/lib/module/skia/web/JsiSkTextBlob.js +0 -6
  270. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
  271. package/lib/module/skia/web/JsiSkTypeface.d.ts +0 -1
  272. package/lib/module/skia/web/JsiSkTypeface.js +0 -6
  273. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  274. package/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -2
  275. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +0 -12
  276. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  277. package/lib/module/skia/web/JsiSkVertices.d.ts +0 -1
  278. package/lib/module/skia/web/JsiSkVertices.js +0 -6
  279. package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
  280. package/lib/module/skia/web/JsiSkottieAnimation.d.ts +0 -1
  281. package/lib/module/skia/web/JsiSkottieAnimation.js +0 -3
  282. package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -1
  283. package/lib/module/skia/web/JsiVideo.d.ts +1 -0
  284. package/lib/module/skia/web/JsiVideo.js +4 -1
  285. package/lib/module/skia/web/JsiVideo.js.map +1 -1
  286. package/lib/module/sksg/Container.native.js.map +1 -1
  287. package/lib/module/sksg/Container.web.js.map +1 -1
  288. package/lib/module/sksg/Elements.js.map +1 -1
  289. package/lib/module/sksg/Reconciler.js.map +1 -1
  290. package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +4 -0
  291. package/lib/module/sksg/Recorder/ReanimatedRecorder.js +5 -0
  292. package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  293. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  294. package/lib/module/sksg/StaticContainer.js.map +1 -1
  295. package/lib/module/views/SkiaPictureView.web.js +3 -1
  296. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  297. package/lib/typescript/eslint.config.d.mts +2 -0
  298. package/lib/typescript/jest.config.d.ts +11 -2
  299. package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +2 -0
  300. package/lib/typescript/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +0 -1
  301. package/lib/typescript/lib/commonjs/skia/web/JsiSkParagraph.d.ts +0 -1
  302. package/lib/typescript/lib/commonjs/skia/web/JsiSkParagraphBuilder.d.ts +0 -1
  303. package/lib/typescript/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -1
  304. package/lib/typescript/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +0 -1
  305. package/lib/typescript/lib/commonjs/skia/web/JsiVideo.d.ts +1 -0
  306. package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +4 -0
  307. package/lib/typescript/lib/module/skia/web/Host.d.ts +2 -0
  308. package/lib/typescript/lib/module/skia/web/JsiSkFontMgr.d.ts +0 -1
  309. package/lib/typescript/lib/module/skia/web/JsiSkParagraph.d.ts +0 -1
  310. package/lib/typescript/lib/module/skia/web/JsiSkParagraphBuilder.d.ts +0 -1
  311. package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -1
  312. package/lib/typescript/lib/module/skia/web/JsiSkottieAnimation.d.ts +0 -1
  313. package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +1 -0
  314. package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +4 -0
  315. package/lib/typescript/src/renderer/__tests__/e2e/setup/Paragraph.d.ts +1 -0
  316. package/lib/typescript/src/renderer/__tests__/e2e/setup/SVG.d.ts +1 -0
  317. package/lib/typescript/src/skia/types/JsiInstance.d.ts +1 -1
  318. package/lib/typescript/src/skia/web/Host.d.ts +2 -1
  319. package/lib/typescript/src/skia/web/JsiSkAnimatedImage.d.ts +0 -1
  320. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +0 -1
  321. package/lib/typescript/src/skia/web/JsiSkColorFilter.d.ts +0 -1
  322. package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +0 -1
  323. package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
  324. package/lib/typescript/src/skia/web/JsiSkData.d.ts +0 -1
  325. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +0 -1
  326. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +0 -1
  327. package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +0 -1
  328. package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +0 -1
  329. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +0 -1
  330. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +0 -1
  331. package/lib/typescript/src/skia/web/JsiSkParagraph.d.ts +0 -1
  332. package/lib/typescript/src/skia/web/JsiSkParagraphBuilder.d.ts +0 -1
  333. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +0 -1
  334. package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +0 -1
  335. package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +0 -1
  336. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +0 -1
  337. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -2
  338. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
  339. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
  340. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +0 -1
  341. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
  342. package/lib/typescript/src/skia/web/JsiSkSVG.d.ts +1 -1
  343. package/lib/typescript/src/skia/web/JsiSkShader.d.ts +0 -1
  344. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -1
  345. package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +0 -1
  346. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +0 -1
  347. package/lib/typescript/src/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -2
  348. package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +0 -1
  349. package/lib/typescript/src/skia/web/JsiSkottieAnimation.d.ts +0 -1
  350. package/lib/typescript/src/skia/web/JsiVideo.d.ts +1 -0
  351. package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +4 -0
  352. package/package.json +19 -12
  353. package/scripts/setup-canvaskit.js +15 -9
  354. package/src/Platform/Platform.ts +2 -2
  355. package/src/Platform/Platform.web.tsx +0 -1
  356. package/src/__tests__/setup.ts +1 -4
  357. package/src/animation/functions/interpolate.ts +0 -1
  358. package/src/dom/nodes/datatypes/Fitting.ts +1 -1
  359. package/src/dom/types/Drawings.ts +1 -1
  360. package/src/external/reanimated/textures.tsx +36 -27
  361. package/src/external/reanimated/useVideo.ts +1 -1
  362. package/src/renderer/Canvas.tsx +1 -2
  363. package/src/renderer/Offscreen.tsx +1 -7
  364. package/src/renderer/__tests__/FitBox.spec.tsx +0 -1
  365. package/src/renderer/__tests__/Picture.spec.tsx +8 -5
  366. package/src/renderer/__tests__/Surfaces.spec.tsx +11 -16
  367. package/src/renderer/__tests__/documentation/Group.spec.tsx +0 -1
  368. package/src/renderer/__tests__/e2e/AnimatedImages.spec.tsx +0 -1
  369. package/src/renderer/__tests__/e2e/Drawings.spec.tsx +0 -4
  370. package/src/renderer/__tests__/e2e/Group.spec.tsx +0 -1
  371. package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +0 -2
  372. package/src/renderer/__tests__/e2e/Paint.spec.tsx +0 -1
  373. package/src/renderer/__tests__/e2e/Paths.spec.tsx +1 -6
  374. package/src/renderer/__tests__/e2e/RuntimeShader.spec.tsx +0 -1
  375. package/src/renderer/__tests__/e2e/Skottie.spec.tsx +6 -6
  376. package/src/renderer/__tests__/e2e/Surfaces.spec.tsx +2 -2
  377. package/src/renderer/__tests__/e2e/TextPath.spec.tsx +0 -2
  378. package/src/renderer/__tests__/e2e/Video.ts +0 -1
  379. package/src/renderer/__tests__/e2e/setup/Paragraph.ts +5 -1
  380. package/src/renderer/__tests__/e2e/setup/SVG.ts +5 -1
  381. package/src/renderer/__tests__/e2e/setup/SkiaObject.ts +1 -1
  382. package/src/renderer/__tests__/setup.tsx +0 -1
  383. package/src/renderer/processors/Animations/Animations.ts +4 -4
  384. package/src/skia/__tests__/Path.spec.ts +1 -3
  385. package/src/skia/core/Image.ts +1 -1
  386. package/src/skia/core/SVG.web.ts +12 -8
  387. package/src/skia/types/JsiInstance.ts +1 -1
  388. package/src/skia/types/Matrix4.ts +4 -4
  389. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +1 -1
  390. package/src/skia/types/Shader/Shader.ts +0 -1
  391. package/src/skia/web/CanvasKitWebGLBufferImpl.ts +4 -1
  392. package/src/skia/web/Host.ts +14 -1
  393. package/src/skia/web/JsiSkAnimatedImage.ts +0 -4
  394. package/src/skia/web/JsiSkCanvas.ts +0 -4
  395. package/src/skia/web/JsiSkColor.ts +1 -1
  396. package/src/skia/web/JsiSkColorFilter.ts +0 -4
  397. package/src/skia/web/JsiSkContourMeasure.ts +0 -4
  398. package/src/skia/web/JsiSkContourMeasureIter.ts +0 -4
  399. package/src/skia/web/JsiSkData.ts +0 -4
  400. package/src/skia/web/JsiSkDataFactory.ts +1 -1
  401. package/src/skia/web/JsiSkFont.ts +0 -4
  402. package/src/skia/web/JsiSkFontMgr.ts +2 -1
  403. package/src/skia/web/JsiSkImage.ts +0 -4
  404. package/src/skia/web/JsiSkImageFilter.ts +0 -4
  405. package/src/skia/web/JsiSkMaskFilter.ts +0 -4
  406. package/src/skia/web/JsiSkMatrix.ts +2 -6
  407. package/src/skia/web/JsiSkPaint.ts +0 -4
  408. package/src/skia/web/JsiSkParagraph.ts +0 -4
  409. package/src/skia/web/JsiSkParagraphBuilder.ts +0 -4
  410. package/src/skia/web/JsiSkPath.ts +0 -4
  411. package/src/skia/web/JsiSkPathEffect.ts +0 -4
  412. package/src/skia/web/JsiSkPicture.ts +0 -4
  413. package/src/skia/web/JsiSkPictureRecorder.ts +0 -4
  414. package/src/skia/web/JsiSkPoint.ts +0 -4
  415. package/src/skia/web/JsiSkRRect.ts +3 -3
  416. package/src/skia/web/JsiSkRSXform.ts +5 -3
  417. package/src/skia/web/JsiSkRect.ts +0 -4
  418. package/src/skia/web/JsiSkRuntimeEffect.ts +5 -5
  419. package/src/skia/web/JsiSkSVG.ts +2 -2
  420. package/src/skia/web/JsiSkShader.ts +0 -4
  421. package/src/skia/web/JsiSkSurface.ts +2 -2
  422. package/src/skia/web/JsiSkTextBlob.ts +0 -4
  423. package/src/skia/web/JsiSkTypeface.ts +0 -4
  424. package/src/skia/web/JsiSkTypefaceFontProvider.ts +0 -12
  425. package/src/skia/web/JsiSkVertices.ts +0 -4
  426. package/src/skia/web/JsiSkottieAnimation.ts +0 -3
  427. package/src/skia/web/JsiVideo.ts +5 -1
  428. package/src/sksg/Container.native.ts +4 -1
  429. package/src/sksg/Container.web.ts +4 -1
  430. package/src/sksg/Elements.tsx +0 -1
  431. package/src/sksg/Reconciler.ts +4 -1
  432. package/src/sksg/Recorder/ReanimatedRecorder.ts +4 -0
  433. package/src/sksg/Recorder/Visitor.ts +1 -1
  434. package/src/sksg/StaticContainer.ts +4 -1
  435. package/src/views/SkiaPictureView.web.tsx +12 -3
  436. package/cpp/api/JsiSkThreadSafeDeletion.h +0 -105
@@ -6,6 +6,7 @@
6
6
  #include "Convertor.h"
7
7
  #include "DrawingCtx.h"
8
8
  #include "ImageFit.h"
9
+ #include "RNSkPlatformContext.h"
9
10
 
10
11
  namespace RNSkia {
11
12
 
@@ -17,10 +18,9 @@ struct CircleCmdProps {
17
18
  };
18
19
 
19
20
  class CircleCmd : public Command {
20
- private:
21
+ public:
21
22
  CircleCmdProps props;
22
23
 
23
- public:
24
24
  CircleCmd(jsi::Runtime &runtime, const jsi::Object &object,
25
25
  Variables &variables)
26
26
  : Command(CommandType::DrawCircle) {
@@ -52,10 +52,9 @@ struct RectCmdProps {
52
52
  };
53
53
 
54
54
  class RectCmd : public Command {
55
- private:
55
+ public:
56
56
  RectCmdProps props;
57
57
 
58
- public:
59
58
  RectCmd(jsi::Runtime &runtime, const jsi::Object &object,
60
59
  Variables &variables)
61
60
  : Command(CommandType::DrawRect) {
@@ -86,10 +85,9 @@ struct PathCmdProps {
86
85
  };
87
86
 
88
87
  class PathCmd : public Command {
89
- private:
88
+ public:
90
89
  PathCmdProps props;
91
90
 
92
- public:
93
91
  PathCmd(jsi::Runtime &runtime, const jsi::Object &object,
94
92
  Variables &variables)
95
93
  : Command(CommandType::DrawPath) {
@@ -196,10 +194,9 @@ struct LineCmdProps {
196
194
  };
197
195
 
198
196
  class LineCmd : public Command {
199
- private:
197
+ public:
200
198
  LineCmdProps props;
201
199
 
202
- public:
203
200
  LineCmd(jsi::Runtime &runtime, const jsi::Object &object,
204
201
  Variables &variables)
205
202
  : Command(CommandType::DrawLine) {
@@ -221,10 +218,9 @@ struct TextPathProps {
221
218
  };
222
219
 
223
220
  class TextPathCmd : public Command {
224
- private:
221
+ public:
225
222
  TextPathProps props;
226
223
 
227
- public:
228
224
  TextPathCmd(jsi::Runtime &runtime, const jsi::Object &object,
229
225
  Variables &variables)
230
226
  : Command(CommandType::DrawTextPath) {
@@ -313,10 +309,9 @@ struct TextCmdProps {
313
309
  };
314
310
 
315
311
  class TextCmd : public Command {
316
- private:
312
+ public:
317
313
  TextCmdProps props;
318
314
 
319
- public:
320
315
  TextCmd(jsi::Runtime &runtime, const jsi::Object &object,
321
316
  Variables &variables)
322
317
  : Command(CommandType::DrawText) {
@@ -351,7 +346,7 @@ struct BoxCmdProps {
351
346
  };
352
347
 
353
348
  class BoxCmd : public Command {
354
- private:
349
+ public:
355
350
  BoxCmdProps props;
356
351
  std::vector<BoxShadowCmdProps> shadows;
357
352
 
@@ -373,7 +368,6 @@ private:
373
368
  return inflate(box, -dx, -dy, tx, ty);
374
369
  }
375
370
 
376
- public:
377
371
  BoxCmd(jsi::Runtime &runtime, const jsi::Object &object,
378
372
  const jsi::Array &shadowsArray, Variables &variables)
379
373
  : Command(CommandType::DrawBox) {
@@ -473,13 +467,13 @@ struct ImageCmdProps {
473
467
  };
474
468
 
475
469
  class ImageCmd : public Command {
476
- private:
470
+ public:
477
471
  ImageCmdProps props;
472
+ std::shared_ptr<RNSkPlatformContext> _context;
478
473
 
479
- public:
480
- ImageCmd(jsi::Runtime &runtime, const jsi::Object &object,
481
- Variables &variables)
482
- : Command(CommandType::DrawImage) {
474
+ ImageCmd(std::shared_ptr<RNSkPlatformContext> context, jsi::Runtime &runtime,
475
+ const jsi::Object &object, Variables &variables)
476
+ : Command(CommandType::DrawImage), _context(context) {
483
477
  convertProperty(runtime, object, "rect", props.rect, variables);
484
478
  convertProperty(runtime, object, "image", props.image, variables);
485
479
  convertProperty(runtime, object, "sampling", props.sampling, variables);
@@ -492,6 +486,17 @@ public:
492
486
  convertProperty(runtime, object, "rect", props.rect, variables);
493
487
  }
494
488
 
489
+ ~ImageCmd() {
490
+ if (props.image.has_value()) {
491
+ auto image = props.image.value();
492
+ if (image) {
493
+ _context->runOnMainThread([image]() {
494
+ // Image will be deleted when this lambda is destroyed on main thread
495
+ });
496
+ }
497
+ }
498
+ }
499
+
495
500
  void draw(DrawingCtx *ctx) {
496
501
  auto [x, y, width, height, rect, fit, image, sampling] = props;
497
502
  if (image.has_value()) {
@@ -522,10 +527,9 @@ struct PointsCmdProps {
522
527
  };
523
528
 
524
529
  class PointsCmd : public Command {
525
- private:
530
+ public:
526
531
  PointsCmdProps props;
527
532
 
528
- public:
529
533
  PointsCmd(jsi::Runtime &runtime, const jsi::Object &object,
530
534
  Variables &variables)
531
535
  : Command(CommandType::DrawPoints) {
@@ -549,10 +553,9 @@ struct RRectCmdProps {
549
553
  };
550
554
 
551
555
  class RRectCmd : public Command {
552
- private:
556
+ public:
553
557
  RRectCmdProps props;
554
558
 
555
- public:
556
559
  RRectCmd(jsi::Runtime &runtime, const jsi::Object &object,
557
560
  Variables &variables)
558
561
  : Command(CommandType::DrawRRect) {
@@ -589,10 +592,9 @@ struct OvalCmdProps {
589
592
  };
590
593
 
591
594
  class OvalCmd : public Command {
592
- private:
595
+ public:
593
596
  OvalCmdProps props;
594
597
 
595
- public:
596
598
  OvalCmd(jsi::Runtime &runtime, const jsi::Object &object,
597
599
  Variables &variables)
598
600
  : Command(CommandType::DrawOval) {
@@ -625,10 +627,9 @@ struct PatchCmdProps {
625
627
  };
626
628
 
627
629
  class PatchCmd : public Command {
628
- private:
630
+ public:
629
631
  PatchCmdProps props;
630
632
 
631
- public:
632
633
  PatchCmd(jsi::Runtime &runtime, const jsi::Object &object,
633
634
  Variables &variables)
634
635
  : Command(CommandType::DrawPatch) {
@@ -674,10 +675,9 @@ struct VerticesCmdProps {
674
675
  };
675
676
 
676
677
  class VerticesCmd : public Command {
677
- private:
678
+ public:
678
679
  VerticesCmdProps props;
679
680
 
680
- public:
681
681
  VerticesCmd(jsi::Runtime &runtime, const jsi::Object &object,
682
682
  Variables &variables)
683
683
  : Command(CommandType::DrawVertices) {
@@ -719,10 +719,9 @@ struct DiffRectCmdProps {
719
719
  };
720
720
 
721
721
  class DiffRectCmd : public Command {
722
- private:
722
+ public:
723
723
  DiffRectCmdProps props;
724
724
 
725
- public:
726
725
  DiffRectCmd(jsi::Runtime &runtime, const jsi::Object &object,
727
726
  Variables &variables)
728
727
  : Command(CommandType::DrawDiffRect) {
@@ -742,10 +741,9 @@ struct TextBlobCmdProps {
742
741
  };
743
742
 
744
743
  class TextBlobCmd : public Command {
745
- private:
744
+ public:
746
745
  TextBlobCmdProps props;
747
746
 
748
- public:
749
747
  TextBlobCmd(jsi::Runtime &runtime, const jsi::Object &object,
750
748
  Variables &variables)
751
749
  : Command(CommandType::DrawTextBlob) {
@@ -767,10 +765,9 @@ struct GlyphsCmdProps {
767
765
  };
768
766
 
769
767
  class GlyphsCmd : public Command {
770
- private:
768
+ public:
771
769
  GlyphsCmdProps props;
772
770
 
773
- public:
774
771
  GlyphsCmd(jsi::Runtime &runtime, const jsi::Object &object,
775
772
  Variables &variables)
776
773
  : Command(CommandType::DrawGlyphs) {
@@ -798,16 +795,26 @@ struct PictureCmdProps {
798
795
  };
799
796
 
800
797
  class PictureCmd : public Command {
801
- private:
798
+ public:
802
799
  PictureCmdProps props;
800
+ std::shared_ptr<RNSkPlatformContext> _context;
803
801
 
804
- public:
805
- PictureCmd(jsi::Runtime &runtime, const jsi::Object &object,
802
+ PictureCmd(std::shared_ptr<RNSkPlatformContext> context,
803
+ jsi::Runtime &runtime, const jsi::Object &object,
806
804
  Variables &variables)
807
- : Command(CommandType::DrawPicture) {
805
+ : Command(CommandType::DrawPicture), _context(context) {
808
806
  convertProperty(runtime, object, "picture", props.picture, variables);
809
807
  }
810
808
 
809
+ ~PictureCmd() {
810
+ auto picture = props.picture;
811
+ if (picture) {
812
+ _context->runOnMainThread([picture]() {
813
+ // Picture will be deleted when this lambda is destroyed on main thread
814
+ });
815
+ }
816
+ }
817
+
811
818
  void draw(DrawingCtx *ctx) { ctx->canvas->drawPicture(props.picture); }
812
819
  };
813
820
 
@@ -821,10 +828,9 @@ struct ImageSVGCmdProps {
821
828
  };
822
829
 
823
830
  class ImageSVGCmd : public Command {
824
- private:
831
+ public:
825
832
  ImageSVGCmdProps props;
826
833
 
827
- public:
828
834
  ImageSVGCmd(jsi::Runtime &runtime, const jsi::Object &object,
829
835
  Variables &variables)
830
836
  : Command(CommandType::DrawImageSVG) {
@@ -877,10 +883,9 @@ struct ParagraphCmdProps {
877
883
  };
878
884
 
879
885
  class ParagraphCmd : public Command {
880
- private:
886
+ public:
881
887
  ParagraphCmdProps props;
882
888
 
883
- public:
884
889
  ParagraphCmd(jsi::Runtime &runtime, const jsi::Object &object,
885
890
  Variables &variables)
886
891
  : Command(CommandType::DrawParagraph) {
@@ -905,10 +910,9 @@ struct SkottieCmdProps {
905
910
  };
906
911
 
907
912
  class SkottieCmd : public Command {
908
- private:
913
+ public:
909
914
  SkottieCmdProps props;
910
915
 
911
- public:
912
916
  SkottieCmd(jsi::Runtime &runtime, const jsi::Object &object,
913
917
  Variables &variables)
914
918
  : Command(CommandType::DrawSkottie) {
@@ -932,13 +936,13 @@ struct AtlasCmdProps {
932
936
  };
933
937
 
934
938
  class AtlasCmd : public Command {
935
- private:
939
+ public:
936
940
  AtlasCmdProps props;
941
+ std::shared_ptr<RNSkPlatformContext> _context;
937
942
 
938
- public:
939
- AtlasCmd(jsi::Runtime &runtime, const jsi::Object &object,
940
- Variables &variables)
941
- : Command(CommandType::DrawAtlas) {
943
+ AtlasCmd(std::shared_ptr<RNSkPlatformContext> context, jsi::Runtime &runtime,
944
+ const jsi::Object &object, Variables &variables)
945
+ : Command(CommandType::DrawAtlas), _context(context) {
942
946
  convertProperty(runtime, object, "image", props.image, variables);
943
947
  convertProperty(runtime, object, "sprites", props.sprites, variables);
944
948
  convertProperty(runtime, object, "transforms", props.transforms, variables);
@@ -947,6 +951,15 @@ public:
947
951
  convertProperty(runtime, object, "sampling", props.sampling, variables);
948
952
  }
949
953
 
954
+ ~AtlasCmd() {
955
+ auto image = props.image;
956
+ if (image) {
957
+ _context->runOnMainThread([image]() {
958
+ // Image will be deleted when this lambda is destroyed on main thread
959
+ });
960
+ }
961
+ }
962
+
950
963
  void draw(DrawingCtx *ctx) {
951
964
  if (props.image) {
952
965
  // Validate transforms and sprites have the same size
@@ -977,4 +990,4 @@ public:
977
990
  }
978
991
  };
979
992
 
980
- } // namespace RNSkia
993
+ } // namespace RNSkia
@@ -22,7 +22,9 @@ class JsiRecorder : public JsiSkWrappingSharedPtrHostObject<Recorder> {
22
22
  public:
23
23
  JsiRecorder(std::shared_ptr<RNSkPlatformContext> context)
24
24
  : JsiSkWrappingSharedPtrHostObject(std::move(context),
25
- std::make_shared<Recorder>()) {}
25
+ std::make_shared<Recorder>()) {
26
+ getObject()->_context = getContext();
27
+ }
26
28
 
27
29
  JSI_HOST_FUNCTION(savePaint) {
28
30
  getObject()->savePaint(runtime, arguments[0].asObject(runtime),
@@ -15,6 +15,7 @@
15
15
  #include "ImageFilters.h"
16
16
  #include "Paint.h"
17
17
  #include "PathEffects.h"
18
+ #include "RNSkPlatformContext.h"
18
19
  #include "Shaders.h"
19
20
 
20
21
  namespace RNSkia {
@@ -24,8 +25,10 @@ private:
24
25
  std::vector<std::unique_ptr<Command>> commands;
25
26
 
26
27
  public:
28
+ std::shared_ptr<RNSkPlatformContext> _context;
27
29
  Variables variables;
28
30
 
31
+ Recorder() = default;
29
32
  ~Recorder() = default;
30
33
 
31
34
  void savePaint(jsi::Runtime &runtime, const jsi::Object &props,
@@ -216,7 +219,8 @@ public:
216
219
  }
217
220
 
218
221
  void drawImage(jsi::Runtime &runtime, const jsi::Object &props) {
219
- commands.push_back(std::make_unique<ImageCmd>(runtime, props, variables));
222
+ commands.push_back(
223
+ std::make_unique<ImageCmd>(_context, runtime, props, variables));
220
224
  }
221
225
 
222
226
  void drawPoints(jsi::Runtime &runtime, const jsi::Object &props) {
@@ -255,7 +259,8 @@ public:
255
259
  }
256
260
 
257
261
  void drawPicture(jsi::Runtime &runtime, const jsi::Object &props) {
258
- commands.push_back(std::make_unique<PictureCmd>(runtime, props, variables));
262
+ commands.push_back(
263
+ std::make_unique<PictureCmd>(_context, runtime, props, variables));
259
264
  }
260
265
 
261
266
  void drawImageSVG(jsi::Runtime &runtime, const jsi::Object &props) {
@@ -269,7 +274,8 @@ public:
269
274
  }
270
275
 
271
276
  void drawAtlas(jsi::Runtime &runtime, const jsi::Object &props) {
272
- commands.push_back(std::make_unique<AtlasCmd>(runtime, props, variables));
277
+ commands.push_back(
278
+ std::make_unique<AtlasCmd>(_context, runtime, props, variables));
273
279
  }
274
280
 
275
281
  void drawSkottie(jsi::Runtime &runtime, const jsi::Object &props) {
@@ -646,4 +652,4 @@ public:
646
652
  }
647
653
  };
648
654
 
649
- } // namespace RNSkia
655
+ } // namespace RNSkia
@@ -24,6 +24,12 @@ void JsiHostObject::set(jsi::Runtime &rt, const jsi::PropNameID &name,
24
24
  }
25
25
  }
26
26
 
27
+ jsi::Value eval(jsi::Runtime &runtime, const std::string &js) {
28
+ return runtime.global()
29
+ .getPropertyAsFunction(runtime, "eval")
30
+ .call(runtime, js);
31
+ }
32
+
27
33
  jsi::Value JsiHostObject::get(jsi::Runtime &runtime,
28
34
  const jsi::PropNameID &name) {
29
35
  auto nameStr = name.utf8(runtime);
@@ -77,6 +83,16 @@ jsi::Value JsiHostObject::get(jsi::Runtime &runtime,
77
83
  return (prop.get)(runtime);
78
84
  }
79
85
 
86
+ // Check for dispose symbol as last resort
87
+ static const auto disposeSymbol = jsi::PropNameID::forSymbol(
88
+ runtime,
89
+ eval(runtime, "Symbol.for('Symbol.dispose');").getSymbol(runtime));
90
+ if (jsi::PropNameID::compare(runtime, disposeSymbol, name)) {
91
+ // Recursively call get with "dispose" string
92
+ auto disposeName = jsi::PropNameID::forAscii(runtime, "dispose");
93
+ return get(runtime, disposeName);
94
+ }
95
+
80
96
  return jsi::Value::undefined();
81
97
  }
82
98
 
package/jestSetup.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* globals jest */
2
- /* eslint-disable import/no-extraneous-dependencies */
2
+
3
3
  jest.mock("@shopify/react-native-skia", () => {
4
4
  jest.mock("@shopify/react-native-skia/lib/commonjs/Platform", () => {
5
5
  const Noop = () => undefined;
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_types","Platform","exports","OS","RNPlatform","PixelRatio","get","resolveAsset","source","isRNModule","Image","resolveAssetSource","uri","default","findNodeHandle","View"],"sources":["Platform.ts"],"sourcesContent":["import {\n Image,\n PixelRatio,\n Platform as RNPlatform,\n findNodeHandle,\n View,\n} from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\nexport const Platform: IPlatform = {\n OS: RNPlatform.OS,\n PixelRatio: PixelRatio.get(),\n resolveAsset: (source: DataModule) => {\n // eslint-disable-next-line no-nested-ternary\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : \"uri\" in source\n ? source.uri\n : source.default;\n },\n findNodeHandle,\n View,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,IAAAC,MAAA,GAAAD,OAAA;AAIO,MAAME,QAAmB,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACjCE,EAAE,EAAEC,qBAAU,CAACD,EAAE;EACjBE,UAAU,EAAEA,uBAAU,CAACC,GAAG,CAAC,CAAC;EAC5BC,YAAY,EAAGC,MAAkB,IAAK;IACpC;IACA,OAAO,IAAAC,iBAAU,EAACD,MAAM,CAAC,GACrBE,kBAAK,CAACC,kBAAkB,CAACH,MAAM,CAAC,CAACI,GAAG,GACpC,KAAK,IAAIJ,MAAM,GACfA,MAAM,CAACI,GAAG,GACVJ,MAAM,CAACK,OAAO;EACpB,CAAC;EACDC,cAAc,EAAdA,2BAAc;EACdC,IAAI,EAAJA;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_types","Platform","exports","OS","RNPlatform","PixelRatio","get","resolveAsset","source","isRNModule","Image","resolveAssetSource","uri","default","findNodeHandle","View"],"sources":["Platform.ts"],"sourcesContent":["import {\n Image,\n PixelRatio,\n Platform as RNPlatform,\n findNodeHandle,\n View,\n} from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\nexport const Platform: IPlatform = {\n OS: RNPlatform.OS,\n PixelRatio: PixelRatio.get(),\n resolveAsset: (source: DataModule) => {\n // eslint-disable-next-line no-nested-ternary\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : \"uri\" in source\n ? source.uri\n : source.default;\n },\n findNodeHandle,\n View,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,IAAAC,MAAA,GAAAD,OAAA;AAIO,MAAME,QAAmB,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACjCE,EAAE,EAAEC,qBAAU,CAACD,EAAE;EACjBE,UAAU,EAAEA,uBAAU,CAACC,GAAG,CAAC,CAAC;EAC5BC,YAAY,EAAGC,MAAkB,IAAK;IACpC;IACA,OAAO,IAAAC,iBAAU,EAACD,MAAM,CAAC,GACrBE,kBAAK,CAACC,kBAAkB,CAACH,MAAM,CAAC,CAACI,GAAG,GACpC,KAAK,IAAIJ,MAAM,GACbA,MAAM,CAACI,GAAG,GACVJ,MAAM,CAACK,OAAO;EACtB,CAAC;EACDC,cAAc,EAAdA,2BAAc;EACdC,IAAI,EAAJA;AACF,CAAC","ignoreList":[]}
@@ -8,7 +8,6 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _types = require("../skia/types");
9
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
10
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- // eslint-disable-next-line max-len
12
11
  // https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js
13
12
  const DOM_LAYOUT_HANDLER_NAME = "__reactLayoutHandler";
14
13
  let resizeObserver = null;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_types","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","useLayoutEffect","current","observe","unobserve","View","children","style","rawStyle","useMemo","useRef","cssStyles","alignItems","backgroundColor","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","textDecoration","zIndex","createElement","Platform","exports","OS","PixelRatio","devicePixelRatio","resolveAsset","source","isRNModule","getAssetByID","httpServerLocation","name","uri","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { RefObject, CSSProperties } from \"react\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { LayoutChangeEvent, ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// eslint-disable-next-line max-len\n// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js\nconst DOM_LAYOUT_HANDLER_NAME = \"__reactLayoutHandler\";\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined;\ntype Div = HTMLDivElement & {\n __reactLayoutHandler: OnLayout;\n};\n\nlet resizeObserver: ResizeObserver | null = null;\n\nconst getObserver = () => {\n if (resizeObserver == null) {\n resizeObserver = new window.ResizeObserver(function (entries) {\n entries.forEach((entry) => {\n const node = entry.target as Div;\n const { left, top, width, height } = entry.contentRect;\n const onLayout = node[DOM_LAYOUT_HANDLER_NAME];\n if (typeof onLayout === \"function\") {\n // setTimeout 0 is taken from react-native-web (UIManager)\n setTimeout(\n () =>\n onLayout({\n timeStamp: Date.now(),\n nativeEvent: { layout: { x: left, y: top, width, height } },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n currentTarget: 0,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n target: 0,\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isDefaultPrevented() {\n throw new Error(\"Method not supported on web.\");\n },\n isPropagationStopped() {\n throw new Error(\"Method not supported on web.\");\n },\n persist() {\n throw new Error(\"Method not supported on web.\");\n },\n preventDefault() {\n throw new Error(\"Method not supported on web.\");\n },\n stopPropagation() {\n throw new Error(\"Method not supported on web.\");\n },\n isTrusted: true,\n type: \"\",\n }),\n 0\n );\n }\n });\n });\n }\n return resizeObserver;\n};\n\nconst useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {\n const observer = getObserver();\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node !== null) {\n node[DOM_LAYOUT_HANDLER_NAME] = onLayout;\n }\n }, [ref, onLayout]);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node != null && observer != null) {\n if (typeof node[DOM_LAYOUT_HANDLER_NAME] === \"function\") {\n observer.observe(node);\n } else {\n observer.unobserve(node);\n }\n }\n return () => {\n if (node != null && observer != null) {\n observer.unobserve(node);\n }\n };\n }, [observer, ref]);\n};\n\nconst View = (({ children, onLayout, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const ref = useRef<Div>(null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n useElementLayout(ref as any, onLayout);\n const cssStyles = useMemo(() => {\n return {\n alignItems: \"stretch\" as const,\n backgroundColor: \"transparent\" as const,\n border: \"0 solid black\" as const,\n boxSizing: \"border-box\" as const,\n display: \"flex\" as const,\n flexBasis: \"auto\" as const,\n flexDirection: \"column\" as const,\n flexShrink: 0,\n listStyle: \"none\" as const,\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: \"relative\" as const,\n textDecoration: \"none\" as const,\n zIndex: 0,\n ...style,\n };\n }, [style]);\n\n return (\n <div ref={ref} style={cssStyles}>\n {children}\n </div>\n );\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: typeof window !== \"undefined\" ? window.devicePixelRatio : 1, // window is not defined on node\n resolveAsset: (source: DataModule) => {\n if (isRNModule(source)) {\n if (typeof source === \"number\" && typeof require === \"function\") {\n const {\n getAssetByID,\n } = require(\"react-native/Libraries/Image/AssetRegistry\");\n const { httpServerLocation, name, type } = getAssetByID(source);\n const uri = `${httpServerLocation}/${name}.${type}`;\n return uri;\n }\n throw new Error(\n \"Asset source is a number - this is not supported on the web\"\n );\n }\n if (\"uri\" in source) {\n return source.uri;\n }\n return source.default;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAA2C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,o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C,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,oBACEtE,MAAA,CAAAU,OAAA,CAAAiF,aAAA;IAAK7B,GAAG,EAAEA,GAAI;IAACQ,KAAK,EAAEI;EAAU,GAC7BL,QACE,CAAC;AAEV,CAAqC;AAE9B,MAAMuB,QAAmB,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACjCE,EAAE,EAAE,KAAK;EACTC,UAAU,EAAE,OAAOpE,MAAM,KAAK,WAAW,GAAGA,MAAM,CAACqE,gBAAgB,GAAG,CAAC;EAAE;EACzEC,YAAY,EAAGC,MAAkB,IAAK;IACpC,IAAI,IAAAC,iBAAU,EAACD,MAAM,CAAC,EAAE;MACtB,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,OAAOhG,OAAO,KAAK,UAAU,EAAE;QAC/D,MAAM;UACJkG;QACF,CAAC,GAAGlG,OAAO,CAAC,4CAA4C,CAAC;QACzD,MAAM;UAAEmG,kBAAkB;UAAEC,IAAI;UAAE1C;QAAK,CAAC,GAAGwC,YAAY,CAACF,MAAM,CAAC;QAC/D,MAAMK,GAAG,GAAG,GAAGF,kBAAkB,IAAIC,IAAI,IAAI1C,IAAI,EAAE;QACnD,OAAO2C,GAAG;MACZ;MACA,MAAM,IAAIjD,KAAK,CACb,6DACF,CAAC;IACH;IACA,IAAI,KAAK,IAAI4C,MAAM,EAAE;MACnB,OAAOA,MAAM,CAACK,GAAG;IACnB;IACA,OAAOL,MAAM,CAACxF,OAAO;EACvB,CAAC;EACD8F,cAAc,EAAEA,CAAA,KAAM;IACpB,MAAM,IAAIlD,KAAK,CAAC,4CAA4C,CAAC;EAC/D,CAAC;EACDc;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_types","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DOM_LAYOUT_HANDLER_NAME","resizeObserver","getObserver","window","ResizeObserver","entries","forEach","entry","node","target","left","top","width","height","contentRect","onLayout","setTimeout","timeStamp","Date","now","nativeEvent","layout","x","y","currentTarget","bubbles","cancelable","defaultPrevented","eventPhase","isDefaultPrevented","Error","isPropagationStopped","persist","preventDefault","stopPropagation","isTrusted","type","useElementLayout","ref","observer","useLayoutEffect","current","observe","unobserve","View","children","style","rawStyle","useMemo","useRef","cssStyles","alignItems","backgroundColor","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","textDecoration","zIndex","createElement","Platform","exports","OS","PixelRatio","devicePixelRatio","resolveAsset","source","isRNModule","getAssetByID","httpServerLocation","name","uri","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { RefObject, CSSProperties } from \"react\";\nimport React, { useLayoutEffect, useMemo, useRef } from \"react\";\nimport type { LayoutChangeEvent, ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js\nconst DOM_LAYOUT_HANDLER_NAME = \"__reactLayoutHandler\";\ntype OnLayout = ((event: LayoutChangeEvent) => void) | undefined;\ntype Div = HTMLDivElement & {\n __reactLayoutHandler: OnLayout;\n};\n\nlet resizeObserver: ResizeObserver | null = null;\n\nconst getObserver = () => {\n if (resizeObserver == null) {\n resizeObserver = new window.ResizeObserver(function (entries) {\n entries.forEach((entry) => {\n const node = entry.target as Div;\n const { left, top, width, height } = entry.contentRect;\n const onLayout = node[DOM_LAYOUT_HANDLER_NAME];\n if (typeof onLayout === \"function\") {\n // setTimeout 0 is taken from react-native-web (UIManager)\n setTimeout(\n () =>\n onLayout({\n timeStamp: Date.now(),\n nativeEvent: { layout: { x: left, y: top, width, height } },\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n currentTarget: 0,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n target: 0,\n bubbles: false,\n cancelable: false,\n defaultPrevented: false,\n eventPhase: 0,\n isDefaultPrevented() {\n throw new Error(\"Method not supported on web.\");\n },\n isPropagationStopped() {\n throw new Error(\"Method not supported on web.\");\n },\n persist() {\n throw new Error(\"Method not supported on web.\");\n },\n preventDefault() {\n throw new Error(\"Method not supported on web.\");\n },\n stopPropagation() {\n throw new Error(\"Method not supported on web.\");\n },\n isTrusted: true,\n type: \"\",\n }),\n 0\n );\n }\n });\n });\n }\n return resizeObserver;\n};\n\nconst useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {\n const observer = getObserver();\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node !== null) {\n node[DOM_LAYOUT_HANDLER_NAME] = onLayout;\n }\n }, [ref, onLayout]);\n\n useLayoutEffect(() => {\n const node = ref.current;\n if (node != null && observer != null) {\n if (typeof node[DOM_LAYOUT_HANDLER_NAME] === \"function\") {\n observer.observe(node);\n } else {\n observer.unobserve(node);\n }\n }\n return () => {\n if (node != null && observer != null) {\n observer.unobserve(node);\n }\n };\n }, [observer, ref]);\n};\n\nconst View = (({ children, onLayout, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const ref = useRef<Div>(null);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n useElementLayout(ref as any, onLayout);\n const cssStyles = useMemo(() => {\n return {\n alignItems: \"stretch\" as const,\n backgroundColor: \"transparent\" as const,\n border: \"0 solid black\" as const,\n boxSizing: \"border-box\" as const,\n display: \"flex\" as const,\n flexBasis: \"auto\" as const,\n flexDirection: \"column\" as const,\n flexShrink: 0,\n listStyle: \"none\" as const,\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: \"relative\" as const,\n textDecoration: \"none\" as const,\n zIndex: 0,\n ...style,\n };\n }, [style]);\n\n return (\n <div ref={ref} style={cssStyles}>\n {children}\n </div>\n );\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: typeof window !== \"undefined\" ? window.devicePixelRatio : 1, // window is not defined on node\n resolveAsset: (source: DataModule) => {\n if (isRNModule(source)) {\n if (typeof source === \"number\" && typeof require === \"function\") {\n const {\n getAssetByID,\n } = require(\"react-native/Libraries/Image/AssetRegistry\");\n const { httpServerLocation, name, type } = getAssetByID(source);\n const uri = `${httpServerLocation}/${name}.${type}`;\n return uri;\n }\n throw new Error(\n \"Asset source is a number - this is not supported on the web\"\n );\n }\n if (\"uri\" in source) {\n return source.uri;\n }\n return source.default;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAA2C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAA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A,CAAAiF,aAAA;IAAK7B,GAAG,EAAEA,GAAI;IAACQ,KAAK,EAAEI;EAAU,GAC7BL,QACE,CAAC;AAEV,CAAqC;AAE9B,MAAMuB,QAAmB,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACjCE,EAAE,EAAE,KAAK;EACTC,UAAU,EAAE,OAAOpE,MAAM,KAAK,WAAW,GAAGA,MAAM,CAACqE,gBAAgB,GAAG,CAAC;EAAE;EACzEC,YAAY,EAAGC,MAAkB,IAAK;IACpC,IAAI,IAAAC,iBAAU,EAACD,MAAM,CAAC,EAAE;MACtB,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,OAAOhG,OAAO,KAAK,UAAU,EAAE;QAC/D,MAAM;UACJkG;QACF,CAAC,GAAGlG,OAAO,CAAC,4CAA4C,CAAC;QACzD,MAAM;UAAEmG,kBAAkB;UAAEC,IAAI;UAAE1C;QAAK,CAAC,GAAGwC,YAAY,CAACF,MAAM,CAAC;QAC/D,MAAMK,GAAG,GAAG,GAAGF,kBAAkB,IAAIC,IAAI,IAAI1C,IAAI,EAAE;QACnD,OAAO2C,GAAG;MACZ;MACA,MAAM,IAAIjD,KAAK,CACb,6DACF,CAAC;IACH;IACA,IAAI,KAAK,IAAI4C,MAAM,EAAE;MACnB,OAAOA,MAAM,CAACK,GAAG;IACnB;IACA,OAAOL,MAAM,CAACxF,OAAO;EACvB,CAAC;EACD8F,cAAc,EAAEA,CAAA,KAAM;IACpB,MAAM,IAAIlD,KAAK,CAAC,4CAA4C,CAAC;EAC/D,CAAC;EACDc;AACF,CAAC","ignoreList":[]}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Extrapolate = void 0;
7
7
  exports.interpolate = interpolate;
8
8
  exports.validateInterpolationOptions = validateInterpolationOptions;
9
- /* eslint-disable max-len */
10
9
  let Extrapolate = exports.Extrapolate = /*#__PURE__*/function (Extrapolate) {
11
10
  Extrapolate["IDENTITY"] = "identity";
12
11
  Extrapolate["CLAMP"] = "clamp";
@@ -1 +1 @@
1
- {"version":3,"names":["Extrapolate","exports","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["/* eslint-disable max-len */\nexport enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n \"worklet\";\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n \"worklet\";\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n \"worklet\";\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n \"worklet\";\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n \"worklet\";\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":";;;;;;;;AAAA;AAAA,IACYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA6BvB,SAASE,MAAMA,CACbC,IAAiB,EACjBC,IAAY,EACZC,GAAW,EACXC,cAAsB,EACtBC,eAAuB,EACvBC,CAAS,EACD;EACR,SAAS;;EACT,QAAQL,IAAI;IACV,KAAKH,WAAW,CAACS,QAAQ;MACvB,OAAOD,CAAC;IACV,KAAKR,WAAW,CAACU,KAAK;MACpB,IAAIN,IAAI,GAAGC,GAAG,GAAGD,IAAI,GAAGE,cAAc,EAAE;QACtC,OAAOA,cAAc;MACvB;MACA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AAC,CAAC;IACzBrB,eAAe,EAAEqB,MAAM,CAAC,CAAC;EAC3B,CAAC;EACD,IAAIC,MAAM,GAAG,CAAC,EAAE;IACd,IAAIrB,CAAC,GAAGmB,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC,EAAE;MACzBP,aAAa,CAACC,aAAa,GAAGI,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC;MAC/CP,aAAa,CAACE,cAAc,GAAGG,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC;MAChDP,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;MACjDP,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;IACpD,CAAC,MAAM;MACL,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAE,EAAEC,CAAC,EAAE;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAC,CAAC,EAAE;UACjBR,aAAa,CAACC,aAAa,GAAGI,KAAK,CAACG,CAAC,GAAG,CAAC,CAAC;UAC1CR,aAAa,CAACE,cAAc,GAAGG,KAAK,CAACG,CAAC,CAAC;UACvCR,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACE,CAAC,GAAG,CAAC,CAAC;UAC5CR,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACE,CAAC,CAAC;UACzC;QACF;MACF;IACF;EACF;EAEA,OAAOT,mBAAmB,CAACb,CAAC,EAAEc,aAAa,EAAEP,mBAAmB,CAAC;AACnE","ignoreList":[]}
1
+ {"version":3,"names":["Extrapolate","exports","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["export enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n \"worklet\";\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n \"worklet\";\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n \"worklet\";\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n \"worklet\";\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n \"worklet\";\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":";;;;;;;;IAAYA,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA6BvB,SAASE,MAAMA,CACbC,IAAiB,EACjBC,IAAY,EACZC,GAAW,EACXC,cAAsB,EACtBC,eAAuB,EACvBC,CAAS,EACD;EACR,SAAS;;EACT,QAAQL,IAAI;IACV,KAAKH,WAAW,CAACS,QAAQ;MACvB,OAAOD,CAAC;IACV,KAAKR,WAAW,CAACU,KAAK;MACpB,IAAIN,IAAI,GAAGC,GAAG,GAAGD,IAAI,GAAGE,cAAc,EAAE;QACtC,OAAOA,cAAc;MACvB;MACA,OAAOC,eAAe;IACxB,KAAKP,WAAW,CAACW,MAAM;IACvB;MACE,OAAON,GAAG;EACd;AACF;AAEA,SAASO,aAAaA,CAACC,KAAa,EAAwB;EAC1D,SAAS;;EACT,OACEA,KAAK,KAAKb,WAAW,CAACW,MAAM,IAC5BE,KAAK,KAAKb,WAAW,CAACU,KAAK,IAC3BG,KAAK,KAAKb,WAAW,CAACS,QAAQ;AAElC;;AAEA;AACA;AACO,SAASK,4BAA4BA,CAC1CX,IAAuB,E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MAChDP,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;MACjDP,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;IACpD,CAAC,MAAM;MACL,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAE,EAAEC,CAAC,EAAE;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAC,CAAC,EAAE;UACjBR,aAAa,CAACC,aAAa,GAAGI,KAAK,CAACG,CAAC,GAAG,CAAC,CAAC;UAC1CR,aAAa,CAACE,cAAc,GAAGG,KAAK,CAACG,CAAC,CAAC;UACvCR,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACE,CAAC,GAAG,CAAC,CAAC;UAC5CR,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACE,CAAC,CAAC;UACzC;QACF;MACF;IACF;EACF;EAEA,OAAOT,mBAAmB,CAACb,CAAC,EAAEc,aAAa,EAAEP,mBAAmB,CAAC;AACnE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_typeddash","require","size","width","height","exports","rect2rect","src","dst","scaleX","scaleY","translateX","x","translateY","y","inscribe","rect","halfWidthDelta","halfHeightDelta","applyBoxFit","fit","input","output","Math","min","aspectRatio","exhaustiveCheck","fitRects","sizes"],"sources":["Fitting.ts"],"sourcesContent":["import { exhaustiveCheck } from \"../../../renderer/typeddash\";\nimport type { SkRect } from \"../../../skia/types\";\nimport type { Fit } from \"../../types\";\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport const size = (width = 0, height = 0) => {\n \"worklet\";\n return { width, height };\n};\n\nexport const rect2rect = (\n src: SkRect,\n dst: SkRect\n): [\n { translateX: number },\n { translateY: number },\n { scaleX: number },\n { scaleY: number }\n] => {\n \"worklet\";\n const scaleX = dst.width / src.width;\n const scaleY = dst.height / src.height;\n const translateX = dst.x - src.x * scaleX;\n const translateY = dst.y - src.y * scaleY;\n return [{ translateX }, { translateY }, { scaleX }, { scaleY }];\n};\n\nconst inscribe = (\n { width, height }: Size,\n rect: { x: number; y: number; width: number; height: number }\n) => {\n \"worklet\";\n const halfWidthDelta = (rect.width - width) / 2.0;\n const halfHeightDelta = (rect.height - height) / 2.0;\n return {\n x: rect.x + halfWidthDelta,\n y: rect.y + halfHeightDelta,\n width,\n height,\n };\n};\n\nconst applyBoxFit = (fit: Fit, input: Size, output: Size) => {\n \"worklet\";\n let src = size(),\n dst = size();\n if (\n input.height <= 0.0 ||\n input.width <= 0.0 ||\n output.height <= 0.0 ||\n output.width <= 0.0\n ) {\n return { src, dst };\n }\n switch (fit) {\n case \"fill\":\n src = input;\n dst = output;\n break;\n case \"contain\":\n src = input;\n if (output.width / output.height > src.width / src.height) {\n dst = size((src.width * output.height) / src.height, output.height);\n } else {\n dst = size(output.width, (src.height * output.width) / src.width);\n }\n break;\n case \"cover\":\n if (output.width / output.height > input.width / input.height) {\n src = size(input.width, (input.width * output.height) / output.width);\n } else {\n src = size((input.height * output.width) / output.height, input.height);\n }\n dst = output;\n break;\n case \"fitWidth\":\n src = size(input.width, (input.width * output.height) / output.width);\n dst = size(output.width, (src.height * output.width) / src.width);\n break;\n case \"fitHeight\":\n src = size((input.height * output.width) / output.height, input.height);\n dst = size((src.width * output.height) / src.height, output.height);\n break;\n case \"none\":\n src = size(\n Math.min(input.width, output.width),\n Math.min(input.height, output.height)\n );\n dst = src;\n break;\n case \"scaleDown\":\n src = input;\n dst = input;\n const aspectRatio = input.width / input.height;\n if (dst.height > output.height) {\n dst = size(output.height * aspectRatio, output.height);\n }\n if (dst.width > output.width) {\n dst = size(output.width, output.width / aspectRatio);\n }\n break;\n default:\n exhaustiveCheck(fit);\n }\n return { src, dst };\n};\n\nexport const fitRects = (\n fit: Fit,\n rect: SkRect,\n { x, y, width, height }: SkRect\n) => {\n \"worklet\";\n const sizes = applyBoxFit(\n fit,\n { width: rect.width, height: rect.height },\n { width, height }\n );\n const src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,GAAG,CAACJ,MAAM,GAAGkB,MAAM,CAAClB,MAAM,EAAE;QAC9BI,GAAG,GAAGN,IAAI,CAACoB,MAAM,CAAClB,MAAM,GAAGqB,WAAW,EAAEH,MAAM,CAAClB,MAAM,CAAC;MACxD;MACA,IAAII,GAAG,CAACL,KAAK,GAAGmB,MAAM,CAACnB,KAAK,EAAE;QAC5BK,GAAG,GAAGN,IAAI,CAACoB,MAAM,CAACnB,KAAK,EAAEmB,MAAM,CAACnB,KAAK,GAAGsB,WAAW,CAAC;MACtD;MACA;IACF;MACE,IAAAC,0BAAe,EAACN,GAAG,CAAC;EACxB;EACA,OAAO;IAAEb,GAAG;IAAEC;EAAI,CAAC;AACrB,CAAC;AAEM,MAAMmB,QAAQ,GAAGA,CACtBP,GAAQ,EACRJ,IAAY,EACZ;EAAEJ,CAAC;EAAEE,CAAC;EAAEX,KAAK;EAAEC;AAAe,CAAC,KAC5B;EACH,SAAS;;EACT,MAAMwB,KAAK,GAAGT,WAAW,CACvBC,GAAG,EACH;IAAEjB,KAAK,EAAEa,IAAI,CAACb,KAAK;IAAEC,MAAM,EAAEY,IAAI,CAACZ;EAAO,CAAC,EAC1C;IAAED,KAAK;IAAEC;EAAO,CAClB,CAAC;EACD,MAAMG,GAAG,GAAGQ,QAAQ,CAACa,KAAK,CAACrB,GAAG,EAAES,IAAI,CAAC;EACrC,MAAMR,GAAG,GAAGO,QAAQ,CAACa,KAAK,CAACpB,GAAG,EAAE;IAC9BI,CAAC;IACDE,CAAC;IACDX,KAAK;IACLC;EACF,CAAC,CAAC;EACF,OAAO;IAAEG,GAAG;IAAEC;EAAI,CAAC;AACrB,CAAC;AAACH,OAAA,CAAAsB,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_typeddash","require","size","width","height","exports","rect2rect","src","dst","scaleX","scaleY","translateX","x","translateY","y","inscribe","rect","halfWidthDelta","halfHeightDelta","applyBoxFit","fit","input","output","Math","min","aspectRatio","exhaustiveCheck","fitRects","sizes"],"sources":["Fitting.ts"],"sourcesContent":["import { exhaustiveCheck } from \"../../../renderer/typeddash\";\nimport type { SkRect } from \"../../../skia/types\";\nimport type { Fit } from \"../../types\";\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport const size = (width = 0, height = 0) => {\n \"worklet\";\n return { width, height };\n};\n\nexport const rect2rect = (\n src: SkRect,\n dst: SkRect\n): [\n { translateX: number },\n { translateY: number },\n { scaleX: number },\n { scaleY: number },\n] => {\n \"worklet\";\n const scaleX = dst.width / src.width;\n const scaleY = dst.height / src.height;\n const translateX = dst.x - src.x * scaleX;\n const translateY = dst.y - src.y * scaleY;\n return [{ translateX }, { translateY }, { scaleX }, { scaleY }];\n};\n\nconst inscribe = (\n { width, height }: Size,\n rect: { x: number; y: number; width: number; height: number }\n) => {\n \"worklet\";\n const halfWidthDelta = (rect.width - width) / 2.0;\n const halfHeightDelta = (rect.height - height) / 2.0;\n return {\n x: rect.x + halfWidthDelta,\n y: rect.y + halfHeightDelta,\n width,\n height,\n };\n};\n\nconst applyBoxFit = (fit: Fit, input: Size, output: Size) => {\n \"worklet\";\n let src = size(),\n dst = size();\n if (\n input.height <= 0.0 ||\n input.width <= 0.0 ||\n output.height <= 0.0 ||\n output.width <= 0.0\n ) {\n return { src, dst };\n }\n switch (fit) {\n case \"fill\":\n src = input;\n dst = output;\n break;\n case \"contain\":\n src = input;\n if (output.width / output.height > src.width / src.height) {\n dst = size((src.width * output.height) / src.height, output.height);\n } else {\n dst = size(output.width, (src.height * output.width) / src.width);\n }\n break;\n case \"cover\":\n if (output.width / output.height > input.width / input.height) {\n src = size(input.width, (input.width * output.height) / output.width);\n } else {\n src = size((input.height * output.width) / output.height, input.height);\n }\n dst = output;\n break;\n case \"fitWidth\":\n src = size(input.width, (input.width * output.height) / output.width);\n dst = size(output.width, (src.height * output.width) / src.width);\n break;\n case \"fitHeight\":\n src = size((input.height * output.width) / output.height, input.height);\n dst = size((src.width * output.height) / src.height, output.height);\n break;\n case \"none\":\n src = size(\n Math.min(input.width, output.width),\n Math.min(input.height, output.height)\n );\n dst = src;\n break;\n case \"scaleDown\":\n src = input;\n dst = input;\n const aspectRatio = input.width / input.height;\n if (dst.height > output.height) {\n dst = size(output.height * aspectRatio, output.height);\n }\n if (dst.width > output.width) {\n dst = size(output.width, output.width / aspectRatio);\n }\n break;\n default:\n exhaustiveCheck(fit);\n }\n return { src, dst };\n};\n\nexport const fitRects = (\n fit: Fit,\n rect: SkRect,\n { x, y, width, height }: SkRect\n) => {\n \"worklet\";\n const sizes = applyBoxFit(\n fit,\n { width: rect.width, height: rect.height },\n { width, height }\n );\n const src = inscribe(sizes.src, rect);\n const dst = inscribe(sizes.dst, {\n x,\n y,\n width,\n height,\n });\n return { src, dst };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AASO,MAAMC,IAAI,GAAGA,CAACC,KAAK,GAAG,CAAC,EAAEC,MAAM,GAAG,CAAC,KAAK;EAC7C,SAAS;;EACT,OAAO;IAAED,KAAK;IAAEC;EAAO,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAH,IAAA,GAAAA,IAAA;AAEK,MAAMI,SAAS,GAAGA,CACvBC,GAAW,EACXC,GAAW,KAMR;EACH,SAAS;;EACT,MAAMC,MAAM,GAAGD,GAAG,CAACL,KAAK,GAAGI,GAAG,CAACJ,KAAK;EACpC,MAAMO,MAAM,GAAGF,GAAG,CAACJ,MAAM,GAAGG,GAAG,CAACH,MAAM;EACtC,MAAMO,UAAU,GAAGH,GAAG,CAACI,CAAC,GAAGL,GAAG,CAACK,CAAC,GAAGH,MAAM;EACzC,MAAMI,UAAU,GAAGL,GAAG,CAACM,CAAC,GAAGP,GAAG,CAACO,CAAC,GAAGJ,MAAM;EACzC,OAAO,CAAC;IAAEC;EAAW,CAAC,EAAE;IAAEE;EAAW,CAAC,EAAE;IAAEJ;EAAO,CAAC,EAAE;IAAEC;EAAO,CAAC,CAAC;AACjE,CAAC;AAACL,OAAA,CAAA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,MAAMR,GAAG,GAAGO,QAAQ,CAACa,KAAK,CAACpB,GAAG,EAAE;IAC9BI,CAAC;IACDE,CAAC;IACDX,KAAK;IACLC;EACF,CAAC,CAAC;EACF,OAAO;IAAEG,GAAG;IAAEC;EAAI,CAAC;AACrB,CAAC;AAACH,OAAA,CAAAsB,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n sampling?: SamplingOptions;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n sampling?: SamplingOptions;\n}\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n SkRSXform,\n SkColor,\n SamplingOptions,\n SkSkottieAnimation,\n SkImageFilter,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage | null;\n sampling?: SamplingOptions;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface AtlasProps extends DrawingNodeProps {\n image: SkImage | null;\n sprites: SkRect[];\n transforms: SkRSXform[];\n colors?: SkColor[];\n sampling?: SamplingOptions;\n}\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport interface ImageSVGProps extends DrawingNodeProps {\n svg: SkSVG | null;\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n rect?: SkRect;\n}\n\nexport interface SkottieProps extends DrawingNodeProps {\n animation: SkSkottieAnimation;\n frame: number;\n}\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont | null;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont | null;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n\nexport interface ImageFilterProps extends GroupProps {\n filter: SkImageFilter;\n}\n"],"mappings":"","ignoreList":[]}