@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 +1 @@
1
- {"version":3,"names":["BlurStyle","ClipOp","isRRect","DeclarationType","NodeType","JsiDeclarationNode","JsiRenderNode","inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","constructor","ctx","props","Unknown","Box","materialize","BoxNode","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode<\n BoxShadowProps,\n BoxShadowProps\n> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, DeclarationType.Unknown, NodeType.Box, props);\n }\n\n materialize() {\n return this.props;\n }\n}\n\nexport class BoxNode extends JsiRenderNode<BoxProps> {\n constructor(ctx: NodeContext, props: BoxProps) {\n super(ctx, NodeType.Box, props);\n }\n\n renderNode({ canvas, paint }: DrawingContext) {\n const { box: defaultBox } = this.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox)\n ? defaultBox\n : this.Skia.RRectXY(defaultBox, 0, 0);\n const shadows = this._children\n .map((node) => {\n if (node instanceof BoxShadowNode) {\n return node.materialize();\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(\n inflate(this.Skia, box, spread, spread, dx, dy),\n lPaint\n );\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = this.Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(this.Skia, box, spread, spread, dx, dy);\n const outer = inflate(this.Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n }\n}\n"],"mappings":"AACA,SAASA,SAAT,EAAoBC,MAApB,EAA4BC,OAA5B,QAA2C,qBAA3C;AAEA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AAGA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,aAAT,QAA8B,eAA9B;;AAEA,MAAMC,OAAO,GAAG,UACdC,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EAAA,OAQdL,IAAI,CAACM,OAAL,CACEN,IAAI,CAACO,QAAL,CACEN,GAAG,CAACO,IAAJ,CAASC,CAAT,GAAaP,EAAb,GAAkBE,EADpB,EAEEH,GAAG,CAACO,IAAJ,CAASE,CAAT,GAAaP,EAAb,GAAkBE,EAFpB,EAGEJ,GAAG,CAACO,IAAJ,CAASG,KAAT,GAAiB,IAAIT,EAHvB,EAIED,GAAG,CAACO,IAAJ,CAASI,MAAT,GAAkB,IAAIT,EAJxB,CADF,EAOEF,GAAG,CAACY,EAAJ,GAASX,EAPX,EAQED,GAAG,CAACa,EAAJ,GAASX,EARX,CARc;AAAA,CAAhB;;AA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I,CAACC,GAAL,CAASnD,EAAT,CAAxC,CAAd;MACAsB,MAAM,CAAC8B,IAAP;MACA9B,MAAM,CAAC+B,SAAP,CAAiBvD,GAAjB,EAAsBR,MAAM,CAACgE,SAA7B,EAAwC,KAAxC;MACA,MAAMhB,MAAM,GAAG,KAAKzC,IAAL,CAAU0C,KAAV,EAAf;MACAD,MAAM,CAACE,QAAP,CAAgB,KAAK3C,IAAL,CAAU4C,KAAV,CAAgBN,KAAhB,CAAhB;MACAG,MAAM,CAACI,SAAP,CAAiBnB,KAAK,CAACG,SAAN,KAAoBD,OAArC;MAEAa,MAAM,CAACK,aAAP,CACE,KAAK9C,IAAL,CAAU+C,UAAV,CAAqBC,QAArB,CAA8BxD,SAAS,CAACyD,MAAxC,EAAgDV,IAAhD,EAAsD,IAAtD,CADF;MAGA,MAAMF,KAAK,GAAGtB,OAAO,CAAC,KAAKf,IAAN,EAAYC,GAAZ,EAAiBuC,MAAjB,EAAyBA,MAAzB,EAAiCtC,EAAjC,EAAqCC,EAArC,CAArB;MACA,MAAMuD,KAAK,GAAG3D,OAAO,CAAC,KAAKC,IAAN,EAAYC,GAAZ,EAAiBkD,KAAK,CAAC1C,CAAvB,EAA0B0C,KAAK,CAACzC,CAAhC,CAArB;MACAe,MAAM,CAACkC,UAAP,CAAkBD,KAAlB,EAAyBrB,KAAzB,EAAgCI,MAAhC;MACAhB,MAAM,CAACmC,OAAP;IACD,CAlBH;EAmBD;;AAxDkD"}
1
+ {"version":3,"names":["BlurStyle","ClipOp","isRRect","DeclarationType","NodeType","JsiDeclarationNode","JsiRenderNode","inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","constructor","ctx","props","Unknown","BoxShadow","materialize","BoxNode","Box","renderNode","canvas","paint","defaultBox","opacity","getAlphaf","shadows","_children","map","node","filter","n","shadow","inner","color","blur","spread","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","outer","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import type { SkRRect, Skia } from \"../../../skia/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { DrawingContext } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\n\nconst inflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) =>\n Skia.RRectXY(\n Skia.XYWHRect(\n box.rect.x - dx + tx,\n box.rect.y - dy + ty,\n box.rect.width + 2 * dx,\n box.rect.height + 2 * dy\n ),\n box.rx + dx,\n box.ry + dy\n );\n\nconst deflate = (\n Skia: Skia,\n box: SkRRect,\n dx: number,\n dy: number,\n tx = 0,\n ty = 0\n) => inflate(Skia, box, -dx, -dy, tx, ty);\n\nexport class BoxShadowNode extends JsiDeclarationNode<\n BoxShadowProps,\n BoxShadowProps\n> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, DeclarationType.Unknown, NodeType.BoxShadow, props);\n }\n\n materialize() {\n return this.props;\n }\n}\n\nexport class BoxNode extends JsiRenderNode<BoxProps> {\n constructor(ctx: NodeContext, props: BoxProps) {\n super(ctx, NodeType.Box, props);\n }\n\n renderNode({ canvas, paint }: DrawingContext) {\n const { box: defaultBox } = this.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox)\n ? defaultBox\n : this.Skia.RRectXY(defaultBox, 0, 0);\n const shadows = this._children\n .map((node) => {\n if (node instanceof BoxShadowNode) {\n return node.materialize();\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(\n inflate(this.Skia, box, spread, spread, dx, dy),\n lPaint\n );\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = this.Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = this.Skia.Paint();\n lPaint.setColor(this.Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n this.Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(this.Skia, box, spread, spread, dx, dy);\n const outer = inflate(this.Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n }\n}\n"],"mappings":"AACA,SAASA,SAAT,EAAoBC,MAApB,EAA4BC,OAA5B,QAA2C,qBAA3C;AAEA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AAGA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,aAAT,QAA8B,eAA9B;;AAEA,MAAMC,OAAO,GAAG,UACdC,IADc,EAEdC,GAFc,EAGdC,EAHc,EAIdC,EAJc;EAAA,IAKdC,EALc,uEAKT,CALS;EAAA,IAMdC,EANc,uEAMT,CANS;EAAA,OAQdL,IAAI,CAACM,OAAL,CACEN,IAAI,CAACO,QAAL,CACEN,GAAG,CAACO,IAAJ,CAASC,CAAT,GAAaP,EAAb,GAAkBE,EADpB,EAEEH,GAAG,CAACO,IAAJ,CAASE,CAAT,GAAaP,EAAb,GAAkBE,EAFpB,EAGEJ,GAAG,CAACO,IAAJ,CAAS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
13
14
  } = this.props;
15
+ const fit = (_this$props$fit = this.props.fit) !== null && _this$props$fit !== void 0 ? _this$props$fit : "contain";
14
16
  const rect = processRect(this.Skia, this.props);
15
17
  const {
16
18
  src,
@@ -1 +1 @@
1
- {"version":3,"names":["NodeType","fitRects","processRect","JsiDrawingNode","ImageNode","constructor","ctx","props","Image","deriveProps","image","fit","rect","Skia","src","dst","x","y","width","height","draw","canvas","paint","derived","Error","drawImageRect"],"sources":["ImageNode.ts"],"sourcesContent":["import type { SkRect } from \"../../../skia/types\";\nimport type { DrawingContext, ImageProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { fitRects, processRect } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class ImageNode extends JsiDrawingNode<\n ImageProps,\n { src: SkRect; dst: SkRect }\n> {\n constructor(ctx: NodeContext, props: ImageProps) {\n super(ctx, NodeType.Image, props);\n }\n\n deriveProps() {\n const { image, fit } = this.props;\n const rect = processRect(this.Skia, this.props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n return { src, dst };\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { image } = this.props;\n if (!this.derived) {\n throw new Error(\"ImageNode: src and dst are undefined\");\n }\n const { src, dst } = this.derived;\n canvas.drawImageRect(image, src, dst, paint);\n }\n}\n"],"mappings":"AAEA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,EAAmBC,WAAnB,QAAsC,cAAtC;AACA,SAASC,cAAT,QAA+B,gBAA/B;AAGA,OAAO,MAAMC,SAAN,SAAwBD,cAAxB,CAGL;EACAE,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAsC;IAC/C,MAAMD,GAAN,EAAWN,QAAQ,CAACQ,KAApB,EAA2BD,KAA3B;EACD;;EAEDE,WAAW,GAAG;IACZ,MAAM;MAAEC,KAAF;MAASC;IAAT,IAAiB,KAAKJ,KAA5B;IACA,MAAMK,IAAI,GAAGV,WAAW,CAAC,KAAKW,IAAN,EAAY,KAAKN,KAAjB,CAAxB;IACA,MAAM;MAAEO,GAAF;MAAOC;IAAP,IAAed,QAAQ,CAC3BU,GAD2B,EAE3B;MACEK,CAAC,EAAE,CADL;MAEEC,CAAC,EAAE,CAFL;MAGEC,KAAK,EAAER,KAAK,CAACQ,KAAN,EAHT;MAIEC,MAAM,EAAET,KAAK,CAACS,MAAN;IAJV,CAF2B,EAQ3BP,IAR2B,CAA7B;IAUA,OAAO;MAAEE,GAAF;MAAOC;IAAP,CAAP;EACD;;EAEDK,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;IACtC,MAAM;MAAEZ;IAAF,IAAY,KAAKH,KAAvB;;IACA,IAAI,CAAC,KAAKgB,OAAV,EAAmB;MACjB,MAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;IACD;;IACD,MAAM;MAAEV,GAAF;MAAOC;IAAP,IAAe,KAAKQ,OAA1B;IACAF,MAAM,CAACI,aAAP,CAAqBf,KAArB,EAA4BI,GAA5B,EAAiCC,GAAjC,EAAsCO,KAAtC;EACD;;AA5BD"}
1
+ {"version":3,"names":["NodeType","fitRects","processRect","JsiDrawingNode","ImageNode","constructor","ctx","props","Image","deriveProps","image","fit","rect","Skia","src","dst","x","y","width","height","draw","canvas","paint","derived","Error","drawImageRect"],"sources":["ImageNode.ts"],"sourcesContent":["import type { SkRect } from \"../../../skia/types\";\nimport type { DrawingContext, ImageProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { fitRects, processRect } from \"../datatypes\";\nimport { JsiDrawingNode } from \"../DrawingNode\";\nimport type { NodeContext } from \"../Node\";\n\nexport class ImageNode extends JsiDrawingNode<\n ImageProps,\n { src: SkRect; dst: SkRect }\n> {\n constructor(ctx: NodeContext, props: ImageProps) {\n super(ctx, NodeType.Image, props);\n }\n\n deriveProps() {\n const { image } = this.props;\n const fit = this.props.fit ?? \"contain\";\n const rect = processRect(this.Skia, this.props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n return { src, dst };\n }\n\n draw({ canvas, paint }: DrawingContext) {\n const { image } = this.props;\n if (!this.derived) {\n throw new Error(\"ImageNode: src and dst are undefined\");\n }\n const { src, dst } = this.derived;\n canvas.drawImageRect(image, src, dst, paint);\n }\n}\n"],"mappings":"AAEA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,EAAmBC,WAAnB,QAAsC,cAAtC;AACA,SAASC,cAAT,QAA+B,gBAA/B;AAGA,OAAO,MAAMC,SAAN,SAAwBD,cAAxB,CAGL;EACAE,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAsC;IAC/C,MAAMD,GAAN,EAAWN,QAAQ,CAACQ,KAApB,EAA2BD,KAA3B;EACD;;EAEDE,WAAW,GAAG;IAAA;;IACZ,MAAM;MAAEC;IAAF,IAAY,KAAKH,KAAvB;IACA,MAAMI,GAAG,sBAAG,KAAKJ,KAAL,CAAWI,GAAd,6DAAqB,SAA9B;IACA,MAAMC,IAAI,GAAGV,WAAW,CAAC,KAAKW,IAAN,EAAY,KAAKN,KAAjB,CAAxB;IACA,MAAM;MAAEO,GAAF;MAAOC;IAAP,IAAed,QAAQ,CAC3BU,GAD2B,EAE3B;MACEK,CAAC,EAAE,CADL;MAEEC,CAAC,EAAE,CAFL;MAGEC,KAAK,EAAER,KAAK,CAACQ,KAAN,EAHT;MAIEC,MAAM,EAAET,KAAK,CAACS,MAAN;IAJV,CAF2B,EAQ3BP,IAR2B,CAA7B;IAUA,OAAO;MAAEE,GAAF;MAAOC;IAAP,CAAP;EACD;;EAEDK,IAAI,OAAoC;IAAA,IAAnC;MAAEC,MAAF;MAAUC;IAAV,CAAmC;IACtC,MAAM;MAAEZ;IAAF,IAAY,KAAKH,KAAvB;;IACA,IAAI,CAAC,KAAKgB,OAAV,EAAmB;MACjB,MAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;IACD;;IACD,MAAM;MAAEV,GAAF;MAAOC;IAAP,IAAe,KAAKQ,OAA1B;IACAF,MAAM,CAACI,aAAP,CAAqBf,KAArB,EAA4BI,GAA5B,EAAiCC,GAAjC,EAAsCO,KAAtC;EACD;;AA7BD"}
@@ -99,7 +99,7 @@ export class BlurImageFilterNode extends ImageFilterDeclaration {
99
99
  }
100
100
  export class DropShadowImageFilterNode extends ImageFilterDeclaration {
101
101
  constructor(ctx, props) {
102
- super(ctx, NodeType.BlurImageFilter, props);
102
+ super(ctx, NodeType.DropShadowImageFilter, props);
103
103
  }
104
104
 
105
105
  materialize() {
@@ -1 +1 @@
1
- {"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","DeclarationType","NodeType","processRadius","enumKey","JsiDeclarationNode","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","constructor","ctx","type","props","getOptionalChildInstance","index","child","_children","getMandatoryChildInstance","isImageFilter","materialize","isShader","MakeShader","declarationType","Error","OffsetImageFilterNode","OffsetImageFilter","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","DropShadowImageFilterNode","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\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(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, 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\nexport abstract class ImageFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkImageFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isImageFilter()) {\n return child.materialize();\n } else if (child.isShader()) {\n return this.Skia.ImageFilter.MakeShader(child.materialize(), null);\n } else if (child.declarationType === DeclarationType.ColorFilter) {\n return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n materialize() {\n const { x, y } = this.props;\n return this.Skia.ImageFilter.MakeOffset(\n x,\n y,\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n materialize() {\n const { channelX, channelY, scale } = this.props;\n return this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n this.getMandatoryChildInstance(0),\n this.getOptionalChildInstance(1)\n );\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n return this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n const input = this.getOptionalChildInstance(0);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n materialize() {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n const input = this.getOptionalChildInstance(0);\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);\n }\n return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const a = this.getMandatoryChildInstance(0);\n const b = this.getMandatoryChildInstance(1);\n return this.Skia.ImageFilter.MakeBlend(mode, a, b);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n materialize() {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const input =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qG"}
1
+ {"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","DeclarationType","NodeType","processRadius","enumKey","JsiDeclarationNode","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","constructor","ctx","type","props","getOptionalChildInstance","index","child","_children","getMandatoryChildInstance","isImageFilter","materialize","isShader","MakeShader","declarationType","Error","OffsetImageFilterNode","OffsetImageFilter","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\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(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, 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\nexport abstract class ImageFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkImageFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isImageFilter()) {\n return child.materialize();\n } else if (child.isShader()) {\n return this.Skia.ImageFilter.MakeShader(child.materialize(), null);\n } else if (child.declarationType === DeclarationType.ColorFilter) {\n return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n materialize() {\n const { x, y } = this.props;\n return this.Skia.ImageFilter.MakeOffset(\n x,\n y,\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n materialize() {\n const { channelX, channelY, scale } = this.props;\n return this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n this.getMandatoryChildInstance(0),\n this.getOptionalChildInstance(1)\n );\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n return this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n materialize() {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n const input = this.getOptionalChildInstance(0);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n materialize() {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n const input = this.getOptionalChildInstance(0);\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);\n }\n return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const a = this.getMandatoryChildInstance(0);\n const b = this.getMandatoryChildInstance(1);\n return this.Skia.ImageFilter.MakeBlend(mode, a, b);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n materialize() {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const input = this.getOptionalChildInstance(0);\n return this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input);\n }\n}\n"],"mappings":"AACA,SACEA,SADF,EAEEC,YAFF,EAGEC,eAHF,EAIEC,QAJF,QAKO,qBALP;AAeA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AACA,SAASC,aAAT,EAAwBC,OAAxB,QAAuC,cAAvC;AAEA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,MAAMC,KAAK,GAAGC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAd;;AAEA,MAAMC,eAAe,GAAG,CACtBC,I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L,CAA+B,CAA/B,CAAV;IACA,MAAM2C,CAAC,GAAG,KAAK3C,yBAAL,CAA+B,CAA/B,CAAV;IACA,OAAO,KAAKnC,IAAL,CAAUS,WAAV,CAAsBG,SAAtB,CAAgC0C,IAAhC,EAAsCuB,CAAtC,EAAyCC,CAAzC,CAAP;EACD;;AAVqF;AAaxF,OAAO,MAAMC,4BAAN,SAA2CrD,sBAA3C,CAAiG;EACtGC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAyD;IAClE,MAAMF,GAAN,EAAWpC,QAAQ,CAACwF,wBAApB,EAA8ClD,KAA9C;EACD;;EAEDO,WAAW,GAAG;IACZ,MAAM;MAAE4C,MAAF;MAAUC;IAAV,IAAuB,KAAKpD,KAAlC;IACA,MAAMqD,GAAG,GAAG,KAAKnF,IAAL,CAAUoF,oBAAV,CAA+BH,MAA/B,CAAZ;;IACA,IAAIC,QAAJ,EAAc;MACZ7F,eAAe,CAAC4F,MAAD,EAASC,QAAT,EAAmBC,GAAnB,CAAf;IACD;;IACD,MAAM5E,KAAK,GAAG,KAAKwB,wBAAL,CAA8B,CAA9B,CAAd;IACA,OAAO,KAAK/B,IAAL,CAAUS,WAAV,CAAsB4E,iBAAtB,CAAwCF,GAAxC,EAA6C,IAA7C,EAAmD5E,KAAnD,CAAP;EACD;;AAbqG"}
@@ -41,22 +41,23 @@ export class ImageShaderNode extends ShaderDeclaration {
41
41
  ...imageShaderProps
42
42
  } = this.props;
43
43
  const rct = getRect(this.Skia, imageShaderProps);
44
+ const m3 = this.Skia.Matrix();
44
45
 
45
46
  if (rct) {
46
- var _imageShaderProps$tra;
47
-
48
47
  const rects = fitRects(fit, {
49
48
  x: 0,
50
49
  y: 0,
51
50
  width: image.width(),
52
51
  height: image.height()
53
52
  }, rct);
54
- const m3 = rect2rect(rects.src, rects.dst);
55
- imageShaderProps.transform = [...((_imageShaderProps$tra = imageShaderProps.transform) !== null && _imageShaderProps$tra !== void 0 ? _imageShaderProps$tra : []), ...m3];
53
+ const [x, y, sx, sy] = rect2rect(rects.src, rects.dst);
54
+ m3.translate(x.translateX, y.translateY);
55
+ m3.scale(sx.scaleX, sy.scaleY);
56
56
  }
57
57
 
58
58
  const lm = this.Skia.Matrix();
59
59
  processTransformProps(lm, imageShaderProps);
60
+ lm.concat(m3);
60
61
  return image.makeShaderOptions(TileMode[enumKey(tx)], TileMode[enumKey(ty)], FilterMode[enumKey(fm)], MipmapMode[enumKey(mm)], lm);
61
62
  }
62
63
 
@@ -1 +1 @@
1
- {"version":3,"names":["processUniforms","FilterMode","MipmapMode","TileMode","JsiDeclarationNode","DeclarationType","NodeType","enumKey","fitRects","getRect","processGradientProps","processTransformProps","rect2rect","ShaderDeclaration","constructor","ctx","type","props","Shader","ShaderNode","materialize","source","uniforms","transform","m3","Skia","Matrix","makeShaderWithChildren","children","filter","child","isShader","map","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","rects","x","y","width","height","src","dst","lm","makeShaderOptions","ColorNode","ColorShader","color","MakeColor","Color","TurbulenceNode","Turbulence","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeTurbulence","FractalNoiseNode","FractalNoise","MakeFractalNoise","LinearGradientNode","LinearGradient","start","end","colors","positions","mode","localMatrix","flags","MakeLinearGradient","RadialGradientNode","RadialGradient","c","r","MakeRadialGradient","SweepGradientNode","SweepGradient","MakeSweepGradient","TwoPointConicalGradientNode","TwoPointConicalGradient","startR","endR","MakeTwoPointConicalGradient"],"sources":["Shaders.ts"],"sourcesContent":["import {\n processUniforms,\n FilterMode,\n MipmapMode,\n TileMode,\n} from \"../../../skia/types\";\nimport type { SkShader } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n ColorProps,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../datatypes\";\n\nexport abstract class ShaderDeclaration<P> extends JsiDeclarationNode<\n P,\n SkShader\n> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.Shader, type, props);\n }\n}\n\nexport class ShaderNode extends ShaderDeclaration<ShaderProps> {\n constructor(ctx: NodeContext, props: ShaderProps) {\n super(ctx, NodeType.Shader, props);\n }\n\n materialize() {\n const { source, uniforms, ...transform } = this.props;\n const m3 = this.Skia.Matrix();\n processTransformProps(m3, transform);\n return source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n this.children()\n .filter(\n (child): child is JsiDeclarationNode<unknown, SkShader> =>\n child instanceof JsiDeclarationNode && child.isShader()\n )\n .map((child) => child.materialize()),\n m3\n );\n }\n}\n\nexport class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {\n constructor(ctx: NodeContext, props: ImageShaderProps) {\n super(ctx, NodeType.ImageShader, props);\n }\n\n materialize() {\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;\n const rct = getRect(this.Skia, imageShaderProps);\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const m3 = rect2rect(rects.src, rects.dst);\n imageShaderProps.transform = [\n ...(imageShaderProps.transform ?? []),\n ...m3,\n ];\n }\n const lm = this.Skia.Matrix();\n processTransformProps(lm, imageShaderProps);\n return image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n }\n}\n\nexport class ColorNode extends ShaderDeclaration<ColorProps> {\n constructor(ctx: NodeContext, props: ColorProps) {\n super(ctx, NodeType.ColorShader, props);\n }\n\n materialize() {\n const { color } = this.props;\n return this.Skia.Shader.MakeColor(this.Skia.Color(color));\n }\n}\n\nexport class TurbulenceNode extends ShaderDeclaration<TurbulenceProps> {\n constructor(ctx: NodeContext, props: TurbulenceProps) {\n super(ctx, NodeType.Turbulence, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class FractalNoiseNode extends ShaderDeclaration<FractalNoiseProps> {\n constructor(ctx: NodeContext, props: FractalNoiseProps) {\n super(ctx, NodeType.FractalNoise, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class LinearGradientNode extends ShaderDeclaration<LinearGradientProps> {\n constructor(ctx: NodeContext, props: LinearGradientProps) {\n super(ctx, NodeType.LinearGradient, props);\n }\n\n materialize() {\n const { start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class RadialGradientNode extends ShaderDeclaration<RadialGradientProps> {\n constructor(ctx: NodeContext, props: RadialGradientProps) {\n super(ctx, NodeType.RadialGradient, props);\n }\n\n materialize() {\n const { c, r } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class SweepGradientNode extends ShaderDeclaration<SweepGradientProps> {\n constructor(ctx: NodeContext, props: SweepGradientProps) {\n super(ctx, NodeType.SweepGradient, props);\n }\n\n materialize() {\n const { c, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n }\n}\n\nexport class TwoPointConicalGradientNode extends ShaderDeclaration<TwoPointConicalGradientProps> {\n constructor(ctx: NodeContext, props: TwoPointConicalGradientProps) {\n super(ctx, NodeType.TwoPointConicalGradient, props);\n }\n\n materialize() {\n const { startR, endR, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n"],"mappings":"AAAA,SACEA,eADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,QAJF,QAKO,qBALP;AAQA,SAASC,kBAAT,QAAmC,SAAnC;AAYA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AACA,SACEC,OADF,EAEEC,QAFF,EAGEC,OAHF,EAIEC,oBAJF,EAKEC,qBALF,EAMEC,SANF,QAOO,cAPP;AASA,OAAO,MAAeC,iBAAf,SAA4CT,kBAA5C,CAGL;EACAU,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWV,eAAe,CAACa,MAA3B,EAAmCF,IAAnC,EAAyCC,KAAzC;EACD;;AAHD;AAMF,OAAO,MAAME,UAAN,SAAyBN,iBAAzB,CAAwD;EAC7DC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAuC;IAChD,MAAMF,GAAN,EAAWT,QAAQ,CAACY,MAApB,EAA4BD,KAA5B;EACD;;EAEDG,WAAW,GAAG;IACZ,MAAM;MAAEC,MAAF;MAAUC,QAAV;MAAoB,GAAGC;IAAvB,IAAqC,KAAKN,KAAhD;IACA,MAAMO,EAAE,GAAG,KAAKC,IAAL,CAAUC,MAAV,EAAX;IACAf,qBAAqB,CAACa,EAAD,EAAKD,SAAL,CAArB;IACA,OAAOF,MAAM,CAAC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,MAAF;MAAUC,SAAV;MAAqBC,IAArB;MAA2BC,WAA3B;MAAwCC;IAAxC,IACJnE,oBAAoB,CAAC,KAAKe,IAAN,EAAY,KAAKR,KAAjB,CADtB;IAEA,OAAO,KAAKQ,IAAL,CAAUP,MAAV,CAAiByE,2BAAjB,CACLpB,KADK,EAELkB,MAFK,EAGLjB,GAHK,EAILkB,IAJK,EAKLjB,MALK,EAMLC,SANK,EAOLC,IAPK,EAQLC,WARK,EASLC,KATK,CAAP;EAWD;;AApB8F"}
1
+ {"version":3,"names":["processUniforms","FilterMode","MipmapMode","TileMode","JsiDeclarationNode","DeclarationType","NodeType","enumKey","fitRects","getRect","processGradientProps","processTransformProps","rect2rect","ShaderDeclaration","constructor","ctx","type","props","Shader","ShaderNode","materialize","source","uniforms","transform","m3","Skia","Matrix","makeShaderWithChildren","children","filter","child","isShader","map","ImageShaderNode","ImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","rects","x","y","width","height","sx","sy","src","dst","translate","translateX","translateY","scale","scaleX","scaleY","lm","concat","makeShaderOptions","ColorNode","ColorShader","color","MakeColor","Color","TurbulenceNode","Turbulence","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeTurbulence","FractalNoiseNode","FractalNoise","MakeFractalNoise","LinearGradientNode","LinearGradient","start","end","colors","positions","mode","localMatrix","flags","MakeLinearGradient","RadialGradientNode","RadialGradient","c","r","MakeRadialGradient","SweepGradientNode","SweepGradient","MakeSweepGradient","TwoPointConicalGradientNode","TwoPointConicalGradient","startR","endR","MakeTwoPointConicalGradient"],"sources":["Shaders.ts"],"sourcesContent":["import {\n processUniforms,\n FilterMode,\n MipmapMode,\n TileMode,\n} from \"../../../skia/types\";\nimport type { SkShader } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n ColorProps,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../datatypes\";\n\nexport abstract class ShaderDeclaration<P> extends JsiDeclarationNode<\n P,\n SkShader\n> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.Shader, type, props);\n }\n}\n\nexport class ShaderNode extends ShaderDeclaration<ShaderProps> {\n constructor(ctx: NodeContext, props: ShaderProps) {\n super(ctx, NodeType.Shader, props);\n }\n\n materialize() {\n const { source, uniforms, ...transform } = this.props;\n const m3 = this.Skia.Matrix();\n processTransformProps(m3, transform);\n return source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n this.children()\n .filter(\n (child): child is JsiDeclarationNode<unknown, SkShader> =>\n child instanceof JsiDeclarationNode && child.isShader()\n )\n .map((child) => child.materialize()),\n m3\n );\n }\n}\n\nexport class ImageShaderNode extends ShaderDeclaration<ImageShaderProps> {\n constructor(ctx: NodeContext, props: ImageShaderProps) {\n super(ctx, NodeType.ImageShader, props);\n }\n\n materialize() {\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = this.props;\n const rct = getRect(this.Skia, imageShaderProps);\n const m3 = this.Skia.Matrix();\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const [x, y, sx, sy] = rect2rect(rects.src, rects.dst);\n m3.translate(x.translateX, y.translateY);\n m3.scale(sx.scaleX, sy.scaleY);\n }\n const lm = this.Skia.Matrix();\n processTransformProps(lm, imageShaderProps);\n lm.concat(m3);\n return image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n }\n}\n\nexport class ColorNode extends ShaderDeclaration<ColorProps> {\n constructor(ctx: NodeContext, props: ColorProps) {\n super(ctx, NodeType.ColorShader, props);\n }\n\n materialize() {\n const { color } = this.props;\n return this.Skia.Shader.MakeColor(this.Skia.Color(color));\n }\n}\n\nexport class TurbulenceNode extends ShaderDeclaration<TurbulenceProps> {\n constructor(ctx: NodeContext, props: TurbulenceProps) {\n super(ctx, NodeType.Turbulence, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class FractalNoiseNode extends ShaderDeclaration<FractalNoiseProps> {\n constructor(ctx: NodeContext, props: FractalNoiseProps) {\n super(ctx, NodeType.FractalNoise, props);\n }\n\n materialize() {\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = this.props;\n return this.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n }\n}\n\nexport class LinearGradientNode extends ShaderDeclaration<LinearGradientProps> {\n constructor(ctx: NodeContext, props: LinearGradientProps) {\n super(ctx, NodeType.LinearGradient, props);\n }\n\n materialize() {\n const { start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class RadialGradientNode extends ShaderDeclaration<RadialGradientProps> {\n constructor(ctx: NodeContext, props: RadialGradientProps) {\n super(ctx, NodeType.RadialGradient, props);\n }\n\n materialize() {\n const { c, r } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n\nexport class SweepGradientNode extends ShaderDeclaration<SweepGradientProps> {\n constructor(ctx: NodeContext, props: SweepGradientProps) {\n super(ctx, NodeType.SweepGradient, props);\n }\n\n materialize() {\n const { c, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n }\n}\n\nexport class TwoPointConicalGradientNode extends ShaderDeclaration<TwoPointConicalGradientProps> {\n constructor(ctx: NodeContext, props: TwoPointConicalGradientProps) {\n super(ctx, NodeType.TwoPointConicalGradient, props);\n }\n\n materialize() {\n const { startR, endR, start, end } = this.props;\n const { colors, positions, mode, localMatrix, flags } =\n processGradientProps(this.Skia, this.props);\n return this.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n }\n}\n"],"mappings":"AAAA,SACEA,eADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,QAJF,QAKO,qBALP;AAQA,SAASC,kBAAT,QAAmC,SAAnC;AAYA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AACA,SACEC,OADF,EAEEC,QAFF,EAGEC,OAHF,EAIEC,oBAJF,EAKEC,qBALF,EAMEC,SANF,QAOO,cAPP;AASA,OAAO,MAAeC,iBAAf,SAA4CT,kBAA5C,CAGL;EACAU,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWV,eAAe,CAACa,MAA3B,EAAmCF,IAAnC,EAAyCC,KAAzC;EACD;;AAHD;AAMF,OAAO,MAAME,UAAN,SAAyBN,iBAAzB,CAAwD;EAC7DC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAuC;IAChD,MAAMF,GAAN,EAAWT,QAAQ,CAACY,MAApB,EAA4BD,KAA5B;EACD;;EAEDG,WAAW,GAAG;IACZ,MAAM;MAAEC,MAAF;MAAUC,QAAV;MAAoB,GAAGC;IAAvB,IAAqC,KAAKN,KAAhD;IACA,MAAMO,EAAE,GAAG,KAAKC,I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AA0CnF,iBAA1C,CAA0F;EAC/FC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAwD;IACjE,MAAMF,GAAN,EAAWT,QAAQ,CAAC2F,uBAApB,EAA6ChF,KAA7C;EACD;;EAEDG,WAAW,GAAG;IACZ,MAAM;MAAE8E,MAAF;MAAUC,IAAV;MAAgBnB,KAAhB;MAAuBC;IAAvB,IAA+B,KAAKhE,KAA1C;IACA,MAAM;MAAEiE,MAAF;MAAUC,SAAV;MAAqBC,IAArB;MAA2BC,WAA3B;MAAwCC;IAAxC,IACJ5E,oBAAoB,CAAC,KAAKe,IAAN,EAAY,KAAKR,KAAjB,CADtB;IAEA,OAAO,KAAKQ,IAAL,CAAUP,MAAV,CAAiBkF,2BAAjB,CACLpB,KADK,EAELkB,MAFK,EAGLjB,GAHK,EAILkB,IAJK,EAKLjB,MALK,EAMLC,SANK,EAOLC,IAPK,EAQLC,WARK,EASLC,KATK,CAAP;EAWD;;AApB8F"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n PaintStyle,\n SkMatrix,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms2d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: SkRRect };\n\nexport interface PointCircleDef {\n c: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms2d;\n origin?: Vector;\n matrix?: SkMatrix;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n PaintStyle,\n SkMatrix,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms2d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: SkRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms2d;\n origin?: Vector;\n matrix?: SkMatrix;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit: Fit;\n image: SkImage;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface CustomDrawingNodeProps extends DrawingNodeProps {\n drawing: (ctx: DrawingContext) => void;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport type ImageSVGProps = RectDef & {\n svg: SkSVG;\n} & DrawingNodeProps;\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Drawings.ts"],"sourcesContent":["import type {\n FillType,\n SkImage,\n StrokeOpts,\n Vector,\n Color,\n SkPoint,\n BlendMode,\n PointMode,\n VertexMode,\n SkFont,\n SkRRect,\n SkTextBlob,\n SkPicture,\n SkSVG,\n SkPaint,\n SkRect,\n} from \"../../skia/types\";\n\nimport type {\n CircleDef,\n Fit,\n GroupProps,\n PathDef,\n RectDef,\n RRectDef,\n SkEnum,\n} from \"./Common\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nexport interface DrawingNodeProps extends GroupProps {\n paint?: SkPaint;\n}\n\nexport type ImageProps = DrawingNodeProps &\n RectDef & {\n fit?: Fit;\n image: SkImage;\n };\n\nexport type CircleProps = CircleDef & DrawingNodeProps;\n\nexport interface PathProps extends DrawingNodeProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nexport interface CustomDrawingNodeProps extends DrawingNodeProps {\n drawing: (ctx: DrawingContext) => void;\n}\n\nexport interface LineProps extends DrawingNodeProps {\n p1: Vector;\n p2: Vector;\n}\n\nexport type OvalProps = RectDef & DrawingNodeProps;\n\nexport type RectProps = RectDef & DrawingNodeProps;\n\nexport type RoundedRectProps = RRectDef & DrawingNodeProps;\n\nexport interface CubicBezierHandle {\n pos: Vector;\n c1: Vector;\n c2: Vector;\n}\n\nexport interface PatchProps extends DrawingNodeProps {\n colors?: Color[];\n patch: [\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle,\n CubicBezierHandle\n ];\n texture?: readonly [SkPoint, SkPoint, SkPoint, SkPoint];\n blendMode?: SkEnum<typeof BlendMode>;\n}\n\nexport interface VerticesProps extends DrawingNodeProps {\n colors?: string[];\n vertices: SkPoint[];\n textures?: SkPoint[];\n mode: SkEnum<typeof VertexMode>;\n blendMode?: SkEnum<typeof BlendMode>;\n indices?: number[];\n}\n\nexport type ImageSVGProps = RectDef & {\n svg: SkSVG;\n} & DrawingNodeProps;\n\nexport interface PictureProps extends DrawingNodeProps {\n picture: SkPicture;\n}\n\nexport interface PointsProps extends DrawingNodeProps {\n points: SkPoint[];\n mode: SkEnum<typeof PointMode>;\n}\n\nexport interface DiffRectProps extends DrawingNodeProps {\n inner: SkRRect;\n outer: SkRRect;\n}\n\nexport interface TextProps extends DrawingNodeProps {\n font: SkFont;\n text: string;\n x: number;\n y: number;\n}\n\nexport interface TextPathProps extends DrawingNodeProps {\n font: SkFont;\n text: string;\n path: PathDef;\n initialOffset: number;\n}\n\nexport interface TextBlobProps extends DrawingNodeProps {\n blob: SkTextBlob;\n x: number;\n y: number;\n}\n\nexport interface Glyph {\n id: number;\n pos: SkPoint;\n}\n\nexport interface GlyphsProps extends DrawingNodeProps {\n font: SkFont;\n x: number;\n y: number;\n glyphs: Glyph[];\n}\n\nexport interface BoxProps extends DrawingNodeProps {\n box: SkRRect | SkRect;\n}\n\nexport interface BoxShadowProps {\n dx?: number;\n dy?: number;\n spread?: number;\n blur: number;\n color?: Color;\n inner?: boolean;\n}\n"],"mappings":""}
@@ -6,8 +6,8 @@ export const Mask = _ref => {
6
6
  let {
7
7
  children,
8
8
  mask,
9
- mode,
10
- clip
9
+ mode = "alpha",
10
+ clip = true
11
11
  } = _ref;
12
12
  return /*#__PURE__*/React.createElement(Group, {
13
13
  layer: true
@@ -23,8 +23,4 @@ export const Mask = _ref => {
23
23
  blendMode: "srcIn"
24
24
  }, children));
25
25
  };
26
- Mask.defaultProps = {
27
- mode: "alpha",
28
- clip: true
29
- };
30
26
  //# sourceMappingURL=Mask.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Group","LumaColorFilter","Paint","Mask","children","mask","mode","clip","defaultProps"],"sources":["Mask.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport { Group } from \"./Group\";\nimport { LumaColorFilter } from \"./colorFilters/LumaColorFilter\";\nimport { Paint } from \"./Paint\";\n\ninterface MaskProps {\n mode: \"luminance\" | \"alpha\";\n clip: boolean;\n mask: ReactNode | ReactNode[];\n children: ReactNode | ReactNode[];\n}\n\nexport const Mask = ({ children, mask, mode, clip }: MaskProps) => {\n return (\n <Group layer>\n <Group\n layer={\n <Paint blendMode=\"src\">\n {mode === \"luminance\" && <LumaColorFilter />}\n </Paint>\n }\n >\n {mask}\n {clip && <Group layer={<Paint blendMode=\"dstIn\" />}>{children}</Group>}\n </Group>\n <Group blendMode=\"srcIn\">{children}</Group>\n </Group>\n );\n};\n\nMask.defaultProps = {\n mode: \"alpha\",\n clip: true,\n};\n"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,KAAT,QAAsB,SAAtB;AASA,OAAO,MAAMC,IAAI,GAAG,QAA+C;EAAA,IAA9C;IAAEC,QAAF;IAAYC,IAAZ;IAAkBC,IAAlB;IAAwBC;EAAxB,CAA8C;EACjE,oBACE,oBAAC,KAAD;IAAO,KAAK;EAAZ,gBACE,oBAAC,KAAD;IACE,KAAK,eACH,oBAAC,KAAD;MAAO,SAAS,EAAC;IAAjB,GACGD,IAAI,KAAK,WAAT,iBAAwB,oBAAC,eAAD,OAD3B;EAFJ,GAOGD,IAPH,EAQGE,IAAI,iBAAI,oBAAC,KAAD;IAAO,KAAK,eAAE,oBAAC,KAAD;MAAO,SAAS,EAAC;IAAjB;EAAd,GAA4CH,QAA5C,CARX,CADF,eAWE,oBAAC,KAAD;IAAO,SAAS,EAAC;EAAjB,GAA0BA,QAA1B,CAXF,CADF;AAeD,CAhBM;AAkBPD,IAAI,CAACK,YAAL,GAAoB;EAClBF,IAAI,EAAE,OADY;EAElBC,IAAI,EAAE;AAFY,CAApB"}
1
+ {"version":3,"names":["React","Group","LumaColorFilter","Paint","Mask","children","mask","mode","clip"],"sources":["Mask.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport { Group } from \"./Group\";\nimport { LumaColorFilter } from \"./colorFilters/LumaColorFilter\";\nimport { Paint } from \"./Paint\";\n\ninterface MaskProps {\n mode?: \"luminance\" | \"alpha\";\n clip?: boolean;\n mask: ReactNode | ReactNode[];\n children: ReactNode | ReactNode[];\n}\n\nexport const Mask = ({\n children,\n mask,\n mode = \"alpha\",\n clip = true,\n}: MaskProps) => {\n return (\n <Group layer>\n <Group\n layer={\n <Paint blendMode=\"src\">\n {mode === \"luminance\" && <LumaColorFilter />}\n </Paint>\n }\n >\n {mask}\n {clip && <Group layer={<Paint blendMode=\"dstIn\" />}>{children}</Group>}\n </Group>\n <Group blendMode=\"srcIn\">{children}</Group>\n </Group>\n );\n};\n"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,KAAT,QAAsB,SAAtB;AASA,OAAO,MAAMC,IAAI,GAAG,QAKH;EAAA,IALI;IACnBC,QADmB;IAEnBC,IAFmB;IAGnBC,IAAI,GAAG,OAHY;IAInBC,IAAI,GAAG;EAJY,CAKJ;EACf,oBACE,oBAAC,KAAD;IAAO,KAAK;EAAZ,gBACE,oBAAC,KAAD;IACE,KAAK,eACH,oBAAC,KAAD;MAAO,SAAS,EAAC;IAAjB,GACGD,IAAI,KAAK,WAAT,iBAAwB,oBAAC,eAAD,OAD3B;EAFJ,GAOGD,IAPH,EAQGE,IAAI,iBAAI,oBAAC,KAAD;IAAO,KAAK,eAAE,oBAAC,KAAD;MAAO,SAAS,EAAC;IAAjB;EAAd,GAA4CH,QAA5C,CARX,CADF,eAWE,oBAAC,KAAD;IAAO,SAAS,EAAC;EAAjB,GAA0BA,QAA1B,CAXF,CADF;AAeD,CArBM"}
@@ -2,9 +2,4 @@ import React from "react";
2
2
  export const Image = props => {
3
3
  return /*#__PURE__*/React.createElement("skImage", props);
4
4
  };
5
- Image.defaultProps = {
6
- x: 0,
7
- y: 0,
8
- fit: "contain"
9
- };
10
5
  //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Image","props","defaultProps","x","y","fit"],"sources":["Image.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors\";\nimport type { ImageProps } from \"../../../dom/types\";\n\nexport const Image = (props: SkiaProps<ImageProps>) => {\n return <skImage {...props} />;\n};\n\nImage.defaultProps = {\n x: 0,\n y: 0,\n fit: \"contain\",\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,KAAK,GAAIC,KAAD,IAAkC;EACrD,oBAAO,+BAAaA,KAAb,CAAP;AACD,CAFM;AAIPD,KAAK,CAACE,YAAN,GAAqB;EACnBC,CAAC,EAAE,CADgB;EAEnBC,CAAC,EAAE,CAFgB;EAGnBC,GAAG,EAAE;AAHc,CAArB"}
1
+ {"version":3,"names":["React","Image","props"],"sources":["Image.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors\";\nimport type { ImageProps } from \"../../../dom/types\";\n\nexport const Image = (props: SkiaProps<ImageProps>) => {\n return <skImage {...props} />;\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,KAAK,GAAIC,KAAD,IAAkC;EACrD,oBAAO,+BAAaA,KAAb,CAAP;AACD,CAFM"}
@@ -1,13 +1,23 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const ImageShader = props => {
3
- return /*#__PURE__*/React.createElement("skImageShader", props);
4
- };
5
- ImageShader.defaultProps = {
6
- tx: "decal",
7
- ty: "decal",
8
- fm: "nearest",
9
- mm: "none",
10
- fit: "none",
11
- transform: []
4
+ export const ImageShader = _ref => {
5
+ let {
6
+ tx = "decal",
7
+ ty = "decal",
8
+ fm = "nearest",
9
+ mm = "none",
10
+ fit = "none",
11
+ transform = [],
12
+ ...props
13
+ } = _ref;
14
+ return /*#__PURE__*/React.createElement("skImageShader", _extends({
15
+ tx: tx,
16
+ ty: ty,
17
+ fm: fm,
18
+ mm: mm,
19
+ fit: fit,
20
+ transform: transform
21
+ }, props));
12
22
  };
13
23
  //# sourceMappingURL=ImageShader.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","ImageShader","props","defaultProps","tx","ty","fm","mm","fit","transform"],"sources":["ImageShader.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { ImageShaderProps } from \"../../../dom/types\";\nimport type { SkiaProps } from \"../../processors\";\n\nexport const ImageShader = (props: SkiaProps<ImageShaderProps>) => {\n return <skImageShader {...props} />;\n};\n\nImageShader.defaultProps = {\n tx: \"decal\",\n ty: \"decal\",\n fm: \"nearest\",\n mm: \"none\",\n fit: \"none\",\n transform: [],\n} as const;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,WAAW,GAAIC,KAAD,IAAwC;EACjE,oBAAO,qCAAmBA,KAAnB,CAAP;AACD,CAFM;AAIPD,WAAW,CAACE,YAAZ,GAA2B;EACzBC,EAAE,EAAE,OADqB;EAEzBC,EAAE,EAAE,OAFqB;EAGzBC,EAAE,EAAE,SAHqB;EAIzBC,EAAE,EAAE,MAJqB;EAKzBC,GAAG,EAAE,MALoB;EAMzBC,SAAS,EAAE;AANc,CAA3B"}
1
+ {"version":3,"names":["React","ImageShader","tx","ty","fm","mm","fit","transform","props"],"sources":["ImageShader.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { ImageShaderProps } from \"../../../dom/types\";\nimport type { SkiaDefaultProps } from \"../../processors\";\n\nexport const ImageShader = ({\n tx = \"decal\",\n ty = \"decal\",\n fm = \"nearest\",\n mm = \"none\",\n fit = \"none\",\n transform = [],\n ...props\n}: SkiaDefaultProps<\n ImageShaderProps,\n \"tx\" | \"ty\" | \"fm\" | \"mm\" | \"fit\" | \"transform\"\n>) => {\n return (\n <skImageShader\n tx={tx}\n ty={ty}\n fm={fm}\n mm={mm}\n fit={fit}\n transform={transform}\n {...props}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,WAAW,GAAG,QAWrB;EAAA,IAXsB;IAC1BC,EAAE,GAAG,OADqB;IAE1BC,EAAE,GAAG,OAFqB;IAG1BC,EAAE,GAAG,SAHqB;IAI1BC,EAAE,GAAG,MAJqB;IAK1BC,GAAG,GAAG,MALoB;IAM1BC,SAAS,GAAG,EANc;IAO1B,GAAGC;EAPuB,CAWtB;EACJ,oBACE;IACE,EAAE,EAAEN,EADN;IAEE,EAAE,EAAEC,EAFN;IAGE,EAAE,EAAEC,EAHN;IAIE,EAAE,EAAEC,EAJN;IAKE,GAAG,EAAEC,GALP;IAME,SAAS,EAAEC;EANb,GAOMC,KAPN,EADF;AAWD,CAvBM"}
@@ -1,8 +1,13 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const Blur = props => {
3
- return /*#__PURE__*/React.createElement("skBlurImageFilter", props);
4
- };
5
- Blur.defaultProps = {
6
- mode: "decal"
4
+ export const Blur = _ref => {
5
+ let {
6
+ mode = "decal",
7
+ ...props
8
+ } = _ref;
9
+ return /*#__PURE__*/React.createElement("skBlurImageFilter", _extends({
10
+ mode: mode
11
+ }, props));
7
12
  };
8
13
  //# sourceMappingURL=Blur.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Blur","props","defaultProps","mode"],"sources":["Blur.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors/Animations/Animations\";\nimport type { BlurImageFilterProps } from \"../../../dom/types\";\n\nexport const Blur = (props: SkiaProps<BlurImageFilterProps>) => {\n return <skBlurImageFilter {...props} />;\n};\n\nBlur.defaultProps = {\n mode: \"decal\",\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,IAAI,GAAIC,KAAD,IAA4C;EAC9D,oBAAO,yCAAuBA,KAAvB,CAAP;AACD,CAFM;AAIPD,IAAI,CAACE,YAAL,GAAoB;EAClBC,IAAI,EAAE;AADY,CAApB"}
1
+ {"version":3,"names":["React","Blur","mode","props"],"sources":["Blur.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaDefaultProps } from \"../../processors/Animations/Animations\";\nimport type { BlurImageFilterProps } from \"../../../dom/types\";\n\nexport const Blur = ({\n mode = \"decal\",\n ...props\n}: SkiaDefaultProps<BlurImageFilterProps, \"mode\">) => {\n return <skBlurImageFilter mode={mode} {...props} />;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,IAAI,GAAG,QAGkC;EAAA,IAHjC;IACnBC,IAAI,GAAG,OADY;IAEnB,GAAGC;EAFgB,CAGiC;EACpD,oBAAO;IAAmB,IAAI,EAAED;EAAzB,GAAmCC,KAAnC,EAAP;AACD,CALM"}
@@ -1,8 +1,13 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const Morphology = props => {
3
- return /*#__PURE__*/React.createElement("skMorphologyImageFilter", props);
4
- };
5
- Morphology.defaultProps = {
6
- operator: "dilate"
4
+ export const Morphology = _ref => {
5
+ let {
6
+ operator = "dilate",
7
+ ...props
8
+ } = _ref;
9
+ return /*#__PURE__*/React.createElement("skMorphologyImageFilter", _extends({
10
+ operator: operator
11
+ }, props));
7
12
  };
8
13
  //# sourceMappingURL=Morphology.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Morphology","props","defaultProps","operator"],"sources":["Morphology.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { MorphologyImageFilterProps } from \"../../../dom/types\";\nimport type { SkiaProps } from \"../../processors\";\n\nexport const Morphology = (props: SkiaProps<MorphologyImageFilterProps>) => {\n return <skMorphologyImageFilter {...props} />;\n};\n\nMorphology.defaultProps = {\n operator: \"dilate\",\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,UAAU,GAAIC,KAAD,IAAkD;EAC1E,oBAAO,+CAA6BA,KAA7B,CAAP;AACD,CAFM;AAIPD,UAAU,CAACE,YAAX,GAA0B;EACxBC,QAAQ,EAAE;AADc,CAA1B"}
1
+ {"version":3,"names":["React","Morphology","operator","props"],"sources":["Morphology.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { MorphologyImageFilterProps } from \"../../../dom/types\";\nimport type { SkiaDefaultProps } from \"../../processors\";\n\nexport const Morphology = ({\n operator = \"dilate\",\n ...props\n}: SkiaDefaultProps<MorphologyImageFilterProps, \"operator\">) => {\n return <skMorphologyImageFilter operator={operator} {...props} />;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,UAAU,GAAG,QAGsC;EAAA,IAHrC;IACzBC,QAAQ,GAAG,QADc;IAEzB,GAAGC;EAFsB,CAGqC;EAC9D,oBAAO;IAAyB,QAAQ,EAAED;EAAnC,GAAiDC,KAAjD,EAAP;AACD,CALM"}
@@ -1,9 +1,15 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const Offset = props => {
3
- return /*#__PURE__*/React.createElement("skOffsetImageFilter", props);
4
- };
5
- Offset.defaultProps = {
6
- x: 0,
7
- y: 0
4
+ export const Offset = _ref => {
5
+ let {
6
+ x = 0,
7
+ y = 0,
8
+ ...props
9
+ } = _ref;
10
+ return /*#__PURE__*/React.createElement("skOffsetImageFilter", _extends({
11
+ x: x,
12
+ y: y
13
+ }, props));
8
14
  };
9
15
  //# sourceMappingURL=Offset.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Offset","props","defaultProps","x","y"],"sources":["Offset.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors/Animations/Animations\";\nimport type { OffsetImageFilterProps } from \"../../../dom/types\";\n\nexport const Offset = (props: SkiaProps<OffsetImageFilterProps>) => {\n return <skOffsetImageFilter {...props} />;\n};\n\nOffset.defaultProps = {\n x: 0,\n y: 0,\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,MAAM,GAAIC,KAAD,IAA8C;EAClE,oBAAO,2CAAyBA,KAAzB,CAAP;AACD,CAFM;AAIPD,MAAM,CAACE,YAAP,GAAsB;EACpBC,CAAC,EAAE,CADiB;EAEpBC,CAAC,EAAE;AAFiB,CAAtB"}
1
+ {"version":3,"names":["React","Offset","x","y","props"],"sources":["Offset.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaDefaultProps } from \"../../processors/Animations/Animations\";\nimport type { OffsetImageFilterProps } from \"../../../dom/types\";\n\nexport const Offset = ({\n x = 0,\n y = 0,\n ...props\n}: SkiaDefaultProps<OffsetImageFilterProps, \"x\" | \"y\">) => {\n return <skOffsetImageFilter x={x} y={y} {...props} />;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,MAAM,GAAG,QAIqC;EAAA,IAJpC;IACrBC,CAAC,GAAG,CADiB;IAErBC,CAAC,GAAG,CAFiB;IAGrB,GAAGC;EAHkB,CAIoC;EACzD,oBAAO;IAAqB,CAAC,EAAEF,CAAxB;IAA2B,CAAC,EAAEC;EAA9B,GAAqCC,KAArC,EAAP;AACD,CANM"}
@@ -1,9 +1,15 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const BlurMask = props => {
3
- return /*#__PURE__*/React.createElement("skBlurMaskFilter", props);
4
- };
5
- BlurMask.defaultProps = {
6
- style: "normal",
7
- respectCTM: true
4
+ export const BlurMask = _ref => {
5
+ let {
6
+ style = "normal",
7
+ respectCTM = true,
8
+ ...props
9
+ } = _ref;
10
+ return /*#__PURE__*/React.createElement("skBlurMaskFilter", _extends({
11
+ style: style,
12
+ respectCTM: respectCTM
13
+ }, props));
8
14
  };
9
15
  //# sourceMappingURL=Blur.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","BlurMask","props","defaultProps","style","respectCTM"],"sources":["Blur.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { BlurMaskFilterProps } from \"../../../dom/types\";\nimport type { SkiaProps } from \"../../processors/Animations/Animations\";\n\nexport const BlurMask = (props: SkiaProps<BlurMaskFilterProps>) => {\n return <skBlurMaskFilter {...props} />;\n};\n\nBlurMask.defaultProps = {\n style: \"normal\",\n respectCTM: true,\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,QAAQ,GAAIC,KAAD,IAA2C;EACjE,oBAAO,wCAAsBA,KAAtB,CAAP;AACD,CAFM;AAIPD,QAAQ,CAACE,YAAT,GAAwB;EACtBC,KAAK,EAAE,QADe;EAEtBC,UAAU,EAAE;AAFU,CAAxB"}
1
+ {"version":3,"names":["React","BlurMask","style","respectCTM","props"],"sources":["Blur.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { BlurMaskFilterProps } from \"../../../dom/types\";\nimport type { SkiaDefaultProps } from \"../../processors/Animations/Animations\";\n\nexport const BlurMask = ({\n style = \"normal\",\n respectCTM = true,\n ...props\n}: SkiaDefaultProps<BlurMaskFilterProps, \"style\" | \"respectCTM\">) => {\n return <skBlurMaskFilter style={style} respectCTM={respectCTM} {...props} />;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,QAAQ,GAAG,QAI6C;EAAA,IAJ5C;IACvBC,KAAK,GAAG,QADe;IAEvBC,UAAU,GAAG,IAFU;IAGvB,GAAGC;EAHoB,CAI4C;EACnE,oBAAO;IAAkB,KAAK,EAAEF,KAAzB;IAAgC,UAAU,EAAEC;EAA5C,GAA4DC,KAA5D,EAAP;AACD,CANM"}
@@ -1,8 +1,13 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const DiscretePathEffect = props => {
3
- return /*#__PURE__*/React.createElement("skDiscretePathEffect", props);
4
- };
5
- DiscretePathEffect.defaultProps = {
6
- seed: 0
4
+ export const DiscretePathEffect = _ref => {
5
+ let {
6
+ seed = 0,
7
+ ...props
8
+ } = _ref;
9
+ return /*#__PURE__*/React.createElement("skDiscretePathEffect", _extends({
10
+ seed: seed
11
+ }, props));
7
12
  };
8
13
  //# sourceMappingURL=Discrete.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","DiscretePathEffect","props","defaultProps","seed"],"sources":["Discrete.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaProps } from \"../../processors/Animations/Animations\";\nimport type { DiscretePathEffectProps } from \"../../../dom/types\";\n\nexport const DiscretePathEffect = (\n props: SkiaProps<DiscretePathEffectProps>\n) => {\n return <skDiscretePathEffect {...props} />;\n};\n\nDiscretePathEffect.defaultProps = {\n seed: 0,\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,kBAAkB,GAC7BC,KADgC,IAE7B;EACH,oBAAO,4CAA0BA,KAA1B,CAAP;AACD,CAJM;AAMPD,kBAAkB,CAACE,YAAnB,GAAkC;EAChCC,IAAI,EAAE;AAD0B,CAAlC"}
1
+ {"version":3,"names":["React","DiscretePathEffect","seed","props"],"sources":["Discrete.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { SkiaDefaultProps } from \"../../processors/Animations/Animations\";\nimport type { DiscretePathEffectProps } from \"../../../dom/types\";\n\nexport const DiscretePathEffect = ({\n seed = 0,\n ...props\n}: SkiaDefaultProps<DiscretePathEffectProps, \"seed\">) => {\n return <skDiscretePathEffect seed={seed} {...props} />;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,kBAAkB,GAAG,QAGuB;EAAA,IAHtB;IACjCC,IAAI,GAAG,CAD0B;IAEjC,GAAGC;EAF8B,CAGsB;EACvD,oBAAO;IAAsB,IAAI,EAAED;EAA5B,GAAsCC,KAAtC,EAAP;AACD,CALM"}
@@ -1,10 +1,17 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const FractalNoise = props => {
3
- return /*#__PURE__*/React.createElement("skFractalNoise", props);
4
- };
5
- FractalNoise.defaultProps = {
6
- seed: 0,
7
- tileWidth: 0,
8
- tileHeight: 0
4
+ export const FractalNoise = _ref => {
5
+ let {
6
+ seed = 0,
7
+ tileWidth = 0,
8
+ tileHeight = 0,
9
+ ...props
10
+ } = _ref;
11
+ return /*#__PURE__*/React.createElement("skFractalNoise", _extends({
12
+ seed: seed,
13
+ tileWidth: tileWidth,
14
+ tileHeight: tileHeight
15
+ }, props));
9
16
  };
10
17
  //# sourceMappingURL=FractalNoise.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","FractalNoise","props","defaultProps","seed","tileWidth","tileHeight"],"sources":["FractalNoise.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { FractalNoiseProps } from \"../../../dom/types\";\nimport type { SkiaProps } from \"../../processors/Animations/Animations\";\n\nexport const FractalNoise = (props: SkiaProps<FractalNoiseProps>) => {\n return <skFractalNoise {...props} />;\n};\n\nFractalNoise.defaultProps = {\n seed: 0,\n tileWidth: 0,\n tileHeight: 0,\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,YAAY,GAAIC,KAAD,IAAyC;EACnE,oBAAO,sCAAoBA,KAApB,CAAP;AACD,CAFM;AAIPD,YAAY,CAACE,YAAb,GAA4B;EAC1BC,IAAI,EAAE,CADoB;EAE1BC,SAAS,EAAE,CAFe;EAG1BC,UAAU,EAAE;AAHc,CAA5B"}
1
+ {"version":3,"names":["React","FractalNoise","seed","tileWidth","tileHeight","props"],"sources":["FractalNoise.tsx"],"sourcesContent":["import React from \"react\";\n\nimport type { FractalNoiseProps } from \"../../../dom/types\";\nimport type { SkiaDefaultProps } from \"../../processors/Animations/Animations\";\n\nexport const FractalNoise = ({\n seed = 0,\n tileWidth = 0,\n tileHeight = 0,\n ...props\n}: SkiaDefaultProps<\n FractalNoiseProps,\n \"seed\" | \"tileHeight\" | \"tileWidth\"\n>) => {\n return (\n <skFractalNoise\n seed={seed}\n tileWidth={tileWidth}\n tileHeight={tileHeight}\n {...props}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAKA,OAAO,MAAMC,YAAY,GAAG,QAQtB;EAAA,IARuB;IAC3BC,IAAI,GAAG,CADoB;IAE3BC,SAAS,GAAG,CAFe;IAG3BC,UAAU,GAAG,CAHc;IAI3B,GAAGC;EAJwB,CAQvB;EACJ,oBACE;IACE,IAAI,EAAEH,IADR;IAEE,SAAS,EAAEC,SAFb;IAGE,UAAU,EAAEC;EAHd,GAIMC,KAJN,EADF;AAQD,CAjBM"}
@@ -1,8 +1,13 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
2
+
1
3
  import React from "react";
2
- export const Shader = props => {
3
- return /*#__PURE__*/React.createElement("skShader", props);
4
- };
5
- Shader.defaultProps = {
6
- uniforms: []
4
+ export const Shader = _ref => {
5
+ let {
6
+ uniforms = {},
7
+ ...props
8
+ } = _ref;
9
+ return /*#__PURE__*/React.createElement("skShader", _extends({
10
+ uniforms: uniforms
11
+ }, props));
7
12
  };
8
13
  //# sourceMappingURL=Shader.js.map