@shopify/react-native-skia 0.1.225 → 0.1.228

Sign up to get free protection for your applications and to get access to all the features.
Files changed (326) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +3 -3
  2. package/cpp/api/JsiSkCanvas.h +2 -1
  3. package/cpp/api/JsiSkMatrix.h +35 -13
  4. package/cpp/api/JsiSkPictureRecorder.h +10 -3
  5. package/cpp/api/JsiSkTypeface.h +1 -0
  6. package/cpp/rnskia/dom/props/MatrixProp.h +19 -0
  7. package/cpp/rnskia/dom/props/TransformProp.h +76 -9
  8. package/lib/commonjs/animation/spring/runSpring.d.ts +3 -0
  9. package/lib/commonjs/animation/spring/runSpring.js +3 -0
  10. package/lib/commonjs/animation/spring/runSpring.js.map +1 -1
  11. package/lib/commonjs/animation/spring/useSpring.d.ts +3 -0
  12. package/lib/commonjs/animation/spring/useSpring.js +3 -0
  13. package/lib/commonjs/animation/spring/useSpring.js.map +1 -1
  14. package/lib/commonjs/animation/timing/runTiming.d.ts +3 -0
  15. package/lib/commonjs/animation/timing/runTiming.js +3 -0
  16. package/lib/commonjs/animation/timing/runTiming.js.map +1 -1
  17. package/lib/commonjs/animation/timing/useLoop.d.ts +3 -0
  18. package/lib/commonjs/animation/timing/useLoop.js +3 -0
  19. package/lib/commonjs/animation/timing/useLoop.js.map +1 -1
  20. package/lib/commonjs/animation/timing/useTiming.d.ts +3 -0
  21. package/lib/commonjs/animation/timing/useTiming.js +3 -0
  22. package/lib/commonjs/animation/timing/useTiming.js.map +1 -1
  23. package/lib/commonjs/dom/nodes/JsiSkDOM.js +2 -0
  24. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  25. package/lib/commonjs/dom/nodes/datatypes/Fitting.d.ts +5 -5
  26. package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
  27. package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +235 -75
  28. package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
  29. package/lib/commonjs/dom/types/Common.d.ts +3 -3
  30. package/lib/commonjs/dom/types/Common.js.map +1 -1
  31. package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -0
  32. package/lib/commonjs/external/reanimated/interpolators.js +24 -5
  33. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  34. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -1
  35. package/lib/commonjs/external/reanimated/moduleWrapper.js +9 -7
  36. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  37. package/lib/commonjs/renderer/Canvas.js +34 -28
  38. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  39. package/lib/commonjs/renderer/components/Drawing.d.ts +5 -0
  40. package/lib/commonjs/renderer/components/Drawing.js +5 -0
  41. package/lib/commonjs/renderer/components/Drawing.js.map +1 -1
  42. package/lib/commonjs/renderer/components/shapes/FitBox.d.ts +5 -5
  43. package/lib/commonjs/skia/core/Matrix.d.ts +2 -2
  44. package/lib/commonjs/skia/core/Matrix.js.map +1 -1
  45. package/lib/commonjs/skia/core/Picture.d.ts +2 -2
  46. package/lib/commonjs/skia/core/Picture.js +12 -2
  47. package/lib/commonjs/skia/core/Picture.js.map +1 -1
  48. package/lib/commonjs/skia/core/Vector.d.ts +0 -5
  49. package/lib/commonjs/skia/core/Vector.js +1 -17
  50. package/lib/commonjs/skia/core/Vector.js.map +1 -1
  51. package/lib/commonjs/skia/types/Canvas.d.ts +1 -1
  52. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  53. package/lib/commonjs/skia/types/Matrix.d.ts +4 -20
  54. package/lib/commonjs/skia/types/Matrix.js +4 -70
  55. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  56. package/lib/commonjs/skia/types/Matrix4.d.ts +90 -0
  57. package/lib/commonjs/skia/types/Matrix4.js +312 -0
  58. package/lib/commonjs/skia/types/Matrix4.js.map +1 -0
  59. package/lib/commonjs/skia/types/Path/Path.d.ts +1 -1
  60. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  61. package/lib/commonjs/skia/types/Picture/PictureRecorder.d.ts +1 -1
  62. package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
  63. package/lib/commonjs/skia/types/Rect.d.ts +1 -0
  64. package/lib/commonjs/skia/types/Rect.js +18 -0
  65. package/lib/commonjs/skia/types/Rect.js.map +1 -1
  66. package/lib/commonjs/skia/types/index.d.ts +1 -0
  67. package/lib/commonjs/skia/types/index.js +13 -0
  68. package/lib/commonjs/skia/types/index.js.map +1 -1
  69. package/lib/commonjs/skia/web/Host.d.ts +2 -3
  70. package/lib/commonjs/skia/web/Host.js +4 -12
  71. package/lib/commonjs/skia/web/Host.js.map +1 -1
  72. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  73. package/lib/commonjs/skia/web/JsiSkCanvas.js +13 -13
  74. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  75. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
  76. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  77. package/lib/commonjs/skia/web/JsiSkFont.js +2 -2
  78. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  79. package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
  80. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  81. package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
  82. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  83. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +3 -3
  84. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  85. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
  86. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  87. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +2 -2
  88. package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -1
  89. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  90. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
  91. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  92. package/lib/commonjs/skia/web/JsiSkPath.js +5 -5
  93. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  94. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +1 -1
  95. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  96. package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
  97. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  98. package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
  99. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  100. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  101. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +1 -1
  102. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  103. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
  104. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  105. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +3 -3
  106. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
  107. package/lib/commonjs/values/api.d.ts +23 -2
  108. package/lib/commonjs/values/api.js +44 -1
  109. package/lib/commonjs/values/api.js.map +1 -1
  110. package/lib/commonjs/values/hooks/useClockValue.d.ts +3 -0
  111. package/lib/commonjs/values/hooks/useClockValue.js +3 -0
  112. package/lib/commonjs/values/hooks/useClockValue.js.map +1 -1
  113. package/lib/commonjs/values/hooks/useComputedValue.d.ts +3 -0
  114. package/lib/commonjs/values/hooks/useComputedValue.js +3 -0
  115. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  116. package/lib/commonjs/values/hooks/useValue.d.ts +3 -0
  117. package/lib/commonjs/values/hooks/useValue.js +3 -0
  118. package/lib/commonjs/values/hooks/useValue.js.map +1 -1
  119. package/lib/commonjs/values/hooks/useValueEffect.d.ts +3 -0
  120. package/lib/commonjs/values/hooks/useValueEffect.js +3 -0
  121. package/lib/commonjs/values/hooks/useValueEffect.js.map +1 -1
  122. package/lib/commonjs/values/types.d.ts +4 -4
  123. package/lib/commonjs/values/types.js.map +1 -1
  124. package/lib/commonjs/views/SkiaView.d.ts +5 -0
  125. package/lib/commonjs/views/SkiaView.js +9 -0
  126. package/lib/commonjs/views/SkiaView.js.map +1 -1
  127. package/lib/module/animation/spring/runSpring.d.ts +3 -0
  128. package/lib/module/animation/spring/runSpring.js +3 -0
  129. package/lib/module/animation/spring/runSpring.js.map +1 -1
  130. package/lib/module/animation/spring/useSpring.d.ts +3 -0
  131. package/lib/module/animation/spring/useSpring.js +3 -0
  132. package/lib/module/animation/spring/useSpring.js.map +1 -1
  133. package/lib/module/animation/timing/runTiming.d.ts +3 -0
  134. package/lib/module/animation/timing/runTiming.js +3 -0
  135. package/lib/module/animation/timing/runTiming.js.map +1 -1
  136. package/lib/module/animation/timing/useLoop.d.ts +3 -0
  137. package/lib/module/animation/timing/useLoop.js +3 -0
  138. package/lib/module/animation/timing/useLoop.js.map +1 -1
  139. package/lib/module/animation/timing/useTiming.d.ts +3 -0
  140. package/lib/module/animation/timing/useTiming.js +3 -0
  141. package/lib/module/animation/timing/useTiming.js.map +1 -1
  142. package/lib/module/dom/nodes/JsiSkDOM.js +2 -0
  143. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  144. package/lib/module/dom/nodes/datatypes/Fitting.d.ts +5 -5
  145. package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
  146. package/lib/module/dom/nodes/datatypes/Gradient.d.ts +235 -75
  147. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  148. package/lib/module/dom/types/Common.d.ts +3 -3
  149. package/lib/module/dom/types/Common.js.map +1 -1
  150. package/lib/module/external/reanimated/interpolators.d.ts +1 -0
  151. package/lib/module/external/reanimated/interpolators.js +22 -6
  152. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  153. package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -1
  154. package/lib/module/external/reanimated/moduleWrapper.js +7 -6
  155. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  156. package/lib/module/renderer/Canvas.js +35 -29
  157. package/lib/module/renderer/Canvas.js.map +1 -1
  158. package/lib/module/renderer/components/Drawing.d.ts +5 -0
  159. package/lib/module/renderer/components/Drawing.js +6 -0
  160. package/lib/module/renderer/components/Drawing.js.map +1 -1
  161. package/lib/module/renderer/components/shapes/FitBox.d.ts +5 -5
  162. package/lib/module/skia/core/Matrix.d.ts +2 -2
  163. package/lib/module/skia/core/Matrix.js.map +1 -1
  164. package/lib/module/skia/core/Picture.d.ts +2 -2
  165. package/lib/module/skia/core/Picture.js +12 -3
  166. package/lib/module/skia/core/Picture.js.map +1 -1
  167. package/lib/module/skia/core/Vector.d.ts +0 -5
  168. package/lib/module/skia/core/Vector.js +0 -13
  169. package/lib/module/skia/core/Vector.js.map +1 -1
  170. package/lib/module/skia/types/Canvas.d.ts +1 -1
  171. package/lib/module/skia/types/Canvas.js.map +1 -1
  172. package/lib/module/skia/types/Matrix.d.ts +4 -20
  173. package/lib/module/skia/types/Matrix.js +3 -71
  174. package/lib/module/skia/types/Matrix.js.map +1 -1
  175. package/lib/module/skia/types/Matrix4.d.ts +90 -0
  176. package/lib/module/skia/types/Matrix4.js +274 -0
  177. package/lib/module/skia/types/Matrix4.js.map +1 -0
  178. package/lib/module/skia/types/Path/Path.d.ts +1 -1
  179. package/lib/module/skia/types/Path/Path.js.map +1 -1
  180. package/lib/module/skia/types/Picture/PictureRecorder.d.ts +1 -1
  181. package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
  182. package/lib/module/skia/types/Rect.d.ts +1 -0
  183. package/lib/module/skia/types/Rect.js +9 -0
  184. package/lib/module/skia/types/Rect.js.map +1 -1
  185. package/lib/module/skia/types/index.d.ts +1 -0
  186. package/lib/module/skia/types/index.js +1 -0
  187. package/lib/module/skia/types/index.js.map +1 -1
  188. package/lib/module/skia/web/Host.d.ts +2 -3
  189. package/lib/module/skia/web/Host.js +2 -7
  190. package/lib/module/skia/web/Host.js.map +1 -1
  191. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  192. package/lib/module/skia/web/JsiSkCanvas.js +14 -14
  193. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  194. package/lib/module/skia/web/JsiSkColorFilterFactory.js +2 -2
  195. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  196. package/lib/module/skia/web/JsiSkFont.js +3 -3
  197. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  198. package/lib/module/skia/web/JsiSkImage.js +7 -7
  199. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  200. package/lib/module/skia/web/JsiSkImageFactory.js +3 -3
  201. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkImageFilterFactory.js +4 -4
  203. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  204. package/lib/module/skia/web/JsiSkMaskFilterFactory.js +2 -2
  205. package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  206. package/lib/module/skia/web/JsiSkMatrix.d.ts +2 -2
  207. package/lib/module/skia/web/JsiSkMatrix.js +6 -1
  208. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  209. package/lib/module/skia/web/JsiSkPaint.js +4 -4
  210. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  211. package/lib/module/skia/web/JsiSkPath.js +6 -6
  212. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  213. package/lib/module/skia/web/JsiSkPathEffectFactory.js +2 -2
  214. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  215. package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
  216. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  217. package/lib/module/skia/web/JsiSkPicture.js +2 -2
  218. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  219. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  220. package/lib/module/skia/web/JsiSkPictureRecorder.js +1 -1
  221. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  222. package/lib/module/skia/web/JsiSkShaderFactory.js +6 -6
  223. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  224. package/lib/module/skia/web/JsiSkVerticesFactory.js +2 -2
  225. package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
  226. package/lib/module/values/api.d.ts +23 -2
  227. package/lib/module/values/api.js +44 -1
  228. package/lib/module/values/api.js.map +1 -1
  229. package/lib/module/values/hooks/useClockValue.d.ts +3 -0
  230. package/lib/module/values/hooks/useClockValue.js +3 -0
  231. package/lib/module/values/hooks/useClockValue.js.map +1 -1
  232. package/lib/module/values/hooks/useComputedValue.d.ts +3 -0
  233. package/lib/module/values/hooks/useComputedValue.js +3 -0
  234. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  235. package/lib/module/values/hooks/useValue.d.ts +3 -0
  236. package/lib/module/values/hooks/useValue.js +3 -0
  237. package/lib/module/values/hooks/useValue.js.map +1 -1
  238. package/lib/module/values/hooks/useValueEffect.d.ts +3 -0
  239. package/lib/module/values/hooks/useValueEffect.js +3 -0
  240. package/lib/module/values/hooks/useValueEffect.js.map +1 -1
  241. package/lib/module/values/types.d.ts +4 -4
  242. package/lib/module/values/types.js.map +1 -1
  243. package/lib/module/views/SkiaView.d.ts +5 -0
  244. package/lib/module/views/SkiaView.js +10 -0
  245. package/lib/module/views/SkiaView.js.map +1 -1
  246. package/lib/typescript/src/animation/spring/runSpring.d.ts +3 -0
  247. package/lib/typescript/src/animation/spring/useSpring.d.ts +3 -0
  248. package/lib/typescript/src/animation/timing/runTiming.d.ts +3 -0
  249. package/lib/typescript/src/animation/timing/useLoop.d.ts +3 -0
  250. package/lib/typescript/src/animation/timing/useTiming.d.ts +3 -0
  251. package/lib/typescript/src/dom/nodes/datatypes/Fitting.d.ts +5 -5
  252. package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +235 -75
  253. package/lib/typescript/src/dom/types/Common.d.ts +3 -3
  254. package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -0
  255. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -1
  256. package/lib/typescript/src/renderer/components/Drawing.d.ts +5 -0
  257. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +5 -5
  258. package/lib/typescript/src/skia/core/Matrix.d.ts +2 -2
  259. package/lib/typescript/src/skia/core/Picture.d.ts +2 -2
  260. package/lib/typescript/src/skia/core/Vector.d.ts +0 -5
  261. package/lib/typescript/src/skia/types/Canvas.d.ts +1 -1
  262. package/lib/typescript/src/skia/types/Matrix.d.ts +4 -20
  263. package/lib/typescript/src/skia/types/Matrix4.d.ts +90 -0
  264. package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -1
  265. package/lib/typescript/src/skia/types/Picture/PictureRecorder.d.ts +1 -1
  266. package/lib/typescript/src/skia/types/Rect.d.ts +1 -0
  267. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  268. package/lib/typescript/src/skia/web/Host.d.ts +2 -3
  269. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
  270. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +2 -2
  271. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  272. package/lib/typescript/src/values/api.d.ts +23 -2
  273. package/lib/typescript/src/values/hooks/useClockValue.d.ts +3 -0
  274. package/lib/typescript/src/values/hooks/useComputedValue.d.ts +3 -0
  275. package/lib/typescript/src/values/hooks/useValue.d.ts +3 -0
  276. package/lib/typescript/src/values/hooks/useValueEffect.d.ts +3 -0
  277. package/lib/typescript/src/values/types.d.ts +4 -4
  278. package/lib/typescript/src/views/SkiaView.d.ts +5 -0
  279. package/package.json +2 -1
  280. package/src/animation/spring/runSpring.ts +3 -0
  281. package/src/animation/spring/useSpring.ts +3 -0
  282. package/src/animation/timing/runTiming.ts +3 -0
  283. package/src/animation/timing/useLoop.ts +3 -0
  284. package/src/animation/timing/useTiming.ts +3 -0
  285. package/src/dom/nodes/JsiSkDOM.ts +4 -0
  286. package/src/dom/nodes/datatypes/Fitting.ts +10 -2
  287. package/src/dom/nodes/datatypes/Gradient.ts +2 -2
  288. package/src/dom/types/Common.ts +5 -3
  289. package/src/external/reanimated/interpolators.ts +30 -7
  290. package/src/external/reanimated/moduleWrapper.ts +6 -0
  291. package/src/renderer/Canvas.tsx +41 -30
  292. package/src/renderer/components/Drawing.tsx +5 -0
  293. package/src/skia/core/Matrix.ts +2 -2
  294. package/src/skia/core/Picture.ts +11 -3
  295. package/src/skia/core/Vector.ts +0 -4
  296. package/src/skia/types/Canvas.ts +1 -1
  297. package/src/skia/types/Matrix.ts +7 -85
  298. package/src/skia/types/Matrix4.ts +344 -0
  299. package/src/skia/types/Path/Path.ts +1 -1
  300. package/src/skia/types/Picture/PictureRecorder.ts +1 -1
  301. package/src/skia/types/Rect.ts +14 -0
  302. package/src/skia/types/index.ts +1 -0
  303. package/src/skia/web/Host.ts +4 -3
  304. package/src/skia/web/JsiSkCanvas.ts +24 -17
  305. package/src/skia/web/JsiSkColorFilterFactory.ts +5 -2
  306. package/src/skia/web/JsiSkFont.ts +3 -3
  307. package/src/skia/web/JsiSkImage.ts +14 -11
  308. package/src/skia/web/JsiSkImageFactory.ts +3 -3
  309. package/src/skia/web/JsiSkImageFilterFactory.ts +5 -5
  310. package/src/skia/web/JsiSkMaskFilterFactory.ts +6 -2
  311. package/src/skia/web/JsiSkMatrix.ts +14 -3
  312. package/src/skia/web/JsiSkPaint.ts +4 -4
  313. package/src/skia/web/JsiSkPath.ts +9 -6
  314. package/src/skia/web/JsiSkPathEffectFactory.ts +2 -2
  315. package/src/skia/web/JsiSkPathFactory.ts +2 -2
  316. package/src/skia/web/JsiSkPicture.ts +4 -4
  317. package/src/skia/web/JsiSkPictureRecorder.ts +6 -2
  318. package/src/skia/web/JsiSkShaderFactory.ts +6 -6
  319. package/src/skia/web/JsiSkVerticesFactory.ts +2 -2
  320. package/src/values/api.ts +55 -2
  321. package/src/values/hooks/useClockValue.ts +3 -0
  322. package/src/values/hooks/useComputedValue.ts +3 -0
  323. package/src/values/hooks/useValue.ts +3 -0
  324. package/src/values/hooks/useValueEffect.ts +3 -0
  325. package/src/values/types.ts +6 -6
  326. package/src/views/SkiaView.tsx +11 -0
@@ -1,6 +1,7 @@
1
1
  import type { ExtrapolationType, SharedValue } from "react-native-reanimated";
2
2
  import type { SkPath, SkPoint } from "../../skia/types";
3
3
  export declare const notifyChange: (value: SharedValue<unknown>) => void;
4
+ export declare const usePathValue: (cb: (path: SkPath) => void) => SharedValue<SkPath>;
4
5
  export declare const useClock: () => SharedValue<number>;
5
6
  export declare const usePathInterpolation: (value: SharedValue<number>, input: number[], outputRange: SkPath[], options?: ExtrapolationType) => SharedValue<SkPath>;
6
7
  export declare const useVectorInterpolation: (value: SharedValue<number>, input: number[], outputRange: SkPoint[], options?: ExtrapolationType) => SharedValue<{
@@ -1,9 +1,10 @@
1
1
  import type { DependencyList } from "react";
2
- import type { FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
2
+ import type { DerivedValue, FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
3
3
  export declare const HAS_REANIMATED2: boolean;
4
4
  export declare const HAS_REANIMATED3: boolean;
5
5
  export declare function throwOnMissingReanimated(): void;
6
6
  export declare const useSharedValue: <T>(init: T, oneWayReadsOnly?: boolean) => SharedValue<T>;
7
+ export declare const useDerivedValue: <T>(processor: () => T, dependencies?: DependencyList) => DerivedValue<T>;
7
8
  export declare const useFrameCallback: (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) => FrameCallback;
8
9
  export declare const startMapper: (worklet: () => void, inputs?: unknown[], outputs?: unknown[]) => number;
9
10
  export declare const stopMapper: (mapperID: number) => void;
@@ -1,3 +1,8 @@
1
1
  import React from "react";
2
2
  import type { CustomDrawingNodeProps } from "../../dom/types";
3
+ /**
4
+ * @deprecated If you are looking to use the Skia imperative API, you can use:
5
+ * The picture API: https://shopify.github.io/react-native-skia/docs/shapes/pictures/
6
+ * The offscreen API: https://shopify.github.io/react-native-skia/docs/animations/textures
7
+ */
3
8
  export declare const Drawing: (props: CustomDrawingNodeProps) => React.JSX.Element;
@@ -8,14 +8,14 @@ interface FitProps {
8
8
  dst: SkRect;
9
9
  children: ReactNode | ReactNode[];
10
10
  }
11
- export declare const fitbox: (fit: Fit, src: SkRect, dst: SkRect) => readonly [{
12
- readonly translateX: number;
11
+ export declare const fitbox: (fit: Fit, src: SkRect, dst: SkRect) => [{
12
+ translateX: number;
13
13
  }, {
14
- readonly translateY: number;
14
+ translateY: number;
15
15
  }, {
16
- readonly scaleX: number;
16
+ scaleX: number;
17
17
  }, {
18
- readonly scaleY: number;
18
+ scaleY: number;
19
19
  }];
20
20
  export declare const FitBox: ({ fit, src, dst, children }: FitProps) => React.JSX.Element;
21
21
  export {};
@@ -1,2 +1,2 @@
1
- import type { Transforms2d } from "../types";
2
- export declare const processTransform2d: (transforms: Transforms2d) => import("../types").SkMatrix;
1
+ import type { Transforms3d } from "../types";
2
+ export declare const processTransform2d: (transforms: Transforms3d) => import("../types").SkMatrix;
@@ -1,8 +1,8 @@
1
- import type { SkCanvas, SkRect } from "../types";
1
+ import { type SkCanvas, type SkRect, type SkSize } from "../types";
2
2
  /**
3
3
  * Memoizes and returns an SkPicture that can be drawn to another canvas.
4
4
  * @param rect Picture bounds
5
5
  * @param cb Callback for drawing to the canvas
6
6
  * @returns SkPicture
7
7
  */
8
- export declare const createPicture: (rect: SkRect, cb: (canvas: SkCanvas) => void) => import("../types").SkPicture;
8
+ export declare const createPicture: (cb: (canvas: SkCanvas) => void, rect?: SkRect | SkSize) => import("../types").SkPicture;
@@ -5,8 +5,3 @@ export declare const neg: (a: Vector) => import("../types").SkPoint;
5
5
  export declare const add: (a: Vector, b: Vector) => import("../types").SkPoint;
6
6
  export declare const sub: (a: Vector, b: Vector) => import("../types").SkPoint;
7
7
  export declare const dist: (a: Vector, b: Vector) => number;
8
- export declare const translate: ({ x, y }: Vector) => readonly [{
9
- readonly translateX: number;
10
- }, {
11
- readonly translateY: number;
12
- }];
@@ -372,7 +372,7 @@ export interface SkCanvas {
372
372
  * Replaces current matrix with m premultiplied with the existing matrix.
373
373
  * @param m
374
374
  */
375
- concat(m: SkMatrix): void;
375
+ concat(m: SkMatrix | number[]): void;
376
376
  /**
377
377
  * Draws the given picture using the current clip, current matrix, and the provided paint.
378
378
  * @param skp
@@ -1,19 +1,9 @@
1
1
  import type { SkJSIInstance } from "./JsiInstance";
2
2
  import type { SkCanvas } from "./Canvas";
3
- export declare enum MatrixIndex {
4
- ScaleX = 0,
5
- SkewX = 1,
6
- TransX = 2,
7
- SkewY = 3,
8
- ScaleY = 4,
9
- TransY = 5,
10
- Persp0 = 6,
11
- Persp1 = 7,
12
- Persp2 = 8
13
- }
3
+ import type { Matrix3, Matrix4, Transforms3d } from "./Matrix4";
14
4
  export declare const isMatrix: (obj: unknown) => obj is SkMatrix;
15
5
  export interface SkMatrix extends SkJSIInstance<"Matrix"> {
16
- concat: (matrix: SkMatrix) => SkMatrix;
6
+ concat: (matrix: SkMatrix | Matrix4 | Matrix3 | number[]) => SkMatrix;
17
7
  translate: (x: number, y: number) => SkMatrix;
18
8
  scale: (x: number, y?: number) => SkMatrix;
19
9
  skew: (x: number, y: number) => SkMatrix;
@@ -25,14 +15,8 @@ export interface SkMatrix extends SkJSIInstance<"Matrix"> {
25
15
  identity: () => SkMatrix;
26
16
  get: () => number[];
27
17
  }
28
- type Transform2dName = "translateX" | "translateY" | "scale" | "skewX" | "skewY" | "scaleX" | "scaleY" | "rotateZ" | "rotate";
29
- type Transformations = {
30
- readonly [Name in Transform2dName]: number;
31
- };
32
- export type Transforms2d = readonly (Pick<Transformations, "translateX"> | Pick<Transformations, "translateY"> | Pick<Transformations, "scale"> | Pick<Transformations, "scaleX"> | Pick<Transformations, "scaleY"> | Pick<Transformations, "skewX"> | Pick<Transformations, "skewY"> | Pick<Transformations, "rotate">)[];
33
18
  export interface TransformProp {
34
- transform?: Transforms2d;
19
+ transform?: Transforms3d;
35
20
  }
36
- export declare const processTransform: <T extends SkMatrix | SkCanvas>(m: T, transforms: Transforms2d) => T;
21
+ export declare const processTransform: <T extends SkMatrix | SkCanvas>(m: T, transforms: Transforms3d) => T;
37
22
  export declare const toDegrees: (rad: number) => number;
38
- export {};
@@ -0,0 +1,90 @@
1
+ type Point = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ type Vec2 = readonly [number, number];
6
+ type Vec3 = readonly [number, number, number];
7
+ export type Matrix3 = readonly [
8
+ number,
9
+ number,
10
+ number,
11
+ number,
12
+ number,
13
+ number,
14
+ number,
15
+ number,
16
+ number
17
+ ];
18
+ export type Matrix4 = readonly [
19
+ number,
20
+ number,
21
+ number,
22
+ number,
23
+ number,
24
+ number,
25
+ number,
26
+ number,
27
+ number,
28
+ number,
29
+ number,
30
+ number,
31
+ number,
32
+ number,
33
+ number,
34
+ number
35
+ ];
36
+ type Transform3dName = "translateX" | "translateY" | "translateZ" | "translate" | "scale" | "scaleX" | "scaleY" | "skewX" | "skewY" | "rotateZ" | "rotate" | "perspective" | "rotateX" | "rotateY" | "matrix";
37
+ type Transformations = {
38
+ [Name in Transform3dName]: Name extends "matrix" ? Matrix4 : Name extends "translate" ? Vec3 | Vec2 : number;
39
+ };
40
+ type Transform3d = Pick<Transformations, "translateX"> | Pick<Transformations, "translateY"> | Pick<Transformations, "translateZ"> | Pick<Transformations, "translate"> | Pick<Transformations, "scale"> | Pick<Transformations, "scaleX"> | Pick<Transformations, "scaleY"> | Pick<Transformations, "skewX"> | Pick<Transformations, "skewY"> | Pick<Transformations, "perspective"> | Pick<Transformations, "rotateX"> | Pick<Transformations, "rotateY"> | Pick<Transformations, "rotateZ"> | Pick<Transformations, "rotate"> | Pick<Transformations, "matrix">;
41
+ export type Transforms3d = Transform3d[];
42
+ /**
43
+ * @worklet
44
+ */
45
+ export declare const Matrix4: () => Matrix4;
46
+ /**
47
+ * @worklet
48
+ */
49
+ export declare const translate: (x: number, y: number, z?: number) => Matrix4;
50
+ /**
51
+ * @worklet
52
+ */
53
+ export declare const perspective: (p: number) => Matrix4;
54
+ /**
55
+ * @worklet
56
+ */
57
+ export declare const mapPoint3d: (m: Matrix4, v: Vec3) => readonly [number, number, number];
58
+ /**
59
+ * @worklet
60
+ */
61
+ export declare const multiply4: (a: Matrix4, b: Matrix4) => Matrix4;
62
+ /**
63
+ * @worklet
64
+ */
65
+ export declare const toMatrix3: (m: Matrix4) => number[];
66
+ /**
67
+ * @worklet
68
+ */
69
+ export declare const pivot: (m: Matrix4, p: Point) => Matrix4;
70
+ /**
71
+ * @worklet
72
+ */
73
+ export declare const scale: (sx: number, sy: number, sz?: number, p?: Point) => Matrix4;
74
+ /**
75
+ * @worklet
76
+ */
77
+ export declare const rotateZ: (value: number, p?: Point) => Matrix4;
78
+ /**
79
+ * @worklet
80
+ */
81
+ export declare const rotateX: (value: number, p?: Point) => Matrix4;
82
+ /**
83
+ * @worklet
84
+ */
85
+ export declare const rotateY: (value: number, p?: Point) => Matrix4;
86
+ /**
87
+ * @worklet
88
+ */
89
+ export declare const processTransform3d: (transforms: Transforms3d) => number[];
90
+ export {};
@@ -440,7 +440,7 @@ export interface SkPath extends SkJSIInstance<"Path"> {
440
440
  /**
441
441
  * Transforms the path by the specified matrix.
442
442
  */
443
- transform(m3: SkMatrix): SkPath;
443
+ transform(m3: SkMatrix | number[]): SkPath;
444
444
  /**
445
445
  * Interpolates between Path with point array of equal size.
446
446
  * Copy verb array and weights to result, and set result path to a weighted
@@ -7,7 +7,7 @@ export interface SkPictureRecorder {
7
7
  *
8
8
  * @param bounds - a rect to cull the results.
9
9
  */
10
- beginRecording(bounds: SkRect): SkCanvas;
10
+ beginRecording(bounds?: SkRect): SkCanvas;
11
11
  /**
12
12
  * Returns the captured draw commands as a picture and invalidates the canvas returned earlier.
13
13
  */
@@ -4,3 +4,4 @@ export interface SkRect {
4
4
  readonly width: number;
5
5
  readonly height: number;
6
6
  }
7
+ export declare const isRect: (def: unknown) => def is SkRect;
@@ -28,3 +28,4 @@ export * from "./Skia";
28
28
  export * from "./TextBlob";
29
29
  export * from "./Size";
30
30
  export * from "./Paragraph";
31
+ export * from "./Matrix4";
@@ -16,6 +16,5 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
16
16
  export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
17
17
  static fromValue<T>(value: SkJSIInstance<string>): T;
18
18
  }
19
- export declare const getCkEnum: (e: EmbindEnum, v: number) => EmbindEnumEntity;
20
- export declare const ckEnum: (value: number) => EmbindEnumEntity;
21
- export declare const optEnum: (value: number | undefined) => EmbindEnumEntity | undefined;
19
+ export declare const getEnum: (e: EmbindEnum, v: number) => EmbindEnumEntity;
20
+ export declare const optEnum: (e: EmbindEnum, value: number | undefined) => EmbindEnumEntity | undefined;
@@ -40,7 +40,7 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
40
40
  clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean): void;
41
41
  clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean): void;
42
42
  clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean): void;
43
- concat(m: SkMatrix): void;
43
+ concat(m: SkMatrix | number[]): void;
44
44
  drawPicture(skp: SkPicture): void;
45
45
  readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array | Uint8Array | null;
46
46
  }
@@ -1,12 +1,12 @@
1
1
  import type { CanvasKit, Matrix3x3 } from "canvaskit-wasm";
2
- import type { SkMatrix } from "../types";
2
+ import { type Matrix3, type Matrix4, 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
6
  private preMultiply;
7
7
  private postMultiply;
8
8
  dispose: () => void;
9
- concat(matrix: SkMatrix): this;
9
+ concat(matrix: SkMatrix | number[] | Matrix4 | Matrix3): this;
10
10
  translate(x: number, y: number): this;
11
11
  postTranslate(x: number, y: number): this;
12
12
  scale(x: number, y?: number): this;
@@ -7,6 +7,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
9
  dispose: () => void;
10
- beginRecording(bounds: SkRect): JsiSkCanvas;
10
+ beginRecording(bounds?: SkRect): JsiSkCanvas;
11
11
  finishRecordingAsPicture(): JsiSkPicture;
12
12
  }
@@ -1,5 +1,26 @@
1
- import type { ISkiaValueApi } from "./types";
1
+ import type { AnimationState, ISkiaValueApi, SkiaAnimation, SkiaClockValue, SkiaMutableValue, SkiaValue } from "./types";
2
2
  declare global {
3
3
  var SkiaValueApi: ISkiaValueApi;
4
4
  }
5
- export declare const ValueApi: ISkiaValueApi;
5
+ export declare const ValueApi: {
6
+ /**
7
+ * @deprecated Use Reanimated 3
8
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
9
+ */
10
+ createValue<T>(initialValue: T): SkiaMutableValue<T>;
11
+ /**
12
+ * @deprecated Use Reanimated 3
13
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
14
+ */
15
+ createComputedValue<R>(cb: () => R, values: SkiaValue<unknown>[]): SkiaValue<R>;
16
+ /**
17
+ * @deprecated Use Reanimated 3
18
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
19
+ */
20
+ createClockValue(): SkiaClockValue;
21
+ /**
22
+ * @deprecated Use Reanimated 3
23
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
24
+ */
25
+ createAnimation<S extends AnimationState = AnimationState>(cb: (t: number, state: S | undefined) => S): SkiaAnimation;
26
+ };
@@ -1,4 +1,7 @@
1
1
  /**
2
+ * @deprecated Use Reanimated 3
3
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
4
+ *
2
5
  * @returns A new value that will be updated on every frame redraw with the
3
6
  * number of milliseconds elapsed since the value was started.
4
7
  * The clock is created in the stopped state.
@@ -1,4 +1,7 @@
1
1
  /**
2
+ * @deprecated Use Reanimated 3
3
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
4
+ *
2
5
  * Creates a new computed value - a value that will calculate its value depending
3
6
  * on other values.
4
7
  * @param cb Callback to calculate new value
@@ -1,5 +1,8 @@
1
1
  import type { SkiaMutableValue } from "../types";
2
2
  /**
3
+ * @deprecated Use Reanimated 3
4
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
5
+ *
3
6
  * Creates a new value that holds some data.
4
7
  * @param v Value to hold
5
8
  * @returns A Value of type of v
@@ -1,5 +1,8 @@
1
1
  import type { SkiaValue } from "../types";
2
2
  /**
3
+ * @deprecated Use Reanimated 3
4
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
5
+ *
3
6
  * Sets up an effect that will be run whenever the value changes
4
7
  * @param value Value to subscribe to changes on
5
8
  * @param cb Callback to run when value changes
@@ -43,21 +43,21 @@ export interface ISkiaValueApi {
43
43
  * Creates a new value that holds the initial value and that
44
44
  * can be changed.
45
45
  */
46
- createValue: <T>(initialValue: T) => SkiaMutableValue<T>;
46
+ createValue<T>(initialValue: T): SkiaMutableValue<T>;
47
47
  /**
48
48
  * Creates a computed value. This is a calculated value that returns the result of
49
49
  * a function that is called with the values of the dependencies.
50
50
  */
51
- createComputedValue: <R>(cb: () => R, values: Array<SkiaValue<unknown>>) => SkiaValue<R>;
51
+ createComputedValue<R>(cb: () => R, values: Array<SkiaValue<unknown>>): SkiaValue<R>;
52
52
  /**
53
53
  * Creates a clock value where the value is the number of milliseconds elapsed
54
54
  * since the clock was created
55
55
  */
56
- createClockValue: () => SkiaClockValue;
56
+ createClockValue(): SkiaClockValue;
57
57
  /**
58
58
  * Creates an animation that is driven from a clock and updated every frame.
59
59
  * @param cb Callback to calculate next value from time.
60
60
  * @returns An animation object that can control a value.
61
61
  */
62
- createAnimation: <S extends AnimationState = AnimationState>(cb: (t: number, state: S | undefined) => S) => SkiaAnimation;
62
+ createAnimation<S extends AnimationState = AnimationState>(cb: (t: number, state: S | undefined) => S): SkiaAnimation;
63
63
  }
@@ -5,6 +5,11 @@ import type { SkiaDrawViewProps } from "./types";
5
5
  export declare const SkiaViewNativeId: {
6
6
  current: number;
7
7
  };
8
+ /**
9
+ * @deprecated If you are looking to use the Skia imperative API, you can use:
10
+ * The picture API: https://shopify.github.io/react-native-skia/docs/shapes/pictures/
11
+ * The offscreen API: https://shopify.github.io/react-native-skia/docs/animations/textures
12
+ */
8
13
  export declare class SkiaView extends React.Component<SkiaDrawViewProps> {
9
14
  constructor(props: SkiaDrawViewProps);
10
15
  private _nativeId;
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.225",
10
+ "version": "0.1.228",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -94,6 +94,7 @@
94
94
  "eslint-config-react-native-wcandillon": "3.10.2",
95
95
  "eslint-plugin-reanimated": "2.0.0",
96
96
  "jest": "29.6.4",
97
+ "jest-diff": "^29.7.0",
97
98
  "merge-dirs": "^0.2.1",
98
99
  "pixelmatch": "^5.3.0",
99
100
  "pngjs": "^6.0.0",
@@ -10,6 +10,9 @@ import { Spring } from "./Spring";
10
10
  import { createSpringEasing } from "./functions/spring";
11
11
 
12
12
  /**
13
+ * @deprecated Use Reanimated 3 for animations:
14
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
15
+ *
13
16
  * Creates a new animation on an existing value that will be driven by
14
17
  * an animation value. The value will be run from / to the value in
15
18
  * params and modified by the provided easing curve for the length of
@@ -10,6 +10,9 @@ import { Spring } from "./Spring";
10
10
  import { createSpringEasing } from "./functions/spring";
11
11
 
12
12
  /**
13
+ * @deprecated Use Reanimated 3 for animations:
14
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
15
+ *
13
16
  * Creats a spring based animation value that will run whenever
14
17
  * the animation parameters change.
15
18
  * @param toOrParams
@@ -8,6 +8,9 @@ import type {
8
8
  import { getResolvedParams } from "./functions";
9
9
  import { createTiming } from "./createTiming";
10
10
  /**
11
+ * @deprecated Use Reanimated 3 for animations:
12
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
13
+ *
11
14
  * Creates a new animation on an existing value that will be driven by
12
15
  * an animation value. The value will be run from / to the value in
13
16
  * params and modified by the provided easing curve for the length of
@@ -3,6 +3,9 @@ import type { TimingConfig } from "../types";
3
3
  import { useTiming } from "./useTiming";
4
4
 
5
5
  /**
6
+ * @deprecated Use Reanimated 3 for animations:
7
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
8
+ *
6
9
  * Configures a looped timing value. The value will go back and forth
7
10
  * between 0 and 1 and back.
8
11
  * @param config Timing configuration for easing and duration
@@ -12,6 +12,9 @@ import { getResolvedParams } from "./functions";
12
12
  import { createTiming } from "./createTiming";
13
13
 
14
14
  /**
15
+ * @deprecated Use Reanimated 3 for animations:
16
+ * https://shopify.github.io/react-native-skia/docs/animations/animations
17
+ *
15
18
  * Creats an animation value that will run whenever
16
19
  * the animation parameters change. The animation start immediately.
17
20
  * @param toOrParams
@@ -173,6 +173,10 @@ export class JsiSkDOM implements SkDOM {
173
173
  }
174
174
 
175
175
  CustomDrawing(props: CustomDrawingNodeProps) {
176
+ console.warn(
177
+ // eslint-disable-next-line max-len
178
+ "The <Drawing /> component is deprecated and will be removed in the next release. For custom drawings, please sure the <Picture /> component: https://shopify.github.io/react-native-skia/docs/shapes/pictures/"
179
+ );
176
180
  return NATIVE_DOM
177
181
  ? global.SkiaDomApi.CustomDrawingNode(props ?? {})
178
182
  : new CustomDrawingNode(this.ctx, props);
@@ -9,12 +9,20 @@ export interface Size {
9
9
 
10
10
  export const size = (width = 0, height = 0) => ({ width, height });
11
11
 
12
- export const rect2rect = (src: SkRect, dst: SkRect) => {
12
+ export const rect2rect = (
13
+ src: SkRect,
14
+ dst: SkRect
15
+ ): [
16
+ { translateX: number },
17
+ { translateY: number },
18
+ { scaleX: number },
19
+ { scaleY: number }
20
+ ] => {
13
21
  const scaleX = dst.width / src.width;
14
22
  const scaleY = dst.height / src.height;
15
23
  const translateX = dst.x - src.x * scaleX;
16
24
  const translateY = dst.y - src.y * scaleY;
17
- return [{ translateX }, { translateY }, { scaleX }, { scaleY }] as const;
25
+ return [{ translateX }, { translateY }, { scaleX }, { scaleY }];
18
26
  };
19
27
 
20
28
  export const fitRects = (
@@ -1,11 +1,11 @@
1
- import type { Skia, SkRect, Transforms2d, Vector } from "../../../skia/types";
1
+ import type { Skia, SkRect, Transforms3d, Vector } from "../../../skia/types";
2
2
  import { TileMode } from "../../../skia/types";
3
3
  import type { GradientProps, ImageShaderProps } from "../../types";
4
4
 
5
5
  import { enumKey } from "./Enum";
6
6
  import { processTransformProps } from "./Transform";
7
7
 
8
- export const transformOrigin = (origin: Vector, transform: Transforms2d) => [
8
+ export const transformOrigin = (origin: Vector, transform: Transforms3d) => [
9
9
  { translateX: origin.x },
10
10
  { translateY: origin.y },
11
11
  ...transform,
@@ -3,6 +3,8 @@ import type { ReactNode } from "react";
3
3
  import type {
4
4
  BlendMode,
5
5
  Color,
6
+ Matrix3,
7
+ Matrix4,
6
8
  PaintStyle,
7
9
  SkMatrix,
8
10
  SkPaint,
@@ -11,7 +13,7 @@ import type {
11
13
  SkRRect,
12
14
  StrokeCap,
13
15
  StrokeJoin,
14
- Transforms2d,
16
+ Transforms3d,
15
17
  Vector,
16
18
  } from "../../skia/types";
17
19
 
@@ -64,9 +66,9 @@ export interface ScalarCircleDef {
64
66
  export type CircleDef = PointCircleDef | ScalarCircleDef;
65
67
 
66
68
  export interface TransformProps {
67
- transform?: Transforms2d;
69
+ transform?: Transforms3d;
68
70
  origin?: Vector;
69
- matrix?: SkMatrix;
71
+ matrix?: SkMatrix | Matrix4 | Matrix3 | number[];
70
72
  }
71
73
 
72
74
  export interface PaintProps extends ChildrenProps {
@@ -1,5 +1,9 @@
1
- import type { ExtrapolationType, SharedValue } from "react-native-reanimated";
2
- import { useMemo } from "react";
1
+ import type {
2
+ ExtrapolationType,
3
+ FrameInfo,
4
+ SharedValue,
5
+ } from "react-native-reanimated";
6
+ import { useCallback, useMemo } from "react";
3
7
 
4
8
  import type { SkPath, SkPoint } from "../../skia/types";
5
9
  import { interpolatePaths, interpolateVector } from "../../animation";
@@ -9,19 +13,38 @@ import {
9
13
  useAnimatedReaction,
10
14
  useFrameCallback,
11
15
  useSharedValue,
16
+ useDerivedValue,
12
17
  } from "./moduleWrapper";
13
18
 
14
19
  export const notifyChange = (value: SharedValue<unknown>) => {
15
20
  "worklet";
16
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- (value as any)._value = value.value;
21
+ if (_WORKLET) {
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ (value as any)._value = value.value;
24
+ }
25
+ };
26
+
27
+ export const usePathValue = (cb: (path: SkPath) => void) => {
28
+ const pathInit = useMemo(() => Skia.Path.Make(), []);
29
+ const path = useSharedValue(pathInit);
30
+ useDerivedValue(() => {
31
+ path.value.reset();
32
+ cb(path.value);
33
+ notifyChange(path);
34
+ });
35
+ return path;
18
36
  };
19
37
 
20
38
  export const useClock = () => {
21
39
  const clock = useSharedValue(0);
22
- useFrameCallback((info) => {
23
- clock.value = info.timeSinceFirstFrame;
24
- });
40
+ const callback = useCallback(
41
+ (info: FrameInfo) => {
42
+ "worklet";
43
+ clock.value = info.timeSinceFirstFrame;
44
+ },
45
+ [clock]
46
+ );
47
+ useFrameCallback(callback);
25
48
  return clock;
26
49
  };
27
50
 
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import type { DependencyList } from "react";
3
3
  import type {
4
+ DerivedValue,
4
5
  FrameCallback,
5
6
  FrameInfo,
6
7
  SharedValue,
@@ -42,6 +43,11 @@ export const useSharedValue: <T>(
42
43
  oneWayReadsOnly?: boolean
43
44
  ) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;
44
45
 
46
+ export const useDerivedValue: <T>(
47
+ processor: () => T,
48
+ dependencies?: DependencyList
49
+ ) => DerivedValue<T> = Reanimated2?.useDerivedValue || throwOnMissingReanimated;
50
+
45
51
  export const useFrameCallback: (
46
52
  callback: (frameInfo: FrameInfo) => void,
47
53
  autostart?: boolean