@shopify/react-native-skia 1.3.5 → 1.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +14 -7
  2. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +1 -2
  3. package/lib/commonjs/dom/nodes/Node.d.ts +2 -3
  4. package/lib/commonjs/dom/nodes/Node.js +1 -2
  5. package/lib/commonjs/dom/nodes/Node.js.map +1 -1
  6. package/lib/commonjs/dom/nodes/PaintNode.js +1 -1
  7. package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
  8. package/lib/commonjs/dom/nodes/drawings/Box.js +1 -1
  9. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  10. package/lib/commonjs/dom/nodes/paint/BlendNode.js +1 -1
  11. package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
  12. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -1
  13. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  14. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
  15. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  16. package/lib/commonjs/dom/nodes/paint/MaskFilters.js +1 -1
  17. package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
  18. package/lib/commonjs/dom/nodes/paint/PathEffects.js +1 -1
  19. package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
  20. package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -1
  21. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  22. package/lib/commonjs/dom/types/Node.d.ts +1 -2
  23. package/lib/commonjs/dom/types/Node.js.map +1 -1
  24. package/lib/commonjs/dom/types/NodeType.d.ts +0 -9
  25. package/lib/commonjs/dom/types/NodeType.js +1 -11
  26. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  27. package/lib/commonjs/external/reanimated/useVideo.js +0 -2
  28. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  29. package/lib/commonjs/external/reanimated/useVideoLoading.js +7 -4
  30. package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -1
  31. package/lib/commonjs/skia/core/SVG.web.d.ts +2 -0
  32. package/lib/commonjs/skia/core/SVG.web.js +22 -0
  33. package/lib/commonjs/skia/core/SVG.web.js.map +1 -0
  34. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +1 -1
  35. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  36. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  37. package/lib/commonjs/skia/web/JsiSkCanvas.js +3 -2
  38. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  39. package/lib/commonjs/skia/web/JsiSkSVG.d.ts +9 -0
  40. package/lib/commonjs/skia/web/JsiSkSVG.js +28 -0
  41. package/lib/commonjs/skia/web/JsiSkSVG.js.map +1 -0
  42. package/lib/commonjs/skia/web/JsiSkSVGFactory.d.ts +4 -3
  43. package/lib/commonjs/skia/web/JsiSkSVGFactory.js +40 -4
  44. package/lib/commonjs/skia/web/JsiSkSVGFactory.js.map +1 -1
  45. package/lib/module/dom/nodes/Node.d.ts +2 -3
  46. package/lib/module/dom/nodes/Node.js +1 -2
  47. package/lib/module/dom/nodes/Node.js.map +1 -1
  48. package/lib/module/dom/nodes/PaintNode.js +2 -2
  49. package/lib/module/dom/nodes/PaintNode.js.map +1 -1
  50. package/lib/module/dom/nodes/drawings/Box.js +2 -2
  51. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  52. package/lib/module/dom/nodes/paint/BlendNode.js +2 -2
  53. package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
  54. package/lib/module/dom/nodes/paint/ColorFilters.js +2 -2
  55. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  56. package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
  57. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  58. package/lib/module/dom/nodes/paint/MaskFilters.js +2 -2
  59. package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
  60. package/lib/module/dom/nodes/paint/PathEffects.js +2 -2
  61. package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
  62. package/lib/module/dom/nodes/paint/Shaders.js +2 -2
  63. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  64. package/lib/module/dom/types/Node.d.ts +1 -2
  65. package/lib/module/dom/types/Node.js.map +1 -1
  66. package/lib/module/dom/types/NodeType.d.ts +0 -9
  67. package/lib/module/dom/types/NodeType.js +0 -10
  68. package/lib/module/dom/types/NodeType.js.map +1 -1
  69. package/lib/module/external/reanimated/useVideo.js +0 -2
  70. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  71. package/lib/module/external/reanimated/useVideoLoading.js +8 -5
  72. package/lib/module/external/reanimated/useVideoLoading.js.map +1 -1
  73. package/lib/module/skia/core/SVG.web.d.ts +2 -0
  74. package/lib/module/skia/core/SVG.web.js +15 -0
  75. package/lib/module/skia/core/SVG.web.js.map +1 -0
  76. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +1 -1
  77. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  78. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  79. package/lib/module/skia/web/JsiSkCanvas.js +3 -2
  80. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  81. package/lib/module/skia/web/JsiSkSVG.d.ts +9 -0
  82. package/lib/module/skia/web/JsiSkSVG.js +21 -0
  83. package/lib/module/skia/web/JsiSkSVG.js.map +1 -0
  84. package/lib/module/skia/web/JsiSkSVGFactory.d.ts +4 -3
  85. package/lib/module/skia/web/JsiSkSVGFactory.js +41 -5
  86. package/lib/module/skia/web/JsiSkSVGFactory.js.map +1 -1
  87. package/lib/typescript/src/dom/nodes/Node.d.ts +2 -3
  88. package/lib/typescript/src/dom/types/Node.d.ts +1 -2
  89. package/lib/typescript/src/dom/types/NodeType.d.ts +0 -9
  90. package/lib/typescript/src/skia/core/SVG.web.d.ts +2 -0
  91. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
  92. package/lib/typescript/src/skia/web/JsiSkSVG.d.ts +9 -0
  93. package/lib/typescript/src/skia/web/JsiSkSVGFactory.d.ts +4 -3
  94. package/package.json +2 -2
  95. package/src/dom/nodes/Node.ts +2 -12
  96. package/src/dom/nodes/PaintNode.ts +2 -2
  97. package/src/dom/nodes/drawings/Box.ts +2 -2
  98. package/src/dom/nodes/paint/BlendNode.ts +2 -2
  99. package/src/dom/nodes/paint/ColorFilters.ts +2 -2
  100. package/src/dom/nodes/paint/ImageFilters.ts +2 -2
  101. package/src/dom/nodes/paint/MaskFilters.ts +2 -2
  102. package/src/dom/nodes/paint/PathEffects.ts +2 -2
  103. package/src/dom/nodes/paint/Shaders.ts +2 -2
  104. package/src/dom/types/Node.ts +2 -2
  105. package/src/dom/types/NodeType.ts +0 -10
  106. package/src/external/reanimated/useVideo.ts +0 -2
  107. package/src/external/reanimated/useVideoLoading.ts +11 -7
  108. package/src/skia/core/SVG.web.ts +29 -0
  109. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +1 -1
  110. package/src/skia/web/JsiSkCanvas.ts +6 -2
  111. package/src/skia/web/JsiSkSVG.ts +27 -0
  112. package/src/skia/web/JsiSkSVGFactory.ts +47 -6
@@ -1 +1 @@
1
- {"version":3,"names":["NodeType","DeclarationType"],"sources":["NodeType.ts"],"sourcesContent":["export const enum NodeType {\n // Shaders\n Layer = \"skLayer\",\n Shader = \"skShader\",\n ImageShader = \"skImageShader\",\n ColorShader = \"skColorShader\",\n Turbulence = \"skTurbulence\",\n FractalNoise = \"skFractalNoise\",\n LinearGradient = \"skLinearGradient\",\n RadialGradient = \"skRadialGradient\",\n SweepGradient = \"skSweepGradient\",\n TwoPointConicalGradient = \"skTwoPointConicalGradient\",\n\n // Mask Filters\n BlurMaskFilter = \"skBlurMaskFilter\",\n\n // Path Effects\n DiscretePathEffect = \"skDiscretePathEffect\",\n DashPathEffect = \"skDashPathEffect\",\n Path1DPathEffect = \"skPath1DPathEffect\",\n Path2DPathEffect = \"skPath2DPathEffect\",\n CornerPathEffect = \"skCornerPathEffect\",\n SumPathEffect = \"skSumPathEffect\",\n Line2DPathEffect = \"skLine2DPathEffect\",\n\n // Color Filters\n MatrixColorFilter = \"skMatrixColorFilter\",\n BlendColorFilter = \"skBlendColorFilter\",\n LinearToSRGBGammaColorFilter = \"skLinearToSRGBGammaColorFilter\",\n SRGBToLinearGammaColorFilter = \"skSRGBToLinearGammaColorFilter\",\n LumaColorFilter = \"skLumaColorFilter\",\n LerpColorFilter = \"skLerpColorFilter\",\n\n // Image Filters\n OffsetImageFilter = \"skOffsetImageFilter\",\n DisplacementMapImageFilter = \"skDisplacementMapImageFilter\",\n BlurImageFilter = \"skBlurImageFilter\",\n DropShadowImageFilter = \"skDropShadowImageFilter\",\n MorphologyImageFilter = \"skMorphologyImageFilter\",\n BlendImageFilter = \"skBlendImageFilter\",\n RuntimeShaderImageFilter = \"skRuntimeShaderImageFilter\",\n\n // Mixed\n Blend = \"skBlend\",\n BackdropFilter = \"skBackdropFilter\",\n Box = \"skBox\",\n BoxShadow = \"skBoxShadow\",\n\n // Drawings\n Group = \"skGroup\",\n Paint = \"skPaint\",\n Circle = \"skCircle\",\n Fill = \"skFill\",\n Image = \"skImage\",\n Points = \"skPoints\",\n Path = \"skPath\",\n Rect = \"skRect\",\n RRect = \"skRRect\",\n Oval = \"skOval\",\n Line = \"skLine\",\n Patch = \"skPatch\",\n Vertices = \"skVertices\",\n DiffRect = \"skDiffRect\",\n Text = \"skText\",\n TextPath = \"skTextPath\",\n TextBlob = \"skTextBlob\",\n Glyphs = \"skGlyphs\",\n Picture = \"skPicture\",\n ImageSVG = \"skImageSVG\",\n Atlas = \"skAtlas\",\n\n // Paragraph\n Paragraph = \"skParagraph\",\n}\n\nexport const enum DeclarationType {\n Paint,\n Shader,\n ImageFilter,\n ColorFilter,\n PathEffect,\n MaskFilter,\n Unknown,\n}\n"],"mappings":"AAAA,WAAkBA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AA2E1B,WAAkBC,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA"}
1
+ {"version":3,"names":["NodeType"],"sources":["NodeType.ts"],"sourcesContent":["export const enum NodeType {\n // Shaders\n Layer = \"skLayer\",\n Shader = \"skShader\",\n ImageShader = \"skImageShader\",\n ColorShader = \"skColorShader\",\n Turbulence = \"skTurbulence\",\n FractalNoise = \"skFractalNoise\",\n LinearGradient = \"skLinearGradient\",\n RadialGradient = \"skRadialGradient\",\n SweepGradient = \"skSweepGradient\",\n TwoPointConicalGradient = \"skTwoPointConicalGradient\",\n\n // Mask Filters\n BlurMaskFilter = \"skBlurMaskFilter\",\n\n // Path Effects\n DiscretePathEffect = \"skDiscretePathEffect\",\n DashPathEffect = \"skDashPathEffect\",\n Path1DPathEffect = \"skPath1DPathEffect\",\n Path2DPathEffect = \"skPath2DPathEffect\",\n CornerPathEffect = \"skCornerPathEffect\",\n SumPathEffect = \"skSumPathEffect\",\n Line2DPathEffect = \"skLine2DPathEffect\",\n\n // Color Filters\n MatrixColorFilter = \"skMatrixColorFilter\",\n BlendColorFilter = \"skBlendColorFilter\",\n LinearToSRGBGammaColorFilter = \"skLinearToSRGBGammaColorFilter\",\n SRGBToLinearGammaColorFilter = \"skSRGBToLinearGammaColorFilter\",\n LumaColorFilter = \"skLumaColorFilter\",\n LerpColorFilter = \"skLerpColorFilter\",\n\n // Image Filters\n OffsetImageFilter = \"skOffsetImageFilter\",\n DisplacementMapImageFilter = \"skDisplacementMapImageFilter\",\n BlurImageFilter = \"skBlurImageFilter\",\n DropShadowImageFilter = \"skDropShadowImageFilter\",\n MorphologyImageFilter = \"skMorphologyImageFilter\",\n BlendImageFilter = \"skBlendImageFilter\",\n RuntimeShaderImageFilter = \"skRuntimeShaderImageFilter\",\n\n // Mixed\n Blend = \"skBlend\",\n BackdropFilter = \"skBackdropFilter\",\n Box = \"skBox\",\n BoxShadow = \"skBoxShadow\",\n\n // Drawings\n Group = \"skGroup\",\n Paint = \"skPaint\",\n Circle = \"skCircle\",\n Fill = \"skFill\",\n Image = \"skImage\",\n Points = \"skPoints\",\n Path = \"skPath\",\n Rect = \"skRect\",\n RRect = \"skRRect\",\n Oval = \"skOval\",\n Line = \"skLine\",\n Patch = \"skPatch\",\n Vertices = \"skVertices\",\n DiffRect = \"skDiffRect\",\n Text = \"skText\",\n TextPath = \"skTextPath\",\n TextBlob = \"skTextBlob\",\n Glyphs = \"skGlyphs\",\n Picture = \"skPicture\",\n ImageSVG = \"skImageSVG\",\n Atlas = \"skAtlas\",\n\n // Paragraph\n Paragraph = \"skParagraph\",\n}\n"],"mappings":"AAAA,WAAkBA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA"}
@@ -23,7 +23,6 @@ const setFrame = (video, currentFrame) => {
23
23
  currentFrame.value.dispose();
24
24
  }
25
25
  currentFrame.value = img;
26
- } else {
27
26
  copyFrameOnAndroid(currentFrame);
28
27
  }
29
28
  };
@@ -87,7 +86,6 @@ export const useVideo = (source, userOptions) => {
87
86
  });
88
87
  Rea.useAnimatedReaction(() => seek.value, value => {
89
88
  if (value !== null) {
90
- copyFrameOnAndroid(currentFrame);
91
89
  video === null || video === void 0 || video.seek(value);
92
90
  currentTime.value = value;
93
91
  seek.value = null;
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useMemo","Platform","Rea","useVideoLoading","copyFrameOnAndroid","currentFrame","OS","tex","value","makeNonTextureImage","dispose","setFrame","video","img","nextImage","defaultOptions","looping","paused","seek","currentTime","volume","useOption","defaultValue","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","isPaused","lastTimestamp","duration","_video$duration","framerate","_video$framerate","size","_video$size","width","height","rotation","_video$rotation","frameDuration","currentFrameDuration","Math","floor","useAnimatedReaction","pause","play","setVolume","useFrameCallback","frameInfo","currentTimestamp","timestamp","delta","isOver","runOnUI"],"sources":["useVideo.ts"],"sourcesContent":["import type { SharedValue, FrameInfo } from \"react-native-reanimated\";\nimport { useEffect, useMemo } from \"react\";\n\nimport type { SkImage, Video } from \"../../skia/types\";\nimport { Platform } from \"../../Platform\";\n\nimport Rea from \"./ReanimatedProxy\";\nimport { useVideoLoading } from \"./useVideoLoading\";\n\ntype Animated<T> = SharedValue<T> | T;\n\ninterface PlaybackOptions {\n looping: Animated<boolean>;\n paused: Animated<boolean>;\n seek: Animated<number | null>;\n volume: Animated<number>;\n}\n\nconst copyFrameOnAndroid = (currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n // on android we need to copy the texture before it's invalidated\n if (Platform.OS === \"android\") {\n const tex = currentFrame.value;\n if (tex) {\n currentFrame.value = tex.makeNonTextureImage();\n tex.dispose();\n }\n }\n};\n\nconst setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n const img = video.nextImage();\n if (img) {\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = img;\n } else {\n copyFrameOnAndroid(currentFrame);\n }\n};\n\nconst defaultOptions = {\n looping: true,\n paused: false,\n seek: null,\n currentTime: 0,\n volume: 0,\n};\n\nconst useOption = <T>(value: Animated<T>) => {\n \"worklet\";\n // TODO: only create defaultValue is needed (via makeMutable)\n const defaultValue = Rea.useSharedValue(\n Rea.isSharedValue(value) ? value.value : value\n );\n return Rea.isSharedValue(value) ? value : defaultValue;\n};\n\nconst disposeVideo = (video: Video | null) => {\n \"worklet\";\n video?.dispose();\n};\n\nexport const useVideo = (\n source: string | null,\n userOptions?: Partial<PlaybackOptions>\n) => {\n const video = useVideoLoading(source);\n const isPaused = useOption(userOptions?.paused ?? defaultOptions.paused);\n const looping = useOption(userOptions?.looping ?? defaultOptions.looping);\n const seek = useOption(userOptions?.seek ?? defaultOptions.seek);\n const volume = useOption(userOptions?.volume ?? defaultOptions.volume);\n const currentFrame = Rea.useSharedValue<null | SkImage>(null);\n const currentTime = Rea.useSharedValue(0);\n const lastTimestamp = Rea.useSharedValue(-1);\n const duration = useMemo(() => video?.duration() ?? 0, [video]);\n const framerate = useMemo(\n () => (Platform.OS === \"web\" ? -1 : video?.framerate() ?? 0),\n [video]\n );\n const size = useMemo(() => video?.size() ?? { width: 0, height: 0 }, [video]);\n const rotation = useMemo(() => video?.rotation() ?? 0, [video]);\n const frameDuration = 1000 / framerate;\n const currentFrameDuration = Math.floor(frameDuration);\n Rea.useAnimatedReaction(\n () => isPaused.value,\n (paused) => {\n if (paused) {\n video?.pause();\n } else {\n lastTimestamp.value = -1;\n video?.play();\n }\n }\n );\n Rea.useAnimatedReaction(\n () => seek.value,\n (value) => {\n if (value !== null) {\n copyFrameOnAndroid(currentFrame);\n video?.seek(value);\n currentTime.value = value;\n seek.value = null;\n }\n }\n );\n Rea.useAnimatedReaction(\n () => volume.value,\n (value) => {\n video?.setVolume(value);\n }\n );\n Rea.useFrameCallback((frameInfo: FrameInfo) => {\n \"worklet\";\n if (!video) {\n return;\n }\n if (isPaused.value) {\n return;\n }\n const currentTimestamp = frameInfo.timestamp;\n if (lastTimestamp.value === -1) {\n lastTimestamp.value = currentTimestamp;\n }\n const delta = currentTimestamp - lastTimestamp.value;\n\n const isOver = currentTime.value + delta > duration;\n if (isOver && looping.value) {\n seek.value = 0;\n currentTime.value = seek.value;\n lastTimestamp.value = currentTimestamp;\n }\n // On Web the framerate is uknown.\n // This could be optimized by using requestVideoFrameCallback (Chrome only)\n if ((delta >= currentFrameDuration && !isOver) || Platform.OS === \"web\") {\n setFrame(video, currentFrame);\n currentTime.value += delta;\n lastTimestamp.value = currentTimestamp;\n }\n });\n\n useEffect(() => {\n return () => {\n // TODO: should video simply be a shared value instead?\n Rea.runOnUI(disposeVideo)(video);\n };\n }, [video]);\n\n return {\n currentFrame,\n currentTime,\n duration,\n framerate,\n rotation,\n size,\n };\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAG1C,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,OAAOC,GAAG,MAAM,mBAAmB;AACnC,SAASC,eAAe,QAAQ,mBAAmB;AAWnD,MAAMC,kBAAkB,GAAIC,YAAyC,IAAK;EACxE,SAAS;;EACT;EACA,IAAIJ,QAAQ,CAACK,EAAE,KAAK,SAAS,EAAE;IAC7B,MAAMC,GAAG,GAAGF,YAAY,CAACG,KAAK;IAC9B,IAAID,GAAG,EAAE;MACPF,YAAY,CAACG,KAAK,GAAGD,GAAG,CAACE,mBAAmB,CAAC,CAAC;MAC9CF,GAAG,CAACG,OAAO,CAAC,CAAC;IACf;EACF;AACF,CAAC;AAED,MAAMC,QAAQ,GAAGA,CAACC,KAAY,EAAEP,YAAyC,KAAK;EAC5E,SAAS;;EACT,MAAMQ,GAAG,GAAGD,KAAK,CAACE,SAAS,CAAC,CAAC;EAC7B,IAAID,GAAG,EAAE;IACP,IAAIR,YAAY,CAACG,KAAK,EAAE;MACtBH,YAAY,CAACG,KAAK,CAACE,OAAO,CAAC,CAAC;IAC9B;IACAL,YAAY,CAACG,KAAK,GAAG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AAE;MACV;IACF;IACA,IAAIqB,QAAQ,CAACzB,KAAK,EAAE;MAClB;IACF;IACA,MAAM+C,gBAAgB,GAAGD,SAAS,CAACE,SAAS;IAC5C,IAAItB,aAAa,CAAC1B,KAAK,KAAK,CAAC,CAAC,EAAE;MAC9B0B,aAAa,CAAC1B,KAAK,GAAG+C,gBAAgB;IACxC;IACA,MAAME,KAAK,GAAGF,gBAAgB,GAAGrB,aAAa,CAAC1B,KAAK;IAEpD,MAAMkD,MAAM,GAAGvC,WAAW,CAACX,KAAK,GAAGiD,KAAK,GAAGtB,QAAQ;IACnD,IAAIuB,MAAM,IAAI1C,OAAO,CAACR,KAAK,EAAE;MAC3BU,IAAI,CAACV,KAAK,GAAG,CAAC;MACdW,WAAW,CAACX,KAAK,GAAGU,IAAI,CAACV,KAAK;MAC9B0B,aAAa,CAAC1B,KAAK,GAAG+C,gBAAgB;IACxC;IACA;IACA;IACA,IAAKE,KAAK,IAAIX,oBAAoB,IAAI,CAACY,MAAM,IAAKzD,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;MACvEK,QAAQ,CAACC,KAAK,EAAEP,YAAY,CAAC;MAC7Bc,WAAW,CAACX,KAAK,IAAIiD,KAAK;MAC1BvB,aAAa,CAAC1B,KAAK,GAAG+C,gBAAgB;IACxC;EACF,CAAC,CAAC;EAEFxD,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACAG,GAAG,CAACyD,OAAO,CAAClC,YAAY,CAAC,CAACb,KAAK,CAAC;IAClC,CAAC;EACH,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAO;IACLP,YAAY;IACZc,WAAW;IACXgB,QAAQ;IACRE,SAAS;IACTM,QAAQ;IACRJ;EACF,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["useEffect","useMemo","Platform","Rea","useVideoLoading","copyFrameOnAndroid","currentFrame","OS","tex","value","makeNonTextureImage","dispose","setFrame","video","img","nextImage","defaultOptions","looping","paused","seek","currentTime","volume","useOption","defaultValue","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","isPaused","lastTimestamp","duration","_video$duration","framerate","_video$framerate","size","_video$size","width","height","rotation","_video$rotation","frameDuration","currentFrameDuration","Math","floor","useAnimatedReaction","pause","play","setVolume","useFrameCallback","frameInfo","currentTimestamp","timestamp","delta","isOver","runOnUI"],"sources":["useVideo.ts"],"sourcesContent":["import type { SharedValue, FrameInfo } from \"react-native-reanimated\";\nimport { useEffect, useMemo } from \"react\";\n\nimport type { SkImage, Video } from \"../../skia/types\";\nimport { Platform } from \"../../Platform\";\n\nimport Rea from \"./ReanimatedProxy\";\nimport { useVideoLoading } from \"./useVideoLoading\";\n\ntype Animated<T> = SharedValue<T> | T;\n\ninterface PlaybackOptions {\n looping: Animated<boolean>;\n paused: Animated<boolean>;\n seek: Animated<number | null>;\n volume: Animated<number>;\n}\n\nconst copyFrameOnAndroid = (currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n // on android we need to copy the texture before it's invalidated\n if (Platform.OS === \"android\") {\n const tex = currentFrame.value;\n if (tex) {\n currentFrame.value = tex.makeNonTextureImage();\n tex.dispose();\n }\n }\n};\n\nconst setFrame = (video: Video, currentFrame: SharedValue<SkImage | null>) => {\n \"worklet\";\n const img = video.nextImage();\n if (img) {\n if (currentFrame.value) {\n currentFrame.value.dispose();\n }\n currentFrame.value = img;\n copyFrameOnAndroid(currentFrame);\n }\n};\n\nconst defaultOptions = {\n looping: true,\n paused: false,\n seek: null,\n currentTime: 0,\n volume: 0,\n};\n\nconst useOption = <T>(value: Animated<T>) => {\n \"worklet\";\n // TODO: only create defaultValue is needed (via makeMutable)\n const defaultValue = Rea.useSharedValue(\n Rea.isSharedValue(value) ? value.value : value\n );\n return Rea.isSharedValue(value) ? value : defaultValue;\n};\n\nconst disposeVideo = (video: Video | null) => {\n \"worklet\";\n video?.dispose();\n};\n\nexport const useVideo = (\n source: string | null,\n userOptions?: Partial<PlaybackOptions>\n) => {\n const video = useVideoLoading(source);\n const isPaused = useOption(userOptions?.paused ?? defaultOptions.paused);\n const looping = useOption(userOptions?.looping ?? defaultOptions.looping);\n const seek = useOption(userOptions?.seek ?? defaultOptions.seek);\n const volume = useOption(userOptions?.volume ?? defaultOptions.volume);\n const currentFrame = Rea.useSharedValue<null | SkImage>(null);\n const currentTime = Rea.useSharedValue(0);\n const lastTimestamp = Rea.useSharedValue(-1);\n const duration = useMemo(() => video?.duration() ?? 0, [video]);\n const framerate = useMemo(\n () => (Platform.OS === \"web\" ? -1 : video?.framerate() ?? 0),\n [video]\n );\n const size = useMemo(() => video?.size() ?? { width: 0, height: 0 }, [video]);\n const rotation = useMemo(() => video?.rotation() ?? 0, [video]);\n const frameDuration = 1000 / framerate;\n const currentFrameDuration = Math.floor(frameDuration);\n Rea.useAnimatedReaction(\n () => isPaused.value,\n (paused) => {\n if (paused) {\n video?.pause();\n } else {\n lastTimestamp.value = -1;\n video?.play();\n }\n }\n );\n Rea.useAnimatedReaction(\n () => seek.value,\n (value) => {\n if (value !== null) {\n video?.seek(value);\n currentTime.value = value;\n seek.value = null;\n }\n }\n );\n Rea.useAnimatedReaction(\n () => volume.value,\n (value) => {\n video?.setVolume(value);\n }\n );\n Rea.useFrameCallback((frameInfo: FrameInfo) => {\n \"worklet\";\n if (!video) {\n return;\n }\n if (isPaused.value) {\n return;\n }\n const currentTimestamp = frameInfo.timestamp;\n if (lastTimestamp.value === -1) {\n lastTimestamp.value = currentTimestamp;\n }\n const delta = currentTimestamp - lastTimestamp.value;\n\n const isOver = currentTime.value + delta > duration;\n if (isOver && looping.value) {\n seek.value = 0;\n currentTime.value = seek.value;\n lastTimestamp.value = currentTimestamp;\n }\n // On Web the framerate is uknown.\n // This could be optimized by using requestVideoFrameCallback (Chrome only)\n if ((delta >= currentFrameDuration && !isOver) || Platform.OS === \"web\") {\n setFrame(video, currentFrame);\n currentTime.value += delta;\n lastTimestamp.value = currentTimestamp;\n }\n });\n\n useEffect(() => {\n return () => {\n // TODO: should video simply be a shared value instead?\n Rea.runOnUI(disposeVideo)(video);\n };\n }, [video]);\n\n return {\n currentFrame,\n currentTime,\n duration,\n framerate,\n rotation,\n size,\n };\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAG1C,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,OAAOC,GAAG,MAAM,mBAAmB;AACnC,SAASC,eAAe,QAAQ,mBAAmB;AAWnD,MAAMC,kBAAkB,GAAIC,YAAyC,IAAK;EACxE,SAAS;;EACT;EACA,IAAIJ,QAAQ,CAACK,EAAE,KAAK,SAAS,EAAE;IAC7B,MAAMC,GAAG,GAAGF,YAAY,CAACG,KAAK;IAC9B,IAAID,GAAG,EAAE;MACPF,YAAY,CAACG,KAAK,GAAGD,GAAG,CAACE,mBAAmB,CAAC,CAAC;MAC9CF,GAAG,CAACG,OAAO,CAAC,CAAC;IACf;EACF;AACF,CAAC;AAED,MAAMC,QAAQ,GAAGA,CAACC,KAAY,EAAEP,YAAyC,KAAK;EAC5E,SAAS;;EACT,MAAMQ,GAAG,GAAGD,KAAK,CAACE,SAAS,CAAC,CAAC;EAC7B,IAAID,GAAG,EAAE;IACP,IAAIR,YAAY,CAACG,KAAK,EAAE;MACtBH,YAAY,CAACG,KAAK,CAACE,OAAO,CAAC,CAAC;IAC9B;IACAL,YAAY,CAACG,KAAK,GAAGK,GAAG;IACxBT,kBAAkB,CAACC,YAAY,CAAC;EAClC;AACF,CAAC;AAED,MAAMU,cAAc,GAAG;EACrBC,OAAO,EAAE,IAAI;EACbC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE,IAAI;EACVC,WAAW,EAAE,CAAC;EACdC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,SAAS,GAAOb,KAAkB,IAAK;EAC3C,SAAS;;EACT;EACA,MAAMc,YAAY,GAAGpB,GAAG,CAACqB,cAAc,CACrCrB,GAAG,CAACsB,aAAa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OAAO,CAACR,KAAK,EAAE;MAC3BU,IAAI,CAACV,KAAK,GAAG,CAAC;MACdW,WAAW,CAACX,KAAK,GAAGU,IAAI,CAACV,KAAK;MAC9B0B,aAAa,CAAC1B,KAAK,GAAG+C,gBAAgB;IACxC;IACA;IACA;IACA,IAAKE,KAAK,IAAIX,oBAAoB,IAAI,CAACY,MAAM,IAAKzD,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;MACvEK,QAAQ,CAACC,KAAK,EAAEP,YAAY,CAAC;MAC7Bc,WAAW,CAACX,KAAK,IAAIiD,KAAK;MAC1BvB,aAAa,CAAC1B,KAAK,GAAG+C,gBAAgB;IACxC;EACF,CAAC,CAAC;EAEFxD,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACAG,GAAG,CAACyD,OAAO,CAAClC,YAAY,CAAC,CAACb,KAAK,CAAC;IAClC,CAAC;EACH,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAO;IACLP,YAAY;IACZc,WAAW;IACXgB,QAAQ;IACRE,SAAS;IACTM,QAAQ;IACRJ;EACF,CAAC;AACH,CAAC"}
@@ -1,20 +1,23 @@
1
- import { useEffect, useState } from "react";
1
+ import { useCallback, useEffect, useState } from "react";
2
2
  import { Skia } from "../../skia";
3
3
  import Rea from "./ReanimatedProxy";
4
4
  const runtime = Rea.createWorkletRuntime("video-metadata-runtime");
5
5
  export const useVideoLoading = source => {
6
+ const {
7
+ runOnJS
8
+ } = Rea;
6
9
  const [video, setVideo] = useState(null);
7
- const cb = src => {
10
+ const cb = useCallback(src => {
8
11
  "worklet";
9
12
 
10
13
  const vid = Skia.Video(src);
11
- Rea.runOnJS(setVideo)(vid);
12
- };
14
+ runOnJS(setVideo)(vid);
15
+ }, [runOnJS]);
13
16
  useEffect(() => {
14
17
  if (source) {
15
18
  Rea.runOnRuntime(runtime, cb)(source);
16
19
  }
17
- }, [source]);
20
+ }, [cb, source]);
18
21
  return video;
19
22
  };
20
23
  //# sourceMappingURL=useVideoLoading.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","Skia","Rea","runtime","createWorkletRuntime","useVideoLoading","source","video","setVideo","cb","src","vid","Video","runOnJS","runOnRuntime"],"sources":["useVideoLoading.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst runtime = Rea.createWorkletRuntime(\"video-metadata-runtime\");\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const [video, setVideo] = useState<Video | null>(null);\n const cb = (src: string) => {\n \"worklet\";\n const vid = Skia.Video(src) as Video;\n Rea.runOnJS(setVideo)(vid);\n };\n useEffect(() => {\n if (source) {\n Rea.runOnRuntime(runtime, cb)(source);\n }\n }, [source]);\n return video;\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAG3C,SAASC,IAAI,QAAQ,YAAY;AAEjC,OAAOC,GAAG,MAAM,mBAAmB;AAEnC,MAAMC,OAAO,GAAGD,GAAG,CAACE,oBAAoB,CAAC,wBAAwB,CAAC;AAIlE,OAAO,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGR,QAAQ,CAAe,IAAI,CAAC;EACtD,MAAMS,EAAE,GAAIC,GAAW,IAAK;IAC1B,SAAS;;IACT,MAAMC,GAAG,GAAGV,IAAI,CAACW,KAAK,CAACF,GAAG,CAAU;IACpCR,GAAG,CAACW,OAAO,CAACL,QAAQ,CAAC,CAACG,GAAG,CAAC;EAC5B,CAAC;EACDZ,SAAS,CAAC,MAAM;IACd,IAAIO,MAAM,EAAE;MACVJ,GAAG,CAACY,YAAY,CAACX,OAAO,EAAEM,EAAE,CAAC,CAACH,MAAM,CAAC;IACvC;EACF,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAOC,KAAK;AACd,CAAC"}
1
+ {"version":3,"names":["useCallback","useEffect","useState","Skia","Rea","runtime","createWorkletRuntime","useVideoLoading","source","runOnJS","video","setVideo","cb","src","vid","Video","runOnRuntime"],"sources":["useVideoLoading.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from \"react\";\n\nimport type { Video } from \"../../skia/types\";\nimport { Skia } from \"../../skia\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nconst runtime = Rea.createWorkletRuntime(\"video-metadata-runtime\");\n\ntype VideoSource = string | null;\n\nexport const useVideoLoading = (source: VideoSource) => {\n const { runOnJS } = Rea;\n const [video, setVideo] = useState<Video | null>(null);\n const cb = useCallback(\n (src: string) => {\n \"worklet\";\n const vid = Skia.Video(src) as Video;\n runOnJS(setVideo)(vid);\n },\n [runOnJS]\n );\n useEffect(() => {\n if (source) {\n Rea.runOnRuntime(runtime, cb)(source);\n }\n }, [cb, source]);\n return video;\n};\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAGxD,SAASC,IAAI,QAAQ,YAAY;AAEjC,OAAOC,GAAG,MAAM,mBAAmB;AAEnC,MAAMC,OAAO,GAAGD,GAAG,CAACE,oBAAoB,CAAC,wBAAwB,CAAC;AAIlE,OAAO,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM;IAAEC;EAAQ,CAAC,GAAGL,GAAG;EACvB,MAAM,CAACM,KAAK,EAAEC,QAAQ,CAAC,GAAGT,QAAQ,CAAe,IAAI,CAAC;EACtD,MAAMU,EAAE,GAAGZ,WAAW,CACnBa,GAAW,IAAK;IACf,SAAS;;IACT,MAAMC,GAAG,GAAGX,IAAI,CAACY,KAAK,CAACF,GAAG,CAAU;IACpCJ,OAAO,CAACE,QAAQ,CAAC,CAACG,GAAG,CAAC;EACxB,CAAC,EACD,CAACL,OAAO,CACV,CAAC;EACDR,SAAS,CAAC,MAAM;IACd,IAAIO,MAAM,EAAE;MACVJ,GAAG,CAACY,YAAY,CAACX,OAAO,EAAEO,EAAE,CAAC,CAACJ,MAAM,CAAC;IACvC;EACF,CAAC,EAAE,CAACI,EAAE,EAAEJ,MAAM,CAAC,CAAC;EAChB,OAAOE,KAAK;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { DataSourceParam } from "../types";
2
+ export declare const useSVG: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => import("../types").SkSVG | null;
@@ -0,0 +1,15 @@
1
+ import { Skia } from "../Skia";
2
+ export const useSVG = (source, onError) => {
3
+ if (source === null || source === undefined) {
4
+ throw new Error(`Invalid svg data source. Got: ${source}`);
5
+ }
6
+ if (typeof source !== "object" || source instanceof Uint8Array || typeof source.default !== "string") {
7
+ throw new Error(`Invalid svg data source. Make sure that the source resolves to a string. Got: ${JSON.stringify(source, null, 2)}`);
8
+ }
9
+ const svg = Skia.SVG.MakeFromString(source.default);
10
+ if (svg === null && onError !== undefined) {
11
+ onError(new Error("Failed to create SVG from source."));
12
+ }
13
+ return svg;
14
+ };
15
+ //# sourceMappingURL=SVG.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Skia","useSVG","source","onError","undefined","Error","Uint8Array","default","JSON","stringify","svg","SVG","MakeFromString"],"sources":["SVG.web.ts"],"sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nexport const useSVG = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => {\n if (source === null || source === undefined) {\n throw new Error(`Invalid svg data source. Got: ${source}`);\n }\n if (\n typeof source !== \"object\" ||\n source instanceof Uint8Array ||\n typeof source.default !== \"string\"\n ) {\n throw new Error(\n `Invalid svg data source. Make sure that the source resolves to a string. Got: ${JSON.stringify(\n source,\n null,\n 2\n )}`\n );\n }\n const svg = Skia.SVG.MakeFromString(source.default);\n if (svg === null && onError !== undefined) {\n onError(new Error(\"Failed to create SVG from source.\"));\n }\n return svg;\n};\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,SAAS;AAG9B,OAAO,MAAMC,MAAM,GAAGA,CACpBC,MAAuB,EACvBC,OAA8B,KAC3B;EACH,IAAID,MAAM,KAAK,IAAI,IAAIA,MAAM,KAAKE,SAAS,EAAE;IAC3C,MAAM,IAAIC,KAAK,CAAE,iCAAgCH,MAAO,EAAC,CAAC;EAC5D;EACA,IACE,OAAOA,MAAM,KAAK,QAAQ,IAC1BA,MAAM,YAAYI,UAAU,IAC5B,OAAOJ,MAAM,CAACK,OAAO,KAAK,QAAQ,EAClC;IACA,MAAM,IAAIF,KAAK,CACZ,iFAAgFG,IAAI,CAACC,SAAS,CAC7FP,MAAM,EACN,IAAI,EACJ,CACF,CAAE,EACJ,CAAC;EACH;EACA,MAAMQ,GAAG,GAAGV,IAAI,CAACW,GAAG,CAACC,cAAc,CAACV,MAAM,CAACK,OAAO,CAAC;EACnD,IAAIG,GAAG,KAAK,IAAI,IAAIP,OAAO,KAAKC,SAAS,EAAE;IACzCD,OAAO,CAAC,IAAIE,KAAK,CAAC,mCAAmC,CAAC,CAAC;EACzD;EACA,OAAOK,GAAG;AACZ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export class CanvasKitWebGLBuffer {}
2
2
  export const isNativeBufferAddr = buffer => buffer instanceof BigInt;
3
- export const isNativeBufferWeb = buffer => buffer instanceof HTMLVideoElement || buffer instanceof HTMLCanvasElement || buffer instanceof ImageBitmap || buffer instanceof OffscreenCanvas || buffer instanceof VideoFrame || buffer instanceof HTMLImageElement || buffer instanceof SVGImageElement || buffer instanceof CanvasKitWebGLBuffer;
3
+ export const isNativeBufferWeb = buffer => buffer instanceof HTMLVideoElement || buffer instanceof HTMLCanvasElement || buffer instanceof ImageBitmap || buffer instanceof OffscreenCanvas || typeof VideoFrame !== "undefined" && buffer instanceof VideoFrame || buffer instanceof HTMLImageElement || buffer instanceof SVGImageElement || buffer instanceof CanvasKitWebGLBuffer;
4
4
  export const isNativeBufferNode = buffer => buffer instanceof ArrayBuffer;
5
5
  //# sourceMappingURL=NativeBufferFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferAddr","buffer","BigInt","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport abstract class CanvasKitWebGLBuffer {}\n\nexport type NativeBuffer<\n T extends\n | bigint\n | ArrayBuffer\n | CanvasImageSource\n | CanvasKitWebGLBuffer\n | 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 buffer instanceof CanvasKitWebGLBuffer;\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":"AAEA,OAAO,MAAeA,oBAAoB,CAAC;AAe3C,OAAO,MAAMC,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AACzD,OAAO,MAAMC,iBAAiB,GAC5BF,MAAoB,IAEpBA,MAAM,YAAYG,gBAAgB,IAClCH,MAAM,YAAYI,iBAAiB,IACnCJ,MAAM,YAAYK,WAAW,IAC7BL,MAAM,YAAYM,eAAe,IACjCN,MAAM,YAAYO,UAAU,IAC5BP,MAAM,YAAYQ,gBAAgB,IAClCR,MAAM,YAAYS,eAAe,IACjCT,MAAM,YAAYF,oBAAoB;AAExC,OAAO,MAAMY,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW"}
1
+ {"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferAddr","buffer","BigInt","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport abstract class CanvasKitWebGLBuffer {}\n\nexport type NativeBuffer<\n T extends\n | bigint\n | ArrayBuffer\n | CanvasImageSource\n | CanvasKitWebGLBuffer\n | 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 (typeof VideoFrame !== \"undefined\" && buffer instanceof VideoFrame) ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement ||\n buffer instanceof CanvasKitWebGLBuffer;\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":"AAEA,OAAO,MAAeA,oBAAoB,CAAC;AAe3C,OAAO,MAAMC,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AACzD,OAAO,MAAMC,iBAAiB,GAC5BF,MAAoB,IAEpBA,MAAM,YAAYG,gBAAgB,IAClCH,MAAM,YAAYI,iBAAiB,IACnCJ,MAAM,YAAYK,WAAW,IAC7BL,MAAM,YAAYM,eAAe,IAChC,OAAOC,UAAU,KAAK,WAAW,IAAIP,MAAM,YAAYO,UAAW,IACnEP,MAAM,YAAYQ,gBAAgB,IAClCR,MAAM,YAAYS,eAAe,IACjCT,MAAM,YAAYF,oBAAoB;AAExC,OAAO,MAAMY,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW"}
@@ -27,7 +27,7 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
27
27
  drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont): void;
28
28
  drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint): void;
29
29
  drawGlyphs(glyphs: number[], positions: SkPoint[], x: number, y: number, font: SkFont, paint: SkPaint): void;
30
- drawSvg(_svgDom: SkSVG, _width?: number, _height?: number): void;
30
+ drawSvg(svg: SkSVG, _width?: number, _height?: number): void;
31
31
  save(): number;
32
32
  saveLayer(paint?: SkPaint, bounds?: SkRect | null, backdrop?: SkImageFilter | null, flags?: SaveLayerFlag): number;
33
33
  restore(): void;
@@ -97,8 +97,9 @@ export class JsiSkCanvas extends HostObject {
97
97
  drawGlyphs(glyphs, positions, x, y, font, paint) {
98
98
  this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y, JsiSkFont.fromValue(font), JsiSkPaint.fromValue(paint));
99
99
  }
100
- drawSvg(_svgDom, _width, _height) {
101
- throw new Error("drawSvg is not implemented on React Native Web");
100
+ drawSvg(svg, _width, _height) {
101
+ const image = this.CanvasKit.MakeImageFromCanvasImageSource(svg.ref);
102
+ this.ref.drawImage(image, 0, 0);
102
103
  }
103
104
  save() {
104
105
  return this.ref.save();
@@ -1 +1 @@
1
- {"version":3,"names":["getEnum","HostObject","JsiSkPaint","JsiSkRect","JsiSkRRect","JsiSkImage","JsiSkVertices","JsiSkPath","JsiSkFont","JsiSkTextBlob","JsiSkPicture","JsiSkMatrix","JsiSkImageFilter","JsiSkPoint","JsiSkRSXform","JsiSkCanvas","constructor","CanvasKit","ref","_defineProperty","delete","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","PathOp","clipRect","clipRRect","concat","m","isArray","drawPicture","skp","drawAtlas","atlas","srcs","dsts","_sampling","s","dst","cls","Uint32Array","length","i","r","g","b","a","ColorAsInt","DstOver","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport {\n type BlendMode,\n type ClipOp,\n type FilterMode,\n type MipmapMode,\n type PointMode,\n type SaveLayerFlag,\n type ImageInfo,\n type SkCanvas,\n type SkColor,\n type SkFont,\n type SkImage,\n type SkImageFilter,\n type SkMatrix,\n type SkPaint,\n type SkPath,\n type SkPicture,\n type SkPoint,\n type SkRect,\n type InputRRect,\n type SkSVG,\n type SkTextBlob,\n type SkVertices,\n type SkRSXform,\n type CubicResampler,\n type FilterOptions,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit.PointMode, mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: InputRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n drawAtlas(\n atlas: SkImage,\n srcs: SkRect[],\n dsts: SkRSXform[],\n paint: SkPaint,\n blendMode?: BlendMode,\n colors?: SkColor[],\n _sampling?: CubicResampler | FilterOptions\n ) {\n const src = srcs.flatMap((s) =>\n Array.from(JsiSkRect.fromValue(this.CanvasKit, s))\n );\n const dst = dsts.flatMap((s) => Array.from(JsiSkRSXform.fromValue(s)));\n let cls: Uint32Array | undefined;\n if (colors) {\n cls = new Uint32Array(colors.length);\n for (let i = 0; i < colors.length; i++) {\n const [r, g, b, a] = colors[i];\n cls[i] = this.CanvasKit.ColorAsInt(r * 255, g * 255, b * 255, a * 255);\n }\n }\n this.ref.drawAtlas(\n JsiSkImage.fromValue(atlas),\n src,\n dst,\n JsiSkPaint.fromValue(paint),\n blendMode\n ? getEnum(this.CanvasKit.BlendMode, blendMode)\n : this.CanvasKit.BlendMode.DstOver,\n cls\n );\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;AA8BA,SAASA,OAAO,EAAEC,UAAU,QAAQ,QAAQ;AAC5C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAE7C,OAAO,MAAMC,WAAW,SACdd,UAAU,CAEpB;EACEe,WAAWA,CAACC,SAAoB,EAAEC,GAAW,EAAE;IAC7C,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,QAAQ,CAAC;IAACC,eAAA,kBAGxB,MAAM;MACd,IAAI,CAACD,GAAG,CAACE,MAAM,CAAC,CAAC;IACnB,CAAC;EAJD;EAMAC,QAAQA,CAACC,IAAY,EAAEC,KAAc,EAAE;IACrC,IAAI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,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KAAK;MACtBC,MAAM,EAAEH,SAAS,CAACG,MAAM;MACxBC,UAAU,EAAE,IAAI,CAAChJ,SAAS,CAACiJ,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAEpK,OAAO,CAAC,IAAI,CAACiB,SAAS,CAACoJ,SAAS,EAAER,SAAS,CAACO,SAAS,CAAC;MACjEE,SAAS,EAAEtK,OAAO,CAAC,IAAI,CAACiB,SAAS,CAACsJ,SAAS,EAAEV,SAAS,CAACS,SAAS;IAClE,CAAC;IACD,OAAO,IAAI,CAACpJ,GAAG,CAACwI,UAAU,CAACC,IAAI,EAAEC,IAAI,EAAEE,MAAM,CAAC;EAChD;AACF"}
1
+ {"version":3,"names":["getEnum","HostObject","JsiSkPaint","JsiSkRect","JsiSkRRect","JsiSkImage","JsiSkVertices","JsiSkPath","JsiSkFont","JsiSkTextBlob","JsiSkPicture","JsiSkMatrix","JsiSkImageFilter","JsiSkPoint","JsiSkRSXform","JsiSkCanvas","constructor","CanvasKit","ref","_defineProperty","delete","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","drawSvg","svg","_width","_height","MakeImageFromCanvasImageSource","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","PathOp","clipRect","clipRRect","concat","m","isArray","drawPicture","skp","drawAtlas","atlas","srcs","dsts","_sampling","s","dst","cls","Uint32Array","length","i","r","g","b","a","ColorAsInt","DstOver","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType"],"sources":["JsiSkCanvas.ts"],"sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport {\n type BlendMode,\n type ClipOp,\n type FilterMode,\n type MipmapMode,\n type PointMode,\n type SaveLayerFlag,\n type ImageInfo,\n type SkCanvas,\n type SkColor,\n type SkFont,\n type SkImage,\n type SkImageFilter,\n type SkMatrix,\n type SkPaint,\n type SkPath,\n type SkPicture,\n type SkPoint,\n type SkRect,\n type InputRRect,\n type SkSVG,\n type SkTextBlob,\n type SkVertices,\n type SkRSXform,\n type CubicResampler,\n type FilterOptions,\n} from \"../types\";\n\nimport { getEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport type { JsiSkSVG } from \"./JsiSkSVG\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n getEnum(this.CanvasKit.FilterMode, fm),\n getEnum(this.CanvasKit.MipmapMode, mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n getEnum(this.CanvasKit.BlendMode, mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n getEnum(this.CanvasKit.PointMode, mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: InputRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: InputRRect, inner: InputRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(svg: SkSVG, _width?: number, _height?: number) {\n const image = this.CanvasKit.MakeImageFromCanvasImageSource(\n (svg as JsiSkSVG).ref\n );\n this.ref.drawImage(image, 0, 0);\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(\n color,\n blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined\n );\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n getEnum(this.CanvasKit.PathOp, op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix | number[]) {\n this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n\n drawAtlas(\n atlas: SkImage,\n srcs: SkRect[],\n dsts: SkRSXform[],\n paint: SkPaint,\n blendMode?: BlendMode,\n colors?: SkColor[],\n _sampling?: CubicResampler | FilterOptions\n ) {\n const src = srcs.flatMap((s) =>\n Array.from(JsiSkRect.fromValue(this.CanvasKit, s))\n );\n const dst = dsts.flatMap((s) => Array.from(JsiSkRSXform.fromValue(s)));\n let cls: Uint32Array | undefined;\n if (colors) {\n cls = new Uint32Array(colors.length);\n for (let i = 0; i < colors.length; i++) {\n const [r, g, b, a] = colors[i];\n cls[i] = this.CanvasKit.ColorAsInt(r * 255, g * 255, b * 255, a * 255);\n }\n }\n this.ref.drawAtlas(\n JsiSkImage.fromValue(atlas),\n src,\n dst,\n JsiSkPaint.fromValue(paint),\n blendMode\n ? getEnum(this.CanvasKit.BlendMode, blendMode)\n : this.CanvasKit.BlendMode.DstOver,\n cls\n );\n }\n\n readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {\n const pxInfo = {\n width: imageInfo.width,\n height: imageInfo.height,\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),\n colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),\n };\n return this.ref.readPixels(srcX, srcY, pxInfo);\n }\n}\n"],"mappings":";;;AA8BA,SAASA,OAAO,EAAEC,UAAU,QAAQ,QAAQ;AAC5C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,eAAe;AAC3C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ACJ,CAAC,GAAG,GAAG,EAAEC,CAAC,GAAG,GAAG,EAAEC,CAAC,GAAG,GAAG,EAAEC,CAAC,GAAG,GAAG,CAAC;MACxE;IACF;IACA,IAAI,CAACrI,GAAG,CAACuH,SAAS,CAChBpI,UAAU,CAACmB,SAAS,CAACkH,KAAK,CAAC,EAC3B3G,GAAG,EACHgH,GAAG,EACH7I,UAAU,CAACsB,SAAS,CAACD,KAAK,CAAC,EAC3BqG,SAAS,GACL5H,OAAO,CAAC,IAAI,CAACiB,SAAS,CAAC+C,SAAS,EAAE4D,SAAS,CAAC,GAC5C,IAAI,CAAC3G,SAAS,CAAC+C,SAAS,CAACyF,OAAO,EACpCT,GACF,CAAC;EACH;EAEAU,UAAUA,CAACC,IAAY,EAAEC,IAAY,EAAEC,SAAoB,EAAE;IAC3D,MAAMC,MAAM,GAAG;MACbC,KAAK,EAAEF,SAAS,CAACE,KAAK;MACtBC,MAAM,EAAEH,SAAS,CAACG,MAAM;MACxBC,UAAU,EAAE,IAAI,CAAChJ,SAAS,CAACiJ,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAEpK,OAAO,CAAC,IAAI,CAACiB,SAAS,CAACoJ,SAAS,EAAER,SAAS,CAACO,SAAS,CAAC;MACjEE,SAAS,EAAEtK,OAAO,CAAC,IAAI,CAACiB,SAAS,CAACsJ,SAAS,EAAEV,SAAS,CAACS,SAAS;IAClE,CAAC;IACD,OAAO,IAAI,CAACpJ,GAAG,CAACwI,UAAU,CAACC,IAAI,EAAEC,IAAI,EAAEE,MAAM,CAAC;EAChD;AACF"}
@@ -0,0 +1,9 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import type { SkSVG } from "../types";
3
+ import { HostObject } from "./Host";
4
+ export declare class JsiSkSVG extends HostObject<HTMLImageElement, "SVG"> implements SkSVG {
5
+ constructor(CanvasKit: CanvasKit, ref: HTMLImageElement);
6
+ width(): number;
7
+ height(): number;
8
+ dispose: () => void;
9
+ }
@@ -0,0 +1,21 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { HostObject } from "./Host";
5
+ export class JsiSkSVG extends HostObject {
6
+ constructor(CanvasKit, ref) {
7
+ super(CanvasKit, ref, "SVG");
8
+ _defineProperty(this, "dispose", () => {
9
+ if (this.ref.parentNode) {
10
+ this.ref.parentNode.removeChild(this.ref);
11
+ }
12
+ });
13
+ }
14
+ width() {
15
+ return this.ref.width;
16
+ }
17
+ height() {
18
+ return this.ref.height;
19
+ }
20
+ }
21
+ //# sourceMappingURL=JsiSkSVG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HostObject","JsiSkSVG","constructor","CanvasKit","ref","_defineProperty","parentNode","removeChild","width","height"],"sources":["JsiSkSVG.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkSVG } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkSVG\n extends HostObject<HTMLImageElement, \"SVG\">\n implements SkSVG\n{\n constructor(CanvasKit: CanvasKit, ref: HTMLImageElement) {\n super(CanvasKit, ref, \"SVG\");\n }\n\n width(): number {\n return this.ref.width;\n }\n height(): number {\n return this.ref.height;\n }\n\n dispose = () => {\n if (this.ref.parentNode) {\n this.ref.parentNode.removeChild(this.ref);\n }\n };\n}\n"],"mappings":";;;AAIA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,OAAO,MAAMC,QAAQ,SACXD,UAAU,CAEpB;EACEE,WAAWA,CAACC,SAAoB,EAAEC,GAAqB,EAAE;IACvD,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,KAAK,CAAC;IAACC,eAAA,kBAUrB,MAAM;MACd,IAAI,IAAI,CAACD,GAAG,CAACE,UAAU,EAAE;QACvB,IAAI,CAACF,GAAG,CAACE,UAAU,CAACC,WAAW,CAAC,IAAI,CAACH,GAAG,CAAC;MAC3C;IACF,CAAC;EAbD;EAEAI,KAAKA,CAAA,EAAW;IACd,OAAO,IAAI,CAACJ,GAAG,CAACI,KAAK;EACvB;EACAC,MAAMA,CAAA,EAAW;IACf,OAAO,IAAI,CAACL,GAAG,CAACK,MAAM;EACxB;AAOF"}
@@ -1,9 +1,10 @@
1
1
  import type { CanvasKit } from "canvaskit-wasm";
2
- import type { SkData, SkSVG } from "../types";
2
+ import type { SkSVG } from "../types";
3
3
  import type { SVGFactory } from "../types/SVG/SVGFactory";
4
4
  import { Host } from "./Host";
5
+ import type { JsiSkData } from "./JsiSkData";
5
6
  export declare class JsiSkSVGFactory extends Host implements SVGFactory {
6
7
  constructor(CanvasKit: CanvasKit);
7
- MakeFromData(_data: SkData): SkSVG | null;
8
- MakeFromString(_str: string): SkSVG | null;
8
+ MakeFromData(data: JsiSkData): SkSVG | null;
9
+ MakeFromString(str: string): SkSVG | null;
9
10
  }
@@ -1,13 +1,49 @@
1
- import { Host, NotImplementedOnRNWeb } from "./Host";
1
+ import { Host } from "./Host";
2
+ import { JsiSkSVG } from "./JsiSkSVG";
2
3
  export class JsiSkSVGFactory extends Host {
3
4
  constructor(CanvasKit) {
4
5
  super(CanvasKit);
5
6
  }
6
- MakeFromData(_data) {
7
- throw new NotImplementedOnRNWeb();
7
+ MakeFromData(data) {
8
+ const decoder = new TextDecoder("utf-8");
9
+ const str = decoder.decode(data.ref);
10
+ return this.MakeFromString(str);
8
11
  }
9
- MakeFromString(_str) {
10
- throw new NotImplementedOnRNWeb();
12
+ MakeFromString(str) {
13
+ const parser = new DOMParser();
14
+ const svgDoc = parser.parseFromString(str, "image/svg+xml");
15
+ const svgElement = svgDoc.documentElement;
16
+ const attrWidth = svgElement.getAttribute("width");
17
+ const attrHeight = svgElement.getAttribute("height");
18
+ let width = attrWidth ? parseFloat(attrWidth) : null;
19
+ let height = attrHeight ? parseFloat(attrHeight) : null;
20
+ const svgDataUrl = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(str);
21
+ // Create a new HTMLImageElement
22
+ const img = new Image();
23
+ img.src = svgDataUrl;
24
+
25
+ // Optionally set styles or attributes on the image
26
+ img.style.display = "none";
27
+ img.alt = "SVG Image";
28
+ if (!width || !height) {
29
+ const viewBox = svgElement.getAttribute("viewBox");
30
+ if (viewBox) {
31
+ const viewBoxValues = viewBox.split(" ");
32
+ if (viewBoxValues.length === 4) {
33
+ width = width || parseFloat(viewBoxValues[2]);
34
+ height = height || parseFloat(viewBoxValues[3]);
35
+ }
36
+ }
37
+ }
38
+ if (width && height) {
39
+ img.width = width;
40
+ img.height = height;
41
+ }
42
+ img.onerror = e => {
43
+ console.error("SVG failed to load", e);
44
+ };
45
+ document.body.appendChild(img);
46
+ return new JsiSkSVG(this.CanvasKit, img);
11
47
  }
12
48
  }
13
49
  //# sourceMappingURL=JsiSkSVGFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Host","NotImplementedOnRNWeb","JsiSkSVGFactory","constructor","CanvasKit","MakeFromData","_data","MakeFromString","_str"],"sources":["JsiSkSVGFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkData, SkSVG } from \"../types\";\nimport type { SVGFactory } from \"../types/SVG/SVGFactory\";\n\nimport { Host, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkSVGFactory extends Host implements SVGFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromData(_data: SkData): SkSVG | null {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeFromString(_str: string): SkSVG | null {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":"AAKA,SAASA,IAAI,EAAEC,qBAAqB,QAAQ,QAAQ;AAEpD,OAAO,MAAMC,eAAe,SAASF,IAAI,CAAuB;EAC9DG,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,YAAYA,CAACC,KAAa,EAAgB;IACxC,MAAM,IAAIL,qBAAqB,CAAC,CAAC;EACnC;EAEAM,cAAcA,CAACC,IAAY,EAAgB;IACzC,MAAM,IAAIP,qBAAqB,CAAC,CAAC;EACnC;AACF"}
1
+ {"version":3,"names":["Host","JsiSkSVG","JsiSkSVGFactory","constructor","CanvasKit","MakeFromData","data","decoder","TextDecoder","str","decode","ref","MakeFromString","parser","DOMParser","svgDoc","parseFromString","svgElement","documentElement","attrWidth","getAttribute","attrHeight","width","parseFloat","height","svgDataUrl","encodeURIComponent","img","Image","src","style","display","alt","viewBox","viewBoxValues","split","length","onerror","e","console","error","document","body","appendChild"],"sources":["JsiSkSVGFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkSVG } from \"../types\";\nimport type { SVGFactory } from \"../types/SVG/SVGFactory\";\n\nimport { Host } from \"./Host\";\nimport type { JsiSkData } from \"./JsiSkData\";\nimport { JsiSkSVG } from \"./JsiSkSVG\";\n\nexport class JsiSkSVGFactory extends Host implements SVGFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromData(data: JsiSkData): SkSVG | null {\n const decoder = new TextDecoder(\"utf-8\");\n const str = decoder.decode(data.ref);\n return this.MakeFromString(str);\n }\n\n MakeFromString(str: string): SkSVG | null {\n const parser = new DOMParser();\n const svgDoc = parser.parseFromString(str, \"image/svg+xml\");\n const svgElement = svgDoc.documentElement;\n\n const attrWidth = svgElement.getAttribute(\"width\");\n const attrHeight = svgElement.getAttribute(\"height\");\n let width = attrWidth ? parseFloat(attrWidth) : null;\n let height = attrHeight ? parseFloat(attrHeight) : null;\n\n const svgDataUrl =\n \"data:image/svg+xml;charset=utf-8,\" + encodeURIComponent(str);\n // Create a new HTMLImageElement\n const img = new Image();\n img.src = svgDataUrl;\n\n // Optionally set styles or attributes on the image\n img.style.display = \"none\";\n img.alt = \"SVG Image\";\n if (!width || !height) {\n const viewBox = svgElement.getAttribute(\"viewBox\");\n if (viewBox) {\n const viewBoxValues = viewBox.split(\" \");\n if (viewBoxValues.length === 4) {\n width = width || parseFloat(viewBoxValues[2]);\n height = height || parseFloat(viewBoxValues[3]);\n }\n }\n }\n if (width && height) {\n img.width = width;\n img.height = height;\n }\n\n img.onerror = (e) => {\n console.error(\"SVG failed to load\", e);\n };\n document.body.appendChild(img);\n return new JsiSkSVG(this.CanvasKit, img);\n }\n}\n"],"mappings":"AAKA,SAASA,IAAI,QAAQ,QAAQ;AAE7B,SAASC,QAAQ,QAAQ,YAAY;AAErC,OAAO,MAAMC,eAAe,SAASF,IAAI,CAAuB;EAC9DG,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,YAAYA,CAACC,IAAe,EAAgB;IAC1C,MAAMC,OAAO,GAAG,IAAIC,WAAW,CAAC,OAAO,CAAC;IACxC,MAAMC,GAAG,GAAGF,OAAO,CAACG,MAAM,CAACJ,IAAI,CAACK,GAAG,CAAC;IACpC,OAAO,IAAI,CAACC,cAAc,CAACH,GAAG,CAAC;EACjC;EAEAG,cAAcA,CAACH,GAAW,EAAgB;IACxC,MAAMI,MAAM,GAAG,IAAIC,SAAS,CAAC,CAAC;IAC9B,MAAMC,MAAM,GAAGF,MAAM,CAACG,eAAe,CAACP,GAAG,EAAE,eAAe,CAAC;IAC3D,MAAMQ,UAAU,GAAGF,MAAM,CAACG,eAAe;IAEzC,MAAMC,SAAS,GAAGF,UAAU,CAACG,YAAY,CAAC,OAAO,CAAC;IAClD,MAAMC,UAAU,GAAGJ,UAAU,CAACG,YAAY,CAAC,QAAQ,CAAC;IACpD,IAAIE,KAAK,GAAGH,SAAS,G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Node, DeclarationNode, NodeType, DeclarationType } from "../types";
2
+ import type { Node, DeclarationNode, NodeType } from "../types";
3
3
  import type { DeclarationContext } from "../types/DeclarationContext";
4
4
  export interface NodeContext {
5
5
  Skia: Skia;
@@ -21,9 +21,8 @@ export declare abstract class JsiNode<P> implements Node<P> {
21
21
  }
22
22
  export type Invalidate = () => void;
23
23
  export declare abstract class JsiDeclarationNode<P> extends JsiNode<P> implements DeclarationNode<P> {
24
- declarationType: DeclarationType;
25
24
  private invalidate;
26
- constructor(ctx: NodeContext, declarationType: DeclarationType, type: NodeType, props: P);
25
+ constructor(ctx: NodeContext, type: NodeType, props: P);
27
26
  abstract decorate(ctx: DeclarationContext): void;
28
27
  protected decorateChildren(ctx: DeclarationContext): void;
29
28
  addChild(child: Node<unknown>): void;
@@ -1,5 +1,5 @@
1
1
  import type { GroupProps } from "./Common";
2
- import type { DeclarationType, NodeType } from "./NodeType";
2
+ import type { NodeType } from "./NodeType";
3
3
  import type { DeclarationContext } from "./DeclarationContext";
4
4
  import type { DrawingContext } from "./DrawingContext";
5
5
  export interface Node<P> {
@@ -14,7 +14,6 @@ export interface Node<P> {
14
14
  }
15
15
  export type Invalidate = () => void;
16
16
  export interface DeclarationNode<P> extends Node<P> {
17
- declarationType: DeclarationType;
18
17
  decorate(ctx: DeclarationContext): void;
19
18
  setInvalidate(invalidate: Invalidate): void;
20
19
  }
@@ -57,12 +57,3 @@ export declare const enum NodeType {
57
57
  Atlas = "skAtlas",
58
58
  Paragraph = "skParagraph"
59
59
  }
60
- export declare const enum DeclarationType {
61
- Paint = 0,
62
- Shader = 1,
63
- ImageFilter = 2,
64
- ColorFilter = 3,
65
- PathEffect = 4,
66
- MaskFilter = 5,
67
- Unknown = 6
68
- }
@@ -0,0 +1,2 @@
1
+ import type { DataSourceParam } from "../types";
2
+ export declare const useSVG: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => import("../types").SkSVG | null;
@@ -27,7 +27,7 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
27
27
  drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont): void;
28
28
  drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint): void;
29
29
  drawGlyphs(glyphs: number[], positions: SkPoint[], x: number, y: number, font: SkFont, paint: SkPaint): void;
30
- drawSvg(_svgDom: SkSVG, _width?: number, _height?: number): void;
30
+ drawSvg(svg: SkSVG, _width?: number, _height?: number): void;
31
31
  save(): number;
32
32
  saveLayer(paint?: SkPaint, bounds?: SkRect | null, backdrop?: SkImageFilter | null, flags?: SaveLayerFlag): number;
33
33
  restore(): void;
@@ -0,0 +1,9 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import type { SkSVG } from "../types";
3
+ import { HostObject } from "./Host";
4
+ export declare class JsiSkSVG extends HostObject<HTMLImageElement, "SVG"> implements SkSVG {
5
+ constructor(CanvasKit: CanvasKit, ref: HTMLImageElement);
6
+ width(): number;
7
+ height(): number;
8
+ dispose: () => void;
9
+ }
@@ -1,9 +1,10 @@
1
1
  import type { CanvasKit } from "canvaskit-wasm";
2
- import type { SkData, SkSVG } from "../types";
2
+ import type { SkSVG } from "../types";
3
3
  import type { SVGFactory } from "../types/SVG/SVGFactory";
4
4
  import { Host } from "./Host";
5
+ import type { JsiSkData } from "./JsiSkData";
5
6
  export declare class JsiSkSVGFactory extends Host implements SVGFactory {
6
7
  constructor(CanvasKit: CanvasKit);
7
- MakeFromData(_data: SkData): SkSVG | null;
8
- MakeFromString(_str: string): SkSVG | null;
8
+ MakeFromData(data: JsiSkData): SkSVG | null;
9
+ MakeFromString(str: string): SkSVG | null;
9
10
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "1.3.5",
10
+ "version": "1.3.7",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -108,7 +108,7 @@
108
108
  "react-native-reanimated": "3.6.2",
109
109
  "ts-jest": "29.1.1",
110
110
  "typescript": "5.1.6",
111
- "ws": "8.11.0"
111
+ "ws": "8.17.1"
112
112
  },
113
113
  "dependencies": {
114
114
  "canvaskit-wasm": "0.39.1",
@@ -1,10 +1,5 @@
1
1
  import type { Skia } from "../../skia/types";
2
- import type {
3
- Node,
4
- DeclarationNode,
5
- NodeType,
6
- DeclarationType,
7
- } from "../types";
2
+ import type { Node, DeclarationNode, NodeType } from "../types";
8
3
  import type { DeclarationContext } from "../types/DeclarationContext";
9
4
 
10
5
  export interface NodeContext {
@@ -72,12 +67,7 @@ export abstract class JsiDeclarationNode<P>
72
67
  {
73
68
  private invalidate: Invalidate = () => {};
74
69
 
75
- constructor(
76
- ctx: NodeContext,
77
- public declarationType: DeclarationType,
78
- type: NodeType,
79
- props: P
80
- ) {
70
+ constructor(ctx: NodeContext, type: NodeType, props: P) {
81
71
  super(ctx, type, props);
82
72
  }
83
73
 
@@ -1,6 +1,6 @@
1
1
  import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from "../../skia/types";
2
2
  import type { DeclarationNode, PaintProps } from "../types";
3
- import { DeclarationType, NodeType } from "../types";
3
+ import { NodeType } from "../types";
4
4
  import type { DeclarationContext } from "../types/DeclarationContext";
5
5
 
6
6
  import { enumKey } from "./datatypes";
@@ -12,7 +12,7 @@ export class PaintNode
12
12
  implements DeclarationNode<PaintProps>
13
13
  {
14
14
  constructor(ctx: NodeContext, props: PaintProps = {}) {
15
- super(ctx, DeclarationType.Paint, NodeType.Paint, props);
15
+ super(ctx, NodeType.Paint, props);
16
16
  }
17
17
 
18
18
  decorate(ctx: DeclarationContext) {