@shopify/react-native-skia 1.3.6 → 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 +6 -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 +7 -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 -8
  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,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
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { GroupProps } from \"./Common\";\nimport type { DeclarationType, NodeType } from \"./NodeType\";\nimport type { DeclarationContext } from \"./DeclarationContext\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nexport interface Node<P> {\n type: NodeType;\n\n setProps(props: P): void;\n setProp<K extends keyof P>(name: K, v: P[K]): boolean;\n getProps(): P;\n\n children(): Node<unknown>[];\n addChild(child: Node<unknown>): void;\n removeChild(child: Node<unknown>): void;\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;\n}\n\nexport type Invalidate = () => void;\n\nexport interface DeclarationNode<P> extends Node<P> {\n declarationType: DeclarationType;\n decorate(ctx: DeclarationContext): void;\n\n setInvalidate(invalidate: Invalidate): void;\n}\n\nexport interface RenderNode<P extends GroupProps> extends Node<P> {\n render(ctx: DrawingContext): void;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { GroupProps } from \"./Common\";\nimport type { NodeType } from \"./NodeType\";\nimport type { DeclarationContext } from \"./DeclarationContext\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nexport interface Node<P> {\n type: NodeType;\n\n setProps(props: P): void;\n setProp<K extends keyof P>(name: K, v: P[K]): boolean;\n getProps(): P;\n\n children(): Node<unknown>[];\n addChild(child: Node<unknown>): void;\n removeChild(child: Node<unknown>): void;\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;\n}\n\nexport type Invalidate = () => void;\n\nexport interface DeclarationNode<P> extends Node<P> {\n //declarationType: DeclarationType;\n decorate(ctx: DeclarationContext): void;\n\n setInvalidate(invalidate: Invalidate): void;\n}\n\nexport interface RenderNode<P extends GroupProps> extends Node<P> {\n render(ctx: DrawingContext): void;\n}\n"],"mappings":""}
@@ -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
- }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.NodeType = exports.DeclarationType = void 0;
6
+ exports.NodeType = void 0;
7
7
  let NodeType = exports.NodeType = /*#__PURE__*/function (NodeType) {
8
8
  NodeType["Layer"] = "skLayer";
9
9
  NodeType["Shader"] = "skShader";
@@ -64,14 +64,4 @@ let NodeType = exports.NodeType = /*#__PURE__*/function (NodeType) {
64
64
  NodeType["Paragraph"] = "skParagraph";
65
65
  return NodeType;
66
66
  }({});
67
- let DeclarationType = exports.DeclarationType = /*#__PURE__*/function (DeclarationType) {
68
- DeclarationType[DeclarationType["Paint"] = 0] = "Paint";
69
- DeclarationType[DeclarationType["Shader"] = 1] = "Shader";
70
- DeclarationType[DeclarationType["ImageFilter"] = 2] = "ImageFilter";
71
- DeclarationType[DeclarationType["ColorFilter"] = 3] = "ColorFilter";
72
- DeclarationType[DeclarationType["PathEffect"] = 4] = "PathEffect";
73
- DeclarationType[DeclarationType["MaskFilter"] = 5] = "MaskFilter";
74
- DeclarationType[DeclarationType["Unknown"] = 6] = "Unknown";
75
- return DeclarationType;
76
- }({});
77
67
  //# sourceMappingURL=NodeType.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NodeType","exports","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 Pa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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":";;;;;;IAAkBA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,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"}
@@ -30,7 +30,6 @@ const setFrame = (video, currentFrame) => {
30
30
  currentFrame.value.dispose();
31
31
  }
32
32
  currentFrame.value = img;
33
- } else {
34
33
  copyFrameOnAndroid(currentFrame);
35
34
  }
36
35
  };
@@ -94,7 +93,6 @@ const useVideo = (source, userOptions) => {
94
93
  });
95
94
  _ReanimatedProxy.default.useAnimatedReaction(() => seek.value, value => {
96
95
  if (value !== null) {
97
- copyFrameOnAndroid(currentFrame);
98
96
  video === null || video === void 0 || video.seek(value);
99
97
  currentTime.value = value;
100
98
  seek.value = null;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_Platform","_ReanimatedProxy","_interopRequireDefault","_useVideoLoading","obj","__esModule","default","copyFrameOnAndroid","currentFrame","Platform","OS","tex","value","makeNonTextureImage","dispose","setFrame","video","img","nextImage","defaultOptions","looping","paused","seek","currentTime","volume","useOption","defaultValue","Rea","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","useVideoLoading","isPaused","lastTimestamp","duration","useMemo","_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","useEffect","runOnUI","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAoD,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAWpD,MAAMG,kBAAkB,GAAIC,YAAyC,IAAK;EACxE,SAAS;;EACT;EACA,IAAIC,kBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,MAAMC,GAAG,GAAGH,YAAY,CAACI,KAAK;IAC9B,IAAID,GAAG,EAAE;MACPH,YAAY,CAACI,KAAK,GAAGD,GAAG,CAACE,mBAAmB,CAAC,CAAC;MAC9CF,GAAG,CAACG,OAAO,CAAC,CAAC;IACf;EACF;AACF,CAAC;AAED,MAAMC,QAAQ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;EACH,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAO;IACLR,YAAY;IACZe,WAAW;IACXkB,QAAQ;IACRG,SAAS;IACTM,QAAQ;IACRJ;EACF,CAAC;AACH,CAAC;AAACsB,OAAA,CAAArC,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_react","require","_Platform","_ReanimatedProxy","_interopRequireDefault","_useVideoLoading","obj","__esModule","default","copyFrameOnAndroid","currentFrame","Platform","OS","tex","value","makeNonTextureImage","dispose","setFrame","video","img","nextImage","defaultOptions","looping","paused","seek","currentTime","volume","useOption","defaultValue","Rea","useSharedValue","isSharedValue","disposeVideo","useVideo","source","userOptions","_userOptions$paused","_userOptions$looping","_userOptions$seek","_userOptions$volume","useVideoLoading","isPaused","lastTimestamp","duration","useMemo","_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","useEffect","runOnUI","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAoD,SAAAG,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAWpD,MAAMG,kBAAkB,GAAIC,YAAyC,IAAK;EACxE,SAAS;;EACT;EACA,IAAIC,kBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;IAC7B,MAAMC,GAAG,GAAGH,YAAY,CAACI,KAAK;IAC9B,IAAID,GAAG,EAAE;MACPH,YAAY,CAACI,KAAK,GAAGD,GAAG,CAACE,mBAAmB,CAAC,CAAC;MAC9CF,GAAG,CAACG,OAAO,CAAC,CAAC;IACf;EACF;AACF,CAAC;AAED,MAAMC,QAAQ,GAAGA,CAACC,KAAY,EAAER,YAAyC,KAAK;EAC5E,SAAS;;EACT,MAAMS,GAAG,GAAGD,KAAK,CAACE,SA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AACsB,OAAA,CAAArC,QAAA,GAAAA,QAAA"}
@@ -10,19 +10,21 @@ var _ReanimatedProxy = _interopRequireDefault(require("./ReanimatedProxy"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  const runtime = _ReanimatedProxy.default.createWorkletRuntime("video-metadata-runtime");
12
12
  const useVideoLoading = source => {
13
- const runOnJS = _ReanimatedProxy.default.runOnJS;
13
+ const {
14
+ runOnJS
15
+ } = _ReanimatedProxy.default;
14
16
  const [video, setVideo] = (0, _react.useState)(null);
15
- const cb = src => {
17
+ const cb = (0, _react.useCallback)(src => {
16
18
  "worklet";
17
19
 
18
20
  const vid = _skia.Skia.Video(src);
19
21
  runOnJS(setVideo)(vid);
20
- };
22
+ }, [runOnJS]);
21
23
  (0, _react.useEffect)(() => {
22
24
  if (source) {
23
25
  _ReanimatedProxy.default.runOnRuntime(runtime, cb)(source);
24
26
  }
25
- }, [source]);
27
+ }, [cb, source]);
26
28
  return video;
27
29
  };
28
30
  exports.useVideoLoading = useVideoLoading;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_skia","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","runtime","Rea","createWorkletRuntime","useVideoLoading","source","runOnJS","video","setVideo","useState","cb","src","vid","Skia","Video","useEffect","runOnRuntime","exports"],"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 runOnJS = Rea.runOnJS;\n const [video, setVideo] = useState<Video | null>(null);\n const cb = (src: string) => {\n \"worklet\";\n const vid = Skia.Video(src) as Video;\n 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,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAoC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC,MAAMG,OAAO,GAAGC,wBAAG,CAACC,oBAAoB,CAAC,wBAAwB,CAAC;AAI3D,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAMC,OAAO,GAAGJ,wBAAG,CAACI,OAAO;EAC3B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAe,IAAI,CAAC;EACtD,MAAMC,EAAE,GAAIC,GAAW,IAAK;IAC1B,SAAS;;IACT,MAAMC,GAAG,GAAGC,UAAI,CAACC,KAAK,CAACH,GAAG,CAAU;IACpCL,OAAO,CAACE,QAAQ,CAAC,CAACI,GAAG,CAAC;EACxB,CAAC;EACD,IAAAG,gBAAS,EAAC,MAAM;IACd,IAAIV,MAAM,EAAE;MACVH,wBAAG,CAACc,YAAY,CAACf,OAAO,EAAES,EAAE,CAAC,CAACL,MAAM,CAAC;IACvC;EACF,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EACZ,OAAOE,KAAK;AACd,CAAC;AAACU,OAAA,CAAAb,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_react","require","_skia","_ReanimatedProxy","_interopRequireDefault","obj","__esModule","default","runtime","Rea","createWorkletRuntime","useVideoLoading","source","runOnJS","video","setVideo","useState","cb","useCallback","src","vid","Skia","Video","useEffect","runOnRuntime","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAoC,SAAAG,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC,MAAMG,OAAO,GAAGC,wBAAG,CAACC,oBAAoB,CAAC,wBAAwB,CAAC;AAI3D,MAAMC,eAAe,GAAIC,MAAmB,IAAK;EACtD,MAAM;IAAEC;EAAQ,CAAC,GAAGJ,wBAAG;EACvB,MAAM,CAACK,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAe,IAAI,CAAC;EACtD,MAAMC,EAAE,GAAG,IAAAC,kBAAW,EACnBC,GAAW,IAAK;IACf,SAAS;;IACT,MAAMC,GAAG,GAAGC,UAAI,CAACC,KAAK,CAACH,GAAG,CAAU;IACpCN,OAAO,CAACE,QAAQ,CAAC,CAACK,GAAG,CAAC;EACxB,CAAC,EACD,CAACP,OAAO,CACV,CAAC;EACD,IAAAU,gBAAS,EAAC,MAAM;IACd,IAAIX,MAAM,EAAE;MACVH,wBAAG,CAACe,YAAY,CAAChB,OAAO,EAAES,EAAE,CAAC,CAACL,MAAM,CAAC;IACvC;EACF,CAAC,EAAE,CAACK,EAAE,EAAEL,MAAM,CAAC,CAAC;EAChB,OAAOE,KAAK;AACd,CAAC;AAACW,OAAA,CAAAd,eAAA,GAAAA,eAAA"}
@@ -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,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSVG = void 0;
7
+ var _Skia = require("../Skia");
8
+ const useSVG = (source, onError) => {
9
+ if (source === null || source === undefined) {
10
+ throw new Error(`Invalid svg data source. Got: ${source}`);
11
+ }
12
+ if (typeof source !== "object" || source instanceof Uint8Array || typeof source.default !== "string") {
13
+ throw new Error(`Invalid svg data source. Make sure that the source resolves to a string. Got: ${JSON.stringify(source, null, 2)}`);
14
+ }
15
+ const svg = _Skia.Skia.SVG.MakeFromString(source.default);
16
+ if (svg === null && onError !== undefined) {
17
+ onError(new Error("Failed to create SVG from source."));
18
+ }
19
+ return svg;
20
+ };
21
+ exports.useSVG = useSVG;
22
+ //# sourceMappingURL=SVG.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Skia","require","useSVG","source","onError","undefined","Error","Uint8Array","default","JSON","stringify","svg","Skia","SVG","MakeFromString","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AAGO,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,GAAGC,UAAI,CAACC,GAAG,CAACC,cAAc,CAACX,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;AAACI,OAAA,CAAAb,MAAA,GAAAA,MAAA"}
@@ -8,7 +8,7 @@ class CanvasKitWebGLBuffer {}
8
8
  exports.CanvasKitWebGLBuffer = CanvasKitWebGLBuffer;
9
9
  const isNativeBufferAddr = buffer => buffer instanceof BigInt;
10
10
  exports.isNativeBufferAddr = isNativeBufferAddr;
11
- 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;
11
+ 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;
12
12
  exports.isNativeBufferWeb = isNativeBufferWeb;
13
13
  const isNativeBufferNode = buffer => buffer instanceof ArrayBuffer;
14
14
  exports.isNativeBufferNode = isNativeBufferNode;
@@ -1 +1 @@
1
- {"version":3,"names":["CanvasKitWebGLBuffer","exports","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":";;;;;;AAEO,MAAeA,oBAAoB,CAAC;AAAEC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA;AAetC,MAAME,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AACnD,MAAMG,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,YAAYH,oBAAoB;AAACC,OAAA,CAAAI,iBAAA,GAAAA,iBAAA;AAElC,MAAMQ,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW;AAACb,OAAA,CAAAY,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["CanvasKitWebGLBuffer","exports","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":";;;;;;AAEO,MAAeA,oBAAoB,CAAC;AAAEC,OAAA,CAAAD,oBAAA,GAAAA,oBAAA;AAetC,MAAME,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AAACH,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AACnD,MAAMG,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,YAAYH,oBAAoB;AAACC,OAAA,CAAAI,iBAAA,GAAAA,iBAAA;AAElC,MAAMQ,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW;AAACb,OAAA,CAAAY,kBAAA,GAAAA,kBAAA"}
@@ -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;
@@ -103,8 +103,9 @@ class JsiSkCanvas extends _Host.HostObject {
103
103
  drawGlyphs(glyphs, positions, x, y, font, paint) {
104
104
  this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y, _JsiSkFont.JsiSkFont.fromValue(font), _JsiSkPaint.JsiSkPaint.fromValue(paint));
105
105
  }
106
- drawSvg(_svgDom, _width, _height) {
107
- throw new Error("drawSvg is not implemented on React Native Web");
106
+ drawSvg(svg, _width, _height) {
107
+ const image = this.CanvasKit.MakeImageFromCanvasImageSource(svg.ref);
108
+ this.ref.drawImage(image, 0, 0);
108
109
  }
109
110
  save() {
110
111
  return this.ref.save();
@@ -1 +1 @@
1
- {"version":3,"names":["_Host","require","_JsiSkPaint","_JsiSkRect","_JsiSkRRect","_JsiSkImage","_JsiSkVertices","_JsiSkPath","_JsiSkFont","_JsiSkTextBlob","_JsiSkPicture","_JsiSkMatrix","_JsiSkImageFilter","_JsiSkPoint","_JsiSkRSXform","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","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","JsiSkMatrix","drawPicture","skp","JsiSkPicture","drawAtlas","atlas","srcs","dsts","_sampling","s","dst","JsiSkRSXform","cls","Uint32Array","length","g","b","a","ColorAsInt","DstOver","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAA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S,CAAC8H,KAAK,CAAC,EAC3BrH,GAAG,EACH0H,GAAG,EACHlI,sBAAU,CAACD,SAAS,CAACF,KAAK,CAAC,EAC3BgH,SAAS,GACL,IAAA1F,aAAO,EAAC,IAAI,CAAC3B,SAAS,CAACmD,SAAS,EAAEkE,SAAS,CAAC,GAC5C,IAAI,CAACrH,SAAS,CAACmD,SAAS,CAACgG,OAAO,EACpCP,GACF,CAAC;EACH;EAEAQ,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,CAAC3J,SAAS,CAAC4J,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAE,IAAAnI,aAAO,EAAC,IAAI,CAAC3B,SAAS,CAAC+J,SAAS,EAAER,SAAS,CAACO,SAAS,CAAC;MACjEE,SAAS,EAAE,IAAArI,aAAO,EAAC,IAAI,CAAC3B,SAAS,CAACiK,SAAS,EAAEV,SAAS,CAACS,SAAS;IAClE,CAAC;IACD,OAAO,IAAI,CAAC/J,GAAG,CAACmJ,UAAU,CAACC,IAAI,EAAEC,IAAI,EAAEE,MAAM,CAAC;EAChD;AACF;AAACU,OAAA,CAAArK,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_Host","require","_JsiSkPaint","_JsiSkRect","_JsiSkRRect","_JsiSkImage","_JsiSkVertices","_JsiSkPath","_JsiSkFont","_JsiSkTextBlob","_JsiSkPicture","_JsiSkMatrix","_JsiSkImageFilter","_JsiSkPoint","_JsiSkRSXform","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JsiSkCanvas","HostObject","constructor","CanvasKit","ref","delete","drawRect","rect","paint","JsiSkRect","fromValue","JsiSkPaint","drawImage","image","x","y","JsiSkImage","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","getEnum","FilterMode","MipmapMode","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","JsiSkVertices","BlendMode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","JsiSkPoint","undefined","restoreToCount","saveCount","drawPoints","points","PointMode","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","JsiSkRRect","drawDRRect","outer","inner","drawOval","drawPath","path","JsiSkPath","drawText","str","font","JsiSkFont","drawTextBlob","blob","JsiSkTextBlob","drawGlyphs","glyphs","positions","drawSvg","svg","_width","_height","MakeImageFromCanvasImageSource","save","saveLayer","bounds","backdrop","flags","JsiSkImageFilter","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","JsiSkMatrix","drawPicture","skp","JsiSkPicture","drawAtlas","atlas","srcs","dsts","_sampling","s","dst","JsiSkRSXform","cls","Uint32Array","length","g","b","a","ColorAsInt","DstOver","readPixels","srcX","srcY","imageInfo","pxInfo","width","height","colorSpace","ColorSpace","SRGB","alphaType","AlphaType","colorType","ColorType","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,aAAA,GAAAb,OAAA;AAA8C,SAAAc,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,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AAI,EAAEE,MAAM,CAAC;EAChD;AACF;AAACU,OAAA,CAAArK,WAAA,GAAAA,WAAA"}
@@ -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,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.JsiSkSVG = void 0;
7
+ var _Host = require("./Host");
8
+ 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; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
10
+ 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); }
11
+ class JsiSkSVG extends _Host.HostObject {
12
+ constructor(CanvasKit, ref) {
13
+ super(CanvasKit, ref, "SVG");
14
+ _defineProperty(this, "dispose", () => {
15
+ if (this.ref.parentNode) {
16
+ this.ref.parentNode.removeChild(this.ref);
17
+ }
18
+ });
19
+ }
20
+ width() {
21
+ return this.ref.width;
22
+ }
23
+ height() {
24
+ return this.ref.height;
25
+ }
26
+ }
27
+ exports.JsiSkSVG = JsiSkSVG;
28
+ //# sourceMappingURL=JsiSkSVG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Host","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","JsiSkSVG","HostObject","constructor","CanvasKit","ref","parentNode","removeChild","width","height","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AAAoC,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAE,MAAA,CAAAF,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAI,CAAA,2BAAAJ,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAK,CAAA,GAAAL,CAAA,CAAAM,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAJ,CAAA,GAAAI,CAAA,CAAAG,IAAA,CAAAR,CAAA,EAAAI,CAAA,uCAAAH,CAAA,SAAAA,CAAA,YAAAQ,SAAA,yEAAAL,CAAA,GAAAD,MAAA,GAAAO,MAAA,EAAAV,CAAA;AAE7B,MAAMW,QAAQ,SACXC,gBAAU,CAEpB;EACEC,WAAWA,CAACC,SAAoB,EAAEC,GAAqB,EAAE;IACvD,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,KAAK,CAAC;IAACzB,eAAA,kBAUrB,MAAM;MACd,IAAI,IAAI,CAACyB,GAAG,CAACC,UAAU,EAAE;QACvB,IAAI,CAACD,GAAG,CAACC,UAAU,CAACC,WAAW,CAAC,IAAI,CAACF,GAAG,CAAC;MAC3C;IACF,CAAC;EAbD;EAEAG,KAAKA,CAAA,EAAW;IACd,OAAO,IAAI,CAACH,GAAG,CAACG,KAAK;EACvB;EACAC,MAAMA,CAAA,EAAW;IACf,OAAO,IAAI,CAACJ,GAAG,CAACI,MAAM;EACxB;AAOF;AAACC,OAAA,CAAAT,QAAA,GAAAA,QAAA"}
@@ -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
  }
@@ -5,15 +5,51 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.JsiSkSVGFactory = void 0;
7
7
  var _Host = require("./Host");
8
+ var _JsiSkSVG = require("./JsiSkSVG");
8
9
  class JsiSkSVGFactory extends _Host.Host {
9
10
  constructor(CanvasKit) {
10
11
  super(CanvasKit);
11
12
  }
12
- MakeFromData(_data) {
13
- throw new _Host.NotImplementedOnRNWeb();
13
+ MakeFromData(data) {
14
+ const decoder = new TextDecoder("utf-8");
15
+ const str = decoder.decode(data.ref);
16
+ return this.MakeFromString(str);
14
17
  }
15
- MakeFromString(_str) {
16
- throw new _Host.NotImplementedOnRNWeb();
18
+ MakeFromString(str) {
19
+ const parser = new DOMParser();
20
+ const svgDoc = parser.parseFromString(str, "image/svg+xml");
21
+ const svgElement = svgDoc.documentElement;
22
+ const attrWidth = svgElement.getAttribute("width");
23
+ const attrHeight = svgElement.getAttribute("height");
24
+ let width = attrWidth ? parseFloat(attrWidth) : null;
25
+ let height = attrHeight ? parseFloat(attrHeight) : null;
26
+ const svgDataUrl = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(str);
27
+ // Create a new HTMLImageElement
28
+ const img = new Image();
29
+ img.src = svgDataUrl;
30
+
31
+ // Optionally set styles or attributes on the image
32
+ img.style.display = "none";
33
+ img.alt = "SVG Image";
34
+ if (!width || !height) {
35
+ const viewBox = svgElement.getAttribute("viewBox");
36
+ if (viewBox) {
37
+ const viewBoxValues = viewBox.split(" ");
38
+ if (viewBoxValues.length === 4) {
39
+ width = width || parseFloat(viewBoxValues[2]);
40
+ height = height || parseFloat(viewBoxValues[3]);
41
+ }
42
+ }
43
+ }
44
+ if (width && height) {
45
+ img.width = width;
46
+ img.height = height;
47
+ }
48
+ img.onerror = e => {
49
+ console.error("SVG failed to load", e);
50
+ };
51
+ document.body.appendChild(img);
52
+ return new _JsiSkSVG.JsiSkSVG(this.CanvasKit, img);
17
53
  }
18
54
  }
19
55
  exports.JsiSkSVGFactory = JsiSkSVGFactory;
@@ -1 +1 @@
1
- {"version":3,"names":["_Host","require","JsiSkSVGFactory","Host","constructor","CanvasKit","MakeFromData","_data","NotImplementedOnRNWeb","MakeFromString","_str","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,SAASC,UAAI,CAAuB;EAC9DC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,YAAYA,CAACC,KAAa,EAAgB;IACxC,MAAM,IAAIC,2BAAqB,CAAC,CAAC;EACnC;EAEAC,cAAcA,CAACC,IAAY,EAAgB;IACzC,MAAM,IAAIF,2BAAqB,CAAC,CAAC;EACnC;AACF;AAACG,OAAA,CAAAT,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_Host","require","_JsiSkSVG","JsiSkSVGFactory","Host","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","JsiSkSVG","exports"],"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,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEO,MAAME,eAAe,SAASC,UAAI,CAAuB;EAC9DC,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,M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AC;IACDG,QAAQ,CAACC,IAAI,CAACC,WAAW,CAAChB,GAAG,CAAC;IAC9B,OAAO,IAAIiB,kBAAQ,CAAC,IAAI,CAACxC,SAAS,EAAEuB,GAAG,CAAC;EAC1C;AACF;AAACkB,OAAA,CAAA5C,eAAA,GAAAA,eAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { Skia } from "../../skia/types";
2
- import type { 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;
@@ -47,9 +47,8 @@ export class JsiNode {
47
47
  }
48
48
  }
49
49
  export class JsiDeclarationNode extends JsiNode {
50
- constructor(ctx, declarationType, type, props) {
50
+ constructor(ctx, type, props) {
51
51
  super(ctx, type, props);
52
- this.declarationType = declarationType;
53
52
  _defineProperty(this, "invalidate", () => {});
54
53
  }
55
54
  decorateChildren(ctx) {