@shopify/react-native-skia 0.1.172 → 0.1.173

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. package/android/CMakeLists.txt +1 -0
  2. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -0
  3. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +106 -5
  4. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -1
  5. package/cpp/api/JsiSkSurface.h +7 -1
  6. package/cpp/api/JsiSkSurfaceFactory.h +15 -2
  7. package/cpp/rnskia/RNSkDomView.cpp +2 -4
  8. package/cpp/rnskia/RNSkJsView.cpp +3 -0
  9. package/cpp/rnskia/RNSkPictureView.h +3 -0
  10. package/cpp/rnskia/RNSkPlatformContext.h +9 -0
  11. package/cpp/rnskia/dom/JsiDomApi.h +1 -0
  12. package/cpp/rnskia/dom/base/ConcatablePaint.cpp +117 -0
  13. package/cpp/rnskia/dom/base/ConcatablePaint.h +49 -0
  14. package/cpp/rnskia/dom/base/Declaration.h +88 -0
  15. package/cpp/rnskia/dom/base/DeclarationContext.h +79 -0
  16. package/cpp/rnskia/dom/base/DerivedNodeProp.h +25 -9
  17. package/cpp/rnskia/dom/base/DrawingContext.cpp +32 -186
  18. package/cpp/rnskia/dom/base/DrawingContext.h +45 -64
  19. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +35 -106
  20. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +28 -9
  21. package/cpp/rnskia/dom/base/JsiDomNode.h +46 -17
  22. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +81 -67
  23. package/cpp/rnskia/dom/base/NodeProp.h +12 -2
  24. package/cpp/rnskia/dom/base/NodePropsContainer.h +15 -16
  25. package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +22 -11
  26. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +43 -59
  27. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +16 -17
  28. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +6 -5
  29. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +45 -69
  30. package/cpp/rnskia/dom/nodes/JsiGroupNode.h +1 -1
  31. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +121 -161
  32. package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -0
  33. package/cpp/rnskia/dom/nodes/JsiLayerNode.h +28 -18
  34. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +82 -45
  35. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +68 -101
  36. package/cpp/rnskia/dom/nodes/JsiPathNode.h +3 -2
  37. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +150 -207
  38. package/cpp/rnskia/dom/props/BezierProps.h +4 -2
  39. package/cpp/rnskia/dom/props/BlendModeProp.h +4 -2
  40. package/cpp/rnskia/dom/props/BoxShadowProps.h +8 -10
  41. package/cpp/rnskia/dom/props/CircleProp.h +6 -5
  42. package/cpp/rnskia/dom/props/ClipProp.h +6 -4
  43. package/cpp/rnskia/dom/props/ColorProp.h +8 -4
  44. package/cpp/rnskia/dom/props/DrawingProp.h +5 -3
  45. package/cpp/rnskia/dom/props/FontProp.h +4 -2
  46. package/cpp/rnskia/dom/props/GlyphsProp.h +4 -2
  47. package/cpp/rnskia/dom/props/ImageProps.h +9 -6
  48. package/cpp/rnskia/dom/props/LayerProp.h +6 -4
  49. package/cpp/rnskia/dom/props/MatrixProp.h +4 -2
  50. package/cpp/rnskia/dom/props/NumbersProp.h +8 -4
  51. package/cpp/rnskia/dom/props/PaintProps.h +55 -92
  52. package/cpp/rnskia/dom/props/PathProp.h +4 -2
  53. package/cpp/rnskia/dom/props/PictureProp.h +4 -2
  54. package/cpp/rnskia/dom/props/PointProp.h +4 -2
  55. package/cpp/rnskia/dom/props/PointsProp.h +8 -4
  56. package/cpp/rnskia/dom/props/RRectProp.h +23 -16
  57. package/cpp/rnskia/dom/props/RadiusProp.h +4 -2
  58. package/cpp/rnskia/dom/props/RectProp.h +18 -12
  59. package/cpp/rnskia/dom/props/StrokeProps.h +8 -4
  60. package/cpp/rnskia/dom/props/SvgProp.h +4 -2
  61. package/cpp/rnskia/dom/props/TextBlobProp.h +10 -8
  62. package/cpp/rnskia/dom/props/TileModeProp.h +4 -2
  63. package/cpp/rnskia/dom/props/TransformProp.h +4 -2
  64. package/cpp/rnskia/dom/props/TransformsProps.h +5 -7
  65. package/cpp/rnskia/dom/props/UniformsProp.h +4 -2
  66. package/cpp/rnskia/dom/props/VertexModeProp.h +4 -2
  67. package/cpp/rnskia/dom/props/VerticesProps.h +7 -11
  68. package/ios/RNSkia-iOS/DisplayLink.mm +22 -24
  69. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +53 -50
  70. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -0
  71. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +38 -25
  72. package/ios/RNSkia-iOS/SkiaDomViewManager.mm +17 -17
  73. package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +17 -17
  74. package/ios/RNSkia-iOS/SkiaManager.mm +12 -10
  75. package/ios/RNSkia-iOS/SkiaMetalRenderer.h +5 -0
  76. package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +53 -0
  77. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +17 -17
  78. package/ios/RNSkia-iOS/SkiaUIView.mm +63 -53
  79. package/ios/RNSkiaModule.mm +5 -7
  80. package/lib/commonjs/dom/nodes/DrawingNode.js +5 -1
  81. package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
  82. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +33 -34
  83. package/lib/commonjs/dom/nodes/LayerNode.js +13 -6
  84. package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -1
  85. package/lib/commonjs/dom/nodes/Node.d.ts +6 -11
  86. package/lib/commonjs/dom/nodes/Node.js +8 -26
  87. package/lib/commonjs/dom/nodes/Node.js.map +1 -1
  88. package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
  89. package/lib/commonjs/dom/nodes/PaintNode.d.ts +3 -3
  90. package/lib/commonjs/dom/nodes/PaintNode.js +32 -15
  91. package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
  92. package/lib/commonjs/dom/nodes/RenderNode.d.ts +2 -3
  93. package/lib/commonjs/dom/nodes/RenderNode.js +19 -187
  94. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  95. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
  96. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +25 -7
  97. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
  98. package/lib/commonjs/dom/nodes/drawings/Box.d.ts +3 -1
  99. package/lib/commonjs/dom/nodes/drawings/Box.js +3 -0
  100. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  101. package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +3 -7
  102. package/lib/commonjs/dom/nodes/paint/BlendNode.js +16 -47
  103. package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
  104. package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +10 -11
  105. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +29 -43
  106. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  107. package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +11 -11
  108. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +45 -42
  109. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  110. package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +3 -3
  111. package/lib/commonjs/dom/nodes/paint/MaskFilters.js +3 -2
  112. package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
  113. package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +15 -18
  114. package/lib/commonjs/dom/nodes/paint/PathEffects.js +30 -72
  115. package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
  116. package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +11 -12
  117. package/lib/commonjs/dom/nodes/paint/Shaders.js +28 -18
  118. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  119. package/lib/commonjs/dom/types/DeclarationContext.d.ts +29 -0
  120. package/lib/commonjs/dom/types/DeclarationContext.js +118 -0
  121. package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -0
  122. package/lib/commonjs/dom/types/DrawingContext.d.ts +18 -1
  123. package/lib/commonjs/dom/types/DrawingContext.js +330 -0
  124. package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
  125. package/lib/commonjs/dom/types/Node.d.ts +4 -10
  126. package/lib/commonjs/dom/types/Node.js.map +1 -1
  127. package/lib/commonjs/dom/types/SkDOM.d.ts +22 -23
  128. package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
  129. package/lib/commonjs/dom/types/index.d.ts +1 -0
  130. package/lib/commonjs/dom/types/index.js +13 -0
  131. package/lib/commonjs/dom/types/index.js.map +1 -1
  132. package/lib/commonjs/index.d.ts +1 -0
  133. package/lib/commonjs/index.js +13 -0
  134. package/lib/commonjs/index.js.map +1 -1
  135. package/lib/commonjs/renderer/Canvas.js +3 -3
  136. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  137. package/lib/commonjs/renderer/DrawingContext.d.ts +4 -3
  138. package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
  139. package/lib/commonjs/renderer/HostComponents.d.ts +35 -35
  140. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  141. package/lib/commonjs/renderer/HostConfig.js +1 -0
  142. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  143. package/lib/commonjs/renderer/Offscreen.d.ts +2 -0
  144. package/lib/commonjs/renderer/Offscreen.js +31 -0
  145. package/lib/commonjs/renderer/Offscreen.js.map +1 -0
  146. package/lib/commonjs/renderer/Reconciler.js +0 -1
  147. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  148. package/lib/commonjs/skia/types/Surface/Surface.d.ts +4 -0
  149. package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
  150. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +6 -0
  151. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  152. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  153. package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
  154. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  155. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  156. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +21 -1
  157. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  158. package/lib/commonjs/views/SkiaBaseWebView.js +6 -4
  159. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  160. package/lib/commonjs/views/SkiaDomView.web.js +3 -14
  161. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  162. package/lib/commonjs/views/SkiaPictureView.web.js +0 -7
  163. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  164. package/lib/commonjs/views/SkiaView.web.js +0 -7
  165. package/lib/commonjs/views/SkiaView.web.js.map +1 -1
  166. package/lib/module/dom/nodes/DrawingNode.js +5 -1
  167. package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
  168. package/lib/module/dom/nodes/JsiSkDOM.d.ts +33 -34
  169. package/lib/module/dom/nodes/LayerNode.js +13 -7
  170. package/lib/module/dom/nodes/LayerNode.js.map +1 -1
  171. package/lib/module/dom/nodes/Node.d.ts +6 -11
  172. package/lib/module/dom/nodes/Node.js +8 -25
  173. package/lib/module/dom/nodes/Node.js.map +1 -1
  174. package/lib/module/dom/nodes/PaintContext.js.map +1 -1
  175. package/lib/module/dom/nodes/PaintNode.d.ts +3 -3
  176. package/lib/module/dom/nodes/PaintNode.js +32 -15
  177. package/lib/module/dom/nodes/PaintNode.js.map +1 -1
  178. package/lib/module/dom/nodes/RenderNode.d.ts +2 -3
  179. package/lib/module/dom/nodes/RenderNode.js +20 -187
  180. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  181. package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
  182. package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +23 -4
  183. package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
  184. package/lib/module/dom/nodes/drawings/Box.d.ts +3 -1
  185. package/lib/module/dom/nodes/drawings/Box.js +3 -0
  186. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  187. package/lib/module/dom/nodes/paint/BlendNode.d.ts +3 -7
  188. package/lib/module/dom/nodes/paint/BlendNode.js +15 -46
  189. package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
  190. package/lib/module/dom/nodes/paint/ColorFilters.d.ts +10 -11
  191. package/lib/module/dom/nodes/paint/ColorFilters.js +29 -43
  192. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  193. package/lib/module/dom/nodes/paint/ImageFilters.d.ts +11 -11
  194. package/lib/module/dom/nodes/paint/ImageFilters.js +48 -41
  195. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  196. package/lib/module/dom/nodes/paint/MaskFilters.d.ts +3 -3
  197. package/lib/module/dom/nodes/paint/MaskFilters.js +3 -2
  198. package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
  199. package/lib/module/dom/nodes/paint/PathEffects.d.ts +15 -18
  200. package/lib/module/dom/nodes/paint/PathEffects.js +29 -72
  201. package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
  202. package/lib/module/dom/nodes/paint/Shaders.d.ts +11 -12
  203. package/lib/module/dom/nodes/paint/Shaders.js +28 -18
  204. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  205. package/lib/module/dom/types/DeclarationContext.d.ts +29 -0
  206. package/lib/module/dom/types/DeclarationContext.js +107 -0
  207. package/lib/module/dom/types/DeclarationContext.js.map +1 -0
  208. package/lib/module/dom/types/DrawingContext.d.ts +18 -1
  209. package/lib/module/dom/types/DrawingContext.js +322 -1
  210. package/lib/module/dom/types/DrawingContext.js.map +1 -1
  211. package/lib/module/dom/types/Node.d.ts +4 -10
  212. package/lib/module/dom/types/Node.js.map +1 -1
  213. package/lib/module/dom/types/SkDOM.d.ts +22 -23
  214. package/lib/module/dom/types/SkDOM.js.map +1 -1
  215. package/lib/module/dom/types/index.d.ts +1 -0
  216. package/lib/module/dom/types/index.js +1 -0
  217. package/lib/module/dom/types/index.js.map +1 -1
  218. package/lib/module/index.d.ts +1 -0
  219. package/lib/module/index.js +1 -0
  220. package/lib/module/index.js.map +1 -1
  221. package/lib/module/renderer/Canvas.js +3 -3
  222. package/lib/module/renderer/Canvas.js.map +1 -1
  223. package/lib/module/renderer/DrawingContext.d.ts +4 -3
  224. package/lib/module/renderer/DrawingContext.js.map +1 -1
  225. package/lib/module/renderer/HostComponents.d.ts +35 -35
  226. package/lib/module/renderer/HostComponents.js.map +1 -1
  227. package/lib/module/renderer/HostConfig.js +1 -0
  228. package/lib/module/renderer/HostConfig.js.map +1 -1
  229. package/lib/module/renderer/Offscreen.d.ts +2 -0
  230. package/lib/module/renderer/Offscreen.js +19 -0
  231. package/lib/module/renderer/Offscreen.js.map +1 -0
  232. package/lib/module/renderer/Reconciler.js +0 -1
  233. package/lib/module/renderer/Reconciler.js.map +1 -1
  234. package/lib/module/skia/types/Surface/Surface.d.ts +4 -0
  235. package/lib/module/skia/types/Surface/Surface.js.map +1 -1
  236. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +6 -0
  237. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  238. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  239. package/lib/module/skia/web/JsiSkSurface.js +4 -0
  240. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  241. package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  242. package/lib/module/skia/web/JsiSkSurfaceFactory.js +21 -1
  243. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  244. package/lib/module/views/SkiaBaseWebView.js +6 -4
  245. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  246. package/lib/module/views/SkiaDomView.web.js +2 -11
  247. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  248. package/lib/module/views/SkiaPictureView.web.js +0 -5
  249. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  250. package/lib/module/views/SkiaView.web.js +0 -5
  251. package/lib/module/views/SkiaView.web.js.map +1 -1
  252. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +33 -34
  253. package/lib/typescript/src/dom/nodes/Node.d.ts +6 -11
  254. package/lib/typescript/src/dom/nodes/PaintNode.d.ts +3 -3
  255. package/lib/typescript/src/dom/nodes/RenderNode.d.ts +2 -3
  256. package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
  257. package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +3 -1
  258. package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +3 -7
  259. package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +10 -11
  260. package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +11 -11
  261. package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +3 -3
  262. package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +15 -18
  263. package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +11 -12
  264. package/lib/typescript/src/dom/types/DeclarationContext.d.ts +29 -0
  265. package/lib/typescript/src/dom/types/DrawingContext.d.ts +18 -1
  266. package/lib/typescript/src/dom/types/Node.d.ts +4 -10
  267. package/lib/typescript/src/dom/types/SkDOM.d.ts +22 -23
  268. package/lib/typescript/src/dom/types/index.d.ts +1 -0
  269. package/lib/typescript/src/index.d.ts +1 -0
  270. package/lib/typescript/src/renderer/DrawingContext.d.ts +4 -3
  271. package/lib/typescript/src/renderer/HostComponents.d.ts +35 -35
  272. package/lib/typescript/src/renderer/Offscreen.d.ts +2 -0
  273. package/lib/typescript/src/skia/types/Surface/Surface.d.ts +4 -0
  274. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +6 -0
  275. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
  276. package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  277. package/package.json +1 -1
  278. package/src/dom/nodes/DrawingNode.ts +5 -1
  279. package/src/dom/nodes/LayerNode.ts +13 -11
  280. package/src/dom/nodes/Node.ts +18 -41
  281. package/src/dom/nodes/PaintContext.ts +1 -0
  282. package/src/dom/nodes/PaintNode.ts +28 -18
  283. package/src/dom/nodes/RenderNode.ts +25 -183
  284. package/src/dom/nodes/drawings/BackdropFilterNode.ts +18 -11
  285. package/src/dom/nodes/drawings/Box.ts +6 -4
  286. package/src/dom/nodes/paint/BlendNode.ts +16 -63
  287. package/src/dom/nodes/paint/ColorFilters.ts +32 -55
  288. package/src/dom/nodes/paint/ImageFilters.ts +58 -53
  289. package/src/dom/nodes/paint/MaskFilters.ts +5 -7
  290. package/src/dom/nodes/paint/PathEffects.ts +37 -90
  291. package/src/dom/nodes/paint/Shaders.ts +31 -29
  292. package/src/dom/types/DeclarationContext.ts +105 -0
  293. package/src/dom/types/DrawingContext.ts +304 -1
  294. package/src/dom/types/Node.ts +4 -20
  295. package/src/dom/types/SkDOM.ts +22 -43
  296. package/src/dom/types/index.ts +1 -0
  297. package/src/index.ts +1 -0
  298. package/src/renderer/Canvas.tsx +3 -3
  299. package/src/renderer/DrawingContext.ts +4 -5
  300. package/src/renderer/HostComponents.ts +34 -53
  301. package/src/renderer/HostConfig.ts +1 -0
  302. package/src/renderer/Offscreen.tsx +24 -0
  303. package/src/renderer/Reconciler.tsx +0 -1
  304. package/src/skia/types/Surface/Surface.ts +5 -0
  305. package/src/skia/types/Surface/SurfaceFactory.ts +7 -0
  306. package/src/skia/web/JsiSkSurface.ts +4 -0
  307. package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
  308. package/src/views/SkiaBaseWebView.tsx +6 -2
  309. package/src/views/SkiaDomView.web.tsx +2 -13
  310. package/src/views/SkiaPictureView.web.tsx +0 -7
  311. package/src/views/SkiaView.web.tsx +0 -7
@@ -2,50 +2,50 @@
2
2
  #include "SkiaPictureViewManager.h"
3
3
  #include <React/RCTBridge+Private.h>
4
4
 
5
- #include <RNSkPlatformContext.h>
6
- #include <RNSkPictureView.h>
7
5
  #include <RNSkIOSView.h>
6
+ #include <RNSkPictureView.h>
7
+ #include <RNSkPlatformContext.h>
8
8
 
9
9
  #include "SkiaManager.h"
10
- #include <RNSkiaModule.h>
11
10
  #include "SkiaUIView.h"
12
-
13
-
11
+ #include <RNSkiaModule.h>
14
12
 
15
13
  @implementation SkiaPictureViewManager
16
14
 
17
15
  RCT_EXPORT_MODULE(SkiaPictureView)
18
16
 
19
- - (SkiaManager*) skiaManager {
17
+ - (SkiaManager *)skiaManager {
20
18
  auto bridge = [RCTBridge currentBridge];
21
- auto skiaModule = (RNSkiaModule*)[bridge moduleForName:@"RNSkia"];
19
+ auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkia"];
22
20
  return [skiaModule manager];
23
21
  }
24
22
 
25
23
  RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, SkiaUIView) {
26
24
  // Get parameter
27
25
  int nativeId = [[RCTConvert NSString:json] intValue];
28
- [(SkiaUIView*)view setNativeId:nativeId];
26
+ [(SkiaUIView *)view setNativeId:nativeId];
29
27
  }
30
28
 
31
29
  RCT_CUSTOM_VIEW_PROPERTY(mode, NSString, SkiaUIView) {
32
- std::string mode = json != NULL ? [[RCTConvert NSString:json] UTF8String] : "default";
33
- [(SkiaUIView*)view setDrawingMode: mode];
30
+ std::string mode =
31
+ json != NULL ? [[RCTConvert NSString:json] UTF8String] : "default";
32
+ [(SkiaUIView *)view setDrawingMode:mode];
34
33
  }
35
34
 
36
35
  RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, SkiaUIView) {
37
36
  bool debug = json != NULL ? [RCTConvert BOOL:json] : false;
38
- [(SkiaUIView*)view setDebugMode: debug];
37
+ [(SkiaUIView *)view setDebugMode:debug];
39
38
  }
40
39
 
41
- - (UIView *)view
42
- {
40
+ - (UIView *)view {
43
41
  auto skManager = [[self skiaManager] skManager];
44
42
  // Pass SkManager as a raw pointer to avoid circular dependenciesr
45
- return [[SkiaUIView alloc] initWithManager: skManager.get()
46
- factory: [](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
47
- return std::make_shared<RNSkiOSView<RNSkia::RNSkPictureView>>(context);
48
- }];
43
+ return [[SkiaUIView alloc]
44
+ initWithManager:skManager.get()
45
+ factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
46
+ return std::make_shared<RNSkiOSView<RNSkia::RNSkPictureView>>(
47
+ context);
48
+ }];
49
49
  }
50
50
 
51
51
  @end
@@ -9,19 +9,22 @@
9
9
 
10
10
  @implementation SkiaUIView {
11
11
  std::shared_ptr<RNSkBaseiOSView> _impl;
12
- RNSkia::RNSkManager* _manager;
12
+ RNSkia::RNSkManager *_manager;
13
13
  RNSkia::RNSkDrawingMode _drawingMode;
14
- std::function<std::shared_ptr<RNSkBaseiOSView>(std::shared_ptr<RNSkia::RNSkPlatformContext>)> _factory;
14
+ std::function<std::shared_ptr<RNSkBaseiOSView>(
15
+ std::shared_ptr<RNSkia::RNSkPlatformContext>)>
16
+ _factory;
15
17
  bool _debugMode;
16
18
  size_t _nativeId;
17
19
  }
18
20
 
19
21
  #pragma mark Initialization and destruction
20
22
 
21
- - (instancetype) initWithManager: (RNSkia::RNSkManager*)manager
22
- factory: (std::function<std::shared_ptr<RNSkBaseiOSView>(
23
- std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory
24
- {
23
+ - (instancetype)initWithManager:(RNSkia::RNSkManager *)manager
24
+ factory:
25
+ (std::function<std::shared_ptr<RNSkBaseiOSView>(
26
+ std::shared_ptr<RNSkia::RNSkPlatformContext>)>)
27
+ factory {
25
28
  self = [super init];
26
29
  if (self) {
27
30
  _manager = manager;
@@ -31,28 +34,29 @@
31
34
  _factory = factory;
32
35
 
33
36
  // Listen to notifications about module invalidation
34
- [[NSNotificationCenter defaultCenter] addObserver:self
35
- selector:@selector(willInvalidateModules)
36
- name:RCTBridgeWillInvalidateModulesNotification
37
- object:nil];
37
+ [[NSNotificationCenter defaultCenter]
38
+ addObserver:self
39
+ selector:@selector(willInvalidateModules)
40
+ name:RCTBridgeWillInvalidateModulesNotification
41
+ object:nil];
38
42
  }
39
43
  return self;
40
44
  }
41
45
 
42
- - (void) willInvalidateModules {
46
+ - (void)willInvalidateModules {
43
47
  _impl = nullptr;
44
48
  _manager = nullptr;
45
49
  }
46
50
 
47
51
  #pragma mark Lifecycle
48
52
 
49
- - (void) willMoveToSuperview:(UIView *)newWindow {
53
+ - (void)willMoveToSuperview:(UIView *)newWindow {
50
54
  if (newWindow == NULL) {
51
55
  // Remove implementation view when the parent view is not set
52
- if(_impl != nullptr) {
56
+ if (_impl != nullptr) {
53
57
  [_impl->getLayer() removeFromSuperlayer];
54
58
 
55
- if(_nativeId != 0 && _manager != nullptr) {
59
+ if (_nativeId != 0 && _manager != nullptr) {
56
60
  _manager->setSkiaView(_nativeId, nullptr);
57
61
  }
58
62
 
@@ -60,13 +64,14 @@
60
64
  }
61
65
  } else {
62
66
  // Create implementation view when the parent view is set
63
- if(_impl == nullptr && _manager != nullptr) {
67
+ if (_impl == nullptr && _manager != nullptr) {
64
68
  _impl = _factory(_manager->getPlatformContext());
65
- if(_impl == nullptr) {
66
- throw std::runtime_error("Expected Skia view implementation, got nullptr.");
69
+ if (_impl == nullptr) {
70
+ throw std::runtime_error(
71
+ "Expected Skia view implementation, got nullptr.");
67
72
  }
68
- [self.layer addSublayer: _impl->getLayer()];
69
- if(_nativeId != 0) {
73
+ [self.layer addSublayer:_impl->getLayer()];
74
+ if (_nativeId != 0) {
70
75
  _manager->setSkiaView(_nativeId, _impl->getDrawView());
71
76
  }
72
77
  _impl->getDrawView()->setDrawingMode(_drawingMode);
@@ -75,71 +80,76 @@
75
80
  }
76
81
  }
77
82
 
78
- - (void) dealloc {
79
- if(_manager != nullptr && _nativeId != 0) {
83
+ - (void)dealloc {
84
+ if (_manager != nullptr && _nativeId != 0) {
80
85
  _manager->unregisterSkiaView(_nativeId);
81
86
  }
82
87
 
83
- [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
88
+ [[NSNotificationCenter defaultCenter]
89
+ removeObserver:self
90
+ name:RCTBridgeWillInvalidateModulesNotification
91
+ object:nil];
84
92
 
85
93
  assert(_impl == nullptr);
86
94
  }
87
95
 
88
96
  #pragma mark Layout
89
97
 
90
- - (void) layoutSubviews {
98
+ - (void)layoutSubviews {
91
99
  [super layoutSubviews];
92
- if(_impl != nullptr) {
100
+ if (_impl != nullptr) {
93
101
  _impl->setSize(self.bounds.size.width, self.bounds.size.height);
94
102
  }
95
103
  }
96
104
 
97
105
  #pragma mark Properties
98
106
 
99
- -(void) setDrawingMode:(std::string) mode {
100
- _drawingMode = mode.compare("continuous") == 0 ? RNSkia::RNSkDrawingMode::Continuous : RNSkia::RNSkDrawingMode::Default;
107
+ - (void)setDrawingMode:(std::string)mode {
108
+ _drawingMode = mode.compare("continuous") == 0
109
+ ? RNSkia::RNSkDrawingMode::Continuous
110
+ : RNSkia::RNSkDrawingMode::Default;
101
111
 
102
- if(_impl != nullptr) {
112
+ if (_impl != nullptr) {
103
113
  _impl->getDrawView()->setDrawingMode(_drawingMode);
104
114
  }
105
115
  }
106
116
 
107
- -(void) setDebugMode:(bool) debugMode {
117
+ - (void)setDebugMode:(bool)debugMode {
108
118
  _debugMode = debugMode;
109
- if(_impl != nullptr) {
119
+ if (_impl != nullptr) {
110
120
  _impl->getDrawView()->setShowDebugOverlays(debugMode);
111
121
  }
112
122
  }
113
123
 
114
- - (void) setNativeId:(size_t) nativeId {
124
+ - (void)setNativeId:(size_t)nativeId {
115
125
  _nativeId = nativeId;
116
126
 
117
- if(_impl != nullptr) {
127
+ if (_impl != nullptr) {
118
128
  _manager->registerSkiaView(nativeId, _impl->getDrawView());
119
129
  }
120
130
  }
121
131
 
122
132
  #pragma mark External API
123
133
 
124
- - (std::shared_ptr<RNSkBaseiOSView>) impl {
134
+ - (std::shared_ptr<RNSkBaseiOSView>)impl {
125
135
  return _impl;
126
136
  }
127
137
 
128
138
  #pragma mark Touch handling
129
139
 
130
- - (void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
140
+ - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
131
141
  [self handleTouches:touches withEvent:event];
132
142
  }
133
143
 
134
- -(void) touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
144
+ - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
135
145
  [self handleTouches:touches withEvent:event];
136
146
  }
137
147
 
138
- -(void) touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
148
+ - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
139
149
  [self handleTouches:touches withEvent:event];
140
150
  }
141
151
 
142
- - (void) handleTouches:(NSSet<UITouch*>*) touches withEvent:(UIEvent*) event {
152
+ - (void)handleTouches:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
143
153
  if (event.type == UIEventTypeTouches) {
144
154
  std::vector<RNSkia::RNSkTouchInfo> nextTouches;
145
155
  for (UITouch *touch in touches) {
@@ -150,27 +160,27 @@
150
160
  nextTouch.force = [touch force];
151
161
  nextTouch.id = [touch hash];
152
162
  auto phase = [touch phase];
153
- switch(phase) {
154
- case UITouchPhaseBegan:
155
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Start;
156
- break;
157
- case UITouchPhaseMoved:
158
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
159
- break;
160
- case UITouchPhaseEnded:
161
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::End;
162
- break;
163
- case UITouchPhaseCancelled:
164
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Cancelled;
165
- break;
166
- default:
167
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
168
- break;
163
+ switch (phase) {
164
+ case UITouchPhaseBegan:
165
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Start;
166
+ break;
167
+ case UITouchPhaseMoved:
168
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
169
+ break;
170
+ case UITouchPhaseEnded:
171
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::End;
172
+ break;
173
+ case UITouchPhaseCancelled:
174
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Cancelled;
175
+ break;
176
+ default:
177
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
178
+ break;
169
179
  }
170
180
 
171
181
  nextTouches.push_back(nextTouch);
172
182
  }
173
- if(_impl != nullptr) {
183
+ if (_impl != nullptr) {
174
184
  _impl->getDrawView()->updateTouchState(nextTouches);
175
185
  }
176
186
  }
@@ -3,14 +3,14 @@
3
3
  #import <React/RCTBridge+Private.h>
4
4
 
5
5
  @implementation RNSkiaModule {
6
- SkiaManager* skiaManager;
6
+ SkiaManager *skiaManager;
7
7
  }
8
8
 
9
9
  RCT_EXPORT_MODULE(RNSkia)
10
10
 
11
11
  #pragma Accessors
12
12
 
13
- -(SkiaManager*) manager {
13
+ - (SkiaManager *)manager {
14
14
  return skiaManager;
15
15
  }
16
16
 
@@ -20,21 +20,19 @@ RCT_EXPORT_MODULE(RNSkia)
20
20
  return YES;
21
21
  }
22
22
 
23
- - (void)invalidate
24
- {
23
+ - (void)invalidate {
25
24
  if (skiaManager != nil) {
26
25
  [skiaManager invalidate];
27
26
  }
28
27
  skiaManager = nil;
29
28
  }
30
29
 
31
- RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
32
- {
30
+ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
33
31
  if (skiaManager != nil) {
34
32
  // Already initialized, ignore call.
35
33
  return @true;
36
34
  }
37
- RCTBridge* bridge = [RCTBridge currentBridge];
35
+ RCTBridge *bridge = [RCTBridge currentBridge];
38
36
  skiaManager = [[SkiaManager alloc] initWithBridge:bridge];
39
37
  return @true;
40
38
  }
@@ -66,7 +66,11 @@ class JsiDrawingNode extends _RenderNode.JsiRenderNode {
66
66
 
67
67
  this.children().map(child => {
68
68
  if (child instanceof _PaintNode.PaintNode) {
69
- const paint = child.materialize();
69
+ const declCtx = ctx.declarationCtx;
70
+ declCtx.save();
71
+ child.decorate(declCtx);
72
+ const paint = declCtx.paints.pop();
73
+ declCtx.restore();
70
74
  this.draw({ ...ctx,
71
75
  paint
72
76
  });
@@ -1 +1 @@
1
- {"version":3,"names":["JsiDrawingNode","JsiRenderNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","JsiDeclarationNode","Error","insertChildBefore","before","renderNode","paint","draw","children","map","PaintNode","materialize"],"sources":["DrawingNode.ts"],"sourcesContent":["import type {\n DrawingContext,\n DrawingNodeProps,\n Node,\n NodeType,\n RenderNode,\n} from \"../types\";\n\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\nimport { PaintNode } from \"./PaintNode\";\nimport { JsiRenderNode } from \"./RenderNode\";\n\nexport abstract class JsiDrawingNode<P extends DrawingNodeProps, C>\n extends JsiRenderNode<P>\n implements RenderNode<P>\n{\n protected derived?: C;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.derived = this.deriveProps();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.derived = this.deriveProps();\n }\n\n setProp<K extends keyof P>(name: K, value: P[K]) {\n const hasChanged = super.setProp(name, value);\n if (hasChanged) {\n this.derived = this.deriveProps();\n }\n return hasChanged;\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.derived = this.deriveProps();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.derived = this.deriveProps();\n }\n\n renderNode(ctx: DrawingContext): void {\n if (this.props.paint) {\n this.draw({ ...ctx, paint: this.props.paint });\n } else {\n this.draw(ctx);\n }\n this.children().map((child) => {\n if (child instanceof PaintNode) {\n const paint = child.materialize();\n this.draw({ ...ctx, paint });\n }\n });\n }\n\n protected abstract draw(ctx: DrawingContext): void;\n protected abstract deriveProps(): C;\n}\n"],"mappings":";;;;;;;AASA;;AACA;;AACA;;;;AAEO,MAAeA,cAAf,SACGC,yBADH,CAGP;EAGEC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWC,IAAX,EAAiBC,KAAjB;;IADsD;;IAEtD,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDC,QAAQ,CAACH,KAAD,EAAW;IACjB,MAAMG,QAAN,CAAeH,KAAf;IACA,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDE,OAAO,CAAoBC,IAApB,EAA6BC,KAA7B,EAA0C;IAC/C,MAAMC,UAAU,GAAG,MAAMH,OAAN,CAAcC,IAAd,EAAoBC,KAApB,CAAnB;;IACA,IAAIC,UAAJ,EAAgB;MACd,KAAKN,OAAL,GAAe,KAAKC,WAAL,EAAf;IACD;;IACD,OAAOK,UAAP;EACD;;EAEDC,QAAQ,CAACC,KAAD,EAA6B;IACnC,IAAI,EAAEA,KAAK,YAAYC,wBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIC,KAAJ,CAAW,cAAaF,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMS,QAAN,CAAeC,KAAf;IACA,KAAKR,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDU,iBAAiB,CAACH,KAAD,EAAuBI,MAAvB,EAAoD;IACnE,IAAI,EAAEJ,KAAK,YAAYC,wBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIC,KAAJ,CAAW,cAAaF,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMa,iBAAN,CAAwBH,KAAxB,EAA+BI,MAA/B;IACA,KAAKZ,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDY,UAAU,CAAChB,GAAD,EAA4B;IACpC,IAAI,KAAKE,KAAL,CAAWe,KAAf,EAAsB;MACpB,KAAKC,IAAL,CAAU,EAAE,GAAGlB,GAAL;QAAUiB,KAAK,EAAE,KAAKf,KAAL,CAAWe;MAA5B,CAAV;IACD,CAFD,MAEO;MACL,KAAKC,IAAL,CAAUlB,GAAV;IACD;;IACD,KAAKmB,QAAL,GAAgBC,GAAhB,CAAqBT,KAAD,IAAW;MAC7B,IAAIA,KAAK,YAAYU,oBAArB,EAAgC;QAC9B,MAAMJ,KAAK,GAAGN,KAAK,CAACW,WAAN,EAAd;QACA,KAAKJ,IAAL,CAAU,EAAE,GAAGlB,GAAL;UAAUiB;QAAV,CAAV;MACD;IACF,CALD;EAMD;;AAjDH"}
1
+ {"version":3,"names":["JsiDrawingNode","JsiRenderNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","JsiDeclarationNode","Error","insertChildBefore","before","renderNode","paint","draw","children","map","PaintNode","declCtx","declarationCtx","save","decorate","paints","pop","restore"],"sources":["DrawingNode.ts"],"sourcesContent":["import type {\n DrawingContext,\n DrawingNodeProps,\n Node,\n NodeType,\n RenderNode,\n} from \"../types\";\n\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\nimport { PaintNode } from \"./PaintNode\";\nimport { JsiRenderNode } from \"./RenderNode\";\n\nexport abstract class JsiDrawingNode<P extends DrawingNodeProps, C>\n extends JsiRenderNode<P>\n implements RenderNode<P>\n{\n protected derived?: C;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.derived = this.deriveProps();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.derived = this.deriveProps();\n }\n\n setProp<K extends keyof P>(name: K, value: P[K]) {\n const hasChanged = super.setProp(name, value);\n if (hasChanged) {\n this.derived = this.deriveProps();\n }\n return hasChanged;\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.derived = this.deriveProps();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.derived = this.deriveProps();\n }\n\n renderNode(ctx: DrawingContext): void {\n if (this.props.paint) {\n this.draw({ ...ctx, paint: this.props.paint });\n } else {\n this.draw(ctx);\n }\n this.children().map((child) => {\n if (child instanceof PaintNode) {\n const declCtx = ctx.declarationCtx;\n declCtx.save();\n child.decorate(declCtx);\n const paint = declCtx.paints.pop()!;\n declCtx.restore();\n this.draw({ ...ctx, paint });\n }\n });\n }\n\n protected abstract draw(ctx: DrawingContext): void;\n protected abstract deriveProps(): C;\n}\n"],"mappings":";;;;;;;AASA;;AACA;;AACA;;;;AAEO,MAAeA,cAAf,SACGC,yBADH,CAGP;EAGEC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWC,IAAX,EAAiBC,KAAjB;;IADsD;;IAEtD,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDC,QAAQ,CAACH,KAAD,EAAW;IACjB,MAAMG,QAAN,CAAeH,KAAf;IACA,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDE,OAAO,CAAoBC,IAApB,EAA6BC,KAA7B,EAA0C;IAC/C,MAAMC,UAAU,GAAG,MAAMH,OAAN,CAAcC,IAAd,EAAoBC,KAApB,CAAnB;;IACA,IAAIC,UAAJ,EAAgB;MACd,KAAKN,OAAL,GAAe,KAAKC,WAAL,EAAf;IACD;;IACD,OAAOK,UAAP;EACD;;EAEDC,QAAQ,CAACC,KAAD,EAA6B;IACnC,IAAI,EAAEA,KAAK,YAAYC,wBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIC,KAAJ,CAAW,cAAaF,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMS,QAAN,CAAeC,KAAf;IACA,KAAKR,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDU,iBAAiB,CAACH,KAAD,EAAuBI,MAAvB,EAAoD;IACnE,IAAI,EAAEJ,KAAK,YAAYC,wBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIC,KAAJ,CAAW,cAAaF,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMa,iBAAN,CAAwBH,KAAxB,EAA+BI,MAA/B;IACA,KAAKZ,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDY,UAAU,CAAChB,GAAD,EAA4B;IACpC,IAAI,KAAKE,KAAL,CAAWe,KAAf,EAAsB;MACpB,KAAKC,IAAL,CAAU,EAAE,GAAGlB,GAAL;QAAUiB,KAAK,EAAE,KAAKf,KAAL,CAAWe;MAA5B,CAAV;IACD,CAFD,MAEO;MACL,KAAKC,IAAL,CAAUlB,GAAV;IACD;;IACD,KAAKmB,QAAL,GAAgBC,GAAhB,CAAqBT,KAAD,IAAW;MAC7B,IAAIA,KAAK,YAAYU,oBAArB,EAAgC;QAC9B,MAAMC,OAAO,GAAGtB,GAAG,CAACuB,cAApB;QACAD,OAAO,CAACE,IAAR;QACAb,KAAK,CAACc,QAAN,CAAeH,OAAf;QACA,MAAML,KAAK,GAAGK,OAAO,CAACI,MAAR,CAAeC,GAAf,EAAd;QACAL,OAAO,CAACM,OAAR;QACA,KAAKV,IAAL,CAAU,EAAE,GAAGlB,GAAL;UAAUiB;QAAV,CAAV;MACD;IACF,CATD;EAUD;;AArDH"}
@@ -1,14 +1,13 @@
1
1
  import type { PathProps, SkDOM, GroupProps, ImageProps, BlurImageFilterProps, MatrixColorFilterProps, CircleProps, BlurMaskFilterProps, LinearGradientProps, PaintProps, ShaderProps, ImageShaderProps, CustomDrawingNodeProps, LineProps, OvalProps, PatchProps, PointsProps, RectProps, RoundedRectProps, VerticesProps, TextProps, DiffRectProps, OffsetImageFilterProps, BlendColorFilterProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, FractalNoiseProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, DrawingNodeProps, BoxProps, BoxShadowProps, ChildrenProps } from "../types";
2
2
  import type { BlendImageFilterProps, BlendProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, RuntimeShaderImageFilterProps } from "../types/ImageFilters";
3
3
  import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../types/PathEffects";
4
- import { CornerPathEffectNode, Path1DPathEffectNode, Path2DPathEffectNode, Line2DPathEffectNode, BlendNode } from "./paint";
5
4
  import type { NodeContext } from "./Node";
6
5
  export declare class JsiSkDOM implements SkDOM {
7
6
  private ctx;
8
7
  constructor(ctx: NodeContext);
9
8
  Layer(props?: ChildrenProps): import("../types").RenderNode<ChildrenProps>;
10
9
  Group(props?: GroupProps): import("../types").RenderNode<GroupProps>;
11
- Paint(props: PaintProps): import("../types").DeclarationNode<PaintProps, import("../..").SkPaint, never>;
10
+ Paint(props: PaintProps): import("../types").DeclarationNode<PaintProps>;
12
11
  Fill(props?: DrawingNodeProps): import("../types").RenderNode<PaintProps>;
13
12
  Image(props: ImageProps): import("../types").RenderNode<ImageProps>;
14
13
  Circle(props: CircleProps): import("../types").RenderNode<CircleProps>;
@@ -28,38 +27,38 @@ export declare class JsiSkDOM implements SkDOM {
28
27
  DiffRect(props: DiffRectProps): import("../types").RenderNode<DiffRectProps>;
29
28
  Picture(props: PictureProps): import("../types").RenderNode<PictureProps>;
30
29
  ImageSVG(props: ImageSVGProps): import("../types").RenderNode<ImageSVGProps>;
31
- BlurMaskFilter(props: BlurMaskFilterProps): import("../types").DeclarationNode<BlurMaskFilterProps, import("../..").SkMaskFilter, never>;
32
- BlendImageFilter(props: BlendImageFilterProps): import("../types").DeclarationNode<BlendImageFilterProps, import("../..").SkImageFilter, never>;
33
- DropShadowImageFilter(props: DropShadowImageFilterProps): import("../types").DeclarationNode<DropShadowImageFilterProps, import("../..").SkImageFilter, never>;
34
- DisplacementMapImageFilter(props: DisplacementMapImageFilterProps): import("../types").DeclarationNode<DisplacementMapImageFilterProps, import("../..").SkImageFilter, never>;
35
- BlurImageFilter(props: BlurImageFilterProps): import("../types").DeclarationNode<BlurImageFilterProps, import("../..").SkImageFilter, never>;
36
- OffsetImageFilter(props: OffsetImageFilterProps): import("../types").DeclarationNode<OffsetImageFilterProps, import("../..").SkImageFilter, never>;
37
- MorphologyImageFilter(props: MorphologyImageFilterProps): import("../types").DeclarationNode<MorphologyImageFilterProps, import("../..").SkImageFilter, never>;
38
- RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps): import("../types").DeclarationNode<RuntimeShaderImageFilterProps, import("../..").SkImageFilter, never>;
39
- MatrixColorFilter(props: MatrixColorFilterProps): import("../types").DeclarationNode<MatrixColorFilterProps, import("../..").SkColorFilter, never>;
40
- BlendColorFilter(props: BlendColorFilterProps): import("../types").DeclarationNode<BlendColorFilterProps, import("../..").SkColorFilter, never>;
41
- LumaColorFilter(): import("../types").DeclarationNode<null, import("../..").SkColorFilter, never>;
42
- LinearToSRGBGammaColorFilter(): import("../types").DeclarationNode<null, import("../..").SkColorFilter, never>;
43
- SRGBToLinearGammaColorFilter(): import("../types").DeclarationNode<null, import("../..").SkColorFilter, never>;
44
- LerpColorFilter(props: LerpColorFilterProps): import("../types").DeclarationNode<LerpColorFilterProps, import("../..").SkColorFilter, never>;
45
- Shader(props: ShaderProps): import("../types").DeclarationNode<ShaderProps, import("../..").SkShader, never>;
46
- ImageShader(props: ImageShaderProps): import("../types").DeclarationNode<ImageShaderProps, import("../..").SkShader, never>;
47
- ColorShader(props: ColorProps): import("../types").DeclarationNode<ColorProps, import("../..").SkShader, never>;
48
- SweepGradient(props: SweepGradientProps): import("../types").DeclarationNode<SweepGradientProps, import("../..").SkShader, never>;
49
- Turbulence(props: TurbulenceProps): import("../types").DeclarationNode<TurbulenceProps, import("../..").SkShader, never>;
50
- FractalNoise(props: FractalNoiseProps): import("../types").DeclarationNode<FractalNoiseProps, import("../..").SkShader, never>;
51
- LinearGradient(props: LinearGradientProps): import("../types").DeclarationNode<LinearGradientProps, import("../..").SkShader, never>;
52
- RadialGradient(props: RadialGradientProps): import("../types").DeclarationNode<RadialGradientProps, import("../..").SkShader, never>;
53
- TwoPointConicalGradient(props: TwoPointConicalGradientProps): import("../types").DeclarationNode<TwoPointConicalGradientProps, import("../..").SkShader, never>;
54
- CornerPathEffect(props: CornerPathEffectProps): CornerPathEffectNode | import("../types").DeclarationNode<CornerPathEffectProps, import("../..").SkPathEffect, never>;
55
- DiscretePathEffect(props: DiscretePathEffectProps): import("../types").DeclarationNode<DiscretePathEffectProps, import("../..").SkPathEffect, never>;
56
- DashPathEffect(props: DashPathEffectProps): import("../types").DeclarationNode<DashPathEffectProps, import("../..").SkPathEffect, never>;
57
- Path1DPathEffect(props: Path1DPathEffectProps): Path1DPathEffectNode | import("../types").DeclarationNode<Path1DPathEffectProps, import("../..").SkPathEffect, never>;
58
- Path2DPathEffect(props: Path2DPathEffectProps): Path2DPathEffectNode | import("../types").DeclarationNode<Path2DPathEffectProps, import("../..").SkPathEffect, never>;
59
- SumPathEffect(): import("../types").DeclarationNode<null, import("../..").SkPathEffect, never>;
60
- Line2DPathEffect(props: Line2DPathEffectProps): Line2DPathEffectNode | import("../types").DeclarationNode<Line2DPathEffectProps, import("../..").SkPathEffect, never>;
61
- Blend(props: BlendProps): BlendNode | import("../types").DeclarationNode<BlendProps, import("../..").SkImageFilter, never>;
30
+ BlurMaskFilter(props: BlurMaskFilterProps): import("../types").DeclarationNode<BlurMaskFilterProps>;
31
+ BlendImageFilter(props: BlendImageFilterProps): import("../types").DeclarationNode<BlendImageFilterProps>;
32
+ DropShadowImageFilter(props: DropShadowImageFilterProps): import("../types").DeclarationNode<DropShadowImageFilterProps>;
33
+ DisplacementMapImageFilter(props: DisplacementMapImageFilterProps): import("../types").DeclarationNode<DisplacementMapImageFilterProps>;
34
+ BlurImageFilter(props: BlurImageFilterProps): import("../types").DeclarationNode<BlurImageFilterProps>;
35
+ OffsetImageFilter(props: OffsetImageFilterProps): import("../types").DeclarationNode<OffsetImageFilterProps>;
36
+ MorphologyImageFilter(props: MorphologyImageFilterProps): import("../types").DeclarationNode<MorphologyImageFilterProps>;
37
+ RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps): import("../types").DeclarationNode<RuntimeShaderImageFilterProps>;
38
+ MatrixColorFilter(props: MatrixColorFilterProps): import("../types").DeclarationNode<MatrixColorFilterProps>;
39
+ BlendColorFilter(props: BlendColorFilterProps): import("../types").DeclarationNode<BlendColorFilterProps>;
40
+ LumaColorFilter(): import("../types").DeclarationNode<null>;
41
+ LinearToSRGBGammaColorFilter(): import("../types").DeclarationNode<null>;
42
+ SRGBToLinearGammaColorFilter(): import("../types").DeclarationNode<null>;
43
+ LerpColorFilter(props: LerpColorFilterProps): import("../types").DeclarationNode<LerpColorFilterProps>;
44
+ Shader(props: ShaderProps): import("../types").DeclarationNode<ShaderProps>;
45
+ ImageShader(props: ImageShaderProps): import("../types").DeclarationNode<ImageShaderProps>;
46
+ ColorShader(props: ColorProps): import("../types").DeclarationNode<ColorProps>;
47
+ SweepGradient(props: SweepGradientProps): import("../types").DeclarationNode<SweepGradientProps>;
48
+ Turbulence(props: TurbulenceProps): import("../types").DeclarationNode<TurbulenceProps>;
49
+ FractalNoise(props: FractalNoiseProps): import("../types").DeclarationNode<FractalNoiseProps>;
50
+ LinearGradient(props: LinearGradientProps): import("../types").DeclarationNode<LinearGradientProps>;
51
+ RadialGradient(props: RadialGradientProps): import("../types").DeclarationNode<RadialGradientProps>;
52
+ TwoPointConicalGradient(props: TwoPointConicalGradientProps): import("../types").DeclarationNode<TwoPointConicalGradientProps>;
53
+ CornerPathEffect(props: CornerPathEffectProps): import("../types").DeclarationNode<CornerPathEffectProps>;
54
+ DiscretePathEffect(props: DiscretePathEffectProps): import("../types").DeclarationNode<DiscretePathEffectProps>;
55
+ DashPathEffect(props: DashPathEffectProps): import("../types").DeclarationNode<DashPathEffectProps>;
56
+ Path1DPathEffect(props: Path1DPathEffectProps): import("../types").DeclarationNode<Path1DPathEffectProps>;
57
+ Path2DPathEffect(props: Path2DPathEffectProps): import("../types").DeclarationNode<Path2DPathEffectProps>;
58
+ SumPathEffect(): import("../types").DeclarationNode<null>;
59
+ Line2DPathEffect(props: Line2DPathEffectProps): import("../types").DeclarationNode<Line2DPathEffectProps>;
60
+ Blend(props: BlendProps): import("../types").DeclarationNode<BlendProps>;
62
61
  BackdropFilter(props: ChildrenProps): import("../types").RenderNode<ChildrenProps>;
63
62
  Box(props: BoxProps): import("../types").RenderNode<BoxProps>;
64
- BoxShadow(props: BoxShadowProps): import("../types").DeclarationNode<BoxShadowProps, BoxShadowProps, never>;
63
+ BoxShadow(props: BoxShadowProps): import("../types").DeclarationNode<BoxShadowProps>;
65
64
  }
@@ -11,19 +11,26 @@ var _RenderNode = require("./RenderNode");
11
11
 
12
12
  var _Node = require("./Node");
13
13
 
14
- const isLayer = node => node instanceof _Node.JsiDeclarationNode && node.isPaint();
15
-
16
14
  class LayerNode extends _RenderNode.JsiRenderNode {
17
15
  constructor(ctx, props) {
18
16
  super(ctx, _types.NodeType.Layer, props);
19
17
  }
20
18
 
21
19
  renderNode(ctx) {
20
+ let hasLayer = false;
22
21
  const [layer, ...children] = this.children();
23
22
 
24
- if (isLayer(layer)) {
25
- const paint = layer.materialize();
26
- ctx.canvas.saveLayer(paint);
23
+ if (layer instanceof _Node.JsiDeclarationNode) {
24
+ const declCtx = ctx.declarationCtx;
25
+ declCtx.save();
26
+ layer.decorate(declCtx);
27
+ const paint = declCtx.paints.pop();
28
+ declCtx.restore();
29
+
30
+ if (paint) {
31
+ hasLayer = true;
32
+ ctx.canvas.saveLayer(paint);
33
+ }
27
34
  }
28
35
 
29
36
  children.map(child => {
@@ -32,7 +39,7 @@ class LayerNode extends _RenderNode.JsiRenderNode {
32
39
  }
33
40
  });
34
41
 
35
- if (isLayer(layer)) {
42
+ if (hasLayer) {
36
43
  ctx.canvas.restore();
37
44
  }
38
45
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isLayer","node","JsiDeclarationNode","isPaint","LayerNode","JsiRenderNode","constructor","ctx","props","NodeType","Layer","renderNode","layer","children","paint","materialize","canvas","saveLayer","map","child","render","restore"],"sources":["LayerNode.ts"],"sourcesContent":["import type { DeclarationNode, DrawingContext, Node } from \"../types\";\nimport { NodeType } from \"../types\";\nimport type { ChildrenProps } from \"../types/Common\";\nimport type { SkPaint } from \"../../skia\";\n\nimport { JsiRenderNode } from \"./RenderNode\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nconst isLayer = (\n node: Node<unknown>\n): node is DeclarationNode<unknown, SkPaint> =>\n node instanceof JsiDeclarationNode && node.isPaint();\n\nexport class LayerNode extends JsiRenderNode<ChildrenProps> {\n constructor(ctx: NodeContext, props: ChildrenProps) {\n super(ctx, NodeType.Layer, props);\n }\n\n renderNode(ctx: DrawingContext): void {\n const [layer, ...children] = this.children();\n if (isLayer(layer)) {\n const paint = layer.materialize() as SkPaint;\n ctx.canvas.saveLayer(paint);\n }\n children.map((child) => {\n if (child instanceof JsiRenderNode) {\n child.render(ctx);\n }\n });\n if (isLayer(layer)) {\n ctx.canvas.restore();\n }\n }\n}\n"],"mappings":";;;;;;;AACA;;AAIA;;AAEA;;AAEA,MAAMA,OAAO,GACXC,IADc,IAGdA,IAAI,YAAYC,wBAAhB,IAAsCD,IAAI,CAACE,OAAL,EAHxC;;AAKO,MAAMC,SAAN,SAAwBC,yBAAxB,CAAqD;EAC1DC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAyC;IAClD,MAAMD,GAAN,EAAWE,eAAA,CAASC,KAApB,EAA2BF,KAA3B;EACD;;EAEDG,UAAU,CAACJ,GAAD,EAA4B;IACpC,MAAM,CAACK,KAAD,EAAQ,GAAGC,QAAX,IAAuB,KAAKA,QAAL,EAA7B;;IACA,IAAIb,OAAO,CAACY,KAAD,CAAX,EAAoB;MAClB,MAAME,KAAK,GAAGF,KAAK,CAACG,WAAN,EAAd;MACAR,GAAG,CAACS,MAAJ,CAAWC,SAAX,CAAqBH,KAArB;IACD;;IACDD,QAAQ,CAACK,GAAT,CAAcC,KAAD,IAAW;MACtB,IAAIA,KAAK,YAAYd,yBAArB,EAAoC;QAClCc,KAAK,CAACC,MAAN,CAAab,GAAb;MACD;IACF,CAJD;;IAKA,IAAIP,OAAO,CAACY,KAAD,CAAX,EAAoB;MAClBL,GAAG,CAACS,MAAJ,CAAWK,OAAX;IACD;EACF;;AAnByD"}
1
+ {"version":3,"names":["LayerNode","JsiRenderNode","constructor","ctx","props","NodeType","Layer","renderNode","hasLayer","layer","children","JsiDeclarationNode","declCtx","declarationCtx","save","decorate","paint","paints","pop","restore","canvas","saveLayer","map","child","render"],"sources":["LayerNode.ts"],"sourcesContent":["import type { DrawingContext } from \"../types\";\nimport { NodeType } from \"../types\";\nimport type { ChildrenProps } from \"../types/Common\";\n\nimport { JsiRenderNode } from \"./RenderNode\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class LayerNode extends JsiRenderNode<ChildrenProps> {\n constructor(ctx: NodeContext, props: ChildrenProps) {\n super(ctx, NodeType.Layer, props);\n }\n\n renderNode(ctx: DrawingContext): void {\n let hasLayer = false;\n const [layer, ...children] = this.children();\n if (layer instanceof JsiDeclarationNode) {\n const declCtx = ctx.declarationCtx;\n declCtx.save();\n layer.decorate(declCtx);\n const paint = declCtx.paints.pop();\n declCtx.restore();\n if (paint) {\n hasLayer = true;\n ctx.canvas.saveLayer(paint);\n }\n }\n children.map((child) => {\n if (child instanceof JsiRenderNode) {\n child.render(ctx);\n }\n });\n if (hasLayer) {\n ctx.canvas.restore();\n }\n }\n}\n"],"mappings":";;;;;;;AACA;;AAGA;;AAEA;;AAEO,MAAMA,SAAN,SAAwBC,yBAAxB,CAAqD;EAC1DC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAyC;IAClD,MAAMD,GAAN,EAAWE,eAAA,CAASC,KAApB,EAA2BF,KAA3B;EACD;;EAEDG,UAAU,CAACJ,GAAD,EAA4B;IACpC,IAAIK,QAAQ,GAAG,KAAf;IACA,MAAM,CAACC,KAAD,EAAQ,GAAGC,QAAX,IAAuB,KAAKA,QAAL,EAA7B;;IACA,IAAID,KAAK,YAAYE,wBAArB,EAAyC;MACvC,MAAMC,OAAO,GAAGT,GAAG,CAACU,cAApB;MACAD,OAAO,CAACE,IAAR;MACAL,KAAK,CAACM,QAAN,CAAeH,OAAf;MACA,MAAMI,KAAK,GAAGJ,OAAO,CAACK,MAAR,CAAeC,GAAf,EAAd;MACAN,OAAO,CAACO,OAAR;;MACA,IAAIH,KAAJ,EAAW;QACTR,QAAQ,GAAG,IAAX;QACAL,GAAG,CAACiB,MAAJ,CAAWC,SAAX,CAAqBL,KAArB;MACD;IACF;;IACDN,QAAQ,CAACY,GAAT,CAAcC,KAAD,IAAW;MACtB,IAAIA,KAAK,YAAYtB,yBAArB,EAAoC;QAClCsB,KAAK,CAACC,MAAN,CAAarB,GAAb;MACD;IACF,CAJD;;IAKA,IAAIK,QAAJ,EAAc;MACZL,GAAG,CAACiB,MAAJ,CAAWD,OAAX;IACD;EACF;;AA3ByD"}
@@ -1,7 +1,7 @@
1
- import type { SkColorFilter, Skia, SkImageFilter, SkMaskFilter, SkShader, SkPathEffect, SkPaint } from "../../skia/types";
2
- import type { Node, DeclarationNode, NodeType } from "../types";
3
- import { DeclarationType } from "../types";
1
+ import type { Skia } from "../../skia/types";
2
+ import type { Node, DeclarationNode, NodeType, DeclarationType } from "../types";
4
3
  import type { DependencyManager } from "../../renderer/DependencyManager";
4
+ import type { DeclarationContext } from "../types/DeclarationContext";
5
5
  export interface NodeContext {
6
6
  Skia: Skia;
7
7
  depMgr: DependencyManager;
@@ -23,21 +23,16 @@ export declare abstract class JsiNode<P> implements Node<P> {
23
23
  insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
24
24
  }
25
25
  export declare type Invalidate = () => void;
26
- export declare abstract class JsiDeclarationNode<P, T, Nullable extends null | never = never> extends JsiNode<P> implements DeclarationNode<P, T, Nullable> {
26
+ export declare abstract class JsiDeclarationNode<P> extends JsiNode<P> implements DeclarationNode<P> {
27
27
  declarationType: DeclarationType;
28
28
  private invalidate;
29
29
  constructor(ctx: NodeContext, declarationType: DeclarationType, type: NodeType, props: P);
30
- abstract materialize(): T | Nullable;
30
+ abstract decorate(ctx: DeclarationContext): void;
31
+ protected decorateChildren(ctx: DeclarationContext): void;
31
32
  addChild(child: Node<unknown>): void;
32
33
  insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
33
34
  dispose(): void;
34
35
  setInvalidate(invalidate: Invalidate): void;
35
36
  setProps(props: P): void;
36
37
  setProp<K extends keyof P>(name: K, v: P[K]): boolean;
37
- isPaint(): this is DeclarationNode<unknown, SkPaint>;
38
- isImageFilter(): this is DeclarationNode<unknown, SkImageFilter>;
39
- isColorFilter(): this is DeclarationNode<unknown, SkColorFilter>;
40
- isShader(): this is DeclarationNode<unknown, SkShader>;
41
- isMaskFilter(): this is DeclarationNode<unknown, SkMaskFilter>;
42
- isPathEffect(): this is DeclarationNode<unknown, SkPathEffect>;
43
38
  }
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.JsiNode = exports.JsiDeclarationNode = void 0;
7
7
 
8
- var _types = require("../types");
9
-
10
8
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
9
 
12
10
  class JsiNode {
@@ -86,6 +84,14 @@ class JsiDeclarationNode extends JsiNode {
86
84
  _defineProperty(this, "invalidate", () => {});
87
85
  }
88
86
 
87
+ decorateChildren(ctx) {
88
+ this.children().forEach(child => {
89
+ if (child instanceof JsiDeclarationNode) {
90
+ child.decorate(ctx);
91
+ }
92
+ });
93
+ }
94
+
89
95
  addChild(child) {
90
96
  if (!(child instanceof JsiDeclarationNode)) {
91
97
  throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
@@ -128,30 +134,6 @@ class JsiDeclarationNode extends JsiNode {
128
134
  return hasChanged;
129
135
  }
130
136
 
131
- isPaint() {
132
- return this.declarationType === _types.DeclarationType.Paint;
133
- }
134
-
135
- isImageFilter() {
136
- return this.declarationType === _types.DeclarationType.ImageFilter;
137
- }
138
-
139
- isColorFilter() {
140
- return this.declarationType === _types.DeclarationType.ColorFilter;
141
- }
142
-
143
- isShader() {
144
- return this.declarationType === _types.DeclarationType.Shader;
145
- }
146
-
147
- isMaskFilter() {
148
- return this.declarationType === _types.DeclarationType.MaskFilter;
149
- }
150
-
151
- isPathEffect() {
152
- return this.declarationType === _types.DeclarationType.PathEffect;
153
- }
154
-
155
137
  }
156
138
 
157
139
  exports.JsiDeclarationNode = JsiDeclarationNode;