@shopify/react-native-skia 0.1.130 → 0.1.133

Sign up to get free protection for your applications and to get access to all the features.
Files changed (963) hide show
  1. package/README.md +8 -0
  2. package/android/cpp/jni/JniSkiaDrawView.cpp +3 -2
  3. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +5 -0
  4. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +2 -1
  5. package/cpp/api/JsiSkCanvas.h +2 -2
  6. package/cpp/api/JsiSkFont.h +6 -2
  7. package/cpp/api/JsiSkImage.h +2 -19
  8. package/cpp/api/JsiSkMatrix.h +40 -27
  9. package/cpp/api/JsiSkPaint.h +8 -33
  10. package/cpp/api/JsiSkPath.h +71 -65
  11. package/cpp/api/JsiSkPathFactory.h +14 -1
  12. package/cpp/api/JsiSkRuntimeShaderBuilder.h +18 -0
  13. package/cpp/api/JsiSkTypeface.h +11 -2
  14. package/cpp/api/JsiSkTypefaceFactory.h +5 -1
  15. package/cpp/rnskia/RNSkInfoParameter.h +2 -0
  16. package/cpp/utils/RNSkLog.h +27 -0
  17. package/ios/RNSkia-iOS/SkiaDrawView.mm +2 -1
  18. package/lib/commonjs/animation/functions/index.js +47 -17
  19. package/lib/commonjs/animation/functions/index.js.map +1 -1
  20. package/lib/commonjs/animation/functions/interpolatePaths.js +45 -0
  21. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -0
  22. package/lib/commonjs/animation/functions/interpolateVector.js +20 -0
  23. package/lib/commonjs/animation/functions/interpolateVector.js.map +1 -0
  24. package/lib/commonjs/index.js +13 -0
  25. package/lib/commonjs/index.js.map +1 -1
  26. package/lib/commonjs/renderer/Canvas.js +19 -35
  27. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  28. package/lib/commonjs/renderer/HostConfig.js +2 -2
  29. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  30. package/lib/commonjs/renderer/components/Blend.js +10 -7
  31. package/lib/commonjs/renderer/components/Blend.js.map +1 -1
  32. package/lib/commonjs/renderer/components/Compose.js +9 -6
  33. package/lib/commonjs/renderer/components/Compose.js.map +1 -1
  34. package/lib/commonjs/renderer/components/Group.js +7 -6
  35. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  36. package/lib/commonjs/renderer/components/Mask.js +13 -10
  37. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  38. package/lib/commonjs/renderer/components/Paint.js +7 -4
  39. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  40. package/lib/commonjs/renderer/components/Picture.js.map +1 -1
  41. package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js +1 -1
  42. package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  43. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js +7 -6
  44. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
  45. package/lib/commonjs/renderer/components/colorFilters/Compose.js +6 -6
  46. package/lib/commonjs/renderer/components/colorFilters/Compose.js.map +1 -1
  47. package/lib/commonjs/renderer/components/colorFilters/Lerp.js +8 -7
  48. package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
  49. package/lib/commonjs/renderer/components/colorFilters/LinearToSRGBGamma.js +6 -6
  50. package/lib/commonjs/renderer/components/colorFilters/LinearToSRGBGamma.js.map +1 -1
  51. package/lib/commonjs/renderer/components/colorFilters/LumaColorFilter.js +6 -6
  52. package/lib/commonjs/renderer/components/colorFilters/LumaColorFilter.js.map +1 -1
  53. package/lib/commonjs/renderer/components/colorFilters/Matrix.js +6 -7
  54. package/lib/commonjs/renderer/components/colorFilters/Matrix.js.map +1 -1
  55. package/lib/commonjs/renderer/components/colorFilters/SRGBToLinearGamma.js +6 -6
  56. package/lib/commonjs/renderer/components/colorFilters/SRGBToLinearGamma.js.map +1 -1
  57. package/lib/commonjs/renderer/components/image/BoxFit.js +7 -9
  58. package/lib/commonjs/renderer/components/image/BoxFit.js.map +1 -1
  59. package/lib/commonjs/renderer/components/image/Image.js +3 -2
  60. package/lib/commonjs/renderer/components/image/Image.js.map +1 -1
  61. package/lib/commonjs/renderer/components/image/ImageSVG.js +3 -2
  62. package/lib/commonjs/renderer/components/image/ImageSVG.js.map +1 -1
  63. package/lib/commonjs/renderer/components/image/ImageShader.js +9 -6
  64. package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
  65. package/lib/commonjs/renderer/components/imageFilters/Blur.js +7 -4
  66. package/lib/commonjs/renderer/components/imageFilters/Blur.js.map +1 -1
  67. package/lib/commonjs/renderer/components/imageFilters/DisplacementMap.js +10 -7
  68. package/lib/commonjs/renderer/components/imageFilters/DisplacementMap.js.map +1 -1
  69. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +10 -15
  70. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  71. package/lib/commonjs/renderer/components/imageFilters/Morphology.js +7 -6
  72. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  73. package/lib/commonjs/renderer/components/imageFilters/Offset.js +5 -4
  74. package/lib/commonjs/renderer/components/imageFilters/Offset.js.map +1 -1
  75. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +13 -6
  76. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -1
  77. package/lib/commonjs/renderer/components/imageFilters/Shadow.js +8 -7
  78. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
  79. package/lib/commonjs/renderer/components/imageFilters/getInput.js +7 -7
  80. package/lib/commonjs/renderer/components/imageFilters/getInput.js.map +1 -1
  81. package/lib/commonjs/renderer/components/maskFilters/Blur.js +6 -3
  82. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  83. package/lib/commonjs/renderer/components/pathEffects/Corner.js +8 -6
  84. package/lib/commonjs/renderer/components/pathEffects/Corner.js.map +1 -1
  85. package/lib/commonjs/renderer/components/pathEffects/Dash.js +8 -6
  86. package/lib/commonjs/renderer/components/pathEffects/Dash.js.map +1 -1
  87. package/lib/commonjs/renderer/components/pathEffects/Discrete.js +8 -6
  88. package/lib/commonjs/renderer/components/pathEffects/Discrete.js.map +1 -1
  89. package/lib/commonjs/renderer/components/pathEffects/Line2D.js +8 -6
  90. package/lib/commonjs/renderer/components/pathEffects/Line2D.js.map +1 -1
  91. package/lib/commonjs/renderer/components/pathEffects/Path1D.js +8 -6
  92. package/lib/commonjs/renderer/components/pathEffects/Path1D.js.map +1 -1
  93. package/lib/commonjs/renderer/components/pathEffects/Path2D.js +8 -6
  94. package/lib/commonjs/renderer/components/pathEffects/Path2D.js.map +1 -1
  95. package/lib/commonjs/renderer/components/pathEffects/Sum.js +7 -4
  96. package/lib/commonjs/renderer/components/pathEffects/Sum.js.map +1 -1
  97. package/lib/commonjs/renderer/components/shaders/Color.js +7 -4
  98. package/lib/commonjs/renderer/components/shaders/Color.js.map +1 -1
  99. package/lib/commonjs/renderer/components/shaders/FractalNoise.js +5 -4
  100. package/lib/commonjs/renderer/components/shaders/FractalNoise.js.map +1 -1
  101. package/lib/commonjs/renderer/components/shaders/Gradient.js +5 -5
  102. package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
  103. package/lib/commonjs/renderer/components/shaders/LinearGradient.js +6 -5
  104. package/lib/commonjs/renderer/components/shaders/LinearGradient.js.map +1 -1
  105. package/lib/commonjs/renderer/components/shaders/RadialGradient.js +6 -5
  106. package/lib/commonjs/renderer/components/shaders/RadialGradient.js.map +1 -1
  107. package/lib/commonjs/renderer/components/shaders/Shader.js +6 -43
  108. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  109. package/lib/commonjs/renderer/components/shaders/SweepGradient.js +6 -5
  110. package/lib/commonjs/renderer/components/shaders/SweepGradient.js.map +1 -1
  111. package/lib/commonjs/renderer/components/shaders/Turbulence.js +5 -4
  112. package/lib/commonjs/renderer/components/shaders/Turbulence.js.map +1 -1
  113. package/lib/commonjs/renderer/components/shaders/TwoPointConicalGradient.js +6 -5
  114. package/lib/commonjs/renderer/components/shaders/TwoPointConicalGradient.js.map +1 -1
  115. package/lib/commonjs/renderer/components/shapes/Box.js +26 -29
  116. package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -1
  117. package/lib/commonjs/renderer/components/shapes/Circle.js +7 -5
  118. package/lib/commonjs/renderer/components/shapes/Circle.js.map +1 -1
  119. package/lib/commonjs/renderer/components/shapes/DiffRect.js.map +1 -1
  120. package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
  121. package/lib/commonjs/renderer/components/shapes/Line.js.map +1 -1
  122. package/lib/commonjs/renderer/components/shapes/Oval.js +3 -2
  123. package/lib/commonjs/renderer/components/shapes/Oval.js.map +1 -1
  124. package/lib/commonjs/renderer/components/shapes/Patch.js +8 -5
  125. package/lib/commonjs/renderer/components/shapes/Patch.js.map +1 -1
  126. package/lib/commonjs/renderer/components/shapes/Path.js +5 -4
  127. package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
  128. package/lib/commonjs/renderer/components/shapes/Points.js +2 -2
  129. package/lib/commonjs/renderer/components/shapes/Points.js.map +1 -1
  130. package/lib/commonjs/renderer/components/shapes/Rect.js +3 -2
  131. package/lib/commonjs/renderer/components/shapes/Rect.js.map +1 -1
  132. package/lib/commonjs/renderer/components/shapes/RoundedRect.js +3 -2
  133. package/lib/commonjs/renderer/components/shapes/RoundedRect.js.map +1 -1
  134. package/lib/commonjs/renderer/components/shapes/Vertices.js +9 -8
  135. package/lib/commonjs/renderer/components/shapes/Vertices.js.map +1 -1
  136. package/lib/commonjs/renderer/components/text/Glyphs.js +3 -2
  137. package/lib/commonjs/renderer/components/text/Glyphs.js.map +1 -1
  138. package/lib/commonjs/renderer/components/text/Text.js +3 -2
  139. package/lib/commonjs/renderer/components/text/Text.js.map +1 -1
  140. package/lib/commonjs/renderer/components/text/TextBlob.js.map +1 -1
  141. package/lib/commonjs/renderer/components/text/TextPath.js +7 -11
  142. package/lib/commonjs/renderer/components/text/TextPath.js.map +1 -1
  143. package/lib/commonjs/renderer/index.js +13 -13
  144. package/lib/commonjs/renderer/index.js.map +1 -1
  145. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  146. package/lib/commonjs/renderer/nodes/Drawing.js +5 -5
  147. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  148. package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
  149. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  150. package/lib/commonjs/renderer/processors/Circles.js +2 -4
  151. package/lib/commonjs/renderer/processors/Circles.js.map +1 -1
  152. package/lib/commonjs/renderer/processors/Clips.js +5 -5
  153. package/lib/commonjs/renderer/processors/Clips.js.map +1 -1
  154. package/lib/commonjs/{skia/core → renderer/processors}/Color.js +2 -6
  155. package/lib/commonjs/renderer/processors/Color.js.map +1 -0
  156. package/lib/commonjs/renderer/processors/Font.js +4 -4
  157. package/lib/commonjs/renderer/processors/Font.js.map +1 -1
  158. package/lib/commonjs/renderer/processors/Paint.js +18 -14
  159. package/lib/commonjs/renderer/processors/Paint.js.map +1 -1
  160. package/lib/commonjs/renderer/processors/Paths.js +4 -4
  161. package/lib/commonjs/renderer/processors/Paths.js.map +1 -1
  162. package/lib/commonjs/renderer/processors/Radius.js +2 -4
  163. package/lib/commonjs/renderer/processors/Radius.js.map +1 -1
  164. package/lib/commonjs/renderer/processors/Rects.js +8 -59
  165. package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
  166. package/lib/commonjs/renderer/processors/Transform.js +26 -17
  167. package/lib/commonjs/renderer/processors/Transform.js.map +1 -1
  168. package/lib/commonjs/renderer/processors/index.js +26 -13
  169. package/lib/commonjs/renderer/processors/index.js.map +1 -1
  170. package/lib/commonjs/renderer/processors/math/Coordinates.js.map +1 -1
  171. package/lib/commonjs/renderer/processors/math/Transforms.js.map +1 -1
  172. package/lib/commonjs/renderer/processors/math/index.js +0 -26
  173. package/lib/commonjs/renderer/processors/math/index.js.map +1 -1
  174. package/lib/commonjs/renderer/useCanvas.js +30 -0
  175. package/lib/commonjs/renderer/useCanvas.js.map +1 -0
  176. package/lib/commonjs/skia/NativeSetup.js +1 -1
  177. package/lib/commonjs/skia/NativeSetup.js.map +1 -1
  178. package/lib/commonjs/skia/Skia.web.js +12 -0
  179. package/lib/commonjs/skia/Skia.web.js.map +1 -0
  180. package/lib/commonjs/skia/core/Data.js +9 -4
  181. package/lib/commonjs/skia/core/Data.js.map +1 -1
  182. package/lib/commonjs/skia/core/Font.js +2 -4
  183. package/lib/commonjs/skia/core/Font.js.map +1 -1
  184. package/lib/commonjs/skia/core/Matrix.js +15 -0
  185. package/lib/commonjs/skia/core/Matrix.js.map +1 -0
  186. package/lib/commonjs/skia/core/Paint.js +4 -12
  187. package/lib/commonjs/skia/core/Paint.js.map +1 -1
  188. package/lib/commonjs/skia/core/Path.js +14 -2
  189. package/lib/commonjs/skia/core/Path.js.map +1 -1
  190. package/lib/commonjs/skia/core/RRect.js +13 -0
  191. package/lib/commonjs/skia/core/RRect.js.map +1 -0
  192. package/lib/commonjs/skia/core/Rect.js +47 -0
  193. package/lib/commonjs/skia/core/Rect.js.map +1 -0
  194. package/lib/commonjs/skia/core/Vector.js +49 -0
  195. package/lib/commonjs/skia/core/Vector.js.map +1 -0
  196. package/lib/commonjs/skia/core/index.js +51 -25
  197. package/lib/commonjs/skia/core/index.js.map +1 -1
  198. package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
  199. package/lib/commonjs/skia/types/Image/Image.js +5 -5
  200. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  201. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  202. package/lib/commonjs/skia/types/Matrix.js +58 -1
  203. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  204. package/lib/commonjs/skia/types/Paint/Paint.js +3 -3
  205. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  206. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  207. package/lib/commonjs/skia/types/Point.js.map +1 -1
  208. package/lib/commonjs/skia/types/RRect.js +7 -0
  209. package/lib/commonjs/skia/types/RRect.js.map +1 -1
  210. package/lib/commonjs/skia/types/Shader/Shader.js +45 -1
  211. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  212. package/lib/commonjs/skia/web/{api/Host.js → Host.js} +10 -1
  213. package/lib/commonjs/skia/web/Host.js.map +1 -0
  214. package/lib/commonjs/skia/web/{api/JsiSkCanvas.js → JsiSkCanvas.js} +21 -7
  215. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -0
  216. package/lib/commonjs/skia/web/{api/JsiSkColor.js → JsiSkColor.js} +163 -4
  217. package/lib/commonjs/skia/web/JsiSkColor.js.map +1 -0
  218. package/lib/commonjs/skia/web/{api/JsiSkColorFilter.js → JsiSkColorFilter.js} +0 -0
  219. package/lib/commonjs/skia/web/{api/JsiSkColorFilter.js.map → JsiSkColorFilter.js.map} +1 -1
  220. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +48 -0
  221. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -0
  222. package/lib/commonjs/skia/web/JsiSkContourMeasure.js +42 -0
  223. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -0
  224. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js +30 -0
  225. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -0
  226. package/lib/commonjs/skia/web/JsiSkData.js +18 -0
  227. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -0
  228. package/lib/commonjs/skia/web/JsiSkDataFactory.js +44 -0
  229. package/lib/commonjs/skia/web/JsiSkDataFactory.js.map +1 -0
  230. package/lib/commonjs/skia/web/JsiSkFont.js +113 -0
  231. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -0
  232. package/lib/commonjs/skia/web/JsiSkFontMgr.js +33 -0
  233. package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -0
  234. package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js +25 -0
  235. package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js.map +1 -0
  236. package/lib/commonjs/skia/web/{api/JsiSkImage.js → JsiSkImage.js} +10 -6
  237. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -0
  238. package/lib/commonjs/skia/web/JsiSkImageFactory.js +47 -0
  239. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -0
  240. package/lib/commonjs/skia/web/JsiSkImageFilter.js +18 -0
  241. package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -0
  242. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +68 -0
  243. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -0
  244. package/lib/commonjs/skia/web/JsiSkMaskFilter.js +18 -0
  245. package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -0
  246. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +24 -0
  247. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -0
  248. package/lib/commonjs/skia/web/JsiSkMatrix.js +38 -0
  249. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -0
  250. package/lib/commonjs/skia/web/{api/JsiSkPaint.js → JsiSkPaint.js} +4 -9
  251. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -0
  252. package/lib/commonjs/skia/web/JsiSkPath.js +337 -0
  253. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -0
  254. package/lib/commonjs/skia/web/JsiSkPathEffect.js +18 -0
  255. package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -0
  256. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +78 -0
  257. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -0
  258. package/lib/commonjs/skia/web/JsiSkPathFactory.js +58 -0
  259. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -0
  260. package/lib/commonjs/skia/web/JsiSkPicture.js +29 -0
  261. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -0
  262. package/lib/commonjs/skia/web/JsiSkPictureFactory.js +30 -0
  263. package/lib/commonjs/skia/web/JsiSkPictureFactory.js.map +1 -0
  264. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +30 -0
  265. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -0
  266. package/lib/commonjs/skia/web/JsiSkPoint.js +26 -0
  267. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -0
  268. package/lib/commonjs/skia/web/JsiSkRRect.js +32 -0
  269. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -0
  270. package/lib/commonjs/skia/web/JsiSkRSXform.js +18 -0
  271. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -0
  272. package/lib/commonjs/skia/web/{api/JsiSkRect.js → JsiSkRect.js} +8 -0
  273. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -0
  274. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +44 -0
  275. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -0
  276. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js +30 -0
  277. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -0
  278. package/lib/commonjs/skia/web/JsiSkSVGFactory.js +26 -0
  279. package/lib/commonjs/skia/web/JsiSkSVGFactory.js.map +1 -0
  280. package/lib/commonjs/skia/web/JsiSkShader.js +18 -0
  281. package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -0
  282. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +52 -0
  283. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -0
  284. package/lib/commonjs/skia/web/{api/JsiSkSurface.js → JsiSkSurface.js} +0 -0
  285. package/lib/commonjs/skia/web/{api/JsiSkSurface.js.map → JsiSkSurface.js.map} +1 -1
  286. package/lib/commonjs/skia/web/{api/JsiSkSurfaceFactory.js → JsiSkSurfaceFactory.js} +0 -0
  287. package/lib/commonjs/skia/web/{api/JsiSkSurfaceFactory.js.map → JsiSkSurfaceFactory.js.map} +1 -1
  288. package/lib/commonjs/skia/web/JsiSkTextBlob.js +18 -0
  289. package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -0
  290. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +36 -0
  291. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -0
  292. package/lib/commonjs/skia/web/JsiSkTypeface.js +28 -0
  293. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -0
  294. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +30 -0
  295. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -0
  296. package/lib/commonjs/skia/web/JsiSkVertices.js +28 -0
  297. package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -0
  298. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +49 -0
  299. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -0
  300. package/lib/commonjs/skia/web/JsiSkia.js +97 -0
  301. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -0
  302. package/lib/commonjs/skia/web/index.js +4 -4
  303. package/lib/commonjs/skia/web/index.js.map +1 -1
  304. package/lib/commonjs/values/web/api.js +2 -2
  305. package/lib/commonjs/values/web/api.js.map +1 -1
  306. package/lib/commonjs/views/SkiaView.web.js +216 -0
  307. package/lib/commonjs/views/SkiaView.web.js.map +1 -0
  308. package/lib/commonjs/views/types.js.map +1 -1
  309. package/lib/commonjs/views/useTouchHandler.js +70 -46
  310. package/lib/commonjs/views/useTouchHandler.js.map +1 -1
  311. package/lib/commonjs/web/index.js +22 -0
  312. package/lib/commonjs/web/index.js.map +1 -0
  313. package/lib/module/animation/functions/index.js +4 -2
  314. package/lib/module/animation/functions/index.js.map +1 -1
  315. package/lib/module/animation/functions/interpolatePaths.js +36 -0
  316. package/lib/module/animation/functions/interpolatePaths.js.map +1 -0
  317. package/lib/module/animation/functions/interpolateVector.js +7 -0
  318. package/lib/module/animation/functions/interpolateVector.js.map +1 -0
  319. package/lib/module/index.js +1 -0
  320. package/lib/module/index.js.map +1 -1
  321. package/lib/module/renderer/Canvas.js +15 -26
  322. package/lib/module/renderer/Canvas.js.map +1 -1
  323. package/lib/module/renderer/HostConfig.js +2 -2
  324. package/lib/module/renderer/HostConfig.js.map +1 -1
  325. package/lib/module/renderer/components/Blend.js +5 -2
  326. package/lib/module/renderer/components/Blend.js.map +1 -1
  327. package/lib/module/renderer/components/Compose.js +5 -2
  328. package/lib/module/renderer/components/Compose.js.map +1 -1
  329. package/lib/module/renderer/components/Group.js +7 -6
  330. package/lib/module/renderer/components/Group.js.map +1 -1
  331. package/lib/module/renderer/components/Mask.js +7 -3
  332. package/lib/module/renderer/components/Mask.js.map +1 -1
  333. package/lib/module/renderer/components/Paint.js +6 -3
  334. package/lib/module/renderer/components/Paint.js.map +1 -1
  335. package/lib/module/renderer/components/Picture.js.map +1 -1
  336. package/lib/module/renderer/components/backdrop/BackdropFilter.js +1 -1
  337. package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  338. package/lib/module/renderer/components/colorFilters/BlendColor.js +6 -3
  339. package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
  340. package/lib/module/renderer/components/colorFilters/Compose.js +2 -2
  341. package/lib/module/renderer/components/colorFilters/Compose.js.map +1 -1
  342. package/lib/module/renderer/components/colorFilters/Lerp.js +6 -3
  343. package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
  344. package/lib/module/renderer/components/colorFilters/LinearToSRGBGamma.js +5 -3
  345. package/lib/module/renderer/components/colorFilters/LinearToSRGBGamma.js.map +1 -1
  346. package/lib/module/renderer/components/colorFilters/LumaColorFilter.js +5 -3
  347. package/lib/module/renderer/components/colorFilters/LumaColorFilter.js.map +1 -1
  348. package/lib/module/renderer/components/colorFilters/Matrix.js +5 -3
  349. package/lib/module/renderer/components/colorFilters/Matrix.js.map +1 -1
  350. package/lib/module/renderer/components/colorFilters/SRGBToLinearGamma.js +5 -3
  351. package/lib/module/renderer/components/colorFilters/SRGBToLinearGamma.js.map +1 -1
  352. package/lib/module/renderer/components/image/BoxFit.js +7 -8
  353. package/lib/module/renderer/components/image/BoxFit.js.map +1 -1
  354. package/lib/module/renderer/components/image/Image.js +3 -2
  355. package/lib/module/renderer/components/image/Image.js.map +1 -1
  356. package/lib/module/renderer/components/image/ImageSVG.js +3 -2
  357. package/lib/module/renderer/components/image/ImageSVG.js.map +1 -1
  358. package/lib/module/renderer/components/image/ImageShader.js +10 -7
  359. package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
  360. package/lib/module/renderer/components/imageFilters/Blur.js +7 -4
  361. package/lib/module/renderer/components/imageFilters/Blur.js.map +1 -1
  362. package/lib/module/renderer/components/imageFilters/DisplacementMap.js +7 -4
  363. package/lib/module/renderer/components/imageFilters/DisplacementMap.js.map +1 -1
  364. package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -3
  365. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  366. package/lib/module/renderer/components/imageFilters/Morphology.js +6 -4
  367. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  368. package/lib/module/renderer/components/imageFilters/Offset.js +5 -3
  369. package/lib/module/renderer/components/imageFilters/Offset.js.map +1 -1
  370. package/lib/module/renderer/components/imageFilters/RuntimeShader.js +13 -4
  371. package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -1
  372. package/lib/module/renderer/components/imageFilters/Shadow.js +6 -5
  373. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
  374. package/lib/module/renderer/components/imageFilters/getInput.js +2 -2
  375. package/lib/module/renderer/components/imageFilters/getInput.js.map +1 -1
  376. package/lib/module/renderer/components/maskFilters/Blur.js +5 -2
  377. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  378. package/lib/module/renderer/components/pathEffects/Corner.js +5 -2
  379. package/lib/module/renderer/components/pathEffects/Corner.js.map +1 -1
  380. package/lib/module/renderer/components/pathEffects/Dash.js +5 -2
  381. package/lib/module/renderer/components/pathEffects/Dash.js.map +1 -1
  382. package/lib/module/renderer/components/pathEffects/Discrete.js +5 -2
  383. package/lib/module/renderer/components/pathEffects/Discrete.js.map +1 -1
  384. package/lib/module/renderer/components/pathEffects/Line2D.js +5 -2
  385. package/lib/module/renderer/components/pathEffects/Line2D.js.map +1 -1
  386. package/lib/module/renderer/components/pathEffects/Path1D.js +6 -3
  387. package/lib/module/renderer/components/pathEffects/Path1D.js.map +1 -1
  388. package/lib/module/renderer/components/pathEffects/Path2D.js +6 -3
  389. package/lib/module/renderer/components/pathEffects/Path2D.js.map +1 -1
  390. package/lib/module/renderer/components/pathEffects/Sum.js +5 -2
  391. package/lib/module/renderer/components/pathEffects/Sum.js.map +1 -1
  392. package/lib/module/renderer/components/shaders/Color.js +6 -3
  393. package/lib/module/renderer/components/shaders/Color.js.map +1 -1
  394. package/lib/module/renderer/components/shaders/FractalNoise.js +4 -2
  395. package/lib/module/renderer/components/shaders/FractalNoise.js.map +1 -1
  396. package/lib/module/renderer/components/shaders/Gradient.js +3 -3
  397. package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
  398. package/lib/module/renderer/components/shaders/LinearGradient.js +5 -3
  399. package/lib/module/renderer/components/shaders/LinearGradient.js.map +1 -1
  400. package/lib/module/renderer/components/shaders/RadialGradient.js +5 -3
  401. package/lib/module/renderer/components/shaders/RadialGradient.js.map +1 -1
  402. package/lib/module/renderer/components/shaders/Shader.js +6 -44
  403. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  404. package/lib/module/renderer/components/shaders/SweepGradient.js +5 -3
  405. package/lib/module/renderer/components/shaders/SweepGradient.js.map +1 -1
  406. package/lib/module/renderer/components/shaders/Turbulence.js +4 -2
  407. package/lib/module/renderer/components/shaders/Turbulence.js.map +1 -1
  408. package/lib/module/renderer/components/shaders/TwoPointConicalGradient.js +5 -3
  409. package/lib/module/renderer/components/shaders/TwoPointConicalGradient.js.map +1 -1
  410. package/lib/module/renderer/components/shapes/Box.js +20 -19
  411. package/lib/module/renderer/components/shapes/Box.js.map +1 -1
  412. package/lib/module/renderer/components/shapes/Circle.js +7 -4
  413. package/lib/module/renderer/components/shapes/Circle.js.map +1 -1
  414. package/lib/module/renderer/components/shapes/DiffRect.js.map +1 -1
  415. package/lib/module/renderer/components/shapes/FitBox.js.map +1 -1
  416. package/lib/module/renderer/components/shapes/Line.js.map +1 -1
  417. package/lib/module/renderer/components/shapes/Oval.js +3 -2
  418. package/lib/module/renderer/components/shapes/Oval.js.map +1 -1
  419. package/lib/module/renderer/components/shapes/Patch.js +5 -3
  420. package/lib/module/renderer/components/shapes/Patch.js.map +1 -1
  421. package/lib/module/renderer/components/shapes/Path.js +4 -3
  422. package/lib/module/renderer/components/shapes/Path.js.map +1 -1
  423. package/lib/module/renderer/components/shapes/Points.js +1 -1
  424. package/lib/module/renderer/components/shapes/Points.js.map +1 -1
  425. package/lib/module/renderer/components/shapes/Rect.js +3 -2
  426. package/lib/module/renderer/components/shapes/Rect.js.map +1 -1
  427. package/lib/module/renderer/components/shapes/RoundedRect.js +3 -2
  428. package/lib/module/renderer/components/shapes/RoundedRect.js.map +1 -1
  429. package/lib/module/renderer/components/shapes/Vertices.js +5 -3
  430. package/lib/module/renderer/components/shapes/Vertices.js.map +1 -1
  431. package/lib/module/renderer/components/text/Glyphs.js +3 -2
  432. package/lib/module/renderer/components/text/Glyphs.js.map +1 -1
  433. package/lib/module/renderer/components/text/Text.js +3 -2
  434. package/lib/module/renderer/components/text/Text.js.map +1 -1
  435. package/lib/module/renderer/components/text/TextBlob.js.map +1 -1
  436. package/lib/module/renderer/components/text/TextPath.js +3 -3
  437. package/lib/module/renderer/components/text/TextPath.js.map +1 -1
  438. package/lib/module/renderer/index.js +1 -1
  439. package/lib/module/renderer/index.js.map +1 -1
  440. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  441. package/lib/module/renderer/nodes/Drawing.js +3 -3
  442. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  443. package/lib/module/renderer/nodes/Node.js.map +1 -1
  444. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  445. package/lib/module/renderer/processors/Circles.js +2 -4
  446. package/lib/module/renderer/processors/Circles.js.map +1 -1
  447. package/lib/module/renderer/processors/Clips.js +3 -3
  448. package/lib/module/renderer/processors/Clips.js.map +1 -1
  449. package/lib/module/{skia/core → renderer/processors}/Color.js +1 -2
  450. package/lib/module/renderer/processors/Color.js.map +1 -0
  451. package/lib/module/renderer/processors/Font.js +3 -2
  452. package/lib/module/renderer/processors/Font.js.map +1 -1
  453. package/lib/module/renderer/processors/Paint.js +8 -5
  454. package/lib/module/renderer/processors/Paint.js.map +1 -1
  455. package/lib/module/renderer/processors/Paths.js +2 -2
  456. package/lib/module/renderer/processors/Paths.js.map +1 -1
  457. package/lib/module/renderer/processors/Radius.js +2 -3
  458. package/lib/module/renderer/processors/Radius.js.map +1 -1
  459. package/lib/module/renderer/processors/Rects.js +7 -26
  460. package/lib/module/renderer/processors/Rects.js.map +1 -1
  461. package/lib/module/renderer/processors/Transform.js +24 -16
  462. package/lib/module/renderer/processors/Transform.js.map +1 -1
  463. package/lib/module/renderer/processors/index.js +2 -1
  464. package/lib/module/renderer/processors/index.js.map +1 -1
  465. package/lib/module/renderer/processors/math/Coordinates.js.map +1 -1
  466. package/lib/module/renderer/processors/math/Transforms.js.map +1 -1
  467. package/lib/module/renderer/processors/math/index.js +0 -2
  468. package/lib/module/renderer/processors/math/index.js.map +1 -1
  469. package/lib/module/renderer/useCanvas.js +13 -0
  470. package/lib/module/renderer/useCanvas.js.map +1 -0
  471. package/lib/module/skia/NativeSetup.js +2 -2
  472. package/lib/module/skia/NativeSetup.js.map +1 -1
  473. package/lib/module/skia/Skia.web.js +3 -0
  474. package/lib/module/skia/Skia.web.js.map +1 -0
  475. package/lib/module/skia/core/Data.js +11 -5
  476. package/lib/module/skia/core/Data.js.map +1 -1
  477. package/lib/module/skia/core/Font.js +2 -4
  478. package/lib/module/skia/core/Font.js.map +1 -1
  479. package/lib/module/skia/core/Matrix.js +4 -0
  480. package/lib/module/skia/core/Matrix.js.map +1 -0
  481. package/lib/module/skia/core/Paint.js +3 -7
  482. package/lib/module/skia/core/Paint.js.map +1 -1
  483. package/lib/module/skia/core/Path.js +11 -2
  484. package/lib/module/skia/core/Path.js.map +1 -1
  485. package/lib/module/skia/core/RRect.js +3 -0
  486. package/lib/module/skia/core/RRect.js.map +1 -0
  487. package/lib/module/skia/core/Rect.js +17 -0
  488. package/lib/module/skia/core/Rect.js.map +1 -0
  489. package/lib/module/{renderer/processors/math → skia/core}/Vector.js +2 -7
  490. package/lib/module/skia/core/Vector.js.map +1 -0
  491. package/lib/module/skia/core/index.js +5 -3
  492. package/lib/module/skia/core/index.js.map +1 -1
  493. package/lib/module/skia/types/Font/Font.js.map +1 -1
  494. package/lib/module/skia/types/Image/Image.js +5 -5
  495. package/lib/module/skia/types/Image/Image.js.map +1 -1
  496. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  497. package/lib/module/skia/types/Matrix.js +55 -0
  498. package/lib/module/skia/types/Matrix.js.map +1 -1
  499. package/lib/module/skia/types/Paint/Paint.js +3 -3
  500. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  501. package/lib/module/skia/types/Path/Path.js.map +1 -1
  502. package/lib/module/skia/types/Point.js.map +1 -1
  503. package/lib/module/skia/types/RRect.js +3 -1
  504. package/lib/module/skia/types/RRect.js.map +1 -1
  505. package/lib/module/skia/types/Shader/Shader.js +42 -0
  506. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  507. package/lib/module/skia/web/{api/Host.js → Host.js} +6 -0
  508. package/lib/module/skia/web/Host.js.map +1 -0
  509. package/lib/module/skia/web/{api/JsiSkCanvas.js → JsiSkCanvas.js} +20 -7
  510. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -0
  511. package/lib/module/skia/web/{api/JsiSkColor.js → JsiSkColor.js} +164 -4
  512. package/lib/module/skia/web/JsiSkColor.js.map +1 -0
  513. package/lib/module/skia/web/{api/JsiSkColorFilter.js → JsiSkColorFilter.js} +0 -0
  514. package/lib/module/skia/web/{api/JsiSkColorFilter.js.map → JsiSkColorFilter.js.map} +1 -1
  515. package/lib/module/skia/web/JsiSkColorFilterFactory.js +37 -0
  516. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -0
  517. package/lib/module/skia/web/JsiSkContourMeasure.js +31 -0
  518. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -0
  519. package/lib/module/skia/web/JsiSkContourMeasureIter.js +19 -0
  520. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -0
  521. package/lib/module/skia/web/JsiSkData.js +8 -0
  522. package/lib/module/skia/web/JsiSkData.js.map +1 -0
  523. package/lib/module/skia/web/JsiSkDataFactory.js +33 -0
  524. package/lib/module/skia/web/JsiSkDataFactory.js.map +1 -0
  525. package/lib/module/skia/web/JsiSkFont.js +101 -0
  526. package/lib/module/skia/web/JsiSkFont.js.map +1 -0
  527. package/lib/module/skia/web/JsiSkFontMgr.js +23 -0
  528. package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -0
  529. package/lib/module/skia/web/JsiSkFontMgrFactory.js +14 -0
  530. package/lib/module/skia/web/JsiSkFontMgrFactory.js.map +1 -0
  531. package/lib/module/skia/web/JsiSkImage.js +49 -0
  532. package/lib/module/skia/web/JsiSkImage.js.map +1 -0
  533. package/lib/module/skia/web/JsiSkImageFactory.js +36 -0
  534. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -0
  535. package/lib/module/skia/web/JsiSkImageFilter.js +8 -0
  536. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -0
  537. package/lib/module/skia/web/JsiSkImageFilterFactory.js +57 -0
  538. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -0
  539. package/lib/module/skia/web/JsiSkMaskFilter.js +8 -0
  540. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -0
  541. package/lib/module/skia/web/JsiSkMaskFilterFactory.js +13 -0
  542. package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -0
  543. package/lib/module/skia/web/JsiSkMatrix.js +28 -0
  544. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -0
  545. package/lib/module/skia/web/{api/JsiSkPaint.js → JsiSkPaint.js} +5 -10
  546. package/lib/module/skia/web/JsiSkPaint.js.map +1 -0
  547. package/lib/module/skia/web/JsiSkPath.js +324 -0
  548. package/lib/module/skia/web/JsiSkPath.js.map +1 -0
  549. package/lib/module/skia/web/JsiSkPathEffect.js +8 -0
  550. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -0
  551. package/lib/module/skia/web/JsiSkPathEffectFactory.js +67 -0
  552. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -0
  553. package/lib/module/skia/web/JsiSkPathFactory.js +47 -0
  554. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -0
  555. package/lib/module/skia/web/JsiSkPicture.js +18 -0
  556. package/lib/module/skia/web/JsiSkPicture.js.map +1 -0
  557. package/lib/module/skia/web/JsiSkPictureFactory.js +19 -0
  558. package/lib/module/skia/web/JsiSkPictureFactory.js.map +1 -0
  559. package/lib/module/skia/web/JsiSkPictureRecorder.js +18 -0
  560. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -0
  561. package/lib/module/skia/web/JsiSkPoint.js +16 -0
  562. package/lib/module/skia/web/JsiSkPoint.js.map +1 -0
  563. package/lib/module/skia/web/JsiSkRRect.js +21 -0
  564. package/lib/module/skia/web/JsiSkRRect.js.map +1 -0
  565. package/lib/module/skia/web/JsiSkRSXform.js +8 -0
  566. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -0
  567. package/lib/module/skia/web/{api/JsiSkRect.js → JsiSkRect.js} +8 -0
  568. package/lib/module/skia/web/JsiSkRect.js.map +1 -0
  569. package/lib/module/skia/web/JsiSkRuntimeEffect.js +33 -0
  570. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -0
  571. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js +19 -0
  572. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -0
  573. package/lib/module/skia/web/JsiSkSVGFactory.js +16 -0
  574. package/lib/module/skia/web/JsiSkSVGFactory.js.map +1 -0
  575. package/lib/module/skia/web/JsiSkShader.js +8 -0
  576. package/lib/module/skia/web/JsiSkShader.js.map +1 -0
  577. package/lib/module/skia/web/JsiSkShaderFactory.js +41 -0
  578. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -0
  579. package/lib/module/skia/web/{api/JsiSkSurface.js → JsiSkSurface.js} +0 -0
  580. package/lib/module/skia/web/{api/JsiSkSurface.js.map → JsiSkSurface.js.map} +1 -1
  581. package/lib/module/skia/web/{api/JsiSkSurfaceFactory.js → JsiSkSurfaceFactory.js} +0 -0
  582. package/lib/module/skia/web/{api/JsiSkSurfaceFactory.js.map → JsiSkSurfaceFactory.js.map} +1 -1
  583. package/lib/module/skia/web/JsiSkTextBlob.js +8 -0
  584. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -0
  585. package/lib/module/skia/web/JsiSkTextBlobFactory.js +25 -0
  586. package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -0
  587. package/lib/module/skia/web/JsiSkTypeface.js +18 -0
  588. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -0
  589. package/lib/module/skia/web/JsiSkTypefaceFactory.js +19 -0
  590. package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -0
  591. package/lib/module/skia/web/JsiSkVertices.js +17 -0
  592. package/lib/module/skia/web/JsiSkVertices.js.map +1 -0
  593. package/lib/module/skia/web/JsiSkVerticesFactory.js +39 -0
  594. package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -0
  595. package/lib/module/skia/web/JsiSkia.js +61 -0
  596. package/lib/module/skia/web/JsiSkia.js.map +1 -0
  597. package/lib/module/skia/web/index.js +1 -1
  598. package/lib/module/skia/web/index.js.map +1 -1
  599. package/lib/module/values/web/api.js +2 -2
  600. package/lib/module/values/web/api.js.map +1 -1
  601. package/lib/module/views/SkiaView.web.js +202 -0
  602. package/lib/module/views/SkiaView.web.js.map +1 -0
  603. package/lib/module/views/types.js.map +1 -1
  604. package/lib/module/views/useTouchHandler.js +64 -43
  605. package/lib/module/views/useTouchHandler.js.map +1 -1
  606. package/lib/module/web/index.js +10 -0
  607. package/lib/module/web/index.js.map +1 -0
  608. package/lib/typescript/src/animation/functions/index.d.ts +4 -2
  609. package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +17 -0
  610. package/lib/typescript/src/animation/functions/interpolateVector.d.ts +10 -0
  611. package/lib/typescript/src/index.d.ts +1 -0
  612. package/lib/typescript/src/renderer/Canvas.d.ts +3 -14
  613. package/lib/typescript/src/renderer/DrawingContext.d.ts +3 -3
  614. package/lib/typescript/src/renderer/components/Blend.d.ts +1 -1
  615. package/lib/typescript/src/renderer/components/Group.d.ts +1 -1
  616. package/lib/typescript/src/renderer/components/Paint.d.ts +1 -1
  617. package/lib/typescript/src/renderer/components/Picture.d.ts +1 -1
  618. package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +2 -2
  619. package/lib/typescript/src/renderer/components/colorFilters/Compose.d.ts +2 -2
  620. package/lib/typescript/src/renderer/components/image/BoxFit.d.ts +13 -3
  621. package/lib/typescript/src/renderer/components/image/Image.d.ts +1 -1
  622. package/lib/typescript/src/renderer/components/image/ImageSVG.d.ts +1 -1
  623. package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +2 -2
  624. package/lib/typescript/src/renderer/components/imageFilters/Blur.d.ts +1 -1
  625. package/lib/typescript/src/renderer/components/imageFilters/DisplacementMap.d.ts +1 -1
  626. package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +2 -2
  627. package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +2 -1
  628. package/lib/typescript/src/renderer/components/imageFilters/Shadow.d.ts +1 -1
  629. package/lib/typescript/src/renderer/components/imageFilters/getInput.d.ts +2 -1
  630. package/lib/typescript/src/renderer/components/maskFilters/Blur.d.ts +1 -1
  631. package/lib/typescript/src/renderer/components/pathEffects/Line2D.d.ts +1 -1
  632. package/lib/typescript/src/renderer/components/pathEffects/Path1D.d.ts +1 -1
  633. package/lib/typescript/src/renderer/components/pathEffects/Path2D.d.ts +1 -1
  634. package/lib/typescript/src/renderer/components/shaders/Color.d.ts +1 -1
  635. package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +4 -4
  636. package/lib/typescript/src/renderer/components/shaders/LinearGradient.d.ts +2 -1
  637. package/lib/typescript/src/renderer/components/shaders/RadialGradient.d.ts +2 -1
  638. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -8
  639. package/lib/typescript/src/renderer/components/shaders/SweepGradient.d.ts +2 -1
  640. package/lib/typescript/src/renderer/components/shaders/TwoPointConicalGradient.d.ts +2 -1
  641. package/lib/typescript/src/renderer/components/shapes/Box.d.ts +1 -1
  642. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +4 -1
  643. package/lib/typescript/src/renderer/components/shapes/DiffRect.d.ts +1 -1
  644. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +1 -1
  645. package/lib/typescript/src/renderer/components/shapes/Line.d.ts +2 -1
  646. package/lib/typescript/src/renderer/components/shapes/Patch.d.ts +3 -3
  647. package/lib/typescript/src/renderer/components/shapes/Path.d.ts +1 -1
  648. package/lib/typescript/src/renderer/components/shapes/Points.d.ts +2 -2
  649. package/lib/typescript/src/renderer/components/shapes/Vertices.d.ts +2 -2
  650. package/lib/typescript/src/renderer/components/text/Glyphs.d.ts +1 -1
  651. package/lib/typescript/src/renderer/components/text/TextBlob.d.ts +1 -1
  652. package/lib/typescript/src/renderer/components/text/TextPath.d.ts +1 -1
  653. package/lib/typescript/src/renderer/index.d.ts +1 -1
  654. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +1 -1
  655. package/lib/typescript/src/renderer/nodes/Node.d.ts +1 -1
  656. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +0 -2
  657. package/lib/typescript/src/renderer/processors/Circles.d.ts +2 -2
  658. package/lib/typescript/src/renderer/processors/Clips.d.ts +2 -2
  659. package/lib/typescript/src/{skia/core → renderer/processors}/Color.d.ts +2 -2
  660. package/lib/typescript/src/renderer/processors/Font.d.ts +2 -2
  661. package/lib/typescript/src/renderer/processors/Paint.d.ts +3 -3
  662. package/lib/typescript/src/renderer/processors/Paths.d.ts +2 -2
  663. package/lib/typescript/src/renderer/processors/Radius.d.ts +2 -2
  664. package/lib/typescript/src/renderer/processors/Rects.d.ts +3 -14
  665. package/lib/typescript/src/renderer/processors/Transform.d.ts +3 -4
  666. package/lib/typescript/src/renderer/processors/index.d.ts +2 -1
  667. package/lib/typescript/src/renderer/processors/math/Coordinates.d.ts +1 -1
  668. package/lib/typescript/src/renderer/processors/math/Transforms.d.ts +1 -1
  669. package/lib/typescript/src/renderer/processors/math/index.d.ts +0 -2
  670. package/lib/typescript/src/renderer/useCanvas.d.ts +14 -0
  671. package/lib/typescript/src/skia/Skia.web.d.ts +1 -0
  672. package/lib/typescript/src/skia/core/Data.d.ts +4 -4
  673. package/lib/typescript/src/skia/core/Matrix.d.ts +2 -0
  674. package/lib/typescript/src/skia/core/Paint.d.ts +0 -1
  675. package/lib/typescript/src/skia/core/RRect.d.ts +2 -0
  676. package/lib/typescript/src/skia/core/Rect.d.ts +8 -0
  677. package/lib/typescript/src/skia/core/Vector.d.ts +12 -0
  678. package/lib/typescript/src/skia/core/index.d.ts +5 -3
  679. package/lib/typescript/src/skia/types/ContourMeasure.d.ts +2 -4
  680. package/lib/typescript/src/skia/types/Data/Data.d.ts +1 -1
  681. package/lib/typescript/src/skia/types/Data/DataFactory.d.ts +4 -4
  682. package/lib/typescript/src/skia/types/Font/Font.d.ts +8 -9
  683. package/lib/typescript/src/skia/types/FontMgr/FontMgr.d.ts +1 -1
  684. package/lib/typescript/src/skia/types/FontMgr/FontMgrFactory.d.ts +2 -2
  685. package/lib/typescript/src/skia/types/Image/Image.d.ts +5 -5
  686. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +3 -3
  687. package/lib/typescript/src/skia/types/Matrix.d.ts +15 -14
  688. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +3 -3
  689. package/lib/typescript/src/skia/types/Path/Path.d.ts +27 -22
  690. package/lib/typescript/src/skia/types/Path/PathFactory.d.ts +5 -0
  691. package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -2
  692. package/lib/typescript/src/skia/types/Point.d.ts +1 -0
  693. package/lib/typescript/src/skia/types/RRect.d.ts +1 -0
  694. package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +3 -1
  695. package/lib/typescript/src/skia/types/SVG/SVGFactory.d.ts +2 -2
  696. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +8 -0
  697. package/lib/typescript/src/skia/types/Skia.d.ts +1 -1
  698. package/lib/typescript/src/skia/types/Typeface/TypefaceFactory.d.ts +2 -2
  699. package/lib/typescript/src/skia/web/{api/Host.d.ts → Host.d.ts} +4 -1
  700. package/lib/typescript/src/skia/web/{api/JsiSkCanvas.d.ts → JsiSkCanvas.d.ts} +1 -1
  701. package/lib/typescript/src/skia/web/JsiSkColor.d.ts +2 -0
  702. package/lib/typescript/src/skia/web/{api/JsiSkColorFilter.d.ts → JsiSkColorFilter.d.ts} +1 -1
  703. package/lib/typescript/src/skia/web/JsiSkColorFilterFactory.d.ts +14 -0
  704. package/lib/typescript/src/skia/web/JsiSkContourMeasure.d.ts +16 -0
  705. package/lib/typescript/src/skia/web/JsiSkContourMeasureIter.d.ts +8 -0
  706. package/lib/typescript/src/skia/web/JsiSkData.d.ts +8 -0
  707. package/lib/typescript/src/skia/web/JsiSkDataFactory.d.ts +19 -0
  708. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +33 -0
  709. package/lib/typescript/src/skia/web/JsiSkFontMgr.d.ts +9 -0
  710. package/lib/typescript/src/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
  711. package/lib/typescript/src/skia/web/{api/JsiSkImage.d.ts → JsiSkImage.d.ts} +4 -4
  712. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +10 -0
  713. package/lib/typescript/src/skia/web/JsiSkImageFilter.d.ts +6 -0
  714. package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +19 -0
  715. package/lib/typescript/src/skia/web/JsiSkMaskFilter.d.ts +6 -0
  716. package/lib/typescript/src/skia/web/JsiSkMaskFilterFactory.d.ts +9 -0
  717. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +11 -0
  718. package/lib/typescript/src/skia/web/{api/JsiSkPaint.d.ts → JsiSkPaint.d.ts} +1 -1
  719. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +56 -0
  720. package/lib/typescript/src/skia/web/JsiSkPathEffect.d.ts +6 -0
  721. package/lib/typescript/src/skia/web/JsiSkPathEffectFactory.d.ts +15 -0
  722. package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +13 -0
  723. package/lib/typescript/src/skia/web/JsiSkPicture.d.ts +9 -0
  724. package/lib/typescript/src/skia/web/JsiSkPictureFactory.d.ts +8 -0
  725. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +11 -0
  726. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +8 -0
  727. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +10 -0
  728. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +8 -0
  729. package/lib/typescript/src/skia/web/{api/JsiSkRect.d.ts → JsiSkRect.d.ts} +2 -1
  730. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +14 -0
  731. package/lib/typescript/src/skia/web/JsiSkRuntimeEffectFactory.d.ts +8 -0
  732. package/lib/typescript/src/skia/web/JsiSkSVGFactory.d.ts +9 -0
  733. package/lib/typescript/src/skia/web/JsiSkShader.d.ts +6 -0
  734. package/lib/typescript/src/skia/web/JsiSkShaderFactory.d.ts +16 -0
  735. package/lib/typescript/src/skia/web/{api/JsiSkSurface.d.ts → JsiSkSurface.d.ts} +1 -1
  736. package/lib/typescript/src/skia/web/{api/JsiSkSurfaceFactory.d.ts → JsiSkSurfaceFactory.d.ts} +1 -1
  737. package/lib/typescript/src/skia/web/JsiSkTextBlob.d.ts +6 -0
  738. package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +12 -0
  739. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +8 -0
  740. package/lib/typescript/src/skia/web/JsiSkTypefaceFactory.d.ts +8 -0
  741. package/lib/typescript/src/skia/web/JsiSkVertices.d.ts +9 -0
  742. package/lib/typescript/src/skia/web/JsiSkVerticesFactory.d.ts +4 -0
  743. package/lib/typescript/src/skia/web/JsiSkia.d.ts +3 -0
  744. package/lib/typescript/src/skia/web/index.d.ts +1 -1
  745. package/lib/typescript/src/views/SkiaView.web.d.ts +56 -0
  746. package/lib/typescript/src/views/types.d.ts +1 -0
  747. package/lib/typescript/src/views/useTouchHandler.d.ts +11 -1
  748. package/lib/typescript/src/web/index.d.ts +5 -0
  749. package/package.json +4 -5
  750. package/src/animation/functions/index.ts +4 -2
  751. package/src/animation/functions/interpolatePaths.ts +38 -0
  752. package/src/animation/functions/interpolateVector.ts +26 -0
  753. package/src/index.ts +1 -0
  754. package/src/renderer/Canvas.tsx +13 -35
  755. package/src/renderer/DrawingContext.ts +3 -4
  756. package/src/renderer/HostConfig.ts +2 -2
  757. package/src/renderer/components/Blend.tsx +12 -10
  758. package/src/renderer/components/Compose.tsx +2 -2
  759. package/src/renderer/components/Group.tsx +11 -6
  760. package/src/renderer/components/Mask.tsx +5 -3
  761. package/src/renderer/components/Paint.tsx +5 -4
  762. package/src/renderer/components/Picture.tsx +1 -1
  763. package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
  764. package/src/renderer/components/colorFilters/BlendColor.tsx +4 -4
  765. package/src/renderer/components/colorFilters/Compose.ts +3 -2
  766. package/src/renderer/components/colorFilters/Lerp.tsx +3 -2
  767. package/src/renderer/components/colorFilters/LinearToSRGBGamma.tsx +2 -3
  768. package/src/renderer/components/colorFilters/LumaColorFilter.tsx +2 -3
  769. package/src/renderer/components/colorFilters/Matrix.tsx +2 -3
  770. package/src/renderer/components/colorFilters/SRGBToLinearGamma.tsx +2 -3
  771. package/src/renderer/components/image/BoxFit.ts +7 -13
  772. package/src/renderer/components/image/Image.tsx +3 -3
  773. package/src/renderer/components/image/ImageSVG.tsx +3 -3
  774. package/src/renderer/components/image/ImageShader.tsx +8 -7
  775. package/src/renderer/components/imageFilters/Blur.tsx +12 -10
  776. package/src/renderer/components/imageFilters/DisplacementMap.tsx +4 -4
  777. package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -3
  778. package/src/renderer/components/imageFilters/Morphology.tsx +3 -4
  779. package/src/renderer/components/imageFilters/Offset.tsx +5 -4
  780. package/src/renderer/components/imageFilters/RuntimeShader.tsx +12 -4
  781. package/src/renderer/components/imageFilters/Shadow.tsx +10 -6
  782. package/src/renderer/components/imageFilters/getInput.ts +3 -2
  783. package/src/renderer/components/maskFilters/Blur.tsx +2 -2
  784. package/src/renderer/components/pathEffects/Corner.tsx +2 -2
  785. package/src/renderer/components/pathEffects/Dash.tsx +2 -2
  786. package/src/renderer/components/pathEffects/Discrete.tsx +2 -2
  787. package/src/renderer/components/pathEffects/Line2D.tsx +3 -3
  788. package/src/renderer/components/pathEffects/Path1D.tsx +3 -3
  789. package/src/renderer/components/pathEffects/Path2D.tsx +4 -4
  790. package/src/renderer/components/pathEffects/Sum.tsx +7 -5
  791. package/src/renderer/components/shaders/Color.tsx +7 -5
  792. package/src/renderer/components/shaders/FractalNoise.tsx +1 -2
  793. package/src/renderer/components/shaders/Gradient.ts +7 -10
  794. package/src/renderer/components/shaders/LinearGradient.tsx +4 -4
  795. package/src/renderer/components/shaders/RadialGradient.tsx +4 -4
  796. package/src/renderer/components/shaders/Shader.tsx +6 -56
  797. package/src/renderer/components/shaders/SweepGradient.tsx +4 -4
  798. package/src/renderer/components/shaders/Turbulence.tsx +1 -2
  799. package/src/renderer/components/shaders/TwoPointConicalGradient.tsx +4 -4
  800. package/src/renderer/components/shapes/Box.tsx +36 -17
  801. package/src/renderer/components/shapes/Circle.tsx +3 -4
  802. package/src/renderer/components/shapes/DiffRect.tsx +1 -1
  803. package/src/renderer/components/shapes/FitBox.tsx +1 -1
  804. package/src/renderer/components/shapes/Line.tsx +2 -1
  805. package/src/renderer/components/shapes/Oval.tsx +6 -4
  806. package/src/renderer/components/shapes/Patch.tsx +6 -10
  807. package/src/renderer/components/shapes/Path.tsx +3 -3
  808. package/src/renderer/components/shapes/Points.tsx +2 -2
  809. package/src/renderer/components/shapes/Rect.tsx +6 -4
  810. package/src/renderer/components/shapes/RoundedRect.tsx +2 -2
  811. package/src/renderer/components/shapes/Vertices.tsx +5 -4
  812. package/src/renderer/components/text/Glyphs.tsx +6 -3
  813. package/src/renderer/components/text/Text.tsx +2 -2
  814. package/src/renderer/components/text/TextBlob.tsx +1 -1
  815. package/src/renderer/components/text/TextPath.tsx +3 -4
  816. package/src/renderer/index.ts +1 -1
  817. package/src/renderer/nodes/Declaration.tsx +1 -1
  818. package/src/renderer/nodes/Drawing.tsx +3 -2
  819. package/src/renderer/nodes/Node.ts +1 -1
  820. package/src/renderer/processors/Animations/Animations.ts +0 -3
  821. package/src/renderer/processors/Circles.ts +4 -4
  822. package/src/renderer/processors/Clips.ts +9 -4
  823. package/src/{skia/core → renderer/processors}/Color.ts +2 -3
  824. package/src/renderer/processors/Font.ts +10 -3
  825. package/src/renderer/processors/Paint.ts +12 -7
  826. package/src/renderer/processors/Paths.ts +3 -3
  827. package/src/renderer/processors/Radius.ts +3 -4
  828. package/src/renderer/processors/Rects.ts +10 -45
  829. package/src/renderer/processors/Transform.ts +28 -19
  830. package/src/renderer/processors/index.ts +2 -1
  831. package/src/renderer/processors/math/Coordinates.ts +1 -1
  832. package/src/renderer/processors/math/Transforms.ts +2 -1
  833. package/src/renderer/processors/math/index.ts +0 -2
  834. package/src/renderer/useCanvas.ts +21 -0
  835. package/src/skia/NativeSetup.ts +2 -2
  836. package/src/skia/Skia.web.ts +3 -0
  837. package/src/skia/core/Data.ts +17 -14
  838. package/src/skia/core/Font.ts +2 -4
  839. package/src/skia/core/Matrix.ts +6 -0
  840. package/src/skia/core/Paint.ts +2 -6
  841. package/src/skia/core/Path.ts +14 -6
  842. package/src/skia/core/RRect.tsx +5 -0
  843. package/src/skia/core/Rect.ts +33 -0
  844. package/src/skia/core/Vector.ts +11 -0
  845. package/src/skia/core/index.ts +5 -3
  846. package/src/skia/types/ContourMeasure.tsx +2 -4
  847. package/src/skia/types/Data/Data.ts +1 -1
  848. package/src/skia/types/Data/DataFactory.ts +4 -4
  849. package/src/skia/types/Font/Font.ts +9 -14
  850. package/src/skia/types/FontMgr/FontMgr.ts +1 -1
  851. package/src/skia/types/FontMgr/FontMgrFactory.ts +2 -2
  852. package/src/skia/types/Image/Image.ts +4 -4
  853. package/src/skia/types/Image/ImageFactory.ts +3 -3
  854. package/src/skia/types/Matrix.ts +79 -14
  855. package/src/skia/types/Paint/Paint.ts +1 -1
  856. package/src/skia/types/Path/Path.ts +33 -23
  857. package/src/skia/types/Path/PathFactory.ts +7 -0
  858. package/src/skia/types/Picture/Picture.ts +2 -2
  859. package/src/skia/types/Point.ts +2 -0
  860. package/src/skia/types/RRect.ts +5 -0
  861. package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +4 -1
  862. package/src/skia/types/SVG/SVGFactory.ts +2 -2
  863. package/src/skia/types/Shader/Shader.ts +59 -0
  864. package/src/skia/types/Skia.ts +1 -1
  865. package/src/skia/types/Typeface/TypefaceFactory.ts +2 -2
  866. package/src/skia/web/{api/Host.ts → Host.ts} +7 -1
  867. package/src/skia/web/{api/JsiSkCanvas.ts → JsiSkCanvas.ts} +20 -12
  868. package/src/skia/web/{api/JsiSkColor.ts → JsiSkColor.ts} +152 -6
  869. package/src/skia/web/{api/JsiSkColorFilter.ts → JsiSkColorFilter.ts} +1 -1
  870. package/src/skia/web/JsiSkColorFilterFactory.ts +67 -0
  871. package/src/skia/web/JsiSkContourMeasure.ts +35 -0
  872. package/src/skia/web/JsiSkContourMeasureIter.ts +23 -0
  873. package/src/skia/web/JsiSkData.ts +13 -0
  874. package/src/skia/web/JsiSkDataFactory.ts +35 -0
  875. package/src/skia/web/JsiSkFont.ts +128 -0
  876. package/src/skia/web/JsiSkFontMgr.ts +38 -0
  877. package/src/skia/web/JsiSkFontMgrFactory.ts +18 -0
  878. package/src/skia/web/JsiSkImage.ts +87 -0
  879. package/src/skia/web/JsiSkImageFactory.ts +40 -0
  880. package/src/skia/web/JsiSkImageFilter.ts +14 -0
  881. package/src/skia/web/JsiSkImageFilterFactory.ts +144 -0
  882. package/src/skia/web/JsiSkMaskFilter.ts +14 -0
  883. package/src/skia/web/JsiSkMaskFilterFactory.ts +20 -0
  884. package/src/skia/web/JsiSkMatrix.ts +54 -0
  885. package/src/skia/web/{api/JsiSkPaint.ts → JsiSkPaint.ts} +7 -6
  886. package/src/skia/web/JsiSkPath.ts +386 -0
  887. package/src/skia/web/JsiSkPathEffect.ts +14 -0
  888. package/src/skia/web/JsiSkPathEffectFactory.ts +85 -0
  889. package/src/skia/web/JsiSkPathFactory.ts +54 -0
  890. package/src/skia/web/JsiSkPicture.ts +45 -0
  891. package/src/skia/web/JsiSkPictureFactory.ts +20 -0
  892. package/src/skia/web/JsiSkPictureRecorder.ts +31 -0
  893. package/src/skia/web/JsiSkPoint.ts +19 -0
  894. package/src/skia/web/JsiSkRRect.ts +27 -0
  895. package/src/skia/web/JsiSkRSXform.ts +16 -0
  896. package/src/skia/web/{api/JsiSkRect.ts → JsiSkRect.ts} +11 -1
  897. package/src/skia/web/JsiSkRuntimeEffect.ts +57 -0
  898. package/src/skia/web/JsiSkRuntimeEffectFactory.ts +23 -0
  899. package/src/skia/web/JsiSkSVGFactory.ts +20 -0
  900. package/src/skia/web/JsiSkShader.ts +14 -0
  901. package/src/skia/web/JsiSkShaderFactory.ts +181 -0
  902. package/src/skia/web/{api/JsiSkSurface.ts → JsiSkSurface.ts} +1 -1
  903. package/src/skia/web/{api/JsiSkSurfaceFactory.ts → JsiSkSurfaceFactory.ts} +1 -1
  904. package/src/skia/web/JsiSkTextBlob.ts +14 -0
  905. package/src/skia/web/JsiSkTextBlobFactory.ts +49 -0
  906. package/src/skia/web/JsiSkTypeface.ts +28 -0
  907. package/src/skia/web/JsiSkTypefaceFactory.tsx +20 -0
  908. package/src/skia/web/JsiSkVertices.ts +23 -0
  909. package/src/skia/web/JsiSkVerticesFactory.ts +41 -0
  910. package/src/skia/web/JsiSkia.ts +98 -0
  911. package/src/skia/web/index.ts +1 -1
  912. package/src/values/web/api.ts +2 -2
  913. package/src/views/SkiaView.web.tsx +190 -0
  914. package/src/views/types.ts +1 -0
  915. package/src/views/useTouchHandler.ts +82 -51
  916. package/src/web/index.ts +15 -0
  917. package/lib/commonjs/renderer/processors/math/Matrix3.js +0 -66
  918. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +0 -1
  919. package/lib/commonjs/renderer/processors/math/Vector.js +0 -60
  920. package/lib/commonjs/renderer/processors/math/Vector.js.map +0 -1
  921. package/lib/commonjs/skia/core/Color.js.map +0 -1
  922. package/lib/commonjs/skia/core/Shader.js +0 -18
  923. package/lib/commonjs/skia/core/Shader.js.map +0 -1
  924. package/lib/commonjs/skia/web/api/Host.js.map +0 -1
  925. package/lib/commonjs/skia/web/api/JsiSkCanvas.js.map +0 -1
  926. package/lib/commonjs/skia/web/api/JsiSkColor.js.map +0 -1
  927. package/lib/commonjs/skia/web/api/JsiSkImage.js.map +0 -1
  928. package/lib/commonjs/skia/web/api/JsiSkPaint.js.map +0 -1
  929. package/lib/commonjs/skia/web/api/JsiSkRect.js.map +0 -1
  930. package/lib/commonjs/skia/web/api/index.js +0 -26
  931. package/lib/commonjs/skia/web/api/index.js.map +0 -1
  932. package/lib/module/renderer/processors/math/Matrix3.js +0 -55
  933. package/lib/module/renderer/processors/math/Matrix3.js.map +0 -1
  934. package/lib/module/renderer/processors/math/Vector.js.map +0 -1
  935. package/lib/module/skia/core/Color.js.map +0 -1
  936. package/lib/module/skia/core/Shader.js +0 -7
  937. package/lib/module/skia/core/Shader.js.map +0 -1
  938. package/lib/module/skia/web/api/Host.js.map +0 -1
  939. package/lib/module/skia/web/api/JsiSkCanvas.js.map +0 -1
  940. package/lib/module/skia/web/api/JsiSkColor.js.map +0 -1
  941. package/lib/module/skia/web/api/JsiSkImage.js +0 -46
  942. package/lib/module/skia/web/api/JsiSkImage.js.map +0 -1
  943. package/lib/module/skia/web/api/JsiSkPaint.js.map +0 -1
  944. package/lib/module/skia/web/api/JsiSkRect.js.map +0 -1
  945. package/lib/module/skia/web/api/index.js +0 -13
  946. package/lib/module/skia/web/api/index.js.map +0 -1
  947. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +0 -10
  948. package/lib/typescript/src/renderer/processors/math/Vector.d.ts +0 -23
  949. package/lib/typescript/src/skia/core/Shader.d.ts +0 -1
  950. package/lib/typescript/src/skia/web/api/JsiSkColor.d.ts +0 -3
  951. package/lib/typescript/src/skia/web/api/index.d.ts +0 -10
  952. package/src/animation/timing/functions/__tests__/timing.spec.ts +0 -29
  953. package/src/renderer/processors/math/Matrix3.ts +0 -73
  954. package/src/renderer/processors/math/Vector.ts +0 -38
  955. package/src/skia/__tests__/Rects.spec.ts +0 -40
  956. package/src/skia/__tests__/snapshots/lightblue-rect.png +0 -0
  957. package/src/skia/core/Shader.ts +0 -9
  958. package/src/skia/web/api/JsiSkImage.ts +0 -66
  959. package/src/skia/web/api/index.ts +0 -15
  960. package/src/values/web/__tests__/RNSkAnimation.spec.ts +0 -21
  961. package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +0 -15
  962. package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +0 -8
  963. package/src/values/web/__tests__/RNSkValue.spec.ts +0 -11
@@ -1,3 +1,5 @@
1
- export { interpolate } from "./interpolate";
2
- export { interpolateColors, mixColors } from "./interpolateColors";
1
+ export * from "./interpolate";
2
+ export * from "./interpolateColors";
3
+ export * from "./interpolateVector";
4
+ export * from "./interpolatePaths";
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["interpolate","interpolateColors","mixColors"],"mappings":"AAAA,SAASA,WAAT,QAA4B,eAA5B;AACA,SAASC,iBAAT,EAA4BC,SAA5B,QAA6C,qBAA7C","sourcesContent":["export { interpolate } from \"./interpolate\";\nexport { interpolateColors, mixColors } from \"./interpolateColors\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAd;AACA,cAAc,qBAAd;AACA,cAAc,qBAAd;AACA,cAAc,oBAAd","sourcesContent":["export * from \"./interpolate\";\nexport * from \"./interpolateColors\";\nexport * from \"./interpolateVector\";\nexport * from \"./interpolatePaths\";\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Maps an input value within a range to an output path within a path range.
3
+ * @param value - The input value.
4
+ * @param inputRange - The range of the input value.
5
+ * @param outputRange - The range of the output path.
6
+ * @returns The output path.
7
+ * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>
8
+ * const path1 = new Path();
9
+ * path1.moveTo(0, 0);
10
+ * path1.lineTo(100, 0);
11
+ * const path2 = new Path();
12
+ * path2.moveTo(0, 0);
13
+ * path2.lineTo(0, 100);
14
+ * const path = interpolatePath(0.5, [0, 1], [path1, path2]);
15
+ */
16
+ export const interpolatePaths = (value, input, outputRange) => {
17
+ let i = 0;
18
+
19
+ for (; i <= input.length - 1; i++) {
20
+ if (value >= input[i] && value <= input[i + 1]) {
21
+ break;
22
+ }
23
+
24
+ if (i === input.length - 1) {
25
+ if (value < input[0]) {
26
+ return outputRange[0];
27
+ } else {
28
+ return outputRange[i];
29
+ }
30
+ }
31
+ }
32
+
33
+ const t = (value - input[i]) / (input[i + 1] - input[i]);
34
+ return outputRange[i + 1].interpolate(outputRange[i], t);
35
+ };
36
+ //# sourceMappingURL=interpolatePaths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["interpolatePaths.ts"],"names":["interpolatePaths","value","input","outputRange","i","length","t","interpolate"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,GAAG,CAC9BC,KAD8B,EAE9BC,KAF8B,EAG9BC,WAH8B,KAI3B;AACH,MAAIC,CAAC,GAAG,CAAR;;AACA,SAAOA,CAAC,IAAIF,KAAK,CAACG,MAAN,GAAe,CAA3B,EAA8BD,CAAC,EAA/B,EAAmC;AACjC,QAAIH,KAAK,IAAIC,KAAK,CAACE,CAAD,CAAd,IAAqBH,KAAK,IAAIC,KAAK,CAACE,CAAC,GAAG,CAAL,CAAvC,EAAgD;AAC9C;AACD;;AACD,QAAIA,CAAC,KAAKF,KAAK,CAACG,MAAN,GAAe,CAAzB,EAA4B;AAC1B,UAAIJ,KAAK,GAAGC,KAAK,CAAC,CAAD,CAAjB,EAAsB;AACpB,eAAOC,WAAW,CAAC,CAAD,CAAlB;AACD,OAFD,MAEO;AACL,eAAOA,WAAW,CAACC,CAAD,CAAlB;AACD;AACF;AACF;;AACD,QAAME,CAAC,GAAG,CAACL,KAAK,GAAGC,KAAK,CAACE,CAAD,CAAd,KAAsBF,KAAK,CAACE,CAAC,GAAG,CAAL,CAAL,GAAeF,KAAK,CAACE,CAAD,CAA1C,CAAV;AACA,SAAOD,WAAW,CAACC,CAAC,GAAG,CAAL,CAAX,CAAmBG,WAAnB,CAA+BJ,WAAW,CAACC,CAAD,CAA1C,EAA+CE,CAA/C,CAAP;AACD,CApBM","sourcesContent":["import type { SkPath } from \"../../skia/types\";\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[]\n) => {\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n if (i === input.length - 1) {\n if (value < input[0]) {\n return outputRange[0];\n } else {\n return outputRange[i];\n }\n }\n }\n const t = (value - input[i]) / (input[i + 1] - input[i]);\n return outputRange[i + 1].interpolate(outputRange[i], t)!;\n};\n"]}
@@ -0,0 +1,7 @@
1
+ import { interpolate } from "./interpolate";
2
+ export const interpolateVector = (value, inputRange, outputRange, options) => ({
3
+ x: interpolate(value, inputRange, outputRange.map(v => v.x), options),
4
+ y: interpolate(value, inputRange, outputRange.map(v => v.y), options)
5
+ });
6
+ export const mixVector = (value, from, to) => interpolateVector(value, [0, 1], [from, to]);
7
+ //# sourceMappingURL=interpolateVector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["interpolateVector.ts"],"names":["interpolate","interpolateVector","value","inputRange","outputRange","options","x","map","v","y","mixVector","from","to"],"mappings":"AAEA,SAASA,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,iBAAiB,GAAG,CAC/BC,KAD+B,EAE/BC,UAF+B,EAG/BC,WAH+B,EAI/BC,OAJ+B,MAK3B;AACJC,EAAAA,CAAC,EAAEN,WAAW,CACZE,KADY,EAEZC,UAFY,EAGZC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACF,CAAzB,CAHY,EAIZD,OAJY,CADV;AAOJI,EAAAA,CAAC,EAAET,WAAW,CACZE,KADY,EAEZC,UAFY,EAGZC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACC,CAAzB,CAHY,EAIZJ,OAJY;AAPV,CAL2B,CAA1B;AAoBP,OAAO,MAAMK,SAAS,GAAG,CAACR,KAAD,EAAgBS,IAAhB,EAA8BC,EAA9B,KACvBX,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACS,IAAD,EAAOC,EAAP,CAAhB,CADZ","sourcesContent":["import type { Vector } from \"../../skia/types\";\n\nimport { interpolate } from \"./interpolate\";\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"]}
@@ -1,5 +1,6 @@
1
1
  import "./skia/NativeSetup";
2
2
  export * from "./renderer";
3
+ export * from "./renderer/Canvas";
3
4
  export * from "./views";
4
5
  export * from "./skia";
5
6
  export * from "./external";
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAP;AACA,cAAc,YAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,aAAd","sourcesContent":["import \"./skia/NativeSetup\";\nexport * from \"./renderer\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./values\";\nexport * from \"./animation\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAP;AACA,cAAc,YAAd;AACA,cAAc,mBAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,aAAd","sourcesContent":["import \"./skia/NativeSetup\";\nexport * from \"./renderer\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./values\";\nexport * from \"./animation\";\n"]}
@@ -1,29 +1,13 @@
1
- import React, { useEffect, useState, useCallback, useMemo, useContext, forwardRef, useRef } from "react";
1
+ import React, { useEffect, useState, useCallback, useMemo, forwardRef, useRef } from "react";
2
2
  import ReactReconciler from "react-reconciler";
3
3
  import { SkiaView, useDrawCallback } from "../views";
4
- import { Skia, SkiaPaint } from "../skia";
5
4
  import { useValue } from "../values/hooks/useValue";
5
+ import { Skia } from "../skia/Skia";
6
6
  import { debug as hostDebug, skHostConfig } from "./HostConfig"; // import { debugTree } from "./nodes";
7
7
 
8
- import { vec } from "./processors";
9
8
  import { Container } from "./nodes";
10
9
  import { DependencyManager } from "./DependencyManager";
11
- const CanvasContext = /*#__PURE__*/React.createContext(null);
12
- export const useCanvas = () => {
13
- const size = useContext(CanvasContext);
14
-
15
- if (!size) {
16
- throw new Error("Canvas context is not available");
17
- }
18
-
19
- return {
20
- size
21
- };
22
- };
23
- export const useCanvasSize = () => {
24
- console.warn("useCanvasSize is deprecated, use the size member of useCanvas() instead.");
25
- return useCanvas().size;
26
- };
10
+ import { CanvasProvider } from "./useCanvas";
27
11
  export const skiaReconciler = ReactReconciler(skHostConfig);
28
12
  skiaReconciler.injectIntoDevTools({
29
13
  bundleType: 1,
@@ -49,10 +33,14 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
49
33
  onTouch,
50
34
  fontMgr
51
35
  } = _ref;
52
- const canvasCtx = useValue({
36
+ const size = useValue({
53
37
  width: 0,
54
38
  height: 0
55
39
  });
40
+ const canvasCtx = useMemo(() => ({
41
+ Skia,
42
+ size
43
+ }), [size]);
56
44
  const innerRef = useCanvasRef();
57
45
  const ref = useCombinedRefs(forwardedRef, innerRef);
58
46
  const [tick, setTick] = useState(0);
@@ -61,7 +49,7 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
61
49
  const root = useMemo(() => skiaReconciler.createContainer(container, 0, false, null), [container]); // Render effect
62
50
 
63
51
  useEffect(() => {
64
- render( /*#__PURE__*/React.createElement(CanvasContext.Provider, {
52
+ render( /*#__PURE__*/React.createElement(CanvasProvider, {
65
53
  value: canvasCtx
66
54
  }, children), root, container);
67
55
  }, [children, root, redraw, container, canvasCtx]); // Draw callback
@@ -78,14 +66,14 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
78
66
  onTouch(info.touches);
79
67
  }
80
68
 
81
- if (width !== canvasCtx.current.width || height !== canvasCtx.current.height) {
82
- canvasCtx.current = {
69
+ if (width !== canvasCtx.size.current.width || height !== canvasCtx.size.current.height) {
70
+ canvasCtx.size.current = {
83
71
  width,
84
72
  height
85
73
  };
86
74
  }
87
75
 
88
- const paint = SkiaPaint();
76
+ const paint = Skia.Paint();
89
77
  const ctx = {
90
78
  width,
91
79
  height,
@@ -94,8 +82,9 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
94
82
  paint,
95
83
  opacity: 1,
96
84
  ref,
97
- center: vec(width / 2, height / 2),
98
- fontMgr: fontMgr !== null && fontMgr !== void 0 ? fontMgr : defaultFontMgr
85
+ center: Skia.Point(width / 2, height / 2),
86
+ fontMgr: fontMgr !== null && fontMgr !== void 0 ? fontMgr : defaultFontMgr,
87
+ Skia
99
88
  };
100
89
  container.draw(ctx);
101
90
  }, [tick, onTouch]);
@@ -1 +1 @@
1
- {"version":3,"sources":["Canvas.tsx"],"names":["React","useEffect","useState","useCallback","useMemo","useContext","forwardRef","useRef","ReactReconciler","SkiaView","useDrawCallback","Skia","SkiaPaint","useValue","debug","hostDebug","skHostConfig","vec","Container","DependencyManager","CanvasContext","createContext","useCanvas","size","Error","useCanvasSize","console","warn","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","render","element","root","container","updateContainer","depMgr","subscribe","useCanvasRef","defaultFontMgr","FontMgr","RefDefault","Canvas","forwardedRef","children","style","mode","onTouch","fontMgr","canvasCtx","width","height","innerRef","ref","useCombinedRefs","tick","setTick","redraw","t","createContainer","onDraw","canvas","info","timestamp","touches","current","paint","ctx","opacity","center","draw","unsubscribe","refs","targetRef","forEach"],"mappings":"AAAA,OAAOA,KAAP,IACEC,SADF,EAEEC,QAFF,EAGEC,WAHF,EAIEC,OAJF,EAKEC,UALF,EAMEC,UANF,EAOEC,MAPF,QAQO,OARP;AAiBA,OAAOC,eAAP,MAA4B,kBAA5B;AAEA,SAASC,QAAT,EAAmBC,eAAnB,QAA0C,UAA1C;AAEA,SAASC,IAAT,EAAeC,SAAf,QAAgC,SAAhC;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAGA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,YAA7B,QAAiD,cAAjD,C,CACA;;AACA,SAASC,GAAT,QAAoB,cAApB;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAEA,MAAMC,aAAa,gBAAGpB,KAAK,CAACqB,aAAN,CAGX,IAHW,CAAtB;AAKA,OAAO,MAAMC,SAAS,GAAG,MAAM;AAC7B,QAAMC,IAAI,GAAGlB,UAAU,CAACe,aAAD,CAAvB;;AACA,MAAI,CAACG,IAAL,EAAW;AACT,UAAM,IAAIC,KAAJ,CAAU,iCAAV,CAAN;AACD;;AACD,SAAO;AAAED,IAAAA;AAAF,GAAP;AACD,CANM;AAQP,OAAO,MAAME,aAAa,GAAG,MAAM;AACjCC,EAAAA,OAAO,CAACC,IAAR,CACE,0EADF;AAGA,SAAOL,SAAS,GAAGC,IAAnB;AACD,CALM;AAOP,OAAO,MAAMK,cAAc,GAAGpB,eAAe,CAACQ,YAAD,CAAtC;AAEPY,cAAc,CAACC,kBAAf,CAAkC;AAChCC,EAAAA,UAAU,EAAE,CADoB;AAEhCC,EAAAA,OAAO,EAAE,OAFuB;AAGhCC,EAAAA,mBAAmB,EAAE;AAHW,CAAlC;;AAMA,MAAMC,MAAM,GAAG,CAACC,OAAD,EAAqBC,IAArB,EAAuCC,SAAvC,KAAgE;AAC7ER,EAAAA,cA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A,SAAS,CAACoC,IAAV,CAAeH,GAAf;AACD,GA1B2B,EA2B5B,CAACZ,IAAD,EAAOR,OAAP,CA3B4B,CAA9B;AA8BAhD,EAAAA,SAAS,CAAC,MAAM;AACd,WAAO,MAAM;AACXmC,MAAAA,SAAS,CAACE,MAAV,CAAiBmC,WAAjB;AACD,KAFD;AAGD,GAJQ,EAIN,CAACrC,SAAD,CAJM,CAAT;AAMA,sBACE,oBAAC,QAAD;AACE,IAAA,GAAG,EAAEmB,GADP;AAEE,IAAA,KAAK,EAAER,KAFT;AAGE,IAAA,MAAM,EAAEe,MAHV;AAIE,IAAA,IAAI,EAAEd,IAJR;AAKE,IAAA,KAAK,EAAElC;AALT,IADF;AASD,CA1E6B,CAAzB;AA6EP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAM0C,eAAe,GAAG,YAEnB;AAAA,oCADAkB,IACA;AADAA,IAAAA,IACA;AAAA;;AACH,QAAMC,SAAS,GAAG3E,KAAK,CAACO,MAAN,CAAgB,IAAhB,CAAlB;AACAP,EAAAA,KAAK,CAACC,SAAN,CAAgB,MAAM;AACpByE,IAAAA,IAAI,CAACE,OAAL,CAAcrB,GAAD,IAAS;AACpB,UAAIA,GAAJ,EAAS;AACP,YAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;AAC7BA,UAAAA,GAAG,CAACoB,SAAS,CAACR,OAAX,CAAH;AACD,SAFD,MAEO;AACLZ,UAAAA,GAAG,CAACY,OAAJ,GAAcQ,SAAS,CAACR,OAAxB;AACD;AACF;AACF,KARD;AASD,GAVD,EAUG,CAACO,IAAD,CAVH;AAWA,SAAOC,SAAP;AACD,CAhBD","sourcesContent":["import React, {\n useEffect,\n useState,\n useCallback,\n useMemo,\n useContext,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n ComponentProps,\n MutableRefObject,\n ForwardedRef,\n} from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport { SkiaView, useDrawCallback } from \"../views\";\nimport type { TouchHandler } from \"../views\";\nimport { Skia, SkiaPaint } from \"../skia\";\nimport type { FontMgr } from \"../skia\";\nimport { useValue } from \"../values/hooks/useValue\";\nimport type { SkiaValue } from \"../values/types\";\n\nimport { debug as hostDebug, skHostConfig } from \"./HostConfig\";\n// import { debugTree } from \"./nodes\";\nimport { vec } from \"./processors\";\nimport { Container } from \"./nodes\";\nimport { DependencyManager } from \"./DependencyManager\";\n\nconst CanvasContext = React.createContext<SkiaValue<{\n width: number;\n height: number;\n}> | null>(null);\n\nexport const useCanvas = () => {\n const size = useContext(CanvasContext);\n if (!size) {\n throw new Error(\"Canvas context is not available\");\n }\n return { size };\n};\n\nexport const useCanvasSize = () => {\n console.warn(\n \"useCanvasSize is deprecated, use the size member of useCanvas() instead.\"\n );\n return useCanvas().size;\n};\n\nexport const skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nconst render = (element: ReactNode, root: OpaqueRoot, container: Container) => {\n skiaReconciler.updateContainer(element, root, null, () => {\n hostDebug(\"updateContainer\");\n\n container.depMgr.subscribe();\n });\n};\n\nexport const useCanvasRef = () => useRef<SkiaView>(null);\n\nexport interface CanvasProps extends ComponentProps<typeof SkiaView> {\n ref?: RefObject<SkiaView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n fontMgr?: FontMgr;\n}\n\nconst defaultFontMgr = Skia.FontMgr.RefDefault();\n\nexport const Canvas = forwardRef<SkiaView, CanvasProps>(\n ({ children, style, debug, mode, onTouch, fontMgr }, forwardedRef) => {\n const canvasCtx = useValue({ width: 0, height: 0 });\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const [tick, setTick] = useState(0);\n const redraw = useCallback(() => setTick((t) => t + 1), []);\n\n const container = useMemo(\n () => new Container(new DependencyManager(ref), redraw),\n [redraw, ref]\n );\n\n const root = useMemo(\n () => skiaReconciler.createContainer(container, 0, false, null),\n [container]\n );\n // Render effect\n useEffect(() => {\n render(\n <CanvasContext.Provider value={canvasCtx}>\n {children}\n </CanvasContext.Provider>,\n root,\n container\n );\n }, [children, root, redraw, container, canvasCtx]);\n\n // Draw callback\n const onDraw = useDrawCallback(\n (canvas, info) => {\n // TODO: if tree is empty (count === 1) maybe we should not render?\n const { width, height, timestamp } = info;\n if (onTouch) {\n onTouch(info.touches);\n }\n if (\n width !== canvasCtx.current.width ||\n height !== canvasCtx.current.height\n ) {\n canvasCtx.current = { width, height };\n }\n const paint = SkiaPaint();\n const ctx = {\n width,\n height,\n timestamp,\n canvas,\n paint,\n opacity: 1,\n ref,\n center: vec(width / 2, height / 2),\n fontMgr: fontMgr ?? defaultFontMgr,\n };\n container.draw(ctx);\n },\n [tick, onTouch]\n );\n\n useEffect(() => {\n return () => {\n container.depMgr.unsubscribe();\n };\n }, [container]);\n\n return (\n <SkiaView\n ref={ref}\n style={style}\n onDraw={onDraw}\n mode={mode}\n debug={debug}\n />\n );\n }\n);\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"]}
1
+ {"version":3,"sources":["Canvas.tsx"],"names":["React","useEffect","useState","useCallback","useMemo","forwardRef","useRef","ReactReconciler","SkiaView","useDrawCallback","useValue","Skia","debug","hostDebug","skHostConfig","Container","DependencyManager","CanvasProvider","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","render","element","root","container","updateContainer","depMgr","subscribe","useCanvasRef","defaultFontMgr","FontMgr","RefDefault","Canvas","forwardedRef","children","style","mode","onTouch","fontMgr","size","width","height","canvasCtx","innerRef","ref","useCombinedRefs","tick","setTick","redraw","t","createContainer","onDraw","canvas","info","timestamp","touches","current","paint","Paint","ctx","opacity","center","Point","draw","unsubscribe","refs","targetRef","forEach"],"mappings":"AAAA,OAAOA,KAAP,IACEC,SADF,EAEEC,QAFF,EAGEC,WAHF,EAIEC,OAJF,EAKEC,UALF,EAMEC,MANF,QAOO,OAPP;AAgBA,OAAOC,eAAP,MAA4B,kBAA5B;AAEA,SAASC,QAAT,EAAmBC,eAAnB,QAA0C,UAA1C;AAGA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,YAA7B,QAAiD,cAAjD,C,CACA;;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,cAAT,QAA+B,aAA/B;AAEA,OAAO,MAAMC,cAAc,GAAGX,eAAe,CAACO,YAAD,CAAtC;AAEPI,cAAc,CAACC,kBAAf,CAAkC;AAChCC,EAAAA,UAAU,EAAE,CADoB;AAEhCC,EAAAA,OAAO,EAAE,OAFuB;AAGhCC,EAAAA,mBAAmB,EAAE;AAHW,CAAlC;;AAMA,MAAMC,MAAM,GAAG,CAACC,OAAD,EAAqBC,IAArB,EAAuCC,SAAvC,KAAgE;AAC7ER,EAAAA,cAAc,CAACS,eAAf,CAA+BH,OAA/B,EAAwCC,IAAxC,EAA8C,IAA9C,EAAoD,MAAM;AACxDZ,IAAAA,SAAS,CAAC,iBAAD,CAAT;AAEAa,IAAAA,SAAS,CAACE,MAAV,CAAiBC,SAAjB;AACD,GAJD;AAKD,CAND;;AAQA,OAAO,MAAMC,YAAY,GAAG,MAAMxB,MAAM,CAAW,IAAX,CAAjC;AASP,MAAMyB,cAAc,GAAGpB,IAAI,CAACq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,EAAOT,OAAP,CA5B4B,CAA9B;AA+BAtC,EAAAA,SAAS,CAAC,MAAM;AACd,WAAO,MAAM;AACXyB,MAAAA,SAAS,CAACE,MAAV,CAAiBsC,WAAjB;AACD,KAFD;AAGD,GAJQ,EAIN,CAACxC,SAAD,CAJM,CAAT;AAMA,sBACE,oBAAC,QAAD;AACE,IAAA,GAAG,EAAEoB,GADP;AAEE,IAAA,KAAK,EAAET,KAFT;AAGE,IAAA,MAAM,EAAEgB,MAHV;AAIE,IAAA,IAAI,EAAEf,IAJR;AAKE,IAAA,KAAK,EAAE1B;AALT,IADF;AASD,CA1E6B,CAAzB;AA6EP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMmC,eAAe,GAAG,YAEnB;AAAA,oCADAoB,IACA;AADAA,IAAAA,IACA;AAAA;;AACH,QAAMC,SAAS,GAAGpE,KAAK,CAACM,MAAN,CAAgB,IAAhB,CAAlB;AACAN,EAAAA,KAAK,CAACC,SAAN,CAAgB,MAAM;AACpBkE,IAAAA,IAAI,CAACE,OAAL,CAAcvB,GAAD,IAAS;AACpB,UAAIA,GAAJ,EAAS;AACP,YAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;AAC7BA,UAAAA,GAAG,CAACsB,SAAS,CAACV,OAAX,CAAH;AACD,SAFD,MAEO;AACLZ,UAAAA,GAAG,CAACY,OAAJ,GAAcU,SAAS,CAACV,OAAxB;AACD;AACF;AACF,KARD;AASD,GAVD,EAUG,CAACS,IAAD,CAVH;AAWA,SAAOC,SAAP;AACD,CAhBD","sourcesContent":["import React, {\n useEffect,\n useState,\n useCallback,\n useMemo,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n ComponentProps,\n MutableRefObject,\n ForwardedRef,\n} from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport { SkiaView, useDrawCallback } from \"../views\";\nimport type { TouchHandler } from \"../views\";\nimport type { SkFontMgr } from \"../skia/types\";\nimport { useValue } from \"../values/hooks/useValue\";\nimport { Skia } from \"../skia/Skia\";\n\nimport { debug as hostDebug, skHostConfig } from \"./HostConfig\";\n// import { debugTree } from \"./nodes\";\nimport { Container } from \"./nodes\";\nimport { DependencyManager } from \"./DependencyManager\";\nimport { CanvasProvider } from \"./useCanvas\";\n\nexport const skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nconst render = (element: ReactNode, root: OpaqueRoot, container: Container) => {\n skiaReconciler.updateContainer(element, root, null, () => {\n hostDebug(\"updateContainer\");\n\n container.depMgr.subscribe();\n });\n};\n\nexport const useCanvasRef = () => useRef<SkiaView>(null);\n\nexport interface CanvasProps extends ComponentProps<typeof SkiaView> {\n ref?: RefObject<SkiaView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n fontMgr?: SkFontMgr;\n}\n\nconst defaultFontMgr = Skia.FontMgr.RefDefault();\n\nexport const Canvas = forwardRef<SkiaView, CanvasProps>(\n ({ children, style, debug, mode, onTouch, fontMgr }, forwardedRef) => {\n const size = useValue({ width: 0, height: 0 });\n const canvasCtx = useMemo(() => ({ Skia, size }), [size]);\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const [tick, setTick] = useState(0);\n const redraw = useCallback(() => setTick((t) => t + 1), []);\n\n const container = useMemo(\n () => new Container(new DependencyManager(ref), redraw),\n [redraw, ref]\n );\n\n const root = useMemo(\n () => skiaReconciler.createContainer(container, 0, false, null),\n [container]\n );\n // Render effect\n useEffect(() => {\n render(\n <CanvasProvider value={canvasCtx}>{children}</CanvasProvider>,\n root,\n container\n );\n }, [children, root, redraw, container, canvasCtx]);\n\n // Draw callback\n const onDraw = useDrawCallback(\n (canvas, info) => {\n // TODO: if tree is empty (count === 1) maybe we should not render?\n const { width, height, timestamp } = info;\n if (onTouch) {\n onTouch(info.touches);\n }\n if (\n width !== canvasCtx.size.current.width ||\n height !== canvasCtx.size.current.height\n ) {\n canvasCtx.size.current = { width, height };\n }\n const paint = Skia.Paint();\n const ctx = {\n width,\n height,\n timestamp,\n canvas,\n paint,\n opacity: 1,\n ref,\n center: Skia.Point(width / 2, height / 2),\n fontMgr: fontMgr ?? defaultFontMgr,\n Skia,\n };\n container.draw(ctx);\n },\n [tick, onTouch]\n );\n\n useEffect(() => {\n return () => {\n container.depMgr.unsubscribe();\n };\n }, [container]);\n\n return (\n <SkiaView\n ref={ref}\n style={style}\n onDraw={onDraw}\n mode={mode}\n debug={debug}\n />\n );\n }\n);\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"]}
@@ -1,4 +1,4 @@
1
- /*global NodeJS, performance*/
1
+ /*global NodeJS*/
2
2
  import { DeclarationNode, DrawingNode, NodeType } from "./nodes";
3
3
  import { exhaustiveCheck, shallowEq } from "./typeddash";
4
4
  const DEBUG = false;
@@ -110,7 +110,7 @@ export const skHostConfig = {
110
110
  /**
111
111
  * This function is used by the reconciler in order to calculate current time for prioritising work.
112
112
  */
113
- now: performance.now,
113
+ now: Date.now,
114
114
  supportsMutation: true,
115
115
  isPrimaryRenderer: false,
116
116
  supportsPersistence: false,
@@ -1 +1 @@
1
- {"version":3,"sources":["HostConfig.ts"],"names":["DeclarationNode","DrawingNode","NodeType","exhaustiveCheck","shallowEq","DEBUG","debug","console","log","allChildrenAreMemoized","node","memoizable","child","children","memoized","bustBranchMemoization","parent","ancestor","bustBranchMemoizable","appendNode","push","removeNode","index","indexOf","splice","depMgr","unSubscribeNode","c","insertBefore","before","beforeIndex","createNode","container","type","props","Drawing","onDraw","skipProcessing","p1","Declaration","onDeclare","p2","skHostConfig","now","performance","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","appendChildToContainer","appendChild","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","finalizeContainerChildren","resetAfterCommit","redraw","getPublicInstance","prepareUpdate","instance","oldProps","newProps","propsAreEqual","commitUpdate","_updatePayload","prevProps","nextProps","_internalHandle","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","preparePortalMount","removeChild","removeChildFromContainer","insertInContainerBefore"],"mappings":"AAAA;AAIA,SAASA,eAAT,EAA0BC,WAA1B,EAAuCC,QAAvC,QAAuD,SAAvD;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,aAA3C;AAEA,MAAMC,KAAK,GAAG,KAAd;AACA,OAAO,MAAMC,KAAK,GAAG,YAA6C;AAChE,MAAID,KAAJ,EAAW;AACTE,IAAAA,OAAO,CAACC,GAAR,CAAY,YAAZ;AACD;AACF,CAJM;;AA+CP,MAAMC,sBAAsB,GAAIC,IAAD,IAAoB;AACjD,MAAI,CAACA,IAAI,CAACC,UAAV,EAAsB;AACpB,WAAO,KAAP;AACD;;AACD,OAAK,MAAMC,KAAX,IAAoBF,IAAI,CAACG,QAAzB,EAAmC;AACjC,QAAI,CAACD,KAAK,CAACE,QAAX,EAAqB;AACnB,aAAO,KAAP;AACD;AACF;;AACD,SAAO,IAAP;AACD,CAVD;;AAYA,MAAMC,qBAAqB,GAAIC,MAAD,IAAkB;AAC9C,MAAIA,MAAM,CAACL,UAAX,EAAuB;AACrB,QA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CoF,EAAAA,wBAAwB,EAAE,CAAChF,MAAD,EAASJ,KAAT,KAAmB;AAC3CS,IAAAA,UAAU,CAACL,MAAD,EAASJ,KAAT,CAAV;AACD,GA9JyC;AAgK1CqF,EAAAA,uBAAuB,EAAE,CAACjF,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,KAA2B;AAClDD,IAAAA,YAAY,CAACZ,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,CAAZ;AACD,GAlKyC;AAoK1CD,EAAAA,YAAY,EAAE,CAACZ,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,KAA2B;AACvCD,IAAAA,YAAY,CAACZ,MAAD,EAASJ,KAAT,EAAgBiB,MAAhB,CAAZ;AACD;AAtKyC,CAArC","sourcesContent":["/*global NodeJS, performance*/\nimport type { HostConfig } from \"react-reconciler\";\n\nimport type { Node, Container, DeclarationProps, DrawingProps } from \"./nodes\";\nimport { DeclarationNode, DrawingNode, NodeType } from \"./nodes\";\nimport { exhaustiveCheck, shallowEq } from \"./typeddash\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skDeclaration: DeclarationProps<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skDrawing: DrawingProps<any>;\n }\n }\n}\n\ntype Instance = Node;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Props = any;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = true;\ntype ChildSet = unknown;\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nconst allChildrenAreMemoized = (node: Instance) => {\n if (!node.memoizable) {\n return false;\n }\n for (const child of node.children) {\n if (!child.memoized) {\n return false;\n }\n }\n return true;\n};\n\nconst bustBranchMemoization = (parent: Node) => {\n if (parent.memoizable) {\n let ancestor: Node | undefined = parent;\n while (ancestor) {\n ancestor.memoized = null;\n ancestor = ancestor.parent;\n }\n }\n};\n\nconst bustBranchMemoizable = (parent: Node) => {\n if (parent.memoizable) {\n let ancestor: Node | undefined = parent;\n while (ancestor) {\n ancestor.memoizable = false;\n ancestor = ancestor.parent;\n }\n }\n};\n\nconst appendNode = (parent: Node, child: Node) => {\n child.parent = parent;\n bustBranchMemoization(parent);\n if (!child.memoizable) {\n bustBranchMemoizable(parent);\n }\n if (!parent.memoizable) {\n child.memoizable = false;\n }\n parent.children.push(child);\n};\n\nconst removeNode = (parent: Node, child: Node) => {\n bustBranchMemoization(parent);\n const index = parent.children.indexOf(child);\n parent.children.splice(index, 1);\n child.depMgr.unSubscribeNode(child);\n // unsubscribe to all children as well\n for (const c of child.children) {\n removeNode(child, c);\n }\n};\n\nconst insertBefore = (parent: Node, child: Node, before: Node) => {\n bustBranchMemoization(parent);\n const index = parent.children.indexOf(child);\n if (index !== -1) {\n parent.children.splice(index, 1);\n }\n const beforeIndex = parent.children.indexOf(before);\n parent.children.splice(beforeIndex, 0, child);\n};\n\nconst createNode = (container: Container, type: NodeType, props: Props) => {\n switch (type) {\n case NodeType.Drawing:\n const { onDraw, skipProcessing, ...p1 } = props;\n return new DrawingNode(container.depMgr, onDraw, skipProcessing, p1);\n case NodeType.Declaration:\n const { onDeclare, ...p2 } = props;\n return new DeclarationNode(container.depMgr, onDeclare, p2);\n default:\n // TODO: here we need to throw a nice error message\n // This is the error that will show up when the user uses nodes not supported by Skia (View, Audio, etc)\n return exhaustiveCheck(type);\n }\n};\n\nexport const skHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n now: performance.now,\n\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n //supportsMicrotask: true,\n\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n appendChildToContainer(container, child) {\n debug(\"appendChildToContainer\", container, child);\n appendNode(container, child);\n },\n\n appendChild(parent, child) {\n debug(\"appendChild\", parent, child);\n appendNode(parent, child);\n },\n\n getRootHostContext: (_rootContainerInstance: Node) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n props,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n return createNode(container, type, props) as Node;\n },\n\n appendInitialChild(parentInstance, child) {\n debug(\"appendInitialChild\");\n appendNode(parentInstance, child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n finalizeContainerChildren: () => {\n debug(\"finalizeContainerChildren\");\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n prepareUpdate: (\n instance,\n type,\n oldProps,\n newProps,\n _rootContainerInstance,\n _hostContext\n ) => {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual && !instance.memoizable) {\n return null;\n }\n debug(\"update \", type);\n return true;\n },\n\n commitUpdate(\n instance,\n _updatePayload,\n type,\n prevProps,\n nextProps,\n _internalHandle\n ) {\n debug(\"commitUpdate: \", type);\n if (shallowEq(prevProps, nextProps) && allChildrenAreMemoized(instance)) {\n return;\n }\n bustBranchMemoization(instance);\n instance.props = nextProps;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.children.splice(0);\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n removeChild: (parent, child) => {\n removeNode(parent, child);\n },\n\n removeChildFromContainer: (parent, child) => {\n removeNode(parent, child);\n },\n\n insertInContainerBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n\n insertBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n};\n"]}
1
+ {"version":3,"sources":["HostConfig.ts"],"names":["DeclarationNode","DrawingNode","NodeType","exhaustiveCheck","shallowEq","DEBUG","debug","console","log","allChildrenAreMemoized","node","memoizable","child","children","memoized","bustBranchMemoization","parent","ancestor","bustBranchMemoizable","appendNode","push","removeNode","index","indexOf","splice","depMgr","unSubscribeNode","c","insertBefore","before","beforeIndex","createNode","container","type","props","Drawing","onDraw","skipProcessing","p1","Declaration","onDeclare","p2","skHostConfig","now","Date","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","appendChildToContainer","appendChild","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","appendInitialChild","parentInstance","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","finalizeContainerChildren","resetAfterCommit","redraw","getPublicInstance","prepareUpdate","instance","oldProps","newProps","propsAreEqual","commitUpdate","_updatePayload","prevProps","nextProps","_internalHandle","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","preparePortalMount","removeChild","removeChildFromContainer","insertInContainerBefore"],"mappings":"AAAA;AAIA,SAASA,eAAT,EAA0BC,WAA1B,EAAuCC,QAAvC,QAAuD,SAAvD;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,aAA3C;AAEA,MAAMC,KAAK,GAAG,KAAd;AACA,OAAO,MAAMC,KAAK,GAAG,YAA6C;AAChE,MAAID,KAAJ,EAAW;AACTE,IAAAA,OAAO,CAACC,GAAR,CAAY,YAAZ;AACD;AACF,CAJM;;AA+CP,MAAMC,sBAAsB,GAAIC,IAAD,IAAoB;AACjD,MAAI,CAACA,IAAI,CAACC,UAAV,EAAsB;AACpB,WAAO,KAAP;AACD;;AACD,OAAK,MAAMC,KAAX,IAAoBF,IAAI,CAACG,QAAzB,EAAmC;AACjC,QAAI,CAACD,KAAK,CAACE,QAAX,EAAqB;AACnB,aAAO,KAAP;AACD;AACF;;AACD,SAAO,IAAP;AACD,CAVD;;AAYA,MAAMC,qBAAqB,GAAIC,MAAD,IAAkB;AAC9C,MAAIA,MAAM,CAACL,UAAX,EAAuB;AACrB,QAAIM,QAA0B,GAAGD,MAAjC;;AACA,WAAOC,QAAP,EAAiB;AACfA,MAAAA,QAAQ,CAACH,QAAT,GAAoB,IAApB;AACAG,MAAAA,QAAQ,GAAGA,QAAQ,CAACD,MAApB;AACD;AACF;AACF,CARD;;AAUA,MAAME,oBAAoB,GAAIF,MAAD,IAAkB;AAC7C,MAAIA,MAAM,CAACL,UAAX,EAAuB;AACrB,QAAIM,QAA0B,GAAGD,MAAjC;;AACA,WAAOC,QAAP,EAAiB;AACfA,MAAAA,QAAQ,CAACN,UAAT,GAAsB,KAAtB;AACAM,MAAAA,QAAQ,GAAGA,QAAQ,CAACD,MAApB;AACD;AACF;AACF,CARD;;AAUA,MAAMG,UAAU,GAAG,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;AAtKyC,CAArC","sourcesContent":["/*global NodeJS*/\nimport type { HostConfig } from \"react-reconciler\";\n\nimport type { Node, Container, DeclarationProps, DrawingProps } from \"./nodes\";\nimport { DeclarationNode, DrawingNode, NodeType } from \"./nodes\";\nimport { exhaustiveCheck, shallowEq } from \"./typeddash\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skDeclaration: DeclarationProps<any>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skDrawing: DrawingProps<any>;\n }\n }\n}\n\ntype Instance = Node;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Props = any;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = true;\ntype ChildSet = unknown;\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nconst allChildrenAreMemoized = (node: Instance) => {\n if (!node.memoizable) {\n return false;\n }\n for (const child of node.children) {\n if (!child.memoized) {\n return false;\n }\n }\n return true;\n};\n\nconst bustBranchMemoization = (parent: Node) => {\n if (parent.memoizable) {\n let ancestor: Node | undefined = parent;\n while (ancestor) {\n ancestor.memoized = null;\n ancestor = ancestor.parent;\n }\n }\n};\n\nconst bustBranchMemoizable = (parent: Node) => {\n if (parent.memoizable) {\n let ancestor: Node | undefined = parent;\n while (ancestor) {\n ancestor.memoizable = false;\n ancestor = ancestor.parent;\n }\n }\n};\n\nconst appendNode = (parent: Node, child: Node) => {\n child.parent = parent;\n bustBranchMemoization(parent);\n if (!child.memoizable) {\n bustBranchMemoizable(parent);\n }\n if (!parent.memoizable) {\n child.memoizable = false;\n }\n parent.children.push(child);\n};\n\nconst removeNode = (parent: Node, child: Node) => {\n bustBranchMemoization(parent);\n const index = parent.children.indexOf(child);\n parent.children.splice(index, 1);\n child.depMgr.unSubscribeNode(child);\n // unsubscribe to all children as well\n for (const c of child.children) {\n removeNode(child, c);\n }\n};\n\nconst insertBefore = (parent: Node, child: Node, before: Node) => {\n bustBranchMemoization(parent);\n const index = parent.children.indexOf(child);\n if (index !== -1) {\n parent.children.splice(index, 1);\n }\n const beforeIndex = parent.children.indexOf(before);\n parent.children.splice(beforeIndex, 0, child);\n};\n\nconst createNode = (container: Container, type: NodeType, props: Props) => {\n switch (type) {\n case NodeType.Drawing:\n const { onDraw, skipProcessing, ...p1 } = props;\n return new DrawingNode(container.depMgr, onDraw, skipProcessing, p1);\n case NodeType.Declaration:\n const { onDeclare, ...p2 } = props;\n return new DeclarationNode(container.depMgr, onDeclare, p2);\n default:\n // TODO: here we need to throw a nice error message\n // This is the error that will show up when the user uses nodes not supported by Skia (View, Audio, etc)\n return exhaustiveCheck(type);\n }\n};\n\nexport const skHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n now: Date.now,\n\n supportsMutation: true,\n isPrimaryRenderer: false,\n supportsPersistence: false,\n supportsHydration: false,\n //supportsMicrotask: true,\n\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n appendChildToContainer(container, child) {\n debug(\"appendChildToContainer\", container, child);\n appendNode(container, child);\n },\n\n appendChild(parent, child) {\n debug(\"appendChild\", parent, child);\n appendNode(parent, child);\n },\n\n getRootHostContext: (_rootContainerInstance: Node) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n props,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n return createNode(container, type, props) as Node;\n },\n\n appendInitialChild(parentInstance, child) {\n debug(\"appendInitialChild\");\n appendNode(parentInstance, child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n finalizeContainerChildren: () => {\n debug(\"finalizeContainerChildren\");\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n prepareUpdate: (\n instance,\n type,\n oldProps,\n newProps,\n _rootContainerInstance,\n _hostContext\n ) => {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual && !instance.memoizable) {\n return null;\n }\n debug(\"update \", type);\n return true;\n },\n\n commitUpdate(\n instance,\n _updatePayload,\n type,\n prevProps,\n nextProps,\n _internalHandle\n ) {\n debug(\"commitUpdate: \", type);\n if (shallowEq(prevProps, nextProps) && allChildrenAreMemoized(instance)) {\n return;\n }\n bustBranchMemoization(instance);\n instance.props = nextProps;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.children.splice(0);\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n removeChild: (parent, child) => {\n removeNode(parent, child);\n },\n\n removeChildFromContainer: (parent, child) => {\n removeNode(parent, child);\n },\n\n insertInContainerBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n\n insertBefore: (parent, child, before) => {\n insertBefore(parent, child, before);\n },\n};\n"]}
@@ -1,13 +1,16 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from "react";
4
- import { isImageFilter, Skia, BlendMode, isShader } from "../../skia";
4
+ import { isImageFilter, BlendMode, isShader } from "../../skia/types";
5
5
  import { createDeclaration } from "../nodes";
6
6
  import { enumKey } from "../processors/Paint";
7
- const onDeclare = createDeclaration((_ref, children) => {
7
+ const onDeclare = createDeclaration((_ref, children, _ref2) => {
8
8
  let {
9
9
  mode
10
10
  } = _ref;
11
+ let {
12
+ Skia
13
+ } = _ref2;
11
14
  const [inner, outer] = children;
12
15
  const blend = BlendMode[enumKey(mode)];
13
16
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Blend.tsx"],"names":["React","isImageFilter","Skia","BlendMode","isShader","createDeclaration","enumKey","onDeclare","children","mode","inner","outer","blend","ImageFilter","MakeBlend","Shader","Error","Blend","props"],"mappings":";;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,aAAT,EAAwBC,IAAxB,EAA8BC,SAA9B,EAAyCC,QAAzC,QAAyD,YAAzD;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAEA,SAASC,OAAT,QAAwB,qBAAxB;AAOA,MAAMC,SAAS,GAAGF,iBAAiB,CAAa,OAAWG,QAAX,KAAwB;AAAA,MAAvB;AAAEC,IAAAA;AAAF,GAAuB;AACtE,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBH,QAAvB;AACA,QAAMI,KAAK,GAAGT,SAAS,CAACG,OAAO,CAACG,IAAD,CAAR,CAAvB;;AACA,MAAIR,aAAa,CAACU,KAAD,CAAb,IAAwBV,aAAa,CAACS,KAAD,CAAzC,EAAkD;AAChD,WAAOR,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BF,KAA3B,EAAkCD,KAAlC,EAAyCD,KAAzC,CAAP;AACD,GAFD,MAEO,IAAIN,QAAQ,CAACO,KAAD,CAAR,IAAmBP,QAAQ,CAACM,KAAD,CAA/B,EAAwC;AAC7C,WAAOR,IAAI,CAACa,MAAL,CAAYD,SAAZ,CAAsBF,KAAtB,EAA6BD,KAA7B,EAAoCD,KAApC,CAAP;AACD;;AACD,QAAM,IAAIM,KAAJ,CAAU,kDAAV,CAAN;AACD,CATkC,CAAnC;AAWA,OAAO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAe,IAAA,SAAS,EAAEX;AAA1B,KAAyCW,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport { isImageFilter, Skia, BlendMode, isShader } from \"../../skia\";\nimport { createDeclaration } from \"../nodes\";\nimport type { AnimatedProps, SkEnum } from \"../processors\";\nimport { enumKey } from \"../processors/Paint\";\n\ninterface BlendProps {\n mode: SkEnum<typeof BlendMode>;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendProps>(({ mode }, children) => {\n const [inner, outer] = children;\n const blend = BlendMode[enumKey(mode)];\n if (isImageFilter(outer) && isImageFilter(inner)) {\n return Skia.ImageFilter.MakeBlend(blend, outer, inner);\n } else if (isShader(outer) && isShader(inner)) {\n return Skia.Shader.MakeBlend(blend, outer, inner);\n }\n throw new Error(\"<Blend /> can only blend Shaders or ImageFilters\");\n});\n\nexport const Blend = (props: AnimatedProps<BlendProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["Blend.tsx"],"names":["React","isImageFilter","BlendMode","isShader","createDeclaration","enumKey","onDeclare","children","mode","Skia","inner","outer","blend","ImageFilter","MakeBlend","Shader","Error","Blend","props"],"mappings":";;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,aAAT,EAAwBC,SAAxB,EAAmCC,QAAnC,QAAmD,kBAAnD;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAEA,SAASC,OAAT,QAAwB,qBAAxB;AAOA,MAAMC,SAAS,GAAGF,iBAAiB,CACjC,OAAWG,QAAX,YAAkC;AAAA,MAAjC;AAAEC,IAAAA;AAAF,GAAiC;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAChC,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBJ,QAAvB;AACA,QAAMK,KAAK,GAAGV,SAAS,CAACG,OAAO,CAACG,IAAD,CAAR,CAAvB;;AACA,MAAIP,aAAa,CAACU,KAAD,CAAb,IAAwBV,aAAa,CAACS,KAAD,CAAzC,EAAkD;AAChD,WAAOD,IAAI,CAACI,WAAL,CAAiBC,SAAjB,CAA2BF,KAA3B,EAAkCD,KAAlC,EAAyCD,KAAzC,CAAP;AACD,GAFD,MAEO,IAAIP,QAAQ,CAACQ,KAAD,CAAR,IAAmBR,QAAQ,CAACO,KAAD,CAA/B,EAAwC;AAC7C,WAAOD,IAAI,CAACM,MAAL,CAAYD,SAAZ,CAAsBF,KAAtB,EAA6BD,KAA7B,EAAoCD,KAApC,CAAP;AACD;;AACD,QAAM,IAAIM,KAAJ,CAAU,kDAAV,CAAN;AACD,CAVgC,CAAnC;AAaA,OAAO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAe,IAAA,SAAS,EAAEZ;AAA1B,KAAyCY,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport { isImageFilter, BlendMode, isShader } from \"../../skia/types\";\nimport { createDeclaration } from \"../nodes\";\nimport type { AnimatedProps, SkEnum } from \"../processors\";\nimport { enumKey } from \"../processors/Paint\";\n\ninterface BlendProps {\n mode: SkEnum<typeof BlendMode>;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendProps>(\n ({ mode }, children, { Skia }) => {\n const [inner, outer] = children;\n const blend = BlendMode[enumKey(mode)];\n if (isImageFilter(outer) && isImageFilter(inner)) {\n return Skia.ImageFilter.MakeBlend(blend, outer, inner);\n } else if (isShader(outer) && isShader(inner)) {\n return Skia.Shader.MakeBlend(blend, outer, inner);\n }\n throw new Error(\"<Blend /> can only blend Shaders or ImageFilters\");\n }\n);\n\nexport const Blend = (props: AnimatedProps<BlendProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -1,9 +1,12 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from "react";
4
- import { Skia, isImageFilter, isColorFilter } from "../../skia";
4
+ import { isImageFilter, isColorFilter } from "../../skia/types";
5
5
  import { createDeclaration } from "../nodes/Declaration";
6
- const onDeclare = createDeclaration((_, children) => {
6
+ const onDeclare = createDeclaration((_, children, _ref) => {
7
+ let {
8
+ Skia
9
+ } = _ref;
7
10
  const [inner, outer] = children;
8
11
 
9
12
  if (isColorFilter(outer) && isColorFilter(inner)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["Compose.tsx"],"names":["React","Skia","isImageFilter","isColorFilter","createDeclaration","onDeclare","_","children","inner","outer","ColorFilter","MakeCompose","ImageFilter","Error","Compose","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,IAAT,EAAeC,aAAf,EAA8BC,aAA9B,QAAmD,YAAnD;AACA,SAASC,iBAAT,QAAkC,sBAAlC;AAOA,MAAMC,SAAS,GAAGD,iBAAiB,CAAC,CAACE,CAAD,EAAIC,QAAJ,KAAiB;AACnD,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBF,QAAvB;;AACA,MAAIJ,aAAa,CAACM,KAAD,CAAb,IAAwBN,aAAa,CAACK,KAAD,CAAzC,EAAkD;AAChD,WAAOP,IAAI,CAACS,WAAL,CAAiBC,WAAjB,CAA6BF,KAA7B,EAAoCD,KAApC,CAAP;AACD,GAFD,MAEO,IAAIN,aAAa,CAACO,KAAD,CAAb,IAAwBP,aAAa,CAACM,KAAD,CAAzC,EAAkD;AACvD,WAAOP,IAAI,CAACW,WAAL,CAAiBD,WAAjB,CAA6BF,KAA7B,EAAoCD,KAApC,CAAP;AACD;;AACD,QAAM,IAAIK,KAAJ,CACJ,8DADI,CAAN;AAGD,CAVkC,CAAnC;AAYA,OAAO,MAAMC,OAAO,GAAIC,KAAD,IAAwC;AAC7D,sBAAO;AAAe,IAAA,SAAS,EAAEV;AAA1B,KAAyCU,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { Skia, isImageFilter, isColorFilter } from \"../../skia\";\nimport { createDeclaration } from \"../nodes/Declaration\";\nimport type { AnimatedProps } from \"../processors/Animations/Animations\";\n\nexport interface ComposeProps {\n children: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration((_, children) => {\n const [inner, outer] = children;\n if (isColorFilter(outer) && isColorFilter(inner)) {\n return Skia.ColorFilter.MakeCompose(outer, inner);\n } else if (isImageFilter(outer) && isImageFilter(inner)) {\n return Skia.ImageFilter.MakeCompose(outer, inner);\n }\n throw new Error(\n \"ComposeFilter can only compose ColorFilters and ImageFilters\"\n );\n});\n\nexport const Compose = (props: AnimatedProps<ComposeProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["Compose.tsx"],"names":["React","isImageFilter","isColorFilter","createDeclaration","onDeclare","_","children","Skia","inner","outer","ColorFilter","MakeCompose","ImageFilter","Error","Compose","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,EAAwBC,aAAxB,QAA6C,kBAA7C;AACA,SAASC,iBAAT,QAAkC,sBAAlC;AAOA,MAAMC,SAAS,GAAGD,iBAAiB,CAAC,CAACE,CAAD,EAAIC,QAAJ,WAA2B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC7D,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBH,QAAvB;;AACA,MAAIJ,aAAa,CAACO,KAAD,CAAb,IAAwBP,aAAa,CAACM,KAAD,CAAzC,EAAkD;AAChD,WAAOD,IAAI,CAACG,WAAL,CAAiBC,WAAjB,CAA6BF,KAA7B,EAAoCD,KAApC,CAAP;AACD,GAFD,MAEO,IAAIP,aAAa,CAACQ,KAAD,CAAb,IAAwBR,aAAa,CAACO,KAAD,CAAzC,EAAkD;AACvD,WAAOD,IAAI,CAACK,WAAL,CAAiBD,WAAjB,CAA6BF,KAA7B,EAAoCD,KAApC,CAAP;AACD;;AACD,QAAM,IAAIK,KAAJ,CACJ,8DADI,CAAN;AAGD,CAVkC,CAAnC;AAYA,OAAO,MAAMC,OAAO,GAAIC,KAAD,IAAwC;AAC7D,sBAAO;AAAe,IAAA,SAAS,EAAEX;AAA1B,KAAyCW,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { isImageFilter, isColorFilter } from \"../../skia/types\";\nimport { createDeclaration } from \"../nodes/Declaration\";\nimport type { AnimatedProps } from \"../processors/Animations/Animations\";\n\nexport interface ComposeProps {\n children: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration((_, children, { Skia }) => {\n const [inner, outer] = children;\n if (isColorFilter(outer) && isColorFilter(inner)) {\n return Skia.ColorFilter.MakeCompose(outer, inner);\n } else if (isImageFilter(outer) && isImageFilter(inner)) {\n return Skia.ImageFilter.MakeCompose(outer, inner);\n }\n throw new Error(\n \"ComposeFilter can only compose ColorFilters and ImageFilters\"\n );\n});\n\nexport const Compose = (props: AnimatedProps<ComposeProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from "react";
4
- import { ClipOp } from "../../skia";
5
- import { processTransform, processPaint, processClip } from "../processors";
4
+ import { ClipOp } from "../../skia/types";
5
+ import { processCanvasTransform, processPaint, processClip } from "../processors";
6
6
  import { createDrawing, DrawingNode } from "../nodes";
7
7
  import { isDeclarationNode } from "../nodes/Declaration";
8
8
 
@@ -17,11 +17,12 @@ const onDraw = createDrawing((ctx, _ref, node) => {
17
17
  } = _ref;
18
18
  const {
19
19
  canvas,
20
- opacity
20
+ opacity,
21
+ Skia
21
22
  } = ctx;
22
23
  const declarations = node.children.filter(isDeclarationNode).map(child => child.draw(ctx));
23
24
  const drawings = node.children.filter(child => child instanceof DrawingNode);
24
- const paint = processPaint(ctx.paint.copy(), opacity, groupProps, declarations);
25
+ const paint = processPaint(ctx.Skia, ctx.paint.copy(), opacity, groupProps, declarations);
25
26
  const hasTransform = !!groupProps.transform || !!groupProps.matrix;
26
27
  const hasClip = !!clip;
27
28
  const shouldSave = hasTransform || hasClip || !!layer;
@@ -41,11 +42,11 @@ const onDraw = createDrawing((ctx, _ref, node) => {
41
42
  canvas.save();
42
43
  }
43
44
 
44
- processTransform(ctx, groupProps);
45
+ processCanvasTransform(ctx, groupProps);
45
46
 
46
47
  if (clip) {
47
48
  const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;
48
- processClip(canvas, clip, op);
49
+ processClip(Skia, canvas, clip, op);
49
50
  }
50
51
  }
51
52
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Group.tsx"],"names":["React","ClipOp","processTransform","processPaint","processClip","createDrawing","DrawingNode","isDeclarationNode","isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","declarations","children","filter","map","child","draw","drawings","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","Difference","Intersect","visit","restore","Group","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,MAAT,QAAuB,YAAvB;AACA,SAASC,gBAAT,EAA2BC,YAA3B,EAAyCC,WAAzC,QAA4D,eAA5D;AAOA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,UAA3C;AACA,SAASC,iBAAT,QAAkC,sBAAlC;;AAEA,MAAMC,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAGN,aAAa,CAC1B,CAACO,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAsBP,GAA5B;AACA,QAAMQ,YAAY,GAAGP,IAAI,CAACQ,QAAL,CAClBC,MADkB,CACXf,iBADW,EAElBgB,GAFkB,CAEbC,KAAD,IAAWA,KAAK,CAACC,IAAN,CAAWb,GAAX,CAFG,CAArB;AAIA,QAAMc,QAAQ,GAAGb,IAAI,CAACQ,QAAL,CAAcC,MAAd,CACdE,KAAD,IAAWA,KAAK,YAAYlB,WADb,CAAjB;AAGA,QAAMqB,KAAK,GAAGxB,YAAY,CACxBS,GAAG,CAACe,KAAJ,CAAUC,IAAV,EADwB,EAExBT,OAFwB,EAGxBF,UAHwB,EAIxBG,YAJwB,CAA1B;AAMA,QAAMS,YAAY,GAAG,CAAC,CAACZ,UAAU,CAACa,SAAb,IAA0B,CAAC,CAACb,UAAU,CAACc,MAA5D;AAC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{ RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { ClipOp } from \"../../skia\";\nimport { processTransform, processPaint, processClip } from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing, DrawingNode } from \"../nodes\";\nimport { isDeclarationNode } from \"../nodes/Declaration\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity } = ctx;\n const declarations = node.children\n .filter(isDeclarationNode)\n .map((child) => child.draw(ctx));\n\n const drawings = node.children.filter(\n (child) => child instanceof DrawingNode\n );\n const paint = processPaint(\n ctx.paint.copy(),\n opacity,\n groupProps,\n declarations\n );\n const hasTransform = !!groupProps.transform || !!groupProps.matrix;\n const hasClip = !!clip;\n const shouldSave = hasTransform || hasClip || !!layer;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processTransform(ctx, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(canvas, clip, op);\n }\n }\n node.visit(\n {\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n },\n drawings\n );\n if (shouldSave) {\n canvas.restore();\n }\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
1
+ {"version":3,"sources":["Group.tsx"],"names":["React","ClipOp","processCanvasTransform","processPaint","processClip","createDrawing","DrawingNode","isDeclarationNode","isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","Skia","declarations","children","filter","map","child","draw","drawings","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","Difference","Intersect","visit","restore","Group","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SACEC,sBADF,EAEEC,YAFF,EAGEC,WAHF,QAIO,eAJP;AAWA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,UAA3C;AACA,SAASC,iBAAT,QAAkC,sBAAlC;;AAEA,MAAMC,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAGN,aAAa,CAC1B,CAACO,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,OAAV;AAAmBC,IAAAA;AAAnB,MAA4BR,GAAlC;AACA,QAAMS,YAAY,GAAGR,IAAI,CAACS,QAAL,CAClBC,MADkB,CACXhB,iBADW,EAElBiB,GAFkB,CAEbC,KAAD,IAAWA,KAAK,CAACC,IAAN,CAAWd,GAAX,CAFG,CAArB;AAIA,QAAMe,QAAQ,GAAGd,IAAI,CAACS,QAAL,CAAcC,MAAd,CACdE,KAAD,IAAWA,KAAK,YAAYnB,WADb,CAAjB;AAGA,QAAMsB,KAAK,GAAGzB,YAAY,CACxBS,GAAG,CAACQ,IADoB,EAExBR,GAAG,CAACgB,KAAJ,CAAUC,IAAV,EAFwB,EAGxBV,OAHwB,EAIxBF,UAJwB,EAKxBI,YALwB,CAA1B;AAOA,QAAMS,YAAY,GAAG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C;AAAnB,KAA+BkC,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia/types\";\nimport { ClipOp } from \"../../skia/types\";\nimport {\n processCanvasTransform,\n processPaint,\n processClip,\n} from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing, DrawingNode } from \"../nodes\";\nimport { isDeclarationNode } from \"../nodes/Declaration\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity, Skia } = ctx;\n const declarations = node.children\n .filter(isDeclarationNode)\n .map((child) => child.draw(ctx));\n\n const drawings = node.children.filter(\n (child) => child instanceof DrawingNode\n );\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n opacity,\n groupProps,\n declarations\n );\n const hasTransform = !!groupProps.transform || !!groupProps.matrix;\n const hasClip = !!clip;\n const shouldSave = hasTransform || hasClip || !!layer;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processCanvasTransform(ctx, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(Skia, canvas, clip, op);\n }\n }\n node.visit(\n {\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n },\n drawings\n );\n if (shouldSave) {\n canvas.restore();\n }\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
@@ -1,5 +1,6 @@
1
1
  import React, { useMemo } from "react";
2
- import { BlendMode, Skia } from "../../skia";
2
+ import { BlendMode } from "../../skia/types";
3
+ import { useCanvas } from "../useCanvas";
3
4
  import { Group } from "./Group";
4
5
  export const Mask = _ref => {
5
6
  let {
@@ -8,6 +9,9 @@ export const Mask = _ref => {
8
9
  mode,
9
10
  clip
10
11
  } = _ref;
12
+ const {
13
+ Skia
14
+ } = useCanvas();
11
15
  const maskPaint = useMemo(() => {
12
16
  const paint = Skia.Paint();
13
17
  paint.setBlendMode(BlendMode.Src);
@@ -17,12 +21,12 @@ export const Mask = _ref => {
17
21
  }
18
22
 
19
23
  return paint;
20
- }, [mode]);
24
+ }, [Skia, mode]);
21
25
  const clippingPaint = useMemo(() => {
22
26
  const paint = Skia.Paint();
23
27
  paint.setBlendMode(BlendMode.DstIn);
24
28
  return paint;
25
- }, []);
29
+ }, [Skia]);
26
30
  return /*#__PURE__*/React.createElement(Group, {
27
31
  layer: true
28
32
  }, /*#__PURE__*/React.createElement(Group, {
@@ -1 +1 @@
1
- {"version":3,"sources":["Mask.tsx"],"names":["React","useMemo","BlendMode","Skia","Group","Mask","children","mask","mode","clip","maskPaint","paint","Paint","setBlendMode","Src","setColorFilter","ColorFilter","MakeLumaColorFilter","clippingPaint","DstIn","defaultProps"],"mappings":"AACA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AAEA,SAASC,SAAT,EAAoBC,IAApB,QAAgC,YAAhC;AAEA,SAASC,KAAT,QAAsB,SAAtB;AASA,OAAO,MAAMC,IAAI,GAAG,QAA+C;AAAA,MAA9C;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAZ;AAAkBC,IAAAA,IAAlB;AAAwBC,IAAAA;AAAxB,GAA8C;AACjE,QAAMC,SAAS,GAAGT,OAAO,CAAC,MAAM;AAC9B,UAAMU,KAAK,GAAGR,IAAI,CAACS,KAAL,EAAd;AACAD,IAAAA,KAAK,CAACE,YAAN,CAAmBX,SAAS,CAACY,GAA7B;;AACA,QAAIN,IAAI,KAAK,WAAb,EAA0B;AACxBG,MAAAA,KAAK,CAACI,cAAN,CAAqBZ,IAAI,CAACa,WAAL,CAAiBC,mBAAjB,EAArB;AACD;;AACD,WAAON,KAAP;AACD,GAPwB,EAOtB,CAACH,IAAD,CAPsB,CAAzB;AAQA,QAAMU,aAAa,GAAGjB,OAAO,CAAC,MAAM;AAClC,UAAMU,KAAK,GAAGR,IAAI,CAACS,KAAL,EAAd;AACAD,IAAAA,KAAK,CAACE,YAAN,CAAmBX,SAAS,CAACiB,KAA7B;AACA,WAAOR,KAAP;AACD,GAJ4B,EAI1B,EAJ0B,CAA7B;AAKA,sBACE,oBAAC,KAAD;AAAO,IAAA,KAAK;AAAZ,kBACE,oBAAC,KAAD;AAAO,IAAA,KAAK,EAAED;AAAd,KACGH,IADH,EAEGE,IAAI,iBAAI,oBAAC,KAAD;AAAO,IAAA,KAAK,EAAES;AAAd,KAA8BZ,QAA9B,CAFX,CADF,eAKE,oBAAC,KAAD;AAAO,IAAA,SAAS,EAAC;AAAjB,KAA0BA,QAA1B,CALF,CADF;AASD,CAvBM;AAyBPD,IAAI,CAACe,YAAL,GAAoB;AAClBZ,EAAAA,IAAI,EAAE,OADY;AAElBC,EAAAA,IAAI,EAAE;AAFY,CAApB","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useMemo } from \"react\";\n\nimport { BlendMode, Skia } from \"../../skia\";\n\nimport { Group } from \"./Group\";\n\ninterface MaskProps {\n mode: \"luminance\" | \"alpha\";\n clip: boolean;\n mask: ReactNode | ReactNode[];\n children: ReactNode | ReactNode[];\n}\n\nexport const Mask = ({ children, mask, mode, clip }: MaskProps) => {\n const maskPaint = useMemo(() => {\n const paint = Skia.Paint();\n paint.setBlendMode(BlendMode.Src);\n if (mode === \"luminance\") {\n paint.setColorFilter(Skia.ColorFilter.MakeLumaColorFilter());\n }\n return paint;\n }, [mode]);\n const clippingPaint = useMemo(() => {\n const paint = Skia.Paint();\n paint.setBlendMode(BlendMode.DstIn);\n return paint;\n }, []);\n return (\n <Group layer>\n <Group layer={maskPaint}>\n {mask}\n {clip && <Group layer={clippingPaint}>{children}</Group>}\n </Group>\n <Group blendMode=\"srcIn\">{children}</Group>\n </Group>\n );\n};\n\nMask.defaultProps = {\n mode: \"alpha\",\n clip: true,\n};\n"]}
1
+ {"version":3,"sources":["Mask.tsx"],"names":["React","useMemo","BlendMode","useCanvas","Group","Mask","children","mask","mode","clip","Skia","maskPaint","paint","Paint","setBlendMode","Src","setColorFilter","ColorFilter","MakeLumaColorFilter","clippingPaint","DstIn","defaultProps"],"mappings":"AACA,OAAOA,KAAP,IAAgBC,OAAhB,QAA+B,OAA/B;AAEA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,SAAT,QAA0B,cAA1B;AAEA,SAASC,KAAT,QAAsB,SAAtB;AASA,OAAO,MAAMC,IAAI,GAAG,QAA+C;AAAA,MAA9C;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAZ;AAAkBC,IAAAA,IAAlB;AAAwBC,IAAAA;AAAxB,GAA8C;AACjE,QAAM;AAAEC,IAAAA;AAAF,MAAWP,SAAS,EAA1B;AACA,QAAMQ,SAAS,GAAGV,OAAO,CAAC,MAAM;AAC9B,UAAMW,KAAK,GAAGF,IAAI,CAACG,KAAL,EAAd;AACAD,IAAAA,KAAK,CAACE,YAAN,CAAmBZ,SAAS,CAACa,GAA7B;;AACA,QAAIP,IAAI,KAAK,WAAb,EAA0B;AACxBI,MAAAA,KAAK,CAACI,cAAN,CAAqBN,IAAI,CAACO,WAAL,CAAiBC,mBAAjB,EAArB;AACD;;AACD,WAAON,KAAP;AACD,GAPwB,EAOtB,CAACF,IAAD,EAAOF,IAAP,CAPsB,CAAzB;AAQA,QAAMW,aAAa,GAAGlB,OAAO,CAAC,MAAM;AAClC,UAAMW,KAAK,GAAGF,IAAI,CAACG,KAAL,EAAd;AACAD,IAAAA,KAAK,CAACE,YAAN,CAAmBZ,SAAS,CAACkB,KAA7B;AACA,WAAOR,KAAP;AACD,GAJ4B,EAI1B,CAACF,IAAD,CAJ0B,CAA7B;AAKA,sBACE,oBAAC,KAAD;AAAO,IAAA,KAAK;AAAZ,kBACE,oBAAC,KAAD;AAAO,IAAA,KAAK,EAAEC;AAAd,KACGJ,IADH,EAEGE,IAAI,iBAAI,oBAAC,KAAD;AAAO,IAAA,KAAK,EAAEU;AAAd,KAA8Bb,QAA9B,CAFX,CADF,eAKE,oBAAC,KAAD;AAAO,IAAA,SAAS,EAAC;AAAjB,KAA0BA,QAA1B,CALF,CADF;AASD,CAxBM;AA0BPD,IAAI,CAACgB,YAAL,GAAoB;AAClBb,EAAAA,IAAI,EAAE,OADY;AAElBC,EAAAA,IAAI,EAAE;AAFY,CAApB","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useMemo } from \"react\";\n\nimport { BlendMode } from \"../../skia/types\";\nimport { useCanvas } from \"../useCanvas\";\n\nimport { Group } from \"./Group\";\n\ninterface MaskProps {\n mode: \"luminance\" | \"alpha\";\n clip: boolean;\n mask: ReactNode | ReactNode[];\n children: ReactNode | ReactNode[];\n}\n\nexport const Mask = ({ children, mask, mode, clip }: MaskProps) => {\n const { Skia } = useCanvas();\n const maskPaint = useMemo(() => {\n const paint = Skia.Paint();\n paint.setBlendMode(BlendMode.Src);\n if (mode === \"luminance\") {\n paint.setColorFilter(Skia.ColorFilter.MakeLumaColorFilter());\n }\n return paint;\n }, [Skia, mode]);\n const clippingPaint = useMemo(() => {\n const paint = Skia.Paint();\n paint.setBlendMode(BlendMode.DstIn);\n return paint;\n }, [Skia]);\n return (\n <Group layer>\n <Group layer={maskPaint}>\n {mask}\n {clip && <Group layer={clippingPaint}>{children}</Group>}\n </Group>\n <Group blendMode=\"srcIn\">{children}</Group>\n </Group>\n );\n};\n\nMask.defaultProps = {\n mode: \"alpha\",\n clip: true,\n};\n"]}
@@ -1,14 +1,17 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useRef, useMemo, forwardRef, useImperativeHandle } from "react";
4
- import { SkiaPaint } from "../../skia";
5
4
  import { processPaint } from "../processors";
6
5
  import { createDeclaration } from "../nodes";
6
+ import { useCanvas } from "../useCanvas";
7
7
  export const usePaintRef = () => useRef(null);
8
8
  export const Paint = /*#__PURE__*/forwardRef((props, ref) => {
9
- const paint = useMemo(() => SkiaPaint(), []);
9
+ const {
10
+ Skia
11
+ } = useCanvas();
12
+ const paint = useMemo(() => Skia.Paint(), [Skia]);
10
13
  useImperativeHandle(ref, () => paint, [paint]);
11
- const onDeclare = useMemo(() => createDeclaration((paintProps, children, ctx) => processPaint(paint, ctx.opacity, paintProps, children)), [paint]);
14
+ const onDeclare = useMemo(() => createDeclaration((paintProps, children, ctx) => processPaint(ctx.Skia, paint, ctx.opacity, paintProps, children)), [paint]);
12
15
  return /*#__PURE__*/React.createElement("skDeclaration", _extends({
13
16
  onDeclare: onDeclare
14
17
  }, props));
@@ -1 +1 @@
1
- {"version":3,"sources":["Paint.tsx"],"names":["React","useRef","useMemo","forwardRef","useImperativeHandle","SkiaPaint","processPaint","createDeclaration","usePaintRef","Paint","props","ref","paint","onDeclare","paintProps","children","ctx","opacity"],"mappings":";;AACA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,OAAxB,EAAiCC,UAAjC,EAA6CC,mBAA7C,QAAwE,OAAxE;AAGA,SAASC,SAAT,QAA0B,YAA1B;AAEA,SAASC,YAAT,QAA6B,eAA7B;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAEA,OAAO,MAAMC,WAAW,GAAG,MAAMP,MAAM,CAAU,IAAV,CAAhC;AAMP,OAAO,MAAMQ,KAAK,gBAAGN,UAAU,CAC7B,CAACO,KAAD,EAAQC,GAAR,KAAgB;AACd,QAAMC,KAAK,GAAGV,OAAO,CAAC,MAAMG,SAAS,EAAhB,EAAoB,EAApB,CAArB;AACAD,EAAAA,mBAAmB,CAACO,GAAD,EAAM,MAAMC,KAAZ,EAAmB,CAACA,KAAD,CAAnB,CAAnB;AACA,QAAMC,SAAS,GAAGX,OAAO,CACvB,MACEK,iBAAiB,CAAa,CAACO,UAAD,EAAaC,QAAb,EAAuBC,GAAvB,KAC5BV,YAAY,CAACM,KAAD,EAAQI,GAAG,CAACC,OAAZ,EAAqBH,UAArB,EAAiCC,QAAjC,CADG,CAFI,EAKvB,CAACH,KAAD,CALuB,CAAzB;AAOA,sBAAO;AAAe,IAAA,SAAS,EAAEC;AAA1B,KAAyCH,KAAzC,EAAP;AACD,CAZ4B,CAAxB","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useRef, useMemo, forwardRef, useImperativeHandle } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { SkiaPaint } from \"../../skia\";\nimport type { CustomPaintProps, AnimatedProps } from \"../processors\";\nimport { processPaint } from \"../processors\";\nimport { createDeclaration } from \"../nodes\";\n\nexport const usePaintRef = () => useRef<SkPaint>(null);\n\nexport interface PaintProps extends Omit<CustomPaintProps, \"paint\"> {\n children?: ReactNode | ReactNode[];\n}\n\nexport const Paint = forwardRef<SkPaint, AnimatedProps<PaintProps>>(\n (props, ref) => {\n const paint = useMemo(() => SkiaPaint(), []);\n useImperativeHandle(ref, () => paint, [paint]);\n const onDeclare = useMemo(\n () =>\n createDeclaration<PaintProps>((paintProps, children, ctx) =>\n processPaint(paint, ctx.opacity, paintProps, children)\n ),\n [paint]\n );\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n }\n);\n"]}
1
+ {"version":3,"sources":["Paint.tsx"],"names":["React","useRef","useMemo","forwardRef","useImperativeHandle","processPaint","createDeclaration","useCanvas","usePaintRef","Paint","props","ref","Skia","paint","onDeclare","paintProps","children","ctx","opacity"],"mappings":";;AACA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,OAAxB,EAAiCC,UAAjC,EAA6CC,mBAA7C,QAAwE,OAAxE;AAIA,SAASC,YAAT,QAA6B,eAA7B;AACA,SAASC,iBAAT,QAAkC,UAAlC;AACA,SAASC,SAAT,QAA0B,cAA1B;AAEA,OAAO,MAAMC,WAAW,GAAG,MAAMP,MAAM,CAAU,IAAV,CAAhC;AAMP,OAAO,MAAMQ,KAAK,gBAAGN,UAAU,CAC7B,CAACO,KAAD,EAAQC,GAAR,KAAgB;AACd,QAAM;AAAEC,IAAAA;AAAF,MAAWL,SAAS,EAA1B;AACA,QAAMM,KAAK,GAAGX,OAAO,CAAC,MAAMU,IAAI,CAACH,KAAL,EAAP,EAAqB,CAACG,IAAD,CAArB,CAArB;AACAR,EAAAA,mBAAmB,CAACO,GAAD,EAAM,MAAME,KAAZ,EAAmB,CAACA,KAAD,CAAnB,CAAnB;AACA,QAAMC,SAAS,GAAGZ,OAAO,CACvB,MACEI,iBAAiB,CAAa,CAACS,UAAD,EAAaC,QAAb,EAAuBC,GAAvB,KAC5BZ,YAAY,CAACY,GAAG,CAACL,IAAL,EAAWC,KAAX,EAAkBI,GAAG,CAACC,OAAtB,EAA+BH,UAA/B,EAA2CC,QAA3C,CADG,CAFI,EAKvB,CAACH,KAAD,CALuB,CAAzB;AAOA,sBAAO;AAAe,IAAA,SAAS,EAAEC;AAA1B,KAAyCJ,KAAzC,EAAP;AACD,CAb4B,CAAxB","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useRef, useMemo, forwardRef, useImperativeHandle } from \"react\";\n\nimport type { SkPaint } from \"../../skia/types\";\nimport type { CustomPaintProps, AnimatedProps } from \"../processors\";\nimport { processPaint } from \"../processors\";\nimport { createDeclaration } from \"../nodes\";\nimport { useCanvas } from \"../useCanvas\";\n\nexport const usePaintRef = () => useRef<SkPaint>(null);\n\nexport interface PaintProps extends Omit<CustomPaintProps, \"paint\"> {\n children?: ReactNode | ReactNode[];\n}\n\nexport const Paint = forwardRef<SkPaint, AnimatedProps<PaintProps>>(\n (props, ref) => {\n const { Skia } = useCanvas();\n const paint = useMemo(() => Skia.Paint(), [Skia]);\n useImperativeHandle(ref, () => paint, [paint]);\n const onDeclare = useMemo(\n () =>\n createDeclaration<PaintProps>((paintProps, children, ctx) =>\n processPaint(ctx.Skia, paint, ctx.opacity, paintProps, children)\n ),\n [paint]\n );\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Picture.tsx"],"names":["React","createDrawing","onDraw","ctx","picture","canvas","drawPicture","Picture","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,QAA8B,kBAA9B;AAMA,MAAMC,MAAM,GAAGD,aAAa,CAAe,CAACE,GAAD,WAAsB;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAaF,GAAnB;AACAE,EAAAA,MAAM,CAACC,WAAP,CAAmBF,OAAnB;AACD,CAH2B,CAA5B;AAKA,OAAO,MAAMG,OAAO,GAAIC,KAAD,IAAyB;AAC9C,sBAAO;AAAW,IAAA,MAAM,EAAEN;AAAnB,KAA+BM,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport type { SkPicture } from \"../../skia\";\nimport { createDrawing } from \"../nodes/Drawing\";\n\nexport interface PictureProps {\n picture: SkPicture;\n}\n\nconst onDraw = createDrawing<PictureProps>((ctx, { picture }) => {\n const { canvas } = ctx;\n canvas.drawPicture(picture);\n});\n\nexport const Picture = (props: PictureProps) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
1
+ {"version":3,"sources":["Picture.tsx"],"names":["React","createDrawing","onDraw","ctx","picture","canvas","drawPicture","Picture","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,QAA8B,kBAA9B;AAMA,MAAMC,MAAM,GAAGD,aAAa,CAAe,CAACE,GAAD,WAAsB;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAaF,GAAnB;AACAE,EAAAA,MAAM,CAACC,WAAP,CAAmBF,OAAnB;AACD,CAH2B,CAA5B;AAKA,OAAO,MAAMG,OAAO,GAAIC,KAAD,IAAyB;AAC9C,sBAAO;AAAW,IAAA,MAAM,EAAEN;AAAnB,KAA+BM,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport type { SkPicture } from \"../../skia/types\";\nimport { createDrawing } from \"../nodes/Drawing\";\n\nexport interface PictureProps {\n picture: SkPicture;\n}\n\nconst onDraw = createDrawing<PictureProps>((ctx, { picture }) => {\n const { canvas } = ctx;\n canvas.drawPicture(picture);\n});\n\nexport const Picture = (props: PictureProps) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
@@ -13,7 +13,7 @@ const disableFilterMemoization = children => {
13
13
  const onDraw = createDrawing((ctx, _, node) => {
14
14
  disableFilterMemoization(node.children);
15
15
  const toFilter = node.visit(ctx);
16
- const filter = getInput(toFilter);
16
+ const filter = getInput(ctx.Skia, toFilter);
17
17
 
18
18
  if (!filter) {
19
19
  throw new Error("No image filter provided to the background");
@@ -1 +1 @@
1
- {"version":3,"sources":["BackdropFilter.tsx"],"names":["React","createDrawing","getInput","Group","disableFilterMemoization","children","forEach","child","memoizable","onDraw","ctx","_","node","toFilter","visit","filter","Error","canvas","saveLayer","undefined","restore","BackdropFilter","filterChild","groupChildren","props"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,QAA8B,aAA9B;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAEA,SAASC,KAAT,QAAsB,UAAtB;;AAEA,MAAMC,wBAAwB,GAAIC,QAAD,IAA+B;AAC9DA,EAAAA,QAAQ,CAACC,OAAT,CAAkBC,KAAD,IAAW;AAC1BA,IAAAA,KAAK,CAACC,UAAN,GAAmB,KAAnB;AACAJ,IAAAA,wBAAwB,CAACG,KAAK,CAACF,QAAP,CAAxB;AACD,GAHD;AAID,CALD;;AAWA,MAAMI,MAAM,GAAGR,aAAa,CAAsB,CAACS,GAAD,EAAMC,CAAN,EAASC,IAAT,KAAkB;AAClER,EAAAA,wBAAwB,CAACQ,IAAI,CAACP,QAAN,CAAxB;AACA,QAAMQ,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAWJ,GAAX,CAAjB;AACA,QAAMK,MAAM,GAAGb,QAAQ,CAACW,QAAD,CAAvB;;AACA,MAAI,CAACE,MAAL,EAAa;AACX,UAAM,IAAIC,KAAJ,CAAU,4CAAV,CAAN;AACD;;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAaP,GAAnB;AACAO,EAAAA,MAAM,CAACC,SAAP,CAAiBC,SAAjB,EAA4B,IAA5B,EAAkCJ,MAAlC;AACAE,EAAAA,MAAM,CAACG,OAAP;AACD,CAV2B,CAA5B;AAYA,OAAO,MAAMC,cAAc,GAAG,QAIY;AAAA,MAJX;AAC7BN,IAAAA,MAAM,EAAEO,WADqB;AAE7BjB,IAAAA,QAAQ,EAAEkB,aAFmB;AAG7B,OAAGC;AAH0B,GAIW;AACxC,sBACE,oBAAC,KAAD,EAAWA,KAAX,eACE;AAAW,IAAA,MAAM,EAAEf,MAAnB;AAA2B,IAAA,cAAc;AAAzC,KACGa,WADH,CADF,EAIGC,aAJH,CADF;AAQD,CAbM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport type { AnimatedProps } from \"../../processors\";\nimport { createDrawing } from \"../../nodes\";\nimport type { Node } from \"../../nodes\";\nimport { getInput } from \"../imageFilters/getInput\";\nimport type { GroupProps } from \"../Group\";\nimport { Group } from \"../Group\";\n\nconst disableFilterMemoization = (children: Node<unknown>[]) => {\n children.forEach((child) => {\n child.memoizable = false;\n disableFilterMemoization(child.children);\n });\n};\n\nexport interface BackdropFilterProps extends GroupProps {\n filter: ReactNode | ReactNode[];\n}\n\nconst onDraw = createDrawing<BackdropFilterProps>((ctx, _, node) => {\n disableFilterMemoization(node.children);\n const toFilter = node.visit(ctx);\n const filter = getInput(toFilter);\n if (!filter) {\n throw new Error(\"No image filter provided to the background\");\n }\n const { canvas } = ctx;\n canvas.saveLayer(undefined, null, filter);\n canvas.restore();\n});\n\nexport const BackdropFilter = ({\n filter: filterChild,\n children: groupChildren,\n ...props\n}: AnimatedProps<BackdropFilterProps>) => {\n return (\n <Group {...props}>\n <skDrawing onDraw={onDraw} skipProcessing>\n {filterChild}\n </skDrawing>\n {groupChildren}\n </Group>\n );\n};\n"]}
1
+ {"version":3,"sources":["BackdropFilter.tsx"],"names":["React","createDrawing","getInput","Group","disableFilterMemoization","children","forEach","child","memoizable","onDraw","ctx","_","node","toFilter","visit","filter","Skia","Error","canvas","saveLayer","undefined","restore","BackdropFilter","filterChild","groupChildren","props"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,QAA8B,aAA9B;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAEA,SAASC,KAAT,QAAsB,UAAtB;;AAEA,MAAMC,wBAAwB,GAAIC,QAAD,IAA+B;AAC9DA,EAAAA,QAAQ,CAACC,OAAT,CAAkBC,KAAD,IAAW;AAC1BA,IAAAA,KAAK,CAACC,UAAN,GAAmB,KAAnB;AACAJ,IAAAA,wBAAwB,CAACG,KAAK,CAACF,QAAP,CAAxB;AACD,GAHD;AAID,CALD;;AAWA,MAAMI,MAAM,GAAGR,aAAa,CAAsB,CAACS,GAAD,EAAMC,CAAN,EAASC,IAAT,KAAkB;AAClER,EAAAA,wBAAwB,CAACQ,IAAI,CAACP,QAAN,CAAxB;AACA,QAAMQ,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAWJ,GAAX,CAAjB;AACA,QAAMK,MAAM,GAAGb,QAAQ,CAACQ,GAAG,CAACM,IAAL,EAAWH,QAAX,CAAvB;;AACA,MAAI,CAACE,MAAL,EAAa;AACX,UAAM,IAAIE,KAAJ,CAAU,4CAAV,CAAN;AACD;;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAaR,GAAnB;AACAQ,EAAAA,MAAM,CAACC,SAAP,CAAiBC,SAAjB,EAA4B,IAA5B,EAAkCL,MAAlC;AACAG,EAAAA,MAAM,CAACG,OAAP;AACD,CAV2B,CAA5B;AAYA,OAAO,MAAMC,cAAc,GAAG,QAIY;AAAA,MAJX;AAC7BP,IAAAA,MAAM,EAAEQ,WADqB;AAE7BlB,IAAAA,QAAQ,EAAEmB,aAFmB;AAG7B,OAAGC;AAH0B,GAIW;AACxC,sBACE,oBAAC,KAAD,EAAWA,KAAX,eACE;AAAW,IAAA,MAAM,EAAEhB,MAAnB;AAA2B,IAAA,cAAc;AAAzC,KACGc,WADH,CADF,EAIGC,aAJH,CADF;AAQD,CAbM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport type { AnimatedProps } from \"../../processors\";\nimport { createDrawing } from \"../../nodes\";\nimport type { Node } from \"../../nodes\";\nimport { getInput } from \"../imageFilters/getInput\";\nimport type { GroupProps } from \"../Group\";\nimport { Group } from \"../Group\";\n\nconst disableFilterMemoization = (children: Node<unknown>[]) => {\n children.forEach((child) => {\n child.memoizable = false;\n disableFilterMemoization(child.children);\n });\n};\n\nexport interface BackdropFilterProps extends GroupProps {\n filter: ReactNode | ReactNode[];\n}\n\nconst onDraw = createDrawing<BackdropFilterProps>((ctx, _, node) => {\n disableFilterMemoization(node.children);\n const toFilter = node.visit(ctx);\n const filter = getInput(ctx.Skia, toFilter);\n if (!filter) {\n throw new Error(\"No image filter provided to the background\");\n }\n const { canvas } = ctx;\n canvas.saveLayer(undefined, null, filter);\n canvas.restore();\n});\n\nexport const BackdropFilter = ({\n filter: filterChild,\n children: groupChildren,\n ...props\n}: AnimatedProps<BackdropFilterProps>) => {\n return (\n <Group {...props}>\n <skDrawing onDraw={onDraw} skipProcessing>\n {filterChild}\n </skDrawing>\n {groupChildren}\n </Group>\n );\n};\n"]}