react-native-skia 3.0.0 → 3.0.2

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 (261) hide show
  1. package/Package.swift +14 -13
  2. package/android/CMakeLists.txt +13 -42
  3. package/android/build.gradle +55 -47
  4. package/android/cpp/jni/JniLoad.cpp +2 -4
  5. package/android/cpp/jni/include/JniSkiaView.h +123 -0
  6. package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.cpp → RNSkAndroidCanvasProvider.cpp} +45 -100
  7. package/android/cpp/rnskia-android/{RNSkOpenGLCanvasProvider.h → RNSkAndroidCanvasProvider.h} +24 -22
  8. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -83
  9. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +0 -8
  10. package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +1 -2
  11. package/android/src/main/java/com/reactnative/skia/SkiaSurfaceView.java +1 -3
  12. package/android/src/main/java/com/reactnative/skia/SkiaTextureView.java +1 -17
  13. package/android/src/main/java/com/reactnative/skia/{SkiaBaseView.java → SkiaView.java} +78 -16
  14. package/android/src/main/java/com/reactnative/skia/SkiaViewManager.java +85 -0
  15. package/apple/MetalLayerColorSpace.mm +0 -4
  16. package/apple/RNSkApplePlatformContext.h +0 -14
  17. package/apple/RNSkApplePlatformContext.mm +2 -112
  18. package/apple/RNSkMetalCanvasProvider.h +14 -19
  19. package/apple/RNSkMetalCanvasProvider.mm +35 -68
  20. package/apple/SkiaView.h +20 -0
  21. package/apple/SkiaView.mm +210 -0
  22. package/cpp/api/JsiSkApi.h +2 -13
  23. package/cpp/api/JsiSkCanvas.h +4 -18
  24. package/cpp/api/JsiSkGraphiteContext.h +1 -5
  25. package/cpp/api/JsiSkGraphiteRecording.h +1 -5
  26. package/cpp/api/JsiSkImage.h +7 -41
  27. package/cpp/api/JsiSkImageFactory.h +0 -14
  28. package/cpp/api/JsiSkSurface.h +2 -16
  29. package/cpp/api/JsiSkSurfaceFactory.h +0 -8
  30. package/cpp/rnskia/RNDawnContext.h +6 -0
  31. package/cpp/rnskia/RNDawnInterop.cpp +0 -4
  32. package/cpp/rnskia/RNDawnUtils.h +0 -1
  33. package/cpp/rnskia/RNDawnWindowContext.cpp +10 -0
  34. package/cpp/rnskia/RNDawnWindowContext.h +4 -0
  35. package/cpp/rnskia/RNSkCanvasProvider.h +221 -0
  36. package/cpp/rnskia/RNSkGraphiteProducer.cpp +36 -14
  37. package/cpp/rnskia/RNSkGraphiteProducer.h +23 -8
  38. package/cpp/rnskia/RNSkGraphiteTarget.h +383 -0
  39. package/cpp/rnskia/RNSkJsiViewApi.h +9 -18
  40. package/cpp/rnskia/RNSkPlatformContext.h +9 -15
  41. package/cpp/rnskia/RNSkView.h +340 -245
  42. package/jestSetup.js +1 -3
  43. package/lib/commonjs/Platform/Platform.web.js +1 -1
  44. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  45. package/lib/commonjs/index.d.ts +1 -3
  46. package/lib/commonjs/index.js +3 -12
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/mock/index.js +0 -1
  49. package/lib/commonjs/mock/index.js.map +1 -1
  50. package/lib/commonjs/renderer/Canvas.d.ts +15 -12
  51. package/lib/commonjs/renderer/Canvas.js +24 -20
  52. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  53. package/lib/commonjs/skia/types/Graphite.d.ts +3 -3
  54. package/lib/commonjs/skia/types/Graphite.js.map +1 -1
  55. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +2 -2
  56. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  57. package/lib/commonjs/skia/types/Skia.d.ts +1 -2
  58. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  59. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  60. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  61. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +5 -4
  62. package/lib/commonjs/specs/NativeSkiaModule.web.js +5 -9
  63. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  64. package/lib/{typescript/src/specs/SkiaPictureViewNativeComponent.d.ts → commonjs/specs/SkiaViewNativeComponent.d.ts} +0 -3
  65. package/lib/commonjs/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
  66. package/lib/commonjs/specs/SkiaViewNativeComponent.js.map +1 -0
  67. package/lib/commonjs/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  68. package/lib/commonjs/specs/SkiaViewNativeComponent.web.js +27 -0
  69. package/lib/commonjs/specs/SkiaViewNativeComponent.web.js.map +1 -0
  70. package/lib/commonjs/views/SkiaGraphiteView.d.ts +3 -4
  71. package/lib/commonjs/views/SkiaGraphiteView.js +23 -12
  72. package/lib/commonjs/views/SkiaGraphiteView.js.map +1 -1
  73. package/lib/commonjs/views/SkiaPictureView.d.ts +4 -1
  74. package/lib/commonjs/views/SkiaPictureView.js +12 -10
  75. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  76. package/lib/commonjs/views/SkiaView.web.d.ts +12 -0
  77. package/lib/commonjs/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +82 -38
  78. package/lib/commonjs/views/SkiaView.web.js.map +1 -0
  79. package/lib/commonjs/views/SkiaWebRenderer.js +1 -1
  80. package/lib/commonjs/views/SkiaWebRenderer.js.map +1 -1
  81. package/lib/commonjs/views/android.d.ts +6 -0
  82. package/lib/commonjs/views/android.js +17 -0
  83. package/lib/commonjs/views/android.js.map +1 -0
  84. package/lib/commonjs/views/types.d.ts +3 -12
  85. package/lib/commonjs/views/types.js.map +1 -1
  86. package/lib/module/Platform/Platform.web.js +1 -1
  87. package/lib/module/Platform/Platform.web.js.map +1 -1
  88. package/lib/module/index.d.ts +1 -3
  89. package/lib/module/index.js +1 -3
  90. package/lib/module/index.js.map +1 -1
  91. package/lib/module/mock/index.js +0 -1
  92. package/lib/module/mock/index.js.map +1 -1
  93. package/lib/module/renderer/Canvas.d.ts +15 -12
  94. package/lib/module/renderer/Canvas.js +24 -19
  95. package/lib/module/renderer/Canvas.js.map +1 -1
  96. package/lib/module/skia/types/Graphite.d.ts +3 -3
  97. package/lib/module/skia/types/Graphite.js.map +1 -1
  98. package/lib/module/skia/types/Image/ImageFactory.d.ts +2 -2
  99. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  100. package/lib/module/skia/types/Skia.d.ts +1 -2
  101. package/lib/module/skia/types/Skia.js.map +1 -1
  102. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  103. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  104. package/lib/module/specs/NativeSkiaModule.web.d.ts +5 -4
  105. package/lib/module/specs/NativeSkiaModule.web.js +5 -9
  106. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  107. package/lib/{commonjs/specs/SkiaPictureViewNativeComponent.d.ts → module/specs/SkiaViewNativeComponent.d.ts} +0 -3
  108. package/lib/module/specs/{SkiaPictureViewNativeComponent.js → SkiaViewNativeComponent.js} +2 -2
  109. package/lib/module/specs/SkiaViewNativeComponent.js.map +1 -0
  110. package/lib/module/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  111. package/lib/module/specs/SkiaViewNativeComponent.web.js +21 -0
  112. package/lib/module/specs/SkiaViewNativeComponent.web.js.map +1 -0
  113. package/lib/module/views/SkiaGraphiteView.d.ts +3 -4
  114. package/lib/module/views/SkiaGraphiteView.js +23 -12
  115. package/lib/module/views/SkiaGraphiteView.js.map +1 -1
  116. package/lib/module/views/SkiaPictureView.d.ts +4 -1
  117. package/lib/module/views/SkiaPictureView.js +12 -10
  118. package/lib/module/views/SkiaPictureView.js.map +1 -1
  119. package/lib/module/views/SkiaView.web.d.ts +12 -0
  120. package/lib/module/views/{SkiaGraphiteView.web.js → SkiaView.web.js} +80 -36
  121. package/lib/module/views/SkiaView.web.js.map +1 -0
  122. package/lib/module/views/SkiaWebRenderer.js +1 -1
  123. package/lib/module/views/SkiaWebRenderer.js.map +1 -1
  124. package/lib/module/views/android.d.ts +6 -0
  125. package/lib/module/views/android.js +10 -0
  126. package/lib/module/views/android.js.map +1 -0
  127. package/lib/module/views/types.d.ts +3 -12
  128. package/lib/module/views/types.js.map +1 -1
  129. package/lib/typescript/src/index.d.ts +1 -3
  130. package/lib/typescript/src/renderer/Canvas.d.ts +15 -12
  131. package/lib/typescript/src/skia/types/Graphite.d.ts +3 -3
  132. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +2 -2
  133. package/lib/typescript/src/skia/types/Skia.d.ts +1 -2
  134. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +1 -1
  135. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +5 -4
  136. package/lib/{module/specs/SkiaPictureViewNativeComponent.d.ts → typescript/src/specs/SkiaViewNativeComponent.d.ts} +0 -3
  137. package/lib/typescript/src/specs/SkiaViewNativeComponent.web.d.ts +10 -0
  138. package/lib/typescript/src/views/SkiaGraphiteView.d.ts +3 -4
  139. package/lib/typescript/src/views/SkiaPictureView.d.ts +4 -1
  140. package/lib/typescript/src/views/SkiaView.web.d.ts +12 -0
  141. package/lib/typescript/src/views/android.d.ts +6 -0
  142. package/lib/typescript/src/views/types.d.ts +3 -12
  143. package/package.json +8 -16
  144. package/react-native-skia.podspec +50 -57
  145. package/src/Platform/Platform.web.tsx +1 -1
  146. package/src/index.ts +1 -3
  147. package/src/mock/index.ts +0 -1
  148. package/src/renderer/Canvas.tsx +23 -27
  149. package/src/skia/types/Graphite.ts +3 -3
  150. package/src/skia/types/Image/ImageFactory.ts +2 -2
  151. package/src/skia/types/Skia.ts +1 -2
  152. package/src/skia/types/Surface/SurfaceFactory.ts +1 -1
  153. package/src/specs/NativeSkiaModule.web.ts +9 -21
  154. package/src/specs/{SkiaPictureViewNativeComponent.ts → SkiaViewNativeComponent.ts} +1 -4
  155. package/src/specs/{SkiaPictureViewNativeComponent.web.ts → SkiaViewNativeComponent.web.ts} +8 -10
  156. package/src/views/SkiaGraphiteView.tsx +27 -16
  157. package/src/views/SkiaPictureView.tsx +11 -10
  158. package/src/views/{SkiaGraphiteView.web.tsx → SkiaView.web.tsx} +100 -53
  159. package/src/views/SkiaWebRenderer.ts +1 -1
  160. package/src/views/android.ts +16 -0
  161. package/src/views/types.ts +3 -14
  162. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -92
  163. package/android/cpp/jni/include/JniSkiaGraphiteView.h +0 -176
  164. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -172
  165. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +0 -245
  166. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +0 -33
  167. package/android/cpp/rnskia-android/OpenGLContext.h +0 -248
  168. package/android/cpp/rnskia-android/OpenGLWindowContext.cpp +0 -67
  169. package/android/cpp/rnskia-android/OpenGLWindowContext.h +0 -75
  170. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -67
  171. package/android/cpp/rnskia-android/gl/Context.h +0 -80
  172. package/android/cpp/rnskia-android/gl/Display.h +0 -123
  173. package/android/cpp/rnskia-android/gl/Error.cpp +0 -45
  174. package/android/cpp/rnskia-android/gl/Error.h +0 -8
  175. package/android/cpp/rnskia-android/gl/Surface.h +0 -43
  176. package/android/src/main/java/com/reactnative/skia/SkiaBaseViewManager.java +0 -65
  177. package/android/src/main/java/com/reactnative/skia/SkiaGraphiteView.java +0 -78
  178. package/android/src/main/java/com/reactnative/skia/SkiaGraphiteViewManager.java +0 -32
  179. package/android/src/main/java/com/reactnative/skia/SkiaPictureView.java +0 -105
  180. package/android/src/main/java/com/reactnative/skia/SkiaPictureViewManager.java +0 -44
  181. package/apple/MetalContext.h +0 -116
  182. package/apple/MetalContext.mm +0 -38
  183. package/apple/MetalWindowContext.h +0 -42
  184. package/apple/MetalWindowContext.mm +0 -95
  185. package/apple/RNSkAppleView.h +0 -49
  186. package/apple/RNSkAppleView.mm +0 -35
  187. package/apple/SkiaCVPixelBufferUtils.h +0 -122
  188. package/apple/SkiaCVPixelBufferUtils.mm +0 -535
  189. package/apple/SkiaGraphiteView.h +0 -26
  190. package/apple/SkiaGraphiteView.mm +0 -180
  191. package/apple/SkiaPictureView.h +0 -7
  192. package/apple/SkiaPictureView.mm +0 -70
  193. package/apple/SkiaUIView.h +0 -31
  194. package/apple/SkiaUIView.mm +0 -164
  195. package/cpp/rnskia/RNSkGraphiteView.h +0 -708
  196. package/cpp/rnskia/RNSkPictureView.cpp +0 -69
  197. package/cpp/rnskia/RNSkPictureView.h +0 -211
  198. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1162
  199. package/lib/commonjs/renderer/DefaultCanvas.d.ts +0 -8
  200. package/lib/commonjs/renderer/DefaultCanvas.js +0 -42
  201. package/lib/commonjs/renderer/DefaultCanvas.js.map +0 -1
  202. package/lib/commonjs/renderer/GraphiteCanvas.d.ts +0 -22
  203. package/lib/commonjs/renderer/GraphiteCanvas.js +0 -64
  204. package/lib/commonjs/renderer/GraphiteCanvas.js.map +0 -1
  205. package/lib/commonjs/renderer/GraphiteCanvas.web.d.ts +0 -1
  206. package/lib/commonjs/renderer/GraphiteCanvas.web.js +0 -13
  207. package/lib/commonjs/renderer/GraphiteCanvas.web.js.map +0 -1
  208. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  209. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js +0 -12
  210. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
  211. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  212. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js +0 -28
  213. package/lib/commonjs/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
  214. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +0 -1
  215. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  216. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +0 -29
  217. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
  218. package/lib/commonjs/views/SkiaGraphiteView.web.d.ts +0 -14
  219. package/lib/commonjs/views/SkiaGraphiteView.web.js.map +0 -1
  220. package/lib/commonjs/views/SkiaPictureView.web.d.ts +0 -11
  221. package/lib/commonjs/views/SkiaPictureView.web.js +0 -165
  222. package/lib/commonjs/views/SkiaPictureView.web.js.map +0 -1
  223. package/lib/module/renderer/DefaultCanvas.d.ts +0 -8
  224. package/lib/module/renderer/DefaultCanvas.js +0 -34
  225. package/lib/module/renderer/DefaultCanvas.js.map +0 -1
  226. package/lib/module/renderer/GraphiteCanvas.d.ts +0 -22
  227. package/lib/module/renderer/GraphiteCanvas.js +0 -57
  228. package/lib/module/renderer/GraphiteCanvas.js.map +0 -1
  229. package/lib/module/renderer/GraphiteCanvas.web.d.ts +0 -1
  230. package/lib/module/renderer/GraphiteCanvas.web.js +0 -4
  231. package/lib/module/renderer/GraphiteCanvas.web.js.map +0 -1
  232. package/lib/module/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  233. package/lib/module/specs/SkiaGraphiteViewNativeComponent.js +0 -8
  234. package/lib/module/specs/SkiaGraphiteViewNativeComponent.js.map +0 -1
  235. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  236. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js +0 -22
  237. package/lib/module/specs/SkiaGraphiteViewNativeComponent.web.js.map +0 -1
  238. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +0 -1
  239. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  240. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +0 -23
  241. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +0 -1
  242. package/lib/module/views/SkiaGraphiteView.web.d.ts +0 -14
  243. package/lib/module/views/SkiaGraphiteView.web.js.map +0 -1
  244. package/lib/module/views/SkiaPictureView.web.d.ts +0 -11
  245. package/lib/module/views/SkiaPictureView.web.js +0 -156
  246. package/lib/module/views/SkiaPictureView.web.js.map +0 -1
  247. package/lib/typescript/src/renderer/DefaultCanvas.d.ts +0 -8
  248. package/lib/typescript/src/renderer/GraphiteCanvas.d.ts +0 -22
  249. package/lib/typescript/src/renderer/GraphiteCanvas.web.d.ts +0 -1
  250. package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.d.ts +0 -10
  251. package/lib/typescript/src/specs/SkiaGraphiteViewNativeComponent.web.d.ts +0 -9
  252. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +0 -10
  253. package/lib/typescript/src/views/SkiaGraphiteView.web.d.ts +0 -14
  254. package/lib/typescript/src/views/SkiaPictureView.web.d.ts +0 -11
  255. package/libs/.graphite +0 -1
  256. package/src/renderer/DefaultCanvas.tsx +0 -41
  257. package/src/renderer/GraphiteCanvas.tsx +0 -61
  258. package/src/renderer/GraphiteCanvas.web.tsx +0 -3
  259. package/src/specs/SkiaGraphiteViewNativeComponent.ts +0 -17
  260. package/src/specs/SkiaGraphiteViewNativeComponent.web.ts +0 -31
  261. package/src/views/SkiaPictureView.web.tsx +0 -224
@@ -7,7 +7,7 @@ exports.Platform = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _types = require("../skia/types");
9
9
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
- // Layout is observed by the views themselves (see SkiaPictureView.web.tsx):
10
+ // Layout is observed by the views themselves (see SkiaView.web.tsx):
11
11
  // this shim only reproduces react-native-web's default View styling.
12
12
  const View = ({
13
13
  children,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_types","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","View","children","style","rawStyle","useMemo","cssStyles","alignItems","backgroundColor","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","textDecoration","zIndex","createElement","Platform","exports","OS","PixelRatio","window","devicePixelRatio","resolveAsset","source","asset","unwrapModule","isRNModule","getAssetByID","httpServerLocation","name","type","uri","Error","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport React, { useMemo } from \"react\";\nimport type { ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule, unwrapModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// Layout is observed by the views themselves (see SkiaPictureView.web.tsx):\n// this shim only reproduces react-native-web's default View styling.\nconst View = (({ children, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const cssStyles = useMemo(() => {\n return {\n alignItems: \"stretch\" as const,\n backgroundColor: \"transparent\" as const,\n border: \"0 solid black\" as const,\n boxSizing: \"border-box\" as const,\n display: \"flex\" as const,\n flexBasis: \"auto\" as const,\n flexDirection: \"column\" as const,\n flexShrink: 0,\n listStyle: \"none\" as const,\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: \"relative\" as const,\n textDecoration: \"none\" as const,\n zIndex: 0,\n ...style,\n };\n }, [style]);\n\n return <div style={cssStyles}>{children}</div>;\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: typeof window !== \"undefined\" ? window.devicePixelRatio : 1, // window is not defined on node\n resolveAsset: (source: DataModule) => {\n const asset = unwrapModule(source);\n if (typeof asset === \"string\") {\n return asset;\n }\n if (isRNModule(asset)) {\n if (typeof require === \"function\") {\n const {\n getAssetByID,\n } = require(\"react-native/Libraries/Image/AssetRegistry\");\n const { httpServerLocation, name, type } = getAssetByID(asset);\n const uri = `${httpServerLocation}/${name}.${type}`;\n return uri;\n }\n throw new Error(\n \"Asset source is a number - this is not supported on the web\"\n );\n }\n return asset.uri;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAAyD,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CA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,gBAAgB,GAAG,CAAC;EAAE;EACzEC,YAAY,EAAGC,MAAkB,IAAK;IACpC,MAAMC,KAAK,GAAG,IAAAC,mBAAY,EAACF,MAAM,CAAC;IAClC,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC7B,OAAOA,KAAK;IACd;IACA,IAAI,IAAAE,iBAAU,EAACF,KAAK,CAAC,EAAE;MACrB,IAAI,OAAOpD,OAAO,KAAK,UAAU,EAAE;QACjC,MAAM;UACJuD;QACF,CAAC,GAAGvD,OAAO,CAAC,4CAA4C,CAAC;QACzD,MAAM;UAAEwD,kBAAkB;UAAEC,IAAI;UAAEC;QAAK,CAAC,GAAGH,YAAY,CAACH,KAAK,CAAC;QAC9D,MAAMO,GAAG,GAAG,GAAGH,kBAAkB,IAAIC,IAAI,IAAIC,IAAI,EAAE;QACnD,OAAOC,GAAG;MACZ;MACA,MAAM,IAAIC,KAAK,CACb,6DACF,CAAC;IACH;IACA,OAAOR,KAAK,CAACO,GAAG;EAClB,CAAC;EACDE,cAAc,EAAEA,CAAA,KAAM;IACpB,MAAM,IAAID,KAAK,CAAC,4CAA4C,CAAC;EAC/D,CAAC;EACDvC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_types","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","View","children","style","rawStyle","useMemo","cssStyles","alignItems","backgroundColor","border","boxSizing","display","flexBasis","flexDirection","flexShrink","listStyle","margin","minHeight","minWidth","padding","position","textDecoration","zIndex","createElement","Platform","exports","OS","PixelRatio","window","devicePixelRatio","resolveAsset","source","asset","unwrapModule","isRNModule","getAssetByID","httpServerLocation","name","type","uri","Error","findNodeHandle"],"sources":["Platform.web.tsx"],"sourcesContent":["import type { CSSProperties } from \"react\";\nimport React, { useMemo } from \"react\";\nimport type { ViewComponent, ViewProps } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\nimport { isRNModule, unwrapModule } from \"../skia/types\";\n\nimport type { IPlatform } from \"./IPlatform\";\n\n// Layout is observed by the views themselves (see SkiaView.web.tsx):\n// this shim only reproduces react-native-web's default View styling.\nconst View = (({ children, style: rawStyle }: ViewProps) => {\n const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);\n const cssStyles = useMemo(() => {\n return {\n alignItems: \"stretch\" as const,\n backgroundColor: \"transparent\" as const,\n border: \"0 solid black\" as const,\n boxSizing: \"border-box\" as const,\n display: \"flex\" as const,\n flexBasis: \"auto\" as const,\n flexDirection: \"column\" as const,\n flexShrink: 0,\n listStyle: \"none\" as const,\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: \"relative\" as const,\n textDecoration: \"none\" as const,\n zIndex: 0,\n ...style,\n };\n }, [style]);\n\n return <div style={cssStyles}>{children}</div>;\n}) as unknown as typeof ViewComponent;\n\nexport const Platform: IPlatform = {\n OS: \"web\",\n PixelRatio: typeof window !== \"undefined\" ? window.devicePixelRatio : 1, // window is not defined on node\n resolveAsset: (source: DataModule) => {\n const asset = unwrapModule(source);\n if (typeof asset === \"string\") {\n return asset;\n }\n if (isRNModule(asset)) {\n if (typeof require === \"function\") {\n const {\n getAssetByID,\n } = require(\"react-native/Libraries/Image/AssetRegistry\");\n const { httpServerLocation, name, type } = getAssetByID(asset);\n const uri = `${httpServerLocation}/${name}.${type}`;\n return uri;\n }\n throw new Error(\n \"Asset source is a number - this is not supported on the web\"\n );\n }\n return asset.uri;\n },\n findNodeHandle: () => {\n throw new Error(\"findNodeHandle is not supported on the web\");\n },\n View,\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAAyD,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,C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EAClB,CAAC;EACDE,cAAc,EAAEA,CAAA,KAAM;IACpB,MAAM,IAAID,KAAK,CAAC,4CAA4C,CAAC;EAC/D,CAAC;EACDvC;AACF,CAAC","ignoreList":[]}
@@ -1,10 +1,8 @@
1
1
  import "./skia/NativeSetup";
2
2
  export { JsiSkImage } from "./skia/web/JsiSkImage";
3
3
  export * from "./renderer";
4
- export { useCanvasRef, useCanvasSize } from "./renderer/Canvas";
4
+ export { Canvas, useCanvasRef, useCanvasSize } from "./renderer/Canvas";
5
5
  export type { CanvasProps, CanvasRef } from "./renderer/Canvas";
6
- export { GraphiteCanvas } from "./renderer/GraphiteCanvas";
7
- export { Canvas } from "./renderer/DefaultCanvas";
8
6
  export * from "./renderer/Offscreen";
9
7
  export * from "./views";
10
8
  export * from "./skia";
@@ -5,21 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  JsiSkImage: true,
8
+ Canvas: true,
8
9
  useCanvasRef: true,
9
- useCanvasSize: true,
10
- GraphiteCanvas: true,
11
- Canvas: true
10
+ useCanvasSize: true
12
11
  };
13
12
  Object.defineProperty(exports, "Canvas", {
14
13
  enumerable: true,
15
14
  get: function () {
16
- return _DefaultCanvas.Canvas;
17
- }
18
- });
19
- Object.defineProperty(exports, "GraphiteCanvas", {
20
- enumerable: true,
21
- get: function () {
22
- return _GraphiteCanvas.GraphiteCanvas;
15
+ return _Canvas.Canvas;
23
16
  }
24
17
  });
25
18
  Object.defineProperty(exports, "JsiSkImage", {
@@ -55,8 +48,6 @@ Object.keys(_renderer).forEach(function (key) {
55
48
  });
56
49
  });
57
50
  var _Canvas = require("./renderer/Canvas");
58
- var _GraphiteCanvas = require("./renderer/GraphiteCanvas");
59
- var _DefaultCanvas = require("./renderer/DefaultCanvas");
60
51
  var _Offscreen = require("./renderer/Offscreen");
61
52
  Object.keys(_Offscreen).forEach(function (key) {
62
53
  if (key === "default" || key === "__esModule") return;
@@ -1 +1 @@
1
- {"version":3,"names":["require","_JsiSkImage","_renderer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Canvas","_GraphiteCanvas","_DefaultCanvas","_Offscreen","_views","_skia","_external","_animation","_types","_nodes"],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport { JsiSkImage } from \"./skia/web/JsiSkImage\";\nexport * from \"./renderer\";\nexport { useCanvasRef, useCanvasSize } from \"./renderer/Canvas\";\nexport type { CanvasProps, CanvasRef } from \"./renderer/Canvas\";\nexport { GraphiteCanvas } from \"./renderer/GraphiteCanvas\";\nexport { Canvas } from \"./renderer/DefaultCanvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,OAAA,GAAAf,OAAA;AAEA,IAAAgB,eAAA,GAAAhB,OAAA;AACA,IAAAiB,cAAA,GAAAjB,OAAA;AACA,IAAAkB,UAAA,GAAAlB,OAAA;AAAAG,MAAA,CAAA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AA,CAAAL,GAAA,MAAAiB,MAAA,CAAAjB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,MAAA,CAAAjB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAkB,MAAA,GAAAxB,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAoB,MAAA,EAAAnB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAkB,MAAA,CAAAlB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAU,MAAA,CAAAlB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["require","_JsiSkImage","_renderer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_Canvas","_Offscreen","_views","_skia","_external","_animation","_types","_nodes"],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport { JsiSkImage } from \"./skia/web/JsiSkImage\";\nexport * from \"./renderer\";\nexport { Canvas, useCanvasRef, useCanvasSize } from \"./renderer/Canvas\";\nexport type { CanvasProps, CanvasRef } from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;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canvas: require("react-native").View,
32
- GraphiteCanvas: require("react-native").View,
33
32
  getPreferredHighBitDepthCanvasFormat: () => "rgba16float",
34
33
  SkiaPictureView: require("react-native").View,
35
34
  SkiaGraphiteView: require("react-native").View,
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_JsiSkImage","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","JsiSkApi","Skia","Canvas","View","GraphiteCanvas","getPreferredHighBitDepthCanvasFormat","SkiaPictureView","SkiaGraphiteView","JsiSkImage","drawAsPicture","drawAsImage","drawAsImageFromPicture","useCanvasRef","useCanvasSize","ref","size","width","height","useValue","useComputedValue","useTiming","useLoop","useSpring","useClockValue","useValueEffect","isOnMainThread","useClock","usePathInterpolation","useImageAsTexture","useTextureValue","useTextureValueFromPicture","useRSXformBuffer","usePointBuffer","useColorBuffer","useRectBuffer","useBuffer","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG","useVideo","exports"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { JsiSkImage } from \"../skia/web/JsiSkImage\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n global.SkiaApi = JsiSkApi(CanvasKit);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n Canvas: require(\"react-native\").View,\n GraphiteCanvas: require(\"react-native\").View,\n getPreferredHighBitDepthCanvasFormat: () => \"rgba16float\",\n SkiaPictureView: require(\"react-native\").View,\n SkiaGraphiteView: require(\"react-native\").View,\n JsiSkImage: JsiSkImage,\n drawAsPicture: Noop,\n drawAsImage: Noop,\n drawAsImageFromPicture: Noop,\n useCanvasRef: NoopValue,\n useCanvasSize: () => ({\n ref: {\n current: 0,\n },\n size: {\n width: 0,\n height: 0,\n },\n }),\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n isOnMainThread: () => true,\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useImageAsTexture: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRSXformBuffer: NoopSharedValue,\n usePointBuffer: NoopSharedValue,\n useColorBuffer: NoopSharedValue,\n useRectBuffer: NoopSharedValue,\n useBuffer: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n useVideo: () => null,\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA;AACA,MAAME,IAAe,GAAGA,CAAA,KAAMC,SAAS;AACvC,MAAMC,SAAS,GAAGA,CAAA,MAAO;EAAEC,OAAO,EAAE;AAAE,CAAC,CAAC;AACxC,MAAMC,eAAe,GAAGA,CAAA,MAAO;EAAEC,KAAK,EAAE;AAAE,CAAC,CAAC;AAErC,MAAMC,IAAI,GAAIC,SAAoB,IAAK;EAC5C;EACA;EACAC,MAAM,CAACC,OAAO,GAAG,IAAAC,aAAQ,EAACH,SAAS,CAAC;EACpC;EACA;EACA,MAAMI,IAAI,GAAGH,MAAM,CAACC,OAAO;EAC3B,OAAO;IACLE,IAAI;IACJ,GAAGb,OAAO,CAAC,wBAAwB,CAAC;IACpC,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/BwC,aAAa,EAAExC,eAAe;IAC9ByC,SAAS,EAAEzC,eAAe;IAC1B0C,UAAU,EAAE9C,IAAI;IAChB+C,OAAO,EAAE/C,IAAI;IACbgD,OAAO,EAAEA,CAAA,KAAMrC,IAAI,CAACsC,IAAI,CAAChD,SAAS,EAAE,CAAC,CAAC;IACtCiD,QAAQ,EAAElD,IAAI;IACdmD,WAAW,EAAEA,CAAA,KAAM,IAAI;IACvBC,QAAQ,EAAEA,CAAA,KAAM,IAAI;IACpBC,MAAM,EAAEA,CAAA,KAAM,IAAI;IAClBC,QAAQ,EAAEA,CAAA,KAAM;EAClB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAjD,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_web","require","_JsiSkImage","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","JsiSkApi","Skia","Canvas","View","getPreferredHighBitDepthCanvasFormat","SkiaPictureView","SkiaGraphiteView","JsiSkImage","drawAsPicture","drawAsImage","drawAsImageFromPicture","useCanvasRef","useCanvasSize","ref","size","width","height","useValue","useComputedValue","useTiming","useLoop","useSpring","useClockValue","useValueEffect","isOnMainThread","useClock","usePathInterpolation","useImageAsTexture","useTextureValue","useTextureValueFromPicture","useRSXformBuffer","usePointBuffer","useColorBuffer","useRectBuffer","useBuffer","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG","useVideo","exports"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { JsiSkImage } from \"../skia/web/JsiSkImage\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n global.SkiaApi = JsiSkApi(CanvasKit);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n Canvas: require(\"react-native\").View,\n getPreferredHighBitDepthCanvasFormat: () => \"rgba16float\",\n SkiaPictureView: require(\"react-native\").View,\n SkiaGraphiteView: require(\"react-native\").View,\n JsiSkImage: JsiSkImage,\n drawAsPicture: Noop,\n drawAsImage: Noop,\n drawAsImageFromPicture: Noop,\n useCanvasRef: NoopValue,\n useCanvasSize: () => ({\n ref: {\n current: 0,\n },\n size: {\n width: 0,\n height: 0,\n },\n }),\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n isOnMainThread: () => true,\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useImageAsTexture: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRSXformBuffer: NoopSharedValue,\n usePointBuffer: NoopSharedValue,\n useColorBuffer: NoopSharedValue,\n useRectBuffer: NoopSharedValue,\n useBuffer: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n useVideo: () => null,\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA;AACA,MAAME,IAAe,GAAGA,CAAA,KAAMC,SAAS;AACvC,MAAMC,SAAS,GAAGA,CAAA,MAAO;EAAEC,OAAO,EAAE;AAAE,CAAC,CAAC;AACxC,MAAMC,eAAe,GAAGA,CAAA,MAAO;EAAEC,KAAK,EAAE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B,EAAEhC,eAAe;IACrCiC,iBAAiB,EAAEjC,eAAe;IAClCkC,eAAe,EAAElC,eAAe;IAChCmC,0BAA0B,EAAEnC,eAAe;IAC3CoC,gBAAgB,EAAEpC,eAAe;IACjCqC,cAAc,EAAErC,eAAe;IAC/BsC,cAAc,EAAEtC,eAAe;IAC/BuC,aAAa,EAAEvC,eAAe;IAC9BwC,SAAS,EAAExC,eAAe;IAC1ByC,UAAU,EAAE7C,IAAI;IAChB8C,OAAO,EAAE9C,IAAI;IACb+C,OAAO,EAAEA,CAAA,KAAMpC,IAAI,CAACqC,IAAI,CAAC/C,SAAS,EAAE,CAAC,CAAC;IACtCgD,QAAQ,EAAEjD,IAAI;IACdkD,WAAW,EAAEA,CAAA,KAAM,IAAI;IACvBC,QAAQ,EAAEA,CAAA,KAAM,IAAI;IACpBC,MAAM,EAAEA,CAAA,KAAM,IAAI;IAClBC,QAAQ,EAAEA,CAAA,KAAM;EAClB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAhD,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import type { FC, RefObject } from "react";
2
2
  import React from "react";
3
- import type { MeasureInWindowOnSuccessCallback, MeasureOnSuccessCallback, View, ViewProps } from "react-native";
3
+ import type { MeasureInWindowOnSuccessCallback, MeasureOnSuccessCallback, ViewProps } from "react-native";
4
4
  import type { SharedValue } from "react-native-reanimated";
5
5
  import type { AndroidCanvasProps } from "../views/types";
6
6
  import type { SkImage, SkRect, SkSize } from "../skia/types";
@@ -18,7 +18,6 @@ export declare const useCanvasSize: (userRef?: RefObject<CanvasRef | null>) => {
18
18
  size: SkSize;
19
19
  };
20
20
  export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
21
- debug?: boolean;
22
21
  /** @deprecated Not supported on native. Use `onSize` or `useCanvasSize()` instead. */
23
22
  onLayout?: ViewProps["onLayout"];
24
23
  /**
@@ -29,7 +28,6 @@ export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
29
28
  */
30
29
  opaque?: boolean;
31
30
  onSize?: SharedValue<SkSize>;
32
- colorSpace?: "p3" | "srgb";
33
31
  /**
34
32
  * Renders into a surface with more than 8 bits per channel (16-bit float on
35
33
  * iOS, 10-bit on Android) to avoid banding in subtle gradients. Colors are
@@ -42,16 +40,21 @@ export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
42
40
  /** Android-only rendering options. Ignored on iOS and web. */
43
41
  android?: AndroidCanvasProps;
44
42
  ref?: React.Ref<CanvasRef>;
45
- androidWarmup?: boolean;
46
43
  __destroyWebGLContextAfterRender?: boolean;
47
44
  }
48
45
  /**
49
- * What every canvas shares, whichever native view it renders into: the native
50
- * id, the scene graph root rendered into it, the `onSize` measurement and the
51
- * imperative handle of the ref.
46
+ * The declarative canvas. Its children are rendered by Skia's own React
47
+ * renderer; the frames are produced off the JS thread:
48
+ *
49
+ * - the JS thread records the scene graph into a native recorder once per
50
+ * React commit and hands it to the view;
51
+ * - the Reanimated UI runtime only reads the shared values into it (the one
52
+ * step that needs a JS runtime), it never replays anything;
53
+ * - a dedicated native thread pool replays the recorder into a Graphite
54
+ * recording whenever the content changed, at most once per presented frame;
55
+ * - the view presents the recording on the next vsync.
56
+ *
57
+ * On the web the scene is drawn into a picture on the JS thread and painted
58
+ * on a WebGL canvas.
52
59
  */
53
- export declare const useCanvasRoot: ({ children, onSize, ref, onLayout, }: Pick<CanvasProps, "children" | "onSize" | "ref" | "onLayout">) => {
54
- nativeId: number;
55
- viewRef: RefObject<View | null>;
56
- };
57
- export declare const Canvas: ({ debug, opaque, children, onSize, colorSpace, highBitDepth, androidWarmup, android, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
60
+ export declare const Canvas: ({ opaque, children, onSize, highBitDepth, android, ref, onLayout, ...viewProps }: CanvasProps) => React.JSX.Element;
@@ -3,11 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useCanvasSize = exports.useCanvasRoot = exports.useCanvasRef = exports.Canvas = void 0;
6
+ exports.useCanvasSize = exports.useCanvasRef = exports.Canvas = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _ReanimatedProxy = _interopRequireDefault(require("../external/reanimated/ReanimatedProxy"));
9
9
  var _SkiaViewNativeId = require("../views/SkiaViewNativeId");
10
- var _SkiaPictureViewNativeComponent = _interopRequireDefault(require("../specs/SkiaPictureViewNativeComponent"));
10
+ var _android = require("../views/android");
11
+ var _SkiaViewNativeComponent = _interopRequireDefault(require("../specs/SkiaViewNativeComponent"));
11
12
  var _Reconciler = require("../sksg/Reconciler");
12
13
  var _skia = require("../skia");
13
14
  var _Platform = require("../Platform");
@@ -44,14 +45,9 @@ const useCanvasSize = userRef => {
44
45
  };
45
46
  };
46
47
  exports.useCanvasSize = useCanvasSize;
47
- // Anything else reaching the native component would hit the generated
48
- // string-enum parser, which aborts on unknown values.
49
- const resolveSurfaceType = surfaceType => surfaceType === "SurfaceView" || surfaceType === "TextureView" ? surfaceType : "auto";
50
-
51
48
  /**
52
- * What every canvas shares, whichever native view it renders into: the native
53
- * id, the scene graph root rendered into it, the `onSize` measurement and the
54
- * imperative handle of the ref.
49
+ * What the canvas owns: the native id, the scene graph root rendered into it,
50
+ * the `onSize` measurement and the imperative handle of the ref.
55
51
  */
56
52
  const useCanvasRoot = ({
57
53
  children,
@@ -142,15 +138,27 @@ const useCanvasRoot = ({
142
138
  viewRef
143
139
  };
144
140
  };
145
- exports.useCanvasRoot = useCanvasRoot;
141
+
142
+ /**
143
+ * The declarative canvas. Its children are rendered by Skia's own React
144
+ * renderer; the frames are produced off the JS thread:
145
+ *
146
+ * - the JS thread records the scene graph into a native recorder once per
147
+ * React commit and hands it to the view;
148
+ * - the Reanimated UI runtime only reads the shared values into it (the one
149
+ * step that needs a JS runtime), it never replays anything;
150
+ * - a dedicated native thread pool replays the recorder into a Graphite
151
+ * recording whenever the content changed, at most once per presented frame;
152
+ * - the view presents the recording on the next vsync.
153
+ *
154
+ * On the web the scene is drawn into a picture on the JS thread and painted
155
+ * on a WebGL canvas.
156
+ */
146
157
  const Canvas = ({
147
- debug,
148
158
  opaque,
149
159
  children,
150
160
  onSize,
151
- colorSpace = "p3",
152
161
  highBitDepth = false,
153
- androidWarmup = false,
154
162
  android,
155
163
  ref,
156
164
  onLayout,
@@ -180,17 +188,13 @@ const Canvas = ({
180
188
  };
181
189
  }
182
190
  }, [onLayout, onSize]);
183
- return /*#__PURE__*/_react.default.createElement(_SkiaPictureViewNativeComponent.default, _extends({
191
+ return /*#__PURE__*/_react.default.createElement(_SkiaViewNativeComponent.default, _extends({
184
192
  ref: viewRef,
185
193
  collapsable: false,
186
194
  nativeID: `${nativeId}`,
187
- debug: debug,
188
195
  opaque: opaque,
189
- colorSpace: colorSpace,
190
- highBitDepth: highBitDepth,
191
- androidWarmup: androidWarmup,
192
- androidSurfaceType: resolveSurfaceType(android === null || android === void 0 ? void 0 : android.surfaceType),
193
- androidZOrderOnTop: !!(android !== null && android !== void 0 && android.zOrderOnTop),
196
+ highBitDepth: highBitDepth
197
+ }, (0, _android.androidNativeProps)(android), {
194
198
  onLayout: _Platform.Platform.OS === "web" && (onSize || onLayout) ? onLayoutWeb : onLayout
195
199
  }, viewProps));
196
200
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_ReanimatedProxy","_interopRequireDefault","_SkiaViewNativeId","_SkiaPictureViewNativeComponent","_Reconciler","_skia","_Platform","_external","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useReanimatedFrame","HAS_REANIMATED_3","Rea","useFrameCallback","measure","useCanvasRefPriv","useAnimatedRef","useCanvasSize","userRef","ourRef","ref","size","setSize","useState","width","height","useLayoutEffect","current","_x","_y","resolveSurfaceType","surfaceType","useCanvasRoot","children","onSize","onLayout","Platform","OS","console","error","viewRef","nativeId","useMemo","SkiaViewNativeId","root","SkiaSGRoot","Skia","_viewRef$current","result","canvasRef","value","render","useEffect","unmount","useImperativeHandle","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","callback","_viewRef$current2","measureInWindow","_viewRef$current3","Canvas","debug","opaque","colorSpace","highBitDepth","androidWarmup","android","viewProps","onLayoutWeb","useCallback","nativeEvent","layout","createElement","collapsable","nativeID","androidSurfaceType","androidZOrderOnTop","zOrderOnTop"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC, RefObject } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n LayoutChangeEvent,\n MeasureInWindowOnSuccessCallback,\n MeasureOnSuccessCallback,\n View,\n ViewProps,\n} from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport type { AndroidCanvasProps, AndroidSurfaceType } from \"../views/types\";\nimport SkiaPictureViewNativeComponent from \"../specs/SkiaPictureViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\nimport { HAS_REANIMATED_3 } from \"../external\";\n\nexport interface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n measure(callback: MeasureOnSuccessCallback): void;\n measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\nconst useReanimatedFrame = !HAS_REANIMATED_3 ? () => {} : Rea.useFrameCallback;\nconst measure = !HAS_REANIMATED_3 ? null : Rea.measure;\n\nconst useCanvasRefPriv: typeof useRef<View> = !HAS_REANIMATED_3\n ? useRef\n : Rea.useAnimatedRef;\n\nexport const useCanvasSize = (userRef?: RefObject<CanvasRef | null>) => {\n const ourRef = useCanvasRef();\n const ref = userRef ?? ourRef;\n const [size, setSize] = useState<SkSize>({ width: 0, height: 0 });\n useLayoutEffect(() => {\n if (ref.current) {\n ref.current.measure((_x, _y, width, height) => {\n setSize({ width, height });\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return { ref, size };\n};\n\nexport interface CanvasProps extends Omit<ViewProps, \"onLayout\"> {\n debug?: boolean;\n /** @deprecated Not supported on native. Use `onSize` or `useCanvasSize()` instead. */\n onLayout?: ViewProps[\"onLayout\"];\n /**\n * Declares that the canvas covers every pixel of its bounds, so nothing\n * behind it needs to show through. On Android an opaque canvas is backed by\n * a `SurfaceView` by default, the cheapest path (see `android.surfaceType`).\n * Defaults to false.\n */\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n colorSpace?: \"p3\" | \"srgb\";\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. Colors are\n * identical to the default 8-bit surface, only with more precision (this is\n * about bit depth, not HDR). On Android the extra precision survives\n * composition only when combined with `opaque`, and the prop must be set\n * before the canvas is mounted.\n */\n highBitDepth?: boolean;\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n ref?: React.Ref<CanvasRef>;\n androidWarmup?: boolean;\n __destroyWebGLContextAfterRender?: boolean;\n}\n\n// Anything else reaching the native component would hit the generated\n// string-enum parser, which aborts on unknown values.\nconst resolveSurfaceType = (\n surfaceType: AndroidSurfaceType | undefined\n): \"auto\" | AndroidSurfaceType =>\n surfaceType === \"SurfaceView\" || surfaceType === \"TextureView\"\n ? surfaceType\n : \"auto\";\n\n/**\n * What every canvas shares, whichever native view it renders into: the native\n * id, the scene graph root rendered into it, the `onSize` measurement and the\n * imperative handle of the ref.\n */\nexport const useCanvasRoot = ({\n children,\n onSize,\n ref,\n onLayout,\n}: Pick<CanvasProps, \"children\" | \"onSize\" | \"ref\" | \"onLayout\">) => {\n if (onLayout && Platform.OS !== \"web\") {\n console.error(\n \"<Canvas onLayout={onLayout} /> is not supported on the new architecture, to fix the issue, see: https://shopify.github.io/react-native-skia/docs/canvas/overview/#getting-the-canvas-size\"\n );\n }\n const viewRef = useCanvasRefPriv(null);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n useReanimatedFrame(() => {\n \"worklet\";\n if (onSize && measure) {\n const result =\n // eslint-disable-next-line no-nested-ternary\n Platform.OS === \"web\"\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n viewRef.current?.canvasRef\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n measure(viewRef.current.canvasRef)\n : { width: 0, height: 0 }\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n measure(viewRef as any);\n if (result) {\n const { width, height } = result;\n if (onSize.value.width !== width || onSize.value.height !== height) {\n onSize.value = { width, height };\n }\n }\n }\n }, !!onSize);\n\n // Render effects\n useLayoutEffect(() => {\n root.render(children);\n }, [children, root, nativeId]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n // Component methods\n useImperativeHandle(\n ref,\n () =>\n ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n measure: (callback) => {\n viewRef.current?.measure(callback);\n },\n measureInWindow: (callback) => {\n viewRef.current?.measureInWindow(callback);\n },\n }) as CanvasRef\n );\n return { nativeId, viewRef };\n};\n\nexport const Canvas = ({\n debug,\n opaque,\n children,\n onSize,\n colorSpace = \"p3\",\n highBitDepth = false,\n androidWarmup = false,\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\n const onLayoutWeb = useCallback(\n (e: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(e);\n }\n if (Platform.OS === \"web\" && onSize) {\n const { width, height } = e.nativeEvent.layout;\n onSize.value = { width, height };\n }\n },\n [onLayout, onSize]\n );\n return (\n <SkiaPictureViewNativeComponent\n ref={viewRef}\n collapsable={false}\n nativeID={`${nativeId}`}\n debug={debug}\n opaque={opaque}\n colorSpace={colorSpace}\n highBitDepth={highBitDepth}\n androidWarmup={androidWarmup}\n androidSurfaceType={resolveSurfaceType(android?.surfaceType)}\n androidZOrderOnTop={!!android?.zOrderOnTop}\n onLayout={\n Platform.OS === \"web\" && (onSize || onLayout) ? onLayoutWeb : onLayout\n }\n {...viewProps}\n />\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAkBA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,IAAAI,+BAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAA+C,SAAAE,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAU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eAAPA,OAAO,CAAEW,WAAW,CAAC;IAC3ChD,QAAQ,EACNC,kBAAQ,CAACC,EAAE,KAAK,KAAK,KAAKH,MAAM,IAAIC,QAAQ,CAAC,GAAGuC,WAAW,GAAGvC;EAC/D,GACGsC,SAAS,CACd,CAAC;AAEN,CAAC;AAAChE,OAAA,CAAAyD,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_ReanimatedProxy","_interopRequireDefault","_SkiaViewNativeId","_android","_SkiaViewNativeComponent","_Reconciler","_skia","_Platform","_external","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useReanimatedFrame","HAS_REANIMATED_3","Rea","useFrameCallback","measure","useCanvasRefPriv","useAnimatedRef","useCanvasSize","userRef","ourRef","ref","size","setSize","useState","width","height","useLayoutEffect","current","_x","_y","useCanvasRoot","children","onSize","onLayout","Platform","OS","console","error","viewRef","nativeId","useMemo","SkiaViewNativeId","root","SkiaSGRoot","Skia","_viewRef$current","result","canvasRef","value","render","useEffect","unmount","useImperativeHandle","makeImageSnapshot","rect","SkiaViewApi","makeImageSnapshotAsync","redraw","requestRedraw","getNativeId","callback","_viewRef$current2","measureInWindow","_viewRef$current3","Canvas","opaque","highBitDepth","android","viewProps","onLayoutWeb","useCallback","nativeEvent","layout","createElement","collapsable","nativeID","androidNativeProps"],"sources":["Canvas.tsx"],"sourcesContent":["import type { FC, RefObject } from \"react\";\nimport React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type {\n LayoutChangeEvent,\n MeasureInWindowOnSuccessCallback,\n MeasureOnSuccessCallback,\n View,\n ViewProps,\n} from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport { SkiaViewNativeId } from \"../views/SkiaViewNativeId\";\nimport { androidNativeProps } from \"../views/android\";\nimport type { AndroidCanvasProps } from \"../views/types\";\nimport SkiaViewNativeComponent from \"../specs/SkiaViewNativeComponent\";\nimport type { SkImage, SkRect, SkSize } from \"../skia/types\";\nimport { SkiaSGRoot } from \"../sksg/Reconciler\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\nimport { HAS_REANIMATED_3 } from \"../external\";\n\nexport interface CanvasRef extends FC<CanvasProps> {\n makeImageSnapshot(rect?: SkRect): SkImage;\n makeImageSnapshotAsync(rect?: SkRect): Promise<SkImage>;\n redraw(): void;\n getNativeId(): number;\n measure(callback: MeasureOnSuccessCallback): void;\n measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;\n}\n\nexport const useCanvasRef = () => useRef<CanvasRef>(null);\n\nconst useReanimatedFrame = !HAS_REANIMATED_3 ? () => {} : Rea.useFrameCallback;\nconst measure = !HAS_REANIMATED_3 ? null : Rea.measure;\n\nconst useCanvasRefPriv: typeof useRef<View> = !HAS_REANIMATED_3\n ? useRef\n : Rea.useAnimatedRef;\n\nexport const useCanvasSize = (userRef?: RefObject<CanvasRef | null>) => {\n const ourRef = useCanvasRef();\n const ref = userRef ?? ourRef;\n const [size, setSize] = useState<SkSize>({ width: 0, height: 0 });\n useLayoutEffect(() => {\n if (ref.current) {\n ref.current.measure((_x, _y, width, height) => {\n setSize({ width, height });\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return { ref, size };\n};\n\nexport interface CanvasProps extends Omit<ViewProps, \"onLayout\"> {\n /** @deprecated Not supported on native. Use `onSize` or `useCanvasSize()` instead. */\n onLayout?: ViewProps[\"onLayout\"];\n /**\n * Declares that the canvas covers every pixel of its bounds, so nothing\n * behind it needs to show through. On Android an opaque canvas is backed by\n * a `SurfaceView` by default, the cheapest path (see `android.surfaceType`).\n * Defaults to false.\n */\n opaque?: boolean;\n onSize?: SharedValue<SkSize>;\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. Colors are\n * identical to the default 8-bit surface, only with more precision (this is\n * about bit depth, not HDR). On Android the extra precision survives\n * composition only when combined with `opaque`, and the prop must be set\n * before the canvas is mounted.\n */\n highBitDepth?: boolean;\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n ref?: React.Ref<CanvasRef>;\n __destroyWebGLContextAfterRender?: boolean;\n}\n\n/**\n * What the canvas owns: the native id, the scene graph root rendered into it,\n * the `onSize` measurement and the imperative handle of the ref.\n */\nconst useCanvasRoot = ({\n children,\n onSize,\n ref,\n onLayout,\n}: Pick<CanvasProps, \"children\" | \"onSize\" | \"ref\" | \"onLayout\">) => {\n if (onLayout && Platform.OS !== \"web\") {\n console.error(\n \"<Canvas onLayout={onLayout} /> is not supported on the new architecture, to fix the issue, see: https://shopify.github.io/react-native-skia/docs/canvas/overview/#getting-the-canvas-size\"\n );\n }\n const viewRef = useCanvasRefPriv(null);\n // Native ID\n const nativeId = useMemo(() => {\n return SkiaViewNativeId.current++;\n }, []);\n\n // Root\n const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);\n\n useReanimatedFrame(() => {\n \"worklet\";\n if (onSize && measure) {\n const result =\n // eslint-disable-next-line no-nested-ternary\n Platform.OS === \"web\"\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n viewRef.current?.canvasRef\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n measure(viewRef.current.canvasRef)\n : { width: 0, height: 0 }\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n measure(viewRef as any);\n if (result) {\n const { width, height } = result;\n if (onSize.value.width !== width || onSize.value.height !== height) {\n onSize.value = { width, height };\n }\n }\n }\n }, !!onSize);\n\n // Render effects\n useLayoutEffect(() => {\n root.render(children);\n }, [children, root, nativeId]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n // Component methods\n useImperativeHandle(\n ref,\n () =>\n ({\n makeImageSnapshot: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshot(nativeId, rect);\n },\n makeImageSnapshotAsync: (rect?: SkRect) => {\n return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);\n },\n redraw: () => {\n SkiaViewApi.requestRedraw(nativeId);\n },\n getNativeId: () => {\n return nativeId;\n },\n measure: (callback) => {\n viewRef.current?.measure(callback);\n },\n measureInWindow: (callback) => {\n viewRef.current?.measureInWindow(callback);\n },\n }) as CanvasRef\n );\n return { nativeId, viewRef };\n};\n\n/**\n * The declarative canvas. Its children are rendered by Skia's own React\n * renderer; the frames are produced off the JS thread:\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 * On the web the scene is drawn into a picture on the JS thread and painted\n * on a WebGL canvas.\n */\nexport const Canvas = ({\n opaque,\n children,\n onSize,\n highBitDepth = false,\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\n const onLayoutWeb = useCallback(\n (e: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(e);\n }\n if (Platform.OS === \"web\" && onSize) {\n const { width, height } = e.nativeEvent.layout;\n onSize.value = { width, height };\n }\n },\n [onLayout, onSize]\n );\n return (\n <SkiaViewNativeComponent\n ref={viewRef}\n collapsable={false}\n nativeID={`${nativeId}`}\n opaque={opaque}\n highBitDepth={highBitDepth}\n {...androidNativeProps(android)}\n onLayout={\n Platform.OS === \"web\" && (onSize || onLayout) ? onLayoutWeb : onLayout\n }\n {...viewProps}\n />\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA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EAAAiB,QAAA;IACtBmB,GAAG,EAAEkB,OAAQ;IACboC,WAAW,EAAE,KAAM;IACnBC,QAAQ,EAAE,GAAGpC,QAAQ,EAAG;IACxB0B,MAAM,EAAEA,MAAO;IACfC,YAAY,EAAEA;EAAa,GACvB,IAAAU,2BAAkB,EAACT,OAAO,CAAC;IAC/BlC,QAAQ,EACNC,kBAAQ,CAACC,EAAE,KAAK,KAAK,KAAKH,MAAM,IAAIC,QAAQ,CAAC,GAAGoC,WAAW,GAAGpC;EAC/D,GACGmC,SAAS,CACd,CAAC;AAEN,CAAC;AAAC3D,OAAA,CAAAuD,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -1,12 +1,12 @@
1
1
  import type { SkCanvas } from "./Canvas";
2
2
  import type { SkJSIInstance } from "./JsiInstance";
3
3
  /**
4
- * A frame recorded for a SkiaGraphiteView. Immutable once finished: submit it
5
- * to the view as many times as needed, from any runtime.
4
+ * A frame recorded for a view. Immutable once finished: submit it to the view
5
+ * as many times as needed, from any runtime.
6
6
  */
7
7
  export type SkGraphiteRecording = SkJSIInstance<"GraphiteRecording">;
8
8
  /**
9
- * The recording side of a SkiaGraphiteView, obtained from the view's ref.
9
+ * The recording side of a view, obtained from the ref of a SkiaGraphiteView.
10
10
  *
11
11
  * Frames are recorded on the calling thread and presented by the view on its
12
12
  * display link, so the context can be captured into a worklet and used from
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Graphite.ts"],"sourcesContent":["import type { SkCanvas } from \"./Canvas\";\nimport type { SkJSIInstance } from \"./JsiInstance\";\n\n/**\n * A frame recorded for a SkiaGraphiteView. Immutable once finished: submit it\n * to the view as many times as needed, from any runtime.\n */\nexport type SkGraphiteRecording = SkJSIInstance<\"GraphiteRecording\">;\n\n/**\n * The recording side of a SkiaGraphiteView, obtained from the view's ref.\n *\n * Frames are recorded on the calling thread and presented by the view on its\n * display link, so the context can be captured into a worklet and used from\n * the Reanimated UI runtime or a dedicated worklet runtime. One recording is\n * open at a time.\n */\nexport interface SkGraphiteContext extends SkJSIInstance<\"GraphiteContext\"> {\n /** Width of the view in points. */\n readonly width: number;\n /** Height of the view in points. */\n readonly height: number;\n /**\n * Starts a frame. The canvas draws in points and starts with whatever the\n * view currently shows: clear it first. It is only valid until\n * finishRecording().\n */\n beginRecording(): SkCanvas;\n /** Ends the frame started by beginRecording(). */\n finishRecording(): SkGraphiteRecording;\n /**\n * Queues a recording for the next display frame. Recordings are presented\n * in submission order and never dropped.\n */\n submit(recording: SkGraphiteRecording): void;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Graphite.ts"],"sourcesContent":["import type { SkCanvas } from \"./Canvas\";\nimport type { SkJSIInstance } from \"./JsiInstance\";\n\n/**\n * A frame recorded for a view. Immutable once finished: submit it to the view\n * as many times as needed, from any runtime.\n */\nexport type SkGraphiteRecording = SkJSIInstance<\"GraphiteRecording\">;\n\n/**\n * The recording side of a view, obtained from the ref of a SkiaGraphiteView.\n *\n * Frames are recorded on the calling thread and presented by the view on its\n * display link, so the context can be captured into a worklet and used from\n * the Reanimated UI runtime or a dedicated worklet runtime. One recording is\n * open at a time.\n */\nexport interface SkGraphiteContext extends SkJSIInstance<\"GraphiteContext\"> {\n /** Width of the view in points. */\n readonly width: number;\n /** Height of the view in points. */\n readonly height: number;\n /**\n * Starts a frame. The canvas draws in points and starts with whatever the\n * view currently shows: clear it first. It is only valid until\n * finishRecording().\n */\n beginRecording(): SkCanvas;\n /** Ends the frame started by beginRecording(). */\n finishRecording(): SkGraphiteRecording;\n /**\n * Queues a recording for the next display frame. Recordings are presented\n * in submission order and never dropped.\n */\n submit(recording: SkGraphiteRecording): void;\n}\n"],"mappings":"","ignoreList":[]}
@@ -89,7 +89,7 @@ export interface ImageFactory {
89
89
  * while the image is in use: destroy() releases the underlying GPU
90
90
  * resource regardless of reference counts.
91
91
  *
92
- * Note: This method is only available when the Graphite backend is enabled.
92
+ * Native only.
93
93
  *
94
94
  * @param pointer - The WGPUTexture pointer (texture.nativePointer)
95
95
  * @returns An SkImage wrapping the texture, or throws if the texture is invalid
@@ -101,7 +101,7 @@ export interface ImageFactory {
101
101
  * returned pointer carries one reference and must be adopted exactly once
102
102
  * with react-native-webgpu's adoptTexture(), which owns it from then on.
103
103
  *
104
- * Note: This method is only available when the Graphite backend is enabled.
104
+ * Native only.
105
105
  *
106
106
  * @param image - An SkImage to convert to a texture
107
107
  * @returns A WGPUTexture pointer for adoptTexture(), or throws on failure
@@ -1 +1 @@
1
- {"version":3,"names":["AlphaType","exports"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { ColorType } from \"./ColorType\";\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n MakeNull: () => SkImage;\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by a given native buffer.\n * The native buffer must be a valid owning reference.\n *\n * For instance, this API is used by\n * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CVPixelBufferRef`\n * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * native buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;\n\n /**\n *\n * Return an Image backed by a given native texture.\n *\n * The native texture must be a valid owning reference.\n *\n * This API might be used to integrate with other libraries using gpu textures,\n * or to transfer images between different threads.\n *\n * @param texture A native texture handle\n * @param width The width of the texture\n * @param height The height of the texture\n * @param mipmapped Whether the texture is mipmapped\n * @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.\n *\n * @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.\n */\n MakeImageFromNativeTextureUnstable: (\n texture: unknown,\n width: number,\n height: number,\n mipmapped?: boolean,\n outputImage?: SkImage\n ) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n\n /**\n * Creates an SkImage from a WebGPU texture.\n * This allows using textures rendered by WebGPU in Skia drawings. The\n * texture crosses the package boundary as a raw pointer: pass\n * `texture.nativePointer` from a react-native-webgpu GPUTexture created on\n * the shared device (importDevice(Skia.getNativeDevice())). The native side\n * takes its own reference, so the handle stays valid even if the JS\n * GPUTexture is garbage collected — but do not call texture.destroy()\n * while the image is in use: destroy() releases the underlying GPU\n * resource regardless of reference counts.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param pointer - The WGPUTexture pointer (texture.nativePointer)\n * @returns An SkImage wrapping the texture, or throws if the texture is invalid\n */\n MakeImageFromNativeTexture(pointer: bigint): SkImage;\n\n /**\n * Creates a WebGPU texture from an SkImage.\n * This allows using Skia images in WebGPU rendering pipelines. The\n * returned pointer carries one reference and must be adopted exactly once\n * with react-native-webgpu's adoptTexture(), which owns it from then on.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param image - An SkImage to convert to a texture\n * @returns A WGPUTexture pointer for adoptTexture(), or throws on failure\n */\n MakeNativeTextureFromImage(image: SkImage): bigint;\n}\n"],"mappings":";;;;;;IAMYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["AlphaType","exports"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { ColorType } from \"./ColorType\";\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n MakeNull: () => SkImage;\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by a given native buffer.\n * The native buffer must be a valid owning reference.\n *\n * For instance, this API is used by\n * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CVPixelBufferRef`\n * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * native buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;\n\n /**\n *\n * Return an Image backed by a given native texture.\n *\n * The native texture must be a valid owning reference.\n *\n * This API might be used to integrate with other libraries using gpu textures,\n * or to transfer images between different threads.\n *\n * @param texture A native texture handle\n * @param width The width of the texture\n * @param height The height of the texture\n * @param mipmapped Whether the texture is mipmapped\n * @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.\n *\n * @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.\n */\n MakeImageFromNativeTextureUnstable: (\n texture: unknown,\n width: number,\n height: number,\n mipmapped?: boolean,\n outputImage?: SkImage\n ) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n\n /**\n * Creates an SkImage from a WebGPU texture.\n * This allows using textures rendered by WebGPU in Skia drawings. The\n * texture crosses the package boundary as a raw pointer: pass\n * `texture.nativePointer` from a react-native-webgpu GPUTexture created on\n * the shared device (importDevice(Skia.getNativeDevice())). The native side\n * takes its own reference, so the handle stays valid even if the JS\n * GPUTexture is garbage collected — but do not call texture.destroy()\n * while the image is in use: destroy() releases the underlying GPU\n * resource regardless of reference counts.\n *\n * Native only.\n *\n * @param pointer - The WGPUTexture pointer (texture.nativePointer)\n * @returns An SkImage wrapping the texture, or throws if the texture is invalid\n */\n MakeImageFromNativeTexture(pointer: bigint): SkImage;\n\n /**\n * Creates a WebGPU texture from an SkImage.\n * This allows using Skia images in WebGPU rendering pipelines. The\n * returned pointer carries one reference and must be adopted exactly once\n * with react-native-webgpu's adoptTexture(), which owns it from then on.\n *\n * Native only.\n *\n * @param image - An SkImage to convert to a texture\n * @returns A WGPUTexture pointer for adoptTexture(), or throws on failure\n */\n MakeNativeTextureFromImage(image: SkImage): bigint;\n}\n"],"mappings":";;;;;;IAMYA,SAAS,GAAAC,OAAA,CAAAD,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
@@ -83,8 +83,7 @@ export interface Skia {
83
83
  /**
84
84
  * Raw WGPUDevice pointer of Skia's Graphite device, as a BigInt. Pass it to
85
85
  * react-native-webgpu's importDevice() to get a GPUDevice sharing Skia's
86
- * device (zero-copy interop). Only available on Graphite builds; throws
87
- * otherwise.
86
+ * device (zero-copy interop). Native only.
88
87
  */
89
88
  getNativeDevice(): bigint;
90
89
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory, PathBuilderFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\nimport type { JsiRecorder } from \"./Recorder\";\nimport type { SkottieFactory } from \"./Skottie\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n PathBuilder: PathBuilderFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Skottie: SkottieFactory;\n Video: (url: string) => Promise<Video> | Video;\n NativeBuffer: NativeBufferFactory;\n Recorder(): JsiRecorder;\n /**\n * Raw WGPUDevice pointer of Skia's Graphite device, as a BigInt. Pass it to\n * react-native-webgpu's importDevice() to get a GPUDevice sharing Skia's\n * device (zero-copy interop). Only available on Graphite builds; throws\n * otherwise.\n */\n getNativeDevice(): bigint;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory, PathBuilderFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\nimport type { JsiRecorder } from \"./Recorder\";\nimport type { SkottieFactory } from \"./Skottie\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n PathBuilder: PathBuilderFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Skottie: SkottieFactory;\n Video: (url: string) => Promise<Video> | Video;\n NativeBuffer: NativeBufferFactory;\n Recorder(): JsiRecorder;\n /**\n * Raw WGPUDevice pointer of Skia's Graphite device, as a BigInt. Pass it to\n * react-native-webgpu's importDevice() to get a GPUDevice sharing Skia's\n * device (zero-copy interop). Native only.\n */\n getNativeDevice(): bigint;\n}\n"],"mappings":"","ignoreList":[]}
@@ -33,7 +33,7 @@ export interface SurfaceFactory {
33
33
  * surface exists. Calling destroy() on the GPUTexture still invalidates
34
34
  * the surface.
35
35
  *
36
- * Note: This method is only available when the Graphite backend is enabled.
36
+ * Native only.
37
37
  *
38
38
  * @param pointer - The WGPUTexture pointer (texture.nativePointer)
39
39
  * @returns An SkSurface rendering into the texture, or throws if the texture is invalid
@@ -1 +1 @@
1
- {"version":3,"names":["ColorSpace","exports","SRGB","DisplayP3"],"sources":["SurfaceFactory.ts"],"sourcesContent":["import type { SkSurface } from \"./Surface\";\n\nexport const ColorSpace = {\n SRGB: \"srgb\",\n DisplayP3: \"display-p3\",\n} as const;\n\nexport type ColorSpaceValue = (typeof ColorSpace)[keyof typeof ColorSpace];\n\nexport interface SurfaceOptions {\n colorSpace: ColorSpaceValue;\n}\n\nexport interface SurfaceFactory {\n /**\n * Returns a CPU backed surface with the given dimensions, an SRGB colorspace, Unpremul\n * alphaType and 8888 color type. The pixels belonging to this surface will be in memory and\n * not visible.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n */\n Make: (width: number, height: number) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n * @param opts - optional surface options (e.g. colorSpace: \"display-p3\" | \"srgb\").\n */\n MakeOffscreen: (\n width: number,\n height: number,\n opts?: SurfaceOptions\n ) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface that draws directly into a WebGPU texture\n * (zero-copy). The texture must be created on Skia's device\n * (importDevice(Skia.getNativeDevice())) with RENDER_ATTACHMENT usage; add\n * TEXTURE_BINDING to sample what Skia drew from WebGPU after each flush().\n * The surface holds its own reference to the texture and keeps it alive\n * for its lifetime, so the caller may release the GPUTexture once the\n * surface exists. Calling destroy() on the GPUTexture still invalidates\n * the surface.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param pointer - The WGPUTexture pointer (texture.nativePointer)\n * @returns An SkSurface rendering into the texture, or throws if the texture is invalid\n */\n MakeFromNativeTexture: (pointer: bigint) => SkSurface;\n}\n"],"mappings":";;;;;;AAEO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE;AACb,CAAU","ignoreList":[]}
1
+ {"version":3,"names":["ColorSpace","exports","SRGB","DisplayP3"],"sources":["SurfaceFactory.ts"],"sourcesContent":["import type { SkSurface } from \"./Surface\";\n\nexport const ColorSpace = {\n SRGB: \"srgb\",\n DisplayP3: \"display-p3\",\n} as const;\n\nexport type ColorSpaceValue = (typeof ColorSpace)[keyof typeof ColorSpace];\n\nexport interface SurfaceOptions {\n colorSpace: ColorSpaceValue;\n}\n\nexport interface SurfaceFactory {\n /**\n * Returns a CPU backed surface with the given dimensions, an SRGB colorspace, Unpremul\n * alphaType and 8888 color type. The pixels belonging to this surface will be in memory and\n * not visible.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n */\n Make: (width: number, height: number) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n * @param opts - optional surface options (e.g. colorSpace: \"display-p3\" | \"srgb\").\n */\n MakeOffscreen: (\n width: number,\n height: number,\n opts?: SurfaceOptions\n ) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface that draws directly into a WebGPU texture\n * (zero-copy). The texture must be created on Skia's device\n * (importDevice(Skia.getNativeDevice())) with RENDER_ATTACHMENT usage; add\n * TEXTURE_BINDING to sample what Skia drew from WebGPU after each flush().\n * The surface holds its own reference to the texture and keeps it alive\n * for its lifetime, so the caller may release the GPUTexture once the\n * surface exists. Calling destroy() on the GPUTexture still invalidates\n * the surface.\n *\n * Native only.\n *\n * @param pointer - The WGPUTexture pointer (texture.nativePointer)\n * @returns An SkSurface rendering into the texture, or throws if the texture is invalid\n */\n MakeFromNativeTexture: (pointer: bigint) => SkSurface;\n}\n"],"mappings":";;;;;;AAEO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE;AACb,CAAU","ignoreList":[]}
@@ -1,7 +1,11 @@
1
1
  import type { SkGraphiteContext, SkImage, SkPicture, SkRect } from "../skia/types";
2
2
  import type { ISkiaViewApi } from "../views/types";
3
- /** What every web view registers under its native id. */
3
+ /** What the web view registers under its native id. */
4
4
  export interface SkiaWebViewHandle {
5
+ /** Shows a picture: the frame of a <Canvas> or a <SkiaPictureView>. */
6
+ setPicture(picture: SkPicture): void;
7
+ /** The recording side of the view, see SkiaGraphiteView. */
8
+ getContext(): SkGraphiteContext;
5
9
  getSize(): {
6
10
  width: number;
7
11
  height: number;
@@ -11,9 +15,6 @@ export interface SkiaWebViewHandle {
11
15
  measure(callback: (x: number, y: number, width: number, height: number, pageX: number, pageY: number) => void): void;
12
16
  measureInWindow(callback: (x: number, y: number, width: number, height: number) => void): void;
13
17
  }
14
- export interface SkiaGraphiteViewHandle extends SkiaWebViewHandle {
15
- getContext(): SkGraphiteContext;
16
- }
17
18
  export type ISkiaViewApiWeb = ISkiaViewApi & {
18
19
  views: Record<string, SkiaWebViewHandle>;
19
20
  deferedPictures: Record<string, SkPicture>;
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /* eslint-disable import/no-anonymous-default-export */
8
8
 
9
- /** What every web view registers under its native id. */
9
+ /** What the web view registers under its native id. */
10
10
 
11
- const hasPicture = view => "setPicture" in view;
12
- const hasContext = view => "getContext" in view;
13
11
  global.SkiaViewApi = {
14
12
  views: {},
15
13
  deferedPictures: {},
@@ -19,7 +17,7 @@ global.SkiaViewApi = {
19
17
  registerView(nativeId, view) {
20
18
  this.unregisteredViews.delete(nativeId);
21
19
  // Maybe a picture for this view was already set
22
- if (this.deferedPictures[nativeId] && hasPicture(view)) {
20
+ if (this.deferedPictures[nativeId]) {
23
21
  view.setPicture(this.deferedPictures[nativeId]);
24
22
  delete this.deferedPictures[nativeId];
25
23
  }
@@ -38,9 +36,7 @@ global.SkiaViewApi = {
38
36
  const id = `${nativeId}`;
39
37
  const view = this.views[id];
40
38
  if (view) {
41
- if (hasPicture(view)) {
42
- view.setPicture(value);
43
- }
39
+ view.setPicture(value);
44
40
  } else if (!this.unregisteredViews.has(id)) {
45
41
  this.deferedPictures[id] = value;
46
42
  }
@@ -77,8 +73,8 @@ global.SkiaViewApi = {
77
73
  },
78
74
  makeGraphiteContext(nativeId) {
79
75
  const view = this.views[`${nativeId}`];
80
- if (!view || !hasContext(view)) {
81
- throw new Error(`Cannot make a Graphite context: no SkiaGraphiteView with nativeID ${nativeId} is mounted`);
76
+ if (!view) {
77
+ throw new Error(`Cannot make a Graphite context: no view with nativeID ${nativeId} is mounted`);
82
78
  }
83
79
  return view.getContext();
84
80
  },