@shopify/react-native-skia 1.7.5 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (384) hide show
  1. package/android/cpp/rnskia-android/OpenGLWindowContext.h +8 -1
  2. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
  3. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  4. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +13 -0
  5. package/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +24 -1
  6. package/cpp/rnskia/RNSkJsiViewApi.h +0 -3
  7. package/cpp/rnskia/RNSkView.h +6 -6
  8. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +2 -2
  9. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +2 -2
  10. package/lib/commonjs/dom/nodes/JsiSkDOM.js +2 -2
  11. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  12. package/lib/commonjs/dom/nodes/datatypes/Circle.d.ts +2 -3
  13. package/lib/commonjs/dom/nodes/datatypes/Circle.js +11 -6
  14. package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
  15. package/lib/commonjs/dom/nodes/datatypes/Enum.js +1 -0
  16. package/lib/commonjs/dom/nodes/datatypes/Enum.js.map +1 -1
  17. package/lib/commonjs/dom/nodes/datatypes/Fitting.js +1 -10
  18. package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
  19. package/lib/commonjs/dom/nodes/datatypes/Gradient.js +3 -2
  20. package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
  21. package/lib/commonjs/dom/nodes/datatypes/Path.js +4 -1
  22. package/lib/commonjs/dom/nodes/datatypes/Path.js.map +1 -1
  23. package/lib/commonjs/dom/nodes/datatypes/Radius.js +1 -0
  24. package/lib/commonjs/dom/nodes/datatypes/Radius.js.map +1 -1
  25. package/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +3 -1
  26. package/lib/commonjs/dom/nodes/datatypes/Rect.js +17 -7
  27. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  28. package/lib/commonjs/dom/nodes/datatypes/Transform.d.ts +2 -1
  29. package/lib/commonjs/dom/nodes/datatypes/Transform.js +32 -1
  30. package/lib/commonjs/dom/nodes/datatypes/Transform.js.map +1 -1
  31. package/lib/commonjs/dom/nodes/drawings/Box.js +4 -5
  32. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  33. package/lib/commonjs/dom/nodes/drawings/CircleNode.js +1 -1
  34. package/lib/commonjs/dom/nodes/drawings/CircleNode.js.map +1 -1
  35. package/lib/commonjs/dom/types/DeclarationContext.d.ts +4 -4
  36. package/lib/commonjs/dom/types/DeclarationContext.js +8 -2
  37. package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -1
  38. package/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
  39. package/lib/commonjs/external/reanimated/renderHelpers.js +11 -6
  40. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  41. package/lib/commonjs/renderer/HostConfig.js +8 -4
  42. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  43. package/lib/commonjs/renderer/__tests__/setup.d.ts +2 -3
  44. package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +1 -2
  45. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  46. package/lib/commonjs/renderer/typeddash.js +5 -1
  47. package/lib/commonjs/renderer/typeddash.js.map +1 -1
  48. package/lib/commonjs/skia/__tests__/setup.d.ts +0 -3
  49. package/lib/commonjs/skia/types/Path/Path.js +5 -1
  50. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  51. package/lib/commonjs/skia/types/RRect.d.ts +1 -1
  52. package/lib/commonjs/skia/types/RRect.js +7 -3
  53. package/lib/commonjs/skia/types/RRect.js.map +1 -1
  54. package/lib/commonjs/skia/types/Shader/Shader.js +8 -6
  55. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  56. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +1 -1
  57. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
  58. package/lib/commonjs/sksg/Container.d.ts +19 -0
  59. package/lib/commonjs/sksg/Container.js +102 -0
  60. package/lib/commonjs/sksg/Container.js.map +1 -0
  61. package/lib/commonjs/sksg/DrawingContext.d.ts +16 -0
  62. package/lib/commonjs/sksg/DrawingContext.js +186 -0
  63. package/lib/commonjs/sksg/DrawingContext.js.map +1 -0
  64. package/lib/commonjs/sksg/HostConfig.d.ts +19 -0
  65. package/lib/commonjs/sksg/HostConfig.js +168 -0
  66. package/lib/commonjs/sksg/HostConfig.js.map +1 -0
  67. package/lib/commonjs/sksg/Reconciler.d.ts +17 -0
  68. package/lib/commonjs/sksg/Reconciler.js +54 -0
  69. package/lib/commonjs/sksg/Reconciler.js.map +1 -0
  70. package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +57 -0
  71. package/lib/commonjs/sksg/nodes/Node.d.ts +7 -0
  72. package/lib/commonjs/sksg/nodes/Node.js +6 -0
  73. package/lib/commonjs/sksg/nodes/Node.js.map +1 -0
  74. package/lib/commonjs/sksg/nodes/colorFilters.d.ts +7 -0
  75. package/lib/commonjs/sksg/nodes/colorFilters.js +55 -0
  76. package/lib/commonjs/sksg/nodes/colorFilters.js.map +1 -0
  77. package/lib/commonjs/sksg/nodes/context.d.ts +3 -0
  78. package/lib/commonjs/sksg/nodes/context.js +448 -0
  79. package/lib/commonjs/sksg/nodes/context.js.map +1 -0
  80. package/lib/commonjs/sksg/nodes/drawings.d.ts +31 -0
  81. package/lib/commonjs/sksg/nodes/drawings.js +361 -0
  82. package/lib/commonjs/sksg/nodes/drawings.js.map +1 -0
  83. package/lib/commonjs/sksg/nodes/imageFilters.d.ts +14 -0
  84. package/lib/commonjs/sksg/nodes/imageFilters.js +135 -0
  85. package/lib/commonjs/sksg/nodes/imageFilters.js.map +1 -0
  86. package/lib/commonjs/sksg/nodes/index.d.ts +3 -0
  87. package/lib/commonjs/sksg/nodes/index.js +39 -0
  88. package/lib/commonjs/sksg/nodes/index.js.map +1 -0
  89. package/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
  90. package/lib/commonjs/sksg/nodes/paint.js +80 -0
  91. package/lib/commonjs/sksg/nodes/paint.js.map +1 -0
  92. package/lib/commonjs/sksg/nodes/pathEffects.d.ts +8 -0
  93. package/lib/commonjs/sksg/nodes/pathEffects.js +84 -0
  94. package/lib/commonjs/sksg/nodes/pathEffects.js.map +1 -0
  95. package/lib/commonjs/sksg/nodes/shaders.d.ts +10 -0
  96. package/lib/commonjs/sksg/nodes/shaders.js +156 -0
  97. package/lib/commonjs/sksg/nodes/shaders.js.map +1 -0
  98. package/lib/commonjs/sksg/nodes/utils.d.ts +3 -0
  99. package/lib/commonjs/sksg/nodes/utils.js +25 -0
  100. package/lib/commonjs/sksg/nodes/utils.js.map +1 -0
  101. package/lib/commonjs/views/SkiaDomView.js +3 -1
  102. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  103. package/lib/commonjs/views/SkiaPictureView.js +0 -2
  104. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  105. package/lib/commonjs/views/types.d.ts +2 -2
  106. package/lib/commonjs/views/types.js.map +1 -1
  107. package/lib/module/dom/nodes/JsiSkDOM.js +2 -2
  108. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  109. package/lib/module/dom/nodes/datatypes/Circle.d.ts +2 -3
  110. package/lib/module/dom/nodes/datatypes/Circle.js +12 -6
  111. package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
  112. package/lib/module/dom/nodes/datatypes/Enum.js +2 -0
  113. package/lib/module/dom/nodes/datatypes/Enum.js.map +1 -1
  114. package/lib/module/dom/nodes/datatypes/Fitting.js +2 -10
  115. package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
  116. package/lib/module/dom/nodes/datatypes/Gradient.js +4 -2
  117. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  118. package/lib/module/dom/nodes/datatypes/Path.js +5 -1
  119. package/lib/module/dom/nodes/datatypes/Path.js.map +1 -1
  120. package/lib/module/dom/nodes/datatypes/Radius.js +2 -0
  121. package/lib/module/dom/nodes/datatypes/Radius.js.map +1 -1
  122. package/lib/module/dom/nodes/datatypes/Rect.d.ts +3 -1
  123. package/lib/module/dom/nodes/datatypes/Rect.js +14 -5
  124. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  125. package/lib/module/dom/nodes/datatypes/Transform.d.ts +2 -1
  126. package/lib/module/dom/nodes/datatypes/Transform.js +31 -0
  127. package/lib/module/dom/nodes/datatypes/Transform.js.map +1 -1
  128. package/lib/module/dom/nodes/drawings/Box.js +1 -2
  129. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  130. package/lib/module/dom/nodes/drawings/CircleNode.js +1 -1
  131. package/lib/module/dom/nodes/drawings/CircleNode.js.map +1 -1
  132. package/lib/module/dom/types/DeclarationContext.d.ts +4 -4
  133. package/lib/module/dom/types/DeclarationContext.js +9 -2
  134. package/lib/module/dom/types/DeclarationContext.js.map +1 -1
  135. package/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
  136. package/lib/module/external/reanimated/renderHelpers.js +8 -4
  137. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  138. package/lib/module/renderer/HostConfig.js +8 -4
  139. package/lib/module/renderer/HostConfig.js.map +1 -1
  140. package/lib/module/renderer/__tests__/setup.d.ts +2 -3
  141. package/lib/module/renderer/processors/Animations/Animations.d.ts +1 -2
  142. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  143. package/lib/module/renderer/typeddash.js +5 -1
  144. package/lib/module/renderer/typeddash.js.map +1 -1
  145. package/lib/module/skia/__tests__/setup.d.ts +0 -3
  146. package/lib/module/skia/types/Path/Path.js +5 -1
  147. package/lib/module/skia/types/Path/Path.js.map +1 -1
  148. package/lib/module/skia/types/RRect.d.ts +1 -1
  149. package/lib/module/skia/types/RRect.js +7 -3
  150. package/lib/module/skia/types/RRect.js.map +1 -1
  151. package/lib/module/skia/types/Shader/Shader.js +9 -6
  152. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  153. package/lib/module/skia/web/JsiSkParagraphStyle.js +1 -1
  154. package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
  155. package/lib/module/sksg/Container.d.ts +19 -0
  156. package/lib/module/sksg/Container.js +94 -0
  157. package/lib/module/sksg/Container.js.map +1 -0
  158. package/lib/module/sksg/DrawingContext.d.ts +16 -0
  159. package/lib/module/sksg/DrawingContext.js +180 -0
  160. package/lib/module/sksg/DrawingContext.js.map +1 -0
  161. package/lib/module/sksg/HostConfig.d.ts +19 -0
  162. package/lib/module/sksg/HostConfig.js +161 -0
  163. package/lib/module/sksg/HostConfig.js.map +1 -0
  164. package/lib/module/sksg/Reconciler.d.ts +17 -0
  165. package/lib/module/sksg/Reconciler.js +46 -0
  166. package/lib/module/sksg/Reconciler.js.map +1 -0
  167. package/lib/module/sksg/__tests__/MockDeclaration.d.ts +57 -0
  168. package/lib/module/sksg/nodes/Node.d.ts +7 -0
  169. package/lib/module/sksg/nodes/Node.js +2 -0
  170. package/lib/module/sksg/nodes/Node.js.map +1 -0
  171. package/lib/module/sksg/nodes/colorFilters.d.ts +7 -0
  172. package/lib/module/sksg/nodes/colorFilters.js +44 -0
  173. package/lib/module/sksg/nodes/colorFilters.js.map +1 -0
  174. package/lib/module/sksg/nodes/context.d.ts +3 -0
  175. package/lib/module/sksg/nodes/context.js +443 -0
  176. package/lib/module/sksg/nodes/context.js.map +1 -0
  177. package/lib/module/sksg/nodes/drawings.d.ts +31 -0
  178. package/lib/module/sksg/nodes/drawings.js +334 -0
  179. package/lib/module/sksg/nodes/drawings.js.map +1 -0
  180. package/lib/module/sksg/nodes/imageFilters.d.ts +14 -0
  181. package/lib/module/sksg/nodes/imageFilters.js +122 -0
  182. package/lib/module/sksg/nodes/imageFilters.js.map +1 -0
  183. package/lib/module/sksg/nodes/index.d.ts +3 -0
  184. package/lib/module/sksg/nodes/index.js +4 -0
  185. package/lib/module/sksg/nodes/index.js.map +1 -0
  186. package/lib/module/sksg/nodes/paint.d.ts +2 -0
  187. package/lib/module/sksg/nodes/paint.js +74 -0
  188. package/lib/module/sksg/nodes/paint.js.map +1 -0
  189. package/lib/module/sksg/nodes/pathEffects.d.ts +8 -0
  190. package/lib/module/sksg/nodes/pathEffects.js +72 -0
  191. package/lib/module/sksg/nodes/pathEffects.js.map +1 -0
  192. package/lib/module/sksg/nodes/shaders.d.ts +10 -0
  193. package/lib/module/sksg/nodes/shaders.js +142 -0
  194. package/lib/module/sksg/nodes/shaders.js.map +1 -0
  195. package/lib/module/sksg/nodes/utils.d.ts +3 -0
  196. package/lib/module/sksg/nodes/utils.js +18 -0
  197. package/lib/module/sksg/nodes/utils.js.map +1 -0
  198. package/lib/module/views/SkiaDomView.js +3 -1
  199. package/lib/module/views/SkiaDomView.js.map +1 -1
  200. package/lib/module/views/SkiaPictureView.js +0 -2
  201. package/lib/module/views/SkiaPictureView.js.map +1 -1
  202. package/lib/module/views/types.d.ts +2 -2
  203. package/lib/module/views/types.js.map +1 -1
  204. package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Circle.d.ts +1 -1
  205. package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Rect.d.ts +2 -0
  206. package/lib/typescript/lib/commonjs/dom/nodes/datatypes/Transform.d.ts +1 -0
  207. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
  208. package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +3 -1
  209. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +16 -0
  210. package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +26 -0
  211. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +50 -0
  212. package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +16 -0
  213. package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +1 -0
  214. package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +7 -0
  215. package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +2 -0
  216. package/lib/typescript/lib/commonjs/sksg/nodes/drawings.d.ts +23 -0
  217. package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +10 -0
  218. package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +1 -0
  219. package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +2 -0
  220. package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +8 -0
  221. package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +10 -0
  222. package/lib/typescript/lib/commonjs/sksg/nodes/utils.d.ts +3 -0
  223. package/lib/typescript/lib/module/dom/nodes/datatypes/Circle.d.ts +1 -1
  224. package/lib/typescript/lib/module/dom/nodes/datatypes/Rect.d.ts +2 -0
  225. package/lib/typescript/lib/module/dom/nodes/datatypes/Transform.d.ts +1 -0
  226. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +2 -0
  227. package/lib/typescript/lib/module/mock/index.d.ts +4 -1
  228. package/lib/typescript/lib/module/renderer/HostConfig.d.ts +3 -1
  229. package/lib/typescript/lib/module/sksg/Container.d.ts +15 -0
  230. package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +26 -0
  231. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +49 -0
  232. package/lib/typescript/lib/module/sksg/Reconciler.d.ts +15 -0
  233. package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +6 -0
  234. package/lib/typescript/lib/module/sksg/nodes/context.d.ts +1 -0
  235. package/lib/typescript/lib/module/sksg/nodes/drawings.d.ts +22 -0
  236. package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +9 -0
  237. package/lib/typescript/lib/module/sksg/nodes/index.d.ts +3 -0
  238. package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +1 -0
  239. package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +7 -0
  240. package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +9 -0
  241. package/lib/typescript/lib/module/sksg/nodes/utils.d.ts +2 -0
  242. package/lib/typescript/src/dom/nodes/datatypes/Circle.d.ts +2 -3
  243. package/lib/typescript/src/dom/nodes/datatypes/Rect.d.ts +3 -1
  244. package/lib/typescript/src/dom/nodes/datatypes/Transform.d.ts +2 -1
  245. package/lib/typescript/src/dom/types/DeclarationContext.d.ts +4 -4
  246. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +2 -0
  247. package/lib/typescript/src/renderer/__tests__/setup.d.ts +2 -3
  248. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +1 -2
  249. package/lib/typescript/src/skia/__tests__/setup.d.ts +0 -3
  250. package/lib/typescript/src/skia/types/RRect.d.ts +1 -1
  251. package/lib/typescript/src/sksg/Container.d.ts +19 -0
  252. package/lib/typescript/src/sksg/DrawingContext.d.ts +16 -0
  253. package/lib/typescript/src/sksg/HostConfig.d.ts +19 -0
  254. package/lib/typescript/src/sksg/Reconciler.d.ts +17 -0
  255. package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +57 -0
  256. package/lib/typescript/src/sksg/nodes/Node.d.ts +7 -0
  257. package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +7 -0
  258. package/lib/typescript/src/sksg/nodes/context.d.ts +3 -0
  259. package/lib/typescript/src/sksg/nodes/drawings.d.ts +31 -0
  260. package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +14 -0
  261. package/lib/typescript/src/sksg/nodes/index.d.ts +3 -0
  262. package/lib/typescript/src/sksg/nodes/paint.d.ts +2 -0
  263. package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +8 -0
  264. package/lib/typescript/src/sksg/nodes/shaders.d.ts +10 -0
  265. package/lib/typescript/src/sksg/nodes/utils.d.ts +3 -0
  266. package/lib/typescript/src/views/types.d.ts +2 -2
  267. package/libs/{ios → apple}/libskia.xcframework/Info.plist +15 -0
  268. package/libs/{ios → apple}/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  269. package/libs/{ios → apple}/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  270. package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
  271. package/libs/{ios → apple}/libskottie.xcframework/Info.plist +20 -5
  272. package/libs/{ios → apple}/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  273. package/libs/{ios → apple}/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  274. package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
  275. package/libs/{ios → apple}/libskparagraph.xcframework/Info.plist +20 -5
  276. package/libs/{ios → apple}/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  277. package/libs/{ios → apple}/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  278. package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
  279. package/libs/{ios → apple}/libsksg.xcframework/Info.plist +15 -0
  280. package/libs/{ios → apple}/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  281. package/libs/{ios → apple}/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  282. package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
  283. package/libs/{ios → apple}/libskshaper.xcframework/Info.plist +20 -5
  284. package/libs/{ios → apple}/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  285. package/libs/{ios → apple}/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  286. package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
  287. package/libs/{ios → apple}/libskunicode_core.xcframework/Info.plist +18 -3
  288. package/libs/{ios → apple}/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  289. package/libs/{ios → apple}/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  290. package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
  291. package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/Info.plist +15 -0
  292. package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  293. package/libs/{ios → apple}/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  294. package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
  295. package/libs/{ios → apple}/libsvg.xcframework/Info.plist +15 -0
  296. package/libs/{ios → apple}/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  297. package/libs/{ios → apple}/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  298. package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
  299. package/package.json +3 -3
  300. package/react-native-skia.podspec +9 -9
  301. package/src/__tests__/setup.ts +1 -1
  302. package/src/__tests__/snapshots/sksg/breathe-0.png +0 -0
  303. package/src/__tests__/snapshots/sksg/breathe.png +0 -0
  304. package/src/__tests__/snapshots/sksg/simple.png +0 -0
  305. package/src/__tests__/snapshots/sksg/simple2.png +0 -0
  306. package/src/dom/nodes/JsiSkDOM.ts +2 -4
  307. package/src/dom/nodes/datatypes/Circle.ts +7 -5
  308. package/src/dom/nodes/datatypes/Enum.ts +2 -0
  309. package/src/dom/nodes/datatypes/Fitting.ts +2 -5
  310. package/src/dom/nodes/datatypes/Gradient.ts +4 -7
  311. package/src/dom/nodes/datatypes/Path.ts +5 -2
  312. package/src/dom/nodes/datatypes/Radius.ts +2 -0
  313. package/src/dom/nodes/datatypes/Rect.ts +40 -6
  314. package/src/dom/nodes/datatypes/Transform.ts +29 -1
  315. package/src/dom/nodes/drawings/Box.ts +1 -29
  316. package/src/dom/nodes/drawings/CircleNode.ts +1 -1
  317. package/src/dom/types/DeclarationContext.ts +12 -2
  318. package/src/external/reanimated/renderHelpers.ts +8 -4
  319. package/src/renderer/HostConfig.ts +10 -4
  320. package/src/renderer/__tests__/documentation/shapes/Box.spec.tsx +2 -2
  321. package/src/renderer/__tests__/setup.tsx +17 -15
  322. package/src/renderer/processors/Animations/Animations.ts +1 -5
  323. package/src/renderer/typeddash.ts +4 -2
  324. package/src/skia/__tests__/setup.ts +1 -51
  325. package/src/skia/types/Path/Path.ts +4 -2
  326. package/src/skia/types/RRect.ts +9 -3
  327. package/src/skia/types/Shader/Shader.ts +7 -4
  328. package/src/skia/web/JsiSkParagraphStyle.ts +1 -3
  329. package/src/sksg/Container.ts +102 -0
  330. package/src/sksg/DrawingContext.ts +221 -0
  331. package/src/sksg/HostConfig.ts +287 -0
  332. package/src/sksg/Reconciler.ts +59 -0
  333. package/src/sksg/__tests__/Declarations.spec.tsx +235 -0
  334. package/src/sksg/__tests__/MockDeclaration.ts +140 -0
  335. package/src/sksg/__tests__/Simple.spec.tsx +148 -0
  336. package/src/sksg/nodes/Node.ts +8 -0
  337. package/src/sksg/nodes/colorFilters.ts +60 -0
  338. package/src/sksg/nodes/context.ts +489 -0
  339. package/src/sksg/nodes/drawings.ts +393 -0
  340. package/src/sksg/nodes/imageFilters.ts +183 -0
  341. package/src/sksg/nodes/index.ts +3 -0
  342. package/src/sksg/nodes/paint.ts +75 -0
  343. package/src/sksg/nodes/pathEffects.ts +95 -0
  344. package/src/sksg/nodes/shaders.ts +203 -0
  345. package/src/sksg/nodes/utils.ts +23 -0
  346. package/src/views/SkiaDomView.tsx +3 -1
  347. package/src/views/SkiaPictureView.tsx +0 -2
  348. package/src/views/types.ts +2 -2
  349. package/lib/commonjs/dom/__tests__/Shaders.spec.d.ts +0 -1
  350. package/lib/commonjs/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
  351. package/lib/module/dom/__tests__/Compose.spec.d.ts +0 -1
  352. package/lib/module/dom/__tests__/Demos.spec.d.ts +0 -1
  353. package/lib/module/dom/__tests__/DrawingContext.spec.d.ts +0 -1
  354. package/lib/module/dom/__tests__/Drawings.spec.d.ts +0 -1
  355. package/lib/module/dom/__tests__/Group.spec.d.ts +0 -1
  356. package/lib/module/dom/__tests__/Paint.spec.d.ts +0 -1
  357. package/lib/module/dom/__tests__/RenderNodes.spec.d.ts +0 -1
  358. package/lib/module/dom/__tests__/Shaders.spec.d.ts +0 -1
  359. package/lib/module/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
  360. package/lib/typescript/src/dom/__tests__/Compose.spec.d.ts +0 -1
  361. package/lib/typescript/src/dom/__tests__/Demos.spec.d.ts +0 -1
  362. package/lib/typescript/src/dom/__tests__/DrawingContext.spec.d.ts +0 -1
  363. package/lib/typescript/src/dom/__tests__/Drawings.spec.d.ts +0 -1
  364. package/lib/typescript/src/dom/__tests__/Group.spec.d.ts +0 -1
  365. package/lib/typescript/src/dom/__tests__/Paint.spec.d.ts +0 -1
  366. package/lib/typescript/src/dom/__tests__/RenderNodes.spec.d.ts +0 -1
  367. package/lib/typescript/src/dom/__tests__/Shaders.spec.d.ts +0 -1
  368. package/lib/typescript/src/renderer/__tests__/SkiaDOM.spec.d.ts +0 -1
  369. package/src/dom/__tests__/Compose.spec.tsx +0 -42
  370. package/src/dom/__tests__/Demos.spec.tsx +0 -145
  371. package/src/dom/__tests__/DrawingContext.spec.tsx +0 -99
  372. package/src/dom/__tests__/Drawings.spec.tsx +0 -95
  373. package/src/dom/__tests__/Group.spec.tsx +0 -132
  374. package/src/dom/__tests__/Paint.spec.tsx +0 -100
  375. package/src/dom/__tests__/RenderNodes.spec.tsx +0 -44
  376. package/src/dom/__tests__/Shaders.spec.tsx +0 -123
  377. package/src/renderer/__tests__/SkiaDOM.spec.tsx +0 -46
  378. /package/lib/commonjs/{dom/__tests__/Compose.spec.d.ts → sksg/__tests__/Declarations.spec.d.ts} +0 -0
  379. /package/lib/commonjs/{dom/__tests__/Demos.spec.d.ts → sksg/__tests__/Simple.spec.d.ts} +0 -0
  380. /package/lib/{commonjs/dom/__tests__/DrawingContext.spec.d.ts → module/sksg/__tests__/Declarations.spec.d.ts} +0 -0
  381. /package/lib/{commonjs/dom/__tests__/Drawings.spec.d.ts → module/sksg/__tests__/Simple.spec.d.ts} +0 -0
  382. /package/lib/{commonjs/dom/__tests__/Group.spec.d.ts → typescript/lib/module/sksg/nodes/Node.d.ts} +0 -0
  383. /package/lib/{commonjs/dom/__tests__/Paint.spec.d.ts → typescript/src/sksg/__tests__/Declarations.spec.d.ts} +0 -0
  384. /package/lib/{commonjs/dom/__tests__/RenderNodes.spec.d.ts → typescript/src/sksg/__tests__/Simple.spec.d.ts} +0 -0
@@ -1,14 +1,16 @@
1
- import type { Skia } from "../../../skia/types";
1
+ "worklet";
2
+
2
3
  import type { CircleDef, ScalarCircleDef } from "../../types";
3
4
 
4
- export const isCircleScalarDef = (def: CircleDef): def is ScalarCircleDef =>
5
+ export const isCircleScalarDef = (def: CircleDef): def is ScalarCircleDef => {
5
6
  // We have an issue to check property existence on JSI backed instances
6
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
- (def as any).cx !== undefined;
8
+ return (def as any).cx !== undefined;
9
+ };
8
10
 
9
- export const processCircle = (Skia: Skia, def: CircleDef) => {
11
+ export const processCircle = (def: CircleDef) => {
10
12
  if (isCircleScalarDef(def)) {
11
- return { c: Skia.Point(def.cx, def.cy), r: def.r };
13
+ return { c: { x: def.cx, y: def.cy }, r: def.r };
12
14
  }
13
15
  return { ...def, c: def.c ?? { x: 0, y: 0 } };
14
16
  };
@@ -1,2 +1,4 @@
1
+ "worklet";
2
+
1
3
  export const enumKey = <K extends string>(k: K) =>
2
4
  (k.charAt(0).toUpperCase() + k.slice(1)) as Capitalize<K>;
@@ -1,3 +1,5 @@
1
+ "worklet";
2
+
1
3
  import { exhaustiveCheck } from "../../../renderer/typeddash";
2
4
  import type { SkRect } from "../../../skia/types";
3
5
  import type { Fit } from "../../types";
@@ -8,7 +10,6 @@ export interface Size {
8
10
  }
9
11
 
10
12
  export const size = (width = 0, height = 0) => {
11
- "worklet";
12
13
  return { width, height };
13
14
  };
14
15
 
@@ -21,7 +22,6 @@ export const rect2rect = (
21
22
  { scaleX: number },
22
23
  { scaleY: number }
23
24
  ] => {
24
- "worklet";
25
25
  const scaleX = dst.width / src.width;
26
26
  const scaleY = dst.height / src.height;
27
27
  const translateX = dst.x - src.x * scaleX;
@@ -33,7 +33,6 @@ const inscribe = (
33
33
  { width, height }: Size,
34
34
  rect: { x: number; y: number; width: number; height: number }
35
35
  ) => {
36
- "worklet";
37
36
  const halfWidthDelta = (rect.width - width) / 2.0;
38
37
  const halfHeightDelta = (rect.height - height) / 2.0;
39
38
  return {
@@ -45,7 +44,6 @@ const inscribe = (
45
44
  };
46
45
 
47
46
  const applyBoxFit = (fit: Fit, input: Size, output: Size) => {
48
- "worklet";
49
47
  let src = size(),
50
48
  dst = size();
51
49
  if (
@@ -114,7 +112,6 @@ export const fitRects = (
114
112
  rect: SkRect,
115
113
  { x, y, width, height }: SkRect
116
114
  ) => {
117
- "worklet";
118
115
  const sizes = applyBoxFit(
119
116
  fit,
120
117
  { width: rect.width, height: rect.height },
@@ -1,3 +1,5 @@
1
+ "worklet";
2
+
1
3
  import type { Skia, SkRect, Transforms3d, Vector } from "../../../skia/types";
2
4
  import { TileMode } from "../../../skia/types";
3
5
  import type { GradientProps, ImageShaderProps } from "../../types";
@@ -35,13 +37,8 @@ export const getRect = (
35
37
  const { x, y, width, height } = props;
36
38
  if (props.rect) {
37
39
  return props.rect;
38
- } else if (
39
- x !== undefined &&
40
- y !== undefined &&
41
- width !== undefined &&
42
- height !== undefined
43
- ) {
44
- return Skia.XYWHRect(x, y, width, height);
40
+ } else if (width !== undefined && height !== undefined) {
41
+ return Skia.XYWHRect(x ?? 0, y ?? 0, width, height);
45
42
  } else {
46
43
  return undefined;
47
44
  }
@@ -1,3 +1,5 @@
1
+ "worklet";
2
+
1
3
  import type { Skia } from "../../../skia/types";
2
4
  import { isPath } from "../../../skia/types";
3
5
  import type { PathDef } from "../../types";
@@ -14,5 +16,6 @@ export const processPath = (Skia: Skia, rawPath: PathDef) => {
14
16
  };
15
17
 
16
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- export const isPathDef = (def: any): def is PathDef =>
18
- typeof def === "string" || isPath(def);
19
+ export const isPathDef = (def: any): def is PathDef => {
20
+ return typeof def === "string" || isPath(def);
21
+ };
@@ -1,3 +1,5 @@
1
+ "worklet";
2
+
1
3
  import type { Skia, Vector } from "../../../skia/types";
2
4
  import type { Radius } from "../../types";
3
5
 
@@ -1,22 +1,25 @@
1
+ "worklet";
2
+
1
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import type { Skia, SkRect, Vector } from "../../../skia/types";
4
+ import type { Skia, SkRect, SkRRect, Vector } from "../../../skia/types";
3
5
  import type { RectCtor, RectDef, RRectCtor, RRectDef } from "../../types";
4
6
 
5
7
  import { processRadius } from "./Radius";
6
8
 
7
9
  export const isEdge = (pos: Vector, b: SkRect) => {
8
- "worklet";
9
10
  return (
10
11
  pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height
11
12
  );
12
13
  };
13
14
 
14
15
  // We have an issue to check property existence on JSI backed instances
15
- const isRRectCtor = (def: RRectDef): def is RRectCtor =>
16
- (def as any).rect === undefined;
16
+ const isRRectCtor = (def: RRectDef): def is RRectCtor => {
17
+ return (def as any).rect === undefined;
18
+ };
17
19
  // We have an issue to check property existence on JSI backed instances
18
- const isRectCtor = (def: RectDef): def is RectCtor =>
19
- (def as any).rect === undefined;
20
+ const isRectCtor = (def: RectDef): def is RectCtor => {
21
+ return (def as any).rect === undefined;
22
+ };
20
23
 
21
24
  export const processRect = (Skia: Skia, def: RectDef) => {
22
25
  if (isRectCtor(def)) {
@@ -38,3 +41,34 @@ export const processRRect = (Skia: Skia, def: RRectDef) => {
38
41
  return def.rect;
39
42
  }
40
43
  };
44
+
45
+ export const inflate = (
46
+ Skia: Skia,
47
+ box: SkRRect,
48
+ dx: number,
49
+ dy: number,
50
+ tx = 0,
51
+ ty = 0
52
+ ) => {
53
+ return Skia.RRectXY(
54
+ Skia.XYWHRect(
55
+ box.rect.x - dx + tx,
56
+ box.rect.y - dy + ty,
57
+ box.rect.width + 2 * dx,
58
+ box.rect.height + 2 * dy
59
+ ),
60
+ box.rx + dx,
61
+ box.ry + dy
62
+ );
63
+ };
64
+
65
+ export const deflate = (
66
+ Skia: Skia,
67
+ box: SkRRect,
68
+ dx: number,
69
+ dy: number,
70
+ tx = 0,
71
+ ty = 0
72
+ ) => {
73
+ return inflate(Skia, box, -dx, -dy, tx, ty);
74
+ };
@@ -1,5 +1,7 @@
1
+ "worklet";
2
+
1
3
  import type { TransformProps } from "../../types";
2
- import type { SkMatrix } from "../../../skia/types";
4
+ import type { Skia, SkMatrix } from "../../../skia/types";
3
5
  import { processTransform } from "../../../skia/types";
4
6
 
5
7
  export const processTransformProps = (m3: SkMatrix, props: TransformProps) => {
@@ -22,3 +24,29 @@ export const processTransformProps = (m3: SkMatrix, props: TransformProps) => {
22
24
  }
23
25
  }
24
26
  };
27
+
28
+ export const processTransformProps2 = (Skia: Skia, props: TransformProps) => {
29
+ const { transform, origin, matrix } = props;
30
+ if (matrix) {
31
+ const m3 = Skia.Matrix();
32
+ if (origin) {
33
+ m3.translate(origin.x, origin.y);
34
+ m3.concat(matrix);
35
+ m3.translate(-origin.x, -origin.y);
36
+ } else {
37
+ m3.concat(matrix);
38
+ }
39
+ return m3;
40
+ } else if (transform) {
41
+ const m3 = Skia.Matrix();
42
+ if (origin) {
43
+ m3.translate(origin.x, origin.y);
44
+ }
45
+ processTransform(m3, transform);
46
+ if (origin) {
47
+ m3.translate(-origin.x, -origin.y);
48
+ }
49
+ return m3;
50
+ }
51
+ return null;
52
+ };
@@ -1,4 +1,3 @@
1
- import type { SkRRect, Skia } from "../../../skia/types";
2
1
  import { BlurStyle, ClipOp, isRRect } from "../../../skia/types";
3
2
  import type { DrawingContext } from "../../types";
4
3
  import { NodeType } from "../../types";
@@ -7,34 +6,7 @@ import type { NodeContext } from "../Node";
7
6
  import { JsiDeclarationNode } from "../Node";
8
7
  import { JsiRenderNode } from "../RenderNode";
9
8
  import type { DeclarationContext } from "../../types/DeclarationContext";
10
-
11
- const inflate = (
12
- Skia: Skia,
13
- box: SkRRect,
14
- dx: number,
15
- dy: number,
16
- tx = 0,
17
- ty = 0
18
- ) =>
19
- Skia.RRectXY(
20
- Skia.XYWHRect(
21
- box.rect.x - dx + tx,
22
- box.rect.y - dy + ty,
23
- box.rect.width + 2 * dx,
24
- box.rect.height + 2 * dy
25
- ),
26
- box.rx + dx,
27
- box.ry + dy
28
- );
29
-
30
- const deflate = (
31
- Skia: Skia,
32
- box: SkRRect,
33
- dx: number,
34
- dy: number,
35
- tx = 0,
36
- ty = 0
37
- ) => inflate(Skia, box, -dx, -dy, tx, ty);
9
+ import { deflate, inflate } from "../datatypes";
38
10
 
39
11
  export class BoxShadowNode extends JsiDeclarationNode<BoxShadowProps> {
40
12
  constructor(ctx: NodeContext, props: BoxShadowProps) {
@@ -11,7 +11,7 @@ export class CircleNode extends JsiDrawingNode<CircleProps, SkPoint> {
11
11
  }
12
12
 
13
13
  protected deriveProps() {
14
- return processCircle(this.Skia, this.props).c;
14
+ return processCircle(this.props).c;
15
15
  }
16
16
 
17
17
  draw({ canvas, paint }: DrawingContext) {
@@ -1,3 +1,5 @@
1
+ "worklet";
2
+
1
3
  import type {
2
4
  SkShader,
3
5
  SkPaint,
@@ -25,8 +27,11 @@ export const composeDeclarations = <T>(filters: T[], composer: Composer<T>) => {
25
27
  class Declaration<T> {
26
28
  private decls: T[] = [];
27
29
  private indexes = [0];
30
+ private composer?: Composer<T>;
28
31
 
29
- constructor(private composer?: Composer<T>) {}
32
+ constructor(composer?: Composer<T>) {
33
+ this.composer = composer;
34
+ }
30
35
 
31
36
  private get index() {
32
37
  return this.indexes[this.indexes.length - 1];
@@ -53,6 +58,9 @@ class Declaration<T> {
53
58
  }
54
59
 
55
60
  popAllAsOne() {
61
+ if (this.decls.length === 0) {
62
+ return undefined;
63
+ }
56
64
  if (!this.composer) {
57
65
  throw new Error("No composer for this type of declaration");
58
66
  }
@@ -62,6 +70,7 @@ class Declaration<T> {
62
70
  }
63
71
 
64
72
  export class DeclarationContext {
73
+ public Skia: Skia;
65
74
  readonly paints: Declaration<SkPaint>;
66
75
  readonly maskFilters: Declaration<SkMaskFilter>;
67
76
  readonly shaders: Declaration<SkShader>;
@@ -69,7 +78,8 @@ export class DeclarationContext {
69
78
  readonly imageFilters: Declaration<SkImageFilter>;
70
79
  readonly colorFilters: Declaration<SkColorFilter>;
71
80
 
72
- constructor(private Skia: Skia) {
81
+ constructor(Skia: Skia) {
82
+ this.Skia = Skia;
73
83
  const peComp = this.Skia.PathEffect.MakeCompose.bind(this.Skia.PathEffect);
74
84
  const ifComp = this.Skia.ImageFilter.MakeCompose.bind(
75
85
  this.Skia.ImageFilter
@@ -6,13 +6,17 @@ import type { Node } from "../../dom/types";
6
6
 
7
7
  import Rea from "./ReanimatedProxy";
8
8
 
9
- let HAS_REANIMATED = false;
10
- let HAS_REANIMATED_3 = false;
9
+ export let HAS_REANIMATED = false;
10
+ export let HAS_REANIMATED_3 = false;
11
11
  try {
12
- require("react-native-reanimated");
13
- HAS_REANIMATED = true;
12
+ // This logic is convoluted but necessary
13
+ // In most systems, `require("react-native-reanimated")` throws an error, all is well.
14
+ // In webpack, in some configuration it will return an empty object.
15
+ // So it will not throw an error and we need to check the version to know if it's there.
14
16
  const reanimatedVersion =
15
17
  require("react-native-reanimated/package.json").version;
18
+ require("react-native-reanimated");
19
+ HAS_REANIMATED = !!reanimatedVersion;
16
20
  if (
17
21
  reanimatedVersion &&
18
22
  (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
@@ -1,5 +1,5 @@
1
1
  /*global NodeJS*/
2
- import type { HostConfig } from "react-reconciler";
2
+ import type { Fiber, HostConfig } from "react-reconciler";
3
3
  import { DefaultEventPriority } from "react-reconciler/constants";
4
4
 
5
5
  import type { NodeType, Node } from "../dom/types";
@@ -78,7 +78,6 @@ export const skHostConfig: SkiaHostConfig = {
78
78
  /**
79
79
  * This function is used by the reconciler in order to calculate current time for prioritising work.
80
80
  */
81
- now: Date.now,
82
81
  supportsMutation: true,
83
82
  isPrimaryRenderer: false,
84
83
  supportsPersistence: false,
@@ -242,11 +241,18 @@ export const skHostConfig: SkiaHostConfig = {
242
241
  insertBefore: (parent, child, before) => {
243
242
  insertBefore(parent, child, before);
244
243
  },
244
+
245
245
  // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874
246
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
247
- // @ts-expect-error
248
246
  getCurrentEventPriority: () => DefaultEventPriority,
249
247
  beforeActiveInstanceBlur: () => {},
250
248
  afterActiveInstanceBlur: () => {},
251
249
  detachDeletedInstance: () => {},
250
+
251
+ getInstanceFromNode: function (_node): Fiber | null | undefined {
252
+ return null;
253
+ },
254
+ prepareScopeUpdate: function (_scopeInstance, _instance): void {},
255
+ getInstanceFromScope: function (_scopeInstance): Instance | null {
256
+ return null;
257
+ },
252
258
  };
@@ -27,7 +27,7 @@ describe("Box", () => {
27
27
  </Box>
28
28
  </>
29
29
  );
30
- processResult(surface, docPath("box/shadows.png"), true);
30
+ processResult(surface, docPath("box/shadows.png"));
31
31
  });
32
32
  it("should draw a box with red stroke", () => {
33
33
  const size = width / 2;
@@ -41,6 +41,6 @@ describe("Box", () => {
41
41
  />
42
42
  </>
43
43
  );
44
- processResult(surface, docPath("box/box-stroke.png"), true);
44
+ processResult(surface, docPath("box/box-stroke.png"));
45
45
  });
46
46
  });
@@ -8,15 +8,13 @@ import type { Server, WebSocket } from "ws";
8
8
 
9
9
  import type * as SkiaExports from "../../index";
10
10
  import { JsiSkApi } from "../../skia/web/JsiSkia";
11
- import type { Node } from "../../dom/nodes";
12
- import { JsiSkDOM } from "../../dom/nodes";
13
11
  import { Group } from "../components";
14
12
  import type { SkImage, SkFont, Skia, SkCanvas } from "../../skia/types";
15
13
  import { isPath } from "../../skia/types";
16
14
  import { E2E } from "../../__tests__/setup";
17
- import { SkiaRoot } from "../Reconciler";
18
- import { JsiDrawingContext } from "../../dom/types/DrawingContext";
19
15
  import { LoadSkiaWeb } from "../../web/LoadSkiaWeb";
16
+ import { SkiaSGRoot } from "../../sksg/Reconciler";
17
+ import type { Node } from "../../sksg/nodes";
20
18
 
21
19
  import { SkiaObject } from "./e2e/setup";
22
20
 
@@ -172,11 +170,6 @@ export const importSkia = (): typeof SkiaExports => {
172
170
  };
173
171
  };
174
172
 
175
- export const getSkDOM = () => {
176
- const { Skia } = importSkia();
177
- return new JsiSkDOM({ Skia }, false);
178
- };
179
-
180
173
  export const PIXEL_RATIO = 3;
181
174
  export const fontSize = 32 * PIXEL_RATIO;
182
175
  export const width = 256 * PIXEL_RATIO;
@@ -197,21 +190,20 @@ export const mountCanvas = (element: ReactNode) => {
197
190
  expect(ckSurface).toBeDefined();
198
191
  const canvas = ckSurface.getCanvas();
199
192
 
200
- const root = new SkiaRoot(Skia, false);
193
+ const root = new SkiaSGRoot(Skia);
201
194
  root.render(element);
202
195
  return {
203
196
  surface: ckSurface,
204
197
  root,
205
198
  draw: () => {
206
- const ctx = new JsiDrawingContext(Skia, canvas);
207
- root.dom.render(ctx);
199
+ root.drawOnCanvas(canvas);
208
200
  },
209
201
  };
210
202
  };
211
203
 
212
204
  export const serialize = (element: ReactNode) => {
213
205
  const { root } = mountCanvas(element);
214
- const serialized = serializeNode(root.dom);
206
+ const serialized = serializeNode(root.sg);
215
207
  return JSON.stringify(serialized);
216
208
  };
217
209
 
@@ -228,6 +220,8 @@ interface SerializedNode {
228
220
  const serializeSkOjects = (obj: any): any => {
229
221
  if (typeof obj === "function") {
230
222
  return { __typename__: "Function", source: `${obj.toString()}` };
223
+ } else if (obj instanceof Float32Array) {
224
+ return { __typename__: "Float32Array", value: Array.from(obj) };
231
225
  } else if (Array.isArray(obj)) {
232
226
  return obj.map((item) => serializeSkOjects(item));
233
227
  } else if (obj && typeof obj === "object" && "__typename__" in obj) {
@@ -302,13 +296,21 @@ const serializeSkOjects = (obj: any): any => {
302
296
  ty: obj.ty,
303
297
  };
304
298
  }
299
+ } else if (obj && typeof obj === "object") {
300
+ const result = Object.keys(obj).reduce((acc, key) => {
301
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
302
+ // @ts-ignore
303
+ acc[key] = serializeSkOjects(obj[key]);
304
+ return acc;
305
+ }, {});
306
+ return result;
305
307
  }
306
308
  return obj;
307
309
  };
308
310
 
309
311
  const serializeNode = (node: Node<any>): SerializedNode => {
310
312
  const props: any = {};
311
- const ogProps = node.getProps();
313
+ const ogProps = node.props;
312
314
  if (ogProps) {
313
315
  Object.keys(ogProps)
314
316
  .filter((key) => key !== "children")
@@ -319,7 +321,7 @@ const serializeNode = (node: Node<any>): SerializedNode => {
319
321
  return {
320
322
  type: node.type,
321
323
  props,
322
- children: node.children().map((child) => serializeNode(child)),
324
+ children: node.children.map((child) => serializeNode(child)),
323
325
  };
324
326
  };
325
327
 
@@ -1,8 +1,4 @@
1
- export type SharedValueType<T = number> = {
2
- value: T;
3
- };
4
-
5
- export type AnimatedProp<T> = T | SharedValueType<T>;
1
+ export type AnimatedProp<T> = T | { value: T };
6
2
 
7
3
  export type AnimatedProps<T, O extends keyof T | never = never> = {
8
4
  [K in keyof T]: K extends "children"
@@ -1,5 +1,7 @@
1
- export const mapKeys = <T extends object>(obj: T) =>
2
- Object.keys(obj) as (keyof T)[];
1
+ export const mapKeys = <T extends object>(obj: T) => {
2
+ "worklet";
3
+ return Object.keys(obj) as (keyof T)[];
4
+ };
3
5
 
4
6
  export const exhaustiveCheck = (a: never): never => {
5
7
  "worklet";
@@ -1,7 +1,5 @@
1
- import type { Node } from "../../dom/types";
2
- import { mapKeys } from "../../renderer/typeddash";
3
1
  import { LoadSkiaWeb } from "../../web/LoadSkiaWeb";
4
- import { isMatrix, Skia } from "../types";
2
+ import { Skia } from "../types";
5
3
  import { JsiSkApi } from "../web";
6
4
 
7
5
  let Skia: ReturnType<typeof JsiSkApi>;
@@ -27,51 +25,3 @@ export const setupSkia = (width = 256, height = 256) => {
27
25
  CanvasKit: global.CanvasKit,
28
26
  };
29
27
  };
30
-
31
- const asValue = (value: unknown) => {
32
- if (value instanceof Float32Array) {
33
- return Array.from(value)
34
- .map((v) => Math.round(v * 100) / 100)
35
- .join(", ");
36
- } else if (isMatrix(value)) {
37
- // TODO: https://github.com/Shopify/react-native-skia/issues/715
38
- return "m3x3";
39
- } else if (
40
- typeof value === "object" &&
41
- value !== null &&
42
- "x" in value &&
43
- "y" in value
44
- ) {
45
- const v = value as { x: number; y: number };
46
- return `{x:${v.x}, y:${v.y}}`;
47
- }
48
- return value;
49
- };
50
-
51
- export const printAsXML = (node: Node<unknown>) => {
52
- console.log(asXML(node));
53
- };
54
-
55
- // Print nodes as XML tree
56
- export const asXML = (node: Node<unknown>, indent = 0): string => {
57
- // TODO: remove cast
58
- const hasChildren = node.children().length > 0;
59
- const props = node.getProps() as object;
60
- const space = new Array(indent).fill(" ").join("");
61
- const keys = mapKeys(props).filter((key) => props[key] !== undefined);
62
- if (hasChildren) {
63
- return `${space}<${node.type}${keys.length > 0 ? " " : ""}${keys
64
- .map((name) => `${name}="${asValue(props[name])}"`)
65
- .join(" ")}>
66
- ${node
67
- .children()
68
-
69
- .map((child) => asXML(child, indent + 2)).join(`
70
- `)}
71
- ${space}</${node.type}>`;
72
- } else {
73
- return `${space}<${node.type} ${keys
74
- .map((name) => `${name}="${asValue(props[name])}"`)
75
- .join(" ")} />`;
76
- }
77
- };
@@ -47,8 +47,10 @@ export enum PathVerb {
47
47
 
48
48
  export type PathCommand = number[];
49
49
 
50
- export const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath =>
51
- obj !== null && obj.__typename__ === "Path";
50
+ export const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath => {
51
+ "worklet";
52
+ return obj !== null && obj.__typename__ === "Path";
53
+ };
52
54
 
53
55
  export interface SkPath extends SkJSIInstance<"Path"> {
54
56
  /**
@@ -18,6 +18,12 @@ export interface NonUniformRRect {
18
18
  export type InputRRect = SkRRect | NonUniformRRect;
19
19
 
20
20
  // We have an issue to check property existence on JSI backed instances
21
- export const isRRect = (def: SkRect | SkRRect): def is SkRRect =>
22
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- (def as any).rect !== undefined;
21
+ export const isRRect = (def: unknown): def is SkRRect => {
22
+ "worklet";
23
+ return (
24
+ typeof def === "object" &&
25
+ def !== null &&
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ typeof (def as any).rect === "object"
28
+ );
29
+ };
@@ -1,3 +1,5 @@
1
+ "worklet";
2
+
1
3
  import type { SkJSIInstance } from "../JsiInstance";
2
4
  import type { Vector } from "../Point";
3
5
  import type { SkRuntimeEffect, SkRuntimeShaderBuilder } from "../RuntimeEffect";
@@ -18,12 +20,13 @@ export interface Uniforms {
18
20
  [name: string]: Uniform;
19
21
  }
20
22
 
21
- const isVector = (obj: unknown): obj is Vector =>
23
+ const isVector = (obj: unknown): obj is Vector => {
22
24
  // We have an issue to check property existence on JSI backed instances
23
25
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- (obj as any).x !== undefined && (obj as any).y !== undefined;
26
+ return (obj as any).x !== undefined && (obj as any).y !== undefined;
27
+ };
25
28
 
26
- const processValue = (values: number[], value: Uniform) => {
29
+ function processValue(values: number[], value: Uniform) {
27
30
  if (typeof value === "number") {
28
31
  values.push(value);
29
32
  } else if (Array.isArray(value)) {
@@ -33,7 +36,7 @@ const processValue = (values: number[], value: Uniform) => {
33
36
  } else if (value instanceof Float32Array) {
34
37
  values.push(...value);
35
38
  }
36
- };
39
+ }
37
40
 
38
41
  export const processUniforms = (
39
42
  source: SkRuntimeEffect,
@@ -19,9 +19,7 @@ export class JsiSkParagraphStyle {
19
19
  ps.replaceTabCharacters =
20
20
  value.replaceTabCharacters ?? ps.replaceTabCharacters;
21
21
  ps.textAlign =
22
- value.textAlign !== undefined
23
- ? { value: value.textAlign }
24
- : undefined ?? ps.textAlign;
22
+ value.textAlign !== undefined ? { value: value.textAlign } : ps.textAlign;
25
23
  ps.textDirection =
26
24
  value.textDirection !== undefined
27
25
  ? { value: value.textDirection === TextDirection.LTR ? 1 : 0 }