@shopify/react-native-skia 0.1.116 → 0.1.118

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. package/cpp/api/JsiSkApi.h +13 -9
  2. package/cpp/api/JsiSkCanvas.h +9 -1
  3. package/cpp/api/JsiSkPicture.h +71 -0
  4. package/cpp/api/JsiSkPictureFactory.h +50 -0
  5. package/cpp/api/JsiSkPictureRecorder.h +53 -0
  6. package/lib/commonjs/renderer/Canvas.js +22 -36
  7. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  8. package/lib/commonjs/renderer/HostConfig.js +2 -24
  9. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  10. package/lib/commonjs/renderer/components/Drawing.js +31 -0
  11. package/lib/commonjs/renderer/components/Drawing.js.map +1 -0
  12. package/lib/commonjs/renderer/components/Group.js +1 -1
  13. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  14. package/lib/commonjs/renderer/components/Picture.js +35 -0
  15. package/lib/commonjs/renderer/components/Picture.js.map +1 -0
  16. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +5 -34
  17. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  18. package/lib/commonjs/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +19 -8
  19. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -0
  20. package/lib/commonjs/renderer/components/imageFilters/index.js +4 -17
  21. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  22. package/lib/commonjs/renderer/components/index.js +26 -0
  23. package/lib/commonjs/renderer/components/index.js.map +1 -1
  24. package/lib/commonjs/renderer/components/maskFilters/Blur.js +1 -1
  25. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  26. package/lib/commonjs/renderer/components/shapes/Box.js +126 -0
  27. package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -0
  28. package/lib/commonjs/renderer/components/shapes/index.js +13 -0
  29. package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
  30. package/lib/commonjs/renderer/index.js +13 -0
  31. package/lib/commonjs/renderer/index.js.map +1 -1
  32. package/lib/commonjs/renderer/nodes/Declaration.js +8 -1
  33. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  34. package/lib/commonjs/renderer/nodes/Drawing.js +5 -8
  35. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  36. package/lib/commonjs/renderer/processors/math/Math.js +19 -1
  37. package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
  38. package/lib/commonjs/renderer/processors/math/Matrix3.js +11 -5
  39. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  40. package/lib/commonjs/renderer/typeddash.js +26 -2
  41. package/lib/commonjs/renderer/typeddash.js.map +1 -1
  42. package/lib/commonjs/renderer/useContextBridge.js +35 -0
  43. package/lib/commonjs/renderer/useContextBridge.js.map +1 -0
  44. package/lib/commonjs/skia/Canvas.js.map +1 -1
  45. package/lib/commonjs/skia/Picture/Picture.js +6 -0
  46. package/lib/commonjs/skia/Picture/Picture.js.map +1 -0
  47. package/lib/commonjs/skia/Picture/PictureFactory.js +6 -0
  48. package/lib/commonjs/skia/Picture/PictureFactory.js.map +1 -0
  49. package/lib/commonjs/skia/Picture/PictureRecorder.js +6 -0
  50. package/lib/commonjs/skia/Picture/PictureRecorder.js.map +1 -0
  51. package/lib/commonjs/skia/Picture/index.js +58 -0
  52. package/lib/commonjs/skia/Picture/index.js.map +1 -0
  53. package/lib/commonjs/skia/Picture/usePicture.js +30 -0
  54. package/lib/commonjs/skia/Picture/usePicture.js.map +1 -0
  55. package/lib/commonjs/skia/Skia.js +2 -0
  56. package/lib/commonjs/skia/Skia.js.map +1 -1
  57. package/lib/commonjs/skia/index.js +14 -0
  58. package/lib/commonjs/skia/index.js.map +1 -1
  59. package/lib/commonjs/values/hooks/useDerivedValue.js +2 -2
  60. package/lib/commonjs/values/hooks/useDerivedValue.js.map +1 -1
  61. package/lib/commonjs/views/SkiaView.js +6 -5
  62. package/lib/commonjs/views/SkiaView.js.map +1 -1
  63. package/lib/commonjs/views/types.js.map +1 -1
  64. package/lib/module/renderer/Canvas.js +20 -32
  65. package/lib/module/renderer/Canvas.js.map +1 -1
  66. package/lib/module/renderer/HostConfig.js +1 -23
  67. package/lib/module/renderer/HostConfig.js.map +1 -1
  68. package/lib/module/renderer/components/Drawing.js +17 -0
  69. package/lib/module/renderer/components/Drawing.js.map +1 -0
  70. package/lib/module/renderer/components/Group.js +1 -1
  71. package/lib/module/renderer/components/Group.js.map +1 -1
  72. package/lib/module/renderer/components/Picture.js +21 -0
  73. package/lib/module/renderer/components/Picture.js.map +1 -0
  74. package/lib/module/renderer/components/imageFilters/InnerShadow.js +4 -26
  75. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  76. package/lib/module/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +16 -6
  77. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -0
  78. package/lib/module/renderer/components/imageFilters/index.js +1 -2
  79. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  80. package/lib/module/renderer/components/index.js +2 -0
  81. package/lib/module/renderer/components/index.js.map +1 -1
  82. package/lib/module/renderer/components/maskFilters/Blur.js +1 -1
  83. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  84. package/lib/module/renderer/components/shapes/Box.js +102 -0
  85. package/lib/module/renderer/components/shapes/Box.js.map +1 -0
  86. package/lib/module/renderer/components/shapes/index.js +1 -0
  87. package/lib/module/renderer/components/shapes/index.js.map +1 -1
  88. package/lib/module/renderer/index.js +1 -0
  89. package/lib/module/renderer/index.js.map +1 -1
  90. package/lib/module/renderer/nodes/Declaration.js +3 -0
  91. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  92. package/lib/module/renderer/nodes/Drawing.js +3 -4
  93. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  94. package/lib/module/renderer/processors/math/Math.js +15 -0
  95. package/lib/module/renderer/processors/math/Math.js.map +1 -1
  96. package/lib/module/renderer/processors/math/Matrix3.js +6 -2
  97. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  98. package/lib/module/renderer/typeddash.js +21 -0
  99. package/lib/module/renderer/typeddash.js.map +1 -1
  100. package/lib/module/renderer/useContextBridge.js +21 -0
  101. package/lib/module/renderer/useContextBridge.js.map +1 -0
  102. package/lib/module/skia/Canvas.js.map +1 -1
  103. package/lib/module/skia/Picture/Picture.js +2 -0
  104. package/lib/module/skia/Picture/Picture.js.map +1 -0
  105. package/lib/module/skia/Picture/PictureFactory.js +2 -0
  106. package/lib/module/skia/Picture/PictureFactory.js.map +1 -0
  107. package/lib/module/skia/Picture/PictureRecorder.js +2 -0
  108. package/lib/module/skia/Picture/PictureRecorder.js.map +1 -0
  109. package/lib/module/skia/Picture/index.js +5 -0
  110. package/lib/module/skia/Picture/index.js.map +1 -0
  111. package/lib/module/skia/Picture/usePicture.js +19 -0
  112. package/lib/module/skia/Picture/usePicture.js.map +1 -0
  113. package/lib/module/skia/Skia.js +2 -0
  114. package/lib/module/skia/Skia.js.map +1 -1
  115. package/lib/module/skia/index.js +1 -0
  116. package/lib/module/skia/index.js.map +1 -1
  117. package/lib/module/values/hooks/useDerivedValue.js +1 -1
  118. package/lib/module/values/hooks/useDerivedValue.js.map +1 -1
  119. package/lib/module/views/SkiaView.js +6 -5
  120. package/lib/module/views/SkiaView.js.map +1 -1
  121. package/lib/module/views/types.js.map +1 -1
  122. package/lib/typescript/src/renderer/Canvas.d.ts +5 -10
  123. package/lib/typescript/src/renderer/components/Drawing.d.ts +7 -0
  124. package/lib/typescript/src/renderer/components/Picture.d.ts +6 -0
  125. package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +3 -12
  126. package/lib/typescript/src/renderer/components/imageFilters/{DropShadow.d.ts → Shadow.d.ts} +3 -2
  127. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -2
  128. package/lib/typescript/src/renderer/components/index.d.ts +2 -0
  129. package/lib/typescript/src/renderer/components/shapes/Box.d.ts +23 -0
  130. package/lib/typescript/src/renderer/components/shapes/index.d.ts +1 -0
  131. package/lib/typescript/src/renderer/index.d.ts +1 -0
  132. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -0
  133. package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
  134. package/lib/typescript/src/renderer/processors/math/Math.d.ts +14 -0
  135. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -0
  136. package/lib/typescript/src/renderer/typeddash.d.ts +1 -0
  137. package/lib/typescript/src/renderer/useContextBridge.d.ts +5 -0
  138. package/lib/typescript/src/skia/Canvas.d.ts +6 -0
  139. package/lib/typescript/src/skia/Picture/Picture.d.ts +26 -0
  140. package/lib/typescript/src/skia/Picture/PictureFactory.d.ts +8 -0
  141. package/lib/typescript/src/skia/Picture/PictureRecorder.d.ts +15 -0
  142. package/lib/typescript/src/skia/Picture/index.d.ts +4 -0
  143. package/lib/typescript/src/skia/Picture/usePicture.d.ts +11 -0
  144. package/lib/typescript/src/skia/Skia.d.ts +5 -0
  145. package/lib/typescript/src/skia/index.d.ts +1 -0
  146. package/lib/typescript/src/views/SkiaView.d.ts +25 -1
  147. package/lib/typescript/src/views/types.d.ts +0 -24
  148. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  149. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  150. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  151. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  152. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  153. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  154. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  155. package/package.json +1 -1
  156. package/src/renderer/Canvas.tsx +14 -30
  157. package/src/renderer/HostConfig.ts +1 -19
  158. package/src/renderer/components/Drawing.tsx +16 -0
  159. package/src/renderer/components/Group.tsx +1 -1
  160. package/src/renderer/components/Picture.tsx +17 -0
  161. package/src/renderer/components/imageFilters/InnerShadow.tsx +33 -47
  162. package/src/renderer/components/imageFilters/Shadow.tsx +39 -0
  163. package/src/renderer/components/imageFilters/index.ts +1 -2
  164. package/src/renderer/components/index.ts +2 -0
  165. package/src/renderer/components/maskFilters/Blur.tsx +1 -1
  166. package/src/renderer/components/shapes/Box.tsx +98 -0
  167. package/src/renderer/components/shapes/index.ts +1 -0
  168. package/src/renderer/index.ts +1 -0
  169. package/src/renderer/nodes/Declaration.tsx +10 -0
  170. package/src/renderer/nodes/Drawing.tsx +6 -6
  171. package/src/renderer/processors/math/Math.ts +16 -0
  172. package/src/renderer/processors/math/Matrix3.ts +35 -31
  173. package/src/renderer/typeddash.ts +18 -0
  174. package/src/renderer/useContextBridge.tsx +21 -0
  175. package/src/skia/Canvas.ts +7 -0
  176. package/src/skia/Picture/Picture.ts +34 -0
  177. package/src/skia/Picture/PictureFactory.ts +9 -0
  178. package/src/skia/Picture/PictureRecorder.ts +18 -0
  179. package/src/skia/Picture/index.ts +4 -0
  180. package/src/skia/Picture/usePicture.ts +28 -0
  181. package/src/skia/Skia.ts +5 -0
  182. package/src/skia/index.ts +1 -0
  183. package/src/values/hooks/useDerivedValue.ts +1 -1
  184. package/src/views/SkiaView.tsx +27 -3
  185. package/src/views/types.ts +0 -25
  186. package/lib/commonjs/renderer/components/imageFilters/DropShadow.js.map +0 -1
  187. package/lib/module/renderer/components/imageFilters/DropShadow.js.map +0 -1
  188. package/src/renderer/components/imageFilters/DropShadow.tsx +0 -31
@@ -0,0 +1,34 @@
1
+ import type { InputColorMatrix } from "../ColorFilter";
2
+ import type { FilterMode } from "../Image";
3
+ import type { TileMode } from "../ImageFilter";
4
+ import type { SkRect } from "../Rect";
5
+ import type { IShader } from "../Shader";
6
+
7
+ export interface SkPicture {
8
+ /**
9
+ * Returns a new shader that will draw with this picture.
10
+ *
11
+ * @param tmx The tiling mode to use when sampling in the x-direction.
12
+ * @param tmy The tiling mode to use when sampling in the y-direction.
13
+ * @param mode How to filter the tiles
14
+ * @param localMatrix Optional matrix used when sampling
15
+ * @param tileRect The tile rectangle in picture coordinates: this represents the subset
16
+ * (or superset) of the picture used when building a tile. It is not
17
+ * affected by localMatrix and does not imply scaling (only translation
18
+ * and cropping). If null, the tile rect is considered equal to the picture
19
+ * bounds.
20
+ */
21
+ makeShader(
22
+ tmx: TileMode,
23
+ tmy: TileMode,
24
+ mode: FilterMode,
25
+ localMatrix?: InputColorMatrix,
26
+ tileRect?: SkRect
27
+ ): IShader;
28
+
29
+ /**
30
+ * Returns the serialized format of this SkPicture. The format may change at anytime and
31
+ * no promises are made for backwards or forward compatibility.
32
+ */
33
+ serialize(): Uint8Array | null;
34
+ }
@@ -0,0 +1,9 @@
1
+ import type { SkPicture } from "./Picture";
2
+
3
+ export interface PictureFactory {
4
+ /**
5
+ * Returns an SkPicture which has been serialized previously to the given bytes.
6
+ * @param bytes
7
+ */
8
+ MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;
9
+ }
@@ -0,0 +1,18 @@
1
+ import type { SkCanvas } from "../Canvas";
2
+ import type { SkRect } from "../Rect";
3
+
4
+ import type { SkPicture } from "./Picture";
5
+
6
+ export interface SkPictureRecorder {
7
+ /**
8
+ * Returns a canvas on which to draw. When done drawing, call finishRecordingAsPicture()
9
+ *
10
+ * @param bounds - a rect to cull the results.
11
+ */
12
+ beginRecording(bounds: SkRect): SkCanvas;
13
+
14
+ /**
15
+ * Returns the captured draw commands as a picture and invalidates the canvas returned earlier.
16
+ */
17
+ finishRecordingAsPicture(): SkPicture;
18
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./Picture";
2
+ export * from "./PictureRecorder";
3
+ export * from "./usePicture";
4
+ export * from "./PictureFactory";
@@ -0,0 +1,28 @@
1
+ import type { DependencyList } from "react";
2
+ import { useMemo } from "react";
3
+
4
+ import type { SkCanvas } from "../Canvas";
5
+ import type { SkRect } from "../Rect";
6
+ import { Skia } from "../Skia";
7
+
8
+ import type { SkPicture } from "./Picture";
9
+
10
+ /**
11
+ * Memoizes and returns an SkPicture that can be drawn to another canvas.
12
+ * @param rect Picture bounds
13
+ * @param cb Callback for drawing to the canvas
14
+ * @returns SkPicture
15
+ */
16
+ export const usePicture = (
17
+ rect: SkRect,
18
+ cb: (canvas: SkCanvas) => void,
19
+ deps: DependencyList = []
20
+ ): SkPicture => {
21
+ return useMemo(() => {
22
+ const recorder = Skia.PictureRecorder();
23
+ const canvas = recorder.beginRecording(rect);
24
+ cb(canvas);
25
+ return recorder.finishRecordingAsPicture();
26
+ // eslint-disable-next-line react-hooks/exhaustive-deps
27
+ }, [cb, rect, deps]);
28
+ };
package/src/skia/Skia.ts CHANGED
@@ -26,6 +26,7 @@ import "./NativeSetup";
26
26
  import type { SkRSXform } from "./RSXform";
27
27
  import type { SkPath } from "./Path/Path";
28
28
  import type { SkContourMeasureIter } from "./ContourMeasure";
29
+ import type { PictureFactory, SkPictureRecorder } from "./Picture";
29
30
 
30
31
  /**
31
32
  * Declares the interface for the native Skia API
@@ -41,6 +42,8 @@ export interface Skia {
41
42
  resScale: number
42
43
  ) => SkContourMeasureIter;
43
44
  Paint: () => SkPaint;
45
+ PictureRecorder: () => SkPictureRecorder;
46
+ Picture: PictureFactory;
44
47
  Path: PathFactory;
45
48
  Matrix: () => SkMatrix;
46
49
  ColorFilter: ColorFilterFactory;
@@ -106,6 +109,8 @@ export const Skia = {
106
109
  XYWHRect: SkiaApi.XYWHRect,
107
110
  RRectXY: SkiaApi.RRectXY,
108
111
  Paint: SkiaApi.Paint,
112
+ PictureRecorder: SkiaApi.PictureRecorder,
113
+ Picture: SkiaApi.Picture,
109
114
  Path: SkiaApi.Path,
110
115
  ColorFilter: SkiaApi.ColorFilter,
111
116
  ContourMeasureIter: SkiaApi.ContourMeasureIter,
package/src/skia/index.ts CHANGED
@@ -20,4 +20,5 @@ export * from "./Surface";
20
20
  export * from "./FontMgr";
21
21
  export * from "./Vertices";
22
22
  export * from "./Color";
23
+ export * from "./Picture";
23
24
  export * from "./Data";
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
 
3
3
  import { ValueApi } from "../api";
4
- import { isValue } from "../../renderer";
4
+ import { isValue } from "../../renderer/processors";
5
5
 
6
6
  /**
7
7
  * Creates a new derived value - a value that will calculate its value depending
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import type { ViewProps } from "react-native";
2
3
  import { requireNativeComponent } from "react-native";
3
4
 
4
5
  import type { SkImage, SkRect } from "../skia";
@@ -6,7 +7,6 @@ import type { SkiaReadonlyValue } from "../values";
6
7
 
7
8
  import type {
8
9
  DrawMode,
9
- SkiaViewProps,
10
10
  RNSkiaDrawCallback,
11
11
  NativeSkiaViewProps,
12
12
  } from "./types";
@@ -35,6 +35,30 @@ declare global {
35
35
 
36
36
  const { SkiaViewApi } = global;
37
37
 
38
+ export interface SkiaViewProps extends ViewProps {
39
+ /**
40
+ * Sets the drawing mode for the skia view. There are two drawing
41
+ * modes, "continuous" and "default", where the continuous mode will
42
+ * continuously redraw the view, and the default mode will only
43
+ * redraw when any of the regular react properties are changed like
44
+ * sizes and margins.
45
+ */
46
+ mode?: DrawMode;
47
+ /**
48
+ * When set to true the view will display information about the
49
+ * average time it takes to render.
50
+ */
51
+ debug?: boolean;
52
+ /**
53
+ * Draw callback. Will be called whenever the view is invalidated and
54
+ * needs to redraw. This is either caused by a change in a react
55
+ * property, a touch event, or a call to redraw. If the view is in
56
+ * continuous mode the callback will be called 60 frames per second
57
+ * by the native view.
58
+ */
59
+ onDraw?: RNSkiaDrawCallback;
60
+ }
61
+
38
62
  export class SkiaView extends React.Component<SkiaViewProps> {
39
63
  constructor(props: SkiaViewProps) {
40
64
  super(props);
@@ -103,14 +127,14 @@ export class SkiaView extends React.Component<SkiaViewProps> {
103
127
  }
104
128
 
105
129
  render() {
106
- const { style, mode, debug = false } = this.props;
130
+ const { mode, debug = false, ...viewProps } = this.props;
107
131
  return (
108
132
  <NativeSkiaView
109
- style={style}
110
133
  collapsable={false}
111
134
  nativeID={`${this._nativeId}`}
112
135
  mode={mode}
113
136
  debug={debug}
137
+ {...viewProps}
114
138
  />
115
139
  );
116
140
  }
@@ -47,31 +47,6 @@ export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
47
47
 
48
48
  export type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;
49
49
 
50
- export type SkiaViewProps = {
51
- style?: ViewProps["style"];
52
- /**
53
- * Sets the drawing mode for the skia view. There are two drawing
54
- * modes, "continuous" and "default", where the continuous mode will
55
- * continuously redraw the view, and the default mode will only
56
- * redraw when any of the regular react properties are changed like
57
- * sizes and margins.
58
- */
59
- mode?: DrawMode;
60
- /**
61
- * When set to true the view will display information about the
62
- * average time it takes to render.
63
- */
64
- debug?: boolean;
65
- /**
66
- * Draw callback. Will be called whenever the view is invalidated and
67
- * needs to redraw. This is either caused by a change in a react
68
- * property, a touch event, or a call to redraw. If the view is in
69
- * continuous mode the callback will be called 60 frames per second
70
- * by the native view.
71
- */
72
- onDraw?: RNSkiaDrawCallback;
73
- };
74
-
75
50
  /**
76
51
  * Listener interface for value changes
77
52
  */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["DropShadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","shadowOnly","opacity","input","factory","Skia","ImageFilter","MakeDropShadowOnly","MakeDropShadow","DropShadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAGA;;AAEA;;;;;;AAUA,MAAMA,SAAS,GAAG,oCAChB,OAAsCC,QAAtC,YAAgE;AAAA,MAA/D;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAhB;AAAuBC,IAAAA;AAAvB,GAA+D;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC9D,QAAMC,KAAK,GAAG,wBAASP,QAAT,CAAd;AACA,QAAMQ,OAAO,GAAGH,UAAU,GACtBI,WAAKC,WAAL,CAAiBC,kBADK,GAEtBF,WAAKC,WAAL,CAAiBE,cAFrB;AAGA,SAAOJ,OAAO,CAACP,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqB,yBAAaC,KAAb,EAAoBE,OAApB,CAArB,EAAmDC,KAAnD,CAAd;AACD,CAPe,CAAlB;;AAUO,MAAMM,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEf;AAA1B,KAAyCe,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/Color\";\nimport { processColor } from \"../../../skia/Color\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface DropShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<DropShadowProps>(\n ({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {\n const input = getInput(children);\n const factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n return factory(dx, dy, blur, blur, processColor(color, opacity), input);\n }\n);\n\nexport const DropShadow = (props: AnimatedProps<DropShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["DropShadow.tsx"],"names":["React","Skia","createDeclaration","processColor","getInput","onDeclare","children","dx","dy","blur","color","shadowOnly","opacity","input","factory","ImageFilter","MakeDropShadowOnly","MakeDropShadow","DropShadow","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAGA,SAASC,YAAT,QAA6B,qBAA7B;AAEA,SAASC,QAAT,QAAyB,YAAzB;AAUA,MAAMC,SAAS,GAAGH,iBAAiB,CACjC,OAAsCI,QAAtC,YAAgE;AAAA,MAA/D;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAhB;AAAuBC,IAAAA;AAAvB,GAA+D;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC9D,QAAMC,KAAK,GAAGT,QAAQ,CAACE,QAAD,CAAtB;AACA,QAAMQ,OAAO,GAAGH,UAAU,GACtBV,IAAI,CAACc,WAAL,CAAiBC,kBADK,GAEtBf,IAAI,CAACc,WAAL,CAAiBE,cAFrB;AAGA,SAAOH,OAAO,CAACP,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBN,YAAY,CAACO,KAAD,EAAQE,OAAR,CAAjC,EAAmDC,KAAnD,CAAd;AACD,CAPgC,CAAnC;AAUA,OAAO,MAAMK,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEd;AAA1B,KAAyCc,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/Color\";\nimport { processColor } from \"../../../skia/Color\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface DropShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<DropShadowProps>(\n ({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {\n const input = getInput(children);\n const factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n return factory(dx, dy, blur, blur, processColor(color, opacity), input);\n }\n);\n\nexport const DropShadow = (props: AnimatedProps<DropShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -1,31 +0,0 @@
1
- import React from "react";
2
-
3
- import { Skia } from "../../../skia";
4
- import { createDeclaration } from "../../nodes/Declaration";
5
- import type { AnimatedProps } from "../../processors/Animations/Animations";
6
- import type { Color } from "../../../skia/Color";
7
- import { processColor } from "../../../skia/Color";
8
-
9
- import { getInput } from "./getInput";
10
-
11
- export interface DropShadowProps {
12
- dx: number;
13
- dy: number;
14
- blur: number;
15
- color: Color;
16
- shadowOnly?: boolean;
17
- }
18
-
19
- const onDeclare = createDeclaration<DropShadowProps>(
20
- ({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {
21
- const input = getInput(children);
22
- const factory = shadowOnly
23
- ? Skia.ImageFilter.MakeDropShadowOnly
24
- : Skia.ImageFilter.MakeDropShadow;
25
- return factory(dx, dy, blur, blur, processColor(color, opacity), input);
26
- }
27
- );
28
-
29
- export const DropShadow = (props: AnimatedProps<DropShadowProps>) => {
30
- return <skDeclaration onDeclare={onDeclare} {...props} />;
31
- };