@shopify/react-native-skia 0.1.164 → 0.1.166

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +16 -5
  2. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +34 -0
  3. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +2 -47
  4. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawViewManager.java +2 -44
  5. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureViewManager.java +2 -47
  6. package/cpp/api/JsiSkRuntimeEffect.h +7 -2
  7. package/cpp/rnskia/RNSkDomView.cpp +1 -1
  8. package/cpp/rnskia/RNSkPlatformContext.h +2 -6
  9. package/cpp/rnskia/dom/base/DerivedNodeProp.h +4 -4
  10. package/cpp/rnskia/dom/base/DrawingContext.cpp +5 -38
  11. package/cpp/rnskia/dom/base/DrawingContext.h +3 -17
  12. package/cpp/rnskia/dom/nodes/JsiBoxNode.h +4 -4
  13. package/cpp/rnskia/dom/nodes/JsiCircleNode.h +0 -2
  14. package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +1 -3
  15. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +2 -2
  16. package/cpp/rnskia/dom/nodes/JsiPathNode.h +12 -5
  17. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +17 -7
  18. package/cpp/rnskia/dom/props/CircleProp.h +2 -0
  19. package/cpp/rnskia/dom/props/ClipProp.h +6 -6
  20. package/cpp/rnskia/dom/props/ColorProp.h +9 -4
  21. package/cpp/rnskia/dom/props/ImageProps.h +6 -3
  22. package/cpp/rnskia/dom/props/PaintProps.h +15 -22
  23. package/cpp/rnskia/dom/props/RectProp.h +11 -4
  24. package/cpp/rnskia/dom/props/UniformsProp.h +86 -123
  25. package/cpp/rnskia/dom/props/VerticesProps.h +2 -2
  26. package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -6
  27. package/lib/commonjs/dom/nodes/datatypes/Circle.js +6 -1
  28. package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
  29. package/lib/commonjs/dom/nodes/datatypes/Rect.js +3 -3
  30. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  31. package/lib/commonjs/dom/nodes/drawings/Box.js +1 -1
  32. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  33. package/lib/commonjs/dom/nodes/drawings/ImageNode.js +2 -2
  34. package/lib/commonjs/dom/nodes/drawings/ImageNode.js.map +1 -1
  35. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
  36. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  37. package/lib/commonjs/dom/nodes/paint/Shaders.js +5 -2
  38. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  39. package/lib/commonjs/dom/types/Common.js.map +1 -1
  40. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  41. package/lib/commonjs/renderer/components/Mask.js +2 -6
  42. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  43. package/lib/commonjs/renderer/components/image/Image.js +0 -5
  44. package/lib/commonjs/renderer/components/image/Image.js.map +1 -1
  45. package/lib/commonjs/renderer/components/image/ImageShader.js +20 -10
  46. package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
  47. package/lib/commonjs/renderer/components/imageFilters/Blur.js +10 -5
  48. package/lib/commonjs/renderer/components/imageFilters/Blur.js.map +1 -1
  49. package/lib/commonjs/renderer/components/imageFilters/Morphology.js +10 -5
  50. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  51. package/lib/commonjs/renderer/components/imageFilters/Offset.js +12 -6
  52. package/lib/commonjs/renderer/components/imageFilters/Offset.js.map +1 -1
  53. package/lib/commonjs/renderer/components/maskFilters/Blur.js +12 -6
  54. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  55. package/lib/commonjs/renderer/components/pathEffects/Discrete.js +10 -5
  56. package/lib/commonjs/renderer/components/pathEffects/Discrete.js.map +1 -1
  57. package/lib/commonjs/renderer/components/shaders/FractalNoise.js +14 -7
  58. package/lib/commonjs/renderer/components/shaders/FractalNoise.js.map +1 -1
  59. package/lib/commonjs/renderer/components/shaders/Shader.js +10 -5
  60. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  61. package/lib/commonjs/renderer/components/shaders/Turbulence.js +14 -7
  62. package/lib/commonjs/renderer/components/shaders/Turbulence.js.map +1 -1
  63. package/lib/commonjs/renderer/components/shapes/Circle.js +0 -6
  64. package/lib/commonjs/renderer/components/shapes/Circle.js.map +1 -1
  65. package/lib/commonjs/renderer/components/shapes/FitBox.js +1 -4
  66. package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
  67. package/lib/commonjs/renderer/components/shapes/Oval.js +0 -4
  68. package/lib/commonjs/renderer/components/shapes/Oval.js.map +1 -1
  69. package/lib/commonjs/renderer/components/shapes/Path.js +12 -6
  70. package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
  71. package/lib/commonjs/renderer/components/shapes/Points.js +10 -5
  72. package/lib/commonjs/renderer/components/shapes/Points.js.map +1 -1
  73. package/lib/commonjs/renderer/components/shapes/RoundedRect.js +0 -3
  74. package/lib/commonjs/renderer/components/shapes/RoundedRect.js.map +1 -1
  75. package/lib/commonjs/renderer/components/shapes/Vertices.js +10 -5
  76. package/lib/commonjs/renderer/components/shapes/Vertices.js.map +1 -1
  77. package/lib/commonjs/renderer/components/text/Glyphs.js +12 -6
  78. package/lib/commonjs/renderer/components/text/Glyphs.js.map +1 -1
  79. package/lib/commonjs/renderer/components/text/Text.js +12 -6
  80. package/lib/commonjs/renderer/components/text/Text.js.map +1 -1
  81. package/lib/commonjs/renderer/components/text/TextBlob.js +12 -6
  82. package/lib/commonjs/renderer/components/text/TextBlob.js.map +1 -1
  83. package/lib/commonjs/renderer/components/text/TextPath.js +10 -5
  84. package/lib/commonjs/renderer/components/text/TextPath.js.map +1 -1
  85. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  86. package/lib/commonjs/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  87. package/lib/commonjs/skia/types/Shader/Shader.js +25 -25
  88. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  89. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -1
  90. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  91. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js +1 -1
  92. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -1
  93. package/lib/module/dom/nodes/datatypes/Circle.js +8 -1
  94. package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
  95. package/lib/module/dom/nodes/datatypes/Rect.js +7 -3
  96. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  97. package/lib/module/dom/nodes/drawings/Box.js +1 -1
  98. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  99. package/lib/module/dom/nodes/drawings/ImageNode.js +4 -2
  100. package/lib/module/dom/nodes/drawings/ImageNode.js.map +1 -1
  101. package/lib/module/dom/nodes/paint/ImageFilters.js +1 -1
  102. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  103. package/lib/module/dom/nodes/paint/Shaders.js +5 -4
  104. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  105. package/lib/module/dom/types/Common.js.map +1 -1
  106. package/lib/module/dom/types/Drawings.js.map +1 -1
  107. package/lib/module/renderer/components/Mask.js +2 -6
  108. package/lib/module/renderer/components/Mask.js.map +1 -1
  109. package/lib/module/renderer/components/image/Image.js +0 -5
  110. package/lib/module/renderer/components/image/Image.js.map +1 -1
  111. package/lib/module/renderer/components/image/ImageShader.js +20 -10
  112. package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
  113. package/lib/module/renderer/components/imageFilters/Blur.js +10 -5
  114. package/lib/module/renderer/components/imageFilters/Blur.js.map +1 -1
  115. package/lib/module/renderer/components/imageFilters/Morphology.js +10 -5
  116. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  117. package/lib/module/renderer/components/imageFilters/Offset.js +12 -6
  118. package/lib/module/renderer/components/imageFilters/Offset.js.map +1 -1
  119. package/lib/module/renderer/components/maskFilters/Blur.js +12 -6
  120. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  121. package/lib/module/renderer/components/pathEffects/Discrete.js +10 -5
  122. package/lib/module/renderer/components/pathEffects/Discrete.js.map +1 -1
  123. package/lib/module/renderer/components/shaders/FractalNoise.js +14 -7
  124. package/lib/module/renderer/components/shaders/FractalNoise.js.map +1 -1
  125. package/lib/module/renderer/components/shaders/Shader.js +10 -5
  126. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  127. package/lib/module/renderer/components/shaders/Turbulence.js +14 -7
  128. package/lib/module/renderer/components/shaders/Turbulence.js.map +1 -1
  129. package/lib/module/renderer/components/shapes/Circle.js +0 -6
  130. package/lib/module/renderer/components/shapes/Circle.js.map +1 -1
  131. package/lib/module/renderer/components/shapes/FitBox.js +1 -4
  132. package/lib/module/renderer/components/shapes/FitBox.js.map +1 -1
  133. package/lib/module/renderer/components/shapes/Oval.js +0 -4
  134. package/lib/module/renderer/components/shapes/Oval.js.map +1 -1
  135. package/lib/module/renderer/components/shapes/Path.js +12 -6
  136. package/lib/module/renderer/components/shapes/Path.js.map +1 -1
  137. package/lib/module/renderer/components/shapes/Points.js +10 -5
  138. package/lib/module/renderer/components/shapes/Points.js.map +1 -1
  139. package/lib/module/renderer/components/shapes/RoundedRect.js +0 -3
  140. package/lib/module/renderer/components/shapes/RoundedRect.js.map +1 -1
  141. package/lib/module/renderer/components/shapes/Vertices.js +10 -5
  142. package/lib/module/renderer/components/shapes/Vertices.js.map +1 -1
  143. package/lib/module/renderer/components/text/Glyphs.js +12 -6
  144. package/lib/module/renderer/components/text/Glyphs.js.map +1 -1
  145. package/lib/module/renderer/components/text/Text.js +12 -6
  146. package/lib/module/renderer/components/text/Text.js.map +1 -1
  147. package/lib/module/renderer/components/text/TextBlob.js +12 -6
  148. package/lib/module/renderer/components/text/TextBlob.js.map +1 -1
  149. package/lib/module/renderer/components/text/TextPath.js +10 -5
  150. package/lib/module/renderer/components/text/TextPath.js.map +1 -1
  151. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  152. package/lib/module/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  153. package/lib/module/skia/types/Shader/Shader.js +25 -25
  154. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  155. package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -1
  156. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  157. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js +1 -1
  158. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -1
  159. package/lib/typescript/src/dom/nodes/datatypes/Circle.d.ts +4 -1
  160. package/lib/typescript/src/dom/types/Common.d.ts +4 -4
  161. package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
  162. package/lib/typescript/src/renderer/components/Mask.d.ts +3 -9
  163. package/lib/typescript/src/renderer/components/image/Image.d.ts +1 -8
  164. package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +2 -12
  165. package/lib/typescript/src/renderer/components/imageFilters/Blur.d.ts +2 -7
  166. package/lib/typescript/src/renderer/components/imageFilters/Morphology.d.ts +2 -7
  167. package/lib/typescript/src/renderer/components/imageFilters/Offset.d.ts +2 -8
  168. package/lib/typescript/src/renderer/components/maskFilters/Blur.d.ts +2 -8
  169. package/lib/typescript/src/renderer/components/pathEffects/Discrete.d.ts +2 -7
  170. package/lib/typescript/src/renderer/components/shaders/FractalNoise.d.ts +2 -9
  171. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -7
  172. package/lib/typescript/src/renderer/components/shaders/Turbulence.d.ts +2 -9
  173. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -9
  174. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +2 -7
  175. package/lib/typescript/src/renderer/components/shapes/Oval.d.ts +1 -7
  176. package/lib/typescript/src/renderer/components/shapes/Path.d.ts +2 -8
  177. package/lib/typescript/src/renderer/components/shapes/Points.d.ts +2 -7
  178. package/lib/typescript/src/renderer/components/shapes/RoundedRect.d.ts +1 -6
  179. package/lib/typescript/src/renderer/components/shapes/Vertices.d.ts +2 -7
  180. package/lib/typescript/src/renderer/components/text/Glyphs.d.ts +2 -8
  181. package/lib/typescript/src/renderer/components/text/Text.d.ts +2 -8
  182. package/lib/typescript/src/renderer/components/text/TextBlob.d.ts +2 -8
  183. package/lib/typescript/src/renderer/components/text/TextPath.d.ts +2 -7
  184. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +5 -0
  185. package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +4 -0
  186. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -2
  187. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +3 -1
  188. package/package.json +1 -1
  189. package/src/dom/nodes/datatypes/Circle.ts +1 -1
  190. package/src/dom/nodes/datatypes/Rect.ts +3 -3
  191. package/src/dom/nodes/drawings/Box.ts +1 -1
  192. package/src/dom/nodes/drawings/ImageNode.ts +2 -1
  193. package/src/dom/nodes/paint/ImageFilters.ts +1 -1
  194. package/src/dom/nodes/paint/Shaders.ts +5 -5
  195. package/src/dom/types/Common.ts +4 -4
  196. package/src/dom/types/Drawings.ts +1 -1
  197. package/src/renderer/components/Mask.tsx +8 -8
  198. package/src/renderer/components/image/Image.tsx +0 -6
  199. package/src/renderer/components/image/ImageShader.tsx +24 -12
  200. package/src/renderer/components/imageFilters/Blur.tsx +6 -7
  201. package/src/renderer/components/imageFilters/Morphology.tsx +6 -7
  202. package/src/renderer/components/imageFilters/Offset.tsx +7 -8
  203. package/src/renderer/components/maskFilters/Blur.tsx +7 -8
  204. package/src/renderer/components/pathEffects/Discrete.tsx +6 -9
  205. package/src/renderer/components/shaders/FractalNoise.tsx +18 -9
  206. package/src/renderer/components/shaders/Shader.tsx +6 -7
  207. package/src/renderer/components/shaders/Turbulence.tsx +15 -9
  208. package/src/renderer/components/shapes/Circle.tsx +0 -4
  209. package/src/renderer/components/shapes/FitBox.tsx +2 -6
  210. package/src/renderer/components/shapes/Oval.tsx +0 -5
  211. package/src/renderer/components/shapes/Path.tsx +7 -8
  212. package/src/renderer/components/shapes/Points.tsx +6 -7
  213. package/src/renderer/components/shapes/RoundedRect.tsx +0 -4
  214. package/src/renderer/components/shapes/Vertices.tsx +6 -7
  215. package/src/renderer/components/text/Glyphs.tsx +7 -8
  216. package/src/renderer/components/text/Text.tsx +7 -8
  217. package/src/renderer/components/text/TextBlob.tsx +7 -8
  218. package/src/renderer/components/text/TextPath.tsx +6 -7
  219. package/src/renderer/processors/Animations/Animations.ts +9 -3
  220. package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +5 -0
  221. package/src/skia/types/Shader/Shader.ts +30 -36
  222. package/src/skia/web/JsiSkRuntimeEffect.ts +5 -1
  223. package/src/skia/web/JsiSkRuntimeEffectFactory.ts +1 -1
@@ -1,11 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { SkiaProps } from "../../processors";
3
3
  import type { ImageProps } from "../../../dom/types";
4
- export declare const Image: {
5
- (props: SkiaProps<ImageProps>): JSX.Element;
6
- defaultProps: {
7
- x: number;
8
- y: number;
9
- fit: string;
10
- };
11
- };
4
+ export declare const Image: (props: SkiaProps<ImageProps>) => JSX.Element;
@@ -1,14 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { ImageShaderProps } from "../../../dom/types";
3
- import type { SkiaProps } from "../../processors";
4
- export declare const ImageShader: {
5
- (props: SkiaProps<ImageShaderProps>): JSX.Element;
6
- defaultProps: {
7
- readonly tx: "decal";
8
- readonly ty: "decal";
9
- readonly fm: "nearest";
10
- readonly mm: "none";
11
- readonly fit: "none";
12
- readonly transform: readonly [];
13
- };
14
- };
3
+ import type { SkiaDefaultProps } from "../../processors";
4
+ export declare const ImageShader: ({ tx, ty, fm, mm, fit, transform, ...props }: SkiaDefaultProps<ImageShaderProps, "tx" | "ty" | "fm" | "mm" | "fit" | "transform">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors/Animations/Animations";
2
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
3
3
  import type { BlurImageFilterProps } from "../../../dom/types";
4
- export declare const Blur: {
5
- (props: SkiaProps<BlurImageFilterProps>): JSX.Element;
6
- defaultProps: {
7
- mode: string;
8
- };
9
- };
4
+ export declare const Blur: ({ mode, ...props }: SkiaDefaultProps<BlurImageFilterProps, "mode">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { MorphologyImageFilterProps } from "../../../dom/types";
3
- import type { SkiaProps } from "../../processors";
4
- export declare const Morphology: {
5
- (props: SkiaProps<MorphologyImageFilterProps>): JSX.Element;
6
- defaultProps: {
7
- operator: string;
8
- };
9
- };
3
+ import type { SkiaDefaultProps } from "../../processors";
4
+ export declare const Morphology: ({ operator, ...props }: SkiaDefaultProps<MorphologyImageFilterProps, "operator">) => JSX.Element;
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors/Animations/Animations";
2
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
3
3
  import type { OffsetImageFilterProps } from "../../../dom/types";
4
- export declare const Offset: {
5
- (props: SkiaProps<OffsetImageFilterProps>): JSX.Element;
6
- defaultProps: {
7
- x: number;
8
- y: number;
9
- };
10
- };
4
+ export declare const Offset: ({ x, y, ...props }: SkiaDefaultProps<OffsetImageFilterProps, "x" | "y">) => JSX.Element;
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { BlurMaskFilterProps } from "../../../dom/types";
3
- import type { SkiaProps } from "../../processors/Animations/Animations";
4
- export declare const BlurMask: {
5
- (props: SkiaProps<BlurMaskFilterProps>): JSX.Element;
6
- defaultProps: {
7
- style: string;
8
- respectCTM: boolean;
9
- };
10
- };
3
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
4
+ export declare const BlurMask: ({ style, respectCTM, ...props }: SkiaDefaultProps<BlurMaskFilterProps, "style" | "respectCTM">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors/Animations/Animations";
2
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
3
3
  import type { DiscretePathEffectProps } from "../../../dom/types";
4
- export declare const DiscretePathEffect: {
5
- (props: SkiaProps<DiscretePathEffectProps>): JSX.Element;
6
- defaultProps: {
7
- seed: number;
8
- };
9
- };
4
+ export declare const DiscretePathEffect: ({ seed, ...props }: SkiaDefaultProps<DiscretePathEffectProps, "seed">) => JSX.Element;
@@ -1,11 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { FractalNoiseProps } from "../../../dom/types";
3
- import type { SkiaProps } from "../../processors/Animations/Animations";
4
- export declare const FractalNoise: {
5
- (props: SkiaProps<FractalNoiseProps>): JSX.Element;
6
- defaultProps: {
7
- seed: number;
8
- tileWidth: number;
9
- tileHeight: number;
10
- };
11
- };
3
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
4
+ export declare const FractalNoise: ({ seed, tileWidth, tileHeight, ...props }: SkiaDefaultProps<FractalNoiseProps, "seed" | "tileHeight" | "tileWidth">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors";
2
+ import type { SkiaDefaultProps } from "../../processors";
3
3
  import type { ShaderProps } from "../../../dom/types";
4
- export declare const Shader: {
5
- (props: SkiaProps<ShaderProps>): JSX.Element;
6
- defaultProps: {
7
- uniforms: never[];
8
- };
9
- };
4
+ export declare const Shader: ({ uniforms, ...props }: SkiaDefaultProps<ShaderProps, "uniforms">) => JSX.Element;
@@ -1,11 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { TurbulenceProps } from "../../../dom/types";
3
- import type { SkiaProps } from "../../processors/Animations/Animations";
4
- export declare const Turbulence: {
5
- (props: SkiaProps<TurbulenceProps>): JSX.Element;
6
- defaultProps: {
7
- seed: number;
8
- tileWidth: number;
9
- tileHeight: number;
10
- };
11
- };
3
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
4
+ export declare const Turbulence: ({ seed, tileWidth, tileHeight, ...props }: SkiaDefaultProps<TurbulenceProps, "seed" | "tileWidth" | "tileHeight">) => JSX.Element;
@@ -1,12 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { SkiaProps } from "../../processors";
3
3
  import type { CircleProps } from "../../../dom/types";
4
- export declare const Circle: {
5
- (props: SkiaProps<CircleProps>): JSX.Element;
6
- defaultProps: {
7
- c: {
8
- x: number;
9
- y: number;
10
- };
11
- };
12
- };
4
+ export declare const Circle: (props: SkiaProps<CircleProps>) => JSX.Element;
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
2
2
  import type { Fit } from "../../../dom/nodes";
3
3
  import type { SkRect } from "../../../skia/types";
4
4
  interface FitProps {
5
- fit: Fit;
5
+ fit?: Fit;
6
6
  src: SkRect;
7
7
  dst: SkRect;
8
8
  children: ReactNode | ReactNode[];
@@ -16,10 +16,5 @@ export declare const fitbox: (fit: Fit, src: SkRect, dst: SkRect) => readonly [{
16
16
  }, {
17
17
  readonly scaleY: number;
18
18
  }];
19
- export declare const FitBox: {
20
- ({ fit, src, dst, children }: FitProps): JSX.Element;
21
- defaultProps: {
22
- fit: string;
23
- };
24
- };
19
+ export declare const FitBox: ({ fit, src, dst, children }: FitProps) => JSX.Element;
25
20
  export {};
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { OvalProps } from "../../../dom/types";
3
3
  import type { SkiaProps } from "../../processors";
4
- export declare const Oval: {
5
- (props: SkiaProps<OvalProps>): JSX.Element;
6
- defaultProps: {
7
- x: number;
8
- y: number;
9
- };
10
- };
4
+ export declare const Oval: (props: SkiaProps<OvalProps>) => JSX.Element;
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors";
2
+ import type { SkiaDefaultProps } from "../../processors";
3
3
  import type { PathProps } from "../../../dom/types";
4
- export declare const Path: {
5
- (props: SkiaProps<PathProps>): JSX.Element;
6
- defaultProps: {
7
- start: number;
8
- end: number;
9
- };
10
- };
4
+ export declare const Path: ({ start, end, ...props }: SkiaDefaultProps<PathProps, "start" | "end">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors/Animations/Animations";
2
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
3
3
  import type { PointsProps } from "../../../dom/types";
4
- export declare const Points: {
5
- (props: SkiaProps<PointsProps>): JSX.Element;
6
- defaultProps: {
7
- mode: string;
8
- };
9
- };
4
+ export declare const Points: ({ mode, ...props }: SkiaDefaultProps<PointsProps, "mode">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { RoundedRectProps } from "../../../dom/types";
3
3
  import type { SkiaProps } from "../../processors";
4
- export declare const RoundedRect: {
5
- (props: SkiaProps<RoundedRectProps>): JSX.Element;
6
- defaultProps: {
7
- r: number;
8
- };
9
- };
4
+ export declare const RoundedRect: (props: SkiaProps<RoundedRectProps>) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors";
2
+ import type { SkiaDefaultProps } from "../../processors";
3
3
  import type { VerticesProps } from "../../../dom/types";
4
- export declare const Vertices: {
5
- (props: SkiaProps<VerticesProps>): JSX.Element;
6
- defaultProps: {
7
- mode: string;
8
- };
9
- };
4
+ export declare const Vertices: ({ mode, ...props }: SkiaDefaultProps<VerticesProps, "mode">) => JSX.Element;
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import type { GlyphsProps } from "../../../dom/types";
3
- import type { SkiaProps } from "../../processors/Animations/Animations";
4
- export declare const Glyphs: {
5
- (props: SkiaProps<GlyphsProps>): JSX.Element;
6
- defaultProps: {
7
- x: number;
8
- y: number;
9
- };
10
- };
3
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
4
+ export declare const Glyphs: ({ x, y, ...props }: SkiaDefaultProps<GlyphsProps, "x" | "y">) => JSX.Element;
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors";
2
+ import type { SkiaDefaultProps } from "../../processors";
3
3
  import type { TextProps } from "../../../dom/types";
4
- export declare const Text: {
5
- (props: SkiaProps<TextProps>): JSX.Element;
6
- defaultProps: {
7
- x: number;
8
- y: number;
9
- };
10
- };
4
+ export declare const Text: ({ x, y, ...props }: SkiaDefaultProps<TextProps, "x" | "y">) => JSX.Element;
@@ -1,10 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors";
2
+ import type { SkiaDefaultProps } from "../../processors";
3
3
  import type { TextBlobProps } from "../../../dom/types";
4
- export declare const TextBlob: {
5
- (props: SkiaProps<TextBlobProps>): JSX.Element;
6
- defaultProps: {
7
- x: number;
8
- y: number;
9
- };
10
- };
4
+ export declare const TextBlob: ({ x, y, ...props }: SkiaDefaultProps<TextBlobProps, "x" | "y">) => JSX.Element;
@@ -1,9 +1,4 @@
1
1
  /// <reference types="react" />
2
- import type { SkiaProps } from "../../processors";
2
+ import type { SkiaDefaultProps } from "../../processors";
3
3
  import type { TextPathProps } from "../../../dom/types";
4
- export declare const TextPath: {
5
- (props: SkiaProps<TextPathProps>): JSX.Element;
6
- defaultProps: {
7
- initialOffset: number;
8
- };
9
- };
4
+ export declare const TextPath: ({ initialOffset, ...props }: SkiaDefaultProps<TextPathProps, "initialOffset">) => JSX.Element;
@@ -10,3 +10,8 @@ export declare type AnimatedProps<T, O extends keyof T | never = never> = {
10
10
  [K in keyof T]: K extends "children" ? T[K] : K extends O ? T[K] : AnimatedProp<T[K]>;
11
11
  };
12
12
  export declare type SkiaProps<P = object, O extends keyof P | never = never> = AnimatedProps<P, O>;
13
+ declare type WithOptional<T extends object, N extends keyof T> = Omit<T, N> & {
14
+ [K in N]?: T[K];
15
+ };
16
+ export declare type SkiaDefaultProps<T extends object, N extends keyof T> = WithOptional<SkiaProps<T>, N>;
17
+ export {};
@@ -45,4 +45,8 @@ export interface SkRuntimeEffect extends SkJSIInstance<"RuntimeEffect"> {
45
45
  * @param index
46
46
  */
47
47
  getUniformName(index: number): string;
48
+ /**
49
+ * Returns the SkSL source of the runtime effect shader.
50
+ */
51
+ source(): string;
48
52
  }
@@ -3,8 +3,7 @@ import type { Vector } from "../Point";
3
3
  import type { SkRuntimeEffect, SkRuntimeShaderBuilder } from "../RuntimeEffect";
4
4
  export declare const isShader: (obj: SkJSIInstance<string> | null) => obj is SkShader;
5
5
  export declare type SkShader = SkJSIInstance<"Shader">;
6
- export declare type UniformValue = number | Vector | readonly number[];
7
- export declare type Uniform = UniformValue | readonly UniformValue[];
6
+ export declare type Uniform = number | Vector | Float32Array | Uniform[];
8
7
  export interface Uniforms {
9
8
  [name: string]: Uniform;
10
9
  }
@@ -4,7 +4,9 @@ import type { SkRuntimeEffect } from "../types/RuntimeEffect/RuntimeEffect";
4
4
  import { HostObject } from "./Host";
5
5
  import { JsiSkShader } from "./JsiSkShader";
6
6
  export declare class JsiSkRuntimeEffect extends HostObject<RuntimeEffect, "RuntimeEffect"> implements SkRuntimeEffect {
7
- constructor(CanvasKit: CanvasKit, ref: RuntimeEffect);
7
+ private sksl;
8
+ constructor(CanvasKit: CanvasKit, ref: RuntimeEffect, sksl: string);
9
+ source(): string;
8
10
  makeShader(uniforms: number[], localMatrix?: SkMatrix): JsiSkShader;
9
11
  makeShaderWithChildren(uniforms: number[], children?: SkShader[], localMatrix?: SkMatrix): JsiSkShader;
10
12
  getUniform(index: number): import("canvaskit-wasm").SkSLUniform;
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": "0.1.164",
10
+ "version": "0.1.166",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -10,5 +10,5 @@ export const processCircle = (Skia: Skia, def: CircleDef) => {
10
10
  if (isCircleScalarDef(def)) {
11
11
  return { c: Skia.Point(def.cx, def.cy), r: def.r };
12
12
  }
13
- return def;
13
+ return { ...def, c: def.c ?? { x: 0, y: 0 } };
14
14
  };
@@ -16,7 +16,7 @@ const isRectCtor = (def: RectDef): def is RectCtor =>
16
16
 
17
17
  export const processRect = (Skia: Skia, def: RectDef) => {
18
18
  if (isRectCtor(def)) {
19
- return Skia.XYWHRect(def.x, def.y, def.width, def.height);
19
+ return Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height);
20
20
  } else {
21
21
  return def.rect;
22
22
  }
@@ -24,9 +24,9 @@ export const processRect = (Skia: Skia, def: RectDef) => {
24
24
 
25
25
  export const processRRect = (Skia: Skia, def: RRectDef) => {
26
26
  if (isRRectCtor(def)) {
27
- const r = processRadius(Skia, def.r);
27
+ const r = processRadius(Skia, def.r ?? 0);
28
28
  return Skia.RRectXY(
29
- Skia.XYWHRect(def.x, def.y, def.width, def.height),
29
+ Skia.XYWHRect(def.x ?? 0, def.y ?? 0, def.width, def.height),
30
30
  r.x,
31
31
  r.y
32
32
  );
@@ -40,7 +40,7 @@ export class BoxShadowNode extends JsiDeclarationNode<
40
40
  BoxShadowProps
41
41
  > {
42
42
  constructor(ctx: NodeContext, props: BoxShadowProps) {
43
- super(ctx, DeclarationType.Unknown, NodeType.Box, props);
43
+ super(ctx, DeclarationType.Unknown, NodeType.BoxShadow, props);
44
44
  }
45
45
 
46
46
  materialize() {
@@ -14,7 +14,8 @@ export class ImageNode extends JsiDrawingNode<
14
14
  }
15
15
 
16
16
  deriveProps() {
17
- const { image, fit } = this.props;
17
+ const { image } = this.props;
18
+ const fit = this.props.fit ?? "contain";
18
19
  const rect = processRect(this.Skia, this.props);
19
20
  const { src, dst } = fitRects(
20
21
  fit,
@@ -140,7 +140,7 @@ export class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterP
140
140
 
141
141
  export class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {
142
142
  constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {
143
- super(ctx, NodeType.BlurImageFilter, props);
143
+ super(ctx, NodeType.DropShadowImageFilter, props);
144
144
  }
145
145
 
146
146
  materialize() {
@@ -67,20 +67,20 @@ export class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {
67
67
  materialize() {
68
68
  const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;
69
69
  const rct = getRect(this.Skia, imageShaderProps);
70
+ const m3 = this.Skia.Matrix();
70
71
  if (rct) {
71
72
  const rects = fitRects(
72
73
  fit,
73
74
  { x: 0, y: 0, width: image.width(), height: image.height() },
74
75
  rct
75
76
  );
76
- const m3 = rect2rect(rects.src, rects.dst);
77
- imageShaderProps.transform = [
78
- ...(imageShaderProps.transform ?? []),
79
- ...m3,
80
- ];
77
+ const [x, y, sx, sy] = rect2rect(rects.src, rects.dst);
78
+ m3.translate(x.translateX, y.translateY);
79
+ m3.scale(sx.scaleX, sy.scaleY);
81
80
  }
82
81
  const lm = this.Skia.Matrix();
83
82
  processTransformProps(lm, imageShaderProps);
83
+ lm.concat(m3);
84
84
  return image.makeShaderOptions(
85
85
  TileMode[enumKey(tx)],
86
86
  TileMode[enumKey(ty)],
@@ -37,21 +37,21 @@ export interface ChildrenProps {
37
37
  }
38
38
 
39
39
  export interface RectCtor {
40
- x: number;
41
- y: number;
40
+ x?: number;
41
+ y?: number;
42
42
  width: number;
43
43
  height: number;
44
44
  }
45
45
 
46
46
  export interface RRectCtor extends RectCtor {
47
- r: Radius;
47
+ r?: Radius;
48
48
  }
49
49
 
50
50
  export type RectDef = RectCtor | { rect: SkRect };
51
51
  export type RRectDef = RRectCtor | { rect: SkRRect };
52
52
 
53
53
  export interface PointCircleDef {
54
- c: Vector;
54
+ c?: Vector;
55
55
  r: number;
56
56
  }
57
57
 
@@ -34,7 +34,7 @@ export interface DrawingNodeProps extends GroupProps {
34
34
 
35
35
  export type ImageProps = DrawingNodeProps &
36
36
  RectDef & {
37
- fit: Fit;
37
+ fit?: Fit;
38
38
  image: SkImage;
39
39
  };
40
40
 
@@ -6,13 +6,18 @@ import { LumaColorFilter } from "./colorFilters/LumaColorFilter";
6
6
  import { Paint } from "./Paint";
7
7
 
8
8
  interface MaskProps {
9
- mode: "luminance" | "alpha";
10
- clip: boolean;
9
+ mode?: "luminance" | "alpha";
10
+ clip?: boolean;
11
11
  mask: ReactNode | ReactNode[];
12
12
  children: ReactNode | ReactNode[];
13
13
  }
14
14
 
15
- export const Mask = ({ children, mask, mode, clip }: MaskProps) => {
15
+ export const Mask = ({
16
+ children,
17
+ mask,
18
+ mode = "alpha",
19
+ clip = true,
20
+ }: MaskProps) => {
16
21
  return (
17
22
  <Group layer>
18
23
  <Group
@@ -29,8 +34,3 @@ export const Mask = ({ children, mask, mode, clip }: MaskProps) => {
29
34
  </Group>
30
35
  );
31
36
  };
32
-
33
- Mask.defaultProps = {
34
- mode: "alpha",
35
- clip: true,
36
- };
@@ -6,9 +6,3 @@ import type { ImageProps } from "../../../dom/types";
6
6
  export const Image = (props: SkiaProps<ImageProps>) => {
7
7
  return <skImage {...props} />;
8
8
  };
9
-
10
- Image.defaultProps = {
11
- x: 0,
12
- y: 0,
13
- fit: "contain",
14
- };
@@ -1,17 +1,29 @@
1
1
  import React from "react";
2
2
 
3
3
  import type { ImageShaderProps } from "../../../dom/types";
4
- import type { SkiaProps } from "../../processors";
4
+ import type { SkiaDefaultProps } from "../../processors";
5
5
 
6
- export const ImageShader = (props: SkiaProps<ImageShaderProps>) => {
7
- return <skImageShader {...props} />;
6
+ export const ImageShader = ({
7
+ tx = "decal",
8
+ ty = "decal",
9
+ fm = "nearest",
10
+ mm = "none",
11
+ fit = "none",
12
+ transform = [],
13
+ ...props
14
+ }: SkiaDefaultProps<
15
+ ImageShaderProps,
16
+ "tx" | "ty" | "fm" | "mm" | "fit" | "transform"
17
+ >) => {
18
+ return (
19
+ <skImageShader
20
+ tx={tx}
21
+ ty={ty}
22
+ fm={fm}
23
+ mm={mm}
24
+ fit={fit}
25
+ transform={transform}
26
+ {...props}
27
+ />
28
+ );
8
29
  };
9
-
10
- ImageShader.defaultProps = {
11
- tx: "decal",
12
- ty: "decal",
13
- fm: "nearest",
14
- mm: "none",
15
- fit: "none",
16
- transform: [],
17
- } as const;
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
 
3
- import type { SkiaProps } from "../../processors/Animations/Animations";
3
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
4
4
  import type { BlurImageFilterProps } from "../../../dom/types";
5
5
 
6
- export const Blur = (props: SkiaProps<BlurImageFilterProps>) => {
7
- return <skBlurImageFilter {...props} />;
8
- };
9
-
10
- Blur.defaultProps = {
11
- mode: "decal",
6
+ export const Blur = ({
7
+ mode = "decal",
8
+ ...props
9
+ }: SkiaDefaultProps<BlurImageFilterProps, "mode">) => {
10
+ return <skBlurImageFilter mode={mode} {...props} />;
12
11
  };
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
2
 
3
3
  import type { MorphologyImageFilterProps } from "../../../dom/types";
4
- import type { SkiaProps } from "../../processors";
4
+ import type { SkiaDefaultProps } from "../../processors";
5
5
 
6
- export const Morphology = (props: SkiaProps<MorphologyImageFilterProps>) => {
7
- return <skMorphologyImageFilter {...props} />;
8
- };
9
-
10
- Morphology.defaultProps = {
11
- operator: "dilate",
6
+ export const Morphology = ({
7
+ operator = "dilate",
8
+ ...props
9
+ }: SkiaDefaultProps<MorphologyImageFilterProps, "operator">) => {
10
+ return <skMorphologyImageFilter operator={operator} {...props} />;
12
11
  };
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
2
 
3
- import type { SkiaProps } from "../../processors/Animations/Animations";
3
+ import type { SkiaDefaultProps } from "../../processors/Animations/Animations";
4
4
  import type { OffsetImageFilterProps } from "../../../dom/types";
5
5
 
6
- export const Offset = (props: SkiaProps<OffsetImageFilterProps>) => {
7
- return <skOffsetImageFilter {...props} />;
8
- };
9
-
10
- Offset.defaultProps = {
11
- x: 0,
12
- y: 0,
6
+ export const Offset = ({
7
+ x = 0,
8
+ y = 0,
9
+ ...props
10
+ }: SkiaDefaultProps<OffsetImageFilterProps, "x" | "y">) => {
11
+ return <skOffsetImageFilter x={x} y={y} {...props} />;
13
12
  };