@shopify/react-native-skia 1.3.6 → 1.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +14 -7
  2. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +1 -2
  3. package/cpp/api/JsiSkTypefaceFontProvider.h +14 -4
  4. package/lib/commonjs/dom/nodes/Node.d.ts +2 -3
  5. package/lib/commonjs/dom/nodes/Node.js +1 -2
  6. package/lib/commonjs/dom/nodes/Node.js.map +1 -1
  7. package/lib/commonjs/dom/nodes/PaintNode.js +1 -1
  8. package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
  9. package/lib/commonjs/dom/nodes/drawings/Box.js +1 -1
  10. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  11. package/lib/commonjs/dom/nodes/paint/BlendNode.js +1 -1
  12. package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
  13. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -1
  14. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  15. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
  16. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  17. package/lib/commonjs/dom/nodes/paint/MaskFilters.js +1 -1
  18. package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
  19. package/lib/commonjs/dom/nodes/paint/PathEffects.js +1 -1
  20. package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
  21. package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -1
  22. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  23. package/lib/commonjs/dom/types/Node.d.ts +1 -2
  24. package/lib/commonjs/dom/types/Node.js.map +1 -1
  25. package/lib/commonjs/dom/types/NodeType.d.ts +0 -9
  26. package/lib/commonjs/dom/types/NodeType.js +1 -11
  27. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  28. package/lib/commonjs/external/reanimated/useVideo.js +0 -2
  29. package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
  30. package/lib/commonjs/external/reanimated/useVideoLoading.js +6 -4
  31. package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -1
  32. package/lib/commonjs/skia/core/SVG.web.d.ts +2 -0
  33. package/lib/commonjs/skia/core/SVG.web.js +22 -0
  34. package/lib/commonjs/skia/core/SVG.web.js.map +1 -0
  35. package/lib/commonjs/skia/types/Font/FontMgr.d.ts +1 -1
  36. package/lib/commonjs/skia/types/Font/FontMgr.js.map +1 -1
  37. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js +1 -1
  38. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  39. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  40. package/lib/commonjs/skia/web/JsiSkCanvas.js +3 -2
  41. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  42. package/lib/commonjs/skia/web/JsiSkSVG.d.ts +9 -0
  43. package/lib/commonjs/skia/web/JsiSkSVG.js +28 -0
  44. package/lib/commonjs/skia/web/JsiSkSVG.js.map +1 -0
  45. package/lib/commonjs/skia/web/JsiSkSVGFactory.d.ts +4 -3
  46. package/lib/commonjs/skia/web/JsiSkSVGFactory.js +40 -4
  47. package/lib/commonjs/skia/web/JsiSkSVGFactory.js.map +1 -1
  48. package/lib/module/dom/nodes/Node.d.ts +2 -3
  49. package/lib/module/dom/nodes/Node.js +1 -2
  50. package/lib/module/dom/nodes/Node.js.map +1 -1
  51. package/lib/module/dom/nodes/PaintNode.js +2 -2
  52. package/lib/module/dom/nodes/PaintNode.js.map +1 -1
  53. package/lib/module/dom/nodes/drawings/Box.js +2 -2
  54. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  55. package/lib/module/dom/nodes/paint/BlendNode.js +2 -2
  56. package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
  57. package/lib/module/dom/nodes/paint/ColorFilters.js +2 -2
  58. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  59. package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
  60. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  61. package/lib/module/dom/nodes/paint/MaskFilters.js +2 -2
  62. package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
  63. package/lib/module/dom/nodes/paint/PathEffects.js +2 -2
  64. package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
  65. package/lib/module/dom/nodes/paint/Shaders.js +2 -2
  66. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  67. package/lib/module/dom/types/Node.d.ts +1 -2
  68. package/lib/module/dom/types/Node.js.map +1 -1
  69. package/lib/module/dom/types/NodeType.d.ts +0 -9
  70. package/lib/module/dom/types/NodeType.js +0 -10
  71. package/lib/module/dom/types/NodeType.js.map +1 -1
  72. package/lib/module/external/reanimated/useVideo.js +0 -2
  73. package/lib/module/external/reanimated/useVideo.js.map +1 -1
  74. package/lib/module/external/reanimated/useVideoLoading.js +7 -5
  75. package/lib/module/external/reanimated/useVideoLoading.js.map +1 -1
  76. package/lib/module/skia/core/SVG.web.d.ts +2 -0
  77. package/lib/module/skia/core/SVG.web.js +15 -0
  78. package/lib/module/skia/core/SVG.web.js.map +1 -0
  79. package/lib/module/skia/types/Font/FontMgr.d.ts +1 -1
  80. package/lib/module/skia/types/Font/FontMgr.js.map +1 -1
  81. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js +1 -1
  82. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  83. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  84. package/lib/module/skia/web/JsiSkCanvas.js +3 -2
  85. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  86. package/lib/module/skia/web/JsiSkSVG.d.ts +9 -0
  87. package/lib/module/skia/web/JsiSkSVG.js +21 -0
  88. package/lib/module/skia/web/JsiSkSVG.js.map +1 -0
  89. package/lib/module/skia/web/JsiSkSVGFactory.d.ts +4 -3
  90. package/lib/module/skia/web/JsiSkSVGFactory.js +41 -5
  91. package/lib/module/skia/web/JsiSkSVGFactory.js.map +1 -1
  92. package/lib/typescript/src/dom/nodes/Node.d.ts +2 -3
  93. package/lib/typescript/src/dom/types/Node.d.ts +1 -2
  94. package/lib/typescript/src/dom/types/NodeType.d.ts +0 -9
  95. package/lib/typescript/src/skia/core/SVG.web.d.ts +2 -0
  96. package/lib/typescript/src/skia/types/Font/FontMgr.d.ts +1 -1
  97. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
  98. package/lib/typescript/src/skia/web/JsiSkSVG.d.ts +9 -0
  99. package/lib/typescript/src/skia/web/JsiSkSVGFactory.d.ts +4 -3
  100. package/package.json +2 -2
  101. package/src/dom/nodes/Node.ts +2 -12
  102. package/src/dom/nodes/PaintNode.ts +2 -2
  103. package/src/dom/nodes/drawings/Box.ts +2 -2
  104. package/src/dom/nodes/paint/BlendNode.ts +2 -2
  105. package/src/dom/nodes/paint/ColorFilters.ts +2 -2
  106. package/src/dom/nodes/paint/ImageFilters.ts +2 -2
  107. package/src/dom/nodes/paint/MaskFilters.ts +2 -2
  108. package/src/dom/nodes/paint/PathEffects.ts +2 -2
  109. package/src/dom/nodes/paint/Shaders.ts +2 -2
  110. package/src/dom/types/Node.ts +2 -2
  111. package/src/dom/types/NodeType.ts +0 -10
  112. package/src/external/reanimated/useVideo.ts +0 -2
  113. package/src/external/reanimated/useVideoLoading.ts +11 -8
  114. package/src/skia/core/SVG.web.ts +29 -0
  115. package/src/skia/types/Font/FontMgr.ts +1 -1
  116. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +1 -1
  117. package/src/skia/web/JsiSkCanvas.ts +6 -2
  118. package/src/skia/web/JsiSkSVG.ts +27 -0
  119. package/src/skia/web/JsiSkSVGFactory.ts +47 -6
@@ -5,15 +5,51 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.JsiSkSVGFactory = void 0;
7
7
  var _Host = require("./Host");
8
+ var _JsiSkSVG = require("./JsiSkSVG");
8
9
  class JsiSkSVGFactory extends _Host.Host {
9
10
  constructor(CanvasKit) {
10
11
  super(CanvasKit);
11
12
  }
12
- MakeFromData(_data) {
13
- throw new _Host.NotImplementedOnRNWeb();
13
+ MakeFromData(data) {
14
+ const decoder = new TextDecoder("utf-8");
15
+ const str = decoder.decode(data.ref);
16
+ return this.MakeFromString(str);
14
17
  }
15
- MakeFromString(_str) {
16
- throw new _Host.NotImplementedOnRNWeb();
18
+ MakeFromString(str) {
19
+ const parser = new DOMParser();
20
+ const svgDoc = parser.parseFromString(str, "image/svg+xml");
21
+ const svgElement = svgDoc.documentElement;
22
+ const attrWidth = svgElement.getAttribute("width");
23
+ const attrHeight = svgElement.getAttribute("height");
24
+ let width = attrWidth ? parseFloat(attrWidth) : null;
25
+ let height = attrHeight ? parseFloat(attrHeight) : null;
26
+ const svgDataUrl = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(str);
27
+ // Create a new HTMLImageElement
28
+ const img = new Image();
29
+ img.src = svgDataUrl;
30
+
31
+ // Optionally set styles or attributes on the image
32
+ img.style.display = "none";
33
+ img.alt = "SVG Image";
34
+ if (!width || !height) {
35
+ const viewBox = svgElement.getAttribute("viewBox");
36
+ if (viewBox) {
37
+ const viewBoxValues = viewBox.split(" ");
38
+ if (viewBoxValues.length === 4) {
39
+ width = width || parseFloat(viewBoxValues[2]);
40
+ height = height || parseFloat(viewBoxValues[3]);
41
+ }
42
+ }
43
+ }
44
+ if (width && height) {
45
+ img.width = width;
46
+ img.height = height;
47
+ }
48
+ img.onerror = e => {
49
+ console.error("SVG failed to load", e);
50
+ };
51
+ document.body.appendChild(img);
52
+ return new _JsiSkSVG.JsiSkSVG(this.CanvasKit, img);
17
53
  }
18
54
  }
19
55
  exports.JsiSkSVGFactory = JsiSkSVGFactory;
@@ -1 +1 @@
1
- {"version":3,"names":["_Host","require","JsiSkSVGFactory","Host","constructor","CanvasKit","MakeFromData","_data","NotImplementedOnRNWeb","MakeFromString","_str","exports"],"sources":["JsiSkSVGFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkData, SkSVG } from \"../types\";\nimport type { SVGFactory } from \"../types/SVG/SVGFactory\";\n\nimport { Host, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkSVGFactory extends Host implements SVGFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromData(_data: SkData): SkSVG | null {\n throw new NotImplementedOnRNWeb();\n }\n\n MakeFromString(_str: string): SkSVG | null {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":";;;;;;AAKA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,SAASC,UAAI,CAAuB;EAC9DC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,YAAYA,CAACC,KAAa,EAAgB;IACxC,MAAM,IAAIC,2BAAqB,CAAC,CAAC;EACnC;EAEAC,cAAcA,CAACC,IAAY,EAAgB;IACzC,MAAM,IAAIF,2BAAqB,CAAC,CAAC;EACnC;AACF;AAACG,OAAA,CAAAT,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_Host","require","_JsiSkSVG","JsiSkSVGFactory","Host","constructor","CanvasKit","MakeFromData","data","decoder","TextDecoder","str","decode","ref","MakeFromString","parser","DOMParser","svgDoc","parseFromString","svgElement","documentElement","attrWidth","getAttribute","attrHeight","width","parseFloat","height","svgDataUrl","encodeURIComponent","img","Image","src","style","display","alt","viewBox","viewBoxValues","split","length","onerror","e","console","error","document","body","appendChild","JsiSkSVG","exports"],"sources":["JsiSkSVGFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkSVG } from \"../types\";\nimport type { SVGFactory } from \"../types/SVG/SVGFactory\";\n\nimport { Host } from \"./Host\";\nimport type { JsiSkData } from \"./JsiSkData\";\nimport { JsiSkSVG } from \"./JsiSkSVG\";\n\nexport class JsiSkSVGFactory extends Host implements SVGFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeFromData(data: JsiSkData): SkSVG | null {\n const decoder = new TextDecoder(\"utf-8\");\n const str = decoder.decode(data.ref);\n return this.MakeFromString(str);\n }\n\n MakeFromString(str: string): SkSVG | null {\n const parser = new DOMParser();\n const svgDoc = parser.parseFromString(str, \"image/svg+xml\");\n const svgElement = svgDoc.documentElement;\n\n const attrWidth = svgElement.getAttribute(\"width\");\n const attrHeight = svgElement.getAttribute(\"height\");\n let width = attrWidth ? parseFloat(attrWidth) : null;\n let height = attrHeight ? parseFloat(attrHeight) : null;\n\n const svgDataUrl =\n \"data:image/svg+xml;charset=utf-8,\" + encodeURIComponent(str);\n // Create a new HTMLImageElement\n const img = new Image();\n img.src = svgDataUrl;\n\n // Optionally set styles or attributes on the image\n img.style.display = \"none\";\n img.alt = \"SVG Image\";\n if (!width || !height) {\n const viewBox = svgElement.getAttribute(\"viewBox\");\n if (viewBox) {\n const viewBoxValues = viewBox.split(\" \");\n if (viewBoxValues.length === 4) {\n width = width || parseFloat(viewBoxValues[2]);\n height = height || parseFloat(viewBoxValues[3]);\n }\n }\n }\n if (width && height) {\n img.width = width;\n img.height = height;\n }\n\n img.onerror = (e) => {\n console.error(\"SVG failed to load\", e);\n };\n document.body.appendChild(img);\n return new JsiSkSVG(this.CanvasKit, img);\n }\n}\n"],"mappings":";;;;;;AAKA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEO,MAAME,eAAe,SAASC,UAAI,CAAuB;EAC9DC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,YAAYA,CAACC,IAAe,EAAgB;IAC1C,MAAMC,OAAO,GAAG,IAAIC,WAAW,CAAC,OAAO,CAAC;IACxC,MAAMC,GA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ACW,aAAa,CAAC,CAAC,CAAC,CAAC;QACjD;MACF;IACF;IACA,IAAIZ,KAAK,IAAIE,MAAM,EAAE;MACnBG,GAAG,CAACL,KAAK,GAAGA,KAAK;MACjBK,GAAG,CAACH,MAAM,GAAGA,MAAM;IACrB;IAEAG,GAAG,CAACU,OAAO,GAAIC,CAAC,IAAK;MACnBC,OAAO,CAACC,KAAK,CAAC,oBAAoB,EAAEF,CAAC,CAAC;IACxC,CAAC;IACDG,QAAQ,CAACC,IAAI,CAACC,WAAW,CAAChB,GAAG,CAAC;IAC9B,OAAO,IAAIiB,kBAAQ,CAAC,IAAI,CAACxC,SAAS,EAAEuB,GAAG,CAAC;EAC1C;AACF;AAACkB,OAAA,CAAA5C,eAAA,GAAAA,eAAA"}
@@ -1,5 +1,5 @@
1
1
  import type { Skia } from "../../skia/types";
2
- import type { Node, DeclarationNode, NodeType, DeclarationType } from "../types";
2
+ import type { Node, DeclarationNode, NodeType } from "../types";
3
3
  import type { DeclarationContext } from "../types/DeclarationContext";
4
4
  export interface NodeContext {
5
5
  Skia: Skia;
@@ -21,9 +21,8 @@ export declare abstract class JsiNode<P> implements Node<P> {
21
21
  }
22
22
  export type Invalidate = () => void;
23
23
  export declare abstract class JsiDeclarationNode<P> extends JsiNode<P> implements DeclarationNode<P> {
24
- declarationType: DeclarationType;
25
24
  private invalidate;
26
- constructor(ctx: NodeContext, declarationType: DeclarationType, type: NodeType, props: P);
25
+ constructor(ctx: NodeContext, type: NodeType, props: P);
27
26
  abstract decorate(ctx: DeclarationContext): void;
28
27
  protected decorateChildren(ctx: DeclarationContext): void;
29
28
  addChild(child: Node<unknown>): void;
@@ -47,9 +47,8 @@ export class JsiNode {
47
47
  }
48
48
  }
49
49
  export class JsiDeclarationNode extends JsiNode {
50
- constructor(ctx, declarationType, type, props) {
50
+ constructor(ctx, type, props) {
51
51
  super(ctx, type, props);
52
- this.declarationType = declarationType;
53
52
  _defineProperty(this, "invalidate", () => {});
54
53
  }
55
54
  decorateChildren(ctx) {
@@ -1 +1 @@
1
- {"version":3,"names":["JsiNode","constructor","ctx","type","props","_defineProperty","Skia","setProps","setProp","name","v","hasChanged","getProps","children","_children","addChild","child","removeChild","push","dispose","forEach","index","indexOf","node","splice","insertChildBefore","before","beforeIndex","JsiDeclarationNode","declarationType","decorateChildren","decorate","Error","invalidate","setInvalidate"],"sources":["Node.ts"],"sourcesContent":["import type { Skia } from \"../../skia/types\";\nimport type {\n Node,\n DeclarationNode,\n NodeType,\n DeclarationType,\n} from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nexport interface NodeContext {\n Skia: Skia;\n}\n\nexport abstract class JsiNode<P> implements Node<P> {\n protected _children: JsiNode<unknown>[] = [];\n protected Skia: Skia;\n\n constructor(ctx: NodeContext, public type: NodeType, protected props: P) {\n this.Skia = ctx.Skia;\n }\n\n setProps(props: P) {\n this.props = props;\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = this.props[name] !== v;\n this.props[name] = v;\n return hasChanged;\n }\n\n getProps() {\n return this.props;\n }\n\n children() {\n return this._children;\n }\n\n addChild(child: Node<unknown>) {\n this.removeChild(child);\n this._children.push(child as JsiNode<unknown>);\n }\n\n dispose() {\n this._children.forEach((child) => child.dispose());\n }\n\n removeChild(child: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n const [node] = this._children.splice(index, 1);\n node.dispose();\n }\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n this._children.splice(index, 1);\n }\n const beforeIndex = this._children.indexOf(before as JsiNode<unknown>);\n this._children.splice(beforeIndex, 0, child as JsiNode<unknown>);\n }\n}\n\nexport type Invalidate = () => void;\n\nexport abstract class JsiDeclarationNode<P>\n extends JsiNode<P>\n implements DeclarationNode<P>\n{\n private invalidate: Invalidate = () => {};\n\n constructor(\n ctx: NodeContext,\n public declarationType: DeclarationType,\n type: NodeType,\n props: P\n ) {\n super(ctx, type, props);\n }\n\n abstract decorate(ctx: DeclarationContext): void;\n\n protected decorateChildren(ctx: DeclarationContext) {\n this.children().forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.invalidate();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.invalidate();\n }\n\n dispose() {\n this.invalidate();\n super.dispose();\n }\n\n setInvalidate(invalidate: Invalidate) {\n this.invalidate = invalidate;\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.invalidate();\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = super.setProp(name, v);\n if (hasChanged) {\n this.invalidate();\n }\n return hasChanged;\n }\n}\n"],"mappings":";;;AAaA,OAAO,MAAeA,OAAO,CAAuB;EAIlDC,WAAWA,CAACC,GAAgB,EAASC,IAAc,EAAYC,KAAQ,EAAE;IAAA,KAApCD,IAAc,GAAdA,IAAc;IAAA,KAAYC,KAAQ,GAARA,KAAQ;IAAAC,eAAA,oBAH7B,EAAE;IAAAA,eAAA;IAI1C,IAAI,CAACC,IAAI,GAAGJ,GAAG,CAACI,IAAI;EACtB;EAEAC,QAAQA,CAACH,KAAQ,EAAE;IACjB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEAI,OAAOA,CAAoBC,IAAO,EAAEC,CAAO,EAAE;IAC3C,MAAMC,UAAU,GAAG,IAAI,CAACP,KAAK,CAACK,IAAI,CAAC,KAAKC,CAAC;IACzC,IAAI,CAACN,KAAK,CAACK,IAAI,CAAC,GAAGC,CAAC;IACpB,OAAOC,UAAU;EACnB;EAEAC,QAAQ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;EAEAzB,OAAOA,CAAoBC,IAAO,EAAEC,CAAO,EAAE;IAC3C,MAAMC,UAAU,GAAG,KAAK,CAACH,OAAO,CAACC,IAAI,EAAEC,CAAC,CAAC;IACzC,IAAIC,UAAU,EAAE;MACd,IAAI,CAACsB,UAAU,CAAC,CAAC;IACnB;IACA,OAAOtB,UAAU;EACnB;AACF"}
1
+ {"version":3,"names":["JsiNode","constructor","ctx","type","props","_defineProperty","Skia","setProps","setProp","name","v","hasChanged","getProps","children","_children","addChild","child","removeChild","push","dispose","forEach","index","indexOf","node","splice","insertChildBefore","before","beforeIndex","JsiDeclarationNode","decorateChildren","decorate","Error","invalidate","setInvalidate"],"sources":["Node.ts"],"sourcesContent":["import type { Skia } from \"../../skia/types\";\nimport type { Node, DeclarationNode, NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nexport interface NodeContext {\n Skia: Skia;\n}\n\nexport abstract class JsiNode<P> implements Node<P> {\n protected _children: JsiNode<unknown>[] = [];\n protected Skia: Skia;\n\n constructor(ctx: NodeContext, public type: NodeType, protected props: P) {\n this.Skia = ctx.Skia;\n }\n\n setProps(props: P) {\n this.props = props;\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = this.props[name] !== v;\n this.props[name] = v;\n return hasChanged;\n }\n\n getProps() {\n return this.props;\n }\n\n children() {\n return this._children;\n }\n\n addChild(child: Node<unknown>) {\n this.removeChild(child);\n this._children.push(child as JsiNode<unknown>);\n }\n\n dispose() {\n this._children.forEach((child) => child.dispose());\n }\n\n removeChild(child: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n const [node] = this._children.splice(index, 1);\n node.dispose();\n }\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n this._children.splice(index, 1);\n }\n const beforeIndex = this._children.indexOf(before as JsiNode<unknown>);\n this._children.splice(beforeIndex, 0, child as JsiNode<unknown>);\n }\n}\n\nexport type Invalidate = () => void;\n\nexport abstract class JsiDeclarationNode<P>\n extends JsiNode<P>\n implements DeclarationNode<P>\n{\n private invalidate: Invalidate = () => {};\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n abstract decorate(ctx: DeclarationContext): void;\n\n protected decorateChildren(ctx: DeclarationContext) {\n this.children().forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.invalidate();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.invalidate();\n }\n\n dispose() {\n this.invalidate();\n super.dispose();\n }\n\n setInvalidate(invalidate: Invalidate) {\n this.invalidate = invalidate;\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.invalidate();\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = super.setProp(name, v);\n if (hasChanged) {\n this.invalidate();\n }\n return hasChanged;\n }\n}\n"],"mappings":";;;AAQA,OAAO,MAAeA,OAAO,CAAuB;EAIlDC,WAAWA,CAACC,GAAgB,EAASC,IAAc,EAAYC,KAAQ,EAAE;IAAA,KAApCD,IAAc,GAAdA,IAAc;IAAA,KAAYC,KAAQ,GAARA,KAAQ;IAAAC,eAAA,oBAH7B,EAAE;IAAAA,eAAA;IAI1C,IAAI,CAACC,IAAI,GAAGJ,GAAG,CAACI,IAAI;EACtB;EAEAC,QAAQA,CAACH,KAAQ,EAAE;IACjB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB;EAEAI,OAAOA,CAAoBC,IAAO,EAAEC,CAAO,EAAE;IAC3C,MAAMC,UAAU,GA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AQ,EAAE;IACjB,KAAK,CAACG,QAAQ,CAACH,KAAK,CAAC;IACrB,IAAI,CAAC4B,UAAU,CAAC,CAAC;EACnB;EAEAxB,OAAOA,CAAoBC,IAAO,EAAEC,CAAO,EAAE;IAC3C,MAAMC,UAAU,GAAG,KAAK,CAACH,OAAO,CAACC,IAAI,EAAEC,CAAC,CAAC;IACzC,IAAIC,UAAU,EAAE;MACd,IAAI,CAACqB,UAAU,CAAC,CAAC;IACnB;IACA,OAAOrB,UAAU;EACnB;AACF"}
@@ -1,10 +1,10 @@
1
1
  import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from "../../skia/types";
2
- import { DeclarationType, NodeType } from "../types";
2
+ import { NodeType } from "../types";
3
3
  import { enumKey } from "./datatypes";
4
4
  import { JsiDeclarationNode } from "./Node";
5
5
  export class PaintNode extends JsiDeclarationNode {
6
6
  constructor(ctx, props = {}) {
7
- super(ctx, DeclarationType.Paint, NodeType.Paint, props);
7
+ super(ctx, NodeType.Paint, props);
8
8
  }
9
9
  decorate(ctx) {
10
10
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","DeclarationType","NodeType","enumKey","JsiDeclarationNode","PaintNode","constructor","ctx","props","Paint","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","dither","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","setDither","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { DeclarationType, NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nimport { enumKey } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class PaintNode\n extends JsiDeclarationNode<PaintProps>\n implements DeclarationNode<PaintProps>\n{\n constructor(ctx: NodeContext, props: PaintProps = {}) {\n super(ctx, DeclarationType.Paint, NodeType.Paint, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n dither,\n } = this.props;\n const paint = this.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(this.Skia.Color(color));\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n ctx.save();\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n ctx.paints.push(paint);\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,SAAS,QAAQ,kBAAkB;AAE/E,SAASC,eAAe,EAAEC,QAAQ,QAAQ,UAAU;AAGpD,SAASC,OAAO,QAAQ,aAAa;AAErC,SAASC,kBAAkB,QAAQ,QAAQ;AAE3C,OAAO,MAAMC,SAAS,SACZD,kBAAkB,CAE5B;EACEE,WAAWA,CAACC,GAAgB,EAAEC,KAAiB,GAAG,CAAC,CAAC,EAAE;IACpD,KAAK,CAACD,GAAG,EAAEN,eAAe,CAACQ,KAAK,EAAEP,QAAQ,CAACO,KAAK,EAAED,KAAK,CAAC;EAC1D;EAEAE,QAAQA,CAACH,GAAuB,EAAE;IAChC,MAAM;MACJI,KAAK;MACLC,WAAW;MACXC,SAAS;MACTC,KAAK;MACLC,UAAU;MACVC,SAAS;MACTC,WAAW;MACXC,OAAO;MACPC,SAAS;MACTC;IACF,CAAC,GAAG,IAAI,CAACZ,KAAK;IACd,MAAMa,KAAK,GAAG,IAAI,CAACC,IAAI,CAACb,KAAK,CAAC,CAAC;IAC/B,IAAIE,KAAK,KAAKY,SAAS,EAAE;MACvBF,KAAK,CAACG,QAAQ,CAAC,IAAI,CAACF,IAAI,CAACG,KAAK,CAACd,KAAK,CAAC,CAAC;IACxC;IACA,IAAIC,WAAW,KAAKW,SAAS,EAAE;MAC7BF,KAAK,CAACK,cAAc,CAACd,WAAW,CAAC;IACnC;IACA,IAAIC,SAAS,KAAKU,SAAS,EAAE;MAC3BF,KAAK,CAACM,YAAY,CAAC3B,SAAS,CAACG,OAAO,CAACU,SAAS,CAAC,CAAC,CAAC;IACnD;IACA,IAAIC,KAAK,KAAKS,SAAS,EAAE;MACvBF,KAAK,CAACO,QAAQ,CAAC7B,UAAU,CAACI,OAAO,CAACW,KAAK,CAAC,CAAC,CAAC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W,EAAE;MACfrB,KAAK,CAAC+B,cAAc,CAACV,WAAW,CAAC;IACnC;IACA,IAAIE,MAAM,EAAE;MACVvB,KAAK,CAACgC,SAAS,CAACT,MAAM,CAAC;IACzB;IACA,IAAIK,UAAU,EAAE;MACd5B,KAAK,CAACiC,aAAa,CAACL,UAAU,CAAC;IACjC;IACA,IAAIV,WAAW,EAAE;MACflB,KAAK,CAACkC,cAAc,CAAChB,WAAW,CAAC;IACnC;IACA,IAAIQ,UAAU,EAAE;MACd1B,KAAK,CAACmC,aAAa,CAACT,UAAU,CAAC;IACjC;IACAxC,GAAG,CAACkD,MAAM,CAACC,IAAI,CAACrC,KAAK,CAAC;EACxB;AACF"}
1
+ {"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","NodeType","enumKey","JsiDeclarationNode","PaintNode","constructor","ctx","props","Paint","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","dither","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","setDither","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nimport { enumKey } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class PaintNode\n extends JsiDeclarationNode<PaintProps>\n implements DeclarationNode<PaintProps>\n{\n constructor(ctx: NodeContext, props: PaintProps = {}) {\n super(ctx, NodeType.Paint, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n dither,\n } = this.props;\n const paint = this.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(this.Skia.Color(color));\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n ctx.save();\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n paint.setMaskFilter(maskFilter);\n }\n ctx.paints.push(paint);\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,UAAU,EAAEC,SAAS,QAAQ,kBAAkB;AAE/E,SAASC,QAAQ,QAAQ,UAAU;AAGnC,SAASC,OAAO,QAAQ,aAAa;AAErC,SAASC,kBAAkB,QAAQ,Q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ACd1B,KAAK,CAACmC,aAAa,CAACT,UAAU,CAAC;IACjC;IACAxC,GAAG,CAACkD,MAAM,CAACC,IAAI,CAACrC,KAAK,CAAC;EACxB;AACF"}
@@ -1,12 +1,12 @@
1
1
  import { BlurStyle, ClipOp, isRRect } from "../../../skia/types";
2
- import { DeclarationType, NodeType } from "../../types";
2
+ import { NodeType } from "../../types";
3
3
  import { JsiDeclarationNode } from "../Node";
4
4
  import { JsiRenderNode } from "../RenderNode";
5
5
  const inflate = (Skia, box, dx, dy, tx = 0, ty = 0) => Skia.RRectXY(Skia.XYWHRect(box.rect.x - dx + tx, box.rect.y - dy + ty, box.rect.width + 2 * dx, box.rect.height + 2 * dy), box.rx + dx, box.ry + dy);
6
6
  const deflate = (Skia, box, dx, dy, tx = 0, ty = 0) => inflate(Skia, box, -dx, -dy, tx, ty);
7
7
  export class BoxShadowNode extends JsiDeclarationNode {
8
8
  constructor(ctx, props) {
9
- super(ctx, DeclarationType.Unknown, NodeType.BoxShadow, props);
9
+ super(ctx, NodeType.BoxShadow, props);
10
10
  }
11
11
  decorate(_ctx) {
12
12
  // do nothing
@@ -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","BoxShadow","decorate","_ctx","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\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\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<BoxShadowProps> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, DeclarationType.Unknown, NodeType.BoxShadow, props);\n }\n\n decorate(_ctx: DeclarationContext) {\n // do nothing\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,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AAEhE,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AAGvD,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,aAAa,QAAQ,eAAe;AAG7C,MAAMC,OAAO,GAAGA,CACdC,IAAU,EACVC,GAAY,EACZC,EAAU,EACVC,EAAU,EACVC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,CAAC,KAENL,IAAI,CAACM,OAAO,CACVN,IAAI,CAACO,QAAQ,CACXN,GAAG,CAACO,IAAI,CAACC,CAAC,GAAGP,EAAE,GAAGE,EAAE,EACpBH,GAAG,CAACO,IAAI,CAACE,CAAC,GAAGP,EAAE,GAAGE,EAAE,EACpBJ,GAAG,CAACO,IAAI,CAACG,KAAK,GAAG,CAAC,GAAGT,EAAE,EACvBD,GAAG,CAACO,IAAI,CAACI,MAAM,GAAG,CAAC,GAAGT,EACxB,CAAC,EACDF,GAAG,CAACY,EAAE,GAAGX,EAAE,EACXD,GAAG,CAACa,EAAE,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AM;MACpE,MAAMe,KAAK,GAAG,IAAI,CAACtD,IAAI,CAACuD,KAAK,CAAC,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACvD,EAAE,CAAC,EAAE,EAAE,GAAGsD,IAAI,CAACC,GAAG,CAACtD,EAAE,CAAC,CAAC;MACnEyB,MAAM,CAAC8B,IAAI,CAAC,CAAC;MACb9B,MAAM,CAAC+B,SAAS,CAAC1D,GAAG,EAAER,MAAM,CAACmE,SAAS,EAAE,KAAK,CAAC;MAC9C,MAAMhB,MAAM,GAAG,IAAI,CAAC5C,IAAI,CAAC6C,KAAK,CAAC,CAAC;MAChCD,MAAM,CAACE,QAAQ,CAAC,IAAI,CAAC9C,IAAI,CAAC+C,KAAK,CAACN,KAAK,CAAC,CAAC;MACvCG,MAAM,CAACI,SAAS,CAACnB,KAAK,CAACG,SAAS,CAAC,CAAC,GAAGD,OAAO,CAAC;MAE7Ca,MAAM,CAACK,aAAa,CAClB,IAAI,CAACjD,IAAI,CAACkD,UAAU,CAACC,QAAQ,CAAC3D,SAAS,CAAC4D,MAAM,EAAEV,IAAI,EAAE,IAAI,CAC5D,CAAC;MACD,MAAMF,KAAK,GAAGzB,OAAO,CAAC,IAAI,CAACf,IAAI,EAAEC,GAAG,EAAE0C,MAAM,EAAEA,MAAM,EAAEzC,EAAE,EAAEC,EAAE,CAAC;MAC7D,MAAM0D,KAAK,GAAG9D,OAAO,CAAC,IAAI,CAACC,IAAI,EAAEC,GAAG,EAAEqD,KAAK,CAAC7C,CAAC,EAAE6C,KAAK,CAAC5C,CAAC,CAAC;MACvDkB,MAAM,CAACkC,UAAU,CAACD,KAAK,EAAErB,KAAK,EAAEI,MAAM,CAAC;MACvChB,MAAM,CAACmC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;EACN;AACF"}
1
+ {"version":3,"names":["BlurStyle","ClipOp","isRRect","NodeType","JsiDeclarationNode","JsiRenderNode","inflate","Skia","box","dx","dy","tx","ty","RRectXY","XYWHRect","rect","x","y","width","height","rx","ry","deflate","BoxShadowNode","constructor","ctx","props","BoxShadow","decorate","_ctx","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 { NodeType } from \"../../types\";\nimport type { BoxShadowProps, BoxProps } from \"../../types/Drawings\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { JsiRenderNode } from \"../RenderNode\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\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<BoxShadowProps> {\n constructor(ctx: NodeContext, props: BoxShadowProps) {\n super(ctx, NodeType.BoxShadow, props);\n }\n\n decorate(_ctx: DeclarationContext) {\n // do nothing\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,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AAEhE,SAASC,QAAQ,QAAQ,aAAa;AAGtC,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,aAAa,QAAQ,eAAe;AAG7C,MAAMC,OAAO,GAAGA,CACdC,IAAU,EACVC,GAAY,EACZC,EAAU,EACVC,EAAU,EACVC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,CAAC,KAENL,IAAI,C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EoD,KAAK,CAAC5C,CAAC,EAAE4C,KAAK,CAAC3C,CAAC,CAAC;MACvDiB,MAAM,CAACkC,UAAU,CAACD,KAAK,EAAErB,KAAK,EAAEI,MAAM,CAAC;MACvChB,MAAM,CAACmC,OAAO,CAAC,CAAC;IAClB,CAAC,CAAC;EACN;AACF"}
@@ -1,11 +1,11 @@
1
1
  import { BlendMode } from "../../../skia/types";
2
- import { DeclarationType, NodeType } from "../../types/NodeType";
2
+ import { NodeType } from "../../types/NodeType";
3
3
  import { JsiDeclarationNode } from "../Node";
4
4
  import { enumKey } from "../datatypes";
5
5
  import { composeDeclarations } from "../../types/DeclarationContext";
6
6
  export class BlendNode extends JsiDeclarationNode {
7
7
  constructor(ctx, props) {
8
- super(ctx, DeclarationType.ImageFilter, NodeType.Blend, props);
8
+ super(ctx, NodeType.Blend, props);
9
9
  }
10
10
  decorate(ctx) {
11
11
  this.decorateChildren(ctx);
@@ -1 +1 @@
1
- {"version":3,"names":["BlendMode","DeclarationType","NodeType","JsiDeclarationNode","enumKey","composeDeclarations","BlendNode","constructor","ctx","props","ImageFilter","Blend","decorate","decorateChildren","Skia","blend","mode","imageFilters","popAll","length","composer","MakeBlend","bind","push","shaders","Shader"],"sources":["BlendNode.ts"],"sourcesContent":["import type { BlendProps } from \"../../types/ImageFilters\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { DeclarationType, NodeType } from \"../../types/NodeType\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nexport class BlendNode extends JsiDeclarationNode<BlendProps> {\n constructor(ctx: NodeContext, props: BlendProps) {\n super(ctx, DeclarationType.ImageFilter, NodeType.Blend, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { Skia } = this;\n const blend = BlendMode[enumKey(this.props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.popAll();\n if (imageFilters.length > 0) {\n const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n }\n // Blend Shaders\n const shaders = ctx.shaders.popAll();\n if (shaders.length > 0) {\n const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);\n ctx.shaders.push(composeDeclarations(shaders, composer));\n }\n }\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,eAAe,EAAEC,QAAQ,QAAQ,sBAAsB;AAEhE,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,OAAO,QAAQ,cAAc;AAEtC,SAASC,mBAAmB,QAAQ,gCAAgC;AAEpE,OAAO,MAAMC,SAAS,SAASH,kBAAkB,CAAa;EAC5DI,WAAWA,CAACC,GAAgB,EAAEC,KAAiB,EAAE;IAC/C,KAAK,CAACD,GAAG,EAAEP,eAAe,CAACS,WAAW,EAAER,QAAQ,CAACS,KAAK,EAAEF,KAAK,CAAC;EAChE;EAEAG,QAAQA,CAACJ,GAAuB,EAAE;IAChC,IAAI,CAACK,gBAAgB,CAACL,GAAG,CAAC;IAC1B,MAAM;MAAEM;IAAK,CAAC,GAAG,IAAI;IACrB,MAAMC,KAAK,GAAGf,SAAS,CAACI,OAAO,CAAC,IAAI,CAACK,KAAK,CAACO,IAAI,CAAC,CAAC;IACjD;IACA,MAAMC,YAAY,GAAGT,GAAG,CAACS,YAAY,CAACC,MAAM,CAAC,CAAC;IAC9C,IAAID,YAAY,CAACE,MAAM,GAAG,CAAC,EAAE;MAC3B,MAAMC,QAAQ,GAAGN,IAAI,CAACJ,WAAW,CAACW,SAAS,CAACC,IAAI,CAACR,IAAI,CAACJ,WAAW,EAAEK,KAAK,CAAC;MACzEP,GAAG,CAACS,YAAY,CAACM,IAAI,CAAClB,mBAAmB,CAACY,YAAY,EAAEG,QAAQ,CAAC,CAAC;IACpE;IACA;IACA,MAAMI,OAAO,GAAGhB,GAAG,CAACgB,OAAO,CAACN,MAAM,CAAC,CAAC;IACpC,IAAIM,OAAO,CAACL,MAAM,GAAG,CAAC,EAAE;MACtB,MAAMC,QAAQ,GAAGN,IAAI,CAACW,MAAM,CAACJ,SAAS,CAACC,IAAI,CAACR,IAAI,CAACW,MAAM,EAAEV,KAAK,CAAC;MAC/DP,GAAG,CAACgB,OAAO,CAACD,IAAI,CAAClB,mBAAmB,CAACmB,OAAO,EAAEJ,QAAQ,CAAC,CAAC;IAC1D;EACF;AACF"}
1
+ {"version":3,"names":["BlendMode","NodeType","JsiDeclarationNode","enumKey","composeDeclarations","BlendNode","constructor","ctx","props","Blend","decorate","decorateChildren","Skia","blend","mode","imageFilters","popAll","length","composer","ImageFilter","MakeBlend","bind","push","shaders","Shader"],"sources":["BlendNode.ts"],"sourcesContent":["import type { BlendProps } from \"../../types/ImageFilters\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { NodeType } from \"../../types/NodeType\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nexport class BlendNode extends JsiDeclarationNode<BlendProps> {\n constructor(ctx: NodeContext, props: BlendProps) {\n super(ctx, NodeType.Blend, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { Skia } = this;\n const blend = BlendMode[enumKey(this.props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.popAll();\n if (imageFilters.length > 0) {\n const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n }\n // Blend Shaders\n const shaders = ctx.shaders.popAll();\n if (shaders.length > 0) {\n const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);\n ctx.shaders.push(composeDeclarations(shaders, composer));\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EL,QAAQ,CAAC,CAAC;IAC1D;EACF;AACF"}
@@ -1,10 +1,10 @@
1
1
  import { BlendMode } from "../../../skia/types";
2
2
  import { JsiDeclarationNode } from "../Node";
3
- import { DeclarationType, NodeType } from "../../types";
3
+ import { NodeType } from "../../types";
4
4
  import { enumKey } from "../datatypes/Enum";
5
5
  export class ColorFilterDeclaration extends JsiDeclarationNode {
6
6
  constructor(ctx, type, props) {
7
- super(ctx, DeclarationType.ColorFilter, type, props);
7
+ super(ctx, type, props);
8
8
  }
9
9
  composeAndPush(ctx, cf1) {
10
10
  ctx.save();
@@ -1 +1 @@
1
- {"version":3,"names":["BlendMode","JsiDeclarationNode","DeclarationType","NodeType","enumKey","ColorFilterDeclaration","constructor","ctx","type","props","ColorFilter","composeAndPush","cf1","save","decorateChildren","cf2","colorFilters","popAllAsOne","restore","cf","Skia","MakeCompose","push","MatrixColorFilterNode","MatrixColorFilter","decorate","matrix","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","second","pop","first","Error","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ColorFilter, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n const cf2 = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;\n ctx.colorFilters.push(cf);\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const color = this.Skia.Color(this.props.color);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n ctx.save();\n this.decorateChildren(ctx);\n const { t } = this.props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n ctx.restore();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));\n }\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAK5C,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SAASC,OAAO,QAAQ,mBAAmB;AAI3C,OAAO,MAAeC,sBAAsB,SAAYJ,kBAAkB,CAAI;EAC5EK,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEL,eAAe,CAACQ,WAAW,EAAEF,IAAI,EAAEC,KAAK,CAAC;EACtD;EAEUE,cAAcA,CAACJ,GAAuB,EAAEK,GAAkB,EAAE;IACpEL,GAAG,CAACM,IAAI,CAAC,CAAC;IACV,IAAI,CAACC,gBAAgB,CAACP,GAAG,CAAC;IAC1B,MAAMQ,GAAG,GAAGR,GAAG,CAACS,YAAY,CAACC,WAAW,CAAC,CAAC;IAC1CV,GAAG,CAACW,OAAO,CAAC,CAAC;IACb,MAAMC,EAAE,GAAGJ,GAAG,GAAG,IAAI,CAACK,IAAI,CAACV,WAAW,CAACW,WAAW,CAACT,GAAG,EAAEG,GAAG,CAAC,GAAGH,GAAG;IAClEL,GAAG,CAACS,YAAY,CAACM,IAAI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ACpC,KAAK;IACxB,MAAMqC,MAAM,GAAGvC,GAAG,CAACS,YAAY,CAAC+B,GAAG,CAAC,CAAC;IACrC,MAAMC,KAAK,GAAGzC,GAAG,CAACS,YAAY,CAAC+B,GAAG,CAAC,CAAC;IACpCxC,GAAG,CAACW,OAAO,CAAC,CAAC;IACb,IAAI,CAAC8B,KAAK,IAAI,CAACF,MAAM,EAAE;MACrB,MAAM,IAAIG,KAAK,CACb,4DACF,CAAC;IACH;IACA1C,GAAG,CAACS,YAAY,CAACM,IAAI,CAAC,IAAI,CAACF,IAAI,CAACV,WAAW,CAACwC,QAAQ,CAACL,CAAC,EAAEG,KAAK,EAAEF,MAAM,CAAC,CAAC;EACzE;AACF"}
1
+ {"version":3,"names":["BlendMode","JsiDeclarationNode","NodeType","enumKey","ColorFilterDeclaration","constructor","ctx","type","props","composeAndPush","cf1","save","decorateChildren","cf2","colorFilters","popAllAsOne","restore","cf","Skia","ColorFilter","MakeCompose","push","MatrixColorFilterNode","MatrixColorFilter","decorate","matrix","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","second","pop","first","Error","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n const cf2 = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;\n ctx.colorFilters.push(cf);\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const color = this.Skia.Color(this.props.color);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n ctx.save();\n this.decorateChildren(ctx);\n const { t } = this.props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n ctx.restore();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));\n }\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAK5C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,OAAO,QAAQ,mBAAmB;AAI3C,OAAO,MAAeC,sBAAsB,SAAYH,kBAAkB,CAAI;EAC5EI,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEC,IAAI,EAAEC,KAAK,CAAC;EACzB;EAEUC,cAAcA,CAACH,GAAuB,EAAEI,GAAkB,EAAE;IACpEJ,GAAG,CAACK,IAAI,CAAC,CAAC;IACV,IAAI,CAACC,gBAAgB,CAACN,GAAG,CAAC;IAC1B,MAAMO,GAAG,GAAGP,GAAG,CAACQ,YAAY,CAACC,WAAW,CAAC,CAAC;IAC1CT,GAAG,CAACU,OAAO,CAAC,CAAC;IACb,MAAMC,EAAE,GAAGJ,GAAG,GAAG,IAAI,CAACK,IAAI,CAACC,WAAW,CAACC,WAAW,CAACV,GAAG,EAAEG,GAAG,CAAC,GAAGH,GAAG;IAClEJ,GAAG,CAACQ,YAAY,CAACO,IAAI,CAACJ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xB,MAAMqC,MAAM,GAAGvC,GAAG,CAACQ,YAAY,CAACgC,GAAG,CAAC,CAAC;IACrC,MAAMC,KAAK,GAAGzC,GAAG,CAACQ,YAAY,CAACgC,GAAG,CAAC,CAAC;IACpCxC,GAAG,CAACU,OAAO,CAAC,CAAC;IACb,IAAI,CAAC+B,KAAK,IAAI,CAACF,MAAM,EAAE;MACrB,MAAM,IAAIG,KAAK,CACb,4DACF,CAAC;IACH;IACA1C,GAAG,CAACQ,YAAY,CAACO,IAAI,CAAC,IAAI,CAACH,IAAI,CAACC,WAAW,CAAC8B,QAAQ,CAACL,CAAC,EAAEG,KAAK,EAAEF,MAAM,CAAC,CAAC;EACzE;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { BlendMode, ColorChannel, processUniforms, TileMode } from "../../../skia/types";
2
- import { DeclarationType, NodeType } from "../../types";
2
+ import { NodeType } from "../../types";
3
3
  import { processRadius, enumKey } from "../datatypes";
4
4
  import { JsiDeclarationNode } from "../Node";
5
5
  const Black = Float32Array.of(0, 0, 0, 1);
@@ -17,7 +17,7 @@ const MakeInnerShadow = (Skia, shadowOnly, dx, dy, sigmaX, sigmaY, color, input)
17
17
  };
18
18
  export class ImageFilterDeclaration extends JsiDeclarationNode {
19
19
  constructor(ctx, type, props) {
20
- super(ctx, DeclarationType.ImageFilter, type, props);
20
+ super(ctx, type, props);
21
21
  }
22
22
  input(ctx) {
23
23
  var _ctx$imageFilters$pop;
@@ -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","_ctx$imageFilters$pop","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","_imgf","imgf","push","OffsetImageFilterNode","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","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 DeclarationContext,\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<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n protected input(ctx: DeclarationContext) {\n return ctx.imageFilters.pop() ?? null;\n }\n\n protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = this.Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n this.Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2\n ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2)\n : imgf1;\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { x, y } = this.props;\n const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { channelX, channelY, scale } = this.props;\n const shader = ctx.shaders.pop();\n if (!shader) {\n throw new Error(\"DisplacementMap expects a shader as child\");\n }\n const map = this.Skia.ImageFilter.MakeShader(shader, null);\n const imgf = this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n this.input(ctx)\n );\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n const imgf = this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\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 const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));\n this.composeAndPush(ctx, imgf);\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 decorate(ctx: DeclarationContext) {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));\n } else {\n imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));\n }\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = this.Skia.ImageFilter.MakeRuntimeShader(\n rtb,\n null,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n"],"mappings":"AACA,SACEA,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAW5B,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,OAAO,QAAQ,cAAc;AAErD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,MAAMC,KAAK,GAAGC,YAAY,CAACC,EAAE,CAAC,CAAC,EAAE,C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gB,EAAEE,KAAoC,EAAE;IAClE,KAAK,CAACF,GAAG,EAAEpC,QAAQ,CAACkG,wBAAwB,EAAE5D,KAAK,CAAC;EACtD;EAEAkB,QAAQA,CAACpB,GAAuB,EAAE;IAChC,MAAM;MAAE+D,MAAM;MAAEC;IAAS,CAAC,GAAG,IAAI,CAAC9D,KAAK;IACvC,MAAM+D,GAAG,GAAG,IAAI,CAAC7F,IAAI,CAAC8F,oBAAoB,CAACH,MAAM,CAAC;IAClD,IAAIC,QAAQ,EAAE;MACZvG,eAAe,CAACsG,MAAM,EAAEC,QAAQ,EAAEC,GAAG,CAAC;IACxC;IACA,MAAMjD,IAAI,GAAG,IAAI,CAAC5C,IAAI,CAACS,WAAW,CAACsF,iBAAiB,CAClDF,GAAG,EACH,IAAI,EACJ,IAAI,CAACtF,KAAK,CAACqB,GAAG,CAChB,CAAC;IACD,IAAI,CAACM,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF"}
1
+ {"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","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","_ctx$imageFilters$pop","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","_imgf","imgf","push","OffsetImageFilterNode","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","Error","map","MakeShader","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 DeclarationContext,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { 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<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n protected input(ctx: DeclarationContext) {\n return ctx.imageFilters.pop() ?? null;\n }\n\n protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = this.Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n this.Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2\n ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2)\n : imgf1;\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { x, y } = this.props;\n const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { channelX, channelY, scale } = this.props;\n const shader = ctx.shaders.pop();\n if (!shader) {\n throw new Error(\"DisplacementMap expects a shader as child\");\n }\n const map = this.Skia.ImageFilter.MakeShader(shader, null);\n const imgf = this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n this.input(ctx)\n );\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n const imgf = this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\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 const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));\n this.composeAndPush(ctx, imgf);\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 decorate(ctx: DeclarationContext) {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));\n } else {\n imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));\n }\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = this.Skia.ImageFilter.MakeRuntimeShader(\n rtb,\n null,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n"],"mappings":"AACA,SACEA,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAW5B,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,aAAa,EAAEC,OAAO,QAAQ,cAAc;AAErD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,MAAMC,KAAK,GAAGC,YAAY,CAACC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAMC,eAAe,GAAGA,CACtBC,IAAU,EACVC,UAA+B,EAC/BC,EAAU,EACVC,EAAU,EACVC,MAAc,EACdC,MAAc,EACdC,KAAc,EACdC,KAA2B,KACxB;EACH,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAW,CAACC,eAAe,CACpDV,IAAI,CAACW,WAAW,CAACC,SAAS,CAAChB,KAAK,EAAER,SAAS,CAACyB,GAAG,CAAC,EAChD,IACF,CAAC;EACD,MAAMC,WAAW,GAAGd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AAC;IACxC;IACA,MAAMjD,IAAI,GAAG,IAAI,CAAC5C,IAAI,CAACS,WAAW,CAACsF,iBAAiB,CAClDF,GAAG,EACH,IAAI,EACJ,IAAI,CAACtF,KAAK,CAACqB,GAAG,CAChB,CAAC;IACD,IAAI,CAACM,cAAc,CAACN,GAAG,EAAEgB,IAAI,CAAC;EAChC;AACF"}
@@ -1,10 +1,10 @@
1
1
  import { BlurStyle } from "../../../skia/types";
2
2
  import { JsiDeclarationNode } from "../Node";
3
- import { DeclarationType, NodeType } from "../../types";
3
+ import { NodeType } from "../../types";
4
4
  import { enumKey } from "../datatypes";
5
5
  export class BlurMaskFilterNode extends JsiDeclarationNode {
6
6
  constructor(ctx, props) {
7
- super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);
7
+ super(ctx, NodeType.BlurMaskFilter, props);
8
8
  }
9
9
  decorate(ctx) {
10
10
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["BlurStyle","JsiDeclarationNode","DeclarationType","NodeType","enumKey","BlurMaskFilterNode","constructor","ctx","props","MaskFilter","BlurMaskFilter","decorate","style","blur","respectCTM","mf","Skia","MakeBlur","maskFilters","push"],"sources":["MaskFilters.ts"],"sourcesContent":["import { BlurStyle } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type { BlurMaskFilterProps } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {\n constructor(ctx: NodeContext, props: BlurMaskFilterProps) {\n super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { style, blur, respectCTM } = this.props;\n const mf = this.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.maskFilters.push(mf);\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SAASC,OAAO,QAAQ,cAAc;AAGtC,OAAO,MAAMC,kBAAkB,SAASJ,kBAAkB,CAAsB;EAC9EK,WAAWA,CAACC,GAAgB,EAAEC,KAA0B,EAAE;IACxD,KAAK,CAACD,GAAG,EAAEL,eAAe,CAACO,UAAU,EAAEN,QAAQ,CAACO,cAAc,EAAEF,KAAK,CAAC;EACxE;EAEAG,QAAQA,CAACJ,GAAuB,EAAE;IAChC,MAAM;MAAEK,KAAK;MAAEC,IAAI;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACN,KAAK;IAC9C,MAAMO,EAAE,GAAG,IAAI,CAACC,IAAI,CAACP,UAAU,CAACQ,QAAQ,CACtCjB,SAAS,CAACI,OAAO,CAACQ,KAAK,CAAC,CAAC,EACzBC,IAAI,EACJC,UACF,CAAC;IACDP,GAAG,CAACW,WAAW,CAACC,IAAI,CAACJ,EAAE,CAAC;EAC1B;AACF"}
1
+ {"version":3,"names":["BlurStyle","JsiDeclarationNode","NodeType","enumKey","BlurMaskFilterNode","constructor","ctx","props","BlurMaskFilter","decorate","style","blur","respectCTM","mf","Skia","MaskFilter","MakeBlur","maskFilters","push"],"sources":["MaskFilters.ts"],"sourcesContent":["import { BlurStyle } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type { BlurMaskFilterProps } from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {\n constructor(ctx: NodeContext, props: BlurMaskFilterProps) {\n super(ctx, NodeType.BlurMaskFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { style, blur, respectCTM } = this.props;\n const mf = this.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.maskFilters.push(mf);\n }\n}\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,OAAO,QAAQ,cAAc;AAGtC,OAAO,MAAMC,kBAAkB,SAASH,kBAAkB,CAAsB;EAC9EI,WAAWA,CAACC,GAAgB,EAAEC,KAA0B,EAAE;IACxD,KAAK,CAACD,GAAG,EAAEJ,QAAQ,CAACM,cAAc,EAAED,KAAK,CAAC;EAC5C;EAEAE,QAAQA,CAACH,GAAuB,EAAE;IAChC,MAAM;MAAEI,KAAK;MAAEC,IAAI;MAAEC;IAAW,CAAC,GAAG,IAAI,CAACL,KAAK;IAC9C,MAAMM,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAACC,QAAQ,CACtChB,SAAS,CAACG,OAAO,CAACO,KAAK,CAAC,CAAC,EACzBC,IAAI,EACJC,UACF,CAAC;IACDN,GAAG,CAACW,WAAW,CAACC,IAAI,CAACL,EAAE,CAAC;EAC1B;AACF"}
@@ -1,12 +1,12 @@
1
1
  import { Path1DEffectStyle } from "../../../skia/types";
2
2
  import { JsiDeclarationNode } from "../Node";
3
- import { DeclarationType, NodeType } from "../../types";
3
+ import { NodeType } from "../../types";
4
4
  import { enumKey } from "../datatypes/Enum";
5
5
  import { processPath } from "../datatypes";
6
6
  import { composeDeclarations } from "../../types/DeclarationContext";
7
7
  class PathEffectDeclaration extends JsiDeclarationNode {
8
8
  constructor(ctx, type, props) {
9
- super(ctx, DeclarationType.PathEffect, type, props);
9
+ super(ctx, type, props);
10
10
  }
11
11
  composeAndPush(ctx, pe1) {
12
12
  ctx.save();
@@ -1 +1 @@
1
- {"version":3,"names":["Path1DEffectStyle","JsiDeclarationNode","DeclarationType","NodeType","enumKey","processPath","composeDeclarations","PathEffectDeclaration","constructor","ctx","type","props","PathEffect","composeAndPush","pe1","save","decorateChildren","pe2","pathEffects","popAllAsOne","restore","pe","Skia","MakeCompose","push","DiscretePathEffectNode","DiscretePathEffect","decorate","length","deviation","seed","MakeDiscrete","Path2DPathEffectNode","Path2DPathEffect","matrix","path","MakePath2D","Error","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","pes","popAll","MakeSum","bind","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D"],"sources":["PathEffects.ts"],"sourcesContent":["import { Path1DEffectStyle } from \"../../../skia/types\";\nimport type { SkPathEffect } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport { processPath } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nabstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.PathEffect, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect) {\n ctx.save();\n this.decorateChildren(ctx);\n const pe2 = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n const pe = pe2 ? this.Skia.PathEffect.MakeCompose(pe1, pe2) : pe1;\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {\n constructor(ctx: NodeContext, props: DiscretePathEffectProps) {\n super(ctx, NodeType.DiscretePathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { length, deviation, seed } = this.props;\n const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path2DPathEffectProps) {\n super(ctx, NodeType.Path2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffectNode: invalid path\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {\n constructor(ctx: NodeContext, props: DashPathEffectProps) {\n super(ctx, NodeType.DashPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { intervals, phase } = this.props;\n const pe = this.Skia.PathEffect.MakeDash(intervals, phase);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {\n constructor(ctx: NodeContext, props: CornerPathEffectProps) {\n super(ctx, NodeType.CornerPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { r } = this.props;\n const pe = this.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffectNode: couldn't create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class SumPathEffectNode extends PathEffectDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SumPathEffect, null);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const pes = ctx.pathEffects.popAll();\n const pe = composeDeclarations(\n pes,\n this.Skia.PathEffect.MakeSum.bind(this.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Line2DPathEffectProps) {\n super(ctx, NodeType.Line2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { width, matrix } = this.props;\n const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path1DPathEffectProps) {\n super(ctx, NodeType.Path1DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { advance, phase, style } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAGvD,SAASC,kBAAkB,QAAQ,SAAS;AAS5C,SAASC,eAAe,EAAEC,QAAQ,QAAQ,aAAa;AACvD,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,mBAAmB,QAAQ,gCAAgC;AAEpE,MAAeC,qBAAqB,SAAYN,kBAAkB,CAAI;EACpEO,WAAWA,CAACC,GAAgB,EAAEC,IAAc,EAAEC,KAAQ,EAAE;IACtD,KAAK,CAACF,GAAG,EAAEP,eAAe,CAACU,UAAU,EAAEF,IAAI,EAAEC,KAAK,CAAC;EACrD;EAEUE,cAAcA,CAACJ,GAAuB,EAAEK,GAAiB,EAAE;IACnEL,GAAG,CAACM,IAAI,CAAC,CAAC;IACV,IAAI,CAACC,gBAAgB,CAACP,GAAG,CAAC;IAC1B,MAAMQ,GAAG,GAAGR,GAAG,CAACS,WAAW,CAACC,WAAW,CAAC,CAAC;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AEmB;IAAM,CAAC,GAAG,IAAI,CAACjD,KAAK;IAC5C,MAAMwB,IAAI,GAAG9B,WAAW,CAAC,IAAI,CAACiB,IAAI,EAAE,IAAI,CAACX,KAAK,CAACwB,IAAI,CAAC;IACpD,MAAMd,EAAE,GAAG,IAAI,CAACC,IAAI,CAACV,UAAU,CAACiD,UAAU,CACxC1B,IAAI,EACJwB,OAAO,EACPlB,KAAK,EACLzC,iBAAiB,CAACI,OAAO,CAACwD,KAAK,CAAC,CAClC,CAAC;IACD,IAAIvC,EAAE,KAAK,IAAI,EAAE;MACf,MAAM,IAAIgB,KAAK,CAAC,oDAAoD,CAAC;IACvE;IACA,IAAI,CAACxB,cAAc,CAACJ,GAAG,EAAEY,EAAE,CAAC;EAC9B;AACF"}
1
+ {"version":3,"names":["Path1DEffectStyle","JsiDeclarationNode","NodeType","enumKey","processPath","composeDeclarations","PathEffectDeclaration","constructor","ctx","type","props","composeAndPush","pe1","save","decorateChildren","pe2","pathEffects","popAllAsOne","restore","pe","Skia","PathEffect","MakeCompose","push","DiscretePathEffectNode","DiscretePathEffect","decorate","length","deviation","seed","MakeDiscrete","Path2DPathEffectNode","Path2DPathEffect","matrix","path","MakePath2D","Error","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","pes","popAll","MakeSum","bind","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D"],"sources":["PathEffects.ts"],"sourcesContent":["import { Path1DEffectStyle } from \"../../../skia/types\";\nimport type { SkPathEffect } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../types\";\nimport { NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport { processPath } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nabstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect) {\n ctx.save();\n this.decorateChildren(ctx);\n const pe2 = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n const pe = pe2 ? this.Skia.PathEffect.MakeCompose(pe1, pe2) : pe1;\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {\n constructor(ctx: NodeContext, props: DiscretePathEffectProps) {\n super(ctx, NodeType.DiscretePathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { length, deviation, seed } = this.props;\n const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path2DPathEffectProps) {\n super(ctx, NodeType.Path2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffectNode: invalid path\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {\n constructor(ctx: NodeContext, props: DashPathEffectProps) {\n super(ctx, NodeType.DashPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { intervals, phase } = this.props;\n const pe = this.Skia.PathEffect.MakeDash(intervals, phase);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {\n constructor(ctx: NodeContext, props: CornerPathEffectProps) {\n super(ctx, NodeType.CornerPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { r } = this.props;\n const pe = this.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffectNode: couldn't create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class SumPathEffectNode extends PathEffectDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SumPathEffect, null);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const pes = ctx.pathEffects.popAll();\n const pe = composeDeclarations(\n pes,\n this.Skia.PathEffect.MakeSum.bind(this.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Line2DPathEffectProps) {\n super(ctx, NodeType.Line2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { width, matrix } = this.props;\n const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path1DPathEffectProps) {\n super(ctx, NodeType.Path1DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { advance, phase, style } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAGvD,SAASC,kBAAkB,QAAQ,SAAS;AAS5C,SAASC,QAAQ,QAAQ,aAAa;AAC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,UAAU,CAACkC,UAAU,CAACD,KAAK,EAAErB,MAAM,CAAC;IACzD,IAAId,EAAE,KAAK,IAAI,EAAE;MACf,MAAM,IAAIiB,KAAK,CAAC,oDAAoD,CAAC;IACvE;IACA,IAAI,CAACzB,cAAc,CAACH,GAAG,EAAEW,EAAE,CAAC;EAC9B;AACF;AAEA,OAAO,MAAMqC,oBAAoB,SAASlD,qBAAqB,CAAwB;EACrFC,WAAWA,CAACC,GAAgB,EAAEE,KAA4B,EAAE;IAC1D,KAAK,CAACF,GAAG,EAAEN,QAAQ,CAACuD,gBAAgB,EAAE/C,KAAK,CAAC;EAC9C;EAEAgB,QAAQA,CAAClB,GAAuB,EAAE;IAChC,MAAM;MAAEkD,OAAO;MAAElB,KAAK;MAAEmB;IAAM,CAAC,GAAG,IAAI,CAACjD,KAAK;IAC5C,MAAMwB,IAAI,GAAG9B,WAAW,CAAC,IAAI,CAACgB,IAAI,EAAE,IAAI,CAACV,KAAK,CAACwB,IAAI,CAAC;IACpD,MAAMf,EAAE,GAAG,IAAI,CAACC,IAAI,CAACC,UAAU,CAACuC,UAAU,CACxC1B,IAAI,EACJwB,OAAO,EACPlB,KAAK,EACLxC,iBAAiB,CAACG,OAAO,CAACwD,KAAK,CAAC,CAClC,CAAC;IACD,IAAIxC,EAAE,KAAK,IAAI,EAAE;MACf,MAAM,IAAIiB,KAAK,CAAC,oDAAoD,CAAC;IACvE;IACA,IAAI,CAACzB,cAAc,CAACH,GAAG,EAAEW,EAAE,CAAC;EAC9B;AACF"}
@@ -1,10 +1,10 @@
1
1
  import { processUniforms, FilterMode, MipmapMode, TileMode } from "../../../skia/types";
2
2
  import { JsiDeclarationNode } from "../Node";
3
- import { DeclarationType, NodeType } from "../../types";
3
+ import { NodeType } from "../../types";
4
4
  import { enumKey, fitRects, getRect, processGradientProps, processTransformProps, rect2rect } from "../datatypes";
5
5
  export class ShaderDeclaration extends JsiDeclarationNode {
6
6
  constructor(ctx, type, props) {
7
- super(ctx, DeclarationType.Shader, type, props);
7
+ super(ctx, type, props);
8
8
  }
9
9
  }
10
10
  export class ShaderNode extends ShaderDeclaration {