@shopify/react-native-skia 1.2.0 → 1.2.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 (182) hide show
  1. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +3 -3
  2. package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +13 -8
  3. package/cpp/api/JsiNativeBuffer.h +43 -0
  4. package/cpp/api/JsiSkApi.h +3 -3
  5. package/cpp/api/JsiSkImageFactory.h +3 -3
  6. package/cpp/rnskia/RNSkPlatformContext.h +5 -5
  7. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +3 -3
  8. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +70 -93
  9. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +119 -0
  10. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +332 -0
  11. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +2 -1
  12. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +27 -6
  13. package/lib/commonjs/external/ModuleProxy.d.ts +10 -0
  14. package/lib/commonjs/external/ModuleProxy.js +36 -0
  15. package/lib/commonjs/external/ModuleProxy.js.map +1 -0
  16. package/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +3 -0
  17. package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
  18. package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
  19. package/lib/commonjs/external/reanimated/buffers.js +9 -6
  20. package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
  21. package/lib/commonjs/external/reanimated/interpolators.js +8 -7
  22. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  23. package/lib/commonjs/external/reanimated/renderHelpers.js +27 -11
  24. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  25. package/lib/commonjs/external/reanimated/textures.js +4 -3
  26. package/lib/commonjs/external/reanimated/textures.js.map +1 -1
  27. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +6 -6
  28. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  29. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +6 -5
  30. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -1
  31. package/lib/commonjs/renderer/Offscreen.js +1 -5
  32. package/lib/commonjs/renderer/Offscreen.js.map +1 -1
  33. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +8 -15
  34. package/lib/commonjs/skia/types/Image/ImageFactory.js +1 -10
  35. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  36. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
  37. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +13 -0
  38. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -0
  39. package/lib/commonjs/skia/types/NativeBuffer/index.d.ts +1 -0
  40. package/lib/commonjs/skia/types/NativeBuffer/index.js +17 -0
  41. package/lib/commonjs/skia/types/NativeBuffer/index.js.map +1 -0
  42. package/lib/commonjs/skia/types/Skia.d.ts +2 -2
  43. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  44. package/lib/commonjs/skia/types/index.d.ts +1 -1
  45. package/lib/commonjs/skia/types/index.js +4 -4
  46. package/lib/commonjs/skia/types/index.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +3 -2
  48. package/lib/commonjs/skia/web/JsiSkImageFactory.js +18 -2
  49. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  50. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
  51. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +29 -0
  52. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +1 -0
  53. package/lib/commonjs/skia/web/JsiSkia.js +2 -2
  54. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  55. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +0 -2
  56. package/lib/commonjs/specs/NativeSkiaModule.web.js +0 -8
  57. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  58. package/lib/module/external/ModuleProxy.d.ts +10 -0
  59. package/lib/module/external/ModuleProxy.js +28 -0
  60. package/lib/module/external/ModuleProxy.js.map +1 -0
  61. package/lib/module/external/reanimated/ReanimatedProxy.d.ts +3 -0
  62. package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
  63. package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
  64. package/lib/module/external/reanimated/buffers.js +8 -6
  65. package/lib/module/external/reanimated/buffers.js.map +1 -1
  66. package/lib/module/external/reanimated/interpolators.js +7 -7
  67. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  68. package/lib/module/external/reanimated/renderHelpers.js +26 -11
  69. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  70. package/lib/module/external/reanimated/textures.js +3 -3
  71. package/lib/module/external/reanimated/textures.js.map +1 -1
  72. package/lib/module/external/reanimated/useAnimatedImageValue.js +5 -6
  73. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  74. package/lib/module/external/reanimated/useDerivedValueOnJS.js +5 -5
  75. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -1
  76. package/lib/module/renderer/Offscreen.js +1 -5
  77. package/lib/module/renderer/Offscreen.js.map +1 -1
  78. package/lib/module/skia/types/Image/ImageFactory.d.ts +8 -15
  79. package/lib/module/skia/types/Image/ImageFactory.js +1 -10
  80. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  81. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
  82. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +4 -0
  83. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -0
  84. package/lib/module/skia/types/NativeBuffer/index.d.ts +1 -0
  85. package/lib/module/skia/types/NativeBuffer/index.js +2 -0
  86. package/lib/module/skia/types/NativeBuffer/index.js.map +1 -0
  87. package/lib/module/skia/types/Skia.d.ts +2 -2
  88. package/lib/module/skia/types/Skia.js.map +1 -1
  89. package/lib/module/skia/types/index.d.ts +1 -1
  90. package/lib/module/skia/types/index.js +1 -1
  91. package/lib/module/skia/types/index.js.map +1 -1
  92. package/lib/module/skia/web/JsiSkImageFactory.d.ts +3 -2
  93. package/lib/module/skia/web/JsiSkImageFactory.js +18 -2
  94. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  95. package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
  96. package/lib/module/skia/web/JsiSkNativeBufferFactory.js +22 -0
  97. package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +1 -0
  98. package/lib/module/skia/web/JsiSkia.js +2 -2
  99. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  100. package/lib/module/specs/NativeSkiaModule.web.d.ts +0 -2
  101. package/lib/module/specs/NativeSkiaModule.web.js +0 -3
  102. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  103. package/lib/typescript/src/external/ModuleProxy.d.ts +10 -0
  104. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +3 -0
  105. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +8 -15
  106. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +18 -0
  107. package/lib/typescript/src/skia/types/NativeBuffer/index.d.ts +1 -0
  108. package/lib/typescript/src/skia/types/Skia.d.ts +2 -2
  109. package/lib/typescript/src/skia/types/index.d.ts +1 -1
  110. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +3 -2
  111. package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +8 -0
  112. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +0 -2
  113. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  114. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  115. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  116. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  117. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  118. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  119. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  120. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  121. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  122. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  123. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  124. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  125. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  126. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  127. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  128. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  129. package/package.json +1 -1
  130. package/src/external/ModuleProxy.ts +30 -0
  131. package/src/external/reanimated/ReanimatedProxy.ts +18 -0
  132. package/src/external/reanimated/buffers.ts +7 -6
  133. package/src/external/reanimated/interpolators.ts +7 -12
  134. package/src/external/reanimated/renderHelpers.ts +31 -18
  135. package/src/external/reanimated/textures.tsx +3 -3
  136. package/src/external/reanimated/useAnimatedImageValue.ts +5 -10
  137. package/src/external/reanimated/useDerivedValueOnJS.ts +5 -10
  138. package/src/renderer/Offscreen.tsx +1 -7
  139. package/src/skia/types/Image/ImageFactory.ts +7 -23
  140. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +38 -0
  141. package/src/skia/types/NativeBuffer/index.ts +1 -0
  142. package/src/skia/types/Skia.ts +2 -2
  143. package/src/skia/types/index.ts +1 -1
  144. package/src/skia/web/JsiSkImageFactory.ts +28 -6
  145. package/src/skia/web/JsiSkNativeBufferFactory.ts +35 -0
  146. package/src/skia/web/JsiSkia.ts +2 -2
  147. package/src/specs/NativeSkiaModule.web.ts +0 -4
  148. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerDelegate.java +0 -34
  149. package/cpp/api/JsiPlatformBuffer.h +0 -51
  150. package/cpp/skia/include/gpu/GrBackendDrawableInfo.h +0 -9
  151. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +0 -15
  152. package/lib/commonjs/external/reanimated/moduleWrapper.js +0 -46
  153. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +0 -1
  154. package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
  155. package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js +0 -6
  156. package/lib/commonjs/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +0 -1
  157. package/lib/commonjs/skia/types/PlatformBuffer/index.d.ts +0 -1
  158. package/lib/commonjs/skia/types/PlatformBuffer/index.js +0 -17
  159. package/lib/commonjs/skia/types/PlatformBuffer/index.js.map +0 -1
  160. package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
  161. package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js +0 -20
  162. package/lib/commonjs/skia/web/JsiSkPlatformBufferFactory.js.map +0 -1
  163. package/lib/module/external/reanimated/moduleWrapper.d.ts +0 -15
  164. package/lib/module/external/reanimated/moduleWrapper.js +0 -37
  165. package/lib/module/external/reanimated/moduleWrapper.js.map +0 -1
  166. package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
  167. package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js +0 -2
  168. package/lib/module/skia/types/PlatformBuffer/PlatformBufferFactory.js.map +0 -1
  169. package/lib/module/skia/types/PlatformBuffer/index.d.ts +0 -1
  170. package/lib/module/skia/types/PlatformBuffer/index.js +0 -2
  171. package/lib/module/skia/types/PlatformBuffer/index.js.map +0 -1
  172. package/lib/module/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
  173. package/lib/module/skia/web/JsiSkPlatformBufferFactory.js +0 -13
  174. package/lib/module/skia/web/JsiSkPlatformBufferFactory.js.map +0 -1
  175. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +0 -15
  176. package/lib/typescript/src/skia/types/PlatformBuffer/PlatformBufferFactory.d.ts +0 -12
  177. package/lib/typescript/src/skia/types/PlatformBuffer/index.d.ts +0 -1
  178. package/lib/typescript/src/skia/web/JsiSkPlatformBufferFactory.d.ts +0 -8
  179. package/src/external/reanimated/moduleWrapper.ts +0 -83
  180. package/src/skia/types/PlatformBuffer/PlatformBufferFactory.ts +0 -14
  181. package/src/skia/types/PlatformBuffer/index.ts +0 -1
  182. package/src/skia/web/JsiSkPlatformBufferFactory.ts +0 -22
@@ -1 +0,0 @@
1
- {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","useSharedValue","_Reanimated","useDerivedValue","_Reanimated2","useFrameCallback","_Reanimated3","startMapper","_Reanimated4","stopMapper","_Reanimated5","runOnJS","_Reanimated6","runOnUI","_Reanimated7","makeMutable","_Reanimated8","useAnimatedReaction","_Reanimated9","isSharedValue","value","undefined"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DependencyList } from \"react\";\nimport type {\n DerivedValue,\n FrameCallback,\n FrameInfo,\n SharedValue,\n} from \"react-native-reanimated\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion = require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nexport const useSharedValue: <T>(\n init: T,\n oneWayReadsOnly?: boolean\n) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;\n\nexport const useDerivedValue: <T>(\n processor: () => T,\n dependencies?: DependencyList\n) => DerivedValue<T> = Reanimated2?.useDerivedValue || throwOnMissingReanimated;\n\nexport const useFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n autostart?: boolean\n) => FrameCallback = Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper: (\n worklet: () => void,\n inputs?: unknown[],\n outputs?: unknown[]\n) => number = Reanimated2?.startMapper || throwOnMissingReanimated;\n\nexport const stopMapper: (mapperID: number) => void =\n Reanimated2?.stopMapper || throwOnMissingReanimated;\n\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const runOnUI = Reanimated2?.runOnUI || throwOnMissingReanimated;\nexport const makeMutable: <T>(val: T) => SharedValue<T> =\n Reanimated2?.makeMutable || throwOnMissingReanimated;\n\nexport const useAnimatedReaction: <T>(\n prepare: () => T,\n react: (v: T) => void,\n dependencies?: DependencyList\n) => void = Reanimated2?.useAnimatedReaction || throwOnMissingReanimated;\n\nexport const isSharedValue = <T>(value: unknown): value is SharedValue<T> => {\n return (\n !!value &&\n (Reanimated3\n ? Reanimated3.isSharedValue(value)\n : (value as any).value !== undefined)\n );\n};\n"],"mappings":";AAAA;;AASA;AACA;;AAEA,IAAIA,WAAgB;AAEpB,IAAIC,WAAgB;AACpB,IAAIC,iBAAyB;AAE7B,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAyB,CAAC;EAChDD,iBAAiB,GAAGC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EAC3E,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACG,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAJ,WAAW,GAAGD,WAAW;EAC3B;AACF,CAAC,CAAC,OAAOM,CAAC,EAAE,CAAC;AAEb,OAAO,MAAMC,eAAe,GAAG,CAAC,CAACP,WAAW;AAC5C,OAAO,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAAW;AAE5C,OAAO,SAASQ,wBAAwBA,CAAA,EAAG;EACzC,IAAI,CAACF,eAAe,EAAE;IACpB,MAAM,IAAIG,KAAK,CACb;AACN,iDACI,CAAC;EACH;AACF;AAEA,OAAO,MAAMC,cAGM,GAAG,EAAAC,WAAA,GAAAZ,WAAW,cAAAY,WAAA,uBAAXA,WAAA,CAAaD,cAAc,KAAIF,wBAAwB;AAE7E,OAAO,MAAMI,eAGO,GAAG,EAAAC,YAAA,GAAAd,WAAW,cAAAc,YAAA,uBAAXA,YAAA,CAAaD,eAAe,KAAIJ,wBAAwB;AAE/E,OAAO,MAAMM,gBAGK,GAAG,EAAAC,YAAA,GAAAhB,WAAW,cAAAgB,YAAA,uBAAXA,YAAA,CAAaD,gBAAgB,KAAIN,wBAAwB;AAE9E,OAAO,MAAMQ,WAIF,GAAG,EAAAC,YAAA,GAAAlB,WAAW,cAAAkB,YAAA,uBAAXA,YAAA,CAAaD,WAAW,KAAIR,wBAAwB;AAElE,OAAO,MAAMU,UAAsC,GACjD,EAAAC,YAAA,GAAApB,WAAW,cAAAoB,YAAA,uBAAXA,YAAA,CAAaD,UAAU,KAAIV,wBAAwB;AAErD,OAAO,MAAMY,OAAO,GAAG,EAAAC,YAAA,GAAAtB,WAAW,cAAAsB,YAAA,uBAAXA,YAAA,CAAaD,OAAO,KAAIZ,wBAAwB;AACvE,OAAO,MAAMc,OAAO,GAAG,EAAAC,YAAA,GAAAxB,WAAW,cAAAwB,YAAA,uBAAXA,YAAA,CAAaD,OAAO,KAAId,wBAAwB;AACvE,OAAO,MAAMgB,WAA0C,GACrD,EAAAC,YAAA,GAAA1B,WAAW,cAAA0B,YAAA,uBAAXA,YAAA,CAAaD,WAAW,KAAIhB,wBAAwB;AAEtD,OAAO,MAAMkB,mBAIJ,GAAG,EAAAC,YAAA,GAAA5B,WAAW,cAAA4B,YAAA,uBAAXA,YAAA,CAAaD,mBAAmB,KAAIlB,wBAAwB;AAExE,OAAO,MAAMoB,aAAa,GAAOC,KAAc,IAA8B;EAC3E,OACE,CAAC,CAACA,KAAK,KACN7B,WAAW,GACRA,WAAW,CAAC4B,aAAa,CAACC,KAAK,CAAC,GAC/BA,KAAK,CAASA,KAAK,KAAKC,SAAS,CAAC;AAE3C,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { SkImage } from "../Image";
2
- export type PlatformBuffer = bigint;
3
- export interface PlatformBufferFactory {
4
- /**
5
- * Copy pixels to a platform buffer. (for testing purposes)
6
- */
7
- MakeFromImage: (image: SkImage) => PlatformBuffer;
8
- /**
9
- * Release a platform buffer that was created with `MakeFromImage`.
10
- */
11
- Release: (platformBuffer: PlatformBuffer) => void;
12
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=PlatformBufferFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["PlatformBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport type PlatformBuffer = bigint;\n\nexport interface PlatformBufferFactory {\n /**\n * Copy pixels to a platform buffer. (for testing purposes)\n */\n MakeFromImage: (image: SkImage) => PlatformBuffer;\n /**\n * Release a platform buffer that was created with `MakeFromImage`.\n */\n Release: (platformBuffer: PlatformBuffer) => void;\n}\n"],"mappings":""}
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,2 +0,0 @@
1
- export * from "./PlatformBufferFactory";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./PlatformBufferFactory\";\n"],"mappings":"AAAA,cAAc,yBAAyB"}
@@ -1,8 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
3
- import { Host } from "./Host";
4
- export declare class JsiSkPlatformBufferFactory extends Host implements PlatformBufferFactory {
5
- constructor(CanvasKit: CanvasKit);
6
- MakeFromImage(_image: SkImage): PlatformBuffer;
7
- Release(_platformBuffer: PlatformBuffer): void;
8
- }
@@ -1,13 +0,0 @@
1
- import { Host, NotImplementedOnRNWeb } from "./Host";
2
- export class JsiSkPlatformBufferFactory extends Host {
3
- constructor(CanvasKit) {
4
- super(CanvasKit);
5
- }
6
- MakeFromImage(_image) {
7
- throw new NotImplementedOnRNWeb();
8
- }
9
- Release(_platformBuffer) {
10
- throw new NotImplementedOnRNWeb();
11
- }
12
- }
13
- //# sourceMappingURL=JsiSkPlatformBufferFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Host","NotImplementedOnRNWeb","JsiSkPlatformBufferFactory","constructor","CanvasKit","MakeFromImage","_image","Release","_platformBuffer"],"sources":["JsiSkPlatformBufferFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { PlatformBuffer, PlatformBufferFactory, SkImage } from \"../types\";\n\nimport { Host, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkPlatformBufferFactory\n extends Host\n implements PlatformBufferFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromImage(_image: SkImage): PlatformBuffer {\n throw new NotImplementedOnRNWeb();\n }\n\n Release(_platformBuffer: PlatformBuffer) {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":"AAIA,SAASA,IAAI,EAAEC,qBAAqB,QAAQ,QAAQ;AAEpD,OAAO,MAAMC,0BAA0B,SAC7BF,IAAI,CAEd;EACEG,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,aAAaA,CAACC,MAAe,EAAkB;IAC7C,MAAM,IAAIL,qBAAqB,CAAC,CAAC;EACnC;EAEAM,OAAOA,CAACC,eAA+B,EAAE;IACvC,MAAM,IAAIP,qBAAqB,CAAC,CAAC;EACnC;AACF"}
@@ -1,15 +0,0 @@
1
- import type { DependencyList } from "react";
2
- import type { DerivedValue, FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
3
- export declare const HAS_REANIMATED2: boolean;
4
- export declare const HAS_REANIMATED3: boolean;
5
- export declare function throwOnMissingReanimated(): void;
6
- export declare const useSharedValue: <T>(init: T, oneWayReadsOnly?: boolean) => SharedValue<T>;
7
- export declare const useDerivedValue: <T>(processor: () => T, dependencies?: DependencyList) => DerivedValue<T>;
8
- export declare const useFrameCallback: (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) => FrameCallback;
9
- export declare const startMapper: (worklet: () => void, inputs?: unknown[], outputs?: unknown[]) => number;
10
- export declare const stopMapper: (mapperID: number) => void;
11
- export declare const runOnJS: any;
12
- export declare const runOnUI: any;
13
- export declare const makeMutable: <T>(val: T) => SharedValue<T>;
14
- export declare const useAnimatedReaction: <T>(prepare: () => T, react: (v: T) => void, dependencies?: DependencyList) => void;
15
- export declare const isSharedValue: <T>(value: unknown) => value is SharedValue<T>;
@@ -1,12 +0,0 @@
1
- import type { SkImage } from "../Image";
2
- export type PlatformBuffer = bigint;
3
- export interface PlatformBufferFactory {
4
- /**
5
- * Copy pixels to a platform buffer. (for testing purposes)
6
- */
7
- MakeFromImage: (image: SkImage) => PlatformBuffer;
8
- /**
9
- * Release a platform buffer that was created with `MakeFromImage`.
10
- */
11
- Release: (platformBuffer: PlatformBuffer) => void;
12
- }
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,8 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
3
- import { Host } from "./Host";
4
- export declare class JsiSkPlatformBufferFactory extends Host implements PlatformBufferFactory {
5
- constructor(CanvasKit: CanvasKit);
6
- MakeFromImage(_image: SkImage): PlatformBuffer;
7
- Release(_platformBuffer: PlatformBuffer): void;
8
- }
@@ -1,83 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import type { DependencyList } from "react";
3
- import type {
4
- DerivedValue,
5
- FrameCallback,
6
- FrameInfo,
7
- SharedValue,
8
- } from "react-native-reanimated";
9
-
10
- // This one is needed for the deprecated useSharedValue function
11
- // We can remove it once we remove the deprecation
12
-
13
- let Reanimated2: any;
14
-
15
- let Reanimated3: any;
16
- let reanimatedVersion: string;
17
-
18
- try {
19
- Reanimated2 = require("react-native-reanimated");
20
- reanimatedVersion = require("react-native-reanimated/package.json").version;
21
- if (
22
- reanimatedVersion &&
23
- (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
24
- ) {
25
- Reanimated3 = Reanimated2;
26
- }
27
- } catch (e) {}
28
-
29
- export const HAS_REANIMATED2 = !!Reanimated2;
30
- export const HAS_REANIMATED3 = !!Reanimated3;
31
-
32
- export function throwOnMissingReanimated() {
33
- if (!HAS_REANIMATED2) {
34
- throw new Error(
35
- "Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
36
- react-native-skia's integration layer API."
37
- );
38
- }
39
- }
40
-
41
- export const useSharedValue: <T>(
42
- init: T,
43
- oneWayReadsOnly?: boolean
44
- ) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;
45
-
46
- export const useDerivedValue: <T>(
47
- processor: () => T,
48
- dependencies?: DependencyList
49
- ) => DerivedValue<T> = Reanimated2?.useDerivedValue || throwOnMissingReanimated;
50
-
51
- export const useFrameCallback: (
52
- callback: (frameInfo: FrameInfo) => void,
53
- autostart?: boolean
54
- ) => FrameCallback = Reanimated2?.useFrameCallback || throwOnMissingReanimated;
55
-
56
- export const startMapper: (
57
- worklet: () => void,
58
- inputs?: unknown[],
59
- outputs?: unknown[]
60
- ) => number = Reanimated2?.startMapper || throwOnMissingReanimated;
61
-
62
- export const stopMapper: (mapperID: number) => void =
63
- Reanimated2?.stopMapper || throwOnMissingReanimated;
64
-
65
- export const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;
66
- export const runOnUI = Reanimated2?.runOnUI || throwOnMissingReanimated;
67
- export const makeMutable: <T>(val: T) => SharedValue<T> =
68
- Reanimated2?.makeMutable || throwOnMissingReanimated;
69
-
70
- export const useAnimatedReaction: <T>(
71
- prepare: () => T,
72
- react: (v: T) => void,
73
- dependencies?: DependencyList
74
- ) => void = Reanimated2?.useAnimatedReaction || throwOnMissingReanimated;
75
-
76
- export const isSharedValue = <T>(value: unknown): value is SharedValue<T> => {
77
- return (
78
- !!value &&
79
- (Reanimated3
80
- ? Reanimated3.isSharedValue(value)
81
- : (value as any).value !== undefined)
82
- );
83
- };
@@ -1,14 +0,0 @@
1
- import type { SkImage } from "../Image";
2
-
3
- export type PlatformBuffer = bigint;
4
-
5
- export interface PlatformBufferFactory {
6
- /**
7
- * Copy pixels to a platform buffer. (for testing purposes)
8
- */
9
- MakeFromImage: (image: SkImage) => PlatformBuffer;
10
- /**
11
- * Release a platform buffer that was created with `MakeFromImage`.
12
- */
13
- Release: (platformBuffer: PlatformBuffer) => void;
14
- }
@@ -1 +0,0 @@
1
- export * from "./PlatformBufferFactory";
@@ -1,22 +0,0 @@
1
- import type { CanvasKit } from "canvaskit-wasm";
2
-
3
- import type { PlatformBuffer, PlatformBufferFactory, SkImage } from "../types";
4
-
5
- import { Host, NotImplementedOnRNWeb } from "./Host";
6
-
7
- export class JsiSkPlatformBufferFactory
8
- extends Host
9
- implements PlatformBufferFactory
10
- {
11
- constructor(CanvasKit: CanvasKit) {
12
- super(CanvasKit);
13
- }
14
-
15
- MakeFromImage(_image: SkImage): PlatformBuffer {
16
- throw new NotImplementedOnRNWeb();
17
- }
18
-
19
- Release(_platformBuffer: PlatformBuffer) {
20
- throw new NotImplementedOnRNWeb();
21
- }
22
- }