@shopify/react-native-skia 1.11.0 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. package/android/CMakeLists.txt +0 -8
  2. package/android/cpp/jni/JniLoad.cpp +0 -2
  3. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -1
  4. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +4 -2
  5. package/cpp/api/recorder/Convertor.h +2 -1
  6. package/cpp/api/recorder/DataTypes.h +70 -72
  7. package/cpp/api/recorder/Drawings.h +25 -24
  8. package/cpp/api/recorder/RNRecorder.h +12 -10
  9. package/cpp/api/recorder/Shaders.h +5 -5
  10. package/cpp/jsi/ViewProperty.h +5 -16
  11. package/cpp/rnskia/RNSkManager.cpp +1 -7
  12. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +8 -4
  13. package/lib/commonjs/dom/nodes/index.d.ts +0 -1
  14. package/lib/commonjs/dom/nodes/index.js +0 -11
  15. package/lib/commonjs/dom/nodes/index.js.map +1 -1
  16. package/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -6
  17. package/lib/commonjs/external/reanimated/renderHelpers.js +0 -73
  18. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  19. package/lib/commonjs/index.d.ts +0 -1
  20. package/lib/commonjs/index.js +0 -12
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/renderer/Canvas.d.ts +10 -1
  23. package/lib/commonjs/renderer/Canvas.js +3 -1
  24. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  25. package/lib/commonjs/sksg/Container.d.ts +2 -0
  26. package/lib/commonjs/sksg/Container.js +10 -0
  27. package/lib/commonjs/sksg/Container.js.map +1 -1
  28. package/lib/commonjs/sksg/Elements.d.ts +65 -0
  29. package/lib/commonjs/sksg/Elements.js +6 -0
  30. package/lib/commonjs/sksg/Elements.js.map +1 -0
  31. package/lib/commonjs/sksg/Reconciler.d.ts +1 -0
  32. package/lib/commonjs/sksg/Reconciler.js +2 -0
  33. package/lib/commonjs/sksg/Reconciler.js.map +1 -1
  34. package/lib/commonjs/views/index.d.ts +0 -1
  35. package/lib/commonjs/views/index.js +0 -11
  36. package/lib/commonjs/views/index.js.map +1 -1
  37. package/lib/module/dom/nodes/index.d.ts +0 -1
  38. package/lib/module/dom/nodes/index.js +0 -1
  39. package/lib/module/dom/nodes/index.js.map +1 -1
  40. package/lib/module/external/reanimated/renderHelpers.d.ts +0 -6
  41. package/lib/module/external/reanimated/renderHelpers.js +0 -68
  42. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  43. package/lib/module/index.d.ts +0 -1
  44. package/lib/module/index.js +0 -1
  45. package/lib/module/index.js.map +1 -1
  46. package/lib/module/renderer/Canvas.d.ts +10 -1
  47. package/lib/module/renderer/Canvas.js +1 -0
  48. package/lib/module/renderer/Canvas.js.map +1 -1
  49. package/lib/module/sksg/Container.d.ts +2 -0
  50. package/lib/module/sksg/Container.js +10 -0
  51. package/lib/module/sksg/Container.js.map +1 -1
  52. package/lib/module/sksg/Elements.d.ts +65 -0
  53. package/lib/module/sksg/Elements.js +2 -0
  54. package/lib/module/sksg/Elements.js.map +1 -0
  55. package/lib/module/sksg/Reconciler.d.ts +1 -0
  56. package/lib/module/sksg/Reconciler.js +2 -0
  57. package/lib/module/sksg/Reconciler.js.map +1 -1
  58. package/lib/module/views/index.d.ts +0 -1
  59. package/lib/module/views/index.js +0 -1
  60. package/lib/module/views/index.js.map +1 -1
  61. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -3
  62. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +1 -0
  63. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +2 -0
  64. package/lib/typescript/lib/commonjs/sksg/Elements.d.ts +1 -0
  65. package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -0
  66. package/lib/typescript/lib/module/dom/nodes/index.d.ts +0 -1
  67. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -3
  68. package/lib/typescript/lib/module/index.d.ts +0 -1
  69. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  70. package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -0
  71. package/lib/typescript/lib/module/sksg/Container.d.ts +2 -0
  72. package/lib/typescript/lib/module/sksg/Elements.d.ts +1 -0
  73. package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -0
  74. package/lib/typescript/lib/module/views/index.d.ts +0 -1
  75. package/lib/typescript/src/dom/nodes/index.d.ts +0 -1
  76. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -6
  77. package/lib/typescript/src/index.d.ts +0 -1
  78. package/lib/typescript/src/renderer/Canvas.d.ts +10 -1
  79. package/lib/typescript/src/sksg/Container.d.ts +2 -0
  80. package/lib/typescript/src/sksg/Elements.d.ts +65 -0
  81. package/lib/typescript/src/sksg/Reconciler.d.ts +1 -0
  82. package/lib/typescript/src/views/index.d.ts +0 -1
  83. package/package.json +1 -1
  84. package/src/dom/nodes/index.ts +0 -1
  85. package/src/external/reanimated/renderHelpers.ts +1 -78
  86. package/src/index.ts +0 -1
  87. package/src/renderer/Canvas.tsx +11 -1
  88. package/src/sksg/Container.ts +11 -0
  89. package/src/sksg/Elements.tsx +136 -0
  90. package/src/sksg/Reconciler.ts +2 -0
  91. package/src/views/index.ts +0 -1
  92. package/android/cpp/jni/include/JniSkiaDomView.h +0 -82
  93. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +0 -41
  94. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +0 -32
  95. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerDelegate.java +0 -34
  96. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerInterface.java +0 -18
  97. package/cpp/rnskia/RNSkDomView.cpp +0 -121
  98. package/cpp/rnskia/RNSkDomView.h +0 -97
  99. package/cpp/rnskia/dom/JsiDomApi.h +0 -165
  100. package/cpp/rnskia/dom/base/BaseNodeProp.h +0 -72
  101. package/cpp/rnskia/dom/base/ConcatablePaint.cpp +0 -117
  102. package/cpp/rnskia/dom/base/ConcatablePaint.h +0 -49
  103. package/cpp/rnskia/dom/base/Declaration.h +0 -86
  104. package/cpp/rnskia/dom/base/DeclarationContext.h +0 -79
  105. package/cpp/rnskia/dom/base/DerivedNodeProp.h +0 -203
  106. package/cpp/rnskia/dom/base/DrawingContext.cpp +0 -55
  107. package/cpp/rnskia/dom/base/DrawingContext.h +0 -104
  108. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +0 -119
  109. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +0 -71
  110. package/cpp/rnskia/dom/base/JsiDomNode.h +0 -572
  111. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +0 -262
  112. package/cpp/rnskia/dom/base/NodeProp.h +0 -139
  113. package/cpp/rnskia/dom/base/NodePropsContainer.h +0 -158
  114. package/cpp/rnskia/dom/nodes/JsiAtlasNode.h +0 -64
  115. package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +0 -49
  116. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +0 -94
  117. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +0 -75
  118. package/cpp/rnskia/dom/nodes/JsiBoxNode.h +0 -94
  119. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +0 -33
  120. package/cpp/rnskia/dom/nodes/JsiCircleNode.h +0 -35
  121. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +0 -164
  122. package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +0 -37
  123. package/cpp/rnskia/dom/nodes/JsiFillNode.h +0 -22
  124. package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +0 -53
  125. package/cpp/rnskia/dom/nodes/JsiGroupNode.h +0 -25
  126. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +0 -361
  127. package/cpp/rnskia/dom/nodes/JsiImageNode.h +0 -43
  128. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +0 -63
  129. package/cpp/rnskia/dom/nodes/JsiLayerNode.h +0 -74
  130. package/cpp/rnskia/dom/nodes/JsiLineNode.h +0 -38
  131. package/cpp/rnskia/dom/nodes/JsiOvalNode.h +0 -32
  132. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +0 -119
  133. package/cpp/rnskia/dom/nodes/JsiParagraphNode.h +0 -62
  134. package/cpp/rnskia/dom/nodes/JsiPatchNode.h +0 -50
  135. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +0 -268
  136. package/cpp/rnskia/dom/nodes/JsiPathNode.h +0 -181
  137. package/cpp/rnskia/dom/nodes/JsiPictureNode.h +0 -31
  138. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +0 -48
  139. package/cpp/rnskia/dom/nodes/JsiRRectNode.h +0 -33
  140. package/cpp/rnskia/dom/nodes/JsiRectNode.h +0 -33
  141. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +0 -434
  142. package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +0 -44
  143. package/cpp/rnskia/dom/nodes/JsiTextNode.h +0 -51
  144. package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +0 -33
  145. package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +0 -41
  146. package/cpp/rnskia/dom/props/BezierProps.h +0 -65
  147. package/cpp/rnskia/dom/props/BlendModeProp.h +0 -103
  148. package/cpp/rnskia/dom/props/BoxShadowProps.h +0 -62
  149. package/cpp/rnskia/dom/props/CircleProp.h +0 -49
  150. package/cpp/rnskia/dom/props/ClipProp.h +0 -57
  151. package/cpp/rnskia/dom/props/ColorProp.h +0 -96
  152. package/cpp/rnskia/dom/props/FontProp.h +0 -42
  153. package/cpp/rnskia/dom/props/GlyphsProp.h +0 -55
  154. package/cpp/rnskia/dom/props/LayerProp.h +0 -52
  155. package/cpp/rnskia/dom/props/MatrixProp.h +0 -54
  156. package/cpp/rnskia/dom/props/NumbersProp.h +0 -67
  157. package/cpp/rnskia/dom/props/PaintProps.h +0 -133
  158. package/cpp/rnskia/dom/props/ParagraphProp.h +0 -45
  159. package/cpp/rnskia/dom/props/PathProp.h +0 -59
  160. package/cpp/rnskia/dom/props/PictureProp.h +0 -40
  161. package/cpp/rnskia/dom/props/PointProp.h +0 -65
  162. package/cpp/rnskia/dom/props/PointsProp.h +0 -81
  163. package/cpp/rnskia/dom/props/RRectProp.h +0 -222
  164. package/cpp/rnskia/dom/props/RSXformProp.h +0 -52
  165. package/cpp/rnskia/dom/props/RadiusProp.h +0 -43
  166. package/cpp/rnskia/dom/props/RectProp.h +0 -164
  167. package/cpp/rnskia/dom/props/SamplingProp.h +0 -54
  168. package/cpp/rnskia/dom/props/SkImageProps.h +0 -196
  169. package/cpp/rnskia/dom/props/StrokeProps.h +0 -79
  170. package/cpp/rnskia/dom/props/SvgProp.h +0 -45
  171. package/cpp/rnskia/dom/props/TextBlobProp.h +0 -133
  172. package/cpp/rnskia/dom/props/TileModeProp.h +0 -52
  173. package/cpp/rnskia/dom/props/TransformProp.h +0 -147
  174. package/cpp/rnskia/dom/props/TransformsProps.h +0 -66
  175. package/cpp/rnskia/dom/props/UniformsProp.h +0 -159
  176. package/cpp/rnskia/dom/props/VertexModeProp.h +0 -49
  177. package/cpp/rnskia/dom/props/VerticesProps.h +0 -63
  178. package/ios/RNSkia-iOS/SkiaDomView.h +0 -7
  179. package/ios/RNSkia-iOS/SkiaDomView.mm +0 -63
  180. package/ios/RNSkia-iOS/SkiaDomViewManager.h +0 -8
  181. package/ios/RNSkia-iOS/SkiaDomViewManager.mm +0 -51
  182. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +0 -64
  183. package/lib/commonjs/dom/nodes/JsiSkDOM.js +0 -196
  184. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +0 -1
  185. package/lib/commonjs/renderer/CanvasOld.d.ts +0 -11
  186. package/lib/commonjs/renderer/CanvasOld.js +0 -96
  187. package/lib/commonjs/renderer/CanvasOld.js.map +0 -1
  188. package/lib/commonjs/renderer/Container.d.ts +0 -10
  189. package/lib/commonjs/renderer/Container.js +0 -26
  190. package/lib/commonjs/renderer/Container.js.map +0 -1
  191. package/lib/commonjs/renderer/HostComponents.d.ts +0 -129
  192. package/lib/commonjs/renderer/HostComponents.js +0 -141
  193. package/lib/commonjs/renderer/HostComponents.js.map +0 -1
  194. package/lib/commonjs/renderer/HostConfig.d.ts +0 -18
  195. package/lib/commonjs/renderer/HostConfig.js +0 -157
  196. package/lib/commonjs/renderer/HostConfig.js.map +0 -1
  197. package/lib/commonjs/renderer/Reconciler.d.ts +0 -9
  198. package/lib/commonjs/renderer/Reconciler.js +0 -44
  199. package/lib/commonjs/renderer/Reconciler.js.map +0 -1
  200. package/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +0 -6
  201. package/lib/commonjs/specs/SkiaDomViewNativeComponent.js +0 -11
  202. package/lib/commonjs/specs/SkiaDomViewNativeComponent.js.map +0 -1
  203. package/lib/commonjs/views/SkiaDomView.d.ts +0 -33
  204. package/lib/commonjs/views/SkiaDomView.js +0 -119
  205. package/lib/commonjs/views/SkiaDomView.js.map +0 -1
  206. package/lib/commonjs/views/SkiaDomView.web.d.ts +0 -0
  207. package/lib/commonjs/views/SkiaDomView.web.js +0 -2
  208. package/lib/commonjs/views/SkiaDomView.web.js.map +0 -1
  209. package/lib/module/dom/nodes/JsiSkDOM.d.ts +0 -64
  210. package/lib/module/dom/nodes/JsiSkDOM.js +0 -189
  211. package/lib/module/dom/nodes/JsiSkDOM.js.map +0 -1
  212. package/lib/module/renderer/CanvasOld.d.ts +0 -11
  213. package/lib/module/renderer/CanvasOld.js +0 -87
  214. package/lib/module/renderer/CanvasOld.js.map +0 -1
  215. package/lib/module/renderer/Container.d.ts +0 -10
  216. package/lib/module/renderer/Container.js +0 -19
  217. package/lib/module/renderer/Container.js.map +0 -1
  218. package/lib/module/renderer/HostComponents.d.ts +0 -129
  219. package/lib/module/renderer/HostComponents.js +0 -134
  220. package/lib/module/renderer/HostComponents.js.map +0 -1
  221. package/lib/module/renderer/HostConfig.d.ts +0 -18
  222. package/lib/module/renderer/HostConfig.js +0 -150
  223. package/lib/module/renderer/HostConfig.js.map +0 -1
  224. package/lib/module/renderer/Reconciler.d.ts +0 -9
  225. package/lib/module/renderer/Reconciler.js +0 -36
  226. package/lib/module/renderer/Reconciler.js.map +0 -1
  227. package/lib/module/specs/SkiaDomViewNativeComponent.d.ts +0 -6
  228. package/lib/module/specs/SkiaDomViewNativeComponent.js +0 -4
  229. package/lib/module/specs/SkiaDomViewNativeComponent.js.map +0 -1
  230. package/lib/module/views/SkiaDomView.d.ts +0 -33
  231. package/lib/module/views/SkiaDomView.js +0 -111
  232. package/lib/module/views/SkiaDomView.js.map +0 -1
  233. package/lib/module/views/SkiaDomView.web.d.ts +0 -0
  234. package/lib/module/views/SkiaDomView.web.js +0 -2
  235. package/lib/module/views/SkiaDomView.web.js.map +0 -1
  236. package/lib/typescript/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +0 -60
  237. package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +0 -3
  238. package/lib/typescript/lib/commonjs/renderer/Container.d.ts +0 -9
  239. package/lib/typescript/lib/commonjs/renderer/HostComponents.d.ts +0 -2
  240. package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +0 -40
  241. package/lib/typescript/lib/commonjs/renderer/Reconciler.d.ts +0 -10
  242. package/lib/typescript/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +0 -3
  243. package/lib/typescript/lib/commonjs/views/SkiaDomView.d.ts +0 -30
  244. package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +0 -0
  245. package/lib/typescript/lib/module/dom/nodes/JsiSkDOM.d.ts +0 -59
  246. package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +0 -3
  247. package/lib/typescript/lib/module/renderer/Container.d.ts +0 -9
  248. package/lib/typescript/lib/module/renderer/HostComponents.d.ts +0 -1
  249. package/lib/typescript/lib/module/renderer/HostConfig.d.ts +0 -39
  250. package/lib/typescript/lib/module/renderer/Reconciler.d.ts +0 -9
  251. package/lib/typescript/lib/module/specs/SkiaDomViewNativeComponent.d.ts +0 -2
  252. package/lib/typescript/lib/module/views/SkiaDomView.d.ts +0 -27
  253. package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +0 -0
  254. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +0 -64
  255. package/lib/typescript/src/renderer/CanvasOld.d.ts +0 -11
  256. package/lib/typescript/src/renderer/Container.d.ts +0 -10
  257. package/lib/typescript/src/renderer/HostComponents.d.ts +0 -129
  258. package/lib/typescript/src/renderer/HostConfig.d.ts +0 -18
  259. package/lib/typescript/src/renderer/Reconciler.d.ts +0 -9
  260. package/lib/typescript/src/specs/SkiaDomViewNativeComponent.d.ts +0 -6
  261. package/lib/typescript/src/views/SkiaDomView.d.ts +0 -33
  262. package/lib/typescript/src/views/SkiaDomView.web.d.ts +0 -0
  263. package/src/dom/nodes/JsiSkDOM.ts +0 -298
  264. package/src/renderer/CanvasOld.tsx +0 -126
  265. package/src/renderer/Container.tsx +0 -19
  266. package/src/renderer/HostComponents.ts +0 -399
  267. package/src/renderer/HostConfig.ts +0 -258
  268. package/src/renderer/Reconciler.tsx +0 -54
  269. package/src/specs/SkiaDomViewNativeComponent.ts +0 -9
  270. package/src/views/SkiaDomView.tsx +0 -124
  271. package/src/views/SkiaDomView.web.tsx +0 -0
  272. /package/cpp/api/recorder/{Image.h → ImageFit.h} +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["Rea","HAS_REANIMATED_3","reanimatedVersion","require","version","includes","e","_bindings","WeakMap","unbindReanimatedNode","node","previousMapperId","get","undefined","stopMapper","extractReanimatedProps","props","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps","container","sharedValues","Object","values","length","viewId","getNativeId","SkiaViewApi","global","mapperId","startMapper","setProp","requestRedraw","redraw","set"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nexport let HAS_REANIMATED_3 = false;\ntry {\n // This logic is convoluted but necessary\n // In most systems, `require(\"react-native-reanimated\")` throws an error, all is well.\n // In webpack, in some configuration it will return an empty object.\n // So it will not throw an error and we need to check the version to know if it's there.\n const reanimatedVersion =\n require(\"react-native-reanimated/package.json\").version;\n require(\"react-native-reanimated\");\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n HAS_REANIMATED_3 = true;\n }\n} catch (e) {\n // do nothing\n}\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport const unbindReanimatedNode = (node: Node<unknown>) => {\n if (!HAS_REANIMATED_3) {\n return;\n }\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n};\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED_3) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (Rea.isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (!HAS_REANIMATED_3) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n if (node) {\n for (const propName in reanimatedProps) {\n node.setProp(propName, reanimatedProps[propName].value);\n }\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":"AAAA;;AAMA,OAAOA,GAAG,MAAM,mBAAmB;AAEnC,OAAO,IAAIC,gBAAgB,GAAG,KAAK;AACnC,IAAI;EACF;EACA;EACA;EACA;EACA,MAAMC,iBAAiB,GACrBC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EACzDD,OAAO,CAAC,yBAAyB,CAAC;EAClC,IACED,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACG,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAJ,gBAAgB,GAAG,IAAI;EACzB;AACF,CAAC,CAAC,OAAOK,CAAC,EAAE;EACV;AAAA;AAGF,MAAMC,SAAS,GAAG,IAAIC,OAAO,CAAyB,CAAC;AAEvD,OAAO,MAAMC,oBAAoB,GAAIC,IAAmB,IAAK;EAC3D,IAAI,CAACT,gBAAgB,EAAE;IACrB;EACF;EACA,MAAMU,gBAAgB,GAAGJ,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC;EAC5C,IAAIC,gBAAgB,KAAKE,SAAS,EAAE;IAClCb,GAAG,CAACc,UAAU,CAACH,gBAA0B,CAAC;EAC5C;AACF,CAAC;AAED,OAAO,SAASI,sBAAsBA,CAACC,KAAyB,EAAE;EAChE,IAAI,CAACf,gBAAgB,EAAE;IACrB,OAAO,CAACe,KAAK,EAAE,CAAC,CAAC,CAAC;EACpB;EACA,MAAMC,eAAe,GAAG,CAAC,CAAuB;EAChD,MAAMC,UAAU,GA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ACfA,WAAW,CAACK,aAAa,CAACP,MAAM,CAAC;MACnC,CAAC,MAAM;QACLL,SAAS,CAACa,MAAM,CAAC,CAAC;MACpB;IACF,CAAC,EAAEZ,YAAY,CAAC;IAChBlB,SAAS,CAAC+B,GAAG,CAAC5B,IAAI,EAAEuB,QAAQ,CAAC;EAC/B;AACF","ignoreList":[]}
1
+ {"version":3,"names":["HAS_REANIMATED_3","reanimatedVersion","require","version","includes","e"],"sources":["renderHelpers.ts"],"sourcesContent":["export let HAS_REANIMATED_3 = false;\n\ntry {\n // This logic is convoluted but necessary\n // In most systems, `require(\"react-native-reanimated\")` throws an error, all is well.\n // In webpack, in some configuration it will return an empty object.\n // So it will not throw an error and we need to check the version to know if it's there.\n const reanimatedVersion =\n require(\"react-native-reanimated/package.json\").version;\n require(\"react-native-reanimated\");\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n HAS_REANIMATED_3 = true;\n }\n} catch (e) {\n // do nothing\n}\n"],"mappings":"AAAA,OAAO,IAAIA,gBAAgB,GAAG,KAAK;AAEnC,IAAI;EACF;EACA;EACA;EACA;EACA,MAAMC,iBAAiB,GACrBC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EACzDD,OAAO,CAAC,yBAAyB,CAAC;EAClC,IACED,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACG,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAJ,gBAAgB,GAAG,IAAI;EACzB;AACF,CAAC,CAAC,OAAOK,CAAC,EAAE;EACV;AAAA","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import "./skia/NativeSetup";
2
2
  export { JsiSkImage } from "./skia/web/JsiSkImage";
3
3
  export * from "./renderer";
4
- export * from "./renderer/CanvasOld";
5
4
  export * from "./renderer/Canvas";
6
5
  export * from "./renderer/Offscreen";
7
6
  export * from "./views";
@@ -1,7 +1,6 @@
1
1
  import "./skia/NativeSetup";
2
2
  export { JsiSkImage } from "./skia/web/JsiSkImage";
3
3
  export * from "./renderer";
4
- export * from "./renderer/CanvasOld";
5
4
  export * from "./renderer/Canvas";
6
5
  export * from "./renderer/Offscreen";
7
6
  export * from "./views";
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkImage"],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport { JsiSkImage } from \"./skia/web/JsiSkImage\";\nexport * from \"./renderer\";\nexport * from \"./renderer/CanvasOld\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":"AAAA,OAAO,oBAAoB;AAC3B,SAASA,UAAU,QAAQ,uBAAuB;AAClD,cAAc,YAAY;AAC1B,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["JsiSkImage"],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport { JsiSkImage } from \"./skia/web/JsiSkImage\";\nexport * from \"./renderer\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":"AAAA,OAAO,oBAAoB;AAC3B,SAASA,UAAU,QAAQ,uBAAuB;AAClD,cAAc,YAAY;AAC1B,cAAc,mBAAmB;AACjC,cAAc,sBAAsB;AACpC,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,aAAa","ignoreList":[]}
@@ -1,6 +1,14 @@
1
+ import type { FC } from "react";
1
2
  import type { ViewProps } from "react-native";
2
3
  import type { SharedValue } from "react-native-reanimated";
3
- import type { SkSize } from "../skia/types";
4
+ import type { SkImage, SkRect, SkSize } from "../skia/types";
5
+ interface CanvasRef extends FC<CanvasProps> {
6
+ makeImageSnapshot(rect?: SkRect): SkImage;
7
+ makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;
8
+ redraw(): void;
9
+ getNativeId(): number;
10
+ }
11
+ export declare const useCanvasRef: () => import("react").RefObject<CanvasRef>;
4
12
  export interface CanvasProps extends ViewProps {
5
13
  debug?: boolean;
6
14
  opaque?: boolean;
@@ -8,3 +16,4 @@ export interface CanvasProps extends ViewProps {
8
16
  mode?: "continuous" | "default";
9
17
  }
10
18
  export declare const Canvas: import("react").ForwardRefExoticComponent<CanvasProps & import("react").RefAttributes<unknown>>;
19
+ export {};
@@ -4,6 +4,7 @@ import { SkiaViewNativeId } from "../views/SkiaViewNativeId";
4
4
  import SkiaPictureViewNativeComponent from "../specs/SkiaPictureViewNativeComponent";
5
5
  import { SkiaSGRoot } from "../sksg/Reconciler";
6
6
  import { Skia } from "../skia";
7
+ export const useCanvasRef = () => useRef(null);
7
8
  const NativeSkiaPictureView = SkiaPictureViewNativeComponent;
8
9
 
9
10
  // TODO: no need to go through the JS thread for this
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","SkiaViewNativeId","SkiaPictureViewNativeComponent","SkiaSGRoot","Skia","NativeSkiaPictureView","useOnSizeEvent","resultValue","onLayout","event","width","height","nativeEvent","layout","value","Canvas","mode","debug","opaque","children","onSize","_onLayout","viewProps","ref","rafId","nativeId","current","root","render","unmount","requestRedraw","requestAnimationFrame","console","warn","cancelAnimationFrame","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","getNativeId","React","createElement","_extends","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport type { LayoutChangeEvent, ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\n// TODO: no need to go through the JS thread for this\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport interface CanvasProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n mode?: \"continuous\" | \"default\";\n}\n\nexport const Canvas = forwardRef(\n (\n {\n mode,\n debug,\n opaque,\n children,\n onSize,\n onLayout: _onLayout,\n ...viewProps\n }: CanvasProps,\n ref\n ) => {\n const rafId = useRef<number | null>(null);\n const onLayout = useOnSizeEvent(onSize, _onLayout);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n // Render effects\n useEffect(() => {\n root.render(children);\n }, [children, root]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n const requestRedraw = useCallback(() => {\n rafId.current = requestAnimationFrame(() => {\n root.render(children);\n if (mode === \"continuous\") {\n requestRedraw();\n }\n });\n }, [children, mode, root]);\n\n useEffect(() => {\n if (mode === \"continuous\") {\n console.warn(\"The `mode` property in `Canvas` is deprecated.\");\n requestRedraw();\n }\n return () => {\n if (rafId.current !== null) {\n cancelAnimationFrame(rafId.current);\n }\n };\n }, [mode, requestRedraw]);\n // Component methods\n useImperativeHandle(ref, () => ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n }));\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n onLayout={onLayout}\n {...viewProps}\n />\n );\n }\n);\n"],"mappings":";AAAA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AAId,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI,QAAQ,SAAS;AAG9B,MAAMC,qBAAqB,GAAGH,8BAA8B;;AAE5D;AACA,MAAMI,cAAc,GAAGA,CACrBC,WAAwC,EACxCC,QAA6C,KAC1C;EACH,OAAOZ,WAAW,CACfa,KAAwB,IAAK;IAC5B,IAAID,QAAQ,EAAE;MACZA,QAAQ,CAACC,KAAK,CAAC;IACjB;IACA,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGF,KAAK,CAACG,WAAW,CAACC,MAAM;IAElD,IAAIN,WAAW,EAAE;MACfA,WAAW,CAACO,KAAK,GAAG;QAAEJ,KAAK;QAAEC;MAAO,CAAC;IACvC;EACF,CAAC,EACD,CAACH,QAAQ,EAAED,WAAW,CACxB,CAAC;AACH,CAAC;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,CAAC;MAC9DH,aAAa,CAAC,CAAC;IACjB;IACA,OAAO,MAAM;MACX,IAAIN,KAAK,CAACE,OAAO,KAAK,IAAI,EAAE;QAC1BQ,oBAAoB,CAACV,KAAK,CAACE,OAAO,CAAC;MACrC;IACF,CAAC;EACH,CAAC,EAAE,CAACV,IAAI,EAAEc,aAAa,CAAC,CAAC;EACzB;EACAhC,mBAAmB,CAACyB,GAAG,EAAE,OAAO;IAC9BY,iBAAiB,EAAGC,IAAa,IAAK;MACpC,OAAOC,WAAW,CAACF,iBAAiB,CAACV,QAAQ,EAAEW,IAAI,CAAC;IACtD,CAAC;IACDE,sBAAsB,EAAGF,IAAa,IAAK;MACzC,OAAOC,WAAW,CAACC,sBAAsB,CAACb,QAAQ,EAAEW,IAAI,CAAC;IAC3D,CAAC;IACDG,MAAM,EAAEA,CAAA,KAAM;MACZF,WAAW,CAACP,aAAa,CAACL,QAAQ,CAAC;IACrC,CAAC;IACDe,WAAW,EAAEA,CAAA,KAAM;MACjB,OAAOf,QAAQ;IACjB;EACF,CAAC,CAAC,CAAC;EACH,oBACEgB,KAAA,CAAAC,aAAA,CAACrC,qBAAqB,EAAAsC,QAAA;IACpBC,WAAW,EAAE,KAAM;IACnBC,QAAQ,EAAE,GAAGpB,QAAQ,EAAG;IACxBR,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfV,QAAQ,EAAEA;EAAS,GACfc,SAAS,CACd,CAAC;AAEN,CACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","useCallback","useEffect","useImperativeHandle","useMemo","useRef","SkiaViewNativeId","SkiaPictureViewNativeComponent","SkiaSGRoot","Skia","useCanvasRef","NativeSkiaPictureView","useOnSizeEvent","resultValue","onLayout","event","width","height","nativeEvent","layout","value","Canvas","mode","debug","opaque","children","onSize","_onLayout","viewProps","ref","rafId","nativeId","current","root","render","unmount","requestRedraw","requestAnimationFrame","console","warn","cancelAnimationFrame","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","getNativeId","React","createElement","_extends","collapsable","nativeID"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\nimport type { LayoutChangeEvent, ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\n\ninterface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\nconst NativeSkiaPictureView = SkiaPictureViewNativeComponent;\n\n// TODO: no need to go through the JS thread for this\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport interface CanvasProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n mode?: \"continuous\" | \"default\";\n}\n\nexport const Canvas = forwardRef(\n (\n {\n mode,\n debug,\n opaque,\n children,\n onSize,\n onLayout: _onLayout,\n ...viewProps\n }: CanvasProps,\n ref\n ) => {\n const rafId = useRef<number | null>(null);\n const onLayout = useOnSizeEvent(onSize, _onLayout);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n // Render effects\n useEffect(() => {\n root.render(children);\n }, [children, root]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n const requestRedraw = useCallback(() => {\n rafId.current = requestAnimationFrame(() => {\n root.render(children);\n if (mode === \"continuous\") {\n requestRedraw();\n }\n });\n }, [children, mode, root]);\n\n useEffect(() => {\n if (mode === \"continuous\") {\n console.warn(\"The `mode` property in `Canvas` is deprecated.\");\n requestRedraw();\n }\n return () => {\n if (rafId.current !== null) {\n cancelAnimationFrame(rafId.current);\n }\n };\n }, [mode, requestRedraw]);\n // Component methods\n useImperativeHandle(ref, () => ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n }));\n return (\n <NativeSkiaPictureView\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n onLayout={onLayout}\n {...viewProps}\n />\n );\n }\n);\n"],"mappings":";AACA,SACEA,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AAId,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,8BAA8B,MAAM,yCAAyC;AAEpF,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,IAAI,QAAQ,SAAS;AAU9B,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAML,MAAM,CAAY,IAAI,CAAC;AAEzD,MAAMM,qBAAqB,GAAGJ,8BAA8B;;AAE5D;AACA,MAAMK,cAAc,GAAGA,CACrBC,WAAwC,EACxCC,QAA6C,KAC1C;EACH,OAAOb,WAAW,CACfc,KA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oreList":[]}
@@ -6,7 +6,9 @@ export declare abstract class Container {
6
6
  protected nativeId: number;
7
7
  root: Node[];
8
8
  protected recording: Recording | null;
9
+ protected unmounted: boolean;
9
10
  constructor(Skia: Skia, nativeId: number);
11
+ unmount(): void;
10
12
  drawOnCanvas(canvas: SkCanvas): void;
11
13
  abstract redraw(): void;
12
14
  }
@@ -46,6 +46,10 @@ export class Container {
46
46
  this.nativeId = nativeId;
47
47
  _defineProperty(this, "root", []);
48
48
  _defineProperty(this, "recording", null);
49
+ _defineProperty(this, "unmounted", false);
50
+ }
51
+ unmount() {
52
+ this.unmounted = true;
49
53
  }
50
54
  drawOnCanvas(canvas) {
51
55
  if (!this.recording) {
@@ -82,6 +86,9 @@ class ReanimatedContainer extends Container {
82
86
  if (this.mapperId !== null) {
83
87
  Rea.stopMapper(this.mapperId);
84
88
  }
89
+ if (this.unmounted) {
90
+ return;
91
+ }
85
92
  const recorder = new Recorder();
86
93
  visit(recorder, this.root);
87
94
  const record = recorder.getRecording();
@@ -120,6 +127,9 @@ class NativeReanimatedContainer extends Container {
120
127
  if (this.mapperId !== null) {
121
128
  Rea.stopMapper(this.mapperId);
122
129
  }
130
+ if (this.unmounted) {
131
+ return;
132
+ }
123
133
  const {
124
134
  nativeId,
125
135
  Skia
@@ -1 +1 @@
1
- {"version":3,"names":["Rea","HAS_REANIMATED_3","Platform","Recorder","visit","replay","createDrawingContext","ReanimatedRecorder","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","dispose","nativeDrawOnscreen","recorder","play","Container","constructor","_defineProperty","drawOnCanvas","Error","StaticContainer","redraw","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","NativeReanimatedContainer","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","native","OS"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\nimport { Platform } from \"../Platform\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nconst nativeDrawOnscreen = (\n Skia: Skia,\n nativeId: number,\n recorder: JsiRecorder\n) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n recorder.play(canvas);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nexport abstract class Container {\n public root: Node[] = [];\n protected recording: Recording | null = null;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(Skia, nativeId, sharedRecorder);\n }, sharedValues);\n }\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(Skia, nativeId, sharedRecorder);\n })();\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n const native = Platform.OS !== \"web\";\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (native) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new ReanimatedContainer(Skia, nativeId);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SAASC,gBAAgB,QAAQ,sCAAsC;AAEvE,SAASC,QAAQ,QAAQ,aAAa;AAItC,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE,MAAMC,YAAY,GAAGA,CAACC,IAAU,EAAEC,QAAgB,EAAEC,SAAoB,KAAK;EAC3E,SAAS;;EAET,MAAMC,GAAG,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC;EAClC,MAAMC,MAAM,GAAGF,GAAG,CAACG,cAAc,CAAC,CAAC;EACnC;;EAEA,MAAMC,GAAG,GAAGV,oBAAoB,CAACG,IAAI,EAAEE,SAAS,CAACM,SAAS,EAAEH,MAAM,CAAC;EACnET,MAAM,CAACW,GAAG,EAAEL,SAAS,CAACO,QAAQ,CAAC;EAC/B,MAAMC,OAAO,GAAGP,GAAG,CAACQ,wBAAwB,CAAC,CAAC;EAC9C;EACA;EACAC,WAAW,CAACC,cAAc,CAACZ,QAAQ,EAAE,SAAS,EAAES,OAAO,CAAC;EACxDP,GAAG,CAACW,OAAO,CAAC,CAAC;EACbJ,OAAO,CAACI,OAAO,CAAC,CAAC;AACnB,CAAC;AAED,MAAMC,kBAAkB,GAAGA,CACzBf,IAAU,EACVC,QAAgB,EAChBe,QAAqB,KAClB;EACH,SAAS;;EAET,MAAMb,GAAG,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC;EAClC,MAAMC,MAAM,GAAGF,GAAG,CAACG,cAAc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AQ,EAAEwC,cAAc,CAAC;IACpD,CAAC,CAAC,CAAC,CAAC;EACN;AACF;AAEA,OAAO,MAAMI,eAAe,GAAGA,CAAC7C,IAAU,EAAEC,QAAgB,KAAK;EAC/D,MAAM6C,MAAM,GAAGrD,QAAQ,CAACsD,EAAE,KAAK,KAAK;EACpC,IAAIvD,gBAAgB,IAAIS,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAI6C,MAAM,EAAE;MACV,OAAO,IAAIR,yBAAyB,CAACtC,IAAI,EAAEC,QAAQ,CAAC;IACtD,CAAC,MAAM;MACL,OAAO,IAAI2B,mBAAmB,CAAC5B,IAAI,EAAEC,QAAQ,CAAC;IAChD;EACF,CAAC,MAAM;IACL,OAAO,IAAIsB,eAAe,CAACvB,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Rea","HAS_REANIMATED_3","Platform","Recorder","visit","replay","createDrawingContext","ReanimatedRecorder","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","dispose","nativeDrawOnscreen","recorder","play","Container","constructor","_defineProperty","unmount","unmounted","drawOnCanvas","Error","StaticContainer","redraw","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","stopMapper","record","animationValues","size","startMapper","Array","from","runOnUI","NativeReanimatedContainer","sharedValues","getSharedValues","sharedRecorder","getRecorder","length","applyUpdates","createContainer","native","OS"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\nimport { Platform } from \"../Platform\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nconst nativeDrawOnscreen = (\n Skia: Skia,\n nativeId: number,\n recorder: JsiRecorder\n) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n //const start = performance.now();\n\n recorder.play(canvas);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nexport abstract class Container {\n public root: Node[] = [];\n protected recording: Recording | null = null;\n protected unmounted = false;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n unmount() {\n this.unmounted = true;\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n const { nativeId, Skia, recording } = this;\n if (animationValues.size > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n Rea.runOnUI(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n })();\n }\n}\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n if (this.unmounted) {\n return;\n }\n const { nativeId, Skia } = this;\n const recorder = new ReanimatedRecorder(Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(Skia, nativeId, sharedRecorder);\n }, sharedValues);\n }\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(Skia, nativeId, sharedRecorder);\n })();\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n const native = Platform.OS !== \"web\";\n if (HAS_REANIMATED_3 && nativeId !== -1) {\n if (native) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n return new ReanimatedContainer(Skia, nativeId);\n }\n } else {\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],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,IAAI,EAAEC,QAAQ,EAAE0C,cAAc,CAAC;IACpD,CAAC,CAAC,CAAC,CAAC;EACN;AACF;AAEA,OAAO,MAAMI,eAAe,GAAGA,CAAC/C,IAAU,EAAEC,QAAgB,KAAK;EAC/D,MAAM+C,MAAM,GAAGvD,QAAQ,CAACwD,EAAE,KAAK,KAAK;EACpC,IAAIzD,gBAAgB,IAAIS,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,IAAI+C,MAAM,EAAE;MACV,OAAO,IAAIR,yBAAyB,CAACxC,IAAI,EAAEC,QAAQ,CAAC;IACtD,CAAC,MAAM;MACL,OAAO,IAAI6B,mBAAmB,CAAC9B,IAAI,EAAEC,QAAQ,CAAC;IAChD;EACF,CAAC,MAAM;IACL,OAAO,IAAIwB,eAAe,CAACzB,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ import type { FractalNoiseProps, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps, ParagraphProps, AtlasProps, ChildrenProps, MorphologyImageFilterProps, BlendProps } from "../dom/types";
2
+ import type { SkiaProps } from "../renderer";
3
+ declare global {
4
+ namespace JSX {
5
+ interface IntrinsicElements {
6
+ skGroup: SkiaProps<GroupProps>;
7
+ skLayer: SkiaProps<ChildrenProps>;
8
+ skPaint: SkiaProps<PaintProps>;
9
+ skFill: SkiaProps<DrawingNodeProps>;
10
+ skImage: SkiaProps<ImageProps>;
11
+ skCircle: SkiaProps<CircleProps>;
12
+ skPath: SkiaProps<PathProps>;
13
+ skLine: SkiaProps<LineProps>;
14
+ skOval: SkiaProps<OvalProps>;
15
+ skPatch: SkiaProps<PatchProps>;
16
+ skPoints: SkiaProps<PointsProps>;
17
+ skRect: SkiaProps<RectProps>;
18
+ skRRect: SkiaProps<RoundedRectProps>;
19
+ skAtlas: SkiaProps<AtlasProps>;
20
+ skVertices: SkiaProps<VerticesProps>;
21
+ skText: SkiaProps<TextProps>;
22
+ skTextPath: SkiaProps<TextPathProps>;
23
+ skTextBlob: SkiaProps<TextBlobProps>;
24
+ skGlyphs: SkiaProps<GlyphsProps>;
25
+ skDiffRect: SkiaProps<DiffRectProps>;
26
+ skPicture: SkiaProps<PictureProps>;
27
+ skImageSVG: SkiaProps<ImageSVGProps>;
28
+ skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;
29
+ skBlendImageFilter: SkiaProps<BlendImageFilterProps>;
30
+ skBlurImageFilter: SkiaProps<BlurImageFilterProps>;
31
+ skOffsetImageFilter: SkiaProps<OffsetImageFilterProps>;
32
+ skDropShadowImageFilter: SkiaProps<DropShadowImageFilterProps>;
33
+ skDisplacementMapImageFilter: SkiaProps<DisplacementMapImageFilterProps>;
34
+ skRuntimeShaderImageFilter: SkiaProps<RuntimeShaderImageFilterProps>;
35
+ skMorphologyImageFilter: SkiaProps<MorphologyImageFilterProps>;
36
+ skMatrixColorFilter: SkiaProps<MatrixColorFilterProps>;
37
+ skBlendColorFilter: SkiaProps<BlendColorFilterProps>;
38
+ skLinearToSRGBGammaColorFilter: SkiaProps<ChildrenProps>;
39
+ skSRGBToLinearGammaColorFilter: SkiaProps<ChildrenProps>;
40
+ skLumaColorFilter: SkiaProps<ChildrenProps>;
41
+ skLerpColorFilter: SkiaProps<LerpColorFilterProps>;
42
+ skShader: SkiaProps<ShaderProps>;
43
+ skImageShader: SkiaProps<ImageShaderProps>;
44
+ skColorShader: SkiaProps<ColorProps>;
45
+ skTurbulence: SkiaProps<TurbulenceProps>;
46
+ skFractalNoise: SkiaProps<FractalNoiseProps>;
47
+ skLinearGradient: SkiaProps<LinearGradientProps>;
48
+ skRadialGradient: SkiaProps<RadialGradientProps>;
49
+ skSweepGradient: SkiaProps<SweepGradientProps>;
50
+ skTwoPointConicalGradient: SkiaProps<TwoPointConicalGradientProps>;
51
+ skDiscretePathEffect: SkiaProps<DiscretePathEffectProps>;
52
+ skDashPathEffect: SkiaProps<DashPathEffectProps>;
53
+ skPath1DPathEffect: SkiaProps<Path1DPathEffectProps>;
54
+ skPath2DPathEffect: SkiaProps<Path2DPathEffectProps>;
55
+ skCornerPathEffect: SkiaProps<CornerPathEffectProps>;
56
+ skSumPathEffect: ChildrenProps;
57
+ skLine2DPathEffect: SkiaProps<Line2DPathEffectProps>;
58
+ skBlend: SkiaProps<BlendProps>;
59
+ skBackdropFilter: SkiaProps<ChildrenProps>;
60
+ skBox: SkiaProps<BoxProps>;
61
+ skBoxShadow: SkiaProps<BoxShadowProps>;
62
+ skParagraph: SkiaProps<ParagraphProps>;
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Elements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["Elements.tsx"],"sourcesContent":["import type {\n FractalNoiseProps,\n CircleProps,\n DrawingNodeProps,\n ImageProps,\n PaintProps,\n PathProps,\n LineProps,\n OvalProps,\n DiffRectProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextProps,\n VerticesProps,\n BlurMaskFilterProps,\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n MatrixColorFilterProps,\n ShaderProps,\n ImageShaderProps,\n LinearGradientProps,\n GroupProps,\n PatchProps,\n BlendColorFilterProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n CornerPathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n BoxProps,\n BoxShadowProps,\n ParagraphProps,\n AtlasProps,\n ChildrenProps,\n MorphologyImageFilterProps,\n BlendProps,\n} from \"../dom/types\";\nimport type { SkiaProps } from \"../renderer\";\n\ndeclare global {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n skGroup: SkiaProps<GroupProps>;\n skLayer: SkiaProps<ChildrenProps>;\n skPaint: SkiaProps<PaintProps>;\n\n // Drawings\n skFill: SkiaProps<DrawingNodeProps>;\n skImage: SkiaProps<ImageProps>;\n skCircle: SkiaProps<CircleProps>;\n skPath: SkiaProps<PathProps>;\n skLine: SkiaProps<LineProps>;\n skOval: SkiaProps<OvalProps>;\n skPatch: SkiaProps<PatchProps>;\n skPoints: SkiaProps<PointsProps>;\n skRect: SkiaProps<RectProps>;\n skRRect: SkiaProps<RoundedRectProps>;\n skAtlas: SkiaProps<AtlasProps>;\n skVertices: SkiaProps<VerticesProps>;\n skText: SkiaProps<TextProps>;\n skTextPath: SkiaProps<TextPathProps>;\n skTextBlob: SkiaProps<TextBlobProps>;\n skGlyphs: SkiaProps<GlyphsProps>;\n skDiffRect: SkiaProps<DiffRectProps>;\n skPicture: SkiaProps<PictureProps>;\n skImageSVG: SkiaProps<ImageSVGProps>;\n\n // BlurMaskFilters\n skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;\n\n // ImageFilters\n skBlendImageFilter: SkiaProps<BlendImageFilterProps>;\n skBlurImageFilter: SkiaProps<BlurImageFilterProps>;\n skOffsetImageFilter: SkiaProps<OffsetImageFilterProps>;\n skDropShadowImageFilter: SkiaProps<DropShadowImageFilterProps>;\n skDisplacementMapImageFilter: SkiaProps<DisplacementMapImageFilterProps>;\n skRuntimeShaderImageFilter: SkiaProps<RuntimeShaderImageFilterProps>;\n skMorphologyImageFilter: SkiaProps<MorphologyImageFilterProps>;\n\n // ColorFilters\n skMatrixColorFilter: SkiaProps<MatrixColorFilterProps>;\n skBlendColorFilter: SkiaProps<BlendColorFilterProps>;\n skLinearToSRGBGammaColorFilter: SkiaProps<ChildrenProps>;\n skSRGBToLinearGammaColorFilter: SkiaProps<ChildrenProps>;\n skLumaColorFilter: SkiaProps<ChildrenProps>;\n skLerpColorFilter: SkiaProps<LerpColorFilterProps>;\n\n // Shaders\n skShader: SkiaProps<ShaderProps>;\n skImageShader: SkiaProps<ImageShaderProps>;\n skColorShader: SkiaProps<ColorProps>;\n skTurbulence: SkiaProps<TurbulenceProps>;\n skFractalNoise: SkiaProps<FractalNoiseProps>;\n skLinearGradient: SkiaProps<LinearGradientProps>;\n skRadialGradient: SkiaProps<RadialGradientProps>;\n skSweepGradient: SkiaProps<SweepGradientProps>;\n skTwoPointConicalGradient: SkiaProps<TwoPointConicalGradientProps>;\n\n // Path Effects\n skDiscretePathEffect: SkiaProps<DiscretePathEffectProps>;\n skDashPathEffect: SkiaProps<DashPathEffectProps>;\n skPath1DPathEffect: SkiaProps<Path1DPathEffectProps>;\n skPath2DPathEffect: SkiaProps<Path2DPathEffectProps>;\n skCornerPathEffect: SkiaProps<CornerPathEffectProps>;\n skSumPathEffect: ChildrenProps;\n skLine2DPathEffect: SkiaProps<Line2DPathEffectProps>;\n\n // Mixed declarations/drawings\n skBlend: SkiaProps<BlendProps>;\n skBackdropFilter: SkiaProps<ChildrenProps>;\n skBox: SkiaProps<BoxProps>;\n skBoxShadow: SkiaProps<BoxShadowProps>;\n\n // Paragraph\n skParagraph: SkiaProps<ParagraphProps>;\n }\n }\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { SkCanvas, Skia } from "../skia/types";
3
3
  import { NodeType } from "../dom/types";
4
+ import "./Elements";
4
5
  export declare class SkiaSGRoot {
5
6
  Skia: Skia;
6
7
  private root;
@@ -5,6 +5,7 @@ import ReactReconciler from "react-reconciler";
5
5
  import { NodeType } from "../dom/types";
6
6
  import { debug, sksgHostConfig } from "./HostConfig";
7
7
  import { createContainer } from "./Container";
8
+ import "./Elements";
8
9
  const skiaReconciler = ReactReconciler(sksgHostConfig);
9
10
  skiaReconciler.injectIntoDevTools({
10
11
  bundleType: 1,
@@ -44,6 +45,7 @@ export class SkiaSGRoot {
44
45
  return recorder.finishRecordingAsPicture();
45
46
  }
46
47
  unmount() {
48
+ this.container.unmount();
47
49
  skiaReconciler.updateContainer(null, this.root, null, () => {
48
50
  debug("unmountContainer");
49
51
  });
@@ -1 +1 @@
1
- {"version":3,"names":["ReactReconciler","NodeType","debug","sksgHostConfig","createContainer","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","_defineProperty","container","root","console","error","sg","children","type","Group","props","isDeclaration","render","element","updateContainer","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n debug(\"updateContainer\");\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n });\n }\n}\n"],"mappings":";;;AAEA,OAAOA,eAAe,MAAM,kBAAkB;AAG9C,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,KAAK,EAAEC,cAAc,QAAQ,cAAc;AAEpD,SAASC,eAAe,QAAQ,aAAa;AAE7C,MAAMC,cAAc,GAAGL,eAAe,CAACG,cAAc,CAAC;AAEtDE,cAAc,CAACC,kBAAkB,CAAC;EAChCC,UAAU,EAAE,CAAC;EACbC,OAAO,EAAE,OAAO;EAChBC,mBAAmB,EAAE;AACvB,CAAC,CAAC;AAEF,OAAO,MAAMC,UAAU,CAAC;EAItBC,WAAWA,CAAQC,IAAU,EAAEC,QAAQ,GAAG,CAAC,CAAC,EAAE;IAAA,KAA3BD,IAAU,GAAVA,IAAU;IAAAE,eAAA;IAAAA,eAAA;IAC3B,IAAI,CAACC,SAAS,GAAGX,eAAe,CAACQ,IAAI,EAAEC,QAAQ,CAAC;IAChD,IAAI,CAACG,IAAI,GAAGX,cAAc,CAACD,eAAe,CACxC,IAAI,CAACW,SAAS,EACd,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,EAAE,EACFE,OAAO,CAACC,KAAK,EACb,IACF,CAAC;EACH;EAEA,IAAIC,EAAEA,CAAA,EAAG;IACP,MAAMC,QAAQ,GAAG,IAAI,CAACL,SAAS,CAACC,IAAI;IACpC,OAAO;MAAEK,IAAI,EAAEpB,QAAQ,CAACqB,KAAK;MAAEC,KAAK,EAAE,CAAC,CAAC;MAAEH,QAAQ;MAAEI,aAAa,EAAE;IAAM,CAAC;EAC5E;EAEAC,MAAMA,CAACC,OAAkB,EAAE;IACzB;IACArB,cAAc,CAACsB,eAAe,CAACD,OAAO,EAAS,IAAI,CAACV,IAAI,EAAE,IAAI,EAAE,MAAM;MACpEd,KAAK,CAAC,iBAAiB,CAAC;IAC1B,CAAC,CAAC;EACJ;EAEA0B,YAAYA,CAACC,MAAgB,EAAE;IAC7B,IAAI,CAACd,SAAS,CAACa,YAAY,CAACC,MAAM,CAAC;EACrC;EAEAC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACnB,IAAI,CAACoB,eAAe,CAAC,CAAC;IAC5C,MAAMH,MAAM,GAAGE,QAAQ,CAACE,cAAc,CAAC,CAAC;IACxC,IAAI,CAACL,YAAY,CAACC,MAAM,CAAC;IACzB,OAAOE,QAAQ,CAACG,wBAAwB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACR9B,cAAc,CAACsB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACX,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1Dd,KAAK,CAAC,kBAAkB,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"names":["ReactReconciler","NodeType","debug","sksgHostConfig","createContainer","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","_defineProperty","container","root","console","error","sg","children","type","Group","props","isDeclaration","render","element","updateContainer","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\nimport \"./Elements\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n debug(\"updateContainer\");\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmount();\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n });\n }\n}\n"],"mappings":";;;AAEA,OAAOA,eAAe,MAAM,kBAAkB;AAG9C,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,KAAK,EAAEC,cAAc,QAAQ,cAAc;AAEpD,SAASC,eAAe,QAAQ,aAAa;AAC7C,OAAO,YAAY;AAEnB,MAAMC,cAAc,GAAGL,eAAe,CAACG,cAAc,CAAC;AAEtDE,cAAc,CAACC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,CAACG,wBAAwB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAACpB,SAAS,CAACoB,OAAO,CAAC,CAAC;IACxB9B,cAAc,CAACsB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACX,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1Dd,KAAK,CAAC,kBAAkB,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -1,3 +1,2 @@
1
1
  export * from "./SkiaPictureView";
2
- export * from "./SkiaDomView";
3
2
  export * from "./types";
@@ -1,4 +1,3 @@
1
1
  export * from "./SkiaPictureView";
2
- export * from "./SkiaDomView";
3
2
  export * from "./types";
4
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./SkiaDomView\";\nexport * from \"./types\";\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,SAAS","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./types\";\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,SAAS","ignoreList":[]}
@@ -1,5 +1,2 @@
1
1
  export const __esModule: boolean;
2
2
  export const HAS_REANIMATED_3: any;
3
- export function bindReanimatedProps(container: any, node: any, reanimatedProps: any): void;
4
- export function extractReanimatedProps(props: any): any[];
5
- export function unbindReanimatedNode(node: any): void;
@@ -1,3 +1,4 @@
1
1
  export const __esModule: boolean;
2
2
  export const Canvas: _react.ForwardRefExoticComponent<_react.RefAttributes<any>>;
3
+ export function useCanvasRef(): _react.MutableRefObject<null>;
3
4
  import _react = require("react");
@@ -3,6 +3,8 @@ export class Container {
3
3
  constructor(Skia: any, nativeId: any);
4
4
  Skia: any;
5
5
  nativeId: any;
6
+ unmount(): void;
7
+ unmounted: boolean | undefined;
6
8
  drawOnCanvas(canvas: any): void;
7
9
  }
8
10
  export function createContainer(Skia: any, nativeId: any): NativeReanimatedContainer | ReanimatedContainer | StaticContainer;
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -7,6 +7,8 @@ export class SkiaSGRoot {
7
7
  mapperId: any;
8
8
  Skia: any;
9
9
  nativeId: any;
10
+ unmount(): void;
11
+ unmounted: boolean | undefined;
10
12
  drawOnCanvas(canvas: any): void;
11
13
  } | {
12
14
  redraw(): void;
@@ -17,6 +19,8 @@ export class SkiaSGRoot {
17
19
  mapperId: any;
18
20
  Skia: any;
19
21
  nativeId: any;
22
+ unmount(): void;
23
+ unmounted: boolean | undefined;
20
24
  drawOnCanvas(canvas: any): void;
21
25
  } | {
22
26
  redraw(): void;
@@ -27,6 +31,8 @@ export class SkiaSGRoot {
27
31
  } | undefined;
28
32
  Skia: any;
29
33
  nativeId: any;
34
+ unmount(): void;
35
+ unmounted: boolean | undefined;
30
36
  drawOnCanvas(canvas: any): void;
31
37
  };
32
38
  root: any;
@@ -1,3 +1,2 @@
1
1
  export * from "../types";
2
- export * from "./JsiSkDOM";
3
2
  export * from "./datatypes";
@@ -1,4 +1 @@
1
- export function extractReanimatedProps(props: any): any[];
2
- export function bindReanimatedProps(container: any, node: any, reanimatedProps: any): void;
3
1
  export let HAS_REANIMATED_3: boolean;
4
- export function unbindReanimatedNode(node: any): void;
@@ -1,6 +1,5 @@
1
1
  export { JsiSkImage } from "./skia/web/JsiSkImage";
2
2
  export * from "./renderer";
3
- export * from "./renderer/CanvasOld";
4
3
  export * from "./renderer/Canvas";
5
4
  export * from "./renderer/Offscreen";
6
5
  export * from "./views";
@@ -58,7 +58,6 @@ export function Mock(CanvasKit: any): {
58
58
  useSVG: () => null;
59
59
  useVideo: () => null;
60
60
  NodeType: {};
61
- JsiSkDOM: typeof import("../dom/nodes").JsiSkDOM;
62
61
  enumKey: (k: any) => any;
63
62
  processPath: (Skia: any, rawPath: any) => any;
64
63
  isPathDef: (def: any) => boolean;
@@ -1 +1,2 @@
1
+ export function useCanvasRef(): import("react").MutableRefObject<null>;
1
2
  export const Canvas: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
@@ -2,6 +2,8 @@ export class Container {
2
2
  constructor(Skia: any, nativeId: any);
3
3
  Skia: any;
4
4
  nativeId: any;
5
+ unmount(): void;
6
+ unmounted: boolean | undefined;
5
7
  drawOnCanvas(canvas: any): void;
6
8
  }
7
9
  export function createContainer(Skia: any, nativeId: any): StaticContainer | ReanimatedContainer | NativeReanimatedContainer;
@@ -0,0 +1 @@
1
+ export {};
@@ -10,6 +10,8 @@ export class SkiaSGRoot {
10
10
  } | undefined;
11
11
  Skia: any;
12
12
  nativeId: any;
13
+ unmount(): void;
14
+ unmounted: boolean | undefined;
13
15
  drawOnCanvas(canvas: any): void;
14
16
  } | {
15
17
  redraw(): void;
@@ -20,12 +22,16 @@ export class SkiaSGRoot {
20
22
  mapperId: any;
21
23
  Skia: any;
22
24
  nativeId: any;
25
+ unmount(): void;
26
+ unmounted: boolean | undefined;
23
27
  drawOnCanvas(canvas: any): void;
24
28
  } | {
25
29
  redraw(): void;
26
30
  mapperId: any;
27
31
  Skia: any;
28
32
  nativeId: any;
33
+ unmount(): void;
34
+ unmounted: boolean | undefined;
29
35
  drawOnCanvas(canvas: any): void;
30
36
  };
31
37
  root: any;
@@ -1,3 +1,2 @@
1
1
  export * from "./SkiaPictureView";
2
- export * from "./SkiaDomView";
3
2
  export * from "./types";
@@ -1,3 +1,2 @@
1
1
  export * from "../types";
2
- export * from "./JsiSkDOM";
3
2
  export * from "./datatypes";
@@ -1,7 +1 @@
1
- import type { Container } from "../../renderer/Container";
2
- import type { AnimatedProps } from "../../renderer/processors";
3
- import type { Node } from "../../dom/types";
4
1
  export declare let HAS_REANIMATED_3: boolean;
5
- export declare const unbindReanimatedNode: (node: Node<unknown>) => void;
6
- export declare function extractReanimatedProps(props: AnimatedProps<any>): AnimatedProps<any, never>[];
7
- export declare function bindReanimatedProps(container: Container, node: Node<any>, reanimatedProps: AnimatedProps<any>): void;
@@ -1,7 +1,6 @@
1
1
  import "./skia/NativeSetup";
2
2
  export { JsiSkImage } from "./skia/web/JsiSkImage";
3
3
  export * from "./renderer";
4
- export * from "./renderer/CanvasOld";
5
4
  export * from "./renderer/Canvas";
6
5
  export * from "./renderer/Offscreen";
7
6
  export * from "./views";
@@ -1,6 +1,14 @@
1
+ import type { FC } from "react";
1
2
  import type { ViewProps } from "react-native";
2
3
  import type { SharedValue } from "react-native-reanimated";
3
- import type { SkSize } from "../skia/types";
4
+ import type { SkImage, SkRect, SkSize } from "../skia/types";
5
+ interface CanvasRef extends FC<CanvasProps> {
6
+ makeImageSnapshot(rect?: SkRect): SkImage;
7
+ makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;
8
+ redraw(): void;
9
+ getNativeId(): number;
10
+ }
11
+ export declare const useCanvasRef: () => import("react").RefObject<CanvasRef>;
4
12
  export interface CanvasProps extends ViewProps {
5
13
  debug?: boolean;
6
14
  opaque?: boolean;
@@ -8,3 +16,4 @@ export interface CanvasProps extends ViewProps {
8
16
  mode?: "continuous" | "default";
9
17
  }
10
18
  export declare const Canvas: import("react").ForwardRefExoticComponent<CanvasProps & import("react").RefAttributes<unknown>>;
19
+ export {};
@@ -6,7 +6,9 @@ export declare abstract class Container {
6
6
  protected nativeId: number;
7
7
  root: Node[];
8
8
  protected recording: Recording | null;
9
+ protected unmounted: boolean;
9
10
  constructor(Skia: Skia, nativeId: number);
11
+ unmount(): void;
10
12
  drawOnCanvas(canvas: SkCanvas): void;
11
13
  abstract redraw(): void;
12
14
  }