@shopify/react-native-skia 2.12.0 → 2.13.1

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 (130) hide show
  1. package/LICENSE.md +2 -1
  2. package/Package.swift +4 -4
  3. package/android/CMakeLists.txt +22 -177
  4. package/android/build.gradle +40 -209
  5. package/android/cpp/jni/JniSkiaManager.cpp +3 -45
  6. package/android/cpp/jni/include/JniPlatformContext.h +1 -1
  7. package/android/cpp/jni/include/JniSkiaBaseView.h +18 -11
  8. package/android/cpp/jni/include/JniSkiaManager.h +3 -4
  9. package/android/cpp/jni/include/JniSkiaPictureView.h +5 -5
  10. package/android/cpp/rnskia-android/OpenGLContext.h +1 -1
  11. package/android/cpp/rnskia-android/RNSkAndroidView.h +6 -6
  12. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
  13. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  14. package/android/cpp/rnskia-android/gl/Surface.h +1 -1
  15. package/android/src/main/AndroidManifest.xml +1 -1
  16. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/PlatformContext.java +1 -1
  17. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkVideo.java +1 -1
  18. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkiaModule.java +1 -8
  19. package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +57 -0
  20. package/android/src/main/java/com/reactnative/skia/SkiaBaseView.java +185 -0
  21. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaBaseViewManager.java +20 -1
  22. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaManager.java +11 -6
  23. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureView.java +3 -3
  24. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureViewManager.java +1 -1
  25. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaSurfaceView.java +13 -3
  26. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaTextureView.java +5 -3
  27. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaViewAPI.java +1 -1
  28. package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/ViewScreenshotService.java +1 -1
  29. package/apple/MetalContext.mm +1 -1
  30. package/apple/RNSkiaModule.h +1 -10
  31. package/apple/RNSkiaModule.mm +2 -10
  32. package/apple/SkiaManager.h +0 -2
  33. package/apple/SkiaManager.mm +4 -6
  34. package/apple/SkiaPictureView.h +2 -2
  35. package/apple/SkiaPictureView.mm +0 -4
  36. package/apple/SkiaUIView.h +3 -18
  37. package/apple/SkiaUIView.mm +0 -30
  38. package/cpp/api/CustomBlendModes.h +17 -0
  39. package/cpp/api/JsiSkCanvas.h +19 -10
  40. package/cpp/api/JsiSkImage.h +1 -1
  41. package/cpp/api/JsiSkImageFilter.h +3 -1
  42. package/cpp/api/JsiSkParagraph.h +2 -1
  43. package/cpp/api/JsiSkParagraphBuilder.h +1 -1
  44. package/cpp/api/JsiSkParagraphBuilderFactory.h +1 -1
  45. package/cpp/api/JsiSkPath.h +11 -4
  46. package/cpp/api/JsiSkPathBuilder.h +11 -4
  47. package/cpp/api/JsiSkPictureRecorder.h +2 -1
  48. package/cpp/api/JsiSkShader.h +3 -1
  49. package/cpp/api/JsiSkSkottie.h +27 -25
  50. package/cpp/api/recorder/Command.h +1 -1
  51. package/cpp/api/recorder/Convertor.h +1 -1
  52. package/cpp/api/recorder/DataTypes.h +1 -1
  53. package/cpp/api/recorder/DrawingCtx.h +1 -1
  54. package/cpp/api/recorder/JsiRecorder.h +7 -4
  55. package/cpp/api/third_party/base64.cpp +1 -1
  56. package/cpp/jsi/JSICache.cpp +23 -0
  57. package/cpp/jsi/JSICache.h +28 -1
  58. package/cpp/jsi/NativeObject.h +36 -7
  59. package/cpp/jsi/ViewProperty.h +0 -4
  60. package/cpp/rnskia/RNDawnContext.h +1 -1
  61. package/lib/commonjs/animation/functions/interpolatePaths.js +18 -0
  62. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  63. package/lib/commonjs/mock/index.js +0 -1
  64. package/lib/commonjs/mock/index.js.map +1 -1
  65. package/lib/commonjs/renderer/Canvas.d.ts +11 -3
  66. package/lib/commonjs/renderer/Canvas.js +8 -6
  67. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  68. package/lib/commonjs/skia/web/JsiSkCanvas.js +9 -4
  69. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  70. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  71. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  72. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  73. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +3 -0
  74. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
  75. package/lib/commonjs/views/SkiaPictureView.js +2 -12
  76. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  77. package/lib/commonjs/views/types.d.ts +19 -8
  78. package/lib/commonjs/views/types.js.map +1 -1
  79. package/lib/module/animation/functions/interpolatePaths.js +18 -0
  80. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  81. package/lib/module/mock/index.js +0 -1
  82. package/lib/module/mock/index.js.map +1 -1
  83. package/lib/module/renderer/Canvas.d.ts +11 -3
  84. package/lib/module/renderer/Canvas.js +7 -5
  85. package/lib/module/renderer/Canvas.js.map +1 -1
  86. package/lib/module/skia/web/JsiSkCanvas.js +9 -4
  87. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  88. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  89. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  90. package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  91. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +3 -0
  92. package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
  93. package/lib/module/views/SkiaPictureView.js +2 -12
  94. package/lib/module/views/SkiaPictureView.js.map +1 -1
  95. package/lib/module/views/types.d.ts +19 -8
  96. package/lib/module/views/types.js.map +1 -1
  97. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  98. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
  99. package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  100. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  101. package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -2
  102. package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  103. package/lib/typescript/src/renderer/Canvas.d.ts +11 -3
  104. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
  105. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
  106. package/lib/typescript/src/views/types.d.ts +19 -8
  107. package/package.json +3 -3
  108. package/react-native-skia.podspec +4 -10
  109. package/src/animation/functions/interpolatePaths.ts +24 -0
  110. package/src/mock/index.ts +0 -1
  111. package/src/renderer/Canvas.tsx +23 -5
  112. package/src/skia/web/JsiSkCanvas.ts +14 -9
  113. package/src/specs/SkiaPictureViewNativeComponent.ts +5 -0
  114. package/src/specs/SkiaPictureViewNativeComponent.web.ts +5 -0
  115. package/src/views/SkiaPictureView.tsx +2 -10
  116. package/src/views/types.ts +23 -10
  117. package/android/src/latest/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -11
  118. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +0 -79
  119. package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +0 -113
  120. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -136
  121. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +0 -41
  122. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +0 -20
  123. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +0 -35
  124. package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +0 -17
  125. package/android/src/paper/java/com/shopify/reactnative/skia/NativeSkiaModuleSpec.java +0 -38
  126. package/android/src/reactnative74/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -14
  127. package/apple/SkiaPictureViewManager.h +0 -8
  128. package/apple/SkiaPictureViewManager.mm +0 -60
  129. package/apple/SkiaWebGPUView.h +0 -20
  130. package/apple/WebGPUMetalView.h +0 -12
@@ -1,20 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaInterface.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
- import androidx.annotation.Nullable;
14
-
15
- public interface SkiaPictureViewManagerInterface<T extends View> {
16
- void setDebug(T view, boolean value);
17
- void setOpaque(T view, boolean value);
18
- void setColorSpace(T view, @Nullable String value);
19
- void setAndroidWarmup(T view, boolean value);
20
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaDelegate.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
- import androidx.annotation.Nullable;
14
- import com.facebook.react.uimanager.BaseViewManagerDelegate;
15
- import com.facebook.react.uimanager.BaseViewManager;
16
- import com.facebook.react.uimanager.LayoutShadowNode;
17
-
18
- public class SkiaWebGPUViewManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SkiaWebGPUViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
- public SkiaWebGPUViewManagerDelegate(U viewManager) {
20
- super(viewManager);
21
- }
22
- @Override
23
- public void setProperty(T view, String propName, @Nullable Object value) {
24
- switch (propName) {
25
- case "contextId":
26
- mViewManager.setContextId(view, value == null ? 0 : ((Double) value).intValue());
27
- break;
28
- case "transparent":
29
- mViewManager.setTransparent(view, value != null && (boolean) value);
30
- break;
31
- default:
32
- super.setProperty(view, propName, value);
33
- }
34
- }
35
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
- *
4
- * Do not edit this file as changes may cause incorrect behavior and will be lost
5
- * once the code is regenerated.
6
- *
7
- * @generated by codegen project: GeneratePropsJavaInterface.js
8
- */
9
-
10
- package com.facebook.react.viewmanagers;
11
-
12
- import android.view.View;
13
-
14
- public interface SkiaWebGPUViewManagerInterface<T extends View> {
15
- void setContextId(T view, int value);
16
- void setTransparent(T view, boolean value);
17
- }
@@ -1,38 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.shopify.reactnative.skia;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.ReactApplicationContext;
17
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
- import com.facebook.react.bridge.ReactMethod;
19
- import com.facebook.react.bridge.ReactModuleWithSpec;
20
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
21
- import javax.annotation.Nonnull;
22
-
23
- public abstract class NativeSkiaModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
24
- public static final String NAME = "RNSkiaModule";
25
-
26
- public NativeSkiaModuleSpec(ReactApplicationContext reactContext) {
27
- super(reactContext);
28
- }
29
-
30
- @Override
31
- public @Nonnull String getName() {
32
- return NAME;
33
- }
34
-
35
- @ReactMethod(isBlockingSynchronousMethod = true)
36
- @DoNotStrip
37
- public abstract boolean install();
38
- }
@@ -1,14 +0,0 @@
1
- package com.shopify.reactnative.skia;
2
-
3
- import androidx.annotation.OptIn;
4
-
5
- import com.facebook.react.bridge.ReactContext;
6
- import com.facebook.react.bridge.RuntimeExecutor;
7
- import com.facebook.react.common.annotations.FrameworkAPI;
8
-
9
- /* package */ final class ReactNativeCompatible {
10
- @OptIn(markerClass = FrameworkAPI.class)
11
- public static RuntimeExecutor getRuntimeExecutor(ReactContext context) {
12
- return context.getRuntimeExecutor();
13
- }
14
- }
@@ -1,8 +0,0 @@
1
-
2
- #pragma once
3
-
4
- #import <React/RCTViewManager.h>
5
-
6
- @interface SkiaPictureViewManager : RCTViewManager
7
-
8
- @end
@@ -1,60 +0,0 @@
1
-
2
- #include "SkiaPictureViewManager.h"
3
- #include <React/RCTBridge+Private.h>
4
-
5
- #include "RNSkAppleView.h"
6
- #include "RNSkPictureView.h"
7
- #include "RNSkPlatformContext.h"
8
-
9
- #include "RNSkiaModule.h"
10
- #include "SkiaManager.h"
11
- #include "SkiaUIView.h"
12
-
13
- @implementation SkiaPictureViewManager
14
-
15
- RCT_EXPORT_MODULE(SkiaPictureView)
16
-
17
- - (SkiaManager *)skiaManager {
18
- auto bridge = self.bridge;
19
- RCTAssert(bridge, @"Bridge must not be nil.");
20
- auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkiaModule"];
21
- return [skiaModule manager];
22
- }
23
-
24
- RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, SkiaUIView) {
25
- // Get parameter
26
- int nativeId = [[RCTConvert NSString:json] intValue];
27
- [(SkiaUIView *)view setNativeId:nativeId];
28
- }
29
-
30
- RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, SkiaUIView) {
31
- bool debug = json != NULL ? [RCTConvert BOOL:json] : false;
32
- [(SkiaUIView *)view setDebugMode:debug];
33
- }
34
-
35
- RCT_CUSTOM_VIEW_PROPERTY(opaque, BOOL, SkiaUIView) {
36
- bool opaque = json != NULL ? [RCTConvert BOOL:json] : false;
37
- [(SkiaUIView *)view setOpaque:opaque];
38
- }
39
-
40
- RCT_CUSTOM_VIEW_PROPERTY(highBitDepth, BOOL, SkiaUIView) {
41
- bool highBitDepth = json != NULL ? [RCTConvert BOOL:json] : false;
42
- [(SkiaUIView *)view setHighBitDepth:highBitDepth];
43
- }
44
-
45
- #if !TARGET_OS_OSX
46
- - (UIView *)view {
47
- #else
48
- - (RCTUIView *)view {
49
- #endif // !TARGET_OS_OSX
50
- auto skManager = [[self skiaManager] skManager];
51
- // Pass SkManager as a raw pointer to avoid circular dependenciesr
52
- return [[SkiaUIView alloc]
53
- initWithManager:skManager.get()
54
- factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
55
- return std::make_shared<RNSkAppleView<RNSkia::RNSkPictureView>>(
56
- context);
57
- }];
58
- }
59
-
60
- @end
@@ -1,20 +0,0 @@
1
- #pragma once
2
-
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
-
5
- #import "WebGPUMetalView.h"
6
- #import <React/RCTViewComponentView.h>
7
- #if !TARGET_OS_OSX
8
- #import <UIKit/UIKit.h>
9
- #else
10
- #import <AppKit/AppKit.h>
11
- #endif
12
-
13
- NS_ASSUME_NONNULL_BEGIN
14
-
15
- @interface SkiaWebGPUView : RCTViewComponentView
16
- @end
17
-
18
- NS_ASSUME_NONNULL_END
19
-
20
- #endif // RCT_NEW_ARCH_ENABLED
@@ -1,12 +0,0 @@
1
- #pragma once
2
-
3
- #import "RNSkUIKit.h"
4
-
5
- @interface WebGPUMetalView : RNSkPlatformView
6
-
7
- @property(nonatomic, strong) NSNumber *contextId;
8
-
9
- - (void)configure;
10
- - (void)update;
11
-
12
- @end