@shopify/react-native-skia 2.4.15 → 2.4.17

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 (226) hide show
  1. package/android/CMakeLists.txt +69 -0
  2. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +19 -7
  3. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +7 -0
  4. package/apple/RNSkApplePlatformContext.mm +4 -0
  5. package/cpp/api/JsiSkApi.h +31 -0
  6. package/cpp/api/JsiSkImageFactory.h +69 -1
  7. package/cpp/api/JsiSkImageFilter.h +1 -0
  8. package/cpp/api/JsiSkPath.h +1 -1
  9. package/cpp/jsi/RuntimeAwareCache.h +0 -2
  10. package/cpp/jsi2/EnumMapper.h +45 -0
  11. package/cpp/jsi2/JSIConverter.h +468 -0
  12. package/cpp/jsi2/NativeObject.h +598 -0
  13. package/cpp/jsi2/Promise.cpp +44 -0
  14. package/cpp/jsi2/Promise.h +35 -0
  15. package/cpp/rnskia/RNDawnContext.h +114 -0
  16. package/cpp/rnskia/RNSkManager.cpp +41 -1
  17. package/cpp/rnwgpu/ArrayBuffer.h +68 -0
  18. package/cpp/rnwgpu/api/Convertors.h +761 -0
  19. package/cpp/rnwgpu/api/External.h +12 -0
  20. package/cpp/rnwgpu/api/GPU.cpp +129 -0
  21. package/cpp/rnwgpu/api/GPU.h +57 -0
  22. package/cpp/rnwgpu/api/GPUAdapter.cpp +178 -0
  23. package/cpp/rnwgpu/api/GPUAdapter.h +59 -0
  24. package/cpp/rnwgpu/api/GPUAdapterInfo.h +57 -0
  25. package/cpp/rnwgpu/api/GPUBindGroup.cpp +3 -0
  26. package/cpp/rnwgpu/api/GPUBindGroup.h +51 -0
  27. package/cpp/rnwgpu/api/GPUBindGroupLayout.h +52 -0
  28. package/cpp/rnwgpu/api/GPUBuffer.cpp +97 -0
  29. package/cpp/rnwgpu/api/GPUBuffer.h +87 -0
  30. package/cpp/rnwgpu/api/GPUCommandBuffer.h +45 -0
  31. package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +179 -0
  32. package/cpp/rnwgpu/api/GPUCommandEncoder.h +111 -0
  33. package/cpp/rnwgpu/api/GPUCompilationInfo.h +79 -0
  34. package/cpp/rnwgpu/api/GPUCompilationMessage.h +36 -0
  35. package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +60 -0
  36. package/cpp/rnwgpu/api/GPUComputePassEncoder.h +85 -0
  37. package/cpp/rnwgpu/api/GPUComputePipeline.cpp +12 -0
  38. package/cpp/rnwgpu/api/GPUComputePipeline.h +60 -0
  39. package/cpp/rnwgpu/api/GPUDevice.cpp +434 -0
  40. package/cpp/rnwgpu/api/GPUDevice.h +174 -0
  41. package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +7 -0
  42. package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +40 -0
  43. package/cpp/rnwgpu/api/GPUError.h +35 -0
  44. package/cpp/rnwgpu/api/GPUExtent3D.h +66 -0
  45. package/cpp/rnwgpu/api/GPUExternalTexture.h +45 -0
  46. package/cpp/rnwgpu/api/GPUFeatures.h +212 -0
  47. package/cpp/rnwgpu/api/GPUInternalError.h +31 -0
  48. package/cpp/rnwgpu/api/GPUOrigin2D.h +55 -0
  49. package/cpp/rnwgpu/api/GPUOrigin3D.h +62 -0
  50. package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +33 -0
  51. package/cpp/rnwgpu/api/GPUPipelineLayout.h +45 -0
  52. package/cpp/rnwgpu/api/GPUQuerySet.cpp +11 -0
  53. package/cpp/rnwgpu/api/GPUQuerySet.h +73 -0
  54. package/cpp/rnwgpu/api/GPUQueue.cpp +169 -0
  55. package/cpp/rnwgpu/api/GPUQueue.h +84 -0
  56. package/cpp/rnwgpu/api/GPURenderBundle.h +44 -0
  57. package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +131 -0
  58. package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +110 -0
  59. package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +165 -0
  60. package/cpp/rnwgpu/api/GPURenderPassEncoder.h +130 -0
  61. package/cpp/rnwgpu/api/GPURenderPipeline.cpp +13 -0
  62. package/cpp/rnwgpu/api/GPURenderPipeline.h +61 -0
  63. package/cpp/rnwgpu/api/GPUSampler.h +44 -0
  64. package/cpp/rnwgpu/api/GPUShaderModule.cpp +51 -0
  65. package/cpp/rnwgpu/api/GPUShaderModule.h +66 -0
  66. package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +129 -0
  67. package/cpp/rnwgpu/api/GPUSupportedLimits.h +131 -0
  68. package/cpp/rnwgpu/api/GPUTexture.cpp +47 -0
  69. package/cpp/rnwgpu/api/GPUTexture.h +150 -0
  70. package/cpp/rnwgpu/api/GPUTextureView.h +44 -0
  71. package/cpp/rnwgpu/api/GPUValidationError.h +32 -0
  72. package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +64 -0
  73. package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +71 -0
  74. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +56 -0
  75. package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +97 -0
  76. package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +57 -0
  77. package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +52 -0
  78. package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +56 -0
  79. package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +56 -0
  80. package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +59 -0
  81. package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +39 -0
  82. package/cpp/rnwgpu/api/descriptors/GPUColor.h +66 -0
  83. package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +58 -0
  84. package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +29 -0
  85. package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +45 -0
  86. package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +45 -0
  87. package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +56 -0
  88. package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +58 -0
  89. package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +67 -0
  90. package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +103 -0
  91. package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +99 -0
  92. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +38 -0
  93. package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +71 -0
  94. package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +73 -0
  95. package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +62 -0
  96. package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +62 -0
  97. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +65 -0
  98. package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +81 -0
  99. package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +54 -0
  100. package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +22 -0
  101. package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +54 -0
  102. package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +57 -0
  103. package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +69 -0
  104. package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +61 -0
  105. package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +55 -0
  106. package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +43 -0
  107. package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +45 -0
  108. package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +80 -0
  109. package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +81 -0
  110. package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +101 -0
  111. package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +92 -0
  112. package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +58 -0
  113. package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +103 -0
  114. package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +51 -0
  115. package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +45 -0
  116. package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +110 -0
  117. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +60 -0
  118. package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +62 -0
  119. package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +25 -0
  120. package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +64 -0
  121. package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +59 -0
  122. package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +59 -0
  123. package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +91 -0
  124. package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +29 -0
  125. package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +91 -0
  126. package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +64 -0
  127. package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +53 -0
  128. package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +62 -0
  129. package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +73 -0
  130. package/cpp/rnwgpu/api/descriptors/Unions.h +1984 -0
  131. package/cpp/rnwgpu/async/AsyncDispatcher.h +28 -0
  132. package/cpp/rnwgpu/async/AsyncRunner.cpp +181 -0
  133. package/cpp/rnwgpu/async/AsyncRunner.h +56 -0
  134. package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +181 -0
  135. package/cpp/rnwgpu/async/AsyncTaskHandle.h +55 -0
  136. package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.cpp +23 -0
  137. package/cpp/rnwgpu/async/JSIMicrotaskDispatcher.h +22 -0
  138. package/lib/commonjs/Platform/Platform.web.js +1 -2
  139. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  140. package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
  141. package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -4
  142. package/lib/commonjs/renderer/Canvas.js +4 -3
  143. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  144. package/lib/commonjs/renderer/components/Group.js +1 -2
  145. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  146. package/lib/commonjs/renderer/components/shapes/FitBox.js +1 -2
  147. package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
  148. package/lib/commonjs/skia/types/ContourMeasure.js.map +1 -1
  149. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +20 -0
  150. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  151. package/lib/commonjs/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  152. package/lib/commonjs/skia/types/Skia.d.ts +17 -0
  153. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  154. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -0
  155. package/lib/commonjs/skia/web/JsiSkImageFactory.js +6 -0
  156. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  157. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +2 -2
  158. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
  159. package/lib/commonjs/skia/web/JsiSkia.js +6 -0
  160. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  161. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -1
  162. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  163. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -1
  164. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  165. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  166. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js +2 -0
  167. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  168. package/lib/commonjs/views/SkiaPictureView.web.js +4 -4
  169. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  170. package/lib/commonjs/web/WithSkiaWeb.js +1 -2
  171. package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
  172. package/lib/module/external/reanimated/buffers.js.map +1 -1
  173. package/lib/module/external/reanimated/interpolators.d.ts +1 -4
  174. package/lib/module/renderer/Canvas.js +3 -1
  175. package/lib/module/renderer/Canvas.js.map +1 -1
  176. package/lib/module/skia/types/ContourMeasure.js.map +1 -1
  177. package/lib/module/skia/types/Image/ImageFactory.d.ts +20 -0
  178. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  179. package/lib/module/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  180. package/lib/module/skia/types/Skia.d.ts +17 -0
  181. package/lib/module/skia/types/Skia.js.map +1 -1
  182. package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -0
  183. package/lib/module/skia/web/JsiSkImageFactory.js +6 -0
  184. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  185. package/lib/module/skia/web/JsiSkParagraphStyle.js +2 -2
  186. package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
  187. package/lib/module/skia/web/JsiSkia.js +6 -0
  188. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  189. package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -1
  190. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  191. package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -1
  192. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  193. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  194. package/lib/module/specs/SkiaPictureViewNativeComponent.js +4 -0
  195. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  196. package/lib/module/views/SkiaPictureView.web.js +3 -2
  197. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  198. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -0
  199. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
  200. package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -1
  201. package/lib/typescript/lib/module/skia/Skia.web.d.ts +2 -0
  202. package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -0
  203. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
  204. package/lib/typescript/lib/module/views/SkiaPictureView.d.ts +1 -1
  205. package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -4
  206. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +20 -0
  207. package/lib/typescript/src/skia/types/Skia.d.ts +17 -0
  208. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -0
  209. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  210. package/package.json +20 -16
  211. package/react-native-skia.podspec +52 -13
  212. package/scripts/install-skia.mjs +99 -48
  213. package/src/external/reanimated/buffers.ts +1 -1
  214. package/src/renderer/Canvas.tsx +3 -2
  215. package/src/skia/types/ContourMeasure.tsx +1 -2
  216. package/src/skia/types/Image/ImageFactory.ts +22 -0
  217. package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -2
  218. package/src/skia/types/Skia.ts +17 -0
  219. package/src/skia/web/JsiSkImageFactory.ts +8 -0
  220. package/src/skia/web/JsiSkia.ts +6 -0
  221. package/src/sksg/Recorder/commands/ColorFilters.ts +3 -2
  222. package/src/sksg/Recorder/commands/ImageFilters.ts +3 -2
  223. package/src/sksg/Recorder/commands/PathEffects.ts +3 -2
  224. package/src/sksg/Recorder/commands/Shaders.ts +3 -2
  225. package/src/specs/SkiaPictureViewNativeComponent.ts +7 -0
  226. package/src/views/SkiaPictureView.web.tsx +4 -1
@@ -8,6 +8,12 @@ import { fileURLToPath } from "url";
8
8
 
9
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
10
 
11
+ // Allow skipping download via environment variable (useful for CI builds)
12
+ if (process.env.SKIP_SKIA_DOWNLOAD === '1' || process.env.SKIP_SKIA_DOWNLOAD === 'true') {
13
+ console.log("⏭️ Skipping Skia download (SKIP_SKIA_DOWNLOAD is set)");
14
+ process.exit(0);
15
+ }
16
+
11
17
  const repo = "shopify/react-native-skia";
12
18
 
13
19
  const packageJsonPath = path.join(__dirname, "..", "package.json");
@@ -42,13 +48,24 @@ const updateSkiaChecksums = (checksums, graphite = false) => {
42
48
 
43
49
  const GRAPHITE = !!process.env.SK_GRAPHITE;
44
50
  const prefix = GRAPHITE ? "skia-graphite" : "skia";
51
+
52
+ // Build artifact names based on platform and Graphite mode
45
53
  const names = [
46
54
  `${prefix}-android-arm`,
47
55
  `${prefix}-android-arm-64`,
48
56
  `${prefix}-android-arm-x64`,
49
57
  `${prefix}-android-arm-x86`,
50
- `${prefix}-apple-xcframeworks`,
58
+ `${prefix}-apple-ios-xcframeworks`,
59
+ `${prefix}-apple-macos-xcframeworks`,
51
60
  ];
61
+
62
+ // Add tvOS only for non-Graphite builds
63
+ if (!GRAPHITE) {
64
+ names.push(`${prefix}-apple-tvos-xcframeworks`);
65
+ }
66
+
67
+ // Note: macCatalyst is now included in the iOS xcframeworks, no separate download needed
68
+
52
69
  if (GRAPHITE) {
53
70
  names.push(`${prefix}-headers`);
54
71
  }
@@ -108,7 +125,9 @@ const runCommandWithOutput = (command, args, options = {}) => {
108
125
  const skiaDir = path.resolve(__dirname, "../../../externals/skia");
109
126
 
110
127
  const checkoutSkiaBranch = async (version) => {
111
- const branchName = `chrome/${version}`;
128
+ // Extract base version (e.g., "m144a" -> "m144", "m142" -> "m142")
129
+ const baseVersion = version.match(/^(m\d+)/)?.[1] || version;
130
+ const branchName = `chrome/${baseVersion}`;
112
131
 
113
132
  // Check if the skia directory exists and is a git repo
114
133
  // (won't exist when installed via npm - submodule is not included in the package)
@@ -142,8 +161,7 @@ const checkoutSkiaBranch = async (version) => {
142
161
 
143
162
  console.log(` ✓ Successfully checked out ${branchName}`);
144
163
  } catch (error) {
145
- console.error(` ⚠️ Failed to checkout branch ${branchName}: ${error.message}`);
146
- console.error(" Headers may not match the prebuilt binaries!");
164
+ throw new Error(`Failed to checkout branch ${branchName}: ${error.message}`);
147
165
  }
148
166
  };
149
167
 
@@ -346,11 +364,18 @@ const calculateLibraryChecksums = () => {
346
364
  }
347
365
  }
348
366
 
349
- // Apple frameworks
350
- const appleDir = path.join(libsDir, "apple");
351
- const appleChecksum = calculateDirectoryChecksum(appleDir);
352
- if (appleChecksum) {
353
- checksums["apple-xcframeworks"] = appleChecksum;
367
+ // Apple platforms - calculate separate checksums for each platform
368
+ // Note: maccatalyst is included in iOS xcframeworks, not a separate artifact
369
+ const applePlatforms = GRAPHITE
370
+ ? ["ios", "macos"]
371
+ : ["ios", "tvos", "macos"];
372
+
373
+ for (const platform of applePlatforms) {
374
+ const platformDir = path.join(libsDir, "apple", platform);
375
+ const checksum = calculateDirectoryChecksum(platformDir);
376
+ if (checksum) {
377
+ checksums[`apple-${platform}-xcframeworks`] = checksum;
378
+ }
354
379
  }
355
380
 
356
381
  return checksums;
@@ -400,10 +425,16 @@ const areBinariesInstalled = () => {
400
425
  }
401
426
  }
402
427
 
403
- // Check for Apple frameworks
404
- const appleDir = path.join(libsDir, "apple");
405
- if (!fs.existsSync(appleDir) || fs.readdirSync(appleDir).length === 0) {
406
- return false;
428
+ // Check for Apple platform frameworks
429
+ const applePlatforms = GRAPHITE
430
+ ? ["ios", "macos"]
431
+ : ["ios", "tvos", "macos", "maccatalyst"];
432
+
433
+ for (const platform of applePlatforms) {
434
+ const platformDir = path.join(libsDir, "apple", platform);
435
+ if (!fs.existsSync(platformDir) || fs.readdirSync(platformDir).length === 0) {
436
+ return false;
437
+ }
407
438
  }
408
439
 
409
440
  return true;
@@ -523,45 +554,65 @@ const main = async () => {
523
554
  }
524
555
  });
525
556
 
526
- // Create apple directory structure
557
+ // Create apple directory structure - now per-platform
527
558
  const appleDir = path.join(libsDir, "apple");
528
- // The tar file extracts to skia-apple-xcframeworks/apple
529
- const appleSrcDir = path.join(
530
- artifactsDir,
531
- `${prefix}-apple-xcframeworks`,
532
- "apple"
533
- );
534
- if (fs.existsSync(appleSrcDir)) {
535
- fs.mkdirSync(appleDir, { recursive: true });
536
-
537
- // Copy all xcframeworks
538
- fs.readdirSync(appleSrcDir).forEach((item) => {
539
- const srcPath = path.join(appleSrcDir, item);
540
- const destPath = path.join(appleDir, item);
541
-
542
- if (fs.lstatSync(srcPath).isDirectory()) {
543
- // Copy directory recursively
544
- const copyDir = (src, dest) => {
545
- fs.mkdirSync(dest, { recursive: true });
546
- fs.readdirSync(src).forEach((file) => {
547
- const srcFile = path.join(src, file);
548
- const destFile = path.join(dest, file);
549
- if (fs.lstatSync(srcFile).isDirectory()) {
550
- copyDir(srcFile, destFile);
551
- } else {
552
- fs.copyFileSync(srcFile, destFile);
553
- }
554
- });
555
- };
556
- copyDir(srcPath, destPath);
557
- } else {
558
- fs.copyFileSync(srcPath, destPath);
559
- }
560
- });
561
- }
559
+ fs.mkdirSync(appleDir, { recursive: true });
560
+
561
+ // Define the platform artifacts to process
562
+ // Note: maccatalyst is included in iOS xcframeworks, not a separate artifact
563
+ const applePlatformArtifacts = GRAPHITE
564
+ ? [
565
+ { artifact: `${prefix}-apple-ios-xcframeworks`, srcSubdir: "ios", dest: "ios" },
566
+ { artifact: `${prefix}-apple-macos-xcframeworks`, srcSubdir: "macos", dest: "macos" },
567
+ ]
568
+ : [
569
+ { artifact: `${prefix}-apple-ios-xcframeworks`, srcSubdir: "ios", dest: "ios" },
570
+ { artifact: `${prefix}-apple-tvos-xcframeworks`, srcSubdir: "tvos", dest: "tvos" },
571
+ { artifact: `${prefix}-apple-macos-xcframeworks`, srcSubdir: "macos", dest: "macos" },
572
+ ];
573
+
574
+ applePlatformArtifacts.forEach(({ artifact, srcSubdir, dest }) => {
575
+ // The tar file extracts to artifact_name/srcSubdir (e.g., skia-apple-ios-xcframeworks/ios)
576
+ const appleSrcDir = path.join(artifactsDir, artifact, srcSubdir);
577
+ const destDir = path.join(appleDir, dest);
578
+
579
+ console.log(` Checking ${appleSrcDir} -> ${destDir}`);
580
+ if (fs.existsSync(appleSrcDir)) {
581
+ console.log(` ✓ Copying ${artifact}/${srcSubdir}`);
582
+ fs.mkdirSync(destDir, { recursive: true });
583
+
584
+ // Copy all xcframeworks
585
+ fs.readdirSync(appleSrcDir).forEach((item) => {
586
+ const srcPath = path.join(appleSrcDir, item);
587
+ const destPath = path.join(destDir, item);
588
+
589
+ if (fs.lstatSync(srcPath).isDirectory()) {
590
+ // Copy directory recursively
591
+ const copyDir = (src, dest) => {
592
+ fs.mkdirSync(dest, { recursive: true });
593
+ fs.readdirSync(src).forEach((file) => {
594
+ const srcFile = path.join(src, file);
595
+ const destFile = path.join(dest, file);
596
+ if (fs.lstatSync(srcFile).isDirectory()) {
597
+ copyDir(srcFile, destFile);
598
+ } else {
599
+ fs.copyFileSync(srcFile, destFile);
600
+ }
601
+ });
602
+ };
603
+ copyDir(srcPath, destPath);
604
+ } else {
605
+ fs.copyFileSync(srcPath, destPath);
606
+ }
607
+ });
608
+ } else {
609
+ console.log(` ✗ Source directory not found: ${appleSrcDir}`);
610
+ }
611
+ });
562
612
 
563
613
  // Create or remove Graphite marker files based on build type
564
614
  const androidMarkerFile = path.join(androidDir, "graphite.enabled");
615
+ // Apple marker file stays at the apple root level (libs/apple/graphite.enabled)
565
616
  const appleMarkerFile = path.join(appleDir, "graphite.enabled");
566
617
 
567
618
  if (GRAPHITE) {
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useMemo } from "react";
2
- import type { WorkletFunction } from "react-native-reanimated/lib/typescript/commonTypes";
2
+ import type { WorkletFunction } from "react-native-worklets";
3
3
 
4
4
  import type { SkColor, SkHostRect, SkPoint, SkRSXform } from "../../skia/types";
5
5
  import { Skia } from "../../skia";
@@ -15,7 +15,7 @@ import type {
15
15
  View,
16
16
  ViewProps,
17
17
  } from "react-native";
18
- import type { AnimatedRef, SharedValue } from "react-native-reanimated";
18
+ import type { SharedValue } from "react-native-reanimated";
19
19
 
20
20
  import Rea from "../external/reanimated/ReanimatedProxy";
21
21
  import { SkiaViewNativeId } from "../views/SkiaViewNativeId";
@@ -113,7 +113,8 @@ export const Canvas = ({
113
113
  // @ts-expect-error
114
114
  measure(viewRef.current.canvasRef)
115
115
  : { width: 0, height: 0 }
116
- : measure(viewRef as AnimatedRef<View>);
116
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
+ measure(viewRef as any);
117
118
  if (result) {
118
119
  const { width, height } = result;
119
120
  if (onSize.value.width !== width || onSize.value.height !== height) {
@@ -36,8 +36,7 @@ export interface SkContourMeasure extends SkJSIInstance<"ContourMeasure"> {
36
36
  length(): number;
37
37
  }
38
38
 
39
- export interface SkContourMeasureIter
40
- extends SkJSIInstance<"ContourMeasureIter"> {
39
+ export interface SkContourMeasureIter extends SkJSIInstance<"ContourMeasureIter"> {
41
40
  /**
42
41
  * Iterates through contours in path, returning a contour-measure object for each contour
43
42
  * in the path. Returns null when it is done.
@@ -94,4 +94,26 @@ export interface ImageFactory {
94
94
  * @param bytesPerRow
95
95
  */
96
96
  MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;
97
+
98
+ /**
99
+ * Creates an SkImage from a WebGPU texture.
100
+ * This allows using textures rendered by WebGPU in Skia drawings.
101
+ *
102
+ * Note: This method is only available when the Graphite backend is enabled.
103
+ *
104
+ * @param texture - A GPUTexture object from the WebGPU API
105
+ * @returns An SkImage wrapping the texture, or throws if the texture is invalid
106
+ */
107
+ MakeImageFromTexture(texture: GPUTexture): SkImage;
108
+
109
+ /**
110
+ * Creates a WebGPU texture from an SkImage.
111
+ * This allows using Skia images in WebGPU rendering pipelines.
112
+ *
113
+ * Note: This method is only available when the Graphite backend is enabled.
114
+ *
115
+ * @param image - An SkImage to convert to a texture
116
+ * @returns A GPUTexture containing the image data, or throws if conversion fails
117
+ */
118
+ MakeTextureFromImage(image: SkImage): GPUTexture;
97
119
  }
@@ -10,8 +10,7 @@ export interface SkSLUniform {
10
10
  isInteger: boolean;
11
11
  }
12
12
 
13
- export interface SkRuntimeShaderBuilder
14
- extends SkJSIInstance<"RuntimeShaderBuilder"> {
13
+ export interface SkRuntimeShaderBuilder extends SkJSIInstance<"RuntimeShaderBuilder"> {
15
14
  setUniform(name: string, value: readonly number[]): void;
16
15
  }
17
16
 
@@ -108,4 +108,21 @@ export interface Skia {
108
108
  Context(surface: bigint, width: number, height: number): SkiaContext;
109
109
  NativeBuffer: NativeBufferFactory;
110
110
  Recorder(): JsiRecorder;
111
+ /**
112
+ * Returns whether the Graphite backend is enabled and WebGPU is available.
113
+ *
114
+ * @returns true if Graphite/WebGPU is available, false otherwise
115
+ */
116
+ hasDevice(): boolean;
117
+ /**
118
+ * Returns the shared WebGPU device used by Skia's Graphite backend.
119
+ * This allows direct access to the GPU device for WebGPU operations.
120
+ *
121
+ * Note: This method is only available when the Graphite backend is enabled.
122
+ * Use hasDevice() to check availability before calling this method.
123
+ *
124
+ * @returns The GPUDevice used by Skia
125
+ * @throws Error if Graphite backend is not enabled
126
+ */
127
+ getDevice(): GPUDevice;
111
128
  }
@@ -101,4 +101,12 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
101
101
  }
102
102
  return new JsiSkImage(this.CanvasKit, image);
103
103
  }
104
+
105
+ MakeImageFromTexture(_texture: GPUTexture): SkImage {
106
+ return throwNotImplementedOnRNWeb<SkImage>();
107
+ }
108
+
109
+ MakeTextureFromImage(_image: SkImage): GPUTexture {
110
+ return throwNotImplementedOnRNWeb<GPUTexture>();
111
+ }
104
112
  }
@@ -140,4 +140,10 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
140
140
  Recorder: () => {
141
141
  return throwNotImplementedOnRNWeb<JsiRecorder>();
142
142
  },
143
+ getDevice: () => {
144
+ return throwNotImplementedOnRNWeb<GPUDevice>();
145
+ },
146
+ hasDevice: () => {
147
+ return false;
148
+ },
143
149
  });
@@ -27,8 +27,9 @@ type Props = {
27
27
  [NodeType.SRGBToLinearGammaColorFilter]: Record<string, never>;
28
28
  };
29
29
 
30
- interface PushColorFilter<T extends keyof Props>
31
- extends Command<CommandType.PushColorFilter> {
30
+ interface PushColorFilter<
31
+ T extends keyof Props,
32
+ > extends Command<CommandType.PushColorFilter> {
32
33
  colorFilterType: T;
33
34
  props: Props[T];
34
35
  }
@@ -224,8 +224,9 @@ type Props = {
224
224
  [NodeType.RuntimeShaderImageFilter]: RuntimeShaderImageFilterProps;
225
225
  };
226
226
 
227
- interface PushImageFilter<T extends keyof Props>
228
- extends Command<CommandType.PushImageFilter> {
227
+ interface PushImageFilter<
228
+ T extends keyof Props,
229
+ > extends Command<CommandType.PushImageFilter> {
229
230
  imageFilterType: T;
230
231
  props: Props[T];
231
232
  }
@@ -121,8 +121,9 @@ type Props = {
121
121
  [NodeType.Line2DPathEffect]: Line2DPathEffectProps;
122
122
  };
123
123
 
124
- interface PushPathEffect<T extends keyof Props>
125
- extends Command<CommandType.PushPathEffect> {
124
+ interface PushPathEffect<
125
+ T extends keyof Props,
126
+ > extends Command<CommandType.PushPathEffect> {
126
127
  pathEffectType: T;
127
128
  props: Props[T];
128
129
  }
@@ -257,8 +257,9 @@ type Props = {
257
257
  [NodeType.Blend]: BlendProps;
258
258
  };
259
259
 
260
- interface PushShader<T extends keyof Props>
261
- extends Command<CommandType.PushShader> {
260
+ interface PushShader<
261
+ T extends keyof Props,
262
+ > extends Command<CommandType.PushShader> {
262
263
  shaderType: T;
263
264
  props: Props[T];
264
265
  children: number;
@@ -1,11 +1,18 @@
1
1
  import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
2
2
  import type { ViewProps } from "react-native";
3
+ import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
3
4
 
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-ignore - pointerEvents needs to be redeclared for codegen to generate native bindings
4
7
  export interface NativeProps extends ViewProps {
5
8
  debug?: boolean;
6
9
  opaque?: boolean;
7
10
  colorSpace?: string;
8
11
  androidWarmup?: boolean;
12
+ pointerEvents?: WithDefault<
13
+ "auto" | "none" | "box-none" | "box-only",
14
+ "auto"
15
+ >;
9
16
  }
10
17
 
11
18
  // eslint-disable-next-line import/no-default-export
@@ -419,7 +419,10 @@ export const SkiaPictureView = (props: SkiaPictureViewProps) => {
419
419
  const { debug = false, ref: _ref, ...viewProps } = props;
420
420
  return (
421
421
  <Platform.View {...viewProps} onLayout={onLayoutEvent}>
422
- <canvas ref={canvasRef} style={{ display: "flex", flex: 1 }} />
422
+ <canvas
423
+ ref={canvasRef}
424
+ style={{ display: "block", width: "100%", height: "100%" }}
425
+ />
423
426
  </Platform.View>
424
427
  );
425
428
  };