@shopify/react-native-skia 0.1.115 → 0.1.119

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. package/README.md +39 -2
  2. package/cpp/api/JsiSkApi.h +13 -9
  3. package/cpp/api/JsiSkCanvas.h +9 -1
  4. package/cpp/api/JsiSkPicture.h +71 -0
  5. package/cpp/api/JsiSkPictureFactory.h +50 -0
  6. package/cpp/api/JsiSkPictureRecorder.h +53 -0
  7. package/lib/commonjs/renderer/Canvas.js +22 -36
  8. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  9. package/lib/commonjs/renderer/HostConfig.js +3 -25
  10. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  11. package/lib/commonjs/renderer/components/{Defs.js → Drawing.js} +13 -12
  12. package/lib/commonjs/renderer/components/Drawing.js.map +1 -0
  13. package/lib/commonjs/renderer/components/Group.js +31 -20
  14. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  15. package/lib/commonjs/renderer/components/Paint.js +1 -21
  16. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  17. package/lib/commonjs/renderer/components/Picture.js +35 -0
  18. package/lib/commonjs/renderer/components/Picture.js.map +1 -0
  19. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +5 -34
  20. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  21. package/lib/commonjs/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +19 -8
  22. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -0
  23. package/lib/commonjs/renderer/components/imageFilters/index.js +4 -17
  24. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  25. package/lib/commonjs/renderer/components/index.js +17 -4
  26. package/lib/commonjs/renderer/components/index.js.map +1 -1
  27. package/lib/commonjs/renderer/components/maskFilters/Blur.js +1 -1
  28. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  29. package/lib/commonjs/renderer/components/shapes/Box.js +126 -0
  30. package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -0
  31. package/lib/commonjs/renderer/components/shapes/FitBox.js +9 -5
  32. package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
  33. package/lib/commonjs/renderer/components/shapes/index.js +13 -0
  34. package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
  35. package/lib/commonjs/renderer/index.js +13 -0
  36. package/lib/commonjs/renderer/index.js.map +1 -1
  37. package/lib/commonjs/renderer/nodes/Declaration.js +12 -1
  38. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  39. package/lib/commonjs/renderer/nodes/Drawing.js +9 -24
  40. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  41. package/lib/commonjs/renderer/nodes/Node.js +9 -16
  42. package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
  43. package/lib/commonjs/renderer/processors/Paint.js +24 -26
  44. package/lib/commonjs/renderer/processors/Paint.js.map +1 -1
  45. package/lib/commonjs/renderer/processors/math/Math.js +19 -1
  46. package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
  47. package/lib/commonjs/renderer/processors/math/Matrix3.js +11 -5
  48. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  49. package/lib/commonjs/renderer/typeddash.js +26 -2
  50. package/lib/commonjs/renderer/typeddash.js.map +1 -1
  51. package/lib/commonjs/renderer/useContextBridge.js +35 -0
  52. package/lib/commonjs/renderer/useContextBridge.js.map +1 -0
  53. package/lib/commonjs/skia/Canvas.js.map +1 -1
  54. package/lib/commonjs/skia/Picture/Picture.js +6 -0
  55. package/lib/commonjs/skia/Picture/Picture.js.map +1 -0
  56. package/lib/commonjs/skia/Picture/PictureFactory.js +6 -0
  57. package/lib/commonjs/skia/Picture/PictureFactory.js.map +1 -0
  58. package/lib/commonjs/skia/Picture/PictureRecorder.js +6 -0
  59. package/lib/commonjs/skia/Picture/PictureRecorder.js.map +1 -0
  60. package/lib/commonjs/skia/Picture/index.js +58 -0
  61. package/lib/commonjs/skia/Picture/index.js.map +1 -0
  62. package/lib/commonjs/skia/Picture/usePicture.js +30 -0
  63. package/lib/commonjs/skia/Picture/usePicture.js.map +1 -0
  64. package/lib/commonjs/skia/Skia.js +2 -0
  65. package/lib/commonjs/skia/Skia.js.map +1 -1
  66. package/lib/commonjs/skia/index.js +28 -0
  67. package/lib/commonjs/skia/index.js.map +1 -1
  68. package/lib/commonjs/values/hooks/useDerivedValue.js +2 -2
  69. package/lib/commonjs/values/hooks/useDerivedValue.js.map +1 -1
  70. package/lib/commonjs/views/SkiaView.js +6 -44
  71. package/lib/commonjs/views/SkiaView.js.map +1 -1
  72. package/lib/commonjs/views/types.js.map +1 -1
  73. package/lib/module/renderer/Canvas.js +20 -32
  74. package/lib/module/renderer/Canvas.js.map +1 -1
  75. package/lib/module/renderer/HostConfig.js +2 -24
  76. package/lib/module/renderer/HostConfig.js.map +1 -1
  77. package/lib/module/renderer/components/Drawing.js +17 -0
  78. package/lib/module/renderer/components/Drawing.js.map +1 -0
  79. package/lib/module/renderer/components/Group.js +32 -22
  80. package/lib/module/renderer/components/Group.js.map +1 -1
  81. package/lib/module/renderer/components/Paint.js +2 -22
  82. package/lib/module/renderer/components/Paint.js.map +1 -1
  83. package/lib/module/renderer/components/Picture.js +21 -0
  84. package/lib/module/renderer/components/Picture.js.map +1 -0
  85. package/lib/module/renderer/components/imageFilters/InnerShadow.js +4 -26
  86. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  87. package/lib/module/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +16 -6
  88. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -0
  89. package/lib/module/renderer/components/imageFilters/index.js +1 -2
  90. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  91. package/lib/module/renderer/components/index.js +2 -1
  92. package/lib/module/renderer/components/index.js.map +1 -1
  93. package/lib/module/renderer/components/maskFilters/Blur.js +1 -1
  94. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  95. package/lib/module/renderer/components/shapes/Box.js +102 -0
  96. package/lib/module/renderer/components/shapes/Box.js.map +1 -0
  97. package/lib/module/renderer/components/shapes/FitBox.js +5 -4
  98. package/lib/module/renderer/components/shapes/FitBox.js.map +1 -1
  99. package/lib/module/renderer/components/shapes/index.js +1 -0
  100. package/lib/module/renderer/components/shapes/index.js.map +1 -1
  101. package/lib/module/renderer/index.js +1 -0
  102. package/lib/module/renderer/index.js.map +1 -1
  103. package/lib/module/renderer/nodes/Declaration.js +4 -0
  104. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  105. package/lib/module/renderer/nodes/Drawing.js +8 -21
  106. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  107. package/lib/module/renderer/nodes/Node.js +9 -15
  108. package/lib/module/renderer/nodes/Node.js.map +1 -1
  109. package/lib/module/renderer/processors/Paint.js +22 -21
  110. package/lib/module/renderer/processors/Paint.js.map +1 -1
  111. package/lib/module/renderer/processors/math/Math.js +15 -0
  112. package/lib/module/renderer/processors/math/Math.js.map +1 -1
  113. package/lib/module/renderer/processors/math/Matrix3.js +6 -2
  114. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  115. package/lib/module/renderer/typeddash.js +21 -0
  116. package/lib/module/renderer/typeddash.js.map +1 -1
  117. package/lib/module/renderer/useContextBridge.js +21 -0
  118. package/lib/module/renderer/useContextBridge.js.map +1 -0
  119. package/lib/module/skia/Canvas.js.map +1 -1
  120. package/lib/module/skia/Picture/Picture.js +2 -0
  121. package/lib/module/skia/Picture/Picture.js.map +1 -0
  122. package/lib/module/skia/Picture/PictureFactory.js +2 -0
  123. package/lib/module/skia/Picture/PictureFactory.js.map +1 -0
  124. package/lib/module/skia/Picture/PictureRecorder.js +2 -0
  125. package/lib/module/skia/Picture/PictureRecorder.js.map +1 -0
  126. package/lib/module/skia/Picture/index.js +5 -0
  127. package/lib/module/skia/Picture/index.js.map +1 -0
  128. package/lib/module/skia/Picture/usePicture.js +19 -0
  129. package/lib/module/skia/Picture/usePicture.js.map +1 -0
  130. package/lib/module/skia/Skia.js +2 -0
  131. package/lib/module/skia/Skia.js.map +1 -1
  132. package/lib/module/skia/index.js +2 -0
  133. package/lib/module/skia/index.js.map +1 -1
  134. package/lib/module/values/hooks/useDerivedValue.js +1 -1
  135. package/lib/module/values/hooks/useDerivedValue.js.map +1 -1
  136. package/lib/module/views/SkiaView.js +6 -44
  137. package/lib/module/views/SkiaView.js.map +1 -1
  138. package/lib/module/views/types.js.map +1 -1
  139. package/lib/typescript/src/renderer/Canvas.d.ts +5 -10
  140. package/lib/typescript/src/renderer/components/Drawing.d.ts +7 -0
  141. package/lib/typescript/src/renderer/components/Picture.d.ts +6 -0
  142. package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +3 -12
  143. package/lib/typescript/src/renderer/components/imageFilters/{DropShadow.d.ts → Shadow.d.ts} +3 -2
  144. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -2
  145. package/lib/typescript/src/renderer/components/index.d.ts +2 -1
  146. package/lib/typescript/src/renderer/components/shapes/Box.d.ts +23 -0
  147. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +9 -0
  148. package/lib/typescript/src/renderer/components/shapes/index.d.ts +1 -0
  149. package/lib/typescript/src/renderer/index.d.ts +1 -0
  150. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +3 -0
  151. package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
  152. package/lib/typescript/src/renderer/nodes/Node.d.ts +2 -2
  153. package/lib/typescript/src/renderer/processors/Paint.d.ts +2 -2
  154. package/lib/typescript/src/renderer/processors/math/Math.d.ts +14 -0
  155. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -0
  156. package/lib/typescript/src/renderer/typeddash.d.ts +1 -0
  157. package/lib/typescript/src/renderer/useContextBridge.d.ts +5 -0
  158. package/lib/typescript/src/skia/Canvas.d.ts +6 -0
  159. package/lib/typescript/src/skia/Picture/Picture.d.ts +26 -0
  160. package/lib/typescript/src/skia/Picture/PictureFactory.d.ts +8 -0
  161. package/lib/typescript/src/skia/Picture/PictureRecorder.d.ts +15 -0
  162. package/lib/typescript/src/skia/Picture/index.d.ts +4 -0
  163. package/lib/typescript/src/skia/Picture/usePicture.d.ts +11 -0
  164. package/lib/typescript/src/skia/Skia.d.ts +5 -0
  165. package/lib/typescript/src/skia/index.d.ts +2 -0
  166. package/lib/typescript/src/views/SkiaView.d.ts +28 -13
  167. package/lib/typescript/src/views/types.d.ts +0 -23
  168. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  169. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  170. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  171. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  172. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  173. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  174. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  175. package/package.json +7 -7
  176. package/src/renderer/Canvas.tsx +14 -30
  177. package/src/renderer/HostConfig.ts +2 -20
  178. package/src/renderer/components/Drawing.tsx +16 -0
  179. package/src/renderer/components/Group.tsx +44 -27
  180. package/src/renderer/components/Paint.tsx +5 -35
  181. package/src/renderer/components/Picture.tsx +17 -0
  182. package/src/renderer/components/imageFilters/InnerShadow.tsx +33 -47
  183. package/src/renderer/components/imageFilters/Shadow.tsx +39 -0
  184. package/src/renderer/components/imageFilters/index.ts +1 -2
  185. package/src/renderer/components/index.ts +2 -1
  186. package/src/renderer/components/maskFilters/Blur.tsx +1 -1
  187. package/src/renderer/components/shapes/Box.tsx +98 -0
  188. package/src/renderer/components/shapes/FitBox.tsx +6 -4
  189. package/src/renderer/components/shapes/index.ts +1 -0
  190. package/src/renderer/index.ts +1 -0
  191. package/src/renderer/nodes/Declaration.tsx +14 -0
  192. package/src/renderer/nodes/Drawing.tsx +16 -26
  193. package/src/renderer/nodes/Node.ts +9 -12
  194. package/src/renderer/processors/Paint.ts +34 -31
  195. package/src/renderer/processors/math/Math.ts +16 -0
  196. package/src/renderer/processors/math/Matrix3.ts +35 -31
  197. package/src/renderer/typeddash.ts +18 -0
  198. package/src/renderer/useContextBridge.tsx +21 -0
  199. package/src/skia/Canvas.ts +7 -0
  200. package/src/skia/Picture/Picture.ts +34 -0
  201. package/src/skia/Picture/PictureFactory.ts +9 -0
  202. package/src/skia/Picture/PictureRecorder.ts +18 -0
  203. package/src/skia/Picture/index.ts +4 -0
  204. package/src/skia/Picture/usePicture.ts +28 -0
  205. package/src/skia/Skia.ts +5 -0
  206. package/src/skia/index.ts +2 -0
  207. package/src/values/hooks/useDerivedValue.ts +1 -1
  208. package/src/views/SkiaView.tsx +31 -41
  209. package/src/views/types.ts +0 -24
  210. package/lib/commonjs/renderer/components/Defs.js.map +0 -1
  211. package/lib/commonjs/renderer/components/imageFilters/DropShadow.js.map +0 -1
  212. package/lib/module/renderer/components/Defs.js +0 -16
  213. package/lib/module/renderer/components/Defs.js.map +0 -1
  214. package/lib/module/renderer/components/imageFilters/DropShadow.js.map +0 -1
  215. package/lib/typescript/src/renderer/components/Defs.d.ts +0 -5
  216. package/src/renderer/components/Defs.tsx +0 -19
  217. package/src/renderer/components/imageFilters/DropShadow.tsx +0 -31
@@ -3,28 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Defs = void 0;
6
+ exports.Drawing = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
10
- var _nodes = require("../nodes");
10
+ var _Drawing = require("../nodes/Drawing");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
14
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
 
16
- const onDeclare = (0, _nodes.createDeclaration)(() => {
17
- // Do nothing.
18
- // The goal of this component is to avoid declared paint from
19
- // being used in the drawing context automatically
20
- return null;
16
+ const onDraw = (0, _Drawing.createDrawing)((ctx, _ref) => {
17
+ let {
18
+ drawing
19
+ } = _ref;
20
+ drawing(ctx);
21
21
  });
22
22
 
23
- const Defs = props => {
24
- return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
25
- onDeclare: onDeclare
23
+ const Drawing = props => {
24
+ return /*#__PURE__*/_react.default.createElement("skDrawing", _extends({
25
+ onDraw: onDraw,
26
+ skipProcessing: true
26
27
  }, props));
27
28
  };
28
29
 
29
- exports.Defs = Defs;
30
- //# sourceMappingURL=Defs.js.map
30
+ exports.Drawing = Drawing;
31
+ //# sourceMappingURL=Drawing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Drawing.tsx"],"names":["onDraw","ctx","drawing","Drawing","props"],"mappings":";;;;;;;AAAA;;AAGA;;;;;;AAMA,MAAMA,MAAM,GAAG,4BAA4B,CAACC,GAAD,WAAsB;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC/DA,EAAAA,OAAO,CAACD,GAAD,CAAP;AACD,CAFc,CAAf;;AAIO,MAAME,OAAO,GAAIC,KAAD,IAAyB;AAC9C,sBAAO;AAAW,IAAA,MAAM,EAAEJ,MAAnB;AAA2B,IAAA,cAAc;AAAzC,KAA8CI,KAA9C,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport { createDrawing } from \"../nodes/Drawing\";\n\ninterface DrawingProps {\n drawing: (ctx: DrawingContext) => void;\n}\n\nconst onDraw = createDrawing<DrawingProps>((ctx, { drawing }) => {\n drawing(ctx);\n});\n\nexport const Drawing = (props: DrawingProps) => {\n return <skDrawing onDraw={onDraw} skipProcessing {...props} />;\n};\n"]}
@@ -13,6 +13,8 @@ var _processors = require("../processors");
13
13
 
14
14
  var _nodes = require("../nodes");
15
15
 
16
+ var _Declaration = require("../nodes/Declaration");
17
+
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
 
18
20
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -30,35 +32,44 @@ const onDraw = (0, _nodes.createDrawing)((ctx, _ref, node) => {
30
32
  canvas,
31
33
  opacity
32
34
  } = ctx;
33
- const paint = (0, _processors.selectPaint)(ctx.paint, groupProps);
34
- (0, _processors.processPaint)(paint, opacity, groupProps);
35
-
36
- if (layer) {
37
- if (typeof layer === "boolean") {
38
- canvas.saveLayer();
39
- } else if (isSkPaint(layer)) {
40
- canvas.saveLayer(layer);
35
+ const declarations = node.children.filter(_Declaration.isDeclarationNode).map(child => child.draw(ctx));
36
+ const drawings = node.children.filter(child => child instanceof _nodes.DrawingNode);
37
+ const paint = (0, _processors.processPaint)(ctx.paint.copy(), opacity, groupProps, declarations);
38
+ const hasTransform = !!groupProps.transform || !!groupProps.matrix;
39
+ const hasClip = !!clip;
40
+ const shouldSave = hasTransform || hasClip || !!layer;
41
+
42
+ if (shouldSave) {
43
+ if (layer) {
44
+ if (typeof layer === "boolean") {
45
+ canvas.saveLayer();
46
+ } else if (isSkPaint(layer)) {
47
+ canvas.saveLayer(layer);
48
+ } else {
49
+ var _layer$current;
50
+
51
+ canvas.saveLayer((_layer$current = layer.current) !== null && _layer$current !== void 0 ? _layer$current : undefined);
52
+ }
41
53
  } else {
42
- var _layer$current;
43
-
44
- canvas.saveLayer((_layer$current = layer.current) !== null && _layer$current !== void 0 ? _layer$current : undefined);
54
+ canvas.save();
45
55
  }
46
- } else {
47
- canvas.save();
48
- }
49
56
 
50
- (0, _processors.processTransform)(ctx, groupProps);
57
+ (0, _processors.processTransform)(ctx, groupProps);
51
58
 
52
- if (clip) {
53
- const op = invertClip ? _skia.ClipOp.Difference : _skia.ClipOp.Intersect;
54
- (0, _processors.processClip)(canvas, clip, op);
59
+ if (clip) {
60
+ const op = invertClip ? _skia.ClipOp.Difference : _skia.ClipOp.Intersect;
61
+ (0, _processors.processClip)(canvas, clip, op);
62
+ }
55
63
  }
56
64
 
57
65
  node.visit({ ...ctx,
58
66
  paint,
59
67
  opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity
60
- });
61
- canvas.restore();
68
+ }, drawings);
69
+
70
+ if (shouldSave) {
71
+ canvas.restore();
72
+ }
62
73
  });
63
74
 
64
75
  const Group = props => {
@@ -1 +1 @@
1
- {"version":3,"sources":["Group.tsx"],"names":["isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","paint","saveLayer","current","undefined","save","op","ClipOp","Difference","Intersect","visit","restore","Group","props"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AAYA;;;;;;AAEA,MAAMA,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAG,0BACb,CAACC,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAsBP,GAA5B;AACA,QAAMQ,KAAK,GAAG,6BAAYR,GAAG,CAACQ,KAAhB,EAAuBH,UAAvB,CAAd;AACA,gCAAaG,KAAb,EAAoBD,OAApB,EAA6BF,UAA7B;;AACA,MAAIH,KAAJ,EAAW;AACT,QAAI,OAAOA,KAAP,KAAiB,SAArB,EAAgC;AAC9BI,MAAAA,MAAM,CAACG,SAAP;AACD,KAFD,MAEO,IAAIb,SAAS,CAACM,KAAD,CAAb,EAAsB;AAC3BI,MAAAA,MAAM,CAACG,SAAP,CAAiBP,KAAjB;AACD,KAFM,MAEA;AAAA;;AACLI,MAAAA,MAAM,CAACG,SAAP,mBAAiBP,KAAK,CAACQ,OAAvB,2DAAkCC,SAAlC;AACD;AACF,GARD,MAQO;AACLL,IAAAA,MAAM,CAACM,IAAP;AACD;;AACD,oCAAiBZ,GAAjB,EAAsBK,UAAtB;;AACA,MAAIF,IAAJ,EAAU;AACR,UAAMU,EAAE,GAAGT,UAAU,GAAGU,aAAOC,UAAV,GAAuBD,aAAOE,SAAnD;AACA,iCAAYV,MAAZ,EAAoBH,IAApB,EAA0BU,EAA1B;AACD;;AACDZ,EAAAA,IAAI,CAACgB,KAAL,CAAW,EACT,GAAGjB,GADM;AAETQ,IAAAA,KAFS;AAGTD,IAAAA,OAAO,EAAEF,UAAU,CAACE,OAAX,GAAqBF,UAAU,CAACE,OAAX,GAAqBA,OAA1C,GAAoDA;AAHpD,GAAX;AAKAD,EAAAA,MAAM,CAACY,OAAP;AACD,CA3BY,CAAf;;AA8BO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAW,IAAA,MAAM,EAAErB;AAAnB,KAA+BqB,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { ClipOp } from \"../../skia\";\nimport {\n processTransform,\n selectPaint,\n processPaint,\n processClip,\n} from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing } from \"../nodes\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity } = ctx;\n const paint = selectPaint(ctx.paint, groupProps);\n processPaint(paint, opacity, groupProps);\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processTransform(ctx, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(canvas, clip, op);\n }\n node.visit({\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n });\n canvas.restore();\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
1
+ {"version":3,"sources":["Group.tsx"],"names":["isSkPaint","obj","__typename__","onDraw","ctx","node","layer","clip","invertClip","groupProps","canvas","opacity","declarations","children","filter","isDeclarationNode","map","child","draw","drawings","DrawingNode","paint","copy","hasTransform","transform","matrix","hasClip","shouldSave","saveLayer","current","undefined","save","op","ClipOp","Difference","Intersect","visit","restore","Group","props"],"mappings":";;;;;;;AAAA;;AAIA;;AACA;;AAOA;;AACA;;;;;;AAEA,MAAMA,SAAS,GAAIC,GAAD,IAChB,kBAAkBA,GAAlB,IAAyBA,GAAG,CAACC,YAAJ,KAAqB,OADhD;;AASA,MAAMC,MAAM,GAAG,0BACb,CAACC,GAAD,QAAkDC,IAAlD,KAA2D;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,UAAf;AAA2B,OAAGC;AAA9B,GAAqD;AACzD,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAsBP,GAA5B;AACA,QAAMQ,YAAY,GAAGP,IAAI,CAACQ,QAAL,CAClBC,MADkB,CACXC,8BADW,EAElBC,GAFkB,CAEbC,KAAD,IAAWA,KAAK,CAACC,IAAN,CAAWd,GAAX,CAFG,CAArB;AAIA,QAAMe,QAAQ,GAAGd,IAAI,CAACQ,QAAL,CAAcC,MAAd,CACdG,KAAD,IAAWA,KAAK,YAAYG,kBADb,CAAjB;AAGA,QAAMC,KAAK,GAAG,8BACZjB,GAAG,CAACiB,KAAJ,CAAUC,IAAV,EADY,EAEZX,OAFY,EAGZF,UAHY,EAIZG,YAJY,CAAd;AAMA,QAAMW,YAAY,GAAG,CAAC,CAACd,UAAU,CAACe,SAAb,IAA0B,CAAC,CAACf,UAAU,CAACgB,MAA5D;AACA,QAAMC,OAAO,GAAG,CAAC,CAACnB,IAAlB;AACA,QAAMoB,UAAU,GAAGJ,YAAY,IAAIG,OAAhB,IAA2B,CAAC,CAACpB,KAAhD;;AACA,MAAIqB,UAAJ,EAAgB;AACd,QAAIrB,KAAJ,EAAW;AACT,UAAI,OAAOA,KAAP,KAAiB,SAArB,EAAgC;AAC9BI,QAAAA,MAAM,CAACkB,SAAP;AACD,OAFD,MAEO,IAAI5B,SAAS,CAACM,KAAD,CAAb,EAAsB;AAC3BI,QAAAA,MAAM,CAACkB,SAAP,CAAiBtB,KAAjB;AACD,OAFM,MAEA;AAAA;;AACLI,QAAAA,MAAM,CAACkB,SAAP,mBAAiBtB,KAAK,CAACuB,OAAvB,2DAAkCC,SAAlC;AACD;AACF,KARD,MAQO;AACLpB,MAAAA,MAAM,CAACqB,IAAP;AACD;;AACD,sCAAiB3B,GAAjB,EAAsBK,UAAtB;;AACA,QAAIF,IAAJ,EAAU;AACR,YAAMyB,EAAE,GAAGxB,UAAU,GAAGyB,aAAOC,UAAV,GAAuBD,aAAOE,SAAnD;AACA,mCAAYzB,MAAZ,EAAoBH,IAApB,EAA0ByB,EAA1B;AACD;AACF;;AACD3B,EAAAA,IAAI,CAAC+B,KAAL,CACE,EACE,GAAGhC,GADL;AAEEiB,IAAAA,KAFF;AAGEV,IAAAA,OAAO,EAAEF,UAAU,CAACE,OAAX,GAAqBF,UAAU,CAACE,OAAX,GAAqBA,OAA1C,GAAoDA;AAH/D,GADF,EAMEQ,QANF;;AAQA,MAAIQ,UAAJ,EAAgB;AACdjB,IAAAA,MAAM,CAAC2B,OAAP;AACD;AACF,CAhDY,CAAf;;AAmDO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAW,IAAA,MAAM,EAAEpC;AAAnB,KAA+BoC,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { RefObject } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { ClipOp } from \"../../skia\";\nimport { processTransform, processPaint, processClip } from \"../processors\";\nimport type {\n CustomPaintProps,\n TransformProps,\n AnimatedProps,\n ClipDef,\n} from \"../processors\";\nimport { createDrawing, DrawingNode } from \"../nodes\";\nimport { isDeclarationNode } from \"../nodes/Declaration\";\n\nconst isSkPaint = (obj: RefObject<SkPaint> | SkPaint): obj is SkPaint =>\n \"__typename__\" in obj && obj.__typename__ === \"Paint\";\n\nexport interface GroupProps extends CustomPaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: RefObject<SkPaint> | SkPaint | boolean;\n}\n\nconst onDraw = createDrawing<GroupProps>(\n (ctx, { layer, clip, invertClip, ...groupProps }, node) => {\n const { canvas, opacity } = ctx;\n const declarations = node.children\n .filter(isDeclarationNode)\n .map((child) => child.draw(ctx));\n\n const drawings = node.children.filter(\n (child) => child instanceof DrawingNode\n );\n const paint = processPaint(\n ctx.paint.copy(),\n opacity,\n groupProps,\n declarations\n );\n const hasTransform = !!groupProps.transform || !!groupProps.matrix;\n const hasClip = !!clip;\n const shouldSave = hasTransform || hasClip || !!layer;\n if (shouldSave) {\n if (layer) {\n if (typeof layer === \"boolean\") {\n canvas.saveLayer();\n } else if (isSkPaint(layer)) {\n canvas.saveLayer(layer);\n } else {\n canvas.saveLayer(layer.current ?? undefined);\n }\n } else {\n canvas.save();\n }\n processTransform(ctx, groupProps);\n if (clip) {\n const op = invertClip ? ClipOp.Difference : ClipOp.Intersect;\n processClip(canvas, clip, op);\n }\n }\n node.visit(\n {\n ...ctx,\n paint,\n opacity: groupProps.opacity ? groupProps.opacity * opacity : opacity,\n },\n drawings\n );\n if (shouldSave) {\n canvas.restore();\n }\n }\n);\n\nexport const Group = (props: AnimatedProps<GroupProps>) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
@@ -25,27 +25,7 @@ exports.usePaintRef = usePaintRef;
25
25
  const Paint = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
26
26
  const paint = (0, _react.useMemo)(() => _skia.Skia.Paint(), []);
27
27
  (0, _react.useImperativeHandle)(ref, () => paint, [paint]);
28
- const onDeclare = (0, _react.useMemo)(() => (0, _nodes.createDeclaration)((paintProps, children, ctx) => {
29
- (0, _processors.processPaint)(paint, ctx.opacity, paintProps);
30
- children.forEach(child => {
31
- if ((0, _skia.isShader)(child)) {
32
- paint.setShader(child);
33
- } else if ((0, _skia.isMaskFilter)(child)) {
34
- paint.setMaskFilter(child);
35
- } else if ((0, _skia.isColorFilter)(child)) {
36
- paint.setColorFilter(child);
37
- } else if ((0, _skia.isPathEffect)(child)) {
38
- paint.setPathEffect(child);
39
- }
40
- });
41
- const filters = children.filter(_skia.isImageFilter);
42
-
43
- if (filters.length > 0) {
44
- paint.setImageFilter(filters.reverse().reduce(_skia.Skia.ImageFilter.MakeCompose, null));
45
- }
46
-
47
- return paint;
48
- }), [paint]);
28
+ const onDeclare = (0, _react.useMemo)(() => (0, _nodes.createDeclaration)((paintProps, children, ctx) => (0, _processors.processPaint)(paint, ctx.opacity, paintProps, children)), [paint]);
49
29
  return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
50
30
  onDeclare: onDeclare
51
31
  }, props));
@@ -1 +1 @@
1
- {"version":3,"sources":["Paint.tsx"],"names":["usePaintRef","Paint","props","ref","paint","Skia","onDeclare","paintProps","children","ctx","opacity","forEach","child","setShader","setMaskFilter","setColorFilter","setPathEffect","filters","filter","isImageFilter","length","setImageFilter","reverse","reduce","ImageFilter","MakeCompose"],"mappings":";;;;;;;AACA;;AAGA;;AASA;;AACA;;;;;;;;AAEO,MAAMA,WAAW,GAAG,MAAM,mBAAgB,IAAhB,CAA1B;;;AAMA,MAAMC,KAAK,gBAAG,uBACnB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACd,QAAMC,KAAK,GAAG,oBAAQ,MAAMC,WAAKJ,KAAL,EAAd,EAA4B,EAA5B,CAAd;AACA,kCAAoBE,GAApB,EAAyB,MAAMC,KAA/B,EAAsC,CAACA,KAAD,CAAtC;AACA,QAAME,SAAS,GAAG,oBAChB,MACE,8BAA8B,CAACC,UAAD,EAAaC,QAAb,EAAuBC,GAAvB,KAA+B;AAC3D,kCAAaL,KAAb,EAAoBK,GAAG,CAACC,OAAxB,EAAiCH,UAAjC;AACAC,IAAAA,QAAQ,CAACG,OAAT,CAAkBC,KAAD,IAAW;AAC1B,UAAI,oBAASA,KAAT,CAAJ,EAAqB;AACnBR,QAAAA,KAAK,CAACS,SAAN,CAAgBD,KAAhB;AACD,OAFD,MAEO,IAAI,wBAAaA,KAAb,CAAJ,EAAyB;AAC9BR,QAAAA,KAAK,CAACU,aAAN,CAAoBF,KAApB;AACD,OAFM,MAEA,IAAI,yBAAcA,KAAd,CAAJ,EAA0B;AAC/BR,QAAAA,KAAK,CAACW,cAAN,CAAqBH,KAArB;AACD,OAFM,MAEA,IAAI,wBAAaA,KAAb,CAAJ,EAAyB;AAC9BR,QAAAA,KAAK,CAACY,aAAN,CAAoBJ,KAApB;AACD;AACF,KAVD;AAWA,UAAMK,OAAO,GAAGT,QAAQ,CAACU,MAAT,CAAgBC,mBAAhB,CAAhB;;AACA,QAAIF,OAAO,CAACG,MAAR,GAAiB,CAArB,EAAwB;AACtBhB,MAAAA,KAAK,CAACiB,cAAN,CACEJ,OAAO,CACJK,OADH,GAEGC,MAFH,CAGIlB,WAAKmB,WAAL,CAAiBC,WAHrB,EAII,IAJJ,CADF;AAQD;;AACD,WAAOrB,KAAP;AACD,GAzBD,CAFc,EA4BhB,CAACA,KAAD,CA5BgB,CAAlB;AA8BA,sBAAO;AAAe,IAAA,SAAS,EAAEE;AAA1B,KAAyCJ,KAAzC,EAAP;AACD,CAnCkB,CAAd","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useRef, useMemo, forwardRef, useImperativeHandle } from \"react\";\n\nimport type { SkPaint, SkImageFilter } from \"../../skia\";\nimport {\n isShader,\n isMaskFilter,\n isColorFilter,\n Skia,\n isImageFilter,\n isPathEffect,\n} from \"../../skia\";\nimport type { CustomPaintProps, AnimatedProps } from \"../processors\";\nimport { processPaint } from \"../processors\";\nimport { createDeclaration } from \"../nodes\";\n\nexport const usePaintRef = () => useRef<SkPaint>(null);\n\nexport interface PaintProps extends Omit<CustomPaintProps, \"paint\"> {\n children?: ReactNode | ReactNode[];\n}\n\nexport const Paint = forwardRef<SkPaint, AnimatedProps<PaintProps>>(\n (props, ref) => {\n const paint = useMemo(() => Skia.Paint(), []);\n useImperativeHandle(ref, () => paint, [paint]);\n const onDeclare = useMemo(\n () =>\n createDeclaration<PaintProps>((paintProps, children, ctx) => {\n processPaint(paint, ctx.opacity, paintProps);\n children.forEach((child) => {\n if (isShader(child)) {\n paint.setShader(child);\n } else if (isMaskFilter(child)) {\n paint.setMaskFilter(child);\n } else if (isColorFilter(child)) {\n paint.setColorFilter(child);\n } else if (isPathEffect(child)) {\n paint.setPathEffect(child);\n }\n });\n const filters = children.filter(isImageFilter);\n if (filters.length > 0) {\n paint.setImageFilter(\n filters\n .reverse()\n .reduce<SkImageFilter | null>(\n Skia.ImageFilter.MakeCompose,\n null\n )\n );\n }\n return paint;\n }),\n [paint]\n );\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n }\n);\n"]}
1
+ {"version":3,"sources":["Paint.tsx"],"names":["usePaintRef","Paint","props","ref","paint","Skia","onDeclare","paintProps","children","ctx","opacity"],"mappings":";;;;;;;AACA;;AAGA;;AAEA;;AACA;;;;;;;;AAEO,MAAMA,WAAW,GAAG,MAAM,mBAAgB,IAAhB,CAA1B;;;AAMA,MAAMC,KAAK,gBAAG,uBACnB,CAACC,KAAD,EAAQC,GAAR,KAAgB;AACd,QAAMC,KAAK,GAAG,oBAAQ,MAAMC,WAAKJ,KAAL,EAAd,EAA4B,EAA5B,CAAd;AACA,kCAAoBE,GAApB,EAAyB,MAAMC,KAA/B,EAAsC,CAACA,KAAD,CAAtC;AACA,QAAME,SAAS,GAAG,oBAChB,MACE,8BAA8B,CAACC,UAAD,EAAaC,QAAb,EAAuBC,GAAvB,KAC5B,8BAAaL,KAAb,EAAoBK,GAAG,CAACC,OAAxB,EAAiCH,UAAjC,EAA6CC,QAA7C,CADF,CAFc,EAKhB,CAACJ,KAAD,CALgB,CAAlB;AAOA,sBAAO;AAAe,IAAA,SAAS,EAAEE;AAA1B,KAAyCJ,KAAzC,EAAP;AACD,CAZkB,CAAd","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useRef, useMemo, forwardRef, useImperativeHandle } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { Skia } from \"../../skia\";\nimport type { CustomPaintProps, AnimatedProps } from \"../processors\";\nimport { processPaint } from \"../processors\";\nimport { createDeclaration } from \"../nodes\";\n\nexport const usePaintRef = () => useRef<SkPaint>(null);\n\nexport interface PaintProps extends Omit<CustomPaintProps, \"paint\"> {\n children?: ReactNode | ReactNode[];\n}\n\nexport const Paint = forwardRef<SkPaint, AnimatedProps<PaintProps>>(\n (props, ref) => {\n const paint = useMemo(() => Skia.Paint(), []);\n useImperativeHandle(ref, () => paint, [paint]);\n const onDeclare = useMemo(\n () =>\n createDeclaration<PaintProps>((paintProps, children, ctx) =>\n processPaint(paint, ctx.opacity, paintProps, children)\n ),\n [paint]\n );\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n }\n);\n"]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Picture = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _Drawing = require("../nodes/Drawing");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
+
16
+ const onDraw = (0, _Drawing.createDrawing)((ctx, _ref) => {
17
+ let {
18
+ picture
19
+ } = _ref;
20
+ const {
21
+ canvas
22
+ } = ctx;
23
+ canvas.drawPicture(picture);
24
+ });
25
+
26
+ const Picture = props => {
27
+ return /*#__PURE__*/_react.default.createElement("skDrawing", _extends({
28
+ onDraw: onDraw
29
+ }, props, {
30
+ skipProcessing: true
31
+ }));
32
+ };
33
+
34
+ exports.Picture = Picture;
35
+ //# sourceMappingURL=Picture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Picture.tsx"],"names":["onDraw","ctx","picture","canvas","drawPicture","Picture","props"],"mappings":";;;;;;;AAAA;;AAGA;;;;;;AAMA,MAAMA,MAAM,GAAG,4BAA4B,CAACC,GAAD,WAAsB;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAaF,GAAnB;AACAE,EAAAA,MAAM,CAACC,WAAP,CAAmBF,OAAnB;AACD,CAHc,CAAf;;AAKO,MAAMG,OAAO,GAAIC,KAAD,IAAyB;AAC9C,sBAAO;AAAW,IAAA,MAAM,EAAEN;AAAnB,KAA+BM,KAA/B;AAAsC,IAAA,cAAc;AAApD,KAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport type { SkPicture } from \"../../skia\";\nimport { createDrawing } from \"../nodes/Drawing\";\n\nexport interface PictureProps {\n picture: SkPicture;\n}\n\nconst onDraw = createDrawing<PictureProps>((ctx, { picture }) => {\n const { canvas } = ctx;\n canvas.drawPicture(picture);\n});\n\nexport const Picture = (props: PictureProps) => {\n return <skDrawing onDraw={onDraw} {...props} skipProcessing />;\n};\n"]}
@@ -3,43 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.InnerShadow = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
6
+ exports.MakeInnerShadow = void 0;
9
7
 
10
8
  var _skia = require("../../../skia");
11
9
 
12
- var _Declaration = require("../../nodes/Declaration");
13
-
14
- var _getInput = require("./getInput");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
- const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) => {
21
- let {
22
- dx,
23
- dy,
24
- blur,
25
- color,
26
- shadowOnly
27
- } = _ref;
28
- let {
29
- opacity
30
- } = _ref2;
31
- const input = (0, _getInput.getInput)(children);
32
- const cl = (0, _skia.processColor)(color, opacity);
33
-
10
+ const MakeInnerShadow = (shadowOnly, dx, dy, sigmaX, sigmaY, color, input) => {
34
11
  const sourceGraphic = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(0xff000000, _skia.BlendMode.Dst), null);
35
12
 
36
13
  const sourceAlpha = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(0xff000000, _skia.BlendMode.SrcIn), null);
37
14
 
38
- const f1 = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(cl, _skia.BlendMode.SrcOut), null);
15
+ const f1 = _skia.Skia.ImageFilter.MakeColorFilter(_skia.Skia.ColorFilter.MakeBlend(color, _skia.BlendMode.SrcOut), null);
39
16
 
40
17
  const f2 = _skia.Skia.ImageFilter.MakeOffset(dx, dy, f1);
41
18
 
42
- const f3 = _skia.Skia.ImageFilter.MakeBlur(blur, blur, _skia.TileMode.Decal, f2);
19
+ const f3 = _skia.Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, _skia.TileMode.Decal, f2);
43
20
 
44
21
  const f4 = _skia.Skia.ImageFilter.MakeBlend(_skia.BlendMode.SrcIn, sourceAlpha, f3);
45
22
 
@@ -48,13 +25,7 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
48
25
  }
49
26
 
50
27
  return _skia.Skia.ImageFilter.MakeCompose(input, _skia.Skia.ImageFilter.MakeBlend(_skia.BlendMode.SrcOver, sourceGraphic, f4));
51
- });
52
-
53
- const InnerShadow = props => {
54
- return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
55
- onDeclare: onDeclare
56
- }, props));
57
28
  };
58
29
 
59
- exports.InnerShadow = InnerShadow;
30
+ exports.MakeInnerShadow = MakeInnerShadow;
60
31
  //# sourceMappingURL=InnerShadow.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["InnerShadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","shadowOnly","opacity","input","cl","sourceGraphic","Skia","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","InnerShadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAIA;;;;;;AAWA,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,EAAE,GAAG,wBAAaJ,KAAb,EAAoBE,OAApB,CAAX;;AACA,QAAMG,aAAa,GAAGC,WAAKC,WAAL,CAAiBC,eAAjB,CACpBF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCC,gBAAUC,GAAjD,CADoB,EAEpB,IAFoB,CAAtB;;AAIA,QAAMC,WAAW,GAAGP,WAAKC,WAAL,CAAiBC,eAAjB,CAClBF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCC,gBAAUG,KAAjD,CADkB,EAElB,IAFkB,CAApB;;AAIA,QAAMC,EAAE,GAAGT,WAAKC,WAAL,CAAiBC,eAAjB,CACTF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2BN,EAA3B,EAA+BO,gBAAUK,MAAzC,CADS,EAET,IAFS,CAAX;;AAIA,QAAMC,EAAE,GAAGX,WAAKC,WAAL,CAAiBW,UAAjB,CAA4BrB,EAA5B,EAAgCC,EAAhC,EAAoCiB,EAApC,CAAX;;AACA,QAAMI,EAAE,GAAGb,WAAKC,WAAL,CAAiBa,QAAjB,CAA0BrB,IAA1B,EAAgCA,IAAhC,EAAsCsB,eAASC,KAA/C,EAAsDL,EAAtD,CAAX;;AACA,QAAMM,EAAE,GAAGjB,WAAKC,WAAL,CAAiBG,SAAjB,CAA2BC,gBAAUG,KAArC,EAA4CD,WAA5C,EAAyDM,EAAzD,CAAX;;AACA,MAAIlB,UAAJ,EAAgB;AACd,WAAOsB,EAAP;AACD;;AACD,SAAOjB,WAAKC,WAAL,CAAiBiB,WAAjB,CACLrB,KADK,EAELG,WAAKC,WAAL,CAAiBG,SAAjB,CAA2BC,gBAAUc,OAArC,EAA8CpB,aAA9C,EAA6DkB,EAA7D,CAFK,CAAP;AAID,CA1Be,CAAlB;;AA6BO,MAAMG,WAAW,GAAIC,KAAD,IAA4C;AACrE,sBAAO;AAAe,IAAA,SAAS,EAAEhC;AAA1B,KAAyCgC,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { BlendMode, Skia, TileMode, processColor } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors\";\nimport type { Color } from \"../../../skia\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface InnerShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n shadowOnly?: boolean;\n inner?: boolean;\n}\n\nconst onDeclare = createDeclaration<InnerShadowProps>(\n ({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {\n const input = getInput(children);\n const cl = processColor(color, opacity);\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(cl, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(blur, blur, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n }\n);\n\nexport const InnerShadow = (props: AnimatedProps<InnerShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["InnerShadow.tsx"],"names":["MakeInnerShadow","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","Skia","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver"],"mappings":";;;;;;;AACA;;AAGO,MAAMA,eAAe,GAAG,CAC7BC,UAD6B,EAE7BC,EAF6B,EAG7BC,EAH6B,EAI7BC,MAJ6B,EAK7BC,MAL6B,EAM7BC,KAN6B,EAO7BC,KAP6B,KAQ1B;AACH,QAAMC,aAAa,GAAGC,WAAKC,WAAL,CAAiBC,eAAjB,CACpBF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCC,gBAAUC,GAAjD,CADoB,EAEpB,IAFoB,CAAtB;;AAIA,QAAMC,WAAW,GAAGP,WAAKC,WAAL,CAAiBC,eAAjB,CAClBF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCC,gBAAUG,KAAjD,CADkB,EAElB,IAFkB,CAApB;;AAIA,QAAMC,EAAE,GAAGT,WAAKC,WAAL,CAAiBC,eAAjB,CACTF,WAAKG,WAAL,CAAiBC,SAAjB,CAA2BP,KAA3B,EAAkCQ,gBAAUK,MAA5C,CADS,EAET,IAFS,CAAX;;AAIA,QAAMC,EAAE,GAAGX,WAAKC,WAAL,CAAiBW,UAAjB,CAA4BnB,EAA5B,EAAgCC,EAAhC,EAAoCe,EAApC,CAAX;;AACA,QAAMI,EAAE,GAAGb,WAAKC,WAAL,CAAiBa,QAAjB,CAA0BnB,MAA1B,EAAkCC,MAAlC,EAA0CmB,eAASC,KAAnD,EAA0DL,EAA1D,CAAX;;AACA,QAAMM,EAAE,GAAGjB,WAAKC,WAAL,CAAiBG,SAAjB,CAA2BC,gBAAUG,KAArC,EAA4CD,WAA5C,EAAyDM,EAAzD,CAAX;;AACA,MAAIrB,UAAJ,EAAgB;AACd,WAAOyB,EAAP;AACD;;AACD,SAAOjB,WAAKC,WAAL,CAAiBiB,WAAjB,CACLpB,KADK,EAELE,WAAKC,WAAL,CAAiBG,SAAjB,CAA2BC,gBAAUc,OAArC,EAA8CpB,aAA9C,EAA6DkB,EAA7D,CAFK,CAAP;AAID,CA/BM","sourcesContent":["import type { SkColor } from \"../../../skia\";\nimport { BlendMode, Skia, TileMode } from \"../../../skia\";\nimport type { SkImageFilter } from \"../../../skia/ImageFilter/ImageFilter\";\n\nexport const MakeInnerShadow = (\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DropShadow = void 0;
6
+ exports.Shadow = void 0;
7
7
 
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
 
@@ -15,6 +15,8 @@ var _Color = require("../../../skia/Color");
15
15
 
16
16
  var _getInput = require("./getInput");
17
17
 
18
+ var _InnerShadow = require("./InnerShadow");
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -24,22 +26,31 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
24
26
  dx,
25
27
  dy,
26
28
  blur,
27
- color,
28
- shadowOnly
29
+ color: cl,
30
+ shadowOnly,
31
+ inner
29
32
  } = _ref;
30
33
  let {
31
34
  opacity
32
35
  } = _ref2;
33
36
  const input = (0, _getInput.getInput)(children);
34
- const factory = shadowOnly ? _skia.Skia.ImageFilter.MakeDropShadowOnly : _skia.Skia.ImageFilter.MakeDropShadow;
35
- return factory(dx, dy, blur, blur, (0, _Color.processColor)(color, opacity), input);
37
+ const color = (0, _Color.processColor)(cl, opacity);
38
+ let factory;
39
+
40
+ if (inner) {
41
+ factory = _InnerShadow.MakeInnerShadow.bind(null, shadowOnly);
42
+ } else {
43
+ factory = shadowOnly ? _skia.Skia.ImageFilter.MakeDropShadowOnly : _skia.Skia.ImageFilter.MakeDropShadow;
44
+ }
45
+
46
+ return factory(dx, dy, blur, blur, color, input);
36
47
  });
37
48
 
38
- const DropShadow = props => {
49
+ const Shadow = props => {
39
50
  return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
40
51
  onDeclare: onDeclare
41
52
  }, props));
42
53
  };
43
54
 
44
- exports.DropShadow = DropShadow;
45
- //# sourceMappingURL=DropShadow.js.map
55
+ exports.Shadow = Shadow;
56
+ //# sourceMappingURL=Shadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Shadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","input","factory","MakeInnerShadow","bind","Skia","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAGA;;AAEA;;AACA;;;;;;AAWA,MAAMA,SAAS,GAAG,oCAChB,OAAiDC,QAAjD,YAA2E;AAAA,MAA1E;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAA0E;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACzE,QAAMC,KAAK,GAAG,wBAAST,QAAT,CAAd;AACA,QAAMI,KAAK,GAAG,yBAAaC,EAAb,EAAiBG,OAAjB,CAAd;AACA,MAAIE,OAAJ;;AACA,MAAIH,KAAJ,EAAW;AACTG,IAAAA,OAAO,GAAGC,6BAAgBC,IAAhB,CAAqB,IAArB,EAA2BN,UAA3B,CAAV;AACD,GAFD,MAEO;AACLI,IAAAA,OAAO,GAAGJ,UAAU,GAChBO,WAAKC,WAAL,CAAiBC,kBADD,GAEhBF,WAAKC,WAAL,CAAiBE,cAFrB;AAGD;;AACD,SAAON,OAAO,CAACT,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBC,KAArB,EAA4BK,KAA5B,CAAd;AACD,CAbe,CAAlB;;AAgBO,MAAMQ,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEnB;AAA1B,KAAyCmB,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\";\nimport { MakeInnerShadow } from \"./InnerShadow\";\n\nexport interface ShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<ShadowProps>(\n ({ dx, dy, blur, color: cl, shadowOnly, inner }, children, { opacity }) => {\n const input = getInput(children);\n const color = processColor(cl, opacity);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, shadowOnly);\n } else {\n factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n);\n\nexport const Shadow = (props: AnimatedProps<ShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -43,28 +43,15 @@ Object.keys(_DisplacementMap).forEach(function (key) {
43
43
  });
44
44
  });
45
45
 
46
- var _DropShadow = require("./DropShadow");
46
+ var _Shadow = require("./Shadow");
47
47
 
48
- Object.keys(_DropShadow).forEach(function (key) {
48
+ Object.keys(_Shadow).forEach(function (key) {
49
49
  if (key === "default" || key === "__esModule") return;
50
- if (key in exports && exports[key] === _DropShadow[key]) return;
50
+ if (key in exports && exports[key] === _Shadow[key]) return;
51
51
  Object.defineProperty(exports, key, {
52
52
  enumerable: true,
53
53
  get: function () {
54
- return _DropShadow[key];
55
- }
56
- });
57
- });
58
-
59
- var _InnerShadow = require("./InnerShadow");
60
-
61
- Object.keys(_InnerShadow).forEach(function (key) {
62
- if (key === "default" || key === "__esModule") return;
63
- if (key in exports && exports[key] === _InnerShadow[key]) return;
64
- Object.defineProperty(exports, key, {
65
- enumerable: true,
66
- get: function () {
67
- return _InnerShadow[key];
54
+ return _Shadow[key];
68
55
  }
69
56
  });
70
57
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Blur\";\nexport * from \"./Offset\";\nexport * from \"./DisplacementMap\";\nexport * from \"./DropShadow\";\nexport * from \"./InnerShadow\";\nexport * from \"./Morphology\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Blur\";\nexport * from \"./Offset\";\nexport * from \"./DisplacementMap\";\nexport * from \"./Shadow\";\nexport * from \"./Morphology\";\n"]}
@@ -134,6 +134,19 @@ Object.keys(_processors).forEach(function (key) {
134
134
  });
135
135
  });
136
136
 
137
+ var _Picture = require("./Picture");
138
+
139
+ Object.keys(_Picture).forEach(function (key) {
140
+ if (key === "default" || key === "__esModule") return;
141
+ if (key in exports && exports[key] === _Picture[key]) return;
142
+ Object.defineProperty(exports, key, {
143
+ enumerable: true,
144
+ get: function () {
145
+ return _Picture[key];
146
+ }
147
+ });
148
+ });
149
+
137
150
  var _Group = require("./Group");
138
151
 
139
152
  Object.keys(_Group).forEach(function (key) {
@@ -199,15 +212,15 @@ Object.keys(_Blend).forEach(function (key) {
199
212
  });
200
213
  });
201
214
 
202
- var _Defs = require("./Defs");
215
+ var _Drawing = require("./Drawing");
203
216
 
204
- Object.keys(_Defs).forEach(function (key) {
217
+ Object.keys(_Drawing).forEach(function (key) {
205
218
  if (key === "default" || key === "__esModule") return;
206
- if (key in exports && exports[key] === _Defs[key]) return;
219
+ if (key in exports && exports[key] === _Drawing[key]) return;
207
220
  Object.defineProperty(exports, key, {
208
221
  enumerable: true,
209
222
  get: function () {
210
- return _Defs[key];
223
+ return _Drawing[key];
211
224
  }
212
225
  });
213
226
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./shapes\";\nexport * from \"./backdrop\";\nexport * from \"./image\";\nexport * from \"./shaders\";\nexport * from \"./text\";\nexport * from \"./colorFilters\";\nexport * from \"./maskFilters\";\nexport * from \"./imageFilters\";\nexport * from \"./pathEffects\";\nexport * from \"../processors\";\n\nexport * from \"./Group\";\nexport * from \"./Mask\";\nexport * from \"./Paint\";\nexport * from \"./Compose\";\nexport * from \"./Blend\";\nexport * from \"./Defs\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./shapes\";\nexport * from \"./backdrop\";\nexport * from \"./image\";\nexport * from \"./shaders\";\nexport * from \"./text\";\nexport * from \"./colorFilters\";\nexport * from \"./maskFilters\";\nexport * from \"./imageFilters\";\nexport * from \"./pathEffects\";\nexport * from \"../processors\";\nexport * from \"./Picture\";\n\nexport * from \"./Group\";\nexport * from \"./Mask\";\nexport * from \"./Paint\";\nexport * from \"./Compose\";\nexport * from \"./Blend\";\nexport * from \"./Drawing\";\n"]}
@@ -37,6 +37,6 @@ const BlurMask = props => {
37
37
  exports.BlurMask = BlurMask;
38
38
  BlurMask.defaultProps = {
39
39
  style: "normal",
40
- respectCTM: false
40
+ respectCTM: true
41
41
  };
42
42
  //# sourceMappingURL=Blur.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Blur.tsx"],"names":["onDeclare","style","blur","respectCTM","Skia","MaskFilter","MakeBlur","BlurStyle","BlurMask","props","defaultProps"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AASA,MAAMA,SAAS,GAAG,oCAChB,QAAiC;AAAA,MAAhC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA;AAAf,GAAgC;AAC/B,SAAOC,WAAKC,UAAL,CAAgBC,QAAhB,CACLC,sBAAU,yBAAQN,KAAR,CAAV,CADK,EAELC,IAFK,EAGLC,UAHK,CAAP;AAKD,CAPe,CAAlB;;AAUO,MAAMK,QAAQ,GAAIC,KAAD,IAAyC;AAC/D,sBAAO;AAAe,IAAA,SAAS,EAAET;AAA1B,KAAyCS,KAAzC,EAAP;AACD,CAFM;;;AAIPD,QAAQ,CAACE,YAAT,GAAwB;AACtBT,EAAAA,KAAK,EAAE,QADe;AAEtBE,EAAAA,UAAU,EAAE;AAFU,CAAxB","sourcesContent":["import React from \"react\";\n\nimport { BlurStyle } from \"../../../skia/MaskFilter\";\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { SkEnum } from \"../../processors\";\nimport { enumKey } from \"../../processors\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\n\nexport interface BlurMaskProps {\n style: SkEnum<typeof BlurStyle>;\n blur: number;\n respectCTM: boolean;\n}\n\nconst onDeclare = createDeclaration<BlurMaskProps>(\n ({ style, blur, respectCTM }) => {\n return Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n }\n);\n\nexport const BlurMask = (props: AnimatedProps<BlurMaskProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nBlurMask.defaultProps = {\n style: \"normal\",\n respectCTM: false,\n};\n"]}
1
+ {"version":3,"sources":["Blur.tsx"],"names":["onDeclare","style","blur","respectCTM","Skia","MaskFilter","MakeBlur","BlurStyle","BlurMask","props","defaultProps"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEA;;;;;;AASA,MAAMA,SAAS,GAAG,oCAChB,QAAiC;AAAA,MAAhC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA;AAAf,GAAgC;AAC/B,SAAOC,WAAKC,UAAL,CAAgBC,QAAhB,CACLC,sBAAU,yBAAQN,KAAR,CAAV,CADK,EAELC,IAFK,EAGLC,UAHK,CAAP;AAKD,CAPe,CAAlB;;AAUO,MAAMK,QAAQ,GAAIC,KAAD,IAAyC;AAC/D,sBAAO;AAAe,IAAA,SAAS,EAAET;AAA1B,KAAyCS,KAAzC,EAAP;AACD,CAFM;;;AAIPD,QAAQ,CAACE,YAAT,GAAwB;AACtBT,EAAAA,KAAK,EAAE,QADe;AAEtBE,EAAAA,UAAU,EAAE;AAFU,CAAxB","sourcesContent":["import React from \"react\";\n\nimport { BlurStyle } from \"../../../skia/MaskFilter\";\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { SkEnum } from \"../../processors\";\nimport { enumKey } from \"../../processors\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\n\nexport interface BlurMaskProps {\n style: SkEnum<typeof BlurStyle>;\n blur: number;\n respectCTM: boolean;\n}\n\nconst onDeclare = createDeclaration<BlurMaskProps>(\n ({ style, blur, respectCTM }) => {\n return Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n }\n);\n\nexport const BlurMask = (props: AnimatedProps<BlurMaskProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nBlurMask.defaultProps = {\n style: \"normal\",\n respectCTM: true,\n};\n"]}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BoxShadow = exports.Box = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _skia = require("../../../skia");
11
+
12
+ var _nodes = require("../../nodes");
13
+
14
+ var _processors = require("../../processors");
15
+
16
+ var _Rects = require("../../processors/Rects");
17
+
18
+ var _Declaration = require("../../nodes/Declaration");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
24
+ const inflate = function (box, dx, dy) {
25
+ let tx = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
26
+ let ty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
27
+ return (0, _processors.rrect)((0, _Rects.rect)(box.rect.x - dx + tx, box.rect.y - dy + ty, box.rect.width + 2 * dx, box.rect.height + 2 * dy), box.rx + dx, box.ry + dy);
28
+ };
29
+
30
+ const deflate = function (box, dx, dy) {
31
+ let tx = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
32
+ let ty = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
33
+ return inflate(box, -dx, -dy, tx, ty);
34
+ };
35
+
36
+ const onDeclare = (0, _Declaration.createDeclaration)(_ref => {
37
+ let {
38
+ dx,
39
+ dy,
40
+ spread,
41
+ blur,
42
+ color,
43
+ inner
44
+ } = _ref;
45
+ return {
46
+ dx,
47
+ dy,
48
+ spread,
49
+ blur,
50
+ color,
51
+ inner,
52
+ __typename__: "BoxShadow"
53
+ };
54
+ });
55
+
56
+ const BoxShadow = props => {
57
+ return /*#__PURE__*/_react.default.createElement("skDeclaration", _extends({
58
+ onDeclare: onDeclare
59
+ }, props));
60
+ };
61
+
62
+ exports.BoxShadow = BoxShadow;
63
+
64
+ const isBoxShadow = s => s.__typename__ === "BoxShadow";
65
+
66
+ const onDraw = (0, _nodes.createDrawing)((ctx, _ref2, node) => {
67
+ let {
68
+ box: defaultBox
69
+ } = _ref2;
70
+ const box = (0, _Rects.isRRect)(defaultBox) ? defaultBox : (0, _processors.rrect)(defaultBox, 0, 0);
71
+ const {
72
+ canvas,
73
+ paint,
74
+ opacity
75
+ } = ctx;
76
+ const shadows = node.visit(ctx).filter(isBoxShadow);
77
+ shadows.filter(shadow => !shadow.inner).map(shadow => {
78
+ const {
79
+ color = "black",
80
+ blur,
81
+ spread = 0,
82
+ dx = 0,
83
+ dy = 0
84
+ } = shadow;
85
+
86
+ const lPaint = _skia.Skia.Paint();
87
+
88
+ lPaint.setColor((0, _skia.processColor)(color, opacity));
89
+ lPaint.setMaskFilter(_skia.Skia.MaskFilter.MakeBlur(_skia.BlurStyle.Normal, blur, true));
90
+ canvas.drawRRect(inflate(box, spread, spread, dx, dy), lPaint);
91
+ });
92
+ canvas.drawRRect(box, paint);
93
+ shadows.filter(shadow => shadow.inner).map(shadow => {
94
+ const {
95
+ color = "black",
96
+ blur,
97
+ spread = 0,
98
+ dx = 0,
99
+ dy = 0
100
+ } = shadow;
101
+ const delta = (0, _processors.add)((0, _processors.vec)(10, 10), (0, _processors.vec)(Math.abs(dx), Math.abs(dy)));
102
+ canvas.save();
103
+ canvas.clipRRect(box, _skia.ClipOp.Intersect, false);
104
+
105
+ const lPaint = _skia.Skia.Paint();
106
+
107
+ lPaint.setColor((0, _skia.processColor)(color, opacity));
108
+ lPaint.setMaskFilter(_skia.Skia.MaskFilter.MakeBlur(_skia.BlurStyle.Normal, blur, true));
109
+ const inner = deflate(box, spread, spread, dx, dy);
110
+ const outer = inflate(box, delta.x, delta.y);
111
+ canvas.drawDRRect(outer, inner, lPaint);
112
+ canvas.restore();
113
+ });
114
+ });
115
+
116
+ const Box = props => {
117
+ return /*#__PURE__*/_react.default.createElement("skDrawing", _extends({
118
+ onDraw: onDraw
119
+ }, props));
120
+ };
121
+
122
+ exports.Box = Box;
123
+ Box.defaultProps = {
124
+ shadows: []
125
+ };
126
+ //# sourceMappingURL=Box.js.map