@shopify/react-native-skia 0.1.212 → 0.1.214

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 (254) hide show
  1. package/android/build.gradle +5 -0
  2. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +3 -2
  3. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +9 -2
  4. package/cpp/api/JsiSkSurface.h +4 -1
  5. package/cpp/skia/include/android/GrAHardwareBufferUtils.h +99 -0
  6. package/cpp/skia/include/android/SkHeifDecoder.h +10 -3
  7. package/cpp/skia/include/codec/SkAvifDecoder.h +1 -0
  8. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -0
  9. package/cpp/skia/include/codec/SkCodec.h +4 -3
  10. package/cpp/skia/include/codec/SkEncodedImageFormat.h +0 -3
  11. package/cpp/skia/include/codec/SkGifDecoder.h +1 -0
  12. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -0
  13. package/cpp/skia/include/codec/SkJpegDecoder.h +1 -0
  14. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -0
  15. package/cpp/skia/include/codec/SkPngDecoder.h +1 -0
  16. package/cpp/skia/include/codec/SkRawDecoder.h +1 -0
  17. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -0
  18. package/cpp/skia/include/codec/SkWebpDecoder.h +1 -0
  19. package/cpp/skia/include/config/SkUserConfig.h +0 -2
  20. package/cpp/skia/include/core/SkBitmap.h +8 -8
  21. package/cpp/skia/include/core/SkCanvas.h +37 -50
  22. package/cpp/skia/include/core/SkCapabilities.h +2 -7
  23. package/cpp/skia/include/core/SkColor.h +1 -1
  24. package/cpp/skia/include/core/SkColorFilter.h +6 -0
  25. package/cpp/skia/include/core/SkColorTable.h +3 -0
  26. package/cpp/skia/include/core/SkColorType.h +2 -0
  27. package/cpp/skia/include/core/SkContourMeasure.h +12 -8
  28. package/cpp/skia/include/core/SkDocument.h +1 -0
  29. package/cpp/skia/include/core/SkFont.h +11 -2
  30. package/cpp/skia/include/core/SkFontMgr.h +2 -3
  31. package/cpp/skia/include/core/SkGraphics.h +3 -13
  32. package/cpp/skia/include/core/SkImage.h +57 -111
  33. package/cpp/skia/include/core/SkImageFilter.h +6 -1
  34. package/cpp/skia/include/core/SkImageGenerator.h +8 -0
  35. package/cpp/skia/include/core/SkImageInfo.h +0 -2
  36. package/cpp/skia/include/core/SkM44.h +7 -3
  37. package/cpp/skia/include/core/SkMallocPixelRef.h +4 -1
  38. package/cpp/skia/include/core/SkMatrix.h +17 -17
  39. package/cpp/skia/include/core/SkMesh.h +71 -61
  40. package/cpp/skia/include/core/SkMilestone.h +1 -1
  41. package/cpp/skia/include/core/SkOverdrawCanvas.h +25 -0
  42. package/cpp/skia/include/core/SkPaint.h +1 -1
  43. package/cpp/skia/include/core/SkPath.h +12 -4
  44. package/cpp/skia/include/core/SkPathMeasure.h +3 -4
  45. package/cpp/skia/include/core/SkPicture.h +19 -6
  46. package/cpp/skia/include/core/SkPictureRecorder.h +6 -6
  47. package/cpp/skia/include/core/SkPixmap.h +2 -3
  48. package/cpp/skia/include/core/SkRRect.h +1 -1
  49. package/cpp/skia/include/core/SkRect.h +107 -110
  50. package/cpp/skia/include/core/SkRefCnt.h +1 -1
  51. package/cpp/skia/include/core/SkRegion.h +7 -1
  52. package/cpp/skia/include/core/SkSerialProcs.h +14 -0
  53. package/cpp/skia/include/core/SkShader.h +9 -0
  54. package/cpp/skia/include/core/SkStream.h +9 -9
  55. package/cpp/skia/include/core/SkString.h +1 -1
  56. package/cpp/skia/include/core/SkSurface.h +14 -25
  57. package/cpp/skia/include/core/SkTextBlob.h +17 -4
  58. package/cpp/skia/include/core/SkTiledImageUtils.h +28 -0
  59. package/cpp/skia/include/core/SkTypeface.h +7 -2
  60. package/cpp/skia/include/core/SkTypes.h +4 -12
  61. package/cpp/skia/include/docs/SkPDFDocument.h +17 -3
  62. package/cpp/skia/include/effects/SkImageFilters.h +73 -24
  63. package/cpp/skia/include/effects/SkRuntimeEffect.h +20 -51
  64. package/cpp/skia/include/gpu/GpuTypes.h +13 -0
  65. package/cpp/skia/include/gpu/GrBackendSurface.h +95 -262
  66. package/cpp/skia/include/gpu/GrContextOptions.h +7 -1
  67. package/cpp/skia/include/gpu/GrDirectContext.h +138 -128
  68. package/cpp/skia/include/gpu/GrRecordingContext.h +9 -4
  69. package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -24
  70. package/cpp/skia/include/gpu/GrTypes.h +16 -1
  71. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +4 -4
  72. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +2 -2
  73. package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +44 -12
  74. package/cpp/skia/include/gpu/ganesh/SkMeshGanesh.h +57 -0
  75. package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +2 -1
  76. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +58 -0
  77. package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +29 -0
  78. package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +1 -1
  79. package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSurface.h +67 -0
  80. package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
  81. package/cpp/skia/include/gpu/graphite/BackendTexture.h +14 -3
  82. package/cpp/skia/include/gpu/graphite/Context.h +93 -13
  83. package/cpp/skia/include/gpu/graphite/ContextOptions.h +19 -8
  84. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +23 -0
  85. package/cpp/skia/include/gpu/graphite/Image.h +56 -0
  86. package/cpp/skia/include/gpu/graphite/ImageProvider.h +5 -0
  87. package/cpp/skia/include/gpu/graphite/Recorder.h +26 -9
  88. package/cpp/skia/include/gpu/graphite/Recording.h +7 -5
  89. package/cpp/skia/include/gpu/graphite/TextureInfo.h +8 -0
  90. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +2 -2
  91. package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
  92. package/cpp/skia/include/gpu/vk/GrVkTypes.h +4 -3
  93. package/cpp/skia/include/ports/SkCFObject.h +1 -1
  94. package/cpp/skia/include/private/SkGainmapInfo.h +4 -13
  95. package/cpp/skia/include/private/SkJpegGainmapEncoder.h +1 -24
  96. package/cpp/skia/include/private/SkWeakRefCnt.h +1 -1
  97. package/cpp/skia/include/private/base/SkAnySubclass.h +73 -0
  98. package/cpp/skia/include/private/base/SkAssert.h +106 -12
  99. package/cpp/skia/include/private/base/SkAttributes.h +0 -12
  100. package/cpp/skia/include/private/base/SkFeatures.h +0 -3
  101. package/cpp/skia/include/private/base/SkFloatingPoint.h +58 -105
  102. package/cpp/skia/include/private/base/SkSpan_impl.h +18 -12
  103. package/cpp/skia/include/private/base/SkTArray.h +22 -17
  104. package/cpp/skia/include/private/base/SkTDArray.h +5 -6
  105. package/cpp/skia/include/private/base/SkTemplates.h +50 -30
  106. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +5 -2
  107. package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +2 -2
  108. package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +13 -8
  109. package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +1 -1
  110. package/cpp/skia/include/private/chromium/SkImageChromium.h +16 -3
  111. package/cpp/skia/include/private/chromium/Slug.h +11 -4
  112. package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
  113. package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +6 -9
  114. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +29 -13
  115. package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -28
  116. package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +34 -0
  117. package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +6 -0
  118. package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +8 -0
  119. package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +10 -0
  120. package/cpp/skia/include/utils/SkBase64.h +2 -2
  121. package/cpp/skia/include/utils/SkNWayCanvas.h +1 -11
  122. package/cpp/skia/include/utils/SkNoDrawCanvas.h +0 -2
  123. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -2
  124. package/cpp/skia/include/utils/SkShadowUtils.h +15 -1
  125. package/cpp/skia/include/utils/SkTextUtils.h +1 -1
  126. package/cpp/skia/modules/skparagraph/include/Paragraph.h +107 -1
  127. package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +3 -2
  128. package/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +4 -0
  129. package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +5 -3
  130. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +4 -0
  131. package/cpp/skia/src/core/SkChecksum.h +2 -1
  132. package/cpp/skia/src/core/SkPathPriv.h +1 -1
  133. package/cpp/skia/src/core/SkTHash.h +19 -9
  134. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
  135. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +1 -1
  136. package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
  137. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  138. package/lib/commonjs/external/reanimated/index.d.ts +1 -0
  139. package/lib/commonjs/external/reanimated/index.js +13 -0
  140. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  141. package/lib/commonjs/external/reanimated/moduleWrapper.js +3 -8
  142. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  143. package/lib/commonjs/external/reanimated/renderHelpers.js +46 -1
  144. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  145. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  146. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +26 -0
  147. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  148. package/lib/commonjs/external/reanimated/useSharedValueEffect.js +2 -5
  149. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  150. package/lib/commonjs/index.d.ts +1 -0
  151. package/lib/commonjs/index.js +21 -0
  152. package/lib/commonjs/index.js.map +1 -1
  153. package/lib/commonjs/skia/types/MaskFilter.js +4 -0
  154. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  155. package/lib/commonjs/skia/web/JsiSkPicture.js +2 -1
  156. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  157. package/lib/commonjs/views/SkiaBaseWebView.js +1 -1
  158. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  159. package/lib/commonjs/views/types.js +3 -0
  160. package/lib/commonjs/views/types.js.map +1 -1
  161. package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
  162. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  163. package/lib/module/external/reanimated/index.d.ts +1 -0
  164. package/lib/module/external/reanimated/index.js +1 -0
  165. package/lib/module/external/reanimated/index.js.map +1 -1
  166. package/lib/module/external/reanimated/moduleWrapper.js +1 -9
  167. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  168. package/lib/module/external/reanimated/renderHelpers.js +48 -2
  169. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  170. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  171. package/lib/module/external/reanimated/useDerivedValueOnJS.js +15 -0
  172. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -0
  173. package/lib/module/external/reanimated/useSharedValueEffect.js +3 -6
  174. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  175. package/lib/module/index.d.ts +1 -0
  176. package/lib/module/index.js +1 -0
  177. package/lib/module/index.js.map +1 -1
  178. package/lib/module/skia/types/MaskFilter.js +3 -0
  179. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  180. package/lib/module/views/types.js +3 -0
  181. package/lib/module/views/types.js.map +1 -1
  182. package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
  183. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +2 -0
  184. package/lib/typescript/src/index.d.ts +1 -0
  185. package/libs/android/arm64-v8a/libskia.a +0 -0
  186. package/libs/android/arm64-v8a/libskottie.a +0 -0
  187. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  188. package/libs/android/arm64-v8a/libsksg.a +0 -0
  189. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  190. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  191. package/libs/android/arm64-v8a/libsvg.a +0 -0
  192. package/libs/android/armeabi-v7a/libskia.a +0 -0
  193. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  194. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  195. package/libs/android/armeabi-v7a/libsksg.a +0 -0
  196. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  197. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  198. package/libs/android/armeabi-v7a/libsvg.a +0 -0
  199. package/libs/android/x86/libskia.a +0 -0
  200. package/libs/android/x86/libskottie.a +0 -0
  201. package/libs/android/x86/libskparagraph.a +0 -0
  202. package/libs/android/x86/libsksg.a +0 -0
  203. package/libs/android/x86/libskshaper.a +0 -0
  204. package/libs/android/x86/libskunicode.a +0 -0
  205. package/libs/android/x86/libsvg.a +0 -0
  206. package/libs/android/x86_64/libskia.a +0 -0
  207. package/libs/android/x86_64/libskottie.a +0 -0
  208. package/libs/android/x86_64/libskparagraph.a +0 -0
  209. package/libs/android/x86_64/libsksg.a +0 -0
  210. package/libs/android/x86_64/libskshaper.a +0 -0
  211. package/libs/android/x86_64/libskunicode.a +0 -0
  212. package/libs/android/x86_64/libsvg.a +0 -0
  213. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  214. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  215. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  216. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  217. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  218. package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
  219. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  220. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  221. package/libs/ios/libsksg.xcframework/Info.plist +5 -5
  222. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  223. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  224. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  225. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  226. package/libs/ios/libskunicode.xcframework/Info.plist +5 -5
  227. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  228. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  229. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  230. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  231. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  232. package/package.json +1 -1
  233. package/react-native-skia.podspec +1 -1
  234. package/src/dom/nodes/datatypes/Rect.ts +6 -2
  235. package/src/external/reanimated/index.ts +1 -0
  236. package/src/external/reanimated/moduleWrapper.ts +6 -10
  237. package/src/external/reanimated/renderHelpers.ts +41 -1
  238. package/src/external/reanimated/useDerivedValueOnJS.ts +24 -0
  239. package/src/external/reanimated/useSharedValueEffect.ts +4 -7
  240. package/src/index.ts +1 -0
  241. package/cpp/skia/include/core/SkDeferredDisplayList.h +0 -15
  242. package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +0 -15
  243. package/cpp/skia/include/core/SkPromiseImageTexture.h +0 -20
  244. package/cpp/skia/include/core/SkSurfaceCharacterization.h +0 -15
  245. package/cpp/skia/include/core/SkTime.h +0 -63
  246. package/cpp/skia/include/effects/SkOpPathEffect.h +0 -43
  247. package/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +0 -28
  248. package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +0 -32
  249. package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +0 -95
  250. package/cpp/skia/include/private/SkBitmaskEnum.h +0 -59
  251. package/cpp/skia/include/private/SkSLDefines.h +0 -64
  252. package/cpp/skia/include/private/SkShadowFlags.h +0 -27
  253. package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +0 -26
  254. /package/cpp/skia/{include/private/base → src/core}/SkPathEnums.h +0 -0
@@ -124,6 +124,9 @@ struct ParagraphStyle {
124
124
  bool getReplaceTabCharacters() const { return fReplaceTabCharacters; }
125
125
  void setReplaceTabCharacters(bool value) { fReplaceTabCharacters = value; }
126
126
 
127
+ bool getApplyRoundingHack() const { return fApplyRoundingHack; }
128
+ void setApplyRoundingHack(bool value) { fApplyRoundingHack = value; }
129
+
127
130
  private:
128
131
  StrutStyle fStrutStyle;
129
132
  TextStyle fDefaultTextStyle;
@@ -136,6 +139,7 @@ private:
136
139
  TextHeightBehavior fTextHeightBehavior;
137
140
  bool fHintingIsOn;
138
141
  bool fReplaceTabCharacters;
142
+ bool fApplyRoundingHack = true;
139
143
  };
140
144
  } // namespace textlayout
141
145
  } // namespace skia
@@ -2,14 +2,16 @@
2
2
  #ifndef TypefaceFontProvider_DEFINED
3
3
  #define TypefaceFontProvider_DEFINED
4
4
 
5
+ #include "include/core/SkFontMgr.h"
6
+ #include "include/core/SkFontStyle.h"
7
+ #include "include/core/SkStream.h"
8
+ #include "include/core/SkString.h"
5
9
  #include "include/private/base/SkTArray.h"
6
10
  #include "src/core/SkTHash.h"
11
+
7
12
  #include <string>
8
13
  #include <unordered_map>
9
14
  #include <vector>
10
- #include "include/core/SkFontMgr.h"
11
- #include "include/core/SkStream.h"
12
- #include "include/core/SkString.h"
13
15
 
14
16
  namespace skia {
15
17
  namespace textlayout {
@@ -116,9 +116,13 @@ private:
116
116
  bool parseLengthUnitToken(SkSVGLength::Unit*);
117
117
  bool parseNamedColorToken(SkColor*);
118
118
  bool parseHexColorToken(SkColor*);
119
+ bool parseColorComponentScalarToken(int32_t*);
120
+ bool parseColorComponentIntegralToken(int32_t*);
121
+ bool parseColorComponentFractionalToken(int32_t*);
119
122
  bool parseColorComponentToken(int32_t*);
120
123
  bool parseColorToken(SkColor*);
121
124
  bool parseRGBColorToken(SkColor*);
125
+ bool parseRGBAColorToken(SkColor*);
122
126
  bool parseSVGColor(SkSVGColor*, SkSVGColor::Vars&&);
123
127
  bool parseSVGColorType(SkSVGColorType*);
124
128
  bool parseFuncIRI(SkSVGFuncIRI*);
@@ -9,9 +9,10 @@
9
9
  #define SkChecksum_DEFINED
10
10
 
11
11
  #include "include/core/SkString.h"
12
- #include "include/core/SkTypes.h"
13
12
  #include "include/private/base/SkAPI.h"
14
13
 
14
+ #include <cstddef>
15
+ #include <cstdint>
15
16
  #include <string>
16
17
  #include <string_view>
17
18
  #include <type_traits>
@@ -19,7 +19,7 @@
19
19
  #include "include/private/SkIDChangeListener.h"
20
20
  #include "include/private/SkPathRef.h"
21
21
  #include "include/private/base/SkDebug.h"
22
- #include "include/private/base/SkPathEnums.h"
22
+ #include "src/core/SkPathEnums.h"
23
23
 
24
24
  #include <cstdint>
25
25
  #include <iterator>
@@ -9,11 +9,12 @@
9
9
  #define SkTHash_DEFINED
10
10
 
11
11
  #include "include/core/SkTypes.h"
12
- #include "include/private/base/SkTemplates.h"
13
12
  #include "src/core/SkChecksum.h"
14
13
 
15
14
  #include <initializer_list>
15
+ #include <memory>
16
16
  #include <new>
17
+ #include <type_traits>
17
18
  #include <utility>
18
19
 
19
20
  namespace skia_private {
@@ -40,7 +41,7 @@ public:
40
41
  if (this != &that) {
41
42
  fCount = that.fCount;
42
43
  fCapacity = that.fCapacity;
43
- fSlots.reset(that.fCapacity);
44
+ fSlots.reset(new Slot[that.fCapacity]);
44
45
  for (int i = 0; i < fCapacity; i++) {
45
46
  fSlots[i] = that.fSlots[i];
46
47
  }
@@ -147,8 +148,8 @@ public:
147
148
 
148
149
  fCount = 0;
149
150
  fCapacity = capacity;
150
- AutoTArray<Slot> oldSlots = std::move(fSlots);
151
- fSlots = AutoTArray<Slot>(capacity);
151
+ std::unique_ptr<Slot[]> oldSlots = std::move(fSlots);
152
+ fSlots.reset(new Slot[capacity]);
152
153
 
153
154
  for (int i = 0; i < oldCapacity; i++) {
154
155
  Slot& s = oldSlots[i];
@@ -413,7 +414,7 @@ private:
413
414
 
414
415
  int fCount = 0,
415
416
  fCapacity = 0;
416
- AutoTArray<Slot> fSlots;
417
+ std::unique_ptr<Slot[]> fSlots;
417
418
  };
418
419
 
419
420
  // Maps K->V. A more user-friendly wrapper around THashTable, suitable for most use cases.
@@ -488,15 +489,24 @@ public:
488
489
  }
489
490
 
490
491
  // Call fn on every key/value pair in the table. You may mutate the value but not the key.
491
- template <typename Fn> // f(K, V*) or f(const K&, V*)
492
+ template <typename Fn, // f(K, V*) or f(const K&, V*)
493
+ std::enable_if_t<std::is_invocable_v<Fn, K, V*>>* = nullptr>
492
494
  void foreach(Fn&& fn) {
493
- fTable.foreach([&fn](Pair* p){ fn(p->first, &p->second); });
495
+ fTable.foreach([&fn](Pair* p) { fn(p->first, &p->second); });
494
496
  }
495
497
 
496
498
  // Call fn on every key/value pair in the table. You may not mutate anything.
497
- template <typename Fn> // f(K, V), f(const K&, V), f(K, const V&) or f(const K&, const V&).
499
+ template <typename Fn, // f(K, V), f(const K&, V), f(K, const V&) or f(const K&, const V&).
500
+ std::enable_if_t<std::is_invocable_v<Fn, K, V>>* = nullptr>
498
501
  void foreach(Fn&& fn) const {
499
- fTable.foreach([&fn](const Pair& p){ fn(p.first, p.second); });
502
+ fTable.foreach([&fn](const Pair& p) { fn(p.first, p.second); });
503
+ }
504
+
505
+ // Call fn on every key/value pair in the table. You may not mutate anything.
506
+ template <typename Fn, // f(Pair), or f(const Pair&)
507
+ std::enable_if_t<std::is_invocable_v<Fn, Pair>>* = nullptr>
508
+ void foreach(Fn&& fn) const {
509
+ fTable.foreach([&fn](const Pair& p) { fn(p); });
500
510
  }
501
511
 
502
512
  // Dereferencing an iterator gives back a key-value pair, suitable for structured binding.
@@ -88,7 +88,9 @@ bool RNSkMetalCanvasProvider::renderToCanvas(
88
88
  SkCanvas *canvas = skSurface->getCanvas();
89
89
  cb(canvas);
90
90
 
91
- skSurface->flushAndSubmit();
91
+ if (auto dContext = GrAsDirectContext(skSurface->recordingContext())) {
92
+ dContext->flushAndSubmit();
93
+ }
92
94
 
93
95
  id<MTLCommandBuffer> commandBuffer(
94
96
  [ThreadContextHolder::ThreadSkiaMetalContext
@@ -65,7 +65,7 @@ SkiaMetalSurfaceFactory::makeWindowedSurface(id<MTLTexture> texture, int width,
65
65
  GrMtlTextureInfo fbInfo;
66
66
  fbInfo.fTexture.retain((__bridge void *)texture);
67
67
 
68
- GrBackendRenderTarget backendRT(width, height, 1, fbInfo);
68
+ GrBackendRenderTarget backendRT(width, height, fbInfo);
69
69
 
70
70
  auto skSurface = SkSurfaces::WrapBackendRenderTarget(
71
71
  ThreadContextHolder::ThreadSkiaMetalContext.skContext.get(), backendRT,
@@ -8,7 +8,11 @@ exports.processRect = exports.processRRect = exports.isEdge = void 0;
8
8
  var _Radius = require("./Radius");
9
9
 
10
10
  /* eslint-disable @typescript-eslint/no-explicit-any */
11
- const isEdge = (pos, b) => pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height; // We have an issue to check property existence on JSI backed instances
11
+ const isEdge = (pos, b) => {
12
+ "worklet";
13
+
14
+ return pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height;
15
+ }; // We have an issue to check property existence on JSI backed instances
12
16
 
13
17
 
14
18
  exports.isEdge = isEdge;
@@ -1 +1 @@
1
- {"version":3,"names":["isEdge","pos","b","x","y","width","height","isRRectCtor","def","rect","undefined","isRectCtor","processRect","Skia","XYWHRect","processRRect","r","processRadius","RRectXY"],"sources":["Rect.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Skia, SkRect, Vector } from \"../../../skia/types\";\nimport type { RectCtor, RectDef, RRectCtor, RRectDef } from \"../../types\";\n\nimport { processRadius } from \"./Radius\";\n\nexport const isEdge = (pos: Vector, b: SkRect) =>\n pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height;\n\n// We have an issue to check property existence on JSI backed instances\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\n\nexport const processRect = (Skia: Skia, def: RectDef) => {\n if (isRectCtor(def)) {\n return Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (Skia: Skia, def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(Skia, def.r ?? 0);\n return Skia.RRectXY(\n Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height),\n r.x,\n r.y\n );\n } else {\n return def.rect;\n }\n};\n"],"mappings":";;;;;;;AAIA;;AAJA;AAMO,MAAMA,MAAM,GAAG,CAACC,GAAD,EAAcC,CAAd,KACpBD,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACC,CAAZ,IAAiBF,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACE,CAA7B,IAAkCH,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACG,KAA9C,IAAuDJ,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACI,MAD9D,C,CAGP;;;;;AACA,MAAMC,WAAW,GAAIC,GAAD,IACjBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB,C,CAEA;;;AACA,MAAMC,UAAU,GAAIH,GAAD,IAChBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB;;AAGO,MAAME,WAAW,GAAG,CAACC,IAAD,EAAaL,GAAb,KAA8B;EACvD,IAAIG,UAAU,CAACH,GAAD,CAAd,EAAqB;IACnB,OAAOK,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CAAP;EACD,CAFD,MAEO;IACL,OAAOE,GAAG,CAACC,IAAX;EACD;AACF,CANM;;;;AAQA,MAAMM,YAAY,GAAG,CAACF,IAAD,EAAaL,GAAb,KAA+B;EACzD,IAAID,WAAW,CAACC,GAAD,CAAf,EAAsB;IACpB,MAAMQ,CAAC,GAAG,IAAAC,qBAAA,EAAcJ,IAAd,EAAoBL,GAAG,CAACQ,CAAJ,IAAS,CAA7B,CAAV;IACA,OAAOH,IAAI,CAACK,OAAL,CACLL,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CADK,EAELU,CAAC,CAACb,CAFG,EAGLa,CAAC,CAACZ,CAHG,CAAP;EAKD,CAPD,MAOO;IACL,OAAOI,GAAG,CAACC,IAAX;EACD;AACF,CAXM"}
1
+ {"version":3,"names":["isEdge","pos","b","x","y","width","height","isRRectCtor","def","rect","undefined","isRectCtor","processRect","Skia","XYWHRect","processRRect","r","processRadius","RRectXY"],"sources":["Rect.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Skia, SkRect, Vector } from \"../../../skia/types\";\nimport type { RectCtor, RectDef, RRectCtor, RRectDef } from \"../../types\";\n\nimport { processRadius } from \"./Radius\";\n\nexport const isEdge = (pos: Vector, b: SkRect) => {\n \"worklet\";\n return (\n pos.x === b.x || pos.y === b.y || pos.x === b.width || pos.y === b.height\n );\n};\n\n// We have an issue to check property existence on JSI backed instances\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\n\nexport const processRect = (Skia: Skia, def: RectDef) => {\n if (isRectCtor(def)) {\n return Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (Skia: Skia, def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(Skia, def.r ?? 0);\n return Skia.RRectXY(\n Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height),\n r.x,\n r.y\n );\n } else {\n return def.rect;\n }\n};\n"],"mappings":";;;;;;;AAIA;;AAJA;AAMO,MAAMA,MAAM,GAAG,CAACC,GAAD,EAAcC,CAAd,KAA4B;EAChD;;EACA,OACED,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACC,CAAZ,IAAiBF,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACE,CAA7B,IAAkCH,GAAG,CAACE,CAAJ,KAAUD,CAAC,CAACG,KAA9C,IAAuDJ,GAAG,CAACG,CAAJ,KAAUF,CAAC,CAACI,MADrE;AAGD,CALM,C,CAOP;;;;;AACA,MAAMC,WAAW,GAAIC,GAAD,IACjBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB,C,CAEA;;;AACA,MAAMC,UAAU,GAAIH,GAAD,IAChBA,GAAD,CAAaC,IAAb,KAAsBC,SADxB;;AAGO,MAAME,WAAW,GAAG,CAACC,IAAD,EAAaL,GAAb,KAA8B;EACvD,IAAIG,UAAU,CAACH,GAAD,CAAd,EAAqB;IACnB,OAAOK,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CAAP;EACD,CAFD,MAEO;IACL,OAAOE,GAAG,CAACC,IAAX;EACD;AACF,CANM;;;;AAQA,MAAMM,YAAY,GAAG,CAACF,IAAD,EAAaL,GAAb,KAA+B;EACzD,IAAID,WAAW,CAACC,GAAD,CAAf,EAAsB;IACpB,MAAMQ,CAAC,GAAG,IAAAC,qBAAA,EAAcJ,IAAd,EAAoBL,GAAG,CAACQ,CAAJ,IAAS,CAA7B,CAAV;IACA,OAAOH,IAAI,CAACK,OAAL,CACLL,IAAI,CAACC,QAAL,CAAcN,GAAG,CAACL,CAAJ,IAAS,CAAvB,EAA0BK,GAAG,CAACJ,CAAJ,IAAS,CAAnC,EAAsCI,GAAG,CAACH,KAA1C,EAAiDG,GAAG,CAACF,MAArD,CADK,EAELU,CAAC,CAACb,CAFG,EAGLa,CAAC,CAACZ,CAHG,CAAP;EAKD,CAPD,MAOO;IACL,OAAOI,GAAG,CAACC,IAAX;EACD;AACF,CAXM"}
@@ -1,2 +1,3 @@
1
1
  export * from "./useSharedValueEffect";
2
+ export * from "./useDerivedValueOnJS";
2
3
  export * from "./renderHelpers";
@@ -17,6 +17,19 @@ Object.keys(_useSharedValueEffect).forEach(function (key) {
17
17
  });
18
18
  });
19
19
 
20
+ var _useDerivedValueOnJS = require("./useDerivedValueOnJS");
21
+
22
+ Object.keys(_useDerivedValueOnJS).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _useDerivedValueOnJS[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _useDerivedValueOnJS[key];
29
+ }
30
+ });
31
+ });
32
+
20
33
  var _renderHelpers = require("./renderHelpers");
21
34
 
22
35
  Object.keys(_renderHelpers).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useSharedValueEffect\";\nexport * from \"./renderHelpers\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useSharedValueEffect\";\nexport * from \"./useDerivedValueOnJS\";\nexport * from \"./renderHelpers\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -10,6 +10,8 @@ exports.useSharedValue = exports.useFrameCallback = void 0;
10
10
  var _react = require("react");
11
11
 
12
12
  var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5;
13
+ /* eslint-disable @typescript-eslint/no-explicit-any */
14
+
13
15
 
14
16
  // This one is needed for the deprecated useSharedValue function
15
17
  // We can remove it once we remove the deprecation
@@ -39,12 +41,6 @@ function throwOnMissingReanimated() {
39
41
  }
40
42
  }
41
43
 
42
- function throwOnMissingReanimated3() {
43
- if (!HAS_REANIMATED3) {
44
- throw new Error(`Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`);
45
- }
46
- }
47
-
48
44
  const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || (value => (0, _react.useMemo)(() => ({
49
45
  value
50
46
  }), [value]));
@@ -60,8 +56,7 @@ const runOnJS = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void
60
56
  exports.runOnJS = runOnJS;
61
57
 
62
58
  const isSharedValue = value => {
63
- throwOnMissingReanimated3();
64
- return !!value && Reanimated3.isSharedValue(value);
59
+ return !!value && (Reanimated3 ? Reanimated3.isSharedValue(value) : value.value !== undefined);
65
60
  };
66
61
 
67
62
  exports.isSharedValue = isSharedValue;
@@ -1 +1 @@
1
- {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","throwOnMissingReanimated3","useSharedValue","value","useMemo","useFrameCallback","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\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 =\n // eslint-disable-next-line import/extensions\n 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\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\nexport const useFrameCallback: (...args: any[]) => any =\n Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper = Reanimated2?.startMapper || throwOnMissingReanimated;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;;;;;;;;AACA;;;;AAIA;AACA;AAEA,IAAIA,WAAJ;AAEA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEA,SAASQ,wBAAT,GAAoC;EACzC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;AACF;;AAEM,MAAMU,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmB,IAAAC,cAAA,EAAQ,OAAO;EAAED;AAAF,CAAP,CAAR,EAA2B,CAACA,KAAD,CAA3B,CADpB,CADK;;;AAGA,MAAME,gBAAyC,GACpD,iBAAAf,WAAW,UAAX,oDAAae,gBAAb,KAAiCN,wBAD5B;;AAGA,MAAMO,WAAW,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,WAAb,KAA4BP,wBAAhD;;AACA,MAAMQ,UAAU,GAAG,iBAAAjB,WAAW,UAAX,oDAAaiB,UAAb,KAA2BR,wBAA9C;;AACA,MAAMS,OAAO,GAAG,iBAAAlB,WAAW,UAAX,oDAAakB,OAAb,KAAwBT,wBAAxC;;;AACA,MAAMU,aAAa,GACxBN,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACkB,aAAZ,CAA0BN,KAA1B,CAAlB;AACD,CALM"}
1
+ {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","useSharedValue","value","useMemo","useFrameCallback","startMapper","stopMapper","runOnJS","isSharedValue","undefined"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\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 =\n // eslint-disable-next-line import/extensions\n 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 =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\nexport const useFrameCallback: (...args: any[]) => any =\n Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper = Reanimated2?.startMapper || throwOnMissingReanimated;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n return (\n !!value &&\n (Reanimated3\n ? Reanimated3.isSharedValue(value)\n : (value as any).value !== undefined)\n );\n};\n"],"mappings":";;;;;;;;;AACA;;;AADA;;;AAKA;AACA;AAEA,IAAIA,WAAJ;AAEA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEA,SAASQ,wBAAT,GAAoC;EACzC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAEM,MAAMC,cAAc,GACzB,gBAAAX,WAAW,UAAX,kDAAaW,cAAb,MACEC,KAAD,IAAmB,IAAAC,cAAA,EAAQ,OAAO;EAAED;AAAF,CAAP,CAAR,EAA2B,CAACA,KAAD,CAA3B,CADpB,CADK;;;AAGA,MAAME,gBAAyC,GACpD,iBAAAd,WAAW,UAAX,oDAAac,gBAAb,KAAiCL,wBAD5B;;AAGA,MAAMM,WAAW,GAAG,iBAAAf,WAAW,UAAX,oDAAae,WAAb,KAA4BN,wBAAhD;;AACA,MAAMO,UAAU,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,UAAb,KAA2BP,wBAA9C;;AACA,MAAMQ,OAAO,GAAG,iBAAAjB,WAAW,UAAX,oDAAaiB,OAAb,KAAwBR,wBAAxC;;;AACA,MAAMS,aAAa,GACxBN,KAD2B,IAEK;EAChC,OACE,CAAC,CAACA,KAAF,KACCX,WAAW,GACRA,WAAW,CAACiB,aAAZ,CAA0BN,KAA1B,CADQ,GAEPA,KAAD,CAAeA,KAAf,KAAyBO,SAH7B,CADF;AAMD,CATM"}
@@ -14,7 +14,7 @@ var _moduleWrapper = require("./moduleWrapper");
14
14
  const _bindings = new WeakMap();
15
15
 
16
16
  function extractReanimatedProps(props) {
17
- if (!_moduleWrapper.HAS_REANIMATED3) {
17
+ if (!_moduleWrapper.HAS_REANIMATED3 && !_moduleWrapper.HAS_REANIMATED2) {
18
18
  return [props, {}];
19
19
  }
20
20
 
@@ -39,7 +39,52 @@ function extractReanimatedProps(props) {
39
39
  return [otherProps, reanimatedProps];
40
40
  }
41
41
 
42
+ function bindReanimatedProps2(container, node, reanimatedProps) {
43
+ const sharedValues = Object.values(reanimatedProps);
44
+
45
+ const previousMapperId = _bindings.get(node);
46
+
47
+ if (previousMapperId !== undefined) {
48
+ (0, _moduleWrapper.stopMapper)(previousMapperId);
49
+ }
50
+
51
+ if (sharedValues.length > 0) {
52
+ const viewId = container.getNativeId();
53
+ const {
54
+ SkiaViewApi
55
+ } = global;
56
+
57
+ const updateProps = () => {
58
+ for (const propName in reanimatedProps) {
59
+ node && node.setProp(propName, reanimatedProps[propName].value);
60
+ } // On React Native we use the SkiaViewApi to redraw because it can
61
+ // run on the worklet thread (container.redraw can't)
62
+ // if SkiaViewApi is undefined, we are on web and container.redraw()
63
+ // can safely be invoked
64
+
65
+
66
+ if (SkiaViewApi) {
67
+ SkiaViewApi.requestRedraw(viewId);
68
+ } else {
69
+ container.redraw();
70
+ }
71
+ };
72
+
73
+ const mapperId = (0, _moduleWrapper.startMapper)(() => {
74
+ "worklet";
75
+
76
+ (0, _moduleWrapper.runOnJS)(updateProps)();
77
+ }, sharedValues);
78
+
79
+ _bindings.set(node, mapperId);
80
+ }
81
+ }
82
+
42
83
  function bindReanimatedProps(container, node, reanimatedProps) {
84
+ if (_moduleWrapper.HAS_REANIMATED2) {
85
+ return bindReanimatedProps2(container, node, reanimatedProps);
86
+ }
87
+
43
88
  if (!_moduleWrapper.HAS_REANIMATED3) {
44
89
  return;
45
90
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_bindings","WeakMap","extractReanimatedProps","props","HAS_REANIMATED3","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps","container","node","sharedValues","Object","values","previousMapperId","get","undefined","stopMapper","length","viewId","getNativeId","SkiaViewApi","global","mapperId","startMapper","setProp","requestRedraw","redraw","set"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable reanimated/js-function-in-worklet */\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} from \"./moduleWrapper\";\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED3) {\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\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\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);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = startMapper(() => {\n \"worklet\";\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 }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":";;;;;;;;AAMA;;AANA;;AACA;AAYA,MAAMA,SAAS,GAAG,IAAIC,OAAJ,EAAlB;;AAEO,SAASC,sBAAT,CAAgCC,KAAhC,EAA2D;EAChE,IAAI,CAACC,8BAAL,EAAsB;IACpB,OAAO,CAACD,KAAD,EAAQ,EAAR,CAAP;EACD;;EACD,MAAME,eAAe,GAAG,EAAxB;EACA,MAAMC,UAAU,GAAG,EAAnB;;EACA,KAAK,MAAMC,QAAX,IAAuBJ,KAAvB,EAA8B;IAC5B,IAAII,QAAQ,KAAK,UAAjB,EAA6B;MAC3B;IACD;;IACD,MAAMC,SAAS,GAAGL,KAAK,CAACI,QAAD,CAAvB;;IACA,IAAI,IAAAE,4BAAA,EAAcD,SAAd,CAAJ,EAA8B;MAC5BH,eAAe,CAACE,QAAD,CAAf,GAA4BC,SAA5B;MACAF,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAS,CAACE,KAAjC;IACD,CAHD,MAGO;MACLJ,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAvB;IACD;EACF;;EACD,OAAO,CAACF,UAAD,EAAaD,eAAb,CAAP;AACD;;AAEM,SAASM,mBAAT,CACLC,SADK,EAELC,IAFK,EAGLR,eAHK,EAIL;EACA,IAAI,CAACD,8BAAL,EAAsB;IACpB;EACD;;EACD,MAAMU,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcX,eAAd,CAArB;;EACA,MAAMY,gBAAgB,GAAGjB,SAAS,CAACkB,GAAV,CAAcL,IAAd,CAAzB;;EACA,IAAII,gBAAgB,KAAKE,SAAzB,EAAoC;IAClC,IAAAC,yBAAA,EAAWH,gBAAX;EACD;;EACD,IAAIH,YAAY,CAACO,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGV,SAAS,CAACW,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;IACA,MAAMC,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,KAAK,MAAMpB,QAAX,IAAuBF,eAAvB,EAAwC;QACtCQ,IAAI,IAAIA,IAAI,CAACe,OAAL,CAAarB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BG,KAAjD,CAAR;MACD,CAJgC,CAKjC;MACA;MACA;MACA;;;MACA,IAAIc,WAAJ,EAAiB;QACfA,WAAW,CAACK,aAAZ,CAA0BP,MAA1B;MACD,CAFD,MAEO;QACLV,SAAS,CAACkB,MAAV;MACD;IACF,CAdgB,EAcdhB,YAdc,CAAjB;;IAeAd,SAAS,CAAC+B,GAAV,CAAclB,IAAd,EAAoBa,QAApB;EACD;AACF"}
1
+ {"version":3,"names":["_bindings","WeakMap","extractReanimatedProps","props","HAS_REANIMATED3","HAS_REANIMATED2","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps2","container","node","sharedValues","Object","values","previousMapperId","get","undefined","stopMapper","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/* eslint-disable reanimated/js-function-in-worklet */\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 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);\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) {\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);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = startMapper(() => {\n \"worklet\";\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 }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":";;;;;;;;AAMA;;AANA;;AACA;AAcA,MAAMA,SAAS,GAAG,IAAIC,OAAJ,EAAlB;;AAEO,SAASC,sBAAT,CAAgCC,KAAhC,EAA2D;EAChE,IAAI,CAACC,8BAAD,IAAoB,CAACC,8BAAzB,EAA0C;IACxC,OAAO,CAACF,KAAD,EAAQ,EAAR,CAAP;EACD;;EACD,MAAMG,eAAe,GAAG,EAAxB;EACA,MAAMC,UAAU,GAAG,EAAnB;;EACA,KAAK,MAAMC,QAAX,IAAuBL,KAAvB,EAA8B;IAC5B,IAAIK,QAAQ,KAAK,UAAjB,EAA6B;MAC3B;IACD;;IACD,MAAMC,SAAS,GAAGN,KAAK,CAACK,QAAD,CAAvB;;IACA,IAAI,IAAAE,4BAAA,EAAcD,SAAd,CAAJ,EAA8B;MAC5BH,eAAe,CAACE,QAAD,CAAf,GAA4BC,SAA5B;MACAF,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAS,CAACE,KAAjC;IACD,CAHD,MAGO;MACLJ,UAAU,CAACC,QAAD,CAAV,GAAuBC,SAAvB;IACD;EACF;;EACD,OAAO,CAACF,UAAD,EAAaD,eAAb,CAAP;AACD;;AAED,SAASM,oBAAT,CACEC,SADF,EAEEC,IAFF,EAGER,eAHF,EAIE;EACA,MAAMS,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcX,eAAd,CAArB;;EACA,MAAMY,gBAAgB,GAAGlB,SAAS,CAACmB,GAAV,CAAcL,IAAd,CAAzB;;EACA,IAAII,gBAAgB,KAAKE,SAAzB,EAAoC;IAClC,IAAAC,yBAAA,EAAWH,gBAAX;EACD;;EACD,IAAIH,YAAY,CAACO,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGV,SAAS,CAACW,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;;IACA,MAAMC,WAAW,GAAG,MAAM;MACxB,KAAK,MAAMnB,QAAX,IAAuBF,eAAvB,EAAwC;QACtCQ,IAAI,IAAIA,IAAI,CAACc,OAAL,CAAapB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BG,KAAjD,CAAR;MACD,CAHuB,CAIxB;MACA;MACA;MACA;;;MACA,IAAIc,WAAJ,EAAiB;QACfA,WAAW,CAACI,aAAZ,CAA0BN,MAA1B;MACD,CAFD,MAEO;QACLV,SAAS,CAACiB,MAAV;MACD;IACF,CAbD;;IAcA,MAAMC,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,IAAAC,sBAAA,EAAQN,WAAR;IACD,CAHgB,EAGdZ,YAHc,CAAjB;;IAIAf,SAAS,CAACkC,GAAV,CAAcpB,IAAd,EAAoBiB,QAApB;EACD;AACF;;AAEM,SAASI,mBAAT,CACLtB,SADK,EAELC,IAFK,EAGLR,eAHK,EAIL;EACA,IAAID,8BAAJ,EAAqB;IACnB,OAAOO,oBAAoB,CAACC,SAAD,EAAYC,IAAZ,EAAkBR,eAAlB,CAA3B;EACD;;EACD,IAAI,CAACF,8BAAL,EAAsB;IACpB;EACD;;EACD,MAAMW,YAAY,GAAGC,MAAM,CAACC,MAAP,CAAcX,eAAd,CAArB;;EACA,MAAMY,gBAAgB,GAAGlB,SAAS,CAACmB,GAAV,CAAcL,IAAd,CAAzB;;EACA,IAAII,gBAAgB,KAAKE,SAAzB,EAAoC;IAClC,IAAAC,yBAAA,EAAWH,gBAAX;EACD;;EACD,IAAIH,YAAY,CAACO,MAAb,GAAsB,CAA1B,EAA6B;IAC3B,MAAMC,MAAM,GAAGV,SAAS,CAACW,WAAV,EAAf;IACA,MAAM;MAAEC;IAAF,IAAkBC,MAAxB;IACA,MAAMK,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,KAAK,MAAMxB,QAAX,IAAuBF,eAAvB,EAAwC;QACtCQ,IAAI,IAAIA,IAAI,CAACc,OAAL,CAAapB,QAAb,EAAuBF,eAAe,CAACE,QAAD,CAAf,CAA0BG,KAAjD,CAAR;MACD,CAJgC,CAKjC;MACA;MACA;MACA;;;MACA,IAAIc,WAAJ,EAAiB;QACfA,WAAW,CAACI,aAAZ,CAA0BN,MAA1B;MACD,CAFD,MAEO;QACLV,SAAS,CAACiB,MAAV;MACD;IACF,CAdgB,EAcdf,YAdc,CAAjB;;IAeAf,SAAS,CAACkC,GAAV,CAAcpB,IAAd,EAAoBiB,QAApB;EACD;AACF"}
@@ -0,0 +1,2 @@
1
+ import { type DependencyList } from "react";
2
+ export declare const useDerivedValueOnJS: (fn: () => any, deps?: DependencyList) => any;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useDerivedValueOnJS = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _moduleWrapper = require("./moduleWrapper");
11
+
12
+ const useDerivedValueOnJS = (fn, deps) => {
13
+ const value = (0, _moduleWrapper.useSharedValue)(fn());
14
+ (0, _react.useEffect)(() => {
15
+ const mapperId = (0, _moduleWrapper.startMapper)(() => {
16
+ "worklet";
17
+
18
+ (0, _moduleWrapper.runOnJS)(fn)();
19
+ }, deps);
20
+ return () => (0, _moduleWrapper.stopMapper)(mapperId);
21
+ }, [deps, fn]);
22
+ return value;
23
+ };
24
+
25
+ exports.useDerivedValueOnJS = useDerivedValueOnJS;
26
+ //# sourceMappingURL=useDerivedValueOnJS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useDerivedValueOnJS","fn","deps","value","useSharedValue","useEffect","mapperId","startMapper","runOnJS","stopMapper"],"sources":["useDerivedValueOnJS.ts"],"sourcesContent":["import { useEffect, type DependencyList } 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?: DependencyList\n) => {\n const value = useSharedValue(fn());\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;;AAEA;;AAOO,MAAMA,mBAAmB,GAAG,CAEjCC,EAFiC,EAGjCC,IAHiC,KAI9B;EACH,MAAMC,KAAK,GAAG,IAAAC,6BAAA,EAAeH,EAAE,EAAjB,CAAd;EACA,IAAAI,gBAAA,EAAU,MAAM;IACd,MAAMC,QAAQ,GAAG,IAAAC,0BAAA,EAAY,MAAM;MACjC;;MACA,IAAAC,sBAAA,EAAQP,EAAR;IACD,CAHgB,EAGdC,IAHc,CAAjB;IAIA,OAAO,MAAM,IAAAO,yBAAA,EAAWH,QAAX,CAAb;EACD,CAND,EAMG,CAACJ,IAAD,EAAOD,EAAP,CANH;EAOA,OAAOE,KAAP;AACD,CAdM"}
@@ -20,11 +20,8 @@ const useSharedValueEffect = function (cb, value) {
20
20
  values[_key - 2] = arguments[_key];
21
21
  }
22
22
 
23
- if (_moduleWrapper.HAS_REANIMATED3) {
24
- console.warn(`useSharedValueEffect() is deprecated with Reanimated 3, you can use Reanimated values directly.
25
- Learn more at https://shopify.github.io/react-native-skia/docs/animations/reanimated.`);
26
- }
27
-
23
+ console.warn(`useSharedValueEffect() is deprecated and will be removed in the next release
24
+ Learn more at https://shopify.github.io/react-native-skia/docs/animations/animations.`);
28
25
  const input = (0, _moduleWrapper.useSharedValue)(0);
29
26
  (0, _react.useEffect)(() => {
30
27
  if (!_moduleWrapper.HAS_REANIMATED2) {
@@ -1 +1 @@
1
- {"version":3,"names":["useSharedValueEffect","cb","value","values","HAS_REANIMATED3","console","warn","input","useSharedValue","useEffect","HAS_REANIMATED2","mapperId","startMapper","runOnJS","stopMapper","undefined"],"sources":["useSharedValueEffect.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\nimport {\n HAS_REANIMATED2,\n useSharedValue,\n runOnJS,\n startMapper,\n stopMapper,\n HAS_REANIMATED3,\n} from \"./moduleWrapper\";\n\n/**\n * Connects a shared value from reanimated to a SkiaView or Canvas\n * so whenever the shared value changes the SkiaView will redraw.\n * @param cb Callback that will be called whenever the shared value changes.\n * @param values One or more shared values to listen for.\n */\nexport const useSharedValueEffect = <T = number>(\n cb: () => void,\n value: SharedValueType<T>,\n ...values: SharedValueType<T>[]\n) => {\n if (HAS_REANIMATED3) {\n console.warn(\n `useSharedValueEffect() is deprecated with Reanimated 3, you can use Reanimated values directly.\nLearn more at https://shopify.github.io/react-native-skia/docs/animations/reanimated.`\n );\n }\n const input = useSharedValue(0);\n\n useEffect(() => {\n if (!HAS_REANIMATED2) {\n console.warn(\n \"Reanimated was not found and the useSharedValueEffect hook will have no effect.\"\n );\n } else {\n // Start a mapper in Reanimated\n const mapperId = startMapper(\n () => {\n \"worklet\";\n runOnJS(cb)();\n },\n [value, ...values],\n [input]\n );\n // Return unregistering the mapper\n return () => {\n if (stopMapper && mapperId !== undefined) {\n stopMapper(mapperId);\n }\n };\n }\n return () => {};\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [input, value, ...values]);\n};\n"],"mappings":";;;;;;;AAAA;;AAIA;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,oBAAoB,GAAG,UAClCC,EADkC,EAElCC,KAFkC,EAI/B;EAAA,kCADAC,MACA;IADAA,MACA;EAAA;;EACH,IAAIC,8BAAJ,EAAqB;IACnBC,OAAO,CAACC,IAAR,CACG;AACP,sFAFI;EAID;;EACD,MAAMC,KAAK,GAAG,IAAAC,6BAAA,EAAe,CAAf,CAAd;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACd,IAAI,CAACC,8BAAL,EAAsB;MACpBL,OAAO,CAACC,IAAR,CACE,iFADF;IAGD,CAJD,MAIO;MACL;MACA,MAAMK,QAAQ,GAAG,IAAAC,0BAAA,EACf,MAAM;QACJ;;QACA,IAAAC,sBAAA,EAAQZ,EAAR;MACD,CAJc,EAKf,CAACC,KAAD,EAAQ,GAAGC,MAAX,CALe,EAMf,CAACI,KAAD,CANe,CAAjB,CAFK,CAUL;;MACA,OAAO,MAAM;QACX,IAAIO,yBAAA,IAAcH,QAAQ,KAAKI,SAA/B,EAA0C;UACxC,IAAAD,yBAAA,EAAWH,QAAX;QACD;MACF,CAJD;IAKD;;IACD,OAAO,MAAM,CAAE,CAAf,CAtBc,CAuBd;EACD,CAxBD,EAwBG,CAACJ,KAAD,EAAQL,KAAR,EAAe,GAAGC,MAAlB,CAxBH;AAyBD,CAtCM"}
1
+ {"version":3,"names":["useSharedValueEffect","cb","value","values","console","warn","input","useSharedValue","useEffect","HAS_REANIMATED2","mapperId","startMapper","runOnJS","stopMapper","undefined"],"sources":["useSharedValueEffect.ts"],"sourcesContent":["import { useEffect } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\nimport {\n HAS_REANIMATED2,\n useSharedValue,\n runOnJS,\n startMapper,\n stopMapper,\n} from \"./moduleWrapper\";\n\n/**\n * Connects a shared value from reanimated to a SkiaView or Canvas\n * so whenever the shared value changes the SkiaView will redraw.\n * @param cb Callback that will be called whenever the shared value changes.\n * @param values One or more shared values to listen for.\n */\nexport const useSharedValueEffect = <T = number>(\n cb: () => void,\n value: SharedValueType<T>,\n ...values: SharedValueType<T>[]\n) => {\n console.warn(\n `useSharedValueEffect() is deprecated and will be removed in the next release\nLearn more at https://shopify.github.io/react-native-skia/docs/animations/animations.`\n );\n const input = useSharedValue(0);\n\n useEffect(() => {\n if (!HAS_REANIMATED2) {\n console.warn(\n \"Reanimated was not found and the useSharedValueEffect hook will have no effect.\"\n );\n } else {\n // Start a mapper in Reanimated\n const mapperId = startMapper(\n () => {\n \"worklet\";\n runOnJS(cb)();\n },\n [value, ...values],\n [input]\n );\n // Return unregistering the mapper\n return () => {\n if (stopMapper && mapperId !== undefined) {\n stopMapper(mapperId);\n }\n };\n }\n return () => {};\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [input, value, ...values]);\n};\n"],"mappings":";;;;;;;AAAA;;AAIA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,oBAAoB,GAAG,UAClCC,EADkC,EAElCC,KAFkC,EAI/B;EAAA,kCADAC,MACA;IADAA,MACA;EAAA;;EACHC,OAAO,CAACC,IAAR,CACG;AACL,sFAFE;EAIA,MAAMC,KAAK,GAAG,IAAAC,6BAAA,EAAe,CAAf,CAAd;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACd,IAAI,CAACC,8BAAL,EAAsB;MACpBL,OAAO,CAACC,IAAR,CACE,iFADF;IAGD,CAJD,MAIO;MACL;MACA,MAAMK,QAAQ,GAAG,IAAAC,0BAAA,EACf,MAAM;QACJ;;QACA,IAAAC,sBAAA,EAAQX,EAAR;MACD,CAJc,EAKf,CAACC,KAAD,EAAQ,GAAGC,MAAX,CALe,EAMf,CAACG,KAAD,CANe,CAAjB,CAFK,CAUL;;MACA,OAAO,MAAM;QACX,IAAIO,yBAAA,IAAcH,QAAQ,KAAKI,SAA/B,EAA0C;UACxC,IAAAD,yBAAA,EAAWH,QAAX;QACD;MACF,CAJD;IAKD;;IACD,OAAO,MAAM,CAAE,CAAf,CAtBc,CAuBd;EACD,CAxBD,EAwBG,CAACJ,KAAD,EAAQJ,KAAR,EAAe,GAAGC,MAAlB,CAxBH;AAyBD,CApCM"}
@@ -1,4 +1,5 @@
1
1
  import "./skia/NativeSetup";
2
+ export { JsiSkImage } from "./skia/web/JsiSkImage";
2
3
  export * from "./renderer";
3
4
  export * from "./renderer/Canvas";
4
5
  export * from "./renderer/Offscreen";
@@ -3,13 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ JsiSkImage: true
8
+ };
9
+ Object.defineProperty(exports, "JsiSkImage", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _JsiSkImage.JsiSkImage;
13
+ }
14
+ });
6
15
 
7
16
  require("./skia/NativeSetup");
8
17
 
18
+ var _JsiSkImage = require("./skia/web/JsiSkImage");
19
+
9
20
  var _renderer = require("./renderer");
10
21
 
11
22
  Object.keys(_renderer).forEach(function (key) {
12
23
  if (key === "default" || key === "__esModule") return;
24
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
13
25
  if (key in exports && exports[key] === _renderer[key]) return;
14
26
  Object.defineProperty(exports, key, {
15
27
  enumerable: true,
@@ -23,6 +35,7 @@ var _Canvas = require("./renderer/Canvas");
23
35
 
24
36
  Object.keys(_Canvas).forEach(function (key) {
25
37
  if (key === "default" || key === "__esModule") return;
38
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
26
39
  if (key in exports && exports[key] === _Canvas[key]) return;
27
40
  Object.defineProperty(exports, key, {
28
41
  enumerable: true,
@@ -36,6 +49,7 @@ var _Offscreen = require("./renderer/Offscreen");
36
49
 
37
50
  Object.keys(_Offscreen).forEach(function (key) {
38
51
  if (key === "default" || key === "__esModule") return;
52
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
39
53
  if (key in exports && exports[key] === _Offscreen[key]) return;
40
54
  Object.defineProperty(exports, key, {
41
55
  enumerable: true,
@@ -49,6 +63,7 @@ var _views = require("./views");
49
63
 
50
64
  Object.keys(_views).forEach(function (key) {
51
65
  if (key === "default" || key === "__esModule") return;
66
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
52
67
  if (key in exports && exports[key] === _views[key]) return;
53
68
  Object.defineProperty(exports, key, {
54
69
  enumerable: true,
@@ -62,6 +77,7 @@ var _skia = require("./skia");
62
77
 
63
78
  Object.keys(_skia).forEach(function (key) {
64
79
  if (key === "default" || key === "__esModule") return;
80
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
65
81
  if (key in exports && exports[key] === _skia[key]) return;
66
82
  Object.defineProperty(exports, key, {
67
83
  enumerable: true,
@@ -75,6 +91,7 @@ var _external = require("./external");
75
91
 
76
92
  Object.keys(_external).forEach(function (key) {
77
93
  if (key === "default" || key === "__esModule") return;
94
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
78
95
  if (key in exports && exports[key] === _external[key]) return;
79
96
  Object.defineProperty(exports, key, {
80
97
  enumerable: true,
@@ -88,6 +105,7 @@ var _values = require("./values");
88
105
 
89
106
  Object.keys(_values).forEach(function (key) {
90
107
  if (key === "default" || key === "__esModule") return;
108
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
91
109
  if (key in exports && exports[key] === _values[key]) return;
92
110
  Object.defineProperty(exports, key, {
93
111
  enumerable: true,
@@ -101,6 +119,7 @@ var _animation = require("./animation");
101
119
 
102
120
  Object.keys(_animation).forEach(function (key) {
103
121
  if (key === "default" || key === "__esModule") return;
122
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
104
123
  if (key in exports && exports[key] === _animation[key]) return;
105
124
  Object.defineProperty(exports, key, {
106
125
  enumerable: true,
@@ -114,6 +133,7 @@ var _types = require("./dom/types");
114
133
 
115
134
  Object.keys(_types).forEach(function (key) {
116
135
  if (key === "default" || key === "__esModule") return;
136
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
117
137
  if (key in exports && exports[key] === _types[key]) return;
118
138
  Object.defineProperty(exports, key, {
119
139
  enumerable: true,
@@ -127,6 +147,7 @@ var _nodes = require("./dom/nodes");
127
147
 
128
148
  Object.keys(_nodes).forEach(function (key) {
129
149
  if (key === "default" || key === "__esModule") return;
150
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
130
151
  if (key in exports && exports[key] === _nodes[key]) return;
131
152
  Object.defineProperty(exports, key, {
132
153
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport * from \"./renderer\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./values\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":";;;;;;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["import \"./skia/NativeSetup\";\nexport { JsiSkImage } from \"./skia/web/JsiSkImage\";\nexport * from \"./renderer\";\nexport * from \"./renderer/Canvas\";\nexport * from \"./renderer/Offscreen\";\nexport * from \"./views\";\nexport * from \"./skia\";\nexport * from \"./external\";\nexport * from \"./values\";\nexport * from \"./animation\";\nexport * from \"./dom/types\";\nexport * from \"./dom/nodes\";\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -15,6 +15,10 @@ exports.BlurStyle = BlurStyle;
15
15
  })(BlurStyle || (exports.BlurStyle = BlurStyle = {}));
16
16
 
17
17
  const isMaskFilter = obj => obj !== null && obj.__typename__ === "MaskFilter";
18
+ /**
19
+ * See SkMaskFilter.h for more details.
20
+ */
21
+
18
22
 
19
23
  exports.isMaskFilter = isMaskFilter;
20
24
  //# sourceMappingURL=MaskFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["BlurStyle","isMaskFilter","obj","__typename__"],"sources":["MaskFilter.ts"],"sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\n\nexport enum BlurStyle {\n Normal, //!< fuzzy inside and outside\n Solid, //!< solid inside, fuzzy outside\n Outer, //!< nothing inside, fuzzy outside\n Inner, //!< fuzzy inside, nothing outside\n}\n\nexport const isMaskFilter = (\n obj: SkJSIInstance<string> | null\n): obj is SkMaskFilter => obj !== null && obj.__typename__ === \"MaskFilter\";\n\nexport type SkMaskFilter = SkJSIInstance<\"MaskFilter\">;\n\n/**\n * See SkMaskFilter.h for more details.\n */\nexport interface MaskFilterFactory {\n /**\n * Create a blur maskfilter\n * @param style\n * @param sigma - Standard deviation of the Gaussian blur to apply. Must be > 0.\n * @param respectCTM - if true the blur's sigma is modified by the CTM.\n */\n MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean): SkMaskFilter;\n}\n"],"mappings":";;;;;;IAEYA,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;AAOL,MAAMC,YAAY,GACvBC,GAD0B,IAEFA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,YAFxD"}
1
+ {"version":3,"names":["BlurStyle","isMaskFilter","obj","__typename__"],"sources":["MaskFilter.ts"],"sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\n\nexport enum BlurStyle {\n Normal, //!< fuzzy inside and outside\n Solid, //!< solid inside, fuzzy outside\n Outer, //!< nothing inside, fuzzy outside\n Inner, //!< fuzzy inside, nothing outside\n}\n\nexport const isMaskFilter = (\n obj: SkJSIInstance<string> | null\n): obj is SkMaskFilter => obj !== null && obj.__typename__ === \"MaskFilter\";\n\nexport type SkMaskFilter = SkJSIInstance<\"MaskFilter\">;\n\n/**\n * See SkMaskFilter.h for more details.\n */\nexport interface MaskFilterFactory {\n /**\n * Create a blur maskfilter\n * @param style\n * @param sigma - Standard deviation of the Gaussian blur to apply. Must be > 0.\n * @param respectCTM - if true the blur's sigma is modified by the CTM.\n */\n MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean): SkMaskFilter;\n}\n"],"mappings":";;;;;;IAEYA,S;;;WAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;EAAAA,S,CAAAA,S;GAAAA,S,yBAAAA,S;;AAOL,MAAMC,YAAY,GACvBC,GAD0B,IAEFA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,YAFxD;AAMP;AACA;AACA"}
@@ -13,7 +13,8 @@ var _JsiSkMatrix = require("./JsiSkMatrix");
13
13
 
14
14
  var _JsiSkRect = require("./JsiSkRect");
15
15
 
16
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // TODO: suggest to rename SkPicture to Picture for consistency
17
+
17
18
 
18
19
  class JsiSkPicture extends _Host.HostObject {
19
20
  constructor(CanvasKit, ref) {
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkPicture","HostObject","constructor","CanvasKit","ref","delete","makeShader","tmx","tmy","mode","localMatrix","tileRect","JsiSkShader","ckEnum","JsiSkMatrix","fromValue","undefined","JsiSkRect","serialize"],"sources":["JsiSkPicture.ts"],"sourcesContent":["// TODO: suggest to rename SkPicture to Picture for consistency\nimport type { CanvasKit, SkPicture as Picture } from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n SkRect,\n TileMode,\n SkPicture,\n SkMatrix,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkShader } from \"./JsiSkShader\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkPicture\n extends HostObject<Picture, \"Picture\">\n implements SkPicture\n{\n constructor(CanvasKit: CanvasKit, ref: Picture) {\n super(CanvasKit, ref, \"Picture\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n makeShader(\n tmx: TileMode,\n tmy: TileMode,\n mode: FilterMode,\n localMatrix?: SkMatrix,\n tileRect?: SkRect\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShader(\n ckEnum(tmx),\n ckEnum(tmy),\n ckEnum(mode),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,\n tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined\n )\n );\n }\n\n serialize() {\n return this.ref.serialize();\n }\n}\n"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AACA;;;;AAEO,MAAMA,YAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;IAC9C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;;IAD8C,iCAItC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN+C;EAE/C;;EAMDC,UAAU,CACRC,GADQ,EAERC,GAFQ,EAGRC,IAHQ,EAIRC,WAJQ,EAKRC,QALQ,EAMR;IACA,OAAO,IAAIC,wBAAJ,CACL,KAAKT,SADA,EAEL,KAAKC,GAAL,CAASE,UAAT,CACE,IAAAO,YAAA,EAAON,GAAP,CADF,EAEE,IAAAM,YAAA,EAAOL,GAAP,CAFF,EAGE,IAAAK,YAAA,EAAOJ,IAAP,CAHF,EAIEC,WAAW,GAAGI,wBAAA,CAAYC,SAAZ,CAAsBL,WAAtB,CAAH,GAAwCM,SAJrD,EAKEL,QAAQ,GAAGM,oBAAA,CAAUF,SAAV,CAAoB,KAAKZ,SAAzB,EAAoCQ,QAApC,CAAH,GAAmDK,SAL7D,CAFK,CAAP;EAUD;;EAEDE,SAAS,GAAG;IACV,OAAO,KAAKd,GAAL,CAASc,SAAT,EAAP;EACD;;AA9BH"}
1
+ {"version":3,"names":["JsiSkPicture","HostObject","constructor","CanvasKit","ref","delete","makeShader","tmx","tmy","mode","localMatrix","tileRect","JsiSkShader","ckEnum","JsiSkMatrix","fromValue","undefined","JsiSkRect","serialize"],"sources":["JsiSkPicture.ts"],"sourcesContent":["// TODO: suggest to rename SkPicture to Picture for consistency\nimport type { CanvasKit, SkPicture as Picture } from \"canvaskit-wasm\";\n\nimport type {\n FilterMode,\n SkRect,\n TileMode,\n SkPicture,\n SkMatrix,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkShader } from \"./JsiSkShader\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkPicture\n extends HostObject<Picture, \"Picture\">\n implements SkPicture\n{\n constructor(CanvasKit: CanvasKit, ref: Picture) {\n super(CanvasKit, ref, \"Picture\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n makeShader(\n tmx: TileMode,\n tmy: TileMode,\n mode: FilterMode,\n localMatrix?: SkMatrix,\n tileRect?: SkRect\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShader(\n ckEnum(tmx),\n ckEnum(tmy),\n ckEnum(mode),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,\n tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined\n )\n );\n }\n\n serialize() {\n return this.ref.serialize();\n }\n}\n"],"mappings":";;;;;;;AAWA;;AACA;;AACA;;AACA;;kNAdA;;;AAgBO,MAAMA,YAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;IAC9C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;;IAD8C,iCAItC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN+C;EAE/C;;EAMDC,UAAU,CACRC,GADQ,EAERC,GAFQ,EAGRC,IAHQ,EAIRC,WAJQ,EAKRC,QALQ,EAMR;IACA,OAAO,IAAIC,wBAAJ,CACL,KAAKT,SADA,EAEL,KAAKC,GAAL,CAASE,UAAT,CACE,IAAAO,YAAA,EAAON,GAAP,CADF,EAEE,IAAAM,YAAA,EAAOL,GAAP,CAFF,EAGE,IAAAK,YAAA,EAAOJ,IAAP,CAHF,EAIEC,WAAW,GAAGI,wBAAA,CAAYC,SAAZ,CAAsBL,WAAtB,CAAH,GAAwCM,SAJrD,EAKEL,QAAQ,GAAGM,oBAAA,CAAUF,SAAV,CAAoB,KAAKZ,SAAzB,EAAoCQ,QAApC,CAAH,GAAmDK,SAL7D,CAFK,CAAP;EAUD;;EAEDE,SAAS,GAAG;IACV,OAAO,KAAKd,GAAL,CAASc,SAAT,EAAP;EACD;;AA9BH"}
@@ -17,7 +17,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
19
 
20
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* global HTMLCanvasElement */
21
21
 
22
22
  const pd = _Platform.Platform.PixelRatio;
23
23