@shopify/react-native-skia 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/android/CMakeLists.txt +4 -8
  2. package/android/build.gradle +9 -2
  3. package/android/cpp/jni/JniPlatformContext.cpp +7 -7
  4. package/android/cpp/jni/JniSkiaManager.cpp +1 -1
  5. package/android/cpp/jni/include/JniSkiaBaseView.h +2 -2
  6. package/android/cpp/jni/include/JniSkiaDomView.h +4 -4
  7. package/android/cpp/jni/include/JniSkiaManager.h +4 -4
  8. package/android/cpp/jni/include/JniSkiaPictureView.h +4 -4
  9. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +245 -0
  10. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +33 -0
  11. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +3 -3
  12. package/android/cpp/rnskia-android/RNSkAndroidView.h +1 -1
  13. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +2 -2
  14. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +4 -4
  15. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.cpp +32 -2
  16. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +7 -4
  17. package/cpp/api/JsiSkAnimatedImage.h +1 -1
  18. package/cpp/api/JsiSkCanvas.h +8 -8
  19. package/cpp/api/JsiSkColor.h +1 -1
  20. package/cpp/api/JsiSkColorFilter.h +1 -1
  21. package/cpp/api/JsiSkColorFilterFactory.h +2 -2
  22. package/cpp/api/JsiSkContourMeasure.h +1 -1
  23. package/cpp/api/JsiSkContourMeasureIter.h +1 -1
  24. package/cpp/api/JsiSkData.h +2 -2
  25. package/cpp/api/JsiSkFont.h +2 -2
  26. package/cpp/api/JsiSkFontMgr.h +1 -1
  27. package/cpp/api/JsiSkFontMgrFactory.h +1 -1
  28. package/cpp/api/JsiSkFontStyle.h +2 -2
  29. package/cpp/api/JsiSkImage.h +2 -2
  30. package/cpp/api/JsiSkImageFilter.h +1 -1
  31. package/cpp/api/JsiSkImageFilterFactory.h +1 -1
  32. package/cpp/api/JsiSkImageInfo.h +1 -1
  33. package/cpp/api/JsiSkMaskFilter.h +1 -1
  34. package/cpp/api/JsiSkMaskFilterFactory.h +1 -1
  35. package/cpp/api/JsiSkMatrix.h +1 -1
  36. package/cpp/api/JsiSkPaint.h +1 -1
  37. package/cpp/api/JsiSkParagraph.h +7 -7
  38. package/cpp/api/JsiSkParagraphBuilder.h +9 -9
  39. package/cpp/api/JsiSkParagraphBuilderFactory.h +4 -4
  40. package/cpp/api/JsiSkParagraphStyle.h +3 -3
  41. package/cpp/api/JsiSkPath.h +11 -11
  42. package/cpp/api/JsiSkPathEffect.h +1 -1
  43. package/cpp/api/JsiSkPathEffectFactory.h +4 -4
  44. package/cpp/api/JsiSkPathFactory.h +2 -2
  45. package/cpp/api/JsiSkPicture.h +1 -1
  46. package/cpp/api/JsiSkPictureFactory.h +2 -2
  47. package/cpp/api/JsiSkPictureRecorder.h +2 -2
  48. package/cpp/api/JsiSkPoint.h +1 -1
  49. package/cpp/api/JsiSkRRect.h +1 -1
  50. package/cpp/api/JsiSkRSXform.h +1 -1
  51. package/cpp/api/JsiSkRect.h +1 -1
  52. package/cpp/api/JsiSkRuntimeEffect.h +1 -1
  53. package/cpp/api/JsiSkRuntimeShaderBuilder.h +1 -1
  54. package/cpp/api/JsiSkSVGFactory.h +1 -1
  55. package/cpp/api/JsiSkShader.h +2 -2
  56. package/cpp/api/JsiSkShaderFactory.h +3 -3
  57. package/cpp/api/JsiSkStrutStyle.h +1 -1
  58. package/cpp/api/JsiSkSurface.h +1 -1
  59. package/cpp/api/JsiSkSurfaceFactory.h +1 -1
  60. package/cpp/api/JsiSkTextBlob.h +1 -1
  61. package/cpp/api/JsiSkTextBlobFactory.h +1 -1
  62. package/cpp/api/JsiSkTextStyle.h +2 -2
  63. package/cpp/api/JsiSkTypeface.h +3 -3
  64. package/cpp/api/JsiSkTypefaceFontProvider.h +2 -2
  65. package/cpp/api/JsiSkVertices.h +1 -1
  66. package/cpp/jsi/JsiHostObject.cpp +1 -1
  67. package/cpp/rnskia/RNSkDomView.cpp +1 -1
  68. package/cpp/rnskia/RNSkDomView.h +3 -3
  69. package/cpp/rnskia/RNSkManager.cpp +5 -5
  70. package/cpp/rnskia/RNSkPictureView.h +3 -3
  71. package/cpp/rnskia/RNSkPlatformContext.h +5 -5
  72. package/cpp/rnskia/RNSkView.h +2 -2
  73. package/cpp/rnskia/dom/base/ConcatablePaint.h +6 -6
  74. package/cpp/rnskia/dom/base/Declaration.h +1 -1
  75. package/cpp/rnskia/dom/base/DeclarationContext.h +7 -7
  76. package/cpp/rnskia/dom/base/DrawingContext.h +3 -3
  77. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +2 -2
  78. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +1 -1
  79. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +1 -1
  80. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +1 -1
  81. package/cpp/rnskia/dom/nodes/JsiPathNode.h +1 -1
  82. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +1 -1
  83. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +1 -1
  84. package/cpp/rnskia/dom/props/BlendModeProp.h +1 -1
  85. package/cpp/rnskia/dom/props/BoxShadowProps.h +1 -1
  86. package/cpp/rnskia/dom/props/CircleProp.h +1 -1
  87. package/cpp/rnskia/dom/props/ClipProp.h +2 -2
  88. package/cpp/rnskia/dom/props/PaintProps.h +1 -1
  89. package/cpp/rnskia/dom/props/PathProp.h +1 -1
  90. package/cpp/rnskia/dom/props/PointProp.h +1 -1
  91. package/cpp/rnskia/dom/props/PointsProp.h +1 -1
  92. package/cpp/rnskia/dom/props/RRectProp.h +2 -2
  93. package/cpp/rnskia/dom/props/RSXformProp.h +1 -1
  94. package/cpp/rnskia/dom/props/RadiusProp.h +1 -1
  95. package/cpp/rnskia/dom/props/RectProp.h +1 -1
  96. package/cpp/rnskia/dom/props/StrokeProps.h +1 -1
  97. package/cpp/rnskia/dom/props/TileModeProp.h +1 -1
  98. package/cpp/rnskia/dom/props/UniformsProp.h +1 -1
  99. package/cpp/rnskia/dom/props/VertexModeProp.h +1 -1
  100. package/cpp/rnskia/dom/props/VerticesProps.h +1 -1
  101. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1158 -0
  102. package/cpp/utils/RNSkTypedArray.h +1 -1
  103. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +6 -6
  104. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +3 -3
  105. package/ios/RNSkia-iOS/SkiaDomView.mm +7 -7
  106. package/ios/RNSkia-iOS/SkiaDomViewManager.mm +7 -7
  107. package/ios/RNSkia-iOS/SkiaManager.h +1 -1
  108. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +1 -1
  109. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +5 -5
  110. package/ios/RNSkia-iOS/SkiaPictureView.mm +7 -7
  111. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +4 -4
  112. package/ios/RNSkia-iOS/SkiaUIView.h +3 -3
  113. package/ios/RNSkia-iOS/SkiaUIView.mm +2 -2
  114. package/ios/RNSkia-iOS/ViewScreenshotService.h +1 -1
  115. package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
  116. package/lib/commonjs/headless/index.d.ts +1 -0
  117. package/lib/commonjs/headless/index.js +17 -0
  118. package/lib/commonjs/headless/index.js.map +1 -1
  119. package/lib/module/headless/index.d.ts +1 -0
  120. package/lib/module/headless/index.js +1 -0
  121. package/lib/module/headless/index.js.map +1 -1
  122. package/lib/typescript/src/headless/index.d.ts +1 -0
  123. package/package.json +1 -1
  124. package/src/headless/index.ts +2 -0
@@ -1,6 +1,6 @@
1
1
  #pragma once
2
2
 
3
- #include "SkImage.h"
3
+ #include "include/core/SkImage.h"
4
4
  #include <jsi/jsi.h>
5
5
 
6
6
  namespace RNSkia {
@@ -1,13 +1,13 @@
1
- #import <RNSkLog.h>
2
- #import <RNSkMetalCanvasProvider.h>
3
- #import <SkiaMetalSurfaceFactory.h>
1
+ #import "RNSkMetalCanvasProvider.h"
2
+ #import "RNSkLog.h"
3
+ #import "SkiaMetalSurfaceFactory.h"
4
4
 
5
5
  #pragma clang diagnostic push
6
6
  #pragma clang diagnostic ignored "-Wdocumentation"
7
7
 
8
- #import "SkCanvas.h"
9
- #import "SkColorSpace.h"
10
- #import "SkSurface.h"
8
+ #import "include/core/SkCanvas.h"
9
+ #import "include/core/SkColorSpace.h"
10
+ #import "include/core/SkSurface.h"
11
11
 
12
12
  #import <include/gpu/GrBackendSurface.h>
13
13
  #import <include/gpu/GrDirectContext.h>
@@ -4,13 +4,13 @@
4
4
  #include <thread>
5
5
  #include <utility>
6
6
 
7
- #include <SkiaMetalSurfaceFactory.h>
7
+ #include "SkiaMetalSurfaceFactory.h"
8
8
 
9
9
  #pragma clang diagnostic push
10
10
  #pragma clang diagnostic ignored "-Wdocumentation"
11
11
 
12
- #include "SkFontMgr.h"
13
- #include "SkSurface.h"
12
+ #include "include/core/SkFontMgr.h"
13
+ #include "include/core/SkSurface.h"
14
14
 
15
15
  #include "include/ports/SkFontMgr_mac_ct.h"
16
16
 
@@ -1,13 +1,13 @@
1
1
  #ifdef RCT_NEW_ARCH_ENABLED
2
- #import <SkiaDomView.h>
2
+ #import "SkiaDomView.h"
3
3
 
4
- #import <RNSkDomView.h>
5
- #import <RNSkIOSView.h>
6
- #import <RNSkPlatformContext.h>
4
+ #import "RNSkDomView.h"
5
+ #import "RNSkIOSView.h"
6
+ #import "RNSkPlatformContext.h"
7
7
 
8
- #import <RNSkiaModule.h>
9
- #import <SkiaManager.h>
10
- #import <SkiaUIView.h>
8
+ #import "RNSkiaModule.h"
9
+ #import "SkiaManager.h"
10
+ #import "SkiaUIView.h"
11
11
 
12
12
  #import <React/RCTBridge+Private.h>
13
13
  #import <React/RCTConversions.h>
@@ -1,14 +1,14 @@
1
1
 
2
+ #include "SkiaDomViewManager.h"
2
3
  #include <React/RCTBridge+Private.h>
3
- #include <SkiaDomViewManager.h>
4
4
 
5
- #include <RNSkDomView.h>
6
- #include <RNSkIOSView.h>
7
- #include <RNSkPlatformContext.h>
5
+ #include "RNSkDomView.h"
6
+ #include "RNSkIOSView.h"
7
+ #include "RNSkPlatformContext.h"
8
8
 
9
- #include <RNSkiaModule.h>
10
- #include <SkiaManager.h>
11
- #include <SkiaUIView.h>
9
+ #include "RNSkiaModule.h"
10
+ #include "SkiaManager.h"
11
+ #include "SkiaUIView.h"
12
12
 
13
13
  @implementation SkiaDomViewManager
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  #import <React/RCTBridge.h>
4
4
 
5
- #import <RNSkManager.h>
5
+ #import "RNSkManager.h"
6
6
 
7
7
  @interface SkiaManager : NSObject
8
8
 
@@ -3,7 +3,7 @@
3
3
  #pragma clang diagnostic push
4
4
  #pragma clang diagnostic ignored "-Wdocumentation"
5
5
 
6
- #import "SkCanvas.h"
6
+ #import "include/core/SkCanvas.h"
7
7
  #import <include/gpu/GrDirectContext.h>
8
8
 
9
9
  #pragma clang diagnostic pop
@@ -1,13 +1,13 @@
1
- #import <RNSkLog.h>
1
+ #import "RNSkLog.h"
2
2
 
3
- #include <SkiaMetalSurfaceFactory.h>
3
+ #include "SkiaMetalSurfaceFactory.h"
4
4
 
5
5
  #pragma clang diagnostic push
6
6
  #pragma clang diagnostic ignored "-Wdocumentation"
7
7
 
8
- #import "SkCanvas.h"
9
- #import "SkColorSpace.h"
10
- #import "SkSurface.h"
8
+ #import "include/core/SkCanvas.h"
9
+ #import "include/core/SkColorSpace.h"
10
+ #import "include/core/SkSurface.h"
11
11
 
12
12
  #import <include/gpu/GrBackendSurface.h>
13
13
  #import <include/gpu/GrDirectContext.h>
@@ -1,13 +1,13 @@
1
1
  #ifdef RCT_NEW_ARCH_ENABLED
2
- #import <SkiaPictureView.h>
2
+ #import "SkiaPictureView.h"
3
3
 
4
- #import <RNSkIOSView.h>
5
- #import <RNSkPictureView.h>
6
- #import <RNSkPlatformContext.h>
4
+ #import "RNSkIOSView.h"
5
+ #import "RNSkPictureView.h"
6
+ #import "RNSkPlatformContext.h"
7
7
 
8
- #import <RNSkiaModule.h>
9
- #import <SkiaManager.h>
10
- #import <SkiaUIView.h>
8
+ #import "RNSkiaModule.h"
9
+ #import "SkiaManager.h"
10
+ #import "SkiaUIView.h"
11
11
 
12
12
  #import <React/RCTBridge+Private.h>
13
13
  #import <React/RCTConversions.h>
@@ -2,13 +2,13 @@
2
2
  #include "SkiaPictureViewManager.h"
3
3
  #include <React/RCTBridge+Private.h>
4
4
 
5
- #include <RNSkIOSView.h>
6
- #include <RNSkPictureView.h>
7
- #include <RNSkPlatformContext.h>
5
+ #include "RNSkIOSView.h"
6
+ #include "RNSkPictureView.h"
7
+ #include "RNSkPlatformContext.h"
8
8
 
9
+ #include "RNSkiaModule.h"
9
10
  #include "SkiaManager.h"
10
11
  #include "SkiaUIView.h"
11
- #include <RNSkiaModule.h>
12
12
 
13
13
  @implementation SkiaPictureViewManager
14
14
 
@@ -6,9 +6,9 @@
6
6
  #import <CoreFoundation/CoreFoundation.h>
7
7
  #import <UIKit/UIKit.h>
8
8
 
9
- #import <RNSkManager.h>
10
- #import <RNSkiOSView.h>
11
- #import <SkiaManager.h>
9
+ #import "RNSkManager.h"
10
+ #import "RNSkiOSView.h"
11
+ #import "SkiaManager.h"
12
12
 
13
13
  #if RCT_NEW_ARCH_ENABLED
14
14
  #import <React/RCTViewComponentView.h>
@@ -1,12 +1,12 @@
1
1
  #import <React/RCTBridge.h>
2
2
 
3
+ #import "RNSkiaModule.h"
3
4
  #import "SkiaUIView.h"
4
- #import <RNSkiaModule.h>
5
5
 
6
6
  #include <utility>
7
7
  #include <vector>
8
8
 
9
- #import <RNSkManager.h>
9
+ #import "RNSkManager.h"
10
10
 
11
11
  @implementation SkiaUIView {
12
12
  std::shared_ptr<RNSkBaseiOSView> _impl;
@@ -8,7 +8,7 @@
8
8
  #pragma clang diagnostic push
9
9
  #pragma clang diagnostic ignored "-Wdocumentation"
10
10
 
11
- #include "SkImage.h"
11
+ #include "include/core/SkImage.h"
12
12
 
13
13
  #pragma clang diagnostic pop
14
14
 
@@ -4,7 +4,7 @@
4
4
  #pragma clang diagnostic push
5
5
  #pragma clang diagnostic ignored "-Wdocumentation"
6
6
 
7
- #include "SkData.h"
7
+ #include "include/core/SkData.h"
8
8
 
9
9
  #pragma clang diagnostic pop
10
10
 
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { SkSurface } from "../skia";
3
+ export * from "../renderer/components";
3
4
  export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
4
5
  export declare const getSkiaExports: () => {
5
6
  Skia: import("../skia/types").Skia;
@@ -3,10 +3,27 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ makeOffscreenSurface: true,
8
+ getSkiaExports: true,
9
+ drawOffscreen: true
10
+ };
6
11
  exports.makeOffscreenSurface = exports.getSkiaExports = exports.drawOffscreen = void 0;
7
12
  var _web = require("../skia/web");
8
13
  var _Reconciler = require("../renderer/Reconciler");
9
14
  var _types = require("../dom/types");
15
+ var _components = require("../renderer/components");
16
+ Object.keys(_components).forEach(function (key) {
17
+ if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
19
+ if (key in exports && exports[key] === _components[key]) return;
20
+ Object.defineProperty(exports, key, {
21
+ enumerable: true,
22
+ get: function () {
23
+ return _components[key];
24
+ }
25
+ });
26
+ });
10
27
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
28
  // @ts-ignore
12
29
 
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_Reconciler","_types","Skia","makeOffscreenSurface","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","exports","getSkiaExports","drawOffscreen","element","root","SkiaRoot","render","canvas","getCanvas","ctx","JsiDrawingContext","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":";;;;;;AAKA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAPA;AACA;;AASA,IAAIG,IAAiC;AAE9B,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAG,IAAAI,aAAQ,EAACC,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGN,IAAI,CAACO,OAAO,CAACC,aAAa,CAACN,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIG,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAACI,OAAA,CAAAT,oBAAA,GAAAA,oBAAA;AAEK,MAAMU,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACX,IAAI,EAAE;IACTA,IAAI,GAAG,IAAAI,aAAQ,EAACC,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEL;EAAK,CAAC;AACjB,CAAC;AAACU,OAAA,CAAAC,cAAA,GAAAA,cAAA;AAEK,MAAMC,aAAa,GAAGA,CAACN,OAAkB,EAAEO,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAIC,oBAAQ,CAACf,IAAI,EAAE,KAAK,CAAC;EACtCc,IAAI,CAACE,MAAM,CAACH,OAAO,CAAC;EACpB,MAAMI,MAAM,GAAGX,OAAO,CAACY,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIC,wBAAiB,CAACpB,IAAI,EAAEiB,MAAM,CAAC;EAC/CH,IAAI,CAACO,GAAG,CAACL,MAAM,CAACG,GAAG,CAAC;EACpBL,IAAI,CAACQ,OAAO,CAAC,CAAC;EACdhB,OAAO,CAACiB,KAAK,CAAC,CAAC;EACf,OAAOjB,OAAO,CAACkB,iBAAiB,CAAC,CAAC;AACpC,CAAC;AAACd,OAAA,CAAAE,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_web","require","_Reconciler","_types","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","Skia","makeOffscreenSurface","width","height","JsiSkApi","CanvasKit","surface","Surface","MakeOffscreen","Error","getSkiaExports","drawOffscreen","element","root","SkiaRoot","render","canvas","getCanvas","ctx","JsiDrawingContext","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":";;;;;;;;;;;AAKA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AAAAI,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAVA;AACA;;AAWA,IAAIS,IAAiC;AAE9B,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAG,IAAAI,aAAQ,EAACC,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGN,IAAI,CAACO,OAAO,CAACC,aAAa,CAACN,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIG,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAACV,OAAA,CAAAK,oBAAA,GAAAA,oBAAA;AAEK,MAAMS,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACV,IAAI,EAAE;IACTA,IAAI,GAAG,IAAAI,aAAQ,EAACC,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEL;EAAK,CAAC;AACjB,CAAC;AAACJ,OAAA,CAAAc,cAAA,GAAAA,cAAA;AAEK,MAAMC,aAAa,GAAGA,CAACL,OAAkB,EAAEM,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAIC,oBAAQ,CAACd,IAAI,EAAE,KAAK,CAAC;EACtCa,IAAI,CAACE,MAAM,CAACH,OAAO,CAAC;EACpB,MAAMI,MAAM,GAAGV,OAAO,CAACW,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIC,wBAAiB,CAACnB,IAAI,EAAEgB,MAAM,CAAC;EAC/CH,IAAI,CAACO,GAAG,CAACL,MAAM,CAACG,GAAG,CAAC;EACpBL,IAAI,CAACQ,OAAO,CAAC,CAAC;EACdf,OAAO,CAACgB,KAAK,CAAC,CAAC;EACf,OAAOhB,OAAO,CAACiB,iBAAiB,CAAC,CAAC;AACpC,CAAC;AAAC3B,OAAA,CAAAe,aAAA,GAAAA,aAAA"}
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { SkSurface } from "../skia";
3
+ export * from "../renderer/components";
3
4
  export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
4
5
  export declare const getSkiaExports: () => {
5
6
  Skia: import("../skia/types").Skia;
@@ -4,6 +4,7 @@
4
4
  import { JsiSkApi } from "../skia/web";
5
5
  import { SkiaRoot } from "../renderer/Reconciler";
6
6
  import { JsiDrawingContext } from "../dom/types";
7
+ export * from "../renderer/components";
7
8
  let Skia;
8
9
  export const makeOffscreenSurface = (width, height) => {
9
10
  if (!Skia) {
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkApi","SkiaRoot","JsiDrawingContext","Skia","makeOffscreenSurface","width","height","CanvasKit","surface","Surface","MakeOffscreen","Error","getSkiaExports","drawOffscreen","element","root","render","canvas","getCanvas","ctx","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":"AAAA;AACA;;AAIA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,cAAc;AAGhD,IAAIC,IAAiC;AAErC,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGL,IAAI,CAACM,OAAO,CAACC,aAAa,CAACL,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAED,OAAO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACT,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEJ;EAAK,CAAC;AACjB,CAAC;AAED,OAAO,MAAMU,aAAa,GAAGA,CAACL,OAAkB,EAAEM,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAId,QAAQ,CAACE,IAAI,EAAE,KAAK,CAAC;EACtCY,IAAI,CAACC,MAAM,CAACF,OAAO,CAAC;EACpB,MAAMG,MAAM,GAAGT,OAAO,CAACU,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIjB,iBAAiB,CAACC,IAAI,EAAEc,MAAM,CAAC;EAC/CF,IAAI,CAACK,GAAG,CAACJ,MAAM,CAACG,GAAG,CAAC;EACpBJ,IAAI,CAACM,OAAO,CAAC,CAAC;EACdb,OAAO,CAACc,KAAK,CAAC,CAAC;EACf,OAAOd,OAAO,CAACe,iBAAiB,CAAC,CAAC;AACpC,CAAC"}
1
+ {"version":3,"names":["JsiSkApi","SkiaRoot","JsiDrawingContext","Skia","makeOffscreenSurface","width","height","CanvasKit","surface","Surface","MakeOffscreen","Error","getSkiaExports","drawOffscreen","element","root","render","canvas","getCanvas","ctx","dom","unmount","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\nlet Skia: ReturnType<typeof JsiSkApi>;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const getSkiaExports = () => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n return { Skia };\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n root.unmount();\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":"AAAA;AACA;;AAIA,SAASA,QAAQ,QAAQ,aAAa;AACtC,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,iBAAiB,QAAQ,cAAc;AAGhD,cAAc,wBAAwB;AAEtC,IAAIC,IAAiC;AAErC,OAAO,MAAMC,oBAAoB,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EACrE,IAAI,CAACH,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,MAAMC,OAAO,GAAGL,IAAI,CAACM,OAAO,CAACC,aAAa,CAACL,KAAK,EAAEC,MAAM,CAAC;EACzD,IAAIE,OAAO,KAAK,IAAI,EAAE;IACpB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,OAAOH,OAAO;AAChB,CAAC;AAED,OAAO,MAAMI,cAAc,GAAGA,CAAA,KAAM;EAClC,IAAI,CAACT,IAAI,EAAE;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAS,CAAC;EAC5B;EACA,OAAO;IAAEJ;EAAK,CAAC;AACjB,CAAC;AAED,OAAO,MAAMU,aAAa,GAAGA,CAACL,OAAkB,EAAEM,OAAkB,KAAK;EACvE,MAAMC,IAAI,GAAG,IAAId,QAAQ,CAACE,IAAI,EAAE,KAAK,CAAC;EACtCY,IAAI,CAACC,MAAM,CAACF,OAAO,CAAC;EACpB,MAAMG,MAAM,GAAGT,OAAO,CAACU,SAAS,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,IAAIjB,iBAAiB,CAACC,IAAI,EAAEc,MAAM,CAAC;EAC/CF,IAAI,CAACK,GAAG,CAACJ,MAAM,CAACG,GAAG,CAAC;EACpBJ,IAAI,CAACM,OAAO,CAAC,CAAC;EACdb,OAAO,CAACc,KAAK,CAAC,CAAC;EACf,OAAOd,OAAO,CAACe,iBAAiB,CAAC,CAAC;AACpC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { SkSurface } from "../skia";
3
+ export * from "../renderer/components";
3
4
  export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
4
5
  export declare const getSkiaExports: () => {
5
6
  Skia: import("../skia/types").Skia;
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.0.5",
10
+ "version": "1.0.6",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -8,6 +8,8 @@ import { SkiaRoot } from "../renderer/Reconciler";
8
8
  import { JsiDrawingContext } from "../dom/types";
9
9
  import type { SkSurface } from "../skia";
10
10
 
11
+ export * from "../renderer/components";
12
+
11
13
  let Skia: ReturnType<typeof JsiSkApi>;
12
14
 
13
15
  export const makeOffscreenSurface = (width: number, height: number) => {