react-native-skia 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/Package.swift +14 -13
  2. package/README.md +19 -2
  3. package/android/CMakeLists.txt +13 -42
  4. package/android/build.gradle +54 -63
  5. package/android/cpp/jni/JniLoad.cpp +2 -4
  6. package/android/cpp/jni/include/JniSkiaView.h +123 -0
  7. package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.cpp → RNSkAndroidCanvasProvider.cpp} +45 -100
  8. package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.h → RNSkAndroidCanvasProvider.h} +24 -22
  9. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -83
  10. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +0 -8
  11. package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +1 -2
  12. package/android/src/main/java/com/reactnative/skia/SkiaSurfaceView.java +1 -3
  13. package/android/src/main/java/com/reactnative/skia/SkiaTextureView.java +1 -17
  14. package/android/src/main/java/com/reactnative/skia/{SkiaBaseView.java → SkiaView.java} +78 -16
  15. package/android/src/main/java/com/reactnative/skia/SkiaViewManager.java +85 -0
  16. package/apple/MetalLayerColorSpace.mm +10 -12
  17. package/apple/RNSkApplePlatformContext.h +12 -14
  18. package/apple/RNSkApplePlatformContext.mm +19 -112
  19. package/apple/RNSkMetalCanvasProvider.h +14 -19
  20. package/apple/RNSkMetalCanvasProvider.mm +39 -70
  21. package/apple/RNSkiaModule.mm +10 -0
  22. package/apple/SkiaView.h +20 -0
  23. package/apple/SkiaView.mm +210 -0
  24. package/cpp/api/JsiSkApi.h +2 -13
  25. package/cpp/api/JsiSkCanvas.h +4 -18
  26. package/cpp/api/JsiSkGraphiteContext.h +1 -5
  27. package/cpp/api/JsiSkGraphiteRecording.h +1 -5
  28. package/cpp/api/JsiSkImage.h +7 -41
  29. package/cpp/api/JsiSkImageFactory.h +0 -14
  30. package/cpp/api/JsiSkSurface.h +2 -16
  31. package/cpp/api/JsiSkSurfaceFactory.h +0 -8
  32. package/cpp/rnskia/RNDawnContext.h +3 -2
  33. package/cpp/rnskia/RNDawnInterop.cpp +0 -4
  34. package/cpp/rnskia/RNDawnUtils.h +12 -1
  35. package/cpp/rnskia/RNDawnWindowContext.cpp +12 -1
  36. package/cpp/rnskia/RNDawnWindowContext.h +19 -7
  37. package/cpp/rnskia/RNMetalLayerColorSpace.h +4 -2
  38. package/cpp/rnskia/RNSkCanvasProvider.h +231 -0
  39. package/cpp/rnskia/RNSkGraphiteProducer.cpp +36 -14
  40. package/cpp/rnskia/RNSkGraphiteProducer.h +23 -8
  41. package/cpp/rnskia/RNSkGraphiteTarget.h +396 -0
  42. package/cpp/rnskia/RNSkJsiViewApi.h +9 -18
  43. package/cpp/rnskia/RNSkPlatformContext.h +17 -15
  44. package/cpp/rnskia/RNSkView.h +362 -246
  45. package/jestSetup.js +1 -3
  46. package/lib/commonjs/Platform/Platform.web.js +1 -1
  47. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  48. package/lib/commonjs/external/reanimated/interpolators.js +1 -1
  49. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  50. package/lib/commonjs/index.d.ts +1 -3
  51. package/lib/commonjs/index.js +3 -12
  52. package/lib/commonjs/index.js.map +1 -1
  53. package/lib/commonjs/mock/index.js +0 -1
  54. package/lib/commonjs/mock/index.js.map +1 -1
  55. package/lib/commonjs/renderer/Canvas.d.ts +15 -12
  56. package/lib/commonjs/renderer/Canvas.js +25 -21
  57. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  58. package/lib/commonjs/skia/types/Graphite.d.ts +3 -3
  59. package/lib/commonjs/skia/types/Graphite.js.map +1 -1
  60. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +2 -2
  61. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  62. package/lib/commonjs/skia/types/Skia.d.ts +1 -2
  63. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  64. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  65. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  66. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +5 -4
  67. package/lib/commonjs/specs/NativeSkiaModule.web.js +5 -9
  68. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  69. package/lib/{typescript/src/specs/SkiaPictureViewNativeComponent.d.ts → commonjs/specs/SkiaViewNativeComponent.d.ts} +0 -3
  70. package/lib/commonjs/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
  71. package/lib/commonjs/specs/SkiaViewNativeComponent.js.map +1 -0
  72. package/lib/commonjs/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  73. package/lib/commonjs/specs/SkiaViewNativeComponent.web.js +27 -0
  74. package/lib/commonjs/specs/SkiaViewNativeComponent.web.js.map +1 -0
  75. package/lib/commonjs/views/SkiaGraphiteView.d.ts +3 -4
  76. package/lib/commonjs/views/SkiaGraphiteView.js +23 -12
  77. package/lib/commonjs/views/SkiaGraphiteView.js.map +1 -1
  78. package/lib/commonjs/views/SkiaPictureView.d.ts +4 -1
  79. package/lib/commonjs/views/SkiaPictureView.js +12 -10
  80. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  81. package/lib/commonjs/views/SkiaView.web.d.ts +12 -0
  82. package/lib/commonjs/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +82 -38
  83. package/lib/commonjs/views/SkiaView.web.js.map +1 -0
  84. package/lib/commonjs/views/SkiaWebRenderer.js +1 -1
  85. package/lib/commonjs/views/SkiaWebRenderer.js.map +1 -1
  86. package/lib/commonjs/views/android.d.ts +6 -0
  87. package/lib/commonjs/views/android.js +17 -0
  88. package/lib/commonjs/views/android.js.map +1 -0
  89. package/lib/commonjs/views/types.d.ts +3 -12
  90. package/lib/commonjs/views/types.js.map +1 -1
  91. package/lib/module/Platform/Platform.web.js +1 -1
  92. package/lib/module/Platform/Platform.web.js.map +1 -1
  93. package/lib/module/external/reanimated/interpolators.js +1 -1
  94. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  95. package/lib/module/index.d.ts +1 -3
  96. package/lib/module/index.js +1 -3
  97. package/lib/module/index.js.map +1 -1
  98. package/lib/module/mock/index.js +0 -1
  99. package/lib/module/mock/index.js.map +1 -1
  100. package/lib/module/renderer/Canvas.d.ts +15 -12
  101. package/lib/module/renderer/Canvas.js +25 -20
  102. package/lib/module/renderer/Canvas.js.map +1 -1
  103. package/lib/module/skia/types/Graphite.d.ts +3 -3
  104. package/lib/module/skia/types/Graphite.js.map +1 -1
  105. package/lib/module/skia/types/Image/ImageFactory.d.ts +2 -2
  106. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  107. package/lib/module/skia/types/Skia.d.ts +1 -2
  108. package/lib/module/skia/types/Skia.js.map +1 -1
  109. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  110. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  111. package/lib/module/specs/NativeSkiaModule.web.d.ts +5 -4
  112. package/lib/module/specs/NativeSkiaModule.web.js +5 -9
  113. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  114. package/lib/{commonjs/specs/SkiaPictureViewNativeComponent.d.ts → module/specs/SkiaViewNativeComponent.d.ts} +0 -3
  115. package/lib/module/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
  116. package/lib/module/specs/SkiaViewNativeComponent.js.map +1 -0
  117. package/lib/module/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  118. package/lib/module/specs/SkiaViewNativeComponent.web.js +21 -0
  119. package/lib/module/specs/SkiaViewNativeComponent.web.js.map +1 -0
  120. package/lib/module/views/SkiaGraphiteView.d.ts +3 -4
  121. package/lib/module/views/SkiaGraphiteView.js +23 -12
  122. package/lib/module/views/SkiaGraphiteView.js.map +1 -1
  123. package/lib/module/views/SkiaPictureView.d.ts +4 -1
  124. package/lib/module/views/SkiaPictureView.js +12 -10
  125. package/lib/module/views/SkiaPictureView.js.map +1 -1
  126. package/lib/module/views/SkiaView.web.d.ts +12 -0
  127. package/lib/module/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +80 -36
  128. package/lib/module/views/SkiaView.web.js.map +1 -0
  129. package/lib/module/views/SkiaWebRenderer.js +1 -1
  130. package/lib/module/views/SkiaWebRenderer.js.map +1 -1
  131. package/lib/module/views/android.d.ts +6 -0
  132. package/lib/module/views/android.js +10 -0
  133. package/lib/module/views/android.js.map +1 -0
  134. package/lib/module/views/types.d.ts +3 -12
  135. package/lib/module/views/types.js.map +1 -1
  136. package/lib/typescript/src/index.d.ts +1 -3
  137. package/lib/typescript/src/renderer/Canvas.d.ts +15 -12
  138. package/lib/typescript/src/skia/types/Graphite.d.ts +3 -3
  139. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +2 -2
  140. package/lib/typescript/src/skia/types/Skia.d.ts +1 -2
  141. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  142. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +5 -4
  143. package/lib/{module/specs/SkiaPictureViewNativeComponent.d.ts → typescript/src/specs/SkiaViewNativeComponent.d.ts} +0 -3
  144. package/lib/typescript/src/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  145. package/lib/typescript/src/views/SkiaGraphiteView.d.ts +3 -4
  146. package/lib/typescript/src/views/SkiaPictureView.d.ts +4 -1
  147. package/lib/typescript/src/views/SkiaView.web.d.ts +12 -0
  148. package/lib/typescript/src/views/android.d.ts +6 -0
  149. package/lib/typescript/src/views/types.d.ts +3 -12
  150. package/package.json +5 -13
  151. package/react-native-skia.podspec +34 -58
  152. package/src/Platform/Platform.web.tsx +1 -1
  153. package/src/external/reanimated/interpolators.ts +1 -1
  154. package/src/index.ts +1 -3
  155. package/src/mock/index.ts +0 -1
  156. package/src/renderer/Canvas.tsx +24 -28
  157. package/src/skia/types/Graphite.ts +3 -3
  158. package/src/skia/types/Image/ImageFactory.ts +2 -2
  159. package/src/skia/types/Skia.ts +1 -2
  160. package/src/skia/types/Surface/SurfaceFactory.ts +1 -1
  161. package/src/specs/NativeSkiaModule.web.ts +9 -21
  162. package/src/specs/{SkiaPictureViewNativeComponent.ts → SkiaViewNativeComponent.ts} +1 -4
  163. package/src/specs/{SkiaPictureViewNativeComponent.web.ts → SkiaViewNativeComponent.web.ts} +8 -10
  164. package/src/views/SkiaGraphiteView.tsx +27 -16
  165. package/src/views/SkiaPictureView.tsx +11 -10
  166. package/src/views/{SkiaGraphiteView.web.tsx → SkiaView.web.tsx} +100 -53
  167. package/src/views/SkiaWebRenderer.ts +1 -1
  168. package/src/views/android.ts +16 -0
  169. package/src/views/types.ts +3 -14
  170. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -92
  171. package/android/cpp/jni/include/JniSkiaGraphiteView.h +0 -176
  172. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -172
  173. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +0 -245
  174. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +0 -33
  175. package/android/cpp/rnskia-android/OpenGLContext.h +0 -248
  176. package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +0 -67
  177. package/android/cpp/rnskia-android/OpenGLWindowContext.h +0 -75
  178. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -67
  179. package/android/cpp/rnskia-android/gl/Context.h +0 -80
  180. package/android/cpp/rnskia-android/gl/Display.h +0 -123
  181. package/android/cpp/rnskia-android/gl/Error.cpp +0 -45
  182. package/android/cpp/rnskia-android/gl/Error.h +0 -8
  183. package/android/cpp/rnskia-android/gl/Surface.h +0 -43
  184. package/android/src/main/java/com/reactnative/skia/SkiaBaseViewManager.java +0 -65
  185. package/android/src/main/java/com/reactnative/skia/SkiaGraphiteView.java +0 -78
  186. package/android/src/main/java/com/reactnative/skia/SkiaGraphiteViewManager.java +0 -32
  187. package/android/src/main/java/com/reactnative/skia/SkiaPictureView.java +0 -105
  188. package/android/src/main/java/com/reactnative/skia/SkiaPictureViewManager.java +0 -44
  189. package/apple/MetalContext.h +0 -116
  190. package/apple/MetalContext.mm +0 -38
  191. package/apple/MetalWindowContext.h +0 -42
  192. package/apple/MetalWindowContext.mm +0 -95
  193. package/apple/RNSkAppleView.h +0 -49
  194. package/apple/RNSkAppleView.mm +0 -35
  195. package/apple/SkiaCVPixelBufferUtils.h +0 -122
  196. package/apple/SkiaCVPixelBufferUtils.mm +0 -535
  197. package/apple/SkiaGraphiteView.h +0 -26
  198. package/apple/SkiaGraphiteView.mm +0 -180
  199. package/apple/SkiaPictureView.h +0 -7
  200. package/apple/SkiaPictureView.mm +0 -70
  201. package/apple/SkiaUIView.h +0 -31
  202. package/apple/SkiaUIView.mm +0 -164
  203. package/cpp/rnskia/RNSkGraphiteView.h +0 -708
  204. package/cpp/rnskia/RNSkPictureView.cpp +0 -69
  205. package/cpp/rnskia/RNSkPictureView.h +0 -211
  206. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1162
  207. package/lib/commonjs/renderer/DefaultCanvas.d.ts +0 -8
  208. package/lib/commonjs/renderer/DefaultCanvas.js +0 -42
  209. package/lib/commonjs/renderer/DefaultCanvas.js.map +0 -1
  210. package/lib/commonjs/renderer/GraphiteCanvas.d.ts +0 -22
  211. package/lib/commonjs/renderer/GraphiteCanvas.js +0 -64
  212. package/lib/commonjs/renderer/GraphiteCanvas.js.map +0 -1
  213. package/lib/commonjs/renderer/GraphiteCanvas.web.d.ts +0 -1
  214. package/lib/commonjs/renderer/GraphiteCanvas.web.js +0 -13
  215. package/lib/commonjs/renderer/GraphiteCanvas.web.js.map +0 -1
  216. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  217. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js +0 -12
  218. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
  219. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  220. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js +0 -28
  221. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
  222. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +0 -1
  223. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  224. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +0 -29
  225. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
  226. package/lib/commonjs/views/SkiaGraphiteView.web.d.ts +0 -14
  227. package/lib/commonjs/views/SkiaGraphiteView.web.js.map +0 -1
  228. package/lib/commonjs/views/SkiaPictureView.web.d.ts +0 -11
  229. package/lib/commonjs/views/SkiaPictureView.web.js +0 -165
  230. package/lib/commonjs/views/SkiaPictureView.web.js.map +0 -1
  231. package/lib/module/renderer/DefaultCanvas.d.ts +0 -8
  232. package/lib/module/renderer/DefaultCanvas.js +0 -34
  233. package/lib/module/renderer/DefaultCanvas.js.map +0 -1
  234. package/lib/module/renderer/GraphiteCanvas.d.ts +0 -22
  235. package/lib/module/renderer/GraphiteCanvas.js +0 -57
  236. package/lib/module/renderer/GraphiteCanvas.js.map +0 -1
  237. package/lib/module/renderer/GraphiteCanvas.web.d.ts +0 -1
  238. package/lib/module/renderer/GraphiteCanvas.web.js +0 -4
  239. package/lib/module/renderer/GraphiteCanvas.web.js.map +0 -1
  240. package/lib/module/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  241. package/lib/module/specs/SkiaGraphiteViewNativeComponent.js +0 -8
  242. package/lib/module/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
  243. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  244. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js +0 -22
  245. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
  246. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +0 -1
  247. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  248. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +0 -23
  249. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
  250. package/lib/module/views/SkiaGraphiteView.web.d.ts +0 -14
  251. package/lib/module/views/SkiaGraphiteView.web.js.map +0 -1
  252. package/lib/module/views/SkiaPictureView.web.d.ts +0 -11
  253. package/lib/module/views/SkiaPictureView.web.js +0 -156
  254. package/lib/module/views/SkiaPictureView.web.js.map +0 -1
  255. package/lib/typescript/src/renderer/DefaultCanvas.d.ts +0 -8
  256. package/lib/typescript/src/renderer/GraphiteCanvas.d.ts +0 -22
  257. package/lib/typescript/src/renderer/GraphiteCanvas.web.d.ts +0 -1
  258. package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  259. package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  260. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  261. package/lib/typescript/src/views/SkiaGraphiteView.web.d.ts +0 -14
  262. package/lib/typescript/src/views/SkiaPictureView.web.d.ts +0 -11
  263. package/libs/.graphite +0 -1
  264. package/src/renderer/DefaultCanvas.tsx +0 -41
  265. package/src/renderer/GraphiteCanvas.tsx +0 -61
  266. package/src/renderer/GraphiteCanvas.web.tsx +0 -3
  267. package/src/specs/SkiaGraphiteViewNativeComponent.ts +0 -17
  268. package/src/specs/SkiaGraphiteViewNativeComponent.web.ts +0 -31
  269. package/src/views/SkiaPictureView.web.tsx +0 -224
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- import { Skia } from "../skia";
3
- import { Platform } from "../Platform";
4
- import { Canvas as PictureCanvas } from "./Canvas";
5
- import { GraphiteCanvas } from "./GraphiteCanvas";
6
- let useGraphite = null;
7
-
8
- // Whether this build runs the Graphite backend. Resolved on the first render
9
- // (the native API is installed by then) and cached: getNativeDevice() throws
10
- // on Ganesh builds. On the web, GraphiteCanvas is the regular canvas anyway.
11
- const hasGraphite = () => {
12
- if (useGraphite === null) {
13
- if (Platform.OS === "web") {
14
- useGraphite = false;
15
- } else {
16
- try {
17
- useGraphite = typeof Skia.getNativeDevice() === "bigint";
18
- } catch {
19
- useGraphite = false;
20
- }
21
- }
22
- }
23
- return useGraphite;
24
- };
25
-
26
- /**
27
- * `<Canvas>` renders {@link GraphiteCanvas} when React Native Skia is
28
- * configured with the Graphite backend (install-skia-graphite), and the
29
- * picture view based canvas otherwise. Both take the same props and ref.
30
- */
31
- export const Canvas = props => {
32
- return hasGraphite() ? /*#__PURE__*/React.createElement(GraphiteCanvas, props) : /*#__PURE__*/React.createElement(PictureCanvas, props);
33
- };
34
- //# sourceMappingURL=DefaultCanvas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","Skia","Platform","Canvas","PictureCanvas","GraphiteCanvas","useGraphite","hasGraphite","OS","getNativeDevice","props","createElement"],"sources":["DefaultCanvas.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\n\nimport type { CanvasProps } from \"./Canvas\";\nimport { Canvas as PictureCanvas } from \"./Canvas\";\nimport { GraphiteCanvas } from \"./GraphiteCanvas\";\n\nlet useGraphite: boolean | null = null;\n\n// Whether this build runs the Graphite backend. Resolved on the first render\n// (the native API is installed by then) and cached: getNativeDevice() throws\n// on Ganesh builds. On the web, GraphiteCanvas is the regular canvas anyway.\nconst hasGraphite = () => {\n if (useGraphite === null) {\n if (Platform.OS === \"web\") {\n useGraphite = false;\n } else {\n try {\n useGraphite = typeof Skia.getNativeDevice() === \"bigint\";\n } catch {\n useGraphite = false;\n }\n }\n }\n return useGraphite;\n};\n\n/**\n * `<Canvas>` renders {@link GraphiteCanvas} when React Native Skia is\n * configured with the Graphite backend (install-skia-graphite), and the\n * picture view based canvas otherwise. Both take the same props and ref.\n */\nexport const Canvas = (props: CanvasProps) => {\n return hasGraphite() ? (\n <GraphiteCanvas {...props} />\n ) : (\n <PictureCanvas {...props} />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,QAAQ,QAAQ,aAAa;AAGtC,SAASC,MAAM,IAAIC,aAAa,QAAQ,UAAU;AAClD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,IAAIC,WAA2B,GAAG,IAAI;;AAEtC;AACA;AACA;AACA,MAAMC,WAAW,GAAGA,CAAA,KAAM;EACxB,IAAID,WAAW,KAAK,IAAI,EAAE;IACxB,IAAIJ,QAAQ,CAACM,EAAE,KAAK,KAAK,EAAE;MACzBF,WAAW,GAAG,KAAK;IACrB,CAAC,MAAM;MACL,IAAI;QACFA,WAAW,GAAG,OAAOL,IAAI,CAACQ,eAAe,CAAC,CAAC,KAAK,QAAQ;MAC1D,CAAC,CAAC,MAAM;QACNH,WAAW,GAAG,KAAK;MACrB;IACF;EACF;EACA,OAAOA,WAAW;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMH,MAAM,GAAIO,KAAkB,IAAK;EAC5C,OAAOH,WAAW,CAAC,CAAC,gBAClBP,KAAA,CAAAW,aAAA,CAACN,cAAc,EAAKK,KAAQ,CAAC,gBAE7BV,KAAA,CAAAW,aAAA,CAACP,aAAa,EAAKM,KAAQ,CAC5B;AACH,CAAC","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- import type { CanvasProps } from "./Canvas";
3
- /**
4
- * The declarative canvas on the Graphite view. It takes the same props and
5
- * exposes the same ref as {@link Canvas}, and draws the same children, but
6
- * the frames are produced differently:
7
- *
8
- * - the JS thread records the scene graph into a native recorder once per
9
- * React commit and hands it to the view;
10
- * - the Reanimated UI runtime only reads the shared values into it (the one
11
- * step that needs a JS runtime), it never replays anything;
12
- * - a dedicated native thread pool replays the recorder into a Graphite
13
- * recording whenever the content changed, at most once per presented frame;
14
- * - the view presents the recording on the next vsync.
15
- *
16
- * Neither the JS thread nor the UI thread pays for drawing. It requires the
17
- * Graphite backend (install-skia-graphite); with the default backend the view
18
- * renders nothing. `colorSpace`, `android` and `androidWarmup` are accepted
19
- * for API compatibility and ignored: the Graphite view renders in sRGB and
20
- * uses its own backing view.
21
- */
22
- export declare const GraphiteCanvas: ({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, android, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
@@ -1,57 +0,0 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React from "react";
3
- import SkiaGraphiteViewNativeComponent from "../specs/SkiaGraphiteViewNativeComponent";
4
- import { useCanvasRoot } from "./Canvas";
5
-
6
- /**
7
- * The declarative canvas on the Graphite view. It takes the same props and
8
- * exposes the same ref as {@link Canvas}, and draws the same children, but
9
- * the frames are produced differently:
10
- *
11
- * - the JS thread records the scene graph into a native recorder once per
12
- * React commit and hands it to the view;
13
- * - the Reanimated UI runtime only reads the shared values into it (the one
14
- * step that needs a JS runtime), it never replays anything;
15
- * - a dedicated native thread pool replays the recorder into a Graphite
16
- * recording whenever the content changed, at most once per presented frame;
17
- * - the view presents the recording on the next vsync.
18
- *
19
- * Neither the JS thread nor the UI thread pays for drawing. It requires the
20
- * Graphite backend (install-skia-graphite); with the default backend the view
21
- * renders nothing. `colorSpace`, `android` and `androidWarmup` are accepted
22
- * for API compatibility and ignored: the Graphite view renders in sRGB and
23
- * uses its own backing view.
24
- */
25
- export const GraphiteCanvas = ({
26
- debug,
27
- opaque,
28
- children,
29
- onSize,
30
- colorSpace,
31
- highBitDepth = false,
32
- androidWarmup,
33
- android,
34
- ref,
35
- onLayout,
36
- ...viewProps
37
- }) => {
38
- const {
39
- nativeId,
40
- viewRef
41
- } = useCanvasRoot({
42
- children,
43
- onSize,
44
- ref,
45
- onLayout
46
- });
47
- return /*#__PURE__*/React.createElement(SkiaGraphiteViewNativeComponent, _extends({
48
- ref: viewRef,
49
- collapsable: false,
50
- nativeID: `${nativeId}`,
51
- debug: debug,
52
- opaque: opaque,
53
- highBitDepth: highBitDepth,
54
- onLayout: onLayout
55
- }, viewProps));
56
- };
57
- //# sourceMappingURL=GraphiteCanvas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","SkiaGraphiteViewNativeComponent","useCanvasRoot","GraphiteCanvas","debug","opaque","children","onSize","colorSpace","highBitDepth","androidWarmup","android","ref","onLayout","viewProps","nativeId","viewRef","createElement","_extends","collapsable","nativeID"],"sources":["GraphiteCanvas.tsx"],"sourcesContent":["import React from \"react\";\n\nimport SkiaGraphiteViewNativeComponent from \"../specs/SkiaGraphiteViewNativeComponent\";\n\nimport type { CanvasProps } from \"./Canvas\";\nimport { useCanvasRoot } from \"./Canvas\";\n\n/**\n * The declarative canvas on the Graphite view. It takes the same props and\n * exposes the same ref as {@link Canvas}, and draws the same children, but\n * the frames are produced differently:\n *\n * - the JS thread records the scene graph into a native recorder once per\n * React commit and hands it to the view;\n * - the Reanimated UI runtime only reads the shared values into it (the one\n * step that needs a JS runtime), it never replays anything;\n * - a dedicated native thread pool replays the recorder into a Graphite\n * recording whenever the content changed, at most once per presented frame;\n * - the view presents the recording on the next vsync.\n *\n * Neither the JS thread nor the UI thread pays for drawing. It requires the\n * Graphite backend (install-skia-graphite); with the default backend the view\n * renders nothing. `colorSpace`, `android` and `androidWarmup` are accepted\n * for API compatibility and ignored: the Graphite view renders in sRGB and\n * uses its own backing view.\n */\nexport const GraphiteCanvas = ({\n debug,\n opaque,\n children,\n onSize,\n\n colorSpace,\n highBitDepth = false,\n\n androidWarmup,\n\n android,\n ref,\n onLayout,\n ...viewProps\n}: CanvasProps) => {\n const { nativeId, viewRef } = useCanvasRoot({\n children,\n onSize,\n ref,\n onLayout,\n });\n return (\n <SkiaGraphiteViewNativeComponent\n ref={viewRef}\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n highBitDepth={highBitDepth}\n onLayout={onLayout}\n {...viewProps}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,+BAA+B,MAAM,0CAA0C;AAGtF,SAASC,aAAa,QAAQ,UAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAC;EAC7BC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACRC,MAAM;EAENC,UAAU;EACVC,YAAY,GAAG,KAAK;EAEpBC,aAAa;EAEbC,OAAO;EACPC,GAAG;EACHC,QAAQ;EACR,GAAGC;AACQ,CAAC,KAAK;EACjB,MAAM;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGd,aAAa,CAAC;IAC1CI,QAAQ;IACRC,MAAM;IACNK,GAAG;IACHC;EACF,CAAC,CAAC;EACF,oBACEb,KAAA,CAAAiB,aAAA,CAAChB,+BAA+B,EAAAiB,QAAA;IAC9BN,GAAG,EAAEI,OAAQ;IACbG,WAAW,EAAE,KAAM;IACnBC,QAAQ,EAAE,GAAGL,QAAQ,EAAG;IACxBX,KAAK,EAAEA,KAAM;IACbC,MAAM,EAAEA,MAAO;IACfI,YAAY,EAAEA,YAAa;IAC3BI,QAAQ,EAAEA;EAAS,GACfC,SAAS,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- export { Canvas as GraphiteCanvas } from "./Canvas";
@@ -1,4 +0,0 @@
1
- // The Graphite view is native only: on the web, GraphiteCanvas is the regular
2
- // Canvas.
3
- export { Canvas as GraphiteCanvas } from "./Canvas";
4
- //# sourceMappingURL=GraphiteCanvas.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Canvas","GraphiteCanvas"],"sources":["GraphiteCanvas.web.tsx"],"sourcesContent":["// The Graphite view is native only: on the web, GraphiteCanvas is the regular\n// Canvas.\nexport { Canvas as GraphiteCanvas } from \"./Canvas\";\n"],"mappings":"AAAA;AACA;AACA,SAASA,MAAM,IAAIC,cAAc,QAAQ,UAAU","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import { type ViewProps } from "react-native";
2
- import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
3
- export interface NativeProps extends ViewProps {
4
- debug?: boolean;
5
- opaque?: boolean;
6
- highBitDepth?: boolean;
7
- pointerEvents?: WithDefault<"auto" | "none" | "box-none" | "box-only", "auto">;
8
- }
9
- declare const _default: import("react-native").HostComponent<NativeProps>;
10
- export default _default;
@@ -1,8 +0,0 @@
1
- import { codegenNativeComponent } from "react-native";
2
-
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
- // @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings
5
-
6
- // eslint-disable-next-line import/no-default-export
7
- export default codegenNativeComponent("SkiaGraphiteView");
8
- //# sourceMappingURL=SkiaGraphiteViewNativeComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["codegenNativeComponent"],"sources":["SkiaGraphiteViewNativeComponent.ts"],"sourcesContent":["import { codegenNativeComponent, type ViewProps } from \"react-native\";\nimport type { WithDefault } from \"react-native/Libraries/Types/CodegenTypes\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n highBitDepth?: boolean;\n pointerEvents?: WithDefault<\n \"auto\" | \"none\" | \"box-none\" | \"box-only\",\n \"auto\"\n >;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaGraphiteView\");\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAwB,cAAc;;AAGrE;AACA;;AAWA;AACA,eAAeA,sBAAsB,CAAc,kBAAkB,CAAC","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { ViewProps } from "react-native";
2
- export interface NativeProps extends ViewProps {
3
- debug?: boolean;
4
- opaque?: boolean;
5
- highBitDepth?: boolean;
6
- nativeID: string;
7
- }
8
- declare const SkiaGraphiteViewNativeComponent: ({ nativeID, debug, opaque, highBitDepth, onLayout, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaGraphiteView.web").SkiaGraphiteViewProps>;
9
- export default SkiaGraphiteViewNativeComponent;
@@ -1,22 +0,0 @@
1
- import { createElement } from "react";
2
- import { SkiaGraphiteView } from "../views/SkiaGraphiteView.web";
3
- const SkiaGraphiteViewNativeComponent = ({
4
- nativeID,
5
- debug,
6
- opaque,
7
- highBitDepth,
8
- onLayout,
9
- ...viewProps
10
- }) => {
11
- return /*#__PURE__*/createElement(SkiaGraphiteView, {
12
- nativeID,
13
- debug,
14
- opaque,
15
- highBitDepth,
16
- onLayout,
17
- ...viewProps
18
- });
19
- };
20
- // eslint-disable-next-line import/no-default-export
21
- export default SkiaGraphiteViewNativeComponent;
22
- //# sourceMappingURL=SkiaGraphiteViewNativeComponent.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createElement","SkiaGraphiteView","SkiaGraphiteViewNativeComponent","nativeID","debug","opaque","highBitDepth","onLayout","viewProps"],"sources":["SkiaGraphiteViewNativeComponent.web.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport { createElement } from \"react\";\n\nimport { SkiaGraphiteView } from \"../views/SkiaGraphiteView.web\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n highBitDepth?: boolean;\n nativeID: string;\n}\n\nconst SkiaGraphiteViewNativeComponent = ({\n nativeID,\n debug,\n opaque,\n highBitDepth,\n onLayout,\n ...viewProps\n}: NativeProps) => {\n return createElement(SkiaGraphiteView, {\n nativeID,\n debug,\n opaque,\n highBitDepth,\n onLayout,\n ...viewProps,\n });\n};\n// eslint-disable-next-line import/no-default-export\nexport default SkiaGraphiteViewNativeComponent;\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,OAAO;AAErC,SAASC,gBAAgB,QAAQ,+BAA+B;AAShE,MAAMC,+BAA+B,GAAGA,CAAC;EACvCC,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,YAAY;EACZC,QAAQ;EACR,GAAGC;AACQ,CAAC,KAAK;EACjB,oBAAOR,aAAa,CAACC,gBAAgB,EAAE;IACrCE,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,YAAY;IACZC,QAAQ;IACR,GAAGC;EACL,CAAC,CAAC;AACJ,CAAC;AACD;AACA,eAAeN,+BAA+B","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["codegenNativeComponent"],"sources":["SkiaPictureViewNativeComponent.ts"],"sourcesContent":["import { codegenNativeComponent, type ViewProps } from \"react-native\";\nimport type { WithDefault } from \"react-native/Libraries/Types/CodegenTypes\";\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n colorSpace?: string;\n highBitDepth?: boolean;\n androidWarmup?: boolean;\n androidSurfaceType?: WithDefault<\n \"auto\" | \"SurfaceView\" | \"TextureView\",\n \"auto\"\n >;\n androidZOrderOnTop?: WithDefault<boolean, false>;\n pointerEvents?: WithDefault<\n \"auto\" | \"none\" | \"box-none\" | \"box-only\",\n \"auto\"\n >;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default codegenNativeComponent<NativeProps>(\"SkiaPictureView\");\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAwB,cAAc;;AAGrE;AACA;;AAkBA;AACA,eAAeA,sBAAsB,CAAc,iBAAiB,CAAC","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import type { ViewProps } from "react-native";
2
- export interface NativeProps extends ViewProps {
3
- debug?: boolean;
4
- opaque?: boolean;
5
- nativeID: string;
6
- androidSurfaceType?: "auto" | "SurfaceView" | "TextureView";
7
- androidZOrderOnTop?: boolean;
8
- }
9
- declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, androidSurfaceType: _androidSurfaceType, androidZOrderOnTop: _androidZOrderOnTop, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaPictureView.web").SkiaPictureViewProps>;
10
- export default SkiaPictureViewNativeComponent;
@@ -1,23 +0,0 @@
1
- import { createElement } from "react";
2
- import { SkiaPictureView } from "../views/SkiaPictureView.web";
3
- const SkiaPictureViewNativeComponent = ({
4
- nativeID,
5
- debug,
6
- opaque,
7
- onLayout,
8
- // Android-only, never reaches the DOM
9
- androidSurfaceType: _androidSurfaceType,
10
- androidZOrderOnTop: _androidZOrderOnTop,
11
- ...viewProps
12
- }) => {
13
- return /*#__PURE__*/createElement(SkiaPictureView, {
14
- nativeID,
15
- debug,
16
- opaque,
17
- onLayout,
18
- ...viewProps
19
- });
20
- };
21
- // eslint-disable-next-line import/no-default-export
22
- export default SkiaPictureViewNativeComponent;
23
- //# sourceMappingURL=SkiaPictureViewNativeComponent.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createElement","SkiaPictureView","SkiaPictureViewNativeComponent","nativeID","debug","opaque","onLayout","androidSurfaceType","_androidSurfaceType","androidZOrderOnTop","_androidZOrderOnTop","viewProps"],"sources":["SkiaPictureViewNativeComponent.web.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport { createElement } from \"react\";\n\nimport { SkiaPictureView } from \"../views/SkiaPictureView.web\";\n\nexport interface NativeProps extends ViewProps {\n debug?: boolean;\n opaque?: boolean;\n nativeID: string;\n androidSurfaceType?: \"auto\" | \"SurfaceView\" | \"TextureView\";\n androidZOrderOnTop?: boolean;\n}\n\nconst SkiaPictureViewNativeComponent = ({\n nativeID,\n debug,\n opaque,\n onLayout,\n // Android-only, never reaches the DOM\n androidSurfaceType: _androidSurfaceType,\n androidZOrderOnTop: _androidZOrderOnTop,\n ...viewProps\n}: NativeProps) => {\n return createElement(SkiaPictureView, {\n nativeID,\n debug,\n opaque,\n onLayout,\n ...viewProps,\n });\n};\n// eslint-disable-next-line import/no-default-export\nexport default SkiaPictureViewNativeComponent;\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,OAAO;AAErC,SAASC,eAAe,QAAQ,8BAA8B;AAU9D,MAAMC,8BAA8B,GAAGA,CAAC;EACtCC,QAAQ;EACRC,KAAK;EACLC,MAAM;EACNC,QAAQ;EACR;EACAC,kBAAkB,EAAEC,mBAAmB;EACvCC,kBAAkB,EAAEC,mBAAmB;EACvC,GAAGC;AACQ,CAAC,KAAK;EACjB,oBAAOX,aAAa,CAACC,eAAe,EAAE;IACpCE,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACR,GAAGK;EACL,CAAC,CAAC;AACJ,CAAC;AACD;AACA,eAAeT,8BAA8B","ignoreList":[]}
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import type { SkGraphiteContext } from "../skia/types";
3
- import type { SkiaGraphiteViewNativeProps } from "./types";
4
- export interface SkiaGraphiteViewRef {
5
- /**
6
- * The recording side of the view. Call it once the view is mounted.
7
- */
8
- getContext(): SkGraphiteContext;
9
- getNativeId(): number;
10
- }
11
- export interface SkiaGraphiteViewProps extends SkiaGraphiteViewNativeProps {
12
- ref?: React.Ref<SkiaGraphiteViewRef>;
13
- }
14
- export declare const SkiaGraphiteView: (props: SkiaGraphiteViewProps) => React.JSX.Element;
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useCallback","useEffect","useImperativeHandle","useMemo","useRef","JsiSkPictureRecorder","Platform","SkiaViewNativeId","useSkiaWebRenderer","WebGraphiteRecording","constructor","picture","_defineProperty","retain","holds","release","disposed","dispose","Symbol","WebGraphiteContext","target","width","getSize","height","beginRecording","recorder","Error","CanvasKit","PictureRecorder","x","y","finishRecording","finishRecordingAsPicture","submit","recording","SkiaGraphiteView","props","ref","onLayout","canvasRef","queueRef","shownRef","flushScheduledRef","nativeId","nativeID","undefined","Number","current","isStatic","__destroyWebGLContextAfterRender","present","renderer","frame","length","draw","map","previous","forEach","paint","rendererRef","flush","push","queueMicrotask","_canvasRef$current","_canvasRef$current2","clientWidth","clientHeight","getContext","redraw","makeImageSnapshot","rect","measure","callback","getBoundingClientRect","parentElement","offsetParent","parentRect","left","top","window","scrollX","scrollY","measureInWindow","getNativeId","api","global","SkiaViewApi","registerView","unregisterView","debug","_debug","opaque","_opaque","highBitDepth","_highBitDepth","_ref","_onLayout","_nativeID","_isStatic","viewProps","createElement","View","_extends","key","style","display"],"sources":["SkiaGraphiteView.web.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n} from \"react\";\n\nimport type {\n SkCanvas,\n SkGraphiteContext,\n SkGraphiteRecording,\n SkImage,\n SkPicture,\n SkRect,\n} from \"../skia/types\";\nimport { JsiSkPictureRecorder } from \"../skia/web/JsiSkPictureRecorder\";\nimport { Platform } from \"../Platform\";\nimport type {\n ISkiaViewApiWeb,\n SkiaGraphiteViewHandle,\n} from \"../specs/NativeSkiaModule.web\";\n\nimport type { SkiaGraphiteViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\nimport { useSkiaWebRenderer } from \"./SkiaWebRenderer\";\nimport type { Renderer } from \"./SkiaWebRenderer\";\n\n// The web has no Graphite: a recording is an SkPicture, replayed onto the\n// view's WebGL surface by the same renderer as SkiaPictureView (with its\n// context-loss handling and the destroy-context-after-render mode). Frames\n// keep their native semantics, presented in submission order and never\n// dropped, with one difference: the surface starts cleared on every frame,\n// so a recording draws the whole frame rather than a delta.\n\nexport interface SkiaGraphiteViewRef {\n /**\n * The recording side of the view. Call it once the view is mounted.\n */\n getContext(): SkGraphiteContext;\n getNativeId(): number;\n}\n\nexport interface SkiaGraphiteViewProps extends SkiaGraphiteViewNativeProps {\n ref?: React.Ref<SkiaGraphiteViewRef>;\n}\n\n/**\n * A frame recorded on the web. The view holds it while it is queued or on\n * screen: disposing it then only marks it, the picture is deleted once the\n * view lets go of it.\n */\nclass WebGraphiteRecording implements SkGraphiteRecording {\n readonly __typename__ = \"GraphiteRecording\" as const;\n private holds = 0;\n private disposed = false;\n\n constructor(readonly picture: SkPicture) {}\n\n retain() {\n this.holds++;\n }\n\n release() {\n this.holds--;\n if (this.disposed && this.holds === 0) {\n this.picture.dispose();\n }\n }\n\n dispose() {\n if (this.disposed) {\n return;\n }\n this.disposed = true;\n if (this.holds === 0) {\n this.picture.dispose();\n }\n }\n\n [Symbol.dispose]() {\n this.dispose();\n }\n}\n\ninterface RecordingTarget {\n getSize(): { width: number; height: number };\n submit(recording: WebGraphiteRecording): void;\n}\n\nclass WebGraphiteContext implements SkGraphiteContext {\n readonly __typename__ = \"GraphiteContext\" as const;\n private recorder: JsiSkPictureRecorder | null = null;\n\n constructor(private readonly target: RecordingTarget) {}\n\n get width() {\n return this.target.getSize().width;\n }\n\n get height() {\n return this.target.getSize().height;\n }\n\n beginRecording(): SkCanvas {\n if (this.recorder) {\n throw new Error(\n \"SkiaGraphiteView: a recording is already open, call finishRecording() first.\"\n );\n }\n const { width, height } = this.target.getSize();\n if (width <= 0 || height <= 0) {\n throw new Error(\"SkiaGraphiteView: the view has no size yet.\");\n }\n this.recorder = new JsiSkPictureRecorder(\n CanvasKit,\n new CanvasKit.PictureRecorder()\n );\n return this.recorder.beginRecording({ x: 0, y: 0, width, height });\n }\n\n finishRecording(): SkGraphiteRecording {\n if (!this.recorder) {\n throw new Error(\n \"SkiaGraphiteView: no recording is open, call beginRecording() first.\"\n );\n }\n const picture = this.recorder.finishRecordingAsPicture();\n this.recorder.dispose();\n this.recorder = null;\n return new WebGraphiteRecording(picture);\n }\n\n submit(recording: SkGraphiteRecording) {\n if (!(recording instanceof WebGraphiteRecording)) {\n throw new Error(\n \"SkiaGraphiteView: submit() expects a recording from finishRecording().\"\n );\n }\n this.target.submit(recording);\n }\n\n dispose() {}\n\n [Symbol.dispose]() {}\n}\n\nexport const SkiaGraphiteView = (props: SkiaGraphiteViewProps) => {\n const { ref, onLayout } = props;\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n // Recordings submitted since the last frame, in order, and the frame on\n // screen, replayed when the surface is recreated.\n const queueRef = useRef<WebGraphiteRecording[]>([]);\n const shownRef = useRef<WebGraphiteRecording[]>([]);\n const flushScheduledRef = useRef(false);\n const nativeId = useMemo(\n () =>\n props.nativeID !== undefined\n ? Number(props.nativeID)\n : SkiaViewNativeId.current++,\n [props.nativeID]\n );\n\n const isStatic = props.__destroyWebGLContextAfterRender === true;\n\n // Presents what was submitted since the last frame. A frame that cannot be\n // painted yet (unmeasured canvas, lost context) stays queued for the next\n // opportunity.\n const present = useCallback((renderer: Renderer) => {\n const frame = queueRef.current;\n if (frame.length === 0) {\n return;\n }\n queueRef.current = [];\n if (!renderer.draw(frame.map((recording) => recording.picture))) {\n queueRef.current = frame;\n return;\n }\n const previous = shownRef.current;\n shownRef.current = frame;\n previous.forEach((recording) => recording.release());\n }, []);\n\n const paint = useCallback(\n (renderer: Renderer) => {\n if (queueRef.current.length > 0) {\n present(renderer);\n } else if (shownRef.current.length > 0) {\n renderer.draw(shownRef.current.map((recording) => recording.picture));\n }\n },\n [present]\n );\n const rendererRef = useSkiaWebRenderer(canvasRef, isStatic, {\n paint,\n onLayout,\n });\n\n const flush = useCallback(() => {\n flushScheduledRef.current = false;\n if (rendererRef.current) {\n present(rendererRef.current);\n }\n }, [present, rendererRef]);\n\n // Frames are presented from a microtask rather than an animation frame:\n // the browser composites once per frame either way, and painting right\n // away keeps a frame recorded inside an animation callback from slipping\n // to the next one (see SkiaPictureView.web).\n const submit = useCallback(\n (recording: WebGraphiteRecording) => {\n recording.retain();\n queueRef.current.push(recording);\n if (!flushScheduledRef.current) {\n flushScheduledRef.current = true;\n queueMicrotask(flush);\n }\n },\n [flush]\n );\n\n const getSize = useCallback(\n () => ({\n width: canvasRef.current?.clientWidth || 0,\n height: canvasRef.current?.clientHeight || 0,\n }),\n []\n );\n\n const getContext = useCallback(\n (): SkGraphiteContext => new WebGraphiteContext({ getSize, submit }),\n [getSize, submit]\n );\n\n const redraw = useCallback(() => {\n if (rendererRef.current) {\n paint(rendererRef.current);\n }\n }, [paint, rendererRef]);\n\n const makeImageSnapshot = useCallback(\n (rect?: SkRect): SkImage | null => {\n const frame =\n queueRef.current.length > 0 ? queueRef.current : shownRef.current;\n if (!rendererRef.current || frame.length === 0) {\n return null;\n }\n return rendererRef.current.makeImageSnapshot(\n frame.map((recording) => recording.picture),\n rect\n );\n },\n [rendererRef]\n );\n\n const measure = useCallback(\n (\n callback: (\n x: number,\n y: number,\n width: number,\n height: number,\n pageX: number,\n pageY: number\n ) => void\n ) => {\n if (canvasRef.current) {\n const rect = canvasRef.current.getBoundingClientRect();\n const parentElement = canvasRef.current.offsetParent as HTMLElement;\n const parentRect = parentElement?.getBoundingClientRect() || {\n left: 0,\n top: 0,\n };\n callback(\n rect.left - parentRect.left,\n rect.top - parentRect.top,\n rect.width,\n rect.height,\n rect.left + window.scrollX,\n rect.top + window.scrollY\n );\n }\n },\n []\n );\n\n const measureInWindow = useCallback(\n (\n callback: (x: number, y: number, width: number, height: number) => void\n ) => {\n if (canvasRef.current) {\n const rect = canvasRef.current.getBoundingClientRect();\n callback(rect.left, rect.top, rect.width, rect.height);\n }\n },\n []\n );\n\n useImperativeHandle(\n ref,\n () => ({\n getContext,\n getNativeId: () => nativeId,\n }),\n [getContext, nativeId]\n );\n\n useEffect(() => {\n const api = global.SkiaViewApi as ISkiaViewApiWeb;\n api.registerView(`${nativeId}`, {\n getContext,\n getSize,\n redraw,\n makeImageSnapshot,\n measure,\n measureInWindow,\n } as SkiaGraphiteViewHandle);\n return () => {\n api.unregisterView(`${nativeId}`);\n };\n }, [\n getContext,\n getSize,\n redraw,\n makeImageSnapshot,\n measure,\n measureInWindow,\n nativeId,\n ]);\n\n // Let go of the recordings the view holds.\n useEffect(\n () => () => {\n queueRef.current.forEach((recording) => recording.release());\n queueRef.current = [];\n shownRef.current.forEach((recording) => recording.release());\n shownRef.current = [];\n },\n []\n );\n\n const {\n debug: _debug,\n opaque: _opaque,\n highBitDepth: _highBitDepth,\n ref: _ref,\n onLayout: _onLayout,\n nativeID: _nativeID,\n __destroyWebGLContextAfterRender: _isStatic,\n ...viewProps\n } = props;\n return (\n <Platform.View nativeID={`${nativeId}`} {...viewProps}>\n <canvas\n // A canvas element is bound to one context kind for life (WebGL for\n // the live renderer, 2D for the static one), so switching renderers\n // needs a fresh element.\n key={isStatic ? \"static\" : \"webgl\"}\n ref={canvasRef}\n style={{ display: \"block\", width: \"100%\", height: \"100%\" }}\n />\n </Platform.View>\n );\n};\n"],"mappings":";;;;AAAA;AACA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AAUd,SAASC,oBAAoB,QAAQ,kCAAkC;AACvE,SAASC,QAAQ,QAAQ,aAAa;AAOtC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,mBAAmB;;AAGtD;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA,MAAMC,oBAAoB,CAAgC;EAKxDC,WAAWA,CAAUC,OAAkB,EAAE;IAAA,KAApBA,OAAkB,GAAlBA,OAAkB;IAAAC,eAAA,uBAJf,mBAAmB;IAAAA,eAAA,gBAC3B,CAAC;IAAAA,eAAA,mBACE,KAAK;EAEkB;EAE1CC,MAAMA,CAAA,EAAG;IACP,IAAI,CAACC,KAAK,EAAE;EACd;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAACD,KAAK,EAAE;IACZ,IAAI,IAAI,CAACE,QAAQ,IAAI,IAAI,CAACF,KAAK,KAAK,CAAC,EAAE;MACrC,IA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,GAAG,EAAE0D,IAAI;IACTzD,QAAQ,EAAE0D,SAAS;IACnBpD,QAAQ,EAAEqD,SAAS;IACnBhD,gCAAgC,EAAEiD,SAAS;IAC3C,GAAGC;EACL,CAAC,GAAG/D,KAAK;EACT,oBACErC,KAAA,CAAAqG,aAAA,CAAC9F,QAAQ,CAAC+F,IAAI,EAAAC,QAAA;IAAC1D,QAAQ,EAAE,GAAGD,QAAQ;EAAG,GAAKwD,SAAS,gBACnDpG,KAAA,CAAAqG,aAAA;IACE;IACA;IACA;IACAG,GAAG,EAAEvD,QAAQ,GAAG,QAAQ,GAAG,OAAQ;IACnCX,GAAG,EAAEE,SAAU;IACfiE,KAAK,EAAE;MAAEC,OAAO,EAAE,OAAO;MAAEpF,KAAK,EAAE,MAAM;MAAEE,MAAM,EAAE;IAAO;EAAE,CAC5D,CACY,CAAC;AAEpB,CAAC","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import type { SkPicture } from "../skia/types";
3
- import type { SkiaWebViewHandle } from "../specs/NativeSkiaModule.web";
4
- import type { SkiaPictureViewNativeProps } from "./types";
5
- export interface SkiaPictureViewHandle extends SkiaWebViewHandle {
6
- setPicture(picture: SkPicture): void;
7
- }
8
- export interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {
9
- ref?: React.Ref<SkiaPictureViewHandle>;
10
- }
11
- export declare const SkiaPictureView: (props: SkiaPictureViewProps) => React.JSX.Element;
@@ -1,156 +0,0 @@
1
- /* global HTMLCanvasElement */
2
- import React, { useRef, useEffect, useCallback, useImperativeHandle } from "react";
3
- import { Platform } from "../Platform";
4
- import { SkiaViewNativeId } from "./SkiaViewNativeId";
5
- import { useSkiaWebRenderer } from "./SkiaWebRenderer";
6
- export const SkiaPictureView = props => {
7
- const {
8
- ref,
9
- picture,
10
- onLayout
11
- } = props;
12
- const canvasRef = useRef(null);
13
- const pictureRef = useRef(null);
14
- // Redraw requests coalesce into a single microtask. A microtask (not an
15
- // animation frame) so that a picture produced inside a rAF callback (the
16
- // Reanimated mapper) is drawn before the current frame paints: deferring
17
- // to the next rAF alternates between "flush pending in this frame" and
18
- // "flush scheduled for the next frame", drawing on every other frame
19
- // only and halving the effective frame rate. A picture dispatched before
20
- // the canvas has a size stays in pictureRef (drawing while unmeasured is
21
- // a no-op) and is painted by the resize path once the canvas becomes
22
- // measurable, so it is never lost.
23
- const redrawPendingRef = useRef(false);
24
- const flushScheduledRef = useRef(false);
25
- const isStatic = props.__destroyWebGLContextAfterRender === true;
26
- const paint = useCallback(renderer => {
27
- if (pictureRef.current) {
28
- redrawPendingRef.current = false;
29
- renderer.draw([pictureRef.current]);
30
- }
31
- }, []);
32
- const rendererRef = useSkiaWebRenderer(canvasRef, isStatic, {
33
- paint,
34
- onLayout
35
- });
36
- const flushRedraw = useCallback(() => {
37
- flushScheduledRef.current = false;
38
- if (redrawPendingRef.current && rendererRef.current && pictureRef.current) {
39
- redrawPendingRef.current = false;
40
- rendererRef.current.draw([pictureRef.current]);
41
- }
42
- // If the renderer or picture isn't available yet, the request stays
43
- // pending and is flushed by whichever arrives last.
44
- }, [rendererRef]);
45
- const redraw = useCallback(() => {
46
- redrawPendingRef.current = true;
47
- if (!flushScheduledRef.current) {
48
- flushScheduledRef.current = true;
49
- queueMicrotask(flushRedraw);
50
- }
51
- }, [flushRedraw]);
52
- const getSize = useCallback(() => {
53
- var _canvasRef$current, _canvasRef$current2;
54
- return {
55
- width: ((_canvasRef$current = canvasRef.current) === null || _canvasRef$current === void 0 ? void 0 : _canvasRef$current.clientWidth) || 0,
56
- height: ((_canvasRef$current2 = canvasRef.current) === null || _canvasRef$current2 === void 0 ? void 0 : _canvasRef$current2.clientHeight) || 0
57
- };
58
- }, []);
59
- const setPicture = useCallback(newPicture => {
60
- pictureRef.current = newPicture;
61
- redraw();
62
- }, [redraw]);
63
- const makeImageSnapshot = useCallback(rect => {
64
- if (rendererRef.current && pictureRef.current) {
65
- return rendererRef.current.makeImageSnapshot([pictureRef.current], rect);
66
- }
67
- return null;
68
- }, [rendererRef]);
69
- const measure = useCallback(callback => {
70
- if (canvasRef.current) {
71
- const rect = canvasRef.current.getBoundingClientRect();
72
- const parentElement = canvasRef.current.offsetParent;
73
- const parentRect = (parentElement === null || parentElement === void 0 ? void 0 : parentElement.getBoundingClientRect()) || {
74
- left: 0,
75
- top: 0
76
- };
77
-
78
- // x, y are relative to the parent
79
- const x = rect.left - parentRect.left;
80
- const y = rect.top - parentRect.top;
81
-
82
- // pageX, pageY are absolute screen coordinates
83
- const pageX = rect.left + window.scrollX;
84
- const pageY = rect.top + window.scrollY;
85
- callback(x, y, rect.width, rect.height, pageX, pageY);
86
- }
87
- }, []);
88
- const measureInWindow = useCallback(callback => {
89
- if (canvasRef.current) {
90
- const rect = canvasRef.current.getBoundingClientRect();
91
-
92
- // x, y are the absolute coordinates in the window
93
- const x = rect.left;
94
- const y = rect.top;
95
- callback(x, y, rect.width, rect.height);
96
- }
97
- }, []);
98
-
99
- // No flush cancellation is needed on unmount: a microtask queued before
100
- // unmount runs within the same task, and flushRedraw no-ops once the
101
- // layout-effect cleanup has nulled rendererRef.
102
-
103
- useImperativeHandle(ref, () => ({
104
- setPicture,
105
- getSize,
106
- redraw,
107
- makeImageSnapshot,
108
- measure,
109
- measureInWindow,
110
- get canvasRef() {
111
- return () => canvasRef.current;
112
- }
113
- }), [setPicture, getSize, redraw, makeImageSnapshot, measure, measureInWindow]);
114
- useEffect(() => {
115
- var _props$nativeID;
116
- const nativeID = (_props$nativeID = props.nativeID) !== null && _props$nativeID !== void 0 ? _props$nativeID : `${SkiaViewNativeId.current++}`;
117
- const api = global.SkiaViewApi;
118
- api.registerView(nativeID, {
119
- setPicture,
120
- getSize,
121
- redraw,
122
- makeImageSnapshot,
123
- measure,
124
- measureInWindow
125
- });
126
- return () => {
127
- api.unregisterView(nativeID);
128
- };
129
- }, [setPicture, getSize, redraw, makeImageSnapshot, measure, measureInWindow, props.nativeID]);
130
- useEffect(() => {
131
- if (picture) {
132
- setPicture(picture);
133
- }
134
- }, [setPicture, picture]);
135
- const {
136
- debug: _debug,
137
- ref: _ref,
138
- onLayout: _onLayout,
139
- picture: _picture,
140
- __destroyWebGLContextAfterRender: _isStatic,
141
- ...viewProps
142
- } = props;
143
- return /*#__PURE__*/React.createElement(Platform.View, viewProps, /*#__PURE__*/React.createElement("canvas", {
144
- // A canvas element is bound to one context kind for life (WebGL for
145
- // the live renderer, 2D for the static one), so switching renderers
146
- // needs a fresh element.
147
- key: isStatic ? "static" : "webgl",
148
- ref: canvasRef,
149
- style: {
150
- display: "block",
151
- width: "100%",
152
- height: "100%"
153
- }
154
- }));
155
- };
156
- //# sourceMappingURL=SkiaPictureView.web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useRef","useEffect","useCallback","useImperativeHandle","Platform","SkiaViewNativeId","useSkiaWebRenderer","SkiaPictureView","props","ref","picture","onLayout","canvasRef","pictureRef","redrawPendingRef","flushScheduledRef","isStatic","__destroyWebGLContextAfterRender","paint","renderer","current","draw","rendererRef","flushRedraw","redraw","queueMicrotask","getSize","_canvasRef$current","_canvasRef$current2","width","clientWidth","height","clientHeight","setPicture","newPicture","makeImageSnapshot","rect","measure","callback","getBoundingClientRect","parentElement","offsetParent","parentRect","left","top","x","y","pageX","window","scrollX","pageY","scrollY","measureInWindow","_props$nativeID","nativeID","api","global","SkiaViewApi","registerView","unregisterView","debug","_debug","_ref","_onLayout","_picture","_isStatic","viewProps","createElement","View","key","style","display"],"sources":["SkiaPictureView.web.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React, {\n useRef,\n useEffect,\n useCallback,\n useImperativeHandle,\n} from \"react\";\n\nimport type { SkRect, SkPicture, SkImage } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport type {\n ISkiaViewApiWeb,\n SkiaWebViewHandle,\n} from \"../specs/NativeSkiaModule.web\";\n\nimport type { SkiaPictureViewNativeProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\nimport { useSkiaWebRenderer } from \"./SkiaWebRenderer\";\nimport type { Renderer } from \"./SkiaWebRenderer\";\n\nexport interface SkiaPictureViewHandle extends SkiaWebViewHandle {\n setPicture(picture: SkPicture): void;\n}\n\nexport interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {\n ref?: React.Ref<SkiaPictureViewHandle>;\n}\n\nexport const SkiaPictureView = (props: SkiaPictureViewProps) => {\n const { ref, picture, onLayout } = props;\n const canvasRef = useRef<HTMLCanvasElement | null>(null);\n const pictureRef = useRef<SkPicture | null>(null);\n // Redraw requests coalesce into a single microtask. A microtask (not an\n // animation frame) so that a picture produced inside a rAF callback (the\n // Reanimated mapper) is drawn before the current frame paints: deferring\n // to the next rAF alternates between \"flush pending in this frame\" and\n // \"flush scheduled for the next frame\", drawing on every other frame\n // only and halving the effective frame rate. A picture dispatched before\n // the canvas has a size stays in pictureRef (drawing while unmeasured is\n // a no-op) and is painted by the resize path once the canvas becomes\n // measurable, so it is never lost.\n const redrawPendingRef = useRef(false);\n const flushScheduledRef = useRef(false);\n\n const isStatic = props.__destroyWebGLContextAfterRender === true;\n\n const paint = useCallback((renderer: Renderer) => {\n if (pictureRef.current) {\n redrawPendingRef.current = false;\n renderer.draw([pictureRef.current]);\n }\n }, []);\n const rendererRef = useSkiaWebRenderer(canvasRef, isStatic, {\n paint,\n onLayout,\n });\n\n const flushRedraw = useCallback(() => {\n flushScheduledRef.current = false;\n if (redrawPendingRef.current && rendererRef.current && pictureRef.current) {\n redrawPendingRef.current = false;\n rendererRef.current.draw([pictureRef.current]);\n }\n // If the renderer or picture isn't available yet, the request stays\n // pending and is flushed by whichever arrives last.\n }, [rendererRef]);\n\n const redraw = useCallback(() => {\n redrawPendingRef.current = true;\n if (!flushScheduledRef.current) {\n flushScheduledRef.current = true;\n queueMicrotask(flushRedraw);\n }\n }, [flushRedraw]);\n\n const getSize = useCallback(() => {\n return {\n width: canvasRef.current?.clientWidth || 0,\n height: canvasRef.current?.clientHeight || 0,\n };\n }, []);\n\n const setPicture = useCallback(\n (newPicture: SkPicture) => {\n pictureRef.current = newPicture;\n redraw();\n },\n [redraw]\n );\n\n const makeImageSnapshot = useCallback(\n (rect?: SkRect): SkImage | null => {\n if (rendererRef.current && pictureRef.current) {\n return rendererRef.current.makeImageSnapshot(\n [pictureRef.current],\n rect\n );\n }\n return null;\n },\n [rendererRef]\n );\n\n const measure = useCallback(\n (\n callback: (\n x: number,\n y: number,\n width: number,\n height: number,\n pageX: number,\n pageY: number\n ) => void\n ) => {\n if (canvasRef.current) {\n const rect = canvasRef.current.getBoundingClientRect();\n const parentElement = canvasRef.current.offsetParent as HTMLElement;\n const parentRect = parentElement?.getBoundingClientRect() || {\n left: 0,\n top: 0,\n };\n\n // x, y are relative to the parent\n const x = rect.left - parentRect.left;\n const y = rect.top - parentRect.top;\n\n // pageX, pageY are absolute screen coordinates\n const pageX = rect.left + window.scrollX;\n const pageY = rect.top + window.scrollY;\n\n callback(x, y, rect.width, rect.height, pageX, pageY);\n }\n },\n []\n );\n\n const measureInWindow = useCallback(\n (\n callback: (x: number, y: number, width: number, height: number) => void\n ) => {\n if (canvasRef.current) {\n const rect = canvasRef.current.getBoundingClientRect();\n\n // x, y are the absolute coordinates in the window\n const x = rect.left;\n const y = rect.top;\n\n callback(x, y, rect.width, rect.height);\n }\n },\n []\n );\n\n // No flush cancellation is needed on unmount: a microtask queued before\n // unmount runs within the same task, and flushRedraw no-ops once the\n // layout-effect cleanup has nulled rendererRef.\n\n useImperativeHandle(\n ref,\n () => ({\n setPicture,\n getSize,\n redraw,\n makeImageSnapshot,\n measure,\n measureInWindow,\n get canvasRef() {\n return () => canvasRef.current;\n },\n }),\n [setPicture, getSize, redraw, makeImageSnapshot, measure, measureInWindow]\n );\n\n useEffect(() => {\n const nativeID = props.nativeID ?? `${SkiaViewNativeId.current++}`;\n const api = global.SkiaViewApi as ISkiaViewApiWeb;\n api.registerView(nativeID, {\n setPicture,\n getSize,\n redraw,\n makeImageSnapshot,\n measure,\n measureInWindow,\n } as SkiaPictureViewHandle);\n return () => {\n api.unregisterView(nativeID);\n };\n }, [\n setPicture,\n getSize,\n redraw,\n makeImageSnapshot,\n measure,\n measureInWindow,\n props.nativeID,\n ]);\n\n useEffect(() => {\n if (picture) {\n setPicture(picture);\n }\n }, [setPicture, picture]);\n\n const {\n debug: _debug,\n ref: _ref,\n onLayout: _onLayout,\n picture: _picture,\n __destroyWebGLContextAfterRender: _isStatic,\n ...viewProps\n } = props;\n return (\n <Platform.View {...viewProps}>\n <canvas\n // A canvas element is bound to one context kind for life (WebGL for\n // the live renderer, 2D for the static one), so switching renderers\n // needs a fresh element.\n key={isStatic ? \"static\" : \"webgl\"}\n ref={canvasRef}\n style={{ display: \"block\", width: \"100%\", height: \"100%\" }}\n />\n </Platform.View>\n );\n};\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IACVC,MAAM,EACNC,SAAS,EACTC,WAAW,EACXC,mBAAmB,QACd,OAAO;AAGd,SAASC,QAAQ,QAAQ,aAAa;AAOtC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,mBAAmB;AAWtD,OAAO,MAAMC,eAAe,GAAIC,KAA2B,IAAK;EAC9D,MAAM;IAAEC,GAAG;IAAEC,OAAO;IAAEC;EAAS,CAAC,GAAGH,KAAK;EACxC,MAAMI,SAAS,GAAGZ,MAAM,CAA2B,IAAI,CAAC;EACxD,MAAMa,UAAU,GAAGb,MAAM,CAAmB,IAAI,CAAC;EACjD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMc,gBAAgB,GAAGd,MAAM,CAAC,KAAK,CAAC;EACtC,MAAMe,iBAAiB,GAAGf,MAAM,CAAC,KAAK,CAAC;EAEvC,MAAMgB,QAAQ,GAAGR,KAAK,CAACS,gCAAgC,KAAK,IAAI;EAEhE,MAAMC,KAAK,GAAGhB,WAAW,CAAEiB,QAAkB,IAAK;IAChD,IAAIN,UAAU,CAACO,OAAO,EAAE;MACtBN,gB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,MAAM,EACNW,iBAAiB,EACjBE,OAAO,EACPe,eAAe,EACf5C,KAAK,CAAC8C,QAAQ,CACf,CAAC;EAEFrD,SAAS,CAAC,MAAM;IACd,IAAIS,OAAO,EAAE;MACXuB,UAAU,CAACvB,OAAO,CAAC;IACrB;EACF,CAAC,EAAE,CAACuB,UAAU,EAAEvB,OAAO,CAAC,CAAC;EAEzB,MAAM;IACJkD,KAAK,EAAEC,MAAM;IACbpD,GAAG,EAAEqD,IAAI;IACTnD,QAAQ,EAAEoD,SAAS;IACnBrD,OAAO,EAAEsD,QAAQ;IACjB/C,gCAAgC,EAAEgD,SAAS;IAC3C,GAAGC;EACL,CAAC,GAAG1D,KAAK;EACT,oBACET,KAAA,CAAAoE,aAAA,CAAC/D,QAAQ,CAACgE,IAAI,EAAKF,SAAS,eAC1BnE,KAAA,CAAAoE,aAAA;IACE;IACA;IACA;IACAE,GAAG,EAAErD,QAAQ,GAAG,QAAQ,GAAG,OAAQ;IACnCP,GAAG,EAAEG,SAAU;IACf0D,KAAK,EAAE;MAAEC,OAAO,EAAE,OAAO;MAAE1C,KAAK,EAAE,MAAM;MAAEE,MAAM,EAAE;IAAO;EAAE,CAC5D,CACY,CAAC;AAEpB,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import type { CanvasProps } from "./Canvas";
3
- /**
4
- * `<Canvas>` renders {@link GraphiteCanvas} when React Native Skia is
5
- * configured with the Graphite backend (install-skia-graphite), and the
6
- * picture view based canvas otherwise. Both take the same props and ref.
7
- */
8
- export declare const Canvas: (props: CanvasProps) => React.JSX.Element;
@@ -1,22 +0,0 @@
1
- import React from "react";
2
- import type { CanvasProps } from "./Canvas";
3
- /**
4
- * The declarative canvas on the Graphite view. It takes the same props and
5
- * exposes the same ref as {@link Canvas}, and draws the same children, but
6
- * the frames are produced differently:
7
- *
8
- * - the JS thread records the scene graph into a native recorder once per
9
- * React commit and hands it to the view;
10
- * - the Reanimated UI runtime only reads the shared values into it (the one
11
- * step that needs a JS runtime), it never replays anything;
12
- * - a dedicated native thread pool replays the recorder into a Graphite
13
- * recording whenever the content changed, at most once per presented frame;
14
- * - the view presents the recording on the next vsync.
15
- *
16
- * Neither the JS thread nor the UI thread pays for drawing. It requires the
17
- * Graphite backend (install-skia-graphite); with the default backend the view
18
- * renders nothing. `colorSpace`, `android` and `androidWarmup` are accepted
19
- * for API compatibility and ignored: the Graphite view renders in sRGB and
20
- * uses its own backing view.
21
- */
22
- export declare const GraphiteCanvas: ({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, android, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
@@ -1 +0,0 @@
1
- export { Canvas as GraphiteCanvas } from "./Canvas";
@@ -1,10 +0,0 @@
1
- import { type ViewProps } from "react-native";
2
- import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
3
- export interface NativeProps extends ViewProps {
4
- debug?: boolean;
5
- opaque?: boolean;
6
- highBitDepth?: boolean;
7
- pointerEvents?: WithDefault<"auto" | "none" | "box-none" | "box-only", "auto">;
8
- }
9
- declare const _default: import("react-native").HostComponent<NativeProps>;
10
- export default _default;
@@ -1,9 +0,0 @@
1
- import type { ViewProps } from "react-native";
2
- export interface NativeProps extends ViewProps {
3
- debug?: boolean;
4
- opaque?: boolean;
5
- highBitDepth?: boolean;
6
- nativeID: string;
7
- }
8
- declare const SkiaGraphiteViewNativeComponent: ({ nativeID, debug, opaque, highBitDepth, onLayout, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaGraphiteView.web").SkiaGraphiteViewProps>;
9
- export default SkiaGraphiteViewNativeComponent;
@@ -1,10 +0,0 @@
1
- import type { ViewProps } from "react-native";
2
- export interface NativeProps extends ViewProps {
3
- debug?: boolean;
4
- opaque?: boolean;
5
- nativeID: string;
6
- androidSurfaceType?: "auto" | "SurfaceView" | "TextureView";
7
- androidZOrderOnTop?: boolean;
8
- }
9
- declare const SkiaPictureViewNativeComponent: ({ nativeID, debug, opaque, onLayout, androidSurfaceType: _androidSurfaceType, androidZOrderOnTop: _androidZOrderOnTop, ...viewProps }: NativeProps) => import("react").FunctionComponentElement<import("../views/SkiaPictureView.web").SkiaPictureViewProps>;
10
- export default SkiaPictureViewNativeComponent;
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import type { SkGraphiteContext } from "../skia/types";
3
- import type { SkiaGraphiteViewNativeProps } from "./types";
4
- export interface SkiaGraphiteViewRef {
5
- /**
6
- * The recording side of the view. Call it once the view is mounted.
7
- */
8
- getContext(): SkGraphiteContext;
9
- getNativeId(): number;
10
- }
11
- export interface SkiaGraphiteViewProps extends SkiaGraphiteViewNativeProps {
12
- ref?: React.Ref<SkiaGraphiteViewRef>;
13
- }
14
- export declare const SkiaGraphiteView: (props: SkiaGraphiteViewProps) => React.JSX.Element;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
- import type { SkPicture } from "../skia/types";
3
- import type { SkiaWebViewHandle } from "../specs/NativeSkiaModule.web";
4
- import type { SkiaPictureViewNativeProps } from "./types";
5
- export interface SkiaPictureViewHandle extends SkiaWebViewHandle {
6
- setPicture(picture: SkPicture): void;
7
- }
8
- export interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {
9
- ref?: React.Ref<SkiaPictureViewHandle>;
10
- }
11
- export declare const SkiaPictureView: (props: SkiaPictureViewProps) => React.JSX.Element;
package/libs/.graphite DELETED
@@ -1 +0,0 @@
1
- m154