@shopify/react-native-skia 0.1.185 → 0.1.187

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. package/android/build.gradle +2 -1
  2. package/android/cpp/jni/JniPlatformContext.cpp +92 -3
  3. package/android/cpp/jni/include/JniPlatformContext.h +4 -0
  4. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +8 -0
  5. package/android/src/main/java/com/shopify/reactnative/skia/PlatformContext.java +17 -1
  6. package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +180 -0
  7. package/cpp/api/JsiSkFont.h +1 -1
  8. package/cpp/api/JsiSkHostObjects.h +1 -1
  9. package/cpp/api/JsiSkImage.h +1 -1
  10. package/cpp/api/JsiSkImageFactory.h +29 -0
  11. package/cpp/api/JsiSkPaint.h +7 -7
  12. package/cpp/api/JsiSkPathFactory.h +1 -1
  13. package/cpp/api/JsiSkPicture.h +2 -2
  14. package/cpp/api/JsiSkRuntimeEffect.h +3 -3
  15. package/cpp/api/JsiSkSVG.h +12 -2
  16. package/cpp/api/JsiSkShader.h +1 -1
  17. package/cpp/api/JsiSkSurface.h +3 -3
  18. package/cpp/api/JsiSkSurfaceFactory.h +1 -1
  19. package/cpp/api/JsiSkTypeface.h +1 -1
  20. package/cpp/rnskia/RNSkAnimation.h +3 -3
  21. package/cpp/rnskia/RNSkDomView.h +9 -9
  22. package/cpp/rnskia/RNSkInfoParameter.h +2 -2
  23. package/cpp/rnskia/RNSkJsView.h +8 -8
  24. package/cpp/rnskia/RNSkJsiViewApi.h +5 -5
  25. package/cpp/rnskia/RNSkPictureView.h +8 -8
  26. package/cpp/rnskia/RNSkPlatformContext.h +32 -3
  27. package/cpp/rnskia/RNSkValueApi.h +5 -5
  28. package/cpp/rnskia/RNSkView.h +6 -6
  29. package/cpp/rnskia/dom/base/ConcatablePaint.h +6 -6
  30. package/cpp/rnskia/dom/base/Declaration.h +1 -1
  31. package/cpp/rnskia/dom/base/DeclarationContext.h +7 -7
  32. package/cpp/rnskia/dom/base/DrawingContext.h +3 -3
  33. package/cpp/rnskia/dom/base/NodePropsContainer.h +1 -1
  34. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -1
  35. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +1 -1
  36. package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +8 -7
  37. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +1 -1
  38. package/cpp/rnskia/dom/nodes/JsiImageNode.h +5 -2
  39. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +9 -9
  40. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +1 -1
  41. package/cpp/rnskia/dom/nodes/JsiPathNode.h +1 -1
  42. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +1 -1
  43. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +7 -3
  44. package/cpp/rnskia/dom/nodes/JsiTextNode.h +5 -4
  45. package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +3 -1
  46. package/cpp/rnskia/dom/props/BlendModeProp.h +1 -1
  47. package/cpp/rnskia/dom/props/CircleProp.h +1 -1
  48. package/cpp/rnskia/dom/props/ClipProp.h +1 -1
  49. package/cpp/rnskia/dom/props/FontProp.h +15 -10
  50. package/cpp/rnskia/dom/props/ImageProps.h +30 -16
  51. package/cpp/rnskia/dom/props/PaintProps.h +1 -1
  52. package/cpp/rnskia/dom/props/PathProp.h +1 -1
  53. package/cpp/rnskia/dom/props/PointProp.h +1 -1
  54. package/cpp/rnskia/dom/props/PointsProp.h +1 -1
  55. package/cpp/rnskia/dom/props/RRectProp.h +2 -2
  56. package/cpp/rnskia/dom/props/RadiusProp.h +1 -1
  57. package/cpp/rnskia/dom/props/RectProp.h +1 -1
  58. package/cpp/rnskia/dom/props/StrokeProps.h +1 -1
  59. package/cpp/rnskia/dom/props/SvgProp.h +18 -12
  60. package/cpp/rnskia/dom/props/TextBlobProp.h +60 -57
  61. package/cpp/rnskia/dom/props/TileModeProp.h +1 -1
  62. package/cpp/rnskia/dom/props/UniformsProp.h +1 -1
  63. package/cpp/rnskia/dom/props/VertexModeProp.h +1 -1
  64. package/cpp/rnskia/dom/props/VerticesProps.h +1 -1
  65. package/cpp/rnskia/values/RNSkClockValue.h +2 -2
  66. package/cpp/rnskia/values/RNSkComputedValue.h +1 -1
  67. package/cpp/rnskia/values/RNSkReadonlyValue.h +3 -3
  68. package/cpp/rnskia/values/RNSkValue.h +4 -4
  69. package/cpp/utils/RNSkMeasureTime.h +1 -1
  70. package/cpp/utils/RNSkTimingInfo.h +1 -1
  71. package/globalJestSetup.js +6 -0
  72. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +16 -13
  73. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +8 -0
  74. package/ios/RNSkia-iOS/SkiaManager.mm +20 -1
  75. package/ios/RNSkia-iOS/ViewScreenshotService.h +21 -0
  76. package/ios/RNSkia-iOS/ViewScreenshotService.mm +79 -0
  77. package/jestSetup.js +2 -3
  78. package/lib/commonjs/dom/nodes/drawings/ImageNode.js +22 -1
  79. package/lib/commonjs/dom/nodes/drawings/ImageNode.js.map +1 -1
  80. package/lib/commonjs/dom/nodes/drawings/ImageSVG.js +5 -0
  81. package/lib/commonjs/dom/nodes/drawings/ImageSVG.js.map +1 -1
  82. package/lib/commonjs/dom/nodes/drawings/Text.d.ts +2 -2
  83. package/lib/commonjs/dom/nodes/drawings/Text.js +13 -2
  84. package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
  85. package/lib/commonjs/dom/nodes/paint/Shaders.js +5 -0
  86. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  87. package/lib/commonjs/dom/types/Drawings.d.ts +5 -5
  88. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  89. package/lib/commonjs/dom/types/Shaders.d.ts +1 -1
  90. package/lib/commonjs/dom/types/Shaders.js.map +1 -1
  91. package/lib/commonjs/mock/index.d.ts +2 -15
  92. package/lib/commonjs/mock/index.js +37 -110
  93. package/lib/commonjs/mock/index.js.map +1 -1
  94. package/lib/commonjs/skia/core/Image.d.ts +14 -2
  95. package/lib/commonjs/skia/core/Image.js +37 -1
  96. package/lib/commonjs/skia/core/Image.js.map +1 -1
  97. package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +7 -0
  98. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  99. package/lib/commonjs/skia/types/SVG/SVG.d.ts +4 -1
  100. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  101. package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -1
  102. package/lib/commonjs/skia/web/JsiSkImageFactory.js +7 -0
  103. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  104. package/lib/module/dom/nodes/drawings/ImageNode.js +22 -1
  105. package/lib/module/dom/nodes/drawings/ImageNode.js.map +1 -1
  106. package/lib/module/dom/nodes/drawings/ImageSVG.js +5 -0
  107. package/lib/module/dom/nodes/drawings/ImageSVG.js.map +1 -1
  108. package/lib/module/dom/nodes/drawings/Text.d.ts +2 -2
  109. package/lib/module/dom/nodes/drawings/Text.js +13 -2
  110. package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
  111. package/lib/module/dom/nodes/paint/Shaders.js +5 -0
  112. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  113. package/lib/module/dom/types/Drawings.d.ts +5 -5
  114. package/lib/module/dom/types/Drawings.js.map +1 -1
  115. package/lib/module/dom/types/Shaders.d.ts +1 -1
  116. package/lib/module/dom/types/Shaders.js.map +1 -1
  117. package/lib/module/mock/index.d.ts +2 -15
  118. package/lib/module/mock/index.js +33 -95
  119. package/lib/module/mock/index.js.map +1 -1
  120. package/lib/module/skia/core/Image.d.ts +14 -2
  121. package/lib/module/skia/core/Image.js +32 -0
  122. package/lib/module/skia/core/Image.js.map +1 -1
  123. package/lib/module/skia/types/Image/ImageFactory.d.ts +7 -0
  124. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  125. package/lib/module/skia/types/SVG/SVG.d.ts +4 -1
  126. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  127. package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -1
  128. package/lib/module/skia/web/JsiSkImageFactory.js +7 -0
  129. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  130. package/lib/typescript/globalJestSetup.d.ts +2 -0
  131. package/lib/typescript/src/dom/nodes/drawings/Text.d.ts +2 -2
  132. package/lib/typescript/src/dom/types/Drawings.d.ts +5 -5
  133. package/lib/typescript/src/dom/types/Shaders.d.ts +1 -1
  134. package/lib/typescript/src/mock/index.d.ts +2 -15
  135. package/lib/typescript/src/skia/core/Image.d.ts +14 -2
  136. package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +7 -0
  137. package/lib/typescript/src/skia/types/SVG/SVG.d.ts +4 -1
  138. package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -1
  139. package/package.json +3 -2
  140. package/scripts/install-npm.js +3 -2
  141. package/src/dom/nodes/drawings/ImageNode.ts +9 -1
  142. package/src/dom/nodes/drawings/ImageSVG.ts +3 -0
  143. package/src/dom/nodes/drawings/Text.ts +13 -3
  144. package/src/dom/nodes/paint/Shaders.ts +4 -0
  145. package/src/dom/types/Drawings.ts +5 -5
  146. package/src/dom/types/Shaders.ts +1 -1
  147. package/src/mock/index.ts +35 -98
  148. package/src/skia/core/Image.ts +43 -1
  149. package/src/skia/types/Image/ImageFactory.ts +8 -0
  150. package/src/skia/types/SVG/SVG.ts +4 -1
  151. package/src/skia/web/JsiSkImageFactory.ts +8 -1
@@ -1,3 +1,6 @@
1
1
  import type { JsiDisposable, SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export type SkSVG = SkJSIInstance<"SVG"> & JsiDisposable;
3
+ export interface SkSVG extends SkJSIInstance<"SVG">, JsiDisposable {
4
+ width(): number;
5
+ height(): number;
6
+ }
@@ -1,6 +1,6 @@
1
1
  import type { CanvasKit } from "canvaskit-wasm";
2
2
 
3
- import type { SkData, ImageInfo } from "../types";
3
+ import type { SkData, ImageInfo, SkImage } from "../types";
4
4
  import type { ImageFactory } from "../types/Image/ImageFactory";
5
5
 
6
6
  import { Host, ckEnum } from "./Host";
@@ -12,6 +12,13 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
12
12
  super(CanvasKit);
13
13
  }
14
14
 
15
+ MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {
16
+ const view = viewTag as unknown as HTMLElement;
17
+ // TODO: Implement screenshot from view in React JS
18
+ console.log(view);
19
+ return Promise.resolve(null);
20
+ }
21
+
15
22
  MakeImageFromEncoded(encoded: SkData) {
16
23
  const image = this.CanvasKit.MakeImageFromEncoded(
17
24
  JsiSkData.fromValue(encoded)