@shopify/react-native-skia 1.2.1 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +34 -14
  2. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +2 -1
  3. package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +13 -8
  4. package/cpp/api/JsiSkImageFactory.h +3 -3
  5. package/cpp/rnskia/RNSkPlatformContext.h +3 -3
  6. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +2 -6
  7. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +42 -7
  8. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +178 -5
  9. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +10 -13
  10. package/lib/commonjs/external/ModuleProxy.d.ts +10 -0
  11. package/lib/commonjs/external/ModuleProxy.js +36 -0
  12. package/lib/commonjs/external/ModuleProxy.js.map +1 -0
  13. package/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +3 -0
  14. package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
  15. package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
  16. package/lib/commonjs/external/reanimated/buffers.js +9 -6
  17. package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
  18. package/lib/commonjs/external/reanimated/interpolators.js +8 -7
  19. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  20. package/lib/commonjs/external/reanimated/renderHelpers.js +27 -11
  21. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  22. package/lib/commonjs/external/reanimated/textures.js +4 -3
  23. package/lib/commonjs/external/reanimated/textures.js.map +1 -1
  24. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +6 -6
  25. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  26. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +6 -5
  27. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -1
  28. package/lib/commonjs/renderer/Offscreen.js +1 -5
  29. package/lib/commonjs/renderer/Offscreen.js.map +1 -1
  30. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +3 -3
  31. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  32. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -3
  33. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  34. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.d.ts +1 -1
  35. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js +1 -1
  36. package/lib/commonjs/skia/web/JsiSkNativeBufferFactory.js.map +1 -1
  37. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +0 -2
  38. package/lib/commonjs/specs/NativeSkiaModule.web.js +0 -8
  39. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  40. package/lib/module/external/ModuleProxy.d.ts +10 -0
  41. package/lib/module/external/ModuleProxy.js +28 -0
  42. package/lib/module/external/ModuleProxy.js.map +1 -0
  43. package/lib/module/external/reanimated/ReanimatedProxy.d.ts +3 -0
  44. package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
  45. package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
  46. package/lib/module/external/reanimated/buffers.js +8 -6
  47. package/lib/module/external/reanimated/buffers.js.map +1 -1
  48. package/lib/module/external/reanimated/interpolators.js +7 -7
  49. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  50. package/lib/module/external/reanimated/renderHelpers.js +26 -11
  51. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  52. package/lib/module/external/reanimated/textures.js +3 -3
  53. package/lib/module/external/reanimated/textures.js.map +1 -1
  54. package/lib/module/external/reanimated/useAnimatedImageValue.js +5 -6
  55. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  56. package/lib/module/external/reanimated/useDerivedValueOnJS.js +5 -5
  57. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -1
  58. package/lib/module/renderer/Offscreen.js +1 -5
  59. package/lib/module/renderer/Offscreen.js.map +1 -1
  60. package/lib/module/skia/types/Image/ImageFactory.d.ts +3 -3
  61. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  62. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -3
  63. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  64. package/lib/module/skia/web/JsiSkNativeBufferFactory.d.ts +1 -1
  65. package/lib/module/skia/web/JsiSkNativeBufferFactory.js +1 -1
  66. package/lib/module/skia/web/JsiSkNativeBufferFactory.js.map +1 -1
  67. package/lib/module/specs/NativeSkiaModule.web.d.ts +0 -2
  68. package/lib/module/specs/NativeSkiaModule.web.js +0 -3
  69. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  70. package/lib/typescript/src/external/ModuleProxy.d.ts +10 -0
  71. package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +3 -0
  72. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +3 -3
  73. package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +3 -3
  74. package/lib/typescript/src/skia/web/JsiSkNativeBufferFactory.d.ts +1 -1
  75. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +0 -2
  76. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  77. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  78. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  79. package/libs/ios/libskottie.xcframework/Info.plist +5 -5
  80. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  81. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  82. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  83. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  84. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  85. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  86. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  87. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  88. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  89. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  90. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  91. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  92. package/package.json +1 -1
  93. package/src/external/ModuleProxy.ts +30 -0
  94. package/src/external/reanimated/ReanimatedProxy.ts +18 -0
  95. package/src/external/reanimated/buffers.ts +7 -6
  96. package/src/external/reanimated/interpolators.ts +7 -12
  97. package/src/external/reanimated/renderHelpers.ts +31 -18
  98. package/src/external/reanimated/textures.tsx +3 -3
  99. package/src/external/reanimated/useAnimatedImageValue.ts +5 -10
  100. package/src/external/reanimated/useDerivedValueOnJS.ts +5 -10
  101. package/src/renderer/Offscreen.tsx +1 -7
  102. package/src/skia/types/Image/ImageFactory.ts +3 -3
  103. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +3 -3
  104. package/src/skia/web/JsiSkNativeBufferFactory.ts +1 -1
  105. package/src/specs/NativeSkiaModule.web.ts +0 -4
  106. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerDelegate.java +0 -34
  107. package/cpp/skia/include/gpu/GrBackendDrawableInfo.h +0 -9
  108. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +0 -15
  109. package/lib/commonjs/external/reanimated/moduleWrapper.js +0 -46
  110. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +0 -1
  111. package/lib/module/external/reanimated/moduleWrapper.d.ts +0 -15
  112. package/lib/module/external/reanimated/moduleWrapper.js +0 -37
  113. package/lib/module/external/reanimated/moduleWrapper.js.map +0 -1
  114. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +0 -15
  115. package/src/external/reanimated/moduleWrapper.ts +0 -83
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_skia","_moduleWrapper","_interpolators","useBufferValue","size","bufferInitializer","useMemo","makeMutable","Array","fill","map","useBuffer","modifier","_mod$__closure","values","mod","deps","Object","__closure","mapperId","startMapper","value","forEach","val","index","notifyChange","useEffect","stopMapper","useRectBuffer","Skia","XYWHRect","exports","useRSXformBuffer","RSXform","usePointBuffer","Point","useColorBuffer","Color"],"sources":["buffers.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport type { WorkletFunction } from \"react-native-reanimated/lib/typescript/reanimated2/commonTypes\";\n\nimport type { SkColor, SkHostRect, SkPoint, SkRSXform } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport { startMapper, stopMapper, makeMutable } from \"./moduleWrapper\";\nimport { notifyChange } from \"./interpolators\";\n\ntype Modifier<T> = (input: T, index: number) => void;\n\nconst useBufferValue = <T>(size: number, bufferInitializer: () => T) =>\n useMemo(\n () => makeMutable(new Array(size).fill(0).map(bufferInitializer)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [size]\n );\n\nconst useBuffer = <T>(\n size: number,\n bufferInitializer: () => T,\n modifier: Modifier<T>\n) => {\n const values = useBufferValue(size, bufferInitializer);\n const mod = modifier as WorkletFunction;\n const deps = [size, ...Object.values(mod.__closure ?? {})];\n const mapperId = startMapper(() => {\n \"worklet\";\n values.value.forEach((val, index) => {\n modifier(val, index);\n });\n notifyChange(values);\n }, deps);\n\n useEffect(() => {\n return () => {\n stopMapper(mapperId);\n };\n }, [mapperId]);\n\n return values;\n};\n\nexport const useRectBuffer = (size: number, modifier: Modifier<SkHostRect>) =>\n useBuffer(size, () => Skia.XYWHRect(0, 0, 0, 0), modifier);\n\n// Usage for RSXform Buffer\nexport const useRSXformBuffer = (size: number, modifier: Modifier<SkRSXform>) =>\n useBuffer(size, () => Skia.RSXform(1, 0, 0, 0), modifier);\n\n// Usage for Point Buffer\nexport const usePointBuffer = (size: number, modifier: Modifier<SkPoint>) =>\n useBuffer(size, () => Skia.Point(0, 0), modifier);\n\n// Usage for Color Buffer\nexport const useColorBuffer = (size: number, modifier: Modifier<SkColor>) =>\n useBuffer(size, () => Skia.Color(\"black\"), modifier);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAIA,MAAMI,cAAc,GAAGA,CAAIC,IAAY,EAAEC,iBAA0B,KACjE,IAAAC,cAAO,EACL,MAAM,IAAAC,0BAAW,EAAC,IAAIC,KAAK,CAACJ,IAAI,CAAC,CAACK,IAAI,CAAC,CAAC,CAAC,CAACC,GAAG,CAACL,iBAAiB,CAAC,CAAC;AACjE;AACA,CAACD,IAAI,CACP,CAAC;AAEH,MAAMO,SAAS,GAAGA,CAChBP,IAAY,EACZC,iBAA0B,EAC1BO,QAAqB,KAClB;EAAA,IAAAC,cAAA;EACH,MAAMC,MAAM,GAAGX,cAAc,CAACC,IAAI,EAAEC,iBAAiB,CAAC;EACtD,MAAMU,GAAG,GAAGH,QAA2B;EACvC,MAAMI,IAAI,GAAG,CAACZ,IAAI,EAAE,GAAGa,MAAM,CAACH,MAAM,EAAAD,cAAA,GAACE,GAAG,CAACG,SAAS,cAAAL,cAAA,cAAAA,cAAA,GAAI,CAAC,CAAC,CAAC,CAAC;EAC1D,MAAMM,QAAQ,GAAG,IAAAC,0BAAW,EAAC,MAAM;IACjC,SAAS;;IACTN,MAAM,CAACO,KAAK,CAACC,OAAO,CAAC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,"names":["_react","require","_skia","_interpolators","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","useBufferValue","size","bufferInitializer","useMemo","Rea","makeMutable","Array","fill","map","useBuffer","modifier","_mod$__closure","values","mod","deps","Object","__closure","mapperId","startMapper","value","forEach","val","index","notifyChange","useEffect","stopMapper","useRectBuffer","Skia","XYWHRect","exports","useRSXformBuffer","RSXform","usePointBuffer","Point","useColorBuffer","Color"],"sources":["buffers.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport type { WorkletFunction } from \"react-native-reanimated/lib/typescript/reanimated2/commonTypes\";\n\nimport type { SkColor, SkHostRect, SkPoint, SkRSXform } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport { notifyChange } from \"./interpolators\";\nimport Rea from \"./ReanimatedProxy\";\n\ntype Modifier<T> = (input: T, index: number) => void;\n\nconst useBufferValue = <T>(size: number, bufferInitializer: () => T) => {\n return useMemo(\n () => Rea.makeMutable(new Array(size).fill(0).map(bufferInitializer)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [size]\n );\n};\n\nconst useBuffer = <T>(\n size: number,\n bufferInitializer: () => T,\n modifier: Modifier<T>\n) => {\n const values = useBufferValue(size, bufferInitializer);\n const mod = modifier as WorkletFunction;\n const deps = [size, ...Object.values(mod.__closure ?? {})];\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n values.value.forEach((val, index) => {\n modifier(val, index);\n });\n notifyChange(values);\n }, deps);\n\n useEffect(() => {\n return () => {\n Rea.stopMapper(mapperId);\n };\n }, [mapperId]);\n\n return values;\n};\n\nexport const useRectBuffer = (size: number, modifier: Modifier<SkHostRect>) =>\n useBuffer(size, () => Skia.XYWHRect(0, 0, 0, 0), modifier);\n\n// Usage for RSXform Buffer\nexport const useRSXformBuffer = (size: number, modifier: Modifier<SkRSXform>) =>\n useBuffer(size, () => Skia.RSXform(1, 0, 0, 0), modifier);\n\n// Usage for Point Buffer\nexport const usePointBuffer = (size: number, modifier: Modifier<SkPoint>) =>\n useBuffer(size, () => Skia.Point(0, 0), modifier);\n\n// Usage for Color Buffer\nexport const useColorBuffer = (size: number, modifier: Modifier<SkColor>) =>\n useBuffer(size, () => Skia.Color(\"black\"), modifier);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAoC,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIpC,MAAMG,cAAc,GAAGA,CAAIC,IAAY,EAAEC,iBAA0B,KAAK;EACtE,OAAO,IAAAC,cAAO,EACZ,MAAMC,wBAAG,CAACC,WAAW,CAAC,IAAIC,KAAK,CAACL,IAAI,CAAC,CAACM,IAAI,CAAC,CAAC,CAAC,CAACC,GAAG,CAACN,iBAAiB,CAAC,CAAC;EACrE;EACA,CAACD,IAAI,CACP,CAAC;AACH,CAAC;AAED,MAAMQ,SAAS,GAAGA,CAChBR,IAAY,EACZC,iBAA0B,EAC1BQ,QAAqB,KAClB;EAAA,IAAAC,cAAA;EACH,MAAMC,MAAM,GAAGZ,cAAc,CAACC,IAAI,EAAEC,iBAAiB,CAAC;EACtD,MAAMW,GAAG,GAAGH,QAA2B;EACvC,MAAMI,IAAI,GAAG,CAACb,IAAI,EAAE,GAAGc,MAAM,CAACH,MAAM,EAAAD,cAAA,GAACE,GAAG,CAACG,SAAS,cAAAL,cAAA,cAAAA,cAAA,GAAI,CAAC,CAAC,CAAC,CAAC;EAC1D,MAAMM,QAAQ,GAAGb,wBAAG,CAACc,WAAW,CAAC,MAAM;IACrC,SAAS;;IACTN,MAAM,CAACO,KAAK,CAACC,OAAO,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;MACnCZ,QAAQ,CAACW,GAAG,EAAEC,KAAK,CAAC;IACtB,CAAC,CAAC;IACF,IAAAC,2BAAY,EAACX,MAAM,CAAC;EACtB,CAAC,EAAEE,IAAI,CAAC;EAER,IAAAU,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACXpB,wBAAG,CAACqB,UAAU,CAACR,QAAQ,CAAC;IAC1B,CAAC;EACH,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EAEd,OAAOL,MAAM;AACf,CAAC;AAEM,MAAMc,aAAa,GAAGA,CAACzB,IAAY,EAAES,QAA8B,KACxED,SAAS,CAACR,IAAI,EAAE,MAAM0B,UAAI,CAACC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAElB,QAAQ,CAAC;;AAE5D;AAAAmB,OAAA,CAAAH,aAAA,GAAAA,aAAA;AACO,MAAMI,gBAAgB,GAAGA,CAAC7B,IAAY,EAAES,QAA6B,KAC1ED,SAAS,CAACR,IAAI,EAAE,MAAM0B,UAAI,CAACI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAErB,QAAQ,CAAC;;AAE3D;AAAAmB,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AACO,MAAME,cAAc,GAAGA,CAAC/B,IAAY,EAAES,QAA2B,KACtED,SAAS,CAACR,IAAI,EAAE,MAAM0B,UAAI,CAACM,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAEvB,QAAQ,CAAC;;AAEnD;AAAAmB,OAAA,CAAAG,cAAA,GAAAA,cAAA;AACO,MAAME,cAAc,GAAGA,CAACjC,IAAY,EAAES,QAA2B,KACtED,SAAS,CAACR,IAAI,EAAE,MAAM0B,UAAI,CAACQ,KAAK,CAAC,OAAO,CAAC,EAAEzB,QAAQ,CAAC;AAACmB,OAAA,CAAAK,cAAA,GAAAA,cAAA"}
@@ -8,7 +8,8 @@ var _react = require("react");
8
8
  var _animation = require("../../animation");
9
9
  var _skia = require("../../skia");
10
10
  var _Offscreen = require("../../renderer/Offscreen");
11
- var _moduleWrapper = require("./moduleWrapper");
11
+ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13
  const notifyChange = value => {
13
14
  "worklet";
14
15
 
@@ -20,8 +21,8 @@ const notifyChange = value => {
20
21
  exports.notifyChange = notifyChange;
21
22
  const usePathValue = (cb, init) => {
22
23
  const pathInit = (0, _react.useMemo)(() => _skia.Skia.Path.Make(), []);
23
- const path = (0, _moduleWrapper.useSharedValue)(pathInit);
24
- (0, _moduleWrapper.useDerivedValue)(() => {
24
+ const path = _ReanimatedProxy.default.useSharedValue(pathInit);
25
+ _ReanimatedProxy.default.useDerivedValue(() => {
25
26
  path.value.reset();
26
27
  if (init !== undefined) {
27
28
  path.value.addPath(init);
@@ -33,13 +34,13 @@ const usePathValue = (cb, init) => {
33
34
  };
34
35
  exports.usePathValue = usePathValue;
35
36
  const useClock = () => {
36
- const clock = (0, _moduleWrapper.useSharedValue)(0);
37
+ const clock = _ReanimatedProxy.default.useSharedValue(0);
37
38
  const callback = (0, _react.useCallback)(info => {
38
39
  "worklet";
39
40
 
40
41
  clock.value = info.timeSinceFirstFrame;
41
42
  }, [clock]);
42
- (0, _moduleWrapper.useFrameCallback)(callback);
43
+ _ReanimatedProxy.default.useFrameCallback(callback);
43
44
  return clock;
44
45
  };
45
46
 
@@ -50,8 +51,8 @@ exports.useClock = useClock;
50
51
  const useInterpolator = (factory, value, interpolator, input, output, options) => {
51
52
  // eslint-disable-next-line react-hooks/exhaustive-deps
52
53
  const init = (0, _react.useMemo)(() => factory(), []);
53
- const result = (0, _moduleWrapper.useSharedValue)(init);
54
- (0, _moduleWrapper.useAnimatedReaction)(() => value.value, val => {
54
+ const result = _ReanimatedProxy.default.useSharedValue(init);
55
+ _ReanimatedProxy.default.useAnimatedReaction(() => value.value, val => {
55
56
  result.value = interpolator(val, input, output, options, result.value);
56
57
  notifyChange(result);
57
58
  }, [input, output, options]);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_animation","_skia","_Offscreen","_moduleWrapper","notifyChange","value","isOnMainThread","_value","exports","usePathValue","cb","init","pathInit","useMemo","Skia","Path","Make","path","useSharedValue","useDerivedValue","reset","undefined","addPath","useClock","clock","callback","useCallback","info","timeSinceFirstFrame","useFrameCallback","useInterpolator","factory","interpolator","input","output","options","result","useAnimatedReaction","val","usePathInterpolation","outputRange","allPathsInterpolable","slice","every","isInterpolatable","Error","interpolatePaths","useVectorInterpolation","Point","interpolateVector"],"sources":["interpolators.ts"],"sourcesContent":["import type {\n ExtrapolationType,\n FrameInfo,\n SharedValue,\n} from \"react-native-reanimated\";\nimport { useCallback, useMemo } from \"react\";\n\nimport type { SkPath, SkPoint } from \"../../skia/types\";\nimport { interpolatePaths, interpolateVector } from \"../../animation\";\nimport { Skia } from \"../../skia\";\nimport { isOnMainThread } from \"../../renderer/Offscreen\";\n\nimport {\n useAnimatedReaction,\n useFrameCallback,\n useSharedValue,\n useDerivedValue,\n} from \"./moduleWrapper\";\n\nexport const notifyChange = (value: SharedValue<unknown>) => {\n \"worklet\";\n if (isOnMainThread()) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (value as any)._value = value.value;\n }\n};\n\nexport const usePathValue = (cb: (path: SkPath) => void, init?: SkPath) => {\n const pathInit = useMemo(() => Skia.Path.Make(), []);\n const path = useSharedValue(pathInit);\n useDerivedValue(() => {\n path.value.reset();\n if (init !== undefined) {\n path.value.addPath(init);\n }\n cb(path.value);\n notifyChange(path);\n });\n return path;\n};\n\nexport const useClock = () => {\n const clock = useSharedValue(0);\n const callback = useCallback(\n (info: FrameInfo) => {\n \"worklet\";\n clock.value = info.timeSinceFirstFrame;\n },\n [clock]\n );\n useFrameCallback(callback);\n return clock;\n};\n\n/**\n * @worklet\n */\ntype Interpolator<T> = (\n value: number,\n input: number[],\n output: T[],\n options: ExtrapolationType,\n result: T\n) => T;\n\nconst useInterpolator = <T>(\n factory: () => T,\n value: SharedValue<number>,\n interpolator: Interpolator<T>,\n input: number[],\n output: T[],\n options?: ExtrapolationType\n) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const init = useMemo(() => factory(), []);\n const result = useSharedValue(init);\n useAnimatedReaction(\n () => value.value,\n (val) => {\n result.value = interpolator(val, input, output, options, result.value);\n notifyChange(result);\n },\n [input, output, options]\n );\n return result;\n};\n\nexport const usePathInterpolation = (\n value: SharedValue<number>,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n // Check if all paths in outputRange are interpolable\n const allPathsInterpolable = outputRange\n .slice(1)\n .every((path) => outputRange[0].isInterpolatable(path));\n if (!allPathsInterpolable) {\n // Handle the case where not all paths are interpolable\n // For example, throw an error or return early\n throw new Error(\n `Not all paths in the output range are interpolable.\nSee: https://shopify.github.io/react-native-skia/docs/animations/hooks#usepathinterpolation`\n );\n }\n return useInterpolator(\n () => Skia.Path.Make(),\n value,\n interpolatePaths,\n input,\n outputRange,\n options\n );\n};\n\nexport const useVectorInterpolation = (\n value: SharedValue<number>,\n input: number[],\n outputRange: SkPoint[],\n options?: ExtrapolationType\n) =>\n useInterpolator(\n () => Skia.Point(0, 0),\n value,\n interpolateVector,\n input,\n outputRange,\n options\n );\n"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AAOO,MAAMK,YAAY,GAAIC,KAA2B,IAAK;EAC3D,SAAS;;EACT,IAAI,IAAAC,yBAAc,EAAC,CAAC,EAAE;IACpB;IACCD,KAAK,CAASE,MAAM,GAAGF,KAAK,CAACA,KAAK;EACrC;AACF,CAAC;AAACG,OAAA,CAAAJ,YAAA,GAAAA,YAAA;AAEK,MAAMK,YAAY,GAAGA,CAACC,EAA0B,EAAEC,IAAa,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AAK,CAACA,KAAK,EAChBiC,GAAG,IAAK;IACPF,MAAM,CAAC/B,KAAK,GAAG2B,YAAY,CAACM,GAAG,EAAEL,KAAK,EAAEC,MAAM,EAAEC,OAAO,EAAEC,MAAM,CAAC/B,KAAK,CAAC;IACtED,YAAY,CAACgC,MAAM,CAAC;EACtB,CAAC,EACD,CAACH,KAAK,EAAEC,MAAM,EAAEC,OAAO,CACzB,CAAC;EACD,OAAOC,MAAM;AACf,CAAC;AAEM,MAAMG,oBAAoB,GAAGA,CAClClC,KAA0B,EAC1B4B,KAAe,EACfO,WAAqB,EACrBL,OAA2B,KACxB;EACH;EACA,MAAMM,oBAAoB,GAAGD,WAAW,CACrCE,KAAK,CAAC,CAAC,CAAC,CACRC,KAAK,CAAE1B,IAAI,IAAKuB,WAAW,CAAC,CAAC,CAAC,CAACI,gBAAgB,CAAC3B,IAAI,CAAC,CAAC;EACzD,IAAI,CAACwB,oBAAoB,EAAE;IACzB;IACA;IACA,MAAM,IAAII,KAAK,CACZ;AACP,4FACI,CAAC;EACH;EACA,OAAOf,eAAe,CACpB,MAAMhB,UAAI,CAACC,IAAI,CAACC,IAAI,CAAC,CAAC,EACtBX,KAAK,EACLyC,2BAAgB,EAChBb,KAAK,EACLO,WAAW,EACXL,OACF,CAAC;AACH,CAAC;AAAC3B,OAAA,CAAA+B,oBAAA,GAAAA,oBAAA;AAEK,MAAMQ,sBAAsB,GAAGA,CACpC1C,KAA0B,EAC1B4B,KAAe,EACfO,WAAsB,EACtBL,OAA2B,KAE3BL,eAAe,CACb,MAAMhB,UAAI,CAACkC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACtB3C,KAAK,EACL4C,4BAAiB,EACjBhB,KAAK,EACLO,WAAW,EACXL,OACF,CAAC;AAAC3B,OAAA,CAAAuC,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_react","require","_animation","_skia","_Offscreen","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","notifyChange","value","isOnMainThread","_value","exports","usePathValue","cb","init","pathInit","useMemo","Skia","Path","Make","path","Rea","useSharedValue","useDerivedValue","reset","undefined","addPath","useClock","clock","callback","useCallback","info","timeSinceFirstFrame","useFrameCallback","useInterpolator","factory","interpolator","input","output","options","result","useAnimatedReaction","val","usePathInterpolation","outputRange","allPathsInterpolable","slice","every","isInterpolatable","Error","interpolatePaths","useVectorInterpolation","Point","interpolateVector"],"sources":["interpolators.ts"],"sourcesContent":["import type {\n ExtrapolationType,\n FrameInfo,\n SharedValue,\n} from \"react-native-reanimated\";\nimport { useCallback, useMemo } from \"react\";\n\nimport type { SkPath, SkPoint } from \"../../skia/types\";\nimport { interpolatePaths, interpolateVector } from \"../../animation\";\nimport { Skia } from \"../../skia\";\nimport { isOnMainThread } from \"../../renderer/Offscreen\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nexport const notifyChange = (value: SharedValue<unknown>) => {\n \"worklet\";\n if (isOnMainThread()) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (value as any)._value = value.value;\n }\n};\n\nexport const usePathValue = (cb: (path: SkPath) => void, init?: SkPath) => {\n const pathInit = useMemo(() => Skia.Path.Make(), []);\n const path = Rea.useSharedValue(pathInit);\n Rea.useDerivedValue(() => {\n path.value.reset();\n if (init !== undefined) {\n path.value.addPath(init);\n }\n cb(path.value);\n notifyChange(path);\n });\n return path;\n};\n\nexport const useClock = () => {\n const clock = Rea.useSharedValue(0);\n const callback = useCallback(\n (info: FrameInfo) => {\n \"worklet\";\n clock.value = info.timeSinceFirstFrame;\n },\n [clock]\n );\n Rea.useFrameCallback(callback);\n return clock;\n};\n\n/**\n * @worklet\n */\ntype Interpolator<T> = (\n value: number,\n input: number[],\n output: T[],\n options: ExtrapolationType,\n result: T\n) => T;\n\nconst useInterpolator = <T>(\n factory: () => T,\n value: SharedValue<number>,\n interpolator: Interpolator<T>,\n input: number[],\n output: T[],\n options?: ExtrapolationType\n) => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const init = useMemo(() => factory(), []);\n const result = Rea.useSharedValue(init);\n Rea.useAnimatedReaction(\n () => value.value,\n (val) => {\n result.value = interpolator(val, input, output, options, result.value);\n notifyChange(result);\n },\n [input, output, options]\n );\n return result;\n};\n\nexport const usePathInterpolation = (\n value: SharedValue<number>,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n // Check if all paths in outputRange are interpolable\n const allPathsInterpolable = outputRange\n .slice(1)\n .every((path) => outputRange[0].isInterpolatable(path));\n if (!allPathsInterpolable) {\n // Handle the case where not all paths are interpolable\n // For example, throw an error or return early\n throw new Error(\n `Not all paths in the output range are interpolable.\nSee: https://shopify.github.io/react-native-skia/docs/animations/hooks#usepathinterpolation`\n );\n }\n return useInterpolator(\n () => Skia.Path.Make(),\n value,\n interpolatePaths,\n input,\n outputRange,\n options\n );\n};\n\nexport const useVectorInterpolation = (\n value: SharedValue<number>,\n input: number[],\n outputRange: SkPoint[],\n options?: ExtrapolationType\n) =>\n useInterpolator(\n () => Skia.Point(0, 0),\n value,\n interpolateVector,\n input,\n outputRange,\n options\n );\n"],"mappings":";;;;;;AAKA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAoC,SAAAK,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE7B,MAAMG,YAAY,GAAIC,KAA2B,IAAK;EAC3D,SAAS;;EACT,IAAI,IAAAC,yBAAc,EAAC,CAAC,EAAE;IACpB;IACCD,KAAK,CAASE,MAAM,GAAGF,KAAK,CAACA,KAAK;EACrC;AACF,CAAC;AAACG,OAAA,CAAAJ,YAAA,GAAAA,YAAA;AAEK,MAAMK,YAAY,GAAGA,CAACC,EAA0B,EAAEC,IA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indReanimatedProps = bindReanimatedProps;
7
7
  exports.extractReanimatedProps = extractReanimatedProps;
8
8
  exports.unbindReanimatedNode = void 0;
9
- var _moduleWrapper = require("./moduleWrapper");
9
+ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  /* eslint-disable @typescript-eslint/no-explicit-any */
11
12
 
13
+ let HAS_REANIMATED = false;
14
+ let HAS_REANIMATED_3 = false;
15
+ try {
16
+ require("react-native-reanimated");
17
+ HAS_REANIMATED = true;
18
+ const reanimatedVersion = require("react-native-reanimated/package.json").version;
19
+ if (reanimatedVersion && (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))) {
20
+ HAS_REANIMATED_3 = true;
21
+ }
22
+ } catch (e) {
23
+ HAS_REANIMATED = false;
24
+ }
12
25
  const _bindings = new WeakMap();
13
26
  const unbindReanimatedNode = node => {
27
+ if (!HAS_REANIMATED) {
28
+ return;
29
+ }
14
30
  const previousMapperId = _bindings.get(node);
15
31
  if (previousMapperId !== undefined) {
16
- (0, _moduleWrapper.stopMapper)(previousMapperId);
32
+ _ReanimatedProxy.default.stopMapper(previousMapperId);
17
33
  }
18
34
  };
19
35
  exports.unbindReanimatedNode = unbindReanimatedNode;
20
36
  function extractReanimatedProps(props) {
21
- if (!_moduleWrapper.HAS_REANIMATED3 && !_moduleWrapper.HAS_REANIMATED2) {
37
+ if (!HAS_REANIMATED) {
22
38
  return [props, {}];
23
39
  }
24
40
  const reanimatedProps = {};
@@ -28,7 +44,7 @@ function extractReanimatedProps(props) {
28
44
  continue;
29
45
  }
30
46
  const propValue = props[propName];
31
- if ((0, _moduleWrapper.isSharedValue)(propValue)) {
47
+ if (_ReanimatedProxy.default.isSharedValue(propValue)) {
32
48
  reanimatedProps[propName] = propValue;
33
49
  otherProps[propName] = propValue.value;
34
50
  } else {
@@ -41,7 +57,7 @@ function bindReanimatedProps2(container, node, reanimatedProps) {
41
57
  const sharedValues = Object.values(reanimatedProps);
42
58
  const previousMapperId = _bindings.get(node);
43
59
  if (previousMapperId !== undefined) {
44
- (0, _moduleWrapper.stopMapper)(previousMapperId);
60
+ _ReanimatedProxy.default.stopMapper(previousMapperId);
45
61
  }
46
62
  if (sharedValues.length > 0) {
47
63
  const viewId = container.getNativeId();
@@ -62,32 +78,32 @@ function bindReanimatedProps2(container, node, reanimatedProps) {
62
78
  container.redraw();
63
79
  }
64
80
  };
65
- const mapperId = (0, _moduleWrapper.startMapper)(() => {
81
+ const mapperId = _ReanimatedProxy.default.startMapper(() => {
66
82
  "worklet";
67
83
 
68
- (0, _moduleWrapper.runOnJS)(updateProps)();
84
+ _ReanimatedProxy.default.runOnJS(updateProps)();
69
85
  }, sharedValues);
70
86
  _bindings.set(node, mapperId);
71
87
  }
72
88
  }
73
89
  function bindReanimatedProps(container, node, reanimatedProps) {
74
- if (_moduleWrapper.HAS_REANIMATED2 && !_moduleWrapper.HAS_REANIMATED3) {
90
+ if (HAS_REANIMATED && !HAS_REANIMATED_3) {
75
91
  return bindReanimatedProps2(container, node, reanimatedProps);
76
92
  }
77
- if (!_moduleWrapper.HAS_REANIMATED3) {
93
+ if (!HAS_REANIMATED) {
78
94
  return;
79
95
  }
80
96
  const sharedValues = Object.values(reanimatedProps);
81
97
  const previousMapperId = _bindings.get(node);
82
98
  if (previousMapperId !== undefined) {
83
- (0, _moduleWrapper.stopMapper)(previousMapperId);
99
+ _ReanimatedProxy.default.stopMapper(previousMapperId);
84
100
  }
85
101
  if (sharedValues.length > 0) {
86
102
  const viewId = container.getNativeId();
87
103
  const {
88
104
  SkiaViewApi
89
105
  } = global;
90
- const mapperId = (0, _moduleWrapper.startMapper)(() => {
106
+ const mapperId = _ReanimatedProxy.default.startMapper(() => {
91
107
  "worklet";
92
108
 
93
109
  if (node) {
@@ -1 +1 @@
1
- {"version":3,"names":["_moduleWrapper","require","_bindings","WeakMap","unbindReanimatedNode","node","previousMapperId","get","undefined","stopMapper","exports","extractReanimatedProps","props","HAS_REANIMATED3","HAS_REANIMATED2","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps2","container","sharedValues","Object","values","length","viewId","getNativeId","SkiaViewApi","global","updateProps","setProp","requestRedraw","redraw","mapperId","startMapper","runOnJS","set","bindReanimatedProps"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport {\n startMapper,\n stopMapper,\n isSharedValue,\n HAS_REANIMATED3,\n HAS_REANIMATED2,\n runOnJS,\n} from \"./moduleWrapper\";\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport const unbindReanimatedNode = (node: Node<unknown>) => {\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId as number);\n }\n};\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED3 && !HAS_REANIMATED2) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nfunction bindReanimatedProps2(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const updateProps = () => {\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n };\n const mapperId = startMapper(() => {\n \"worklet\";\n runOnJS(updateProps)();\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (HAS_REANIMATED2 && !HAS_REANIMATED3) {\n return bindReanimatedProps2(container, node, reanimatedProps);\n }\n if (!HAS_REANIMATED3) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = startMapper(() => {\n \"worklet\";\n if (node) {\n for (const propName in reanimatedProps) {\n node.setProp(propName, reanimatedProps[propName].value);\n }\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":";;;;;;;;AAMA,IAAAA,cAAA,GAAAC,OAAA;AANA;;AAeA,MAAMC,SAAS,GAAG,IAAIC,OAAO,CAAyB,CAAC;AAEhD,MAAMC,oBAAoB,GAAIC,IAAmB,IAAK;EAC3D,MAAMC,gBAAgB,GAAGJ,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC;EAC5C,IAAIC,gBAAgB,KAAKE,SAAS,EAAE;IAClC,IAAAC,yBAAU,EAACH,gBAA0B,CAAC;EACxC;AACF,CAAC;AAACI,OAAA,CAAAN,oBAAA,GAAAA,oBAAA;AAEK,SAASO,sBAAsBA,CAACC,K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MACF;MACA;MACA;MACA;MACA;MACA,IAAIS,WAAW,EAAE;QACfA,WAAW,CAACI,aAAa,CAACN,MAAM,CAAC;MACnC,CAAC,MAAM;QACLL,SAAS,CAACY,MAAM,CAAC,CAAC;MACpB;IACF,CAAC,EAAEX,YAAY,CAAC;IAChBrB,SAAS,CAACoC,GAAG,CAACjC,IAAI,EAAE8B,QAAQ,CAAC;EAC/B;AACF"}
1
+ {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","obj","__esModule","default","HAS_REANIMATED","HAS_REANIMATED_3","reanimatedVersion","version","includes","e","_bindings","WeakMap","unbindReanimatedNode","node","previousMapperId","get","undefined","Rea","stopMapper","exports","extractReanimatedProps","props","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps2","container","sharedValues","Object","values","length","viewId","getNativeId","SkiaViewApi","global","updateProps","setProp","requestRedraw","redraw","mapperId","startMapper","runOnJS","set","bindReanimatedProps"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nlet HAS_REANIMATED = false;\nlet HAS_REANIMATED_3 = false;\ntry {\n require(\"react-native-reanimated\");\n HAS_REANIMATED = true;\n const reanimatedVersion =\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n HAS_REANIMATED_3 = true;\n }\n} catch (e) {\n HAS_REANIMATED = false;\n}\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport const unbindReanimatedNode = (node: Node<unknown>) => {\n if (!HAS_REANIMATED) {\n return;\n }\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n};\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (Rea.isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nfunction bindReanimatedProps2(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const updateProps = () => {\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n };\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n Rea.runOnJS(updateProps)();\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (HAS_REANIMATED && !HAS_REANIMATED_3) {\n return bindReanimatedProps2(container, node, reanimatedProps);\n }\n if (!HAS_REANIMATED) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n if (node) {\n for (const propName in reanimatedProps) {\n node.setProp(propName, reanimatedProps[propName].value);\n }\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":";;;;;;;;AAMA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AANpC;;AAQA,IAAIG,cAAc,GAAG,KAAK;AAC1B,IAAIC,gBAAgB,GAAG,KAAK;AAC5B,IAAI;EACFL,OAAO,CAAC,yBAAyB,CAAC;EAClCI,cAAc,GAAG,IAAI;EACrB,MAAME,iBAAiB,GACrBN,OAAO,CAAC,sCAAsC,CAAC,CAACO,OAAO;EACzD,IACED,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACE,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAH,gBAAgB,GAAG,IAAI;EACzB;AACF,CAAC,CAAC,OAAOI,CAAC,EAAE;EACVL,cAAc,GAAG,KAAK;AACxB;AAEA,MAAMM,SAAS,GAAG,IAAIC,OAAO,CAAyB,CAAC;AAEhD,MAAMC,oBAAoB,GAAIC,IAAmB,IAAK;EAC3D,IAAI,CAACT,cAAc,EAAE;IACnB;EACF;EACA,MAAMU,gBAAgB,GAAGJ,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC;EAC5C,IAAIC,gBAAgB,KAAKE,SAAS,EAAE;IAClCC,wBAAG,CAACC,UAAU,CAACJ,gBAA0B,CAAC;EAC5C;AACF,CAAC;AAACK,OAAA,CAAAP,oBAAA,GAAAA,oBAAA;AAEK,SAASQ,sBAAsBA,CAACC,KAAyB,EAAE;EAChE,IAAI,C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CAAC;QACzD;MACF;MACA;MACA;MACA;MACA;MACA,IAAIS,WAAW,EAAE;QACfA,WAAW,CAACI,aAAa,CAACN,MAAM,CAAC;MACnC,CAAC,MAAM;QACLL,SAAS,CAACY,MAAM,CAAC,CAAC;MACpB;IACF,CAAC,EAAEX,YAAY,CAAC;IAChBpB,SAAS,CAACmC,GAAG,CAAChC,IAAI,EAAE6B,QAAQ,CAAC;EAC/B;AACF"}
@@ -7,7 +7,8 @@ exports.useTextureValueFromPicture = exports.useTextureAsValue = exports.useText
7
7
  var _react = require("react");
8
8
  var _Offscreen = require("../../renderer/Offscreen");
9
9
  var _skia = require("../../skia");
10
- var _moduleWrapper = require("./moduleWrapper");
10
+ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
12
  const createTexture = (texture, picture, size) => {
12
13
  "worklet";
13
14
 
@@ -40,10 +41,10 @@ const useTextureValueFromPicture = (picture, size) => {
40
41
  };
41
42
  exports.useTextureValueFromPicture = useTextureValueFromPicture;
42
43
  const usePictureAsTexture = (picture, size) => {
43
- const texture = (0, _moduleWrapper.useSharedValue)(null);
44
+ const texture = _ReanimatedProxy.default.useSharedValue(null);
44
45
  (0, _react.useEffect)(() => {
45
46
  if (picture !== null) {
46
- (0, _moduleWrapper.runOnUI)(createTexture)(texture, picture, size);
47
+ _ReanimatedProxy.default.runOnUI(createTexture)(texture, picture, size);
47
48
  }
48
49
  }, [texture, picture, size]);
49
50
  return texture;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_Offscreen","_skia","_moduleWrapper","createTexture","texture","picture","size","value","drawAsImageFromPicture","useTexture","element","width","height","useMemo","drawAsPicture","x","y","usePictureAsTexture","exports","useTextureAsValue","console","warn","useTextureValueFromPicture","useSharedValue","useEffect","runOnUI","useImageAsTexture","source","image","useImage","recorder","Skia","PictureRecorder","canvas","beginRecording","drawImage","finishRecordingAsPicture"],"sources":["textures.tsx"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport type { ReactElement } from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n DataSourceParam,\n SkImage,\n SkPicture,\n SkSize,\n} from \"../../skia/types\";\nimport {\n drawAsImageFromPicture,\n drawAsPicture,\n} from \"../../renderer/Offscreen\";\nimport { Skia, useImage } from \"../../skia\";\n\nimport { runOnUI, useSharedValue } from \"./moduleWrapper\";\n\nconst createTexture = (\n texture: SharedValue<SkImage | null>,\n picture: SkPicture,\n size: SkSize\n) => {\n \"worklet\";\n texture.value = drawAsImageFromPicture(picture, size);\n};\n\nexport const useTexture = (element: ReactElement, size: SkSize) => {\n const { width, height } = size;\n const picture = useMemo(() => {\n return drawAsPicture(element, {\n x: 0,\n y: 0,\n width,\n height,\n });\n }, [element, width, height]);\n return usePictureAsTexture(picture, size);\n};\n\nexport const useTextureAsValue = (element: ReactElement, size: SkSize) => {\n console.warn(\"useTextureAsValue has been renamed to use useTexture\");\n return useTexture(element, size);\n};\n\nexport const useTextureValueFromPicture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n console.warn(\n \"useTextureValueFromPicture has been renamed to use usePictureAsTexture\"\n );\n return usePictureAsTexture(picture, size);\n};\n\nexport const usePictureAsTexture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n const texture = useSharedValue<SkImage | null>(null);\n useEffect(() => {\n if (picture !== null) {\n runOnUI(createTexture)(texture, picture, size);\n }\n }, [texture, picture, size]);\n return texture;\n};\n\nexport const useImageAsTexture = (source: DataSourceParam) => {\n const image = useImage(source);\n const size = useMemo(() => {\n if (image) {\n return { width: image.width(), height: image.height() };\n }\n return { width: 0, height: 0 };\n }, [image]);\n const picture = useMemo(() => {\n if (image) {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording({\n x: 0,\n y: 0,\n width: size.width,\n height: size.height,\n });\n canvas.drawImage(image, 0, 0);\n return recorder.finishRecordingAsPicture();\n } else {\n return null;\n }\n },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,CAAC,EAAE,CAAC,CAAC;MAC7B,OAAOE,QAAQ,CAACM,wBAAwB,CAAC,CAAC;IAC5C,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF,CAAC,EAAE,CAAC9B,IAAI,EAAEsB,KAAK,CAAC,CAAC;EACjB,OAAOX,mBAAmB,CAACZ,OAAO,EAAEC,IAAI,CAAC;AAC3C,CAAC;AAACY,OAAA,CAAAQ,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_react","require","_Offscreen","_skia","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","createTexture","texture","picture","size","value","drawAsImageFromPicture","useTexture","element","width","height","useMemo","drawAsPicture","x","y","usePictureAsTexture","exports","useTextureAsValue","console","warn","useTextureValueFromPicture","Rea","useSharedValue","useEffect","runOnUI","useImageAsTexture","source","image","useImage","recorder","Skia","PictureRecorder","canvas","beginRecording","drawImage","finishRecordingAsPicture"],"sources":["textures.tsx"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\nimport type { ReactElement } from \"react\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n DataSourceParam,\n SkImage,\n SkPicture,\n SkSize,\n} from \"../../skia/types\";\nimport {\n drawAsImageFromPicture,\n drawAsPicture,\n} from \"../../renderer/Offscreen\";\nimport { Skia, useImage } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst createTexture = (\n texture: SharedValue<SkImage | null>,\n picture: SkPicture,\n size: SkSize\n) => {\n \"worklet\";\n texture.value = drawAsImageFromPicture(picture, size);\n};\n\nexport const useTexture = (element: ReactElement, size: SkSize) => {\n const { width, height } = size;\n const picture = useMemo(() => {\n return drawAsPicture(element, {\n x: 0,\n y: 0,\n width,\n height,\n });\n }, [element, width, height]);\n return usePictureAsTexture(picture, size);\n};\n\nexport const useTextureAsValue = (element: ReactElement, size: SkSize) => {\n console.warn(\"useTextureAsValue has been renamed to use useTexture\");\n return useTexture(element, size);\n};\n\nexport const useTextureValueFromPicture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n console.warn(\n \"useTextureValueFromPicture has been renamed to use usePictureAsTexture\"\n );\n return usePictureAsTexture(picture, size);\n};\n\nexport const usePictureAsTexture = (\n picture: SkPicture | null,\n size: SkSize\n) => {\n const texture = Rea.useSharedValue<SkImage | null>(null);\n useEffect(() => {\n if (picture !== null) {\n Rea.runOnUI(createTexture)(texture, picture, size);\n }\n }, [texture, picture, size]);\n return texture;\n};\n\nexport const useImageAsTexture = (source: DataSourceParam) => {\n const image = useImage(source);\n const size = useMemo(() => {\n if (image) {\n return { width: image.width(), height: image.height() };\n }\n return { width: 0, height: 0 };\n }, [image]);\n const picture = useMemo(() => {\n if (image) {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording({\n x: 0,\n y: 0,\n width: size.width,\n height: size.height,\n });\n canvas.drawImage(image, 0, 0);\n return recorder.finishRecordingAsPicture();\n } else {\n return null;\n }\n }, [size, image]);\n return usePictureAsTexture(picture, size);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAUA,IAAAC,UAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAoC,SAAAI,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC,MAAMG,aAAa,GAAGA,CACpBC,OAAoC,EACpCC,OAAkB,EAClBC,IAAY,KACT;EACH,SAAS;;EACTF,OAAO,CAACG,KAAK,GAAG,IAAAC,iCAAsB,EAACH,OAAO,EAAEC,IAAI,CAAC;AACvD,CAAC;AAEM,MAAMG,UAAU,GAAGA,CAACC,OAAqB,EAAEJ,IAAY,KAAK;EACjE,MAAM;IAAEK,KAAK;IAAEC;EAAO,CAAC,GAAGN,IAAI;EAC9B,MAAMD,OAAO,GAAG,IAAAQ,cAAO,EAAC,MAAM;I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AG,IAAAC,cAAQ,EAACF,MAAM,CAAC;EAC9B,MAAMtB,IAAI,GAAG,IAAAO,cAAO,EAAC,MAAM;IACzB,IAAIgB,KAAK,EAAE;MACT,OAAO;QAAElB,KAAK,EAAEkB,KAAK,CAAClB,KAAK,CAAC,CAAC;QAAEC,MAAM,EAAEiB,KAAK,CAACjB,MAAM,CAAC;MAAE,CAAC;IACzD;IACA,OAAO;MAAED,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;EAChC,CAAC,EAAE,CAACiB,KAAK,CAAC,CAAC;EACX,MAAMxB,OAAO,GAAG,IAAAQ,cAAO,EAAC,MAAM;IAC5B,IAAIgB,KAAK,EAAE;MACT,MAAME,QAAQ,GAAGC,UAAI,CAACC,eAAe,CAAC,CAAC;MACvC,MAAMC,MAAM,GAAGH,QAAQ,CAACI,cAAc,CAAC;QACrCpB,CAAC,EAAE,CAAC;QACJC,CAAC,EAAE,CAAC;QACJL,KAAK,EAAEL,IAAI,CAACK,KAAK;QACjBC,MAAM,EAAEN,IAAI,CAACM;MACf,CAAC,CAAC;MACFsB,MAAM,CAACE,SAAS,CAACP,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;MAC7B,OAAOE,QAAQ,CAACM,wBAAwB,CAAC,CAAC;IAC5C,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF,CAAC,EAAE,CAAC/B,IAAI,EAAEuB,KAAK,CAAC,CAAC;EACjB,OAAOZ,mBAAmB,CAACZ,OAAO,EAAEC,IAAI,CAAC;AAC3C,CAAC;AAACY,OAAA,CAAAS,iBAAA,GAAAA,iBAAA"}
@@ -6,20 +6,20 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useAnimatedImageValue = void 0;
7
7
  var _react = require("react");
8
8
  var _AnimatedImage = require("../../skia/core/AnimatedImage");
9
- var _moduleWrapper = require("./moduleWrapper");
9
+ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
11
  const DEFAULT_FRAME_DURATION = 60;
11
12
  const useAnimatedImageValue = (source, paused) => {
12
- (0, _moduleWrapper.throwOnMissingReanimated)();
13
- const defaultPaused = (0, _moduleWrapper.useSharedValue)(false);
13
+ const defaultPaused = _ReanimatedProxy.default.useSharedValue(false);
14
14
  const isPaused = paused !== null && paused !== void 0 ? paused : defaultPaused;
15
- const currentFrame = (0, _moduleWrapper.useSharedValue)(null);
16
- const lastTimestamp = (0, _moduleWrapper.useSharedValue)(-1);
15
+ const currentFrame = _ReanimatedProxy.default.useSharedValue(null);
16
+ const lastTimestamp = _ReanimatedProxy.default.useSharedValue(-1);
17
17
  const animatedImage = (0, _AnimatedImage.useAnimatedImage)(source, err => {
18
18
  console.error(err);
19
19
  throw new Error(`Could not load animated image - got '${err.message}'`);
20
20
  }, false);
21
21
  const frameDuration = (animatedImage === null || animatedImage === void 0 ? void 0 : animatedImage.currentFrameDuration()) || DEFAULT_FRAME_DURATION;
22
- (0, _moduleWrapper.useFrameCallback)(frameInfo => {
22
+ _ReanimatedProxy.default.useFrameCallback(frameInfo => {
23
23
  if (!animatedImage) {
24
24
  currentFrame.value = null;
25
25
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_AnimatedImage","_moduleWrapper","DEFAULT_FRAME_DURATION","useAnimatedImageValue","source","paused","throwOnMissingReanimated","defaultPaused","useSharedValue","isPaused","currentFrame","lastTimestamp","animatedImage","useAnimatedImage","err","console","error","Error","message","frameDuration","currentFrameDuration","useFrameCallback","frameInfo","value","timestamp","elapsed","decodeNextFrame","dispose","getCurrentFrame","useEffect","exports"],"sources":["useAnimatedImageValue.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { type FrameInfo, type SharedValue } from \"react-native-reanimated\";\n\nimport { useAnimatedImage } from \"../../skia/core/AnimatedImage\";\nimport type { DataSourceParam, SkImage } from \"../../skia/types\";\n\nimport {\n throwOnMissingReanimated,\n useFrameCallback,\n useSharedValue,\n} from \"./moduleWrapper\";\n\nconst DEFAULT_FRAME_DURATION = 60;\n\nexport const useAnimatedImageValue = (\n source: DataSourceParam,\n paused?: SharedValue<boolean>\n) => {\n throwOnMissingReanimated();\n const defaultPaused = useSharedValue(false);\n const isPaused = paused ?? defaultPaused;\n const currentFrame = useSharedValue<null | SkImage>(null);\n const lastTimestamp = useSharedValue(-1);\n const animatedImage = useAnimatedImage(\n source,\n (err) => {\n console.error(err);\n throw new Error(`Could not load animated image - got '${err.message}'`);\n },\n false\n );\n const frameDuration =\n animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;\n\n useFrameCallback((frameInfo: FrameInfo) => {\n if (!animatedImage) {\n currentFrame.value = null;\n return;\n }\n if (isPaused.value && lastTimestamp.value !== -1) {\n return;\n }\n const { timestamp } = frameInfo;\n const elapsed = timestamp - lastTimestamp.value;\n\n // Check if it's time to switch frames based on GIF frame duration\n if (elapsed < frameDuration) {\n return;\n }\n\n // Update the current frame\n animatedImage.decodeNextFrame();\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = animatedImage.getCurrentFrame();\n\n // Update the last timestamp\n lastTimestamp.value = timestamp;\n });\n useEffect(() => {\n return () => {\n animatedImage?.dispose();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return currentFrame;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,cAAA,GAAAF,OAAA;AAMA,MAAMG,sBAAsB,GAAG,EAAE;AAE1B,MAAMC,qBAAqB,GAAGA,CACnCC,MAAuB,EACvBC,MAA6B,KAC1B;EACH,IAAAC,uCAAwB,EAAC,CAAC;EAC1B,MAAMC,aAAa,GAAG,IAAAC,6BAAc,EAAC,KAAK,CAAC;EAC3C,MAAMC,QAAQ,GAAGJ,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIE,aAAa;EACxC,MAAMG,YAAY,GA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,OAAOjB,YAAY;AACrB,CAAC;AAACoB,OAAA,CAAA3B,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_react","require","_AnimatedImage","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","DEFAULT_FRAME_DURATION","useAnimatedImageValue","source","paused","defaultPaused","Rea","useSharedValue","isPaused","currentFrame","lastTimestamp","animatedImage","useAnimatedImage","err","console","error","Error","message","frameDuration","currentFrameDuration","useFrameCallback","frameInfo","value","timestamp","elapsed","decodeNextFrame","dispose","getCurrentFrame","useEffect","exports"],"sources":["useAnimatedImageValue.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { type FrameInfo, type SharedValue } from \"react-native-reanimated\";\n\nimport { useAnimatedImage } from \"../../skia/core/AnimatedImage\";\nimport type { DataSourceParam, SkImage } from \"../../skia/types\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst DEFAULT_FRAME_DURATION = 60;\n\nexport const useAnimatedImageValue = (\n source: DataSourceParam,\n paused?: SharedValue<boolean>\n) => {\n const defaultPaused = Rea.useSharedValue(false);\n const isPaused = paused ?? defaultPaused;\n const currentFrame = Rea.useSharedValue<null | SkImage>(null);\n const lastTimestamp = Rea.useSharedValue(-1);\n const animatedImage = useAnimatedImage(\n source,\n (err) => {\n console.error(err);\n throw new Error(`Could not load animated image - got '${err.message}'`);\n },\n false\n );\n const frameDuration =\n animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;\n\n Rea.useFrameCallback((frameInfo: FrameInfo) => {\n if (!animatedImage) {\n currentFrame.value = null;\n return;\n }\n if (isPaused.value && lastTimestamp.value !== -1) {\n return;\n }\n const { timestamp } = frameInfo;\n const elapsed = timestamp - lastTimestamp.value;\n\n // Check if it's time to switch frames based on GIF frame duration\n if (elapsed < frameDuration) {\n return;\n }\n\n // Update the current frame\n animatedImage.decodeNextFrame();\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = animatedImage.getCurrentFrame();\n\n // Update the last timestamp\n lastTimestamp.value = timestamp;\n });\n useEffect(() => {\n return () => {\n animatedImage?.dispose();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return currentFrame;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAoC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC,MAAMG,sBAAsB,GAAG,EAAE;AAE1B,MAAMC,qBAAqB,GAAGA,CACnCC,MAAuB,EACvBC,MAA6B,KAC1B;EACH,MAAMC,aAAa,GAAGC,wBAAG,CAACC,cAAc,CAAC,KAAK,CAAC;EAC/C,MAAMC,QAAQ,GAAGJ,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIC,aAAa;EACxC,MAAMI,YAAY,GAAGH,wBAAG,CAACC,cAAc,CAAiB,IAAI,CAAC;EAC7D,MAAMG,aAAa,GAAGJ,wBAAG,CAACC,cAAc,CAAC,CAAC,CAAC,CAAC;EAC5C,MAAMI,aAAa,GAAG,IAAAC,+BAAgB,EACpCT,MAAM,EACLU,GAAG,IAAK;IACPC,OAAO,CAACC,KAAK,CAACF,GAAG,CAAC;IAClB,MAAM,IAAIG,KAAK,CAAE,wCAAuCH,GAAG,CAACI,OAAQ,GAAE,CAAC;EACzE,CAAC,EACD,KACF,CAAC;EACD,MAAMC,aAAa,GACjB,CAAAP,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEQ,oBAAoB,CAAC,CAAC,KAAIlB,sBAAsB;EAEjEK,wBAAG,CAACc,gBAAgB,CAAEC,SAAoB,IAAK;IAC7C,IAAI,CAACV,aAAa,EAAE;MAClBF,YAAY,CAACa,KAAK,GAAG,IAAI;MACzB;IACF;IACA,IAAId,QAAQ,CAACc,KAAK,IAAIZ,aAAa,CAACY,KAAK,KAAK,CAAC,CAAC,EAAE;MAChD;IACF;IACA,MAAM;MAAEC;IAAU,CAAC,GAAGF,SAAS;IAC/B,MAAMG,OAAO,GAAGD,SAAS,GAAGb,aAAa,CAACY,KAAK;;IAE/C;IACA,IAAIE,OAAO,GAAGN,aAAa,EAAE;MAC3B;IACF;;IAEA;IACAP,aAAa,CAACc,eAAe,CAAC,CAAC;IAC/B,IAAIhB,YAAY,CAACa,KAAK,EAAE;MACtBb,YAAY,CAACa,KAAK,CAACI,OAAO,CAAC,CAAC;IAC9B;IACAjB,YAAY,CAACa,KAAK,GAAGX,aAAa,CAACgB,eAAe,CAAC,CAAC;;IAEpD;IACAjB,aAAa,CAACY,KAAK,GAAGC,SAAS;EACjC,CAAC,CAAC;EACF,IAAAK,gBAAS,EAAC,MAAM;IACd,OAAO,MAAM;MACXjB,aAAa,aAAbA,aAAa,eAAbA,aAAa,CAAEe,OAAO,CAAC,CAAC;IAC1B,CAAC;IACD;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAOjB,YAAY;AACrB,CAAC;AAACoB,OAAA,CAAA3B,qBAAA,GAAAA,qBAAA"}
@@ -5,17 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.useDerivedValueOnJS = void 0;
7
7
  var _react = require("react");
8
- var _moduleWrapper = require("./moduleWrapper");
8
+ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
10
  const useDerivedValueOnJS = (fn, deps) => {
10
11
  const init = (0, _react.useMemo)(() => fn(), [fn]);
11
- const value = (0, _moduleWrapper.useSharedValue)(init);
12
+ const value = _ReanimatedProxy.default.useSharedValue(init);
12
13
  (0, _react.useEffect)(() => {
13
- const mapperId = (0, _moduleWrapper.startMapper)(() => {
14
+ const mapperId = _ReanimatedProxy.default.startMapper(() => {
14
15
  "worklet";
15
16
 
16
- (0, _moduleWrapper.runOnJS)(fn)();
17
+ _ReanimatedProxy.default.runOnJS(fn)();
17
18
  }, deps);
18
- return () => (0, _moduleWrapper.stopMapper)(mapperId);
19
+ return () => _ReanimatedProxy.default.stopMapper(mapperId);
19
20
  }, [deps, fn]);
20
21
  return value;
21
22
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_moduleWrapper","useDerivedValueOnJS","fn","deps","init","useMemo","value","useSharedValue","useEffect","mapperId","startMapper","runOnJS","stopMapper","exports"],"sources":["useDerivedValueOnJS.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\n\nimport {\n useSharedValue,\n runOnJS,\n startMapper,\n stopMapper,\n} from \"./moduleWrapper\";\n\nexport const useDerivedValueOnJS = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: () => any,\n deps: unknown[]\n) => {\n const init = useMemo(() => fn(), [fn]);\n const value = useSharedValue(init);\n useEffect(() => {\n const mapperId = startMapper(() => {\n \"worklet\";\n runOnJS(fn)();\n }, deps);\n return () => stopMapper(mapperId);\n }, [deps, fn]);\n return value;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAOO,MAAME,mBAAmB,GAAGA,CAEjCC,EAAa,EACbC,IAAe,KACZ;EACH,MAAMC,IAAI,GAAG,IAAAC,cAAO,EAAC,MAAMH,EAAE,CAAC,CAAC,EAAE,CAACA,EAAE,CAAC,CAAC;EACtC,MAAMI,KAAK,GAAG,IAAAC,6BAAc,EAACH,IAAI,CAAC;EAClC,IAAAI,gBAAS,EAAC,MAAM;IACd,MAAMC,QAAQ,GAAG,IAAAC,0BAAW,EAAC,MAAM;MACjC,SAAS;;MACT,IAAAC,sBAAO,EAACT,EAAE,CAAC,CAAC,CAAC;IACf,CAAC,EAAEC,IAAI,CAAC;IACR,OAAO,MAAM,IAAAS,yBAAU,EAACH,QAAQ,CAAC;EACnC,CAAC,EAAE,CAACN,IAAI,EAAED,EAAE,CAAC,CAAC;EACd,OAAOI,KAAK;AACd,CAAC;AAACO,OAAA,CAAAZ,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_react","require","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","useDerivedValueOnJS","fn","deps","init","useMemo","value","Rea","useSharedValue","useEffect","mapperId","startMapper","runOnJS","stopMapper","exports"],"sources":["useDerivedValueOnJS.ts"],"sourcesContent":["import { useEffect, useMemo } from \"react\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nexport const useDerivedValueOnJS = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n fn: () => any,\n deps: unknown[]\n) => {\n const init = useMemo(() => fn(), [fn]);\n const value = Rea.useSharedValue(init);\n useEffect(() => {\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n Rea.runOnJS(fn)();\n }, deps);\n return () => Rea.stopMapper(mapperId);\n }, [deps, fn]);\n return value;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE7B,MAAMG,mBAAmB,GAAGA,CAEjCC,EAAa,EACbC,IAAe,KACZ;EACH,MAAMC,IAAI,GAAG,IAAAC,cAAO,EAAC,MAAMH,EAAE,CAAC,CAAC,EAAE,CAACA,EAAE,CAAC,CAAC;EACtC,MAAMI,KAAK,GAAGC,wBAAG,CAACC,cAAc,CAACJ,IAAI,CAAC;EACtC,IAAAK,gBAAS,EAAC,MAAM;IACd,MAAMC,QAAQ,GAAGH,wBAAG,CAACI,WAAW,CAAC,MAAM;MACrC,SAAS;;MACTJ,wBAAG,CAACK,OAAO,CAACV,EAAE,CAAC,CAAC,CAAC;IACnB,CAAC,EAAEC,IAAI,CAAC;IACR,OAAO,MAAMI,wBAAG,CAACM,UAAU,CAACH,QAAQ,CAAC;EACvC,CAAC,EAAE,CAACP,IAAI,EAAED,EAAE,CAAC,CAAC;EACd,OAAOI,KAAK;AACd,CAAC;AAACQ,OAAA,CAAAb,mBAAA,GAAAA,mBAAA"}
@@ -30,16 +30,12 @@ exports.drawAsPicture = drawAsPicture;
30
30
  const drawAsImage = (element, size) => {
31
31
  return drawAsImageFromPicture(drawAsPicture(element), size);
32
32
  };
33
-
34
- // TODO: We're not sure yet why PixelRatio is not needed here.
35
33
  exports.drawAsImage = drawAsImage;
36
- const pd = 1;
37
34
  const drawAsImageFromPicture = (picture, size) => {
38
35
  "worklet";
39
36
 
40
- const surface = _skia.Skia.Surface.MakeOffscreen(size.width * pd, size.height * pd);
37
+ const surface = _skia.Skia.Surface.MakeOffscreen(size.width, size.height);
41
38
  const canvas = surface.getCanvas();
42
- canvas.scale(pd, pd);
43
39
  canvas.drawPicture(picture);
44
40
  surface.flush();
45
41
  const image = surface.makeImageSnapshot();
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_skia","_Platform","_Reconciler","isOnMainThread","_WORKLET","Platform","OS","exports","drawAsPicture","element","bounds","recorder","Skia","PictureRecorder","canvas","beginRecording","root","SkiaRoot","render","ctx","JsiDrawingContext","dom","picture","finishRecordingAsPicture","unmount","drawAsImage","size","drawAsImageFromPicture","pd","surface","Surface","MakeOffscreen","width","height","getCanvas","scale","drawPicture","flush","image","makeImageSnapshot","makeNonTextureImage"],"sources":["Offscreen.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\n\nimport { SkiaRoot } from \"./Reconciler\";\n\n// We call it main thread because on web main is JS thread\nexport const isOnMainThread = () => {\n \"worklet\";\n return (\n (typeof _WORKLET !== \"undefined\" && _WORKLET === true) ||\n Platform.OS === \"web\"\n );\n};\n\nexport const drawAsPicture = (element: ReactElement, bounds?: SkRect) => {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording(bounds);\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n const picture = recorder.finishRecordingAsPicture();\n root.unmount();\n return picture;\n};\n\nexport const drawAsImage = (element: ReactElement, size: SkSize) => {\n return drawAsImageFromPicture(drawAsPicture(element), size);\n};\n\n// TODO: We're not sure yet why PixelRatio is not needed here.\nconst pd = 1;\nexport const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {\n \"worklet\";\n const surface = Skia.Surface.MakeOffscreen(\n size.width * pd,\n size.height * pd\n )!;\n const canvas = surface.getCanvas();\n canvas.scale(pd, pd);\n canvas.drawPicture(picture);\n surface.flush();\n const image = surface.makeImageSnapshot();\n // If we are not on the main thread or if we are on Web, we need to make the image non-texture.\n if (!isOnMainThread() || Platform.OS === \"web\") {\n return image.makeNonTextureImage();\n } else {\n return image;\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA;AACO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,SAAS;;EACT,OACG,OAAOC,QAAQ,KAAK,WAAW,IAAIA,QAAQ,KAAK,IAAI,IACrDC,kBAAQ,CAACC,EAAE,KAAK,KAAK;AAEzB,CAAC;AAACC,OAAA,CAAAJ,cAAA,GAAAA,cAAA;AAEK,MAAMK,aAAa,GAAGA,CAACC,OAAqB,EAAEC,MAAe,KAAK;EACvE,MAAMC,QAAQ,GAAGC,UAAI,CAACC,eAAe,CAAC,CAAC;EACvC,MAAMC,MAAM,GAAGH,QAAQ,CAACI,cAAc,CAACL,MAAM,CAAC;EAC9C,MAAMM,IAAI,GAAG,IAAIC,oBAAQ,CAACL,UAAI,EAAE,KAAK,CAAC;EACtCI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A,CAAAoB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_types","require","_skia","_Platform","_Reconciler","isOnMainThread","_WORKLET","Platform","OS","exports","drawAsPicture","element","bounds","recorder","Skia","PictureRecorder","canvas","beginRecording","root","SkiaRoot","render","ctx","JsiDrawingContext","dom","picture","finishRecordingAsPicture","unmount","drawAsImage","size","drawAsImageFromPicture","surface","Surface","MakeOffscreen","width","height","getCanvas","drawPicture","flush","image","makeImageSnapshot","makeNonTextureImage"],"sources":["Offscreen.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkPicture, SkRect, SkSize } from \"../skia/types\";\nimport { Skia } from \"../skia\";\nimport { Platform } from \"../Platform\";\n\nimport { SkiaRoot } from \"./Reconciler\";\n\n// We call it main thread because on web main is JS thread\nexport const isOnMainThread = () => {\n \"worklet\";\n return (\n (typeof _WORKLET !== \"undefined\" && _WORKLET === true) ||\n Platform.OS === \"web\"\n );\n};\n\nexport const drawAsPicture = (element: ReactElement, bounds?: SkRect) => {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording(bounds);\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n const picture = recorder.finishRecordingAsPicture();\n root.unmount();\n return picture;\n};\n\nexport const drawAsImage = (element: ReactElement, size: SkSize) => {\n return drawAsImageFromPicture(drawAsPicture(element), size);\n};\n\nexport const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {\n \"worklet\";\n const surface = Skia.Surface.MakeOffscreen(size.width, size.height)!;\n const canvas = surface.getCanvas();\n canvas.drawPicture(picture);\n surface.flush();\n const image = surface.makeImageSnapshot();\n // If we are not on the main thread or if we are on Web, we need to make the image non-texture.\n if (!isOnMainThread() || Platform.OS === \"web\") {\n return image.makeNonTextureImage();\n } else {\n return image;\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC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J,IAAI,CAACK,KAAK,EAAEL,IAAI,CAACM,MAAM,CAAE;EACpE,MAAMlB,MAAM,GAAGc,OAAO,CAACK,SAAS,CAAC,CAAC;EAClCnB,MAAM,CAACoB,WAAW,CAACZ,OAAO,CAAC;EAC3BM,OAAO,CAACO,KAAK,CAAC,CAAC;EACf,MAAMC,KAAK,GAAGR,OAAO,CAACS,iBAAiB,CAAC,CAAC;EACzC;EACA,IAAI,CAAClC,cAAc,CAAC,CAAC,IAAIE,kBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IAC9C,OAAO8B,KAAK,CAACE,mBAAmB,CAAC,CAAC;EACpC,CAAC,MAAM;IACL,OAAOF,KAAK;EACd;AACF,CAAC;AAAC7B,OAAA,CAAAoB,sBAAA,GAAAA,sBAAA"}
@@ -46,7 +46,7 @@ export interface ImageFactory {
46
46
  MakeImageFromEncoded: (encoded: SkData) => SkImage | null;
47
47
  /**
48
48
  * Return an Image backed by a given native buffer.
49
- * The platform buffer must be a valid owning reference.
49
+ * The native buffer must be a valid owning reference.
50
50
  *
51
51
  * For instance, this API is used by
52
52
  * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)
@@ -54,9 +54,9 @@ export interface ImageFactory {
54
54
  *
55
55
  * - On Android; This is an `AHardwareBuffer*`
56
56
  * - On iOS, this is a `CVPixelBufferRef`
57
- * @param nativeBuffer A strong `uintptr_t` pointer to the native platform buffer
57
+ * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer
58
58
  * @throws Throws an error if the Image could not be created, for example when the given
59
- * platform buffer is invalid.
59
+ * native buffer is invalid.
60
60
  */
61
61
  MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;
62
62
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["AlphaType","exports","ColorType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport enum ColorType {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\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 /**\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 platform 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 platform buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * platform buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => 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"],"mappings":";;;;;;IAKYA,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;AAAA,IAOTE,SAAS,GAAAD,OAAA,CAAAC,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,OAiBT"}
1
+ {"version":3,"names":["AlphaType","exports","ColorType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport enum ColorType {\n Unknown, // uninitialized\n Alpha_8, // pixel with alpha in 8-bit byte\n RGB_565, // pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word\n ARGB_4444, // pixel with 4 bits for alpha, red, green, blue; in 16-bit word\n RGBA_8888, // pixel with 8 bits for red, green, blue, alpha; in 32-bit word\n RGB_888x, // pixel with 8 bits each for red, green, blue; in 32-bit word\n BGRA_8888, // pixel with 8 bits for blue, green, red, alpha; in 32-bit word\n RGBA_1010102, // 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word\n BGRA_1010102, // 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word\n RGB_101010x, // pixel with 10 bits each for red, green, blue; in 32-bit word\n BGR_101010x, // pixel with 10 bits each for blue, green, red; in 32-bit word\n BGR_101010x_XR, // pixel with 10 bits each for blue, green, red; in 32-bit word, extended range\n RGBA_10x6, // pixel with 10 used bits (most significant) followed by 6 unused\n Gray_8, // pixel with grayscale level in 8-bit byte\n RGBA_F16Norm, // pixel with half floats in [0,1] for red, green, blue, alpha; in 64-bit word\n RGBA_F16, // pixel with half floats for red, green, blue, alpha; in 64-bit word\n RGBA_F32, // pixel using C float for red, green, blue, alpha; in 128-bit word\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 /**\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 * 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"],"mappings":";;;;;;IAKYA,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;AAAA,IAOTE,SAAS,GAAAD,OAAA,CAAAC,SAAA,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,OAiBT"}
@@ -8,11 +8,11 @@ export declare const isNativeBufferWeb: (buffer: NativeBuffer) => buffer is Canv
8
8
  export declare const isNativeBufferNode: (buffer: NativeBuffer) => buffer is ArrayBuffer;
9
9
  export interface NativeBufferFactory {
10
10
  /**
11
- * Copy pixels to a platform buffer. (for testing purposes)
11
+ * Copy pixels to a native buffer.
12
12
  */
13
13
  MakeFromImage: (image: SkImage) => NativeBuffer;
14
14
  /**
15
- * Release a platform buffer that was created with `MakeFromImage`.
15
+ * Release a native buffer that was created with `MakeFromImage`.
16
16
  */
17
- Release: (platformBuffer: NativeBuffer) => void;
17
+ Release: (nativeBuffer: NativeBuffer) => void;
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isNativeBufferAddr","buffer","BigInt","exports","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport type NativeBuffer<\n T extends bigint | ArrayBuffer | CanvasImageSource | unknown = unknown\n> = T;\n\nexport type NativeBufferAddr = NativeBuffer<bigint>;\nexport type NativeBufferWeb = NativeBuffer<CanvasImageSource>;\nexport type NativeBufferNode = NativeBuffer<ArrayBuffer>;\n\nexport const isNativeBufferAddr = (\n buffer: NativeBuffer\n): buffer is NativeBufferAddr => buffer instanceof BigInt;\nexport const isNativeBufferWeb = (\n buffer: NativeBuffer\n): buffer is NativeBufferWeb =>\n buffer instanceof HTMLVideoElement ||\n buffer instanceof HTMLCanvasElement ||\n buffer instanceof ImageBitmap ||\n buffer instanceof OffscreenCanvas ||\n buffer instanceof VideoFrame ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement;\n\nexport const isNativeBufferNode = (\n buffer: NativeBuffer\n): buffer is NativeBufferNode => buffer instanceof ArrayBuffer;\n\nexport interface NativeBufferFactory {\n /**\n * Copy pixels to a platform buffer. (for testing purposes)\n */\n MakeFromImage: (image: SkImage) => NativeBuffer;\n /**\n * Release a platform buffer that was created with `MakeFromImage`.\n */\n Release: (platformBuffer: NativeBuffer) => void;\n}\n"],"mappings":";;;;;;AAUO,MAAMA,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AAACC,OAAA,CAAAH,kBAAA,GAAAA,kBAAA;AACnD,MAAMI,iBAAiB,GAC5BH,MAAoB,IAEpBA,MAAM,YAAYI,gBAAgB,IAClCJ,MAAM,YAAYK,iBAAiB,IACnCL,MAAM,YAAYM,WAAW,IAC7BN,MAAM,YAAYO,eAAe,IACjCP,MAAM,YAAYQ,UAAU,IAC5BR,MAAM,YAAYS,gBAAgB,IAClCT,MAAM,YAAYU,eAAe;AAACR,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAE7B,MAAMQ,kBAAkB,GAC7BX,MAAoB,IACWA,MAAM,YAAYY,WAAW;AAACV,OAAA,CAAAS,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["isNativeBufferAddr","buffer","BigInt","exports","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport type NativeBuffer<\n T extends bigint | ArrayBuffer | CanvasImageSource | unknown = unknown\n> = T;\n\nexport type NativeBufferAddr = NativeBuffer<bigint>;\nexport type NativeBufferWeb = NativeBuffer<CanvasImageSource>;\nexport type NativeBufferNode = NativeBuffer<ArrayBuffer>;\n\nexport const isNativeBufferAddr = (\n buffer: NativeBuffer\n): buffer is NativeBufferAddr => buffer instanceof BigInt;\nexport const isNativeBufferWeb = (\n buffer: NativeBuffer\n): buffer is NativeBufferWeb =>\n buffer instanceof HTMLVideoElement ||\n buffer instanceof HTMLCanvasElement ||\n buffer instanceof ImageBitmap ||\n buffer instanceof OffscreenCanvas ||\n buffer instanceof VideoFrame ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement;\n\nexport const isNativeBufferNode = (\n buffer: NativeBuffer\n): buffer is NativeBufferNode => buffer instanceof ArrayBuffer;\n\nexport interface NativeBufferFactory {\n /**\n * Copy pixels to a native buffer.\n */\n MakeFromImage: (image: SkImage) => NativeBuffer;\n /**\n * Release a native buffer that was created with `MakeFromImage`.\n */\n Release: (nativeBuffer: NativeBuffer) => void;\n}\n"],"mappings":";;;;;;AAUO,MAAMA,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AAACC,OAAA,CAAAH,kBAAA,GAAAA,kBAAA;AACnD,MAAMI,iBAAiB,GAC5BH,MAAoB,IAEpBA,MAAM,YAAYI,gBAAgB,IAClCJ,MAAM,YAAYK,iBAAiB,IACnCL,MAAM,YAAYM,WAAW,IAC7BN,MAAM,YAAYO,eAAe,IACjCP,MAAM,YAAYQ,UAAU,IAC5BR,MAAM,YAAYS,gBAAgB,IAClCT,MAAM,YAAYU,eAAe;AAACR,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAE7B,MAAMQ,kBAAkB,GAC7BX,MAAoB,IACWA,MAAM,YAAYY,WAAW;AAACV,OAAA,CAAAS,kBAAA,GAAAA,kBAAA"}
@@ -4,5 +4,5 @@ import { Host } from "./Host";
4
4
  export declare class JsiSkNativeBufferFactory extends Host implements NativeBufferFactory {
5
5
  constructor(CanvasKit: CanvasKit);
6
6
  MakeFromImage(image: SkImage): NativeBuffer;
7
- Release(_platformBuffer: NativeBuffer): void;
7
+ Release(_nativeBuffer: NativeBuffer): void;
8
8
  }
@@ -21,7 +21,7 @@ class JsiSkNativeBufferFactory extends _Host.Host {
21
21
  ctx.putImageData(imageData, 0, 0);
22
22
  return canvas;
23
23
  }
24
- Release(_platformBuffer) {
24
+ Release(_nativeBuffer) {
25
25
  // it's a noop on Web
26
26
  }
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_Host","require","JsiSkNativeBufferFactory","Host","constructor","CanvasKit","MakeFromImage","image","info","getImageInfo","uint8ClampedArray","Uint8ClampedArray","readPixels","imageData","ImageData","width","height","canvas","OffscreenCanvas","ctx","getContext","Error","putImageData","Release","_platformBuffer","exports"],"sources":["JsiSkNativeBufferFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport {\n type NativeBuffer,\n type NativeBufferFactory,\n type SkImage,\n} from \"../types\";\n\nimport { Host } from \"./Host\";\n\nexport class JsiSkNativeBufferFactory\n extends Host\n implements NativeBufferFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromImage(image: SkImage): NativeBuffer {\n const info = image.getImageInfo();\n const uint8ClampedArray = new Uint8ClampedArray(image.readPixels()!);\n const imageData = new ImageData(uint8ClampedArray, info.width, info.height);\n const canvas = new OffscreenCanvas(info.width, info.height);\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"Failed to get 2d context from canvas\");\n }\n ctx.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n Release(_platformBuffer: NativeBuffer) {\n // it's a noop on Web\n }\n}\n"],"mappings":";;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,wBAAwB,SAC3BC,UAAI,CAEd;EACEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,aAAaA,CAACC,KAAc,EAAgB;IAC1C,MAAMC,IAAI,GAAGD,KAAK,CAACE,YAAY,CAAC,CAAC;IACjC,MAAMC,iBAAiB,GAAG,IAAIC,iBAAiB,CAACJ,KAAK,CAACK,UAAU,CAAC,CAAE,CAAC;IACpE,MAAMC,SAAS,GAAG,IAAIC,SAAS,CAACJ,iBAAiB,EAAEF,IAAI,CAACO,KAAK,EAAEP,IAAI,CAACQ,MAAM,CAAC;IAC3E,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAACV,IAAI,CAACO,KAAK,EAAEP,IAAI,CAACQ,MAAM,CAAC;IAC3D,MAAMG,GAAG,GAAGF,MAAM,CAACG,UAAU,CAAC,IAAI,CAAC;IACnC,IAAI,CAACD,GAAG,EAAE;MACR,MAAM,IAAIE,KAAK,CAAC,sCAAsC,CAAC;IACzD;IACAF,GAAG,CAACG,YAAY,CAACT,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IACjC,OAAOI,MAAM;EACf;EAEAM,OAAOA,CAACC,eAA6B,EAAE;IACrC;EAAA;AAEJ;AAACC,OAAA,CAAAvB,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_Host","require","JsiSkNativeBufferFactory","Host","constructor","CanvasKit","MakeFromImage","image","info","getImageInfo","uint8ClampedArray","Uint8ClampedArray","readPixels","imageData","ImageData","width","height","canvas","OffscreenCanvas","ctx","getContext","Error","putImageData","Release","_nativeBuffer","exports"],"sources":["JsiSkNativeBufferFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport {\n type NativeBuffer,\n type NativeBufferFactory,\n type SkImage,\n} from \"../types\";\n\nimport { Host } from \"./Host\";\n\nexport class JsiSkNativeBufferFactory\n extends Host\n implements NativeBufferFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromImage(image: SkImage): NativeBuffer {\n const info = image.getImageInfo();\n const uint8ClampedArray = new Uint8ClampedArray(image.readPixels()!);\n const imageData = new ImageData(uint8ClampedArray, info.width, info.height);\n const canvas = new OffscreenCanvas(info.width, info.height);\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) {\n throw new Error(\"Failed to get 2d context from canvas\");\n }\n ctx.putImageData(imageData, 0, 0);\n return canvas;\n }\n\n Release(_nativeBuffer: NativeBuffer) {\n // it's a noop on Web\n }\n}\n"],"mappings":";;;;;;AAQA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,wBAAwB,SAC3BC,UAAI,CAEd;EACEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,aAAaA,CAACC,KAAc,EAAgB;IAC1C,MAAMC,IAAI,GAAGD,KAAK,CAACE,YAAY,CAAC,CAAC;IACjC,MAAMC,iBAAiB,GAAG,IAAIC,iBAAiB,CAACJ,KAAK,CAACK,UAAU,CAAC,CAAE,CAAC;IACpE,MAAMC,SAAS,GAAG,IAAIC,SAAS,CAACJ,iBAAiB,EAAEF,IAAI,CAACO,KAAK,EAAEP,IAAI,CAACQ,MAAM,CAAC;IAC3E,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAACV,IAAI,CAACO,KAAK,EAAEP,IAAI,CAACQ,MAAM,CAAC;IAC3D,MAAMG,GAAG,GAAGF,MAAM,CAACG,UAAU,CAAC,IAAI,CAAC;IACnC,IAAI,CAACD,GAAG,EAAE;MACR,MAAM,IAAIE,KAAK,CAAC,sCAAsC,CAAC;IACzD;IACAF,GAAG,CAACG,YAAY,CAACT,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;IACjC,OAAOI,MAAM;EACf;EAEAM,OAAOA,CAACC,aAA2B,EAAE;IACnC;EAAA;AAEJ;AAACC,OAAA,CAAAvB,wBAAA,GAAAA,wBAAA"}
@@ -1,2 +0,0 @@
1
- import { throwOnMissingReanimated } from "../external/reanimated/moduleWrapper";
2
- export default throwOnMissingReanimated;
@@ -1,10 +1,2 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _moduleWrapper = require("../external/reanimated/moduleWrapper");
8
- // eslint-disable-next-line import/no-default-export
9
- var _default = exports.default = _moduleWrapper.throwOnMissingReanimated;
10
2
  //# sourceMappingURL=NativeSkiaModule.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_moduleWrapper","require","_default","exports","default","throwOnMissingReanimated"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["import { throwOnMissingReanimated } from \"../external/reanimated/moduleWrapper\";\n\n// eslint-disable-next-line import/no-default-export\nexport default throwOnMissingReanimated;\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACeC,uCAAwB"}
1
+ {"version":3,"names":[],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,10 @@
1
+ type ImportType = ReturnType<typeof require>;
2
+ /**
3
+ * Create a lazily-imported module proxy.
4
+ * This is useful for lazily requiring optional dependencies.
5
+ */
6
+ export declare const createModuleProxy: <TModule>(getModule: () => ImportType) => TModule;
7
+ export declare class OptionalDependencyNotInstalledError extends Error {
8
+ constructor(name: string);
9
+ }
10
+ export {};