@shopify/react-native-skia 0.1.191 → 0.1.192

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. package/cpp/api/JsiSkColorFilter.h +2 -17
  2. package/cpp/api/JsiSkContourMeasure.h +3 -17
  3. package/cpp/api/JsiSkContourMeasureIter.h +3 -18
  4. package/cpp/api/JsiSkData.h +1 -18
  5. package/cpp/api/JsiSkFont.h +4 -14
  6. package/cpp/api/JsiSkHostObjects.h +85 -10
  7. package/cpp/api/JsiSkImage.h +1 -12
  8. package/cpp/api/JsiSkImageFilter.h +1 -17
  9. package/cpp/api/JsiSkMaskFilter.h +1 -17
  10. package/cpp/api/JsiSkMatrix.h +3 -6
  11. package/cpp/api/JsiSkPaint.h +3 -15
  12. package/cpp/api/JsiSkPath.h +2 -15
  13. package/cpp/api/JsiSkPathEffect.h +2 -17
  14. package/cpp/api/JsiSkPicture.h +4 -18
  15. package/cpp/api/JsiSkPictureRecorder.h +4 -1
  16. package/cpp/api/JsiSkPoint.h +6 -1
  17. package/cpp/api/JsiSkRRect.h +6 -1
  18. package/cpp/api/JsiSkRSXform.h +4 -6
  19. package/cpp/api/JsiSkRect.h +6 -2
  20. package/cpp/api/JsiSkRuntimeEffect.h +4 -7
  21. package/cpp/api/JsiSkRuntimeShaderBuilder.h +2 -10
  22. package/cpp/api/JsiSkSVG.h +1 -10
  23. package/cpp/api/JsiSkShader.h +2 -16
  24. package/cpp/api/JsiSkSurface.h +3 -16
  25. package/cpp/api/JsiSkTextBlob.h +2 -18
  26. package/cpp/api/JsiSkTypeface.h +1 -22
  27. package/cpp/api/JsiSkVertices.h +3 -17
  28. package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -2
  29. package/cpp/rnskia/values/RNSkValue.h +1 -1
  30. package/lib/commonjs/renderer/Canvas.js +17 -1
  31. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  32. package/lib/commonjs/skia/core/Data.d.ts +2 -2
  33. package/lib/commonjs/skia/core/Data.js.map +1 -1
  34. package/lib/commonjs/skia/types/Data/Data.d.ts +2 -2
  35. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  36. package/lib/commonjs/skia/types/Image/Image.d.ts +2 -2
  37. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  38. package/lib/commonjs/skia/types/JsiInstance.d.ts +4 -4
  39. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  40. package/lib/commonjs/skia/types/SVG/SVG.d.ts +2 -2
  41. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  42. package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +2 -2
  43. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  44. package/lib/commonjs/skia/web/Host.d.ts +1 -0
  45. package/lib/commonjs/skia/web/Host.js +2 -0
  46. package/lib/commonjs/skia/web/Host.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -0
  48. package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -0
  49. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  50. package/lib/commonjs/skia/web/JsiSkColorFilter.d.ts +1 -0
  51. package/lib/commonjs/skia/web/JsiSkColorFilter.js +6 -0
  52. package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
  53. package/lib/commonjs/skia/web/JsiSkContourMeasure.d.ts +1 -0
  54. package/lib/commonjs/skia/web/JsiSkContourMeasure.js +6 -0
  55. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
  56. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  57. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +6 -0
  58. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  59. package/lib/commonjs/skia/web/JsiSkData.d.ts +1 -1
  60. package/lib/commonjs/skia/web/JsiSkData.js +4 -2
  61. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  62. package/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -0
  63. package/lib/commonjs/skia/web/JsiSkFont.js +6 -0
  64. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  65. package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -1
  66. package/lib/commonjs/skia/web/JsiSkImage.js +6 -4
  67. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  68. package/lib/commonjs/skia/web/JsiSkImageFilter.d.ts +1 -0
  69. package/lib/commonjs/skia/web/JsiSkImageFilter.js +6 -0
  70. package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
  71. package/lib/commonjs/skia/web/JsiSkMaskFilter.d.ts +1 -0
  72. package/lib/commonjs/skia/web/JsiSkMaskFilter.js +6 -0
  73. package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
  74. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +1 -0
  75. package/lib/commonjs/skia/web/JsiSkMatrix.js +5 -0
  76. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  77. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  78. package/lib/commonjs/skia/web/JsiSkPaint.js +6 -0
  79. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  80. package/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -0
  81. package/lib/commonjs/skia/web/JsiSkPath.js +6 -0
  82. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  83. package/lib/commonjs/skia/web/JsiSkPathEffect.d.ts +1 -0
  84. package/lib/commonjs/skia/web/JsiSkPathEffect.js +6 -0
  85. package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
  86. package/lib/commonjs/skia/web/JsiSkPicture.d.ts +1 -0
  87. package/lib/commonjs/skia/web/JsiSkPicture.js +6 -1
  88. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  89. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  90. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +6 -0
  91. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  92. package/lib/commonjs/skia/web/JsiSkPoint.d.ts +1 -0
  93. package/lib/commonjs/skia/web/JsiSkPoint.js +5 -0
  94. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  95. package/lib/commonjs/skia/web/JsiSkRRect.d.ts +1 -0
  96. package/lib/commonjs/skia/web/JsiSkRRect.js +5 -0
  97. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  98. package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +1 -0
  99. package/lib/commonjs/skia/web/JsiSkRSXform.js +5 -0
  100. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  101. package/lib/commonjs/skia/web/JsiSkRect.d.ts +1 -0
  102. package/lib/commonjs/skia/web/JsiSkRect.js +5 -0
  103. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  104. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  105. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -0
  106. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  107. package/lib/commonjs/skia/web/JsiSkShader.d.ts +1 -0
  108. package/lib/commonjs/skia/web/JsiSkShader.js +6 -0
  109. package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
  110. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  111. package/lib/commonjs/skia/web/JsiSkSurface.js +6 -0
  112. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  113. package/lib/commonjs/skia/web/JsiSkTextBlob.d.ts +1 -0
  114. package/lib/commonjs/skia/web/JsiSkTextBlob.js +6 -0
  115. package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
  116. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -1
  117. package/lib/commonjs/skia/web/JsiSkTypeface.js +6 -4
  118. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  119. package/lib/commonjs/skia/web/JsiSkVertices.d.ts +1 -0
  120. package/lib/commonjs/skia/web/JsiSkVertices.js +6 -0
  121. package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
  122. package/lib/commonjs/values/hooks/useComputedValue.js +1 -1
  123. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  124. package/lib/commonjs/values/types.d.ts +1 -1
  125. package/lib/commonjs/values/types.js.map +1 -1
  126. package/lib/commonjs/values/web/RNSkComputedValue.d.ts +1 -1
  127. package/lib/commonjs/values/web/RNSkComputedValue.js +1 -1
  128. package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
  129. package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +1 -1
  130. package/lib/commonjs/values/web/RNSkReadonlyValue.js +1 -1
  131. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
  132. package/lib/commonjs/views/SkiaDomView.web.js +14 -4
  133. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  134. package/lib/commonjs/views/types.d.ts +2 -1
  135. package/lib/commonjs/views/types.js.map +1 -1
  136. package/lib/module/renderer/Canvas.js +15 -1
  137. package/lib/module/renderer/Canvas.js.map +1 -1
  138. package/lib/module/skia/core/Data.d.ts +2 -2
  139. package/lib/module/skia/core/Data.js.map +1 -1
  140. package/lib/module/skia/types/Data/Data.d.ts +2 -2
  141. package/lib/module/skia/types/Data/Data.js.map +1 -1
  142. package/lib/module/skia/types/Image/Image.d.ts +2 -2
  143. package/lib/module/skia/types/Image/Image.js.map +1 -1
  144. package/lib/module/skia/types/JsiInstance.d.ts +4 -4
  145. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  146. package/lib/module/skia/types/SVG/SVG.d.ts +2 -2
  147. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  148. package/lib/module/skia/types/Typeface/Typeface.d.ts +2 -2
  149. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  150. package/lib/module/skia/web/Host.d.ts +1 -0
  151. package/lib/module/skia/web/Host.js +2 -0
  152. package/lib/module/skia/web/Host.js.map +1 -1
  153. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -0
  154. package/lib/module/skia/web/JsiSkCanvas.js +6 -0
  155. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  156. package/lib/module/skia/web/JsiSkColorFilter.d.ts +1 -0
  157. package/lib/module/skia/web/JsiSkColorFilter.js +6 -0
  158. package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
  159. package/lib/module/skia/web/JsiSkContourMeasure.d.ts +1 -0
  160. package/lib/module/skia/web/JsiSkContourMeasure.js +6 -0
  161. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  162. package/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  163. package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -0
  164. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  165. package/lib/module/skia/web/JsiSkData.d.ts +1 -1
  166. package/lib/module/skia/web/JsiSkData.js +4 -2
  167. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  168. package/lib/module/skia/web/JsiSkFont.d.ts +1 -0
  169. package/lib/module/skia/web/JsiSkFont.js +6 -0
  170. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  171. package/lib/module/skia/web/JsiSkImage.d.ts +1 -1
  172. package/lib/module/skia/web/JsiSkImage.js +6 -4
  173. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  174. package/lib/module/skia/web/JsiSkImageFilter.d.ts +1 -0
  175. package/lib/module/skia/web/JsiSkImageFilter.js +6 -0
  176. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
  177. package/lib/module/skia/web/JsiSkMaskFilter.d.ts +1 -0
  178. package/lib/module/skia/web/JsiSkMaskFilter.js +6 -0
  179. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
  180. package/lib/module/skia/web/JsiSkMatrix.d.ts +1 -0
  181. package/lib/module/skia/web/JsiSkMatrix.js +5 -0
  182. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  183. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  184. package/lib/module/skia/web/JsiSkPaint.js +6 -0
  185. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  186. package/lib/module/skia/web/JsiSkPath.d.ts +1 -0
  187. package/lib/module/skia/web/JsiSkPath.js +6 -0
  188. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  189. package/lib/module/skia/web/JsiSkPathEffect.d.ts +1 -0
  190. package/lib/module/skia/web/JsiSkPathEffect.js +6 -0
  191. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
  192. package/lib/module/skia/web/JsiSkPicture.d.ts +1 -0
  193. package/lib/module/skia/web/JsiSkPicture.js +6 -0
  194. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  195. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  196. package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -0
  197. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  198. package/lib/module/skia/web/JsiSkPoint.d.ts +1 -0
  199. package/lib/module/skia/web/JsiSkPoint.js +5 -0
  200. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  201. package/lib/module/skia/web/JsiSkRRect.d.ts +1 -0
  202. package/lib/module/skia/web/JsiSkRRect.js +5 -0
  203. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  204. package/lib/module/skia/web/JsiSkRSXform.d.ts +1 -0
  205. package/lib/module/skia/web/JsiSkRSXform.js +5 -0
  206. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  207. package/lib/module/skia/web/JsiSkRect.d.ts +1 -0
  208. package/lib/module/skia/web/JsiSkRect.js +5 -0
  209. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  210. package/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  211. package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -0
  212. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  213. package/lib/module/skia/web/JsiSkShader.d.ts +1 -0
  214. package/lib/module/skia/web/JsiSkShader.js +6 -0
  215. package/lib/module/skia/web/JsiSkShader.js.map +1 -1
  216. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  217. package/lib/module/skia/web/JsiSkSurface.js +6 -0
  218. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  219. package/lib/module/skia/web/JsiSkTextBlob.d.ts +1 -0
  220. package/lib/module/skia/web/JsiSkTextBlob.js +6 -0
  221. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
  222. package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -1
  223. package/lib/module/skia/web/JsiSkTypeface.js +6 -4
  224. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  225. package/lib/module/skia/web/JsiSkVertices.d.ts +1 -0
  226. package/lib/module/skia/web/JsiSkVertices.js +6 -0
  227. package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
  228. package/lib/module/values/hooks/useComputedValue.js +1 -1
  229. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  230. package/lib/module/values/types.d.ts +1 -1
  231. package/lib/module/values/types.js.map +1 -1
  232. package/lib/module/values/web/RNSkComputedValue.d.ts +1 -1
  233. package/lib/module/values/web/RNSkComputedValue.js +1 -1
  234. package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
  235. package/lib/module/values/web/RNSkReadonlyValue.d.ts +1 -1
  236. package/lib/module/values/web/RNSkReadonlyValue.js +1 -1
  237. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
  238. package/lib/module/views/SkiaDomView.web.js +13 -4
  239. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  240. package/lib/module/views/types.d.ts +2 -1
  241. package/lib/module/views/types.js.map +1 -1
  242. package/lib/typescript/src/skia/core/Data.d.ts +2 -2
  243. package/lib/typescript/src/skia/types/Data/Data.d.ts +2 -2
  244. package/lib/typescript/src/skia/types/Image/Image.d.ts +2 -2
  245. package/lib/typescript/src/skia/types/JsiInstance.d.ts +4 -4
  246. package/lib/typescript/src/skia/types/SVG/SVG.d.ts +2 -2
  247. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +2 -2
  248. package/lib/typescript/src/skia/web/Host.d.ts +1 -0
  249. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -0
  250. package/lib/typescript/src/skia/web/JsiSkColorFilter.d.ts +1 -0
  251. package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +1 -0
  252. package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
  253. package/lib/typescript/src/skia/web/JsiSkData.d.ts +1 -1
  254. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -0
  255. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -1
  256. package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +1 -0
  257. package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +1 -0
  258. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +1 -0
  259. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  260. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +1 -0
  261. package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +1 -0
  262. package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +1 -0
  263. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -0
  264. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +1 -0
  265. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +1 -0
  266. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -0
  267. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +1 -0
  268. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
  269. package/lib/typescript/src/skia/web/JsiSkShader.d.ts +1 -0
  270. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
  271. package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +1 -0
  272. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -1
  273. package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +1 -0
  274. package/lib/typescript/src/values/types.d.ts +1 -1
  275. package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -1
  276. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -1
  277. package/lib/typescript/src/views/types.d.ts +2 -1
  278. package/package.json +1 -1
  279. package/src/renderer/Canvas.tsx +21 -1
  280. package/src/skia/core/Data.ts +3 -3
  281. package/src/skia/types/Data/Data.ts +2 -2
  282. package/src/skia/types/Image/Image.ts +2 -2
  283. package/src/skia/types/JsiInstance.ts +4 -4
  284. package/src/skia/types/SVG/SVG.ts +2 -2
  285. package/src/skia/types/Typeface/Typeface.ts +2 -2
  286. package/src/skia/web/Host.ts +2 -0
  287. package/src/skia/web/JsiSkCanvas.ts +4 -0
  288. package/src/skia/web/JsiSkColorFilter.ts +4 -0
  289. package/src/skia/web/JsiSkContourMeasure.ts +4 -0
  290. package/src/skia/web/JsiSkContourMeasureIter.ts +4 -0
  291. package/src/skia/web/JsiSkData.ts +3 -3
  292. package/src/skia/web/JsiSkFont.ts +4 -0
  293. package/src/skia/web/JsiSkImage.ts +2 -2
  294. package/src/skia/web/JsiSkImageFilter.ts +4 -0
  295. package/src/skia/web/JsiSkMaskFilter.ts +4 -0
  296. package/src/skia/web/JsiSkMatrix.ts +4 -0
  297. package/src/skia/web/JsiSkPaint.ts +4 -0
  298. package/src/skia/web/JsiSkPath.ts +4 -0
  299. package/src/skia/web/JsiSkPathEffect.ts +4 -0
  300. package/src/skia/web/JsiSkPicture.ts +4 -0
  301. package/src/skia/web/JsiSkPictureRecorder.ts +4 -0
  302. package/src/skia/web/JsiSkPoint.ts +4 -0
  303. package/src/skia/web/JsiSkRRect.ts +4 -0
  304. package/src/skia/web/JsiSkRSXform.ts +4 -0
  305. package/src/skia/web/JsiSkRect.ts +4 -0
  306. package/src/skia/web/JsiSkRuntimeEffect.ts +4 -0
  307. package/src/skia/web/JsiSkShader.ts +4 -0
  308. package/src/skia/web/JsiSkSurface.ts +4 -0
  309. package/src/skia/web/JsiSkTextBlob.ts +4 -0
  310. package/src/skia/web/JsiSkTypeface.ts +2 -2
  311. package/src/skia/web/JsiSkVertices.ts +4 -0
  312. package/src/values/hooks/useComputedValue.ts +1 -1
  313. package/src/values/types.ts +1 -1
  314. package/src/values/web/RNSkComputedValue.ts +1 -1
  315. package/src/values/web/RNSkReadonlyValue.ts +1 -1
  316. package/src/views/SkiaDomView.web.tsx +6 -1
  317. package/src/views/types.ts +2 -1
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
2
2
  import type { GroupProps, RenderNode } from "../dom/types";
3
3
  import type { SkCanvas, SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
4
4
  import type { SkiaMutableValue, SkiaValue } from "../values";
5
+ import type { SharedValueType } from "../renderer/processors/Animations/Animations";
5
6
  export declare type DrawMode = "continuous" | "default";
6
7
  export declare type NativeSkiaViewProps = ViewProps & {
7
8
  mode?: DrawMode;
@@ -70,7 +71,7 @@ export interface SkiaBaseViewProps extends ViewProps {
70
71
  * Pass an animated value to the onSize property to get updates when
71
72
  * the Skia view is resized.
72
73
  */
73
- onSize?: SkiaMutableValue<SkSize>;
74
+ onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;
74
75
  }
75
76
  export interface SkiaDrawViewProps extends SkiaBaseViewProps {
76
77
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAmBA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S"}
1
+ {"version":3,"names":["TouchType"],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { GroupProps, RenderNode } from \"../dom/types\";\nimport type {\n SkCanvas,\n SkImage,\n SkPicture,\n SkRect,\n SkSize,\n} from \"../skia/types\";\nimport type { SkiaMutableValue, SkiaValue } from \"../values\";\nimport type { SharedValueType } from \"../renderer/processors/Animations/Animations\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Pass an animated value to the onSize property to get updates when\n * the Skia view is resized.\n */\n onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;\n}\n\nexport interface SkiaDrawViewProps extends SkiaBaseViewProps {\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport interface SkiaPictureViewProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n}\n\nexport interface SkiaDomViewProps extends SkiaBaseViewProps {\n root?: RenderNode<GroupProps>;\n onTouch?: TouchHandler;\n}\n"],"mappings":"AAoBA,WAAYA,SAAZ;;WAAYA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S"}
@@ -1,3 +1,3 @@
1
- import type { SkData, DataSourceParam, JsiDisposable } from "../types";
2
- export declare const useRawData: <T extends JsiDisposable>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => T | null;
1
+ import type { SkData, DataSourceParam, BaseSkJSIInstance } from "../types";
2
+ export declare const useRawData: <T extends BaseSkJSIInstance>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => T | null;
3
3
  export declare const useData: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => SkData | null;
@@ -1,5 +1,5 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
- export declare type SkData = SkJSIInstance<"Data"> & JsiDisposable;
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
+ export declare type SkData = SkJSIInstance<"Data">;
3
3
  declare type RNModule = number;
4
4
  declare type ESModule = {
5
5
  __esModule: true;
@@ -1,5 +1,5 @@
1
1
  import type { SkMatrix } from "../Matrix";
2
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
+ import type { SkJSIInstance } from "../JsiInstance";
3
3
  import type { TileMode } from "../ImageFilter";
4
4
  import type { SkShader } from "../Shader";
5
5
  export declare enum FilterMode {
@@ -16,7 +16,7 @@ export declare enum ImageFormat {
16
16
  PNG = 4,
17
17
  WEBP = 6
18
18
  }
19
- export interface SkImage extends SkJSIInstance<"Image">, JsiDisposable {
19
+ export interface SkImage extends SkJSIInstance<"Image"> {
20
20
  /**
21
21
  * Returns the possibly scaled height of the image.
22
22
  */
@@ -1,6 +1,6 @@
1
- export interface SkJSIInstance<T extends string> {
2
- __typename__: T;
3
- }
4
- export interface JsiDisposable {
1
+ export interface BaseSkJSIInstance {
5
2
  dispose: () => void;
6
3
  }
4
+ export interface SkJSIInstance<T extends string> extends BaseSkJSIInstance {
5
+ __typename__: T;
6
+ }
@@ -1,5 +1,5 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
- export interface SkSVG extends SkJSIInstance<"SVG">, JsiDisposable {
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
+ export interface SkSVG extends SkJSIInstance<"SVG"> {
3
3
  width(): number;
4
4
  height(): number;
5
5
  }
@@ -1,2 +1,2 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
- export declare type SkTypeface = SkJSIInstance<"Typeface"> & JsiDisposable;
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
+ export declare type SkTypeface = SkJSIInstance<"Typeface">;
@@ -11,6 +11,7 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
11
11
  readonly __typename__: N;
12
12
  ref: T;
13
13
  constructor(CanvasKit: CanvasKit, ref: T, typename: N);
14
+ abstract dispose: () => void;
14
15
  }
15
16
  export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
16
17
  static fromValue<T>(value: SkJSIInstance<string>): T;
@@ -3,6 +3,7 @@ import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFla
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements SkCanvas {
5
5
  constructor(CanvasKit: CanvasKit, ref: Canvas);
6
+ dispose: () => void;
6
7
  drawRect(rect: SkRect, paint: SkPaint): void;
7
8
  drawImage(image: SkImage, x: number, y: number, paint?: SkPaint): void;
8
9
  drawImageRect(img: SkImage, src: SkRect, dest: SkRect, paint: SkPaint, fastSample?: boolean): void;
@@ -3,4 +3,5 @@ import type { SkColorFilter } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkColorFilter extends HostObject<ColorFilter, "ColorFilter"> implements SkColorFilter {
5
5
  constructor(CanvasKit: CanvasKit, ref: ColorFilter);
6
+ dispose: () => void;
6
7
  }
@@ -9,4 +9,5 @@ export declare class JsiSkContourMeasure extends HostObject<ContourMeasure, "Con
9
9
  getSegment(startD: number, stopD: number, startWithMoveTo: boolean): JsiSkPath;
10
10
  isClosed(): boolean;
11
11
  length(): number;
12
+ dispose: () => void;
12
13
  }
@@ -5,4 +5,5 @@ import { JsiSkContourMeasure } from "./JsiSkContourMeasure";
5
5
  export declare class JsiSkContourMeasureIter extends HostObject<ContourMeasureIter, "ContourMeasureIter"> implements SkContourMeasureIter {
6
6
  constructor(CanvasKit: CanvasKit, ref: ContourMeasureIter);
7
7
  next(): JsiSkContourMeasure | null;
8
+ dispose: () => void;
8
9
  }
@@ -4,6 +4,6 @@ import { HostObject } from "./Host";
4
4
  declare type Data = ArrayBuffer;
5
5
  export declare class JsiSkData extends HostObject<Data, "Data"> implements SkData {
6
6
  constructor(CanvasKit: CanvasKit, ref: Data);
7
- dispose(): void;
7
+ dispose: () => void;
8
8
  }
9
9
  export {};
@@ -5,6 +5,7 @@ import { JsiSkRect } from "./JsiSkRect";
5
5
  import { JsiSkTypeface } from "./JsiSkTypeface";
6
6
  export declare class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
7
7
  constructor(CanvasKit: CanvasKit, ref: Font);
8
+ dispose: () => void;
8
9
  getTextWidth(text: string, paint?: SkPaint | undefined): number;
9
10
  getMetrics(): {
10
11
  ascent: number;
@@ -10,6 +10,6 @@ export declare class JsiSkImage extends HostObject<Image, "Image"> implements Sk
10
10
  makeShaderCubic(tx: TileMode, ty: TileMode, B: number, C: number, localMatrix?: SkMatrix): SkShader;
11
11
  encodeToBytes(fmt?: ImageFormat, quality?: number): Uint8Array;
12
12
  encodeToBase64(fmt?: ImageFormat, quality?: number): string;
13
- dispose(): void;
13
+ dispose: () => void;
14
14
  makeNonTextureImage(): SkImage;
15
15
  }
@@ -3,4 +3,5 @@ import type { SkImageFilter } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkImageFilter extends HostObject<ImageFilter, "ImageFilter"> implements SkImageFilter {
5
5
  constructor(CanvasKit: CanvasKit, ref: ImageFilter);
6
+ dispose: () => void;
6
7
  }
@@ -3,4 +3,5 @@ import type { SkMaskFilter } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkMaskFilter extends HostObject<MaskFilter, "MaskFilter"> implements SkMaskFilter {
5
5
  constructor(CanvasKit: CanvasKit, ref: MaskFilter);
6
+ dispose: () => void;
6
7
  }
@@ -3,6 +3,7 @@ import type { SkMatrix } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkMatrix extends HostObject<Matrix3x3, "Matrix"> implements SkMatrix {
5
5
  constructor(CanvasKit: CanvasKit, ref: Matrix3x3);
6
+ dispose: () => void;
6
7
  concat(matrix: SkMatrix): this;
7
8
  translate(x: number, y: number): this;
8
9
  scale(x: number, y?: number): this;
@@ -3,6 +3,7 @@ import type { StrokeJoin, BlendMode, SkColor, SkColorFilter, SkImageFilter, SkPa
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
5
5
  constructor(CanvasKit: CanvasKit, ref: Paint);
6
+ dispose: () => void;
6
7
  copy(): JsiSkPaint;
7
8
  reset(): void;
8
9
  getAlphaf(): number;
@@ -5,6 +5,7 @@ import { JsiSkPoint } from "./JsiSkPoint";
5
5
  import { JsiSkRect } from "./JsiSkRect";
6
6
  export declare class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
7
7
  constructor(CanvasKit: CanvasKit, ref: Path);
8
+ dispose: () => void;
8
9
  addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): this;
9
10
  addArc(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number): this;
10
11
  addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): this;
@@ -3,4 +3,5 @@ import type { SkPathEffect } from "../types/PathEffect";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkPathEffect extends HostObject<PathEffect, "PathEffect"> implements SkPathEffect {
5
5
  constructor(CanvasKit: CanvasKit, ref: PathEffect);
6
+ dispose: () => void;
6
7
  }
@@ -4,6 +4,7 @@ import { HostObject } from "./Host";
4
4
  import { JsiSkShader } from "./JsiSkShader";
5
5
  export declare class JsiSkPicture extends HostObject<Picture, "Picture"> implements SkPicture {
6
6
  constructor(CanvasKit: CanvasKit, ref: Picture);
7
+ dispose: () => void;
7
8
  makeShader(tmx: TileMode, tmy: TileMode, mode: FilterMode, localMatrix?: SkMatrix, tileRect?: SkRect): JsiSkShader;
8
9
  serialize(): Uint8Array | null;
9
10
  }
@@ -6,6 +6,7 @@ import { JsiSkCanvas } from "./JsiSkCanvas";
6
6
  import { JsiSkPicture } from "./JsiSkPicture";
7
7
  export declare class JsiSkPictureRecorder extends HostObject<PictureRecorder, "PictureRecorder"> implements SkPictureRecorder {
8
8
  constructor(CanvasKit: CanvasKit, ref: PictureRecorder);
9
+ dispose: () => void;
9
10
  beginRecording(bounds: SkRect): JsiSkCanvas;
10
11
  finishRecordingAsPicture(): JsiSkPicture;
11
12
  }
@@ -4,6 +4,7 @@ import { BaseHostObject } from "./Host";
4
4
  export declare class JsiSkPoint extends BaseHostObject<Point, "Point"> implements SkPoint {
5
5
  static fromValue(point: SkPoint): Float32Array;
6
6
  constructor(CanvasKit: CanvasKit, ref: Point);
7
+ dispose: () => void;
7
8
  get x(): number;
8
9
  get y(): number;
9
10
  }
@@ -3,6 +3,7 @@ import type { SkRect, SkRRect } from "../types";
3
3
  import { BaseHostObject } from "./Host";
4
4
  import { JsiSkRect } from "./JsiSkRect";
5
5
  export declare class JsiSkRRect extends BaseHostObject<RRect, "RRect"> implements SkRRect {
6
+ dispose: () => void;
6
7
  static fromValue(CanvasKit: CanvasKit, rect: SkRRect): Float32Array;
7
8
  constructor(CanvasKit: CanvasKit, rect: SkRect, rx: number, ry: number);
8
9
  get rx(): number;
@@ -4,4 +4,5 @@ import { HostObject } from "./Host";
4
4
  export declare type RSXform = Float32Array;
5
5
  export declare class JsiSkRSXform extends HostObject<RSXform, "RSXform"> implements SkRSXform {
6
6
  constructor(CanvasKit: CanvasKit, ref: RSXform);
7
+ dispose: () => void;
7
8
  }
@@ -3,6 +3,7 @@ import type { SkRect } from "../types";
3
3
  import { BaseHostObject } from "./Host";
4
4
  export declare class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkRect {
5
5
  static fromValue(CanvasKit: CanvasKit, rect: SkRect): Float32Array;
6
+ dispose: () => void;
6
7
  constructor(CanvasKit: CanvasKit, ref: Rect);
7
8
  get x(): number;
8
9
  get y(): number;
@@ -6,6 +6,7 @@ import { JsiSkShader } from "./JsiSkShader";
6
6
  export declare class JsiSkRuntimeEffect extends HostObject<RuntimeEffect, "RuntimeEffect"> implements SkRuntimeEffect {
7
7
  private sksl;
8
8
  constructor(CanvasKit: CanvasKit, ref: RuntimeEffect, sksl: string);
9
+ dispose: () => void;
9
10
  source(): string;
10
11
  makeShader(uniforms: number[], localMatrix?: SkMatrix): JsiSkShader;
11
12
  makeShaderWithChildren(uniforms: number[], children?: SkShader[], localMatrix?: SkMatrix): JsiSkShader;
@@ -3,4 +3,5 @@ import type { SkShader } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkShader extends HostObject<Shader, "Shader"> implements SkShader {
5
5
  constructor(CanvasKit: CanvasKit, ref: Shader);
6
+ dispose: () => void;
6
7
  }
@@ -3,6 +3,7 @@ import type { SkCanvas, SkImage, SkRect, SkSurface } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkSurface extends HostObject<Surface, "Surface"> implements SkSurface {
5
5
  constructor(CanvasKit: CanvasKit, ref: Surface);
6
+ dispose: () => void;
6
7
  flush(): void;
7
8
  getCanvas(): SkCanvas;
8
9
  makeImageSnapshot(bounds?: SkRect): SkImage;
@@ -3,4 +3,5 @@ import type { SkTextBlob } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkTextBlob extends HostObject<TextBlob, "TextBlob"> implements SkTextBlob {
5
5
  constructor(CanvasKit: CanvasKit, ref: TextBlob);
6
+ dispose: () => void;
6
7
  }
@@ -5,5 +5,5 @@ export declare class JsiSkTypeface extends HostObject<Typeface, "Typeface"> impl
5
5
  constructor(CanvasKit: CanvasKit, ref: Typeface);
6
6
  get bold(): boolean;
7
7
  get italic(): boolean;
8
- dispose(): void;
8
+ dispose: () => void;
9
9
  }
@@ -4,6 +4,7 @@ import { HostObject } from "./Host";
4
4
  import { JsiSkRect } from "./JsiSkRect";
5
5
  export declare class JsiSkVertices extends HostObject<Vertices, "Vertices"> implements SkVertices {
6
6
  constructor(CanvasKit: CanvasKit, ref: Vertices);
7
+ dispose: () => void;
7
8
  bounds(): JsiSkRect;
8
9
  uniqueID(): number;
9
10
  }
@@ -11,7 +11,7 @@ export interface SkiaValue<T = number> {
11
11
  /**
12
12
  * Invalidates the value. Has different meaning depending on the type of the value.
13
13
  */
14
- __invalidate: () => void;
14
+ dispose: () => void;
15
15
  /**
16
16
  * Field to make typechecking easier
17
17
  */
@@ -6,5 +6,5 @@ export declare class RNSkComputedValue<T> extends RNSkReadonlyValue<T> {
6
6
  private _callback;
7
7
  private _unsubscribers;
8
8
  unsubscribe(): void;
9
- __invalidate(): void;
9
+ dispose(): void;
10
10
  }
@@ -8,5 +8,5 @@ export declare class RNSkReadonlyValue<T> implements SkiaValue<T> {
8
8
  readonly __typename__ = "RNSkValue";
9
9
  get current(): T;
10
10
  addListener(cb: (value: T) => void): () => void;
11
- __invalidate(): void;
11
+ dispose(): void;
12
12
  }
@@ -2,6 +2,7 @@ import type { ViewProps } from "react-native";
2
2
  import type { GroupProps, RenderNode } from "../dom/types";
3
3
  import type { SkCanvas, SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
4
4
  import type { SkiaMutableValue, SkiaValue } from "../values";
5
+ import type { SharedValueType } from "../renderer/processors/Animations/Animations";
5
6
  export declare type DrawMode = "continuous" | "default";
6
7
  export declare type NativeSkiaViewProps = ViewProps & {
7
8
  mode?: DrawMode;
@@ -70,7 +71,7 @@ export interface SkiaBaseViewProps extends ViewProps {
70
71
  * Pass an animated value to the onSize property to get updates when
71
72
  * the Skia view is resized.
72
73
  */
73
- onSize?: SkiaMutableValue<SkSize>;
74
+ onSize?: SkiaMutableValue<SkSize> | SharedValueType<SkSize>;
74
75
  }
75
76
  export interface SkiaDrawViewProps extends SkiaBaseViewProps {
76
77
  /**
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.191",
10
+ "version": "0.1.192",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -17,9 +17,11 @@ import { Skia } from "../skia/Skia";
17
17
  import type { TouchHandler, SkiaBaseViewProps } from "../views";
18
18
  import type { SkiaValue } from "../values/types";
19
19
  import { JsiDrawingContext } from "../dom/types";
20
+ import { useValue } from "../values";
20
21
 
21
22
  import { SkiaRoot } from "./Reconciler";
22
23
  import { NATIVE_DOM } from "./HostComponents";
24
+ import { isValue } from "./processors";
23
25
 
24
26
  export const useCanvasRef = () => useRef<SkiaDomView>(null);
25
27
 
@@ -31,9 +33,27 @@ export interface CanvasProps extends SkiaBaseViewProps {
31
33
 
32
34
  export const Canvas = forwardRef<SkiaDomView, CanvasProps>(
33
35
  (
34
- { children, style, debug, mode, onTouch, onSize, ...props },
36
+ {
37
+ children,
38
+ style,
39
+ debug,
40
+ mode,
41
+ onTouch,
42
+ onSize: onSizeReanimatedOrSkia,
43
+ ...props
44
+ },
35
45
  forwardedRef
36
46
  ) => {
47
+ const size = useValue({ width: 0, height: 0 });
48
+ const onSize = isValue(onSizeReanimatedOrSkia)
49
+ ? onSizeReanimatedOrSkia
50
+ : size;
51
+ useEffect(() => {
52
+ if (!isValue(onSizeReanimatedOrSkia) && onSizeReanimatedOrSkia) {
53
+ return size.addListener((v) => (onSizeReanimatedOrSkia.value = v));
54
+ }
55
+ return undefined;
56
+ }, [onSizeReanimatedOrSkia, size]);
37
57
  const innerRef = useCanvasRef();
38
58
  const ref = useCombinedRefs(forwardedRef, innerRef);
39
59
  const redraw = useCallback(() => {
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
2
 
3
3
  import { Skia } from "../Skia";
4
- import type { SkData, DataSourceParam, JsiDisposable } from "../types";
4
+ import type { SkData, DataSourceParam, BaseSkJSIInstance } from "../types";
5
5
  import { Platform } from "../../Platform";
6
6
 
7
7
  const factoryWrapper = <T>(
@@ -37,7 +37,7 @@ const loadData = <T>(
37
37
  );
38
38
  }
39
39
  };
40
- const useLoading = <T extends JsiDisposable>(
40
+ const useLoading = <T extends BaseSkJSIInstance>(
41
41
  source: DataSourceParam,
42
42
  loader: () => Promise<T | null>
43
43
  ) => {
@@ -61,7 +61,7 @@ const useLoading = <T extends JsiDisposable>(
61
61
  return data;
62
62
  };
63
63
 
64
- export const useRawData = <T extends JsiDisposable>(
64
+ export const useRawData = <T extends BaseSkJSIInstance>(
65
65
  source: DataSourceParam,
66
66
  factory: (data: SkData) => T | null,
67
67
  onError?: (err: Error) => void
@@ -1,6 +1,6 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export type SkData = SkJSIInstance<"Data"> & JsiDisposable;
3
+ export type SkData = SkJSIInstance<"Data">;
4
4
 
5
5
  type RNModule = number;
6
6
  type ESModule = {
@@ -1,5 +1,5 @@
1
1
  import type { SkMatrix } from "../Matrix";
2
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
+ import type { SkJSIInstance } from "../JsiInstance";
3
3
  import type { TileMode } from "../ImageFilter";
4
4
  import type { SkShader } from "../Shader";
5
5
 
@@ -20,7 +20,7 @@ export enum ImageFormat {
20
20
  WEBP = 6,
21
21
  }
22
22
 
23
- export interface SkImage extends SkJSIInstance<"Image">, JsiDisposable {
23
+ export interface SkImage extends SkJSIInstance<"Image"> {
24
24
  /**
25
25
  * Returns the possibly scaled height of the image.
26
26
  */
@@ -1,7 +1,7 @@
1
- export interface SkJSIInstance<T extends string> {
2
- __typename__: T;
1
+ export interface BaseSkJSIInstance {
2
+ dispose: () => void;
3
3
  }
4
4
 
5
- export interface JsiDisposable {
6
- dispose: () => void;
5
+ export interface SkJSIInstance<T extends string> extends BaseSkJSIInstance {
6
+ __typename__: T;
7
7
  }
@@ -1,6 +1,6 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export interface SkSVG extends SkJSIInstance<"SVG">, JsiDisposable {
3
+ export interface SkSVG extends SkJSIInstance<"SVG"> {
4
4
  width(): number;
5
5
  height(): number;
6
6
  }
@@ -1,3 +1,3 @@
1
- import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export type SkTypeface = SkJSIInstance<"Typeface"> & JsiDisposable;
3
+ export type SkTypeface = SkJSIInstance<"Typeface">;
@@ -28,6 +28,8 @@ export abstract class BaseHostObject<T, N extends string>
28
28
  this.ref = ref;
29
29
  this.__typename__ = typename;
30
30
  }
31
+
32
+ abstract dispose: () => void;
31
33
  }
32
34
 
33
35
  export abstract class HostObject<T, N extends string> extends BaseHostObject<
@@ -46,6 +46,10 @@ export class JsiSkCanvas
46
46
  super(CanvasKit, ref, "Canvas");
47
47
  }
48
48
 
49
+ dispose = () => {
50
+ this.ref.delete();
51
+ };
52
+
49
53
  drawRect(rect: SkRect, paint: SkPaint) {
50
54
  this.ref.drawRect(
51
55
  JsiSkRect.fromValue(this.CanvasKit, rect),
@@ -11,4 +11,8 @@ export class JsiSkColorFilter
11
11
  constructor(CanvasKit: CanvasKit, ref: ColorFilter) {
12
12
  super(CanvasKit, ref, "ColorFilter");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -36,4 +36,8 @@ export class JsiSkContourMeasure
36
36
  length() {
37
37
  return this.ref.length();
38
38
  }
39
+
40
+ dispose = () => {
41
+ this.ref.delete();
42
+ };
39
43
  }
@@ -20,4 +20,8 @@ export class JsiSkContourMeasureIter
20
20
  }
21
21
  return new JsiSkContourMeasure(this.CanvasKit, result);
22
22
  }
23
+
24
+ dispose = () => {
25
+ this.ref.delete();
26
+ };
23
27
  }
@@ -11,7 +11,7 @@ export class JsiSkData extends HostObject<Data, "Data"> implements SkData {
11
11
  super(CanvasKit, ref, "Data");
12
12
  }
13
13
 
14
- dispose() {
15
- // Not implemented in data
16
- }
14
+ dispose = () => {
15
+ // Not implemented in data - since data is a raw ArrayBuffer
16
+ };
17
17
  }
@@ -20,6 +20,10 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
20
20
  super(CanvasKit, ref, "Font");
21
21
  }
22
22
 
23
+ dispose = () => {
24
+ this.ref.delete();
25
+ };
26
+
23
27
  getTextWidth(text: string, paint?: SkPaint | undefined) {
24
28
  const ids = this.getGlyphIDs(text);
25
29
  const widths = this.getGlyphWidths(ids, paint);
@@ -110,9 +110,9 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
110
110
  return toBase64String(bytes);
111
111
  }
112
112
 
113
- dispose() {
113
+ dispose = () => {
114
114
  this.ref.delete();
115
- }
115
+ };
116
116
 
117
117
  makeNonTextureImage(): SkImage {
118
118
  return new JsiSkImage(
@@ -11,4 +11,8 @@ export class JsiSkImageFilter
11
11
  constructor(CanvasKit: CanvasKit, ref: ImageFilter) {
12
12
  super(CanvasKit, ref, "ImageFilter");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -11,4 +11,8 @@ export class JsiSkMaskFilter
11
11
  constructor(CanvasKit: CanvasKit, ref: MaskFilter) {
12
12
  super(CanvasKit, ref, "MaskFilter");
13
13
  }
14
+
15
+ dispose = () => {
16
+ this.ref.delete();
17
+ };
14
18
  }
@@ -12,6 +12,10 @@ export class JsiSkMatrix
12
12
  super(CanvasKit, ref, "Matrix");
13
13
  }
14
14
 
15
+ dispose = () => {
16
+ // Do nothing - the matrix is represenetd by a Float32Array
17
+ };
18
+
15
19
  concat(matrix: SkMatrix) {
16
20
  this.ref.set(
17
21
  this.CanvasKit.Matrix.multiply(this.ref, JsiSkMatrix.fromValue(matrix))