@shopify/react-native-skia 0.1.143 → 0.1.145

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/cpp/api/JsiSkPaint.h +6 -0
  2. package/lib/commonjs/renderer/Canvas.js +17 -7
  3. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  4. package/lib/commonjs/renderer/DependencyManager.js +144 -36
  5. package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
  6. package/lib/commonjs/renderer/HostConfig.js +1 -1
  7. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  8. package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  9. package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
  10. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  11. package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
  12. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  13. package/lib/commonjs/renderer/nodes/Node.js +9 -7
  14. package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
  15. package/lib/commonjs/renderer/processors/Animations/Animations.js +3 -22
  16. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  17. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  18. package/lib/commonjs/skia/web/Host.js.map +1 -1
  19. package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
  20. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  21. package/lib/module/renderer/Canvas.js +17 -6
  22. package/lib/module/renderer/Canvas.js.map +1 -1
  23. package/lib/module/renderer/DependencyManager.js +140 -33
  24. package/lib/module/renderer/DependencyManager.js.map +1 -1
  25. package/lib/module/renderer/HostConfig.js +1 -1
  26. package/lib/module/renderer/HostConfig.js.map +1 -1
  27. package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  28. package/lib/module/renderer/nodes/Declaration.js +3 -4
  29. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  30. package/lib/module/renderer/nodes/Drawing.js +3 -6
  31. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  32. package/lib/module/renderer/nodes/Node.js +9 -7
  33. package/lib/module/renderer/nodes/Node.js.map +1 -1
  34. package/lib/module/renderer/processors/Animations/Animations.js +1 -16
  35. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  36. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  37. package/lib/module/skia/web/Host.js.map +1 -1
  38. package/lib/module/skia/web/JsiSkPaint.js +4 -0
  39. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  40. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  41. package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
  42. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
  43. package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
  44. package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
  45. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +0 -1
  46. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
  47. package/lib/typescript/src/skia/web/Host.d.ts +1 -1
  48. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  49. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  50. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  51. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  52. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  53. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  54. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  55. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  56. package/package.json +1 -1
  57. package/src/renderer/Canvas.tsx +19 -7
  58. package/src/renderer/DependencyManager.tsx +170 -39
  59. package/src/renderer/HostConfig.ts +1 -1
  60. package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
  61. package/src/renderer/nodes/Declaration.tsx +6 -8
  62. package/src/renderer/nodes/Drawing.tsx +5 -7
  63. package/src/renderer/nodes/Node.ts +11 -9
  64. package/src/renderer/processors/Animations/Animations.ts +2 -15
  65. package/src/skia/types/Paint/Paint.ts +6 -0
  66. package/src/skia/web/Host.ts +1 -1
  67. package/src/skia/web/JsiSkPaint.ts +4 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["BackdropFilter.tsx"],"names":["React","createDrawing","getInput","Group","disableFilterMemoization","children","forEach","child","memoizable","onDraw","ctx","_","node","toFilter","visit","filter","Skia","Error","canvas","saveLayer","undefined","restore","BackdropFilter","filterChild","groupChildren","props"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,QAA8B,aAA9B;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAEA,SAASC,KAAT,QAAsB,UAAtB;;AAEA,MAAMC,wBAAwB,GAAIC,QAAD,IAA+B;AAC9DA,EAAAA,QAAQ,CAACC,OAAT,CAAkBC,KAAD,IAAW;AAC1BA,IAAAA,KAAK,CAACC,UAAN,GAAmB,KAAnB;AACAJ,IAAAA,wBAAwB,CAACG,KAAK,CAACF,QAAP,CAAxB;AACD,GAHD;AAID,CALD;;AAWA,MAAMI,MAAM,GAAGR,aAAa,CAAsB,CAACS,GAAD,EAAMC,CAAN,EAASC,IAAT,KAAkB;AAClER,EAAAA,wBAAwB,CAACQ,IAAI,CAACP,QAAN,CAAxB;AACA,QAAMQ,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAWJ,GAAX,CAAjB;AACA,QAAMK,MAAM,GAAGb,QAAQ,CAACQ,GAAG,CAACM,IAAL,EAAWH,QAAX,CAAvB;;AACA,MAAI,CAACE,MAAL,EAAa;AACX,UAAM,IAAIE,KAAJ,CAAU,4CAAV,CAAN;AACD;;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAaR,GAAnB;AACAQ,EAAAA,MAAM,CAACC,SAAP,CAAiBC,SAAjB,EAA4B,IAA5B,EAAkCL,MAAlC;AACAG,EAAAA,MAAM,CAACG,OAAP;AACD,CAV2B,CAA5B;AAYA,OAAO,MAAMC,cAAc,GAAG,QAIY;AAAA,MAJX;AAC7BP,IAAAA,MAAM,EAAEQ,WADqB;AAE7BlB,IAAAA,QAAQ,EAAEmB,aAFmB;AAG7B,OAAGC;AAH0B,GAIW;AACxC,sBACE,oBAAC,KAAD,EAAWA,KAAX,eACE;AAAW,IAAA,MAAM,EAAEhB,MAAnB;AAA2B,IAAA,cAAc;AAAzC,KACGc,WADH,CADF,EAIGC,aAJH,CADF;AAQD,CAbM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport type { AnimatedProps } from \"../../processors\";\nimport { createDrawing } from \"../../nodes\";\nimport type { Node } from \"../../nodes\";\nimport { getInput } from \"../imageFilters/getInput\";\nimport type { GroupProps } from \"../Group\";\nimport { Group } from \"../Group\";\n\nconst disableFilterMemoization = (children: Node<unknown>[]) => {\n children.forEach((child) => {\n child.memoizable = false;\n disableFilterMemoization(child.children);\n });\n};\n\nexport interface BackdropFilterProps extends GroupProps {\n filter: ReactNode | ReactNode[];\n}\n\nconst onDraw = createDrawing<BackdropFilterProps>((ctx, _, node) => {\n disableFilterMemoization(node.children);\n const toFilter = node.visit(ctx);\n const filter = getInput(ctx.Skia, toFilter);\n if (!filter) {\n throw new Error(\"No image filter provided to the background\");\n }\n const { canvas } = ctx;\n canvas.saveLayer(undefined, null, filter);\n canvas.restore();\n});\n\nexport const BackdropFilter = ({\n filter: filterChild,\n children: groupChildren,\n ...props\n}: AnimatedProps<BackdropFilterProps>) => {\n return (\n <Group {...props}>\n <skDrawing onDraw={onDraw} skipProcessing>\n {filterChild}\n </skDrawing>\n {groupChildren}\n </Group>\n );\n};\n"]}
1
+ {"version":3,"sources":["BackdropFilter.tsx"],"names":["React","createDrawing","getInput","Group","disableFilterMemoization","children","forEach","child","memoizable","onDraw","ctx","_","node","toFilter","visit","filter","Skia","Error","canvas","saveLayer","undefined","restore","BackdropFilter","filterChild","groupChildren","props"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,aAAT,QAA8B,aAA9B;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAEA,SAASC,KAAT,QAAsB,UAAtB;;AAEA,MAAMC,wBAAwB,GAAIC,QAAD,IAAsB;AACrDA,EAAAA,QAAQ,CAACC,OAAT,CAAkBC,KAAD,IAAW;AAC1BA,IAAAA,KAAK,CAACC,UAAN,GAAmB,KAAnB;AACAJ,IAAAA,wBAAwB,CAACG,KAAK,CAACF,QAAP,CAAxB;AACD,GAHD;AAID,CALD;;AAWA,MAAMI,MAAM,GAAGR,aAAa,CAAsB,CAACS,GAAD,EAAMC,CAAN,EAASC,IAAT,KAAkB;AAClER,EAAAA,wBAAwB,CAACQ,IAAI,CAACP,QAAN,CAAxB;AACA,QAAMQ,QAAQ,GAAGD,IAAI,CAACE,KAAL,CAAWJ,GAAX,CAAjB;AACA,QAAMK,MAAM,GAAGb,QAAQ,CAACQ,GAAG,CAACM,IAAL,EAAWH,QAAX,CAAvB;;AACA,MAAI,CAACE,MAAL,EAAa;AACX,UAAM,IAAIE,KAAJ,CAAU,4CAAV,CAAN;AACD;;AACD,QAAM;AAAEC,IAAAA;AAAF,MAAaR,GAAnB;AACAQ,EAAAA,MAAM,CAACC,SAAP,CAAiBC,SAAjB,EAA4B,IAA5B,EAAkCL,MAAlC;AACAG,EAAAA,MAAM,CAACG,OAAP;AACD,CAV2B,CAA5B;AAYA,OAAO,MAAMC,cAAc,GAAG,QAIY;AAAA,MAJX;AAC7BP,IAAAA,MAAM,EAAEQ,WADqB;AAE7BlB,IAAAA,QAAQ,EAAEmB,aAFmB;AAG7B,OAAGC;AAH0B,GAIW;AACxC,sBACE,oBAAC,KAAD,EAAWA,KAAX,eACE;AAAW,IAAA,MAAM,EAAEhB,MAAnB;AAA2B,IAAA,cAAc;AAAzC,KACGc,WADH,CADF,EAIGC,aAJH,CADF;AAQD,CAbM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport type { AnimatedProps } from \"../../processors\";\nimport { createDrawing } from \"../../nodes\";\nimport type { Node } from \"../../nodes\";\nimport { getInput } from \"../imageFilters/getInput\";\nimport type { GroupProps } from \"../Group\";\nimport { Group } from \"../Group\";\n\nconst disableFilterMemoization = (children: Node[]) => {\n children.forEach((child) => {\n child.memoizable = false;\n disableFilterMemoization(child.children);\n });\n};\n\nexport interface BackdropFilterProps extends GroupProps {\n filter: ReactNode | ReactNode[];\n}\n\nconst onDraw = createDrawing<BackdropFilterProps>((ctx, _, node) => {\n disableFilterMemoization(node.children);\n const toFilter = node.visit(ctx);\n const filter = getInput(ctx.Skia, toFilter);\n if (!filter) {\n throw new Error(\"No image filter provided to the background\");\n }\n const { canvas } = ctx;\n canvas.saveLayer(undefined, null, filter);\n canvas.restore();\n});\n\nexport const BackdropFilter = ({\n filter: filterChild,\n children: groupChildren,\n ...props\n}: AnimatedProps<BackdropFilterProps>) => {\n return (\n <Group {...props}>\n <skDrawing onDraw={onDraw} skipProcessing>\n {filterChild}\n </skDrawing>\n {groupChildren}\n </Group>\n );\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
3
  import { useCallback } from "react";
4
- import { isAnimated, materialize } from "../processors";
4
+ import { isAnimated } from "../processors";
5
5
  import { Node } from "./Node";
6
6
  export const createDeclaration = cb => cb;
7
7
  export const useDeclaration = (cb, deps) => // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -23,13 +23,12 @@ export class DeclarationNode extends Node {
23
23
  }
24
24
 
25
25
  get props() {
26
- return this._props;
26
+ return this.resolvedProps;
27
27
  }
28
28
 
29
29
  draw(ctx) {
30
30
  const children = this.visit(ctx);
31
- const props = materialize(this.props);
32
- const obj = this.onDeclare(props, children, ctx);
31
+ const obj = this.onDeclare(this.props, children, ctx);
33
32
  return obj;
34
33
  }
35
34
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Declaration.tsx"],"names":["useCallback","isAnimated","materialize","Node","createDeclaration","cb","useDeclaration","deps","isDeclarationNode","node","DeclarationNode","constructor","depMgr","onDeclare","props","memoizable","_props","draw","ctx","children","visit","obj"],"mappings":";;AACA,SAASA,WAAT,QAA4B,OAA5B;AAIA,SAASC,UAAT,EAAqBC,WAArB,QAAwC,eAAxC;AAIA,SAASC,IAAT,QAAqB,QAArB;AAUA,OAAO,MAAMC,iBAAiB,GAC5BC,EAD+B,IAEJA,EAFtB;AAIP,OAAO,MAAMC,cAAc,GAAG,CAC5BD,EAD4B,EAE5BE,IAF4B,KAI5B;AACAP,WAAW,CAACK,EAAD,EAAKE,IAAL,aAAKA,IAAL,cAAKA,IAAL,GAAa,EAAb,CALN;AAOP,OAAO,MAAMC,iBAAiB,GAC5BC,IAD+B,IAEMA,IAAI,YAAYC,eAFhD;AAQP,OAAO,MAAMA,eAAN,SAAiCP,IAAjC,CAAyC;AAG9CQ,EAAAA,WAAW,CACTC,MADS,EAETC,SAFS,EAGTC,KAHS,EAIT;AACA,UAAMF,MAAN,EAAcE,KAAd;;AADA;;AAEA,UAAMC,UAAN,GAAmB,CAACd,UAAU,CAACa,KAAD,CAA9B;AACA,SAAKD,SAAL,GAAiBA,SAAjB;AACD;;AAEQ,MAALC,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKC,UAAL,GAAkB,CAACd,UAAU,CAACa,KAAD,CAA7B;AACA,UAAMA,KAAN,GAAcA,KAAd;AACD;;AAEQ,MAALA,KAAK,GAAG;AACV,WAAO,KAAKE,MAAZ;AACD;;AAEDC,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,UAAMC,QAAQ,GAAG,KAAKC,KAAL,CAAWF,GAAX,CAAjB;AACA,UAAMJ,KAAK,GAAGZ,WAAW,CAAC,KAAKY,KAAN,CAAzB;AACA,UAAMO,GAAG,GAAG,KAAKR,SAAL,CAAeC,KAAf,EAAsBK,QAAtB,EAAgCD,GAAhC,CAAZ;AACA,WAAOG,GAAP;AACD;;AA3B6C","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\nimport { isAnimated, materialize } from \"../processors\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { SkJSIInstance } from \"../../skia/types\";\n\nimport { Node } from \"./Node\";\n\nexport type DeclarationResult = SkJSIInstance<string> | null;\n\ntype DeclarationCallback<T> = (\n props: T,\n children: DeclarationResult[],\n ctx: DrawingContext\n) => DeclarationResult;\n\nexport const createDeclaration = <T,>(\n cb: DeclarationCallback<T>\n): DeclarationCallback<T> => cb;\n\nexport const useDeclaration = <P,>(\n cb: DeclarationCallback<P>,\n deps?: DependencyList\n) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport const isDeclarationNode = (\n node: Node\n): node is DeclarationNode<unknown> => node instanceof DeclarationNode;\n\nexport interface DeclarationProps<P> {\n onDeclare: DeclarationCallback<P>;\n}\n\nexport class DeclarationNode<P> extends Node<P> {\n private onDeclare: DeclarationCallback<P>;\n\n constructor(\n depMgr: DependencyManager,\n onDeclare: DeclarationCallback<P>,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n super.memoizable = !isAnimated(props);\n this.onDeclare = onDeclare;\n }\n\n set props(props: AnimatedProps<P>) {\n this.memoizable = !isAnimated(props);\n super.props = props;\n }\n\n get props() {\n return this._props;\n }\n\n draw(ctx: DrawingContext) {\n const children = this.visit(ctx);\n const props = materialize(this.props);\n const obj = this.onDeclare(props, children, ctx);\n return obj;\n }\n}\n"]}
1
+ {"version":3,"sources":["Declaration.tsx"],"names":["useCallback","isAnimated","Node","createDeclaration","cb","useDeclaration","deps","isDeclarationNode","node","DeclarationNode","constructor","depMgr","onDeclare","props","memoizable","resolvedProps","draw","ctx","children","visit","obj"],"mappings":";;AACA,SAASA,WAAT,QAA4B,OAA5B;AAIA,SAASC,UAAT,QAA2B,eAA3B;AAIA,SAASC,IAAT,QAAqB,QAArB;AAUA,OAAO,MAAMC,iBAAiB,GAC5BC,EAD+B,IAEJA,EAFtB;AAIP,OAAO,MAAMC,cAAc,GAAG,CAC5BD,EAD4B,EAE5BE,IAF4B,KAI5B;AACAN,WAAW,CAACI,EAAD,EAAKE,IAAL,aAAKA,IAAL,cAAKA,IAAL,GAAa,EAAb,CALN;AAOP,OAAO,MAAMC,iBAAiB,GAAQC,IAAL,IAC/BA,IAAI,YAAYC,eADX;AAOP,OAAO,MAAMA,eAAN,SAAiCP,IAAjC,CAAyC;AAG9CQ,EAAAA,WAAW,CACTC,MADS,EAETC,SAFS,EAGTC,KAHS,EAIT;AACA,UAAMF,MAAN,EAAcE,KAAd;;AADA;;AAEA,UAAMC,UAAN,GAAmB,CAACb,UAAU,CAACY,KAAD,CAA9B;AACA,SAAKD,SAAL,GAAiBA,SAAjB;AACD;;AAEQ,MAALC,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKC,UAAL,GAAkB,CAACb,UAAU,CAACY,KAAD,CAA7B;AACA,UAAMA,KAAN,GAAcA,KAAd;AACD;;AAEQ,MAALA,KAAK,GAAM;AACb,WAAO,KAAKE,aAAZ;AACD;;AAEDC,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,UAAMC,QAAQ,GAAG,KAAKC,KAAL,CAAWF,GAAX,CAAjB;AACA,UAAMG,GAAG,GAAG,KAAKR,SAAL,CAAe,KAAKC,KAApB,EAA2BK,QAA3B,EAAqCD,GAArC,CAAZ;AACA,WAAOG,GAAP;AACD;;AA1B6C","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\nimport { isAnimated } from \"../processors\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { SkJSIInstance } from \"../../skia/types\";\n\nimport { Node } from \"./Node\";\n\nexport type DeclarationResult = SkJSIInstance<string> | null;\n\ntype DeclarationCallback<T> = (\n props: T,\n children: DeclarationResult[],\n ctx: DrawingContext\n) => DeclarationResult;\n\nexport const createDeclaration = <T,>(\n cb: DeclarationCallback<T>\n): DeclarationCallback<T> => cb;\n\nexport const useDeclaration = <P,>(\n cb: DeclarationCallback<P>,\n deps?: DependencyList\n) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport const isDeclarationNode = <P,>(node: Node): node is DeclarationNode<P> =>\n node instanceof DeclarationNode;\n\nexport interface DeclarationProps<P> {\n onDeclare: DeclarationCallback<P>;\n}\n\nexport class DeclarationNode<P> extends Node<P> {\n private onDeclare: DeclarationCallback<P>;\n\n constructor(\n depMgr: DependencyManager,\n onDeclare: DeclarationCallback<P>,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n super.memoizable = !isAnimated(props);\n this.onDeclare = onDeclare;\n }\n\n set props(props: AnimatedProps<P>) {\n this.memoizable = !isAnimated(props);\n super.props = props;\n }\n\n get props(): P {\n return this.resolvedProps;\n }\n\n draw(ctx: DrawingContext) {\n const children = this.visit(ctx);\n const obj = this.onDeclare(this.props, children, ctx);\n return obj;\n }\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
3
  import { useCallback } from "react";
4
- import { materialize } from "../processors/Animations/Animations";
5
4
  import { isPaint } from "../../skia/types";
6
5
  import { processPaint } from "../processors";
7
6
  import { Node } from "./Node";
@@ -21,17 +20,15 @@ export class DrawingNode extends Node {
21
20
  }
22
21
 
23
22
  draw(ctx) {
24
- const drawingProps = materialize(this.props);
25
-
26
23
  if (this.skipProcessing) {
27
- this.onDraw(ctx, drawingProps, this);
24
+ this.onDraw(ctx, this.props, this);
28
25
  } else {
29
26
  const declarations = this.visit(ctx);
30
- const paint = processPaint(ctx.Skia, ctx.paint.copy(), ctx.opacity, drawingProps, declarations);
27
+ const paint = processPaint(ctx.Skia, ctx.paint.copy(), ctx.opacity, this.props, declarations);
31
28
  [paint, ...declarations.filter(isPaint)].forEach(currentPaint => {
32
29
  this.onDraw({ ...ctx,
33
30
  paint: currentPaint
34
- }, drawingProps, this);
31
+ }, this.props, this);
35
32
  });
36
33
  }
37
34
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["Drawing.tsx"],"names":["useCallback","materialize","isPaint","processPaint","Node","createDrawing","cb","useDrawing","deps","DrawingNode","constructor","depMgr","onDraw","skipProcessing","props","draw","ctx","drawingProps","declarations","visit","paint","Skia","copy","opacity","filter","forEach","currentPaint"],"mappings":";;AACA,SAASA,WAAT,QAA4B,OAA5B;AAIA,SAASC,WAAT,QAA4B,qCAA5B;AACA,SAASC,OAAT,QAAwB,kBAAxB;AAEA,SAASC,YAAT,QAA6B,eAA7B;AAEA,SAASC,IAAT,QAAqB,QAArB;AAUA,OAAO,MAAMC,aAAa,GAAQC,EAAL,IAC3BA,EADK;AAGP,OAAO,MAAMC,UAAU,GAAG,CAAKD,EAAL,EAA4BE,IAA5B,KACxB;AACAR,WAAW,CAACM,EAAD,EAAKE,IAAL,aAAKA,IAAL,cAAKA,IAAL,GAAa,EAAb,CAFN;AAUP,OAAO,MAAMC,WAAN,SAA6BL,IAA7B,CAAqC;AAI1CM,EAAAA,WAAW,CACTC,MADS,EAETC,MAFS,EAGTC,cAHS,EAITC,KAJS,EAKT;AACA,UAAMH,MAAN,EAAcG,KAAd;;AADA;;AAAA;;AAEA,SAAKF,MAAL,GAAcA,MAAd;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACD;;AAEDE,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,UAAMC,YAAY,GAAGhB,WAAW,CAAC,KAAKa,KAAN,CAAhC;;AACA,QAAI,KAAKD,cAAT,EAAyB;AACvB,WAAKD,MAAL,CAAYI,GAAZ,EAAiBC,YAAjB,EAA+B,IAA/B;AACD,KAFD,MAEO;AACL,YAAMC,YAAY,GAAG,KAAKC,KAAL,CAAWH,GAAX,CAArB;AACA,YAAMI,KAAK,GAAGjB,YAAY,CACxBa,GAAG,CAACK,IADoB,EAExBL,GAAG,CAACI,KAAJ,CAAUE,IAAV,EAFwB,EAGxBN,GAAG,CAACO,OAHoB,EAIxBN,YAJwB,EAKxBC,YALwB,CAA1B;AAOA,OAACE,KAAD,EAAQ,GAAGF,YAAY,CAACM,MAAb,CAAoBtB,OAApB,CAAX,EAAyCuB,OAAzC,CAAkDC,YAAD,IAAkB;AACjE,aAAKd,MAAL,CAAY,EAAE,GAAGI,GAAL;AAAUI,UAAAA,KAAK,EAAEM;AAAjB,SAAZ,EAA6CT,YAA7C,EAA2D,IAA3D;AACD,OAFD;AAGD;AACF;;AAhCyC","sourcesContent":["import type { DependencyList, ReactNode } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors/Animations/Animations\";\nimport { materialize } from \"../processors/Animations/Animations\";\nimport { isPaint } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport { processPaint } from \"../processors\";\n\nimport { Node } from \"./Node\";\n\ntype DrawingCallback<P> = (\n ctx: DrawingContext,\n props: P,\n node: Node<P>\n) => void;\n\ntype OnDrawCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;\n\nexport const createDrawing = <P,>(cb: OnDrawCallback<P>): DrawingCallback<P> =>\n cb;\n\nexport const useDrawing = <P,>(cb: OnDrawCallback<P>, deps?: DependencyList) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport type DrawingProps<T> = {\n onDraw: DrawingCallback<T>;\n skipProcessing?: boolean;\n children?: ReactNode | ReactNode[];\n};\n\nexport class DrawingNode<P> extends Node<P> {\n onDraw: DrawingCallback<P>;\n skipProcessing: boolean;\n\n constructor(\n depMgr: DependencyManager,\n onDraw: DrawingCallback<P>,\n skipProcessing: boolean,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n this.onDraw = onDraw;\n this.skipProcessing = skipProcessing;\n }\n\n draw(ctx: DrawingContext) {\n const drawingProps = materialize(this.props);\n if (this.skipProcessing) {\n this.onDraw(ctx, drawingProps, this);\n } else {\n const declarations = this.visit(ctx);\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n ctx.opacity,\n drawingProps,\n declarations\n );\n [paint, ...declarations.filter(isPaint)].forEach((currentPaint) => {\n this.onDraw({ ...ctx, paint: currentPaint }, drawingProps, this);\n });\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["Drawing.tsx"],"names":["useCallback","isPaint","processPaint","Node","createDrawing","cb","useDrawing","deps","DrawingNode","constructor","depMgr","onDraw","skipProcessing","props","draw","ctx","declarations","visit","paint","Skia","copy","opacity","filter","forEach","currentPaint"],"mappings":";;AACA,SAASA,WAAT,QAA4B,OAA5B;AAIA,SAASC,OAAT,QAAwB,kBAAxB;AAEA,SAASC,YAAT,QAA6B,eAA7B;AAEA,SAASC,IAAT,QAAqB,QAArB;AAUA,OAAO,MAAMC,aAAa,GAAQC,EAAL,IAC3BA,EADK;AAGP,OAAO,MAAMC,UAAU,GAAG,CAAKD,EAAL,EAA4BE,IAA5B,KACxB;AACAP,WAAW,CAACK,EAAD,EAAKE,IAAL,aAAKA,IAAL,cAAKA,IAAL,GAAa,EAAb,CAFN;AAUP,OAAO,MAAMC,WAAN,SAA6BL,IAA7B,CAAqC;AAI1CM,EAAAA,WAAW,CACTC,MADS,EAETC,MAFS,EAGTC,cAHS,EAITC,KAJS,EAKT;AACA,UAAMH,MAAN,EAAcG,KAAd;;AADA;;AAAA;;AAEA,SAAKF,MAAL,GAAcA,MAAd;AACA,SAAKC,cAAL,GAAsBA,cAAtB;AACD;;AAEDE,EAAAA,IAAI,CAACC,GAAD,EAAsB;AACxB,QAAI,KAAKH,cAAT,EAAyB;AACvB,WAAKD,MAAL,CAAYI,GAAZ,EAAiB,KAAKF,KAAtB,EAA6B,IAA7B;AACD,KAFD,MAEO;AACL,YAAMG,YAAY,GAAG,KAAKC,KAAL,CAAWF,GAAX,CAArB;AACA,YAAMG,KAAK,GAAGhB,YAAY,CACxBa,GAAG,CAACI,IADoB,EAExBJ,GAAG,CAACG,KAAJ,CAAUE,IAAV,EAFwB,EAGxBL,GAAG,CAACM,OAHoB,EAIxB,KAAKR,KAJmB,EAKxBG,YALwB,CAA1B;AAOA,OAACE,KAAD,EAAQ,GAAGF,YAAY,CAACM,MAAb,CAAoBrB,OAApB,CAAX,EAAyCsB,OAAzC,CAAkDC,YAAD,IAAkB;AACjE,aAAKb,MAAL,CAAY,EAAE,GAAGI,GAAL;AAAUG,UAAAA,KAAK,EAAEM;AAAjB,SAAZ,EAA6C,KAAKX,KAAlD,EAAyD,IAAzD;AACD,OAFD;AAGD;AACF;;AA/ByC","sourcesContent":["import type { DependencyList, ReactNode } from \"react\";\nimport { useCallback } from \"react\";\n\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors/Animations/Animations\";\nimport { isPaint } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport { processPaint } from \"../processors\";\n\nimport { Node } from \"./Node\";\n\ntype DrawingCallback<P> = (\n ctx: DrawingContext,\n props: P,\n node: Node<P>\n) => void;\n\ntype OnDrawCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;\n\nexport const createDrawing = <P,>(cb: OnDrawCallback<P>): DrawingCallback<P> =>\n cb;\n\nexport const useDrawing = <P,>(cb: OnDrawCallback<P>, deps?: DependencyList) =>\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useCallback(cb, deps ?? []);\n\nexport type DrawingProps<P> = {\n onDraw: DrawingCallback<P>;\n skipProcessing?: boolean;\n children?: ReactNode | ReactNode[];\n};\n\nexport class DrawingNode<P> extends Node<P> {\n onDraw: DrawingCallback<P>;\n skipProcessing: boolean;\n\n constructor(\n depMgr: DependencyManager,\n onDraw: DrawingCallback<P>,\n skipProcessing: boolean,\n props: AnimatedProps<P>\n ) {\n super(depMgr, props);\n this.onDraw = onDraw;\n this.skipProcessing = skipProcessing;\n }\n\n draw(ctx: DrawingContext) {\n if (this.skipProcessing) {\n this.onDraw(ctx, this.props, this);\n } else {\n const declarations = this.visit(ctx);\n const paint = processPaint(\n ctx.Skia,\n ctx.paint.copy(),\n ctx.opacity,\n this.props,\n declarations\n );\n [paint, ...declarations.filter(isPaint)].forEach((currentPaint) => {\n this.onDraw({ ...ctx, paint: currentPaint }, this.props, this);\n });\n }\n }\n}\n"]}
@@ -8,10 +8,11 @@ export let NodeType;
8
8
  })(NodeType || (NodeType = {}));
9
9
 
10
10
  export class Node {
11
+ // This cast is ok because we understand that the dependency manager will setup the initial props
11
12
  constructor(depMgr, props) {
12
13
  _defineProperty(this, "children", []);
13
14
 
14
- _defineProperty(this, "_props", void 0);
15
+ _defineProperty(this, "resolvedProps", {});
15
16
 
16
17
  _defineProperty(this, "memoizable", false);
17
18
 
@@ -21,20 +22,21 @@ export class Node {
21
22
 
22
23
  _defineProperty(this, "depMgr", void 0);
23
24
 
24
- this._props = props;
25
25
  this.depMgr = depMgr;
26
- this.depMgr.unSubscribeNode(this);
26
+ this.updatePropSubscriptions(props);
27
+ }
28
+
29
+ updatePropSubscriptions(props) {
27
30
  this.depMgr.subscribeNode(this, props);
28
31
  }
29
32
 
30
33
  set props(props) {
31
- this.depMgr.unSubscribeNode(this);
32
- this.depMgr.subscribeNode(this, props);
33
- this._props = props;
34
+ this.depMgr.unsubscribeNode(this);
35
+ this.updatePropSubscriptions(props);
34
36
  }
35
37
 
36
38
  get props() {
37
- return this._props;
39
+ return this.resolvedProps;
38
40
  }
39
41
 
40
42
  visit(ctx, children) {
@@ -1 +1 @@
1
- {"version":3,"sources":["Node.ts"],"names":["NodeType","Node","constructor","depMgr","props","_props","unSubscribeNode","subscribeNode","visit","ctx","children","returnedValues","forEach","child","memoized","memoizable","push","ret","draw"],"mappings":";;AAKA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q;AAAAA,EAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,OAAO,MAAeC,IAAf,CAAiC;AAQtCC,EAAAA,WAAW,CAACC,MAAD,EAA4BC,KAA5B,EAAqD;AAAA,sCAPpC,EAOoC;;AAAA;;AAAA,wCALnD,KAKmD;;AAAA,sCAJ3B,IAI2B;;AAAA;;AAAA;;AAC9D,SAAKC,MAAL,GAAcD,KAAd;AACA,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKA,MAAL,CAAYG,eAAZ,CAA4B,IAA5B;AACA,SAAKH,MAAL,CAAYI,aAAZ,CAA0B,IAA1B,EAAgCH,KAAhC;AACD;;AAIQ,MAALA,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKD,MAAL,CAAYG,eAAZ,CAA4B,IAA5B;AACA,SAAKH,MAAL,CAAYI,aAAZ,CAA0B,IAA1B,EAAgCH,KAAhC;AACA,SAAKC,MAAL,GAAcD,KAAd;AACD;;AAEQ,MAALA,KAAK,GAAG;AACV,WAAO,KAAKC,MAAZ;AACD;;AAEDG,EAAAA,KAAK,CAACC,GAAD,EAAsBC,QAAtB,EAAyC;AAC5C,UAAMC,cAAkD,GAAG,EAA3D;AACA,KAACD,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,KAAKA,QAAlB,EAA4BE,OAA5B,CAAqCC,KAAD,IAAW;AAC7C,UAAIA,KAAK,CAACC,QAAN,IAAkBD,KAAK,CAACE,UAA5B,EAAwC;AACtCJ,QAAAA,cAAc,CAACK,IAAf,CAAoBH,KAAK,CAACC,QAA1B;AACD,OAFD,MAEO;AACL,cAAMG,GAAG,GAAGJ,KAAK,CAACK,IAAN,CAAWT,GAAX,CAAZ;;AACA,YAAIQ,GAAJ,EAAS;AACPN,UAAAA,cAAc,CAACK,IAAf,CAAoBC,GAApB;;AACA,cAAIJ,KAAK,CAACE,UAAV,EAAsB;AACpBF,YAAAA,KAAK,CAACC,QAAN,GAAiBG,GAAjB;AACD;AACF;AACF;AACF,KAZD;AAaA,WAAON,cAAP;AACD;;AA3CqC","sourcesContent":["import type { SkJSIInstance } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\n\nexport enum NodeType {\n Declaration = \"skDeclaration\",\n Drawing = \"skDrawing\",\n}\n\ntype DeclarationResult = SkJSIInstance<string> | null;\n\nexport abstract class Node<P = unknown> {\n readonly children: Node[] = [];\n _props: AnimatedProps<P>;\n memoizable = false;\n memoized: DeclarationResult | null = null;\n parent?: Node;\n depMgr: DependencyManager;\n\n constructor(depMgr: DependencyManager, props: AnimatedProps<P>) {\n this._props = props;\n this.depMgr = depMgr;\n this.depMgr.unSubscribeNode(this);\n this.depMgr.subscribeNode(this, props);\n }\n\n abstract draw(ctx: DrawingContext): void | DeclarationResult;\n\n set props(props: AnimatedProps<P>) {\n this.depMgr.unSubscribeNode(this);\n this.depMgr.subscribeNode(this, props);\n this._props = props;\n }\n\n get props() {\n return this._props;\n }\n\n visit(ctx: DrawingContext, children?: Node[]) {\n const returnedValues: Exclude<DeclarationResult, null>[] = [];\n (children ?? this.children).forEach((child) => {\n if (child.memoized && child.memoizable) {\n returnedValues.push(child.memoized);\n } else {\n const ret = child.draw(ctx);\n if (ret) {\n returnedValues.push(ret);\n if (child.memoizable) {\n child.memoized = ret;\n }\n }\n }\n });\n return returnedValues;\n }\n}\n"]}
1
+ {"version":3,"sources":["Node.ts"],"names":["NodeType","Node","constructor","depMgr","props","updatePropSubscriptions","subscribeNode","unsubscribeNode","resolvedProps","visit","ctx","children","returnedValues","forEach","child","memoized","memoizable","push","ret","draw"],"mappings":";;AAKA,WAAYA,QAAZ;;WAAYA,Q;AAAA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D;;AA7CqC","sourcesContent":["import type { SkJSIInstance } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\n\nexport enum NodeType {\n Declaration = \"skDeclaration\",\n Drawing = \"skDrawing\",\n}\n\ntype DeclarationResult = SkJSIInstance<string> | null;\n\nexport abstract class Node<P = unknown> {\n readonly children: Node[] = [];\n // This cast is ok because we understand that the dependency manager will setup the initial props\n resolvedProps: P = {} as P;\n memoizable = false;\n memoized: DeclarationResult | null = null;\n parent?: Node;\n depMgr: DependencyManager;\n\n constructor(depMgr: DependencyManager, props: AnimatedProps<P>) {\n this.depMgr = depMgr;\n this.updatePropSubscriptions(props);\n }\n\n abstract draw(ctx: DrawingContext): void | DeclarationResult;\n\n updatePropSubscriptions(props: AnimatedProps<P>) {\n this.depMgr.subscribeNode(this, props);\n }\n\n set props(props: AnimatedProps<P>) {\n this.depMgr.unsubscribeNode(this);\n this.updatePropSubscriptions(props);\n }\n\n get props(): P {\n return this.resolvedProps;\n }\n\n visit(ctx: DrawingContext, children?: Node[]) {\n const returnedValues: Exclude<DeclarationResult, null>[] = [];\n (children ?? this.children).forEach((child) => {\n if (child.memoized && child.memoizable) {\n returnedValues.push(child.memoized);\n } else {\n const ret = child.draw(ctx);\n if (ret) {\n returnedValues.push(ret);\n if (child.memoizable) {\n child.memoized = ret;\n }\n }\n }\n });\n return returnedValues;\n }\n}\n"]}
@@ -1,4 +1,3 @@
1
- import { mapKeys } from "../../typeddash";
2
1
  export const isValue = value => {
3
2
  if (value === undefined || value === null) {
4
3
  return false;
@@ -21,25 +20,11 @@ export const isSelector = value => {
21
20
  };
22
21
  export const isAnimated = props => {
23
22
  for (const value of Object.values(props)) {
24
- if (isValue(value)) {
23
+ if (isValue(value) || isSelector(value)) {
25
24
  return true;
26
25
  }
27
26
  }
28
27
 
29
28
  return false;
30
- };
31
- export const materialize = props => {
32
- const result = { ...props
33
- };
34
- mapKeys(props).forEach(key => {
35
- const prop = props[key];
36
-
37
- if (isValue(prop)) {
38
- result[key] = prop.current;
39
- } else if (isSelector(prop)) {
40
- result[key] = prop.selector(prop.value.current);
41
- }
42
- });
43
- return result;
44
29
  }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
30
  //# sourceMappingURL=Animations.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Animations.ts"],"names":["mapKeys","isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values","materialize","result","forEach","key","prop","current"],"mappings":"AACA,SAASA,OAAT,QAAwB,iBAAxB;AAEA,OAAO,MAAMC,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;AAgBP,OAAO,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;AAkBP,OAAO,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClB,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM;AASP,OAAO,MAAMS,WAAW,GAAOH,KAAJ,IAAgC;AACzD,QAAMI,MAAM,GAAG,EAAE,GAAGJ;AAAL,GAAf;AACAR,EAAAA,OAAO,CAACQ,KAAD,CAAP,CAAeK,OAAf,CAAwBC,GAAD,IAAS;AAC9B,UAAMC,IAAI,GAAGP,KAAK,CAACM,GAAD,CAAlB;;AACA,QAAIb,OAAO,CAACc,IAAD,CAAX,EAAmB;AACjBH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAeC,IAAD,CAAmCC,OAAjD;AACD,KAFD,MAEO,IAAIX,UAAU,CAACU,IAAD,CAAd,EAAsB;AAC3BH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAcC,IAAI,CAACT,QAAL,CAAcS,IAAI,CAACb,KAAL,CAAWc,OAAzB,CAAd;AACD;AACF,GAPD;AAQA,SAAOJ,MAAP;AACD,CAXM,C,CAaP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\nimport { mapKeys } from \"../../typeddash\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value)) {\n return true;\n }\n }\n return false;\n};\n\nexport const materialize = <T>(props: AnimatedProps<T>) => {\n const result = { ...props };\n mapKeys(props).forEach((key) => {\n const prop = props[key];\n if (isValue(prop)) {\n result[key] = (prop as SkiaValue<T[typeof key]>).current;\n } else if (isSelector(prop)) {\n result[key] = prop.selector(prop.value.current) as T[typeof key];\n }\n });\n return result as T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
1
+ {"version":3,"sources":["Animations.ts"],"names":["isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values"],"mappings":"AAEA,OAAO,MAAMA,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;AAgBP,OAAO,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;AAkBP,OAAO,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAP,IAAkBG,UAAU,CAACH,KAAD,CAAhC,EAAyC;AACvC,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM,C,CASP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value) || isSelector(value)) {\n return true;\n }\n }\n return false;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\n\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":"AAUA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAMZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,OAAO,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { SkMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkColor } from \"../Color\";\nimport type { SkPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Miter,\n Round,\n Bevel,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: SkMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: SkPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
1
+ {"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":"AAUA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAMZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,OAAO,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { SkMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkColor } from \"../Color\";\nimport type { SkPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Miter,\n Round,\n Bevel,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Sets all SkPaint contents to their initial values. This is equivalent to replacing\n SkPaint with the result of SkPaint().\n */\n reset(): void;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: SkMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: SkPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"mappings":";;AAIA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,CAACC,GAAD,EAAe;AACxB,UAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;AACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;AAGzBF,EAAAA,WAAW,CAACG,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;AAQ3B,OAAO,MAAeC,cAAf,SACGF,IADH,CAGP;AAIEF,EAAAA,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH;AAWA,OAAO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;AACgB,SAATK,SAAS,CAAIC,KAAJ,EAAkC;AAChD,WAAQA,KAAD,CAAiCL,GAAxC;AACD;;AAHD;AAMF,OAAO,MAAMM,MAAM,GAAID,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;AAAEH,EAAAA;AAAF,CAH7B","sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n readonly ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
1
+ {"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"mappings":";;AAIA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,CAACC,GAAD,EAAe;AACxB,UAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;AACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;AAGzBF,EAAAA,WAAW,CAACG,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;AAQ3B,OAAO,MAAeC,cAAf,SACGF,IADH,CAGP;AAIEF,EAAAA,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH;AAWA,OAAO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;AACgB,SAATK,SAAS,CAAIC,KAAJ,EAAkC;AAChD,WAAQA,KAAD,CAAiCL,GAAxC;AACD;;AAHD;AAMF,OAAO,MAAMM,MAAM,GAAID,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;AAAEH,EAAAA;AAAF,CAH7B","sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
@@ -13,6 +13,10 @@ export class JsiSkPaint extends HostObject {
13
13
  return new JsiSkPaint(this.CanvasKit, this.ref.copy());
14
14
  }
15
15
 
16
+ reset() {
17
+ this.ref = new this.CanvasKit.Paint();
18
+ }
19
+
16
20
  getColor() {
17
21
  return this.ref.getColor();
18
22
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkPaint.ts"],"names":["HostObject","ckEnum","JsiSkColorFilter","JsiSkImageFilter","JsiSkMaskFilter","JsiSkPathEffect","JsiSkShader","JsiSkPaint","constructor","CanvasKit","ref","copy","getColor","getStrokeCap","value","getStrokeJoin","getStrokeMiter","getStrokeWidth","setAlphaf","alpha","setAntiAlias","aa","setBlendMode","blendMode","setColor","color","setColorFilter","filter","fromValue","setImageFilter","setMaskFilter","setPathEffect","effect","setShader","shader","setStrokeCap","cap","setStrokeJoin","join","setStrokeMiter","limit","setStrokeWidth","width","setStyle","style"],"mappings":"AAgBA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,QAAnC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,gBAAT,QAAiC,oBAAj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AASiC,QAAT,CAAkB;AAAE7B,MAAAA,KAAK,EAAE8B;AAAT,KAAlB;AACD;;AAnF2E","sourcesContent":["import type { CanvasKit, Paint } from \"canvaskit-wasm\";\n\nimport type {\n StrokeJoin,\n BlendMode,\n SkColor,\n SkColorFilter,\n SkImageFilter,\n SkPaint,\n SkShader,\n StrokeCap,\n PaintStyle,\n SkMaskFilter,\n SkPathEffect,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkMaskFilter } from \"./JsiSkMaskFilter\";\nimport { JsiSkPathEffect } from \"./JsiSkPathEffect\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkPaint extends HostObject<Paint, \"Paint\"> implements SkPaint {\n constructor(CanvasKit: CanvasKit, ref: Paint) {\n super(CanvasKit, ref, \"Paint\");\n }\n\n copy() {\n return new JsiSkPaint(this.CanvasKit, this.ref.copy());\n }\n\n getColor() {\n return this.ref.getColor();\n }\n\n getStrokeCap() {\n return this.ref.getStrokeCap().value;\n }\n\n getStrokeJoin() {\n return this.ref.getStrokeJoin().value;\n }\n\n getStrokeMiter() {\n return this.ref.getStrokeMiter();\n }\n\n getStrokeWidth() {\n return this.ref.getStrokeWidth();\n }\n\n setAlphaf(alpha: number) {\n this.ref.setAlphaf(alpha);\n }\n\n setAntiAlias(aa: boolean) {\n this.ref.setAntiAlias(aa);\n }\n\n setBlendMode(blendMode: BlendMode) {\n this.ref.setBlendMode(ckEnum(blendMode));\n }\n\n setColor(color: SkColor) {\n this.ref.setColor(color);\n }\n\n setColorFilter(filter: SkColorFilter | null) {\n this.ref.setColorFilter(filter ? JsiSkColorFilter.fromValue(filter) : null);\n }\n\n setImageFilter(filter: SkImageFilter | null) {\n this.ref.setImageFilter(filter ? JsiSkImageFilter.fromValue(filter) : null);\n }\n\n setMaskFilter(filter: SkMaskFilter | null) {\n this.ref.setMaskFilter(filter ? JsiSkMaskFilter.fromValue(filter) : null);\n }\n\n setPathEffect(effect: SkPathEffect | null) {\n this.ref.setPathEffect(effect ? JsiSkPathEffect.fromValue(effect) : null);\n }\n\n setShader(shader: SkShader | null) {\n this.ref.setShader(shader ? JsiSkShader.fromValue(shader) : null);\n }\n\n setStrokeCap(cap: StrokeCap) {\n this.ref.setStrokeCap(ckEnum(cap));\n }\n\n setStrokeJoin(join: StrokeJoin) {\n this.ref.setStrokeJoin(ckEnum(join));\n }\n\n setStrokeMiter(limit: number) {\n this.ref.setStrokeMiter(limit);\n }\n\n setStrokeWidth(width: number) {\n this.ref.setStrokeWidth(width);\n }\n\n setStyle(style: PaintStyle) {\n this.ref.setStyle({ value: style });\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkPaint.ts"],"names":["HostObject","ckEnum","JsiSkColorFilter","JsiSkImageFilter","JsiSkMaskFilter","JsiSkPathEffect","JsiSkShader","JsiSkPaint","constructor","CanvasKit","ref","copy","reset","Paint","getColor","getStrokeCap","value","getStrokeJoin","getStrokeMiter","getStrokeWidth","setAlphaf","alpha","setAntiAlias","aa","setBlendMode","blendMode","setColor","color","setColorFilter","filter","fromValue","setImageFilter","setMaskFilter","setPathEffect","effect","setShader","shader","setStrokeCap","cap","setStrokeJoin","join","setStrokeMiter","limit","setStrokeWidth","width","setStyle","style"],"mappings":"AAgBA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,QAAnC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,UAAN,SAAyBP,UAAzB,CAAuE;AAC5EQ,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAmC;AAC5C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,OAAtB;AACD;;A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\n SkColorFilter,\n SkImageFilter,\n SkPaint,\n SkShader,\n StrokeCap,\n PaintStyle,\n SkMaskFilter,\n SkPathEffect,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkMaskFilter } from \"./JsiSkMaskFilter\";\nimport { JsiSkPathEffect } from \"./JsiSkPathEffect\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkPaint extends HostObject<Paint, \"Paint\"> implements SkPaint {\n constructor(CanvasKit: CanvasKit, ref: Paint) {\n super(CanvasKit, ref, \"Paint\");\n }\n\n copy() {\n return new JsiSkPaint(this.CanvasKit, this.ref.copy());\n }\n\n reset() {\n this.ref = new this.CanvasKit.Paint();\n }\n\n getColor() {\n return this.ref.getColor();\n }\n\n getStrokeCap() {\n return this.ref.getStrokeCap().value;\n }\n\n getStrokeJoin() {\n return this.ref.getStrokeJoin().value;\n }\n\n getStrokeMiter() {\n return this.ref.getStrokeMiter();\n }\n\n getStrokeWidth() {\n return this.ref.getStrokeWidth();\n }\n\n setAlphaf(alpha: number) {\n this.ref.setAlphaf(alpha);\n }\n\n setAntiAlias(aa: boolean) {\n this.ref.setAntiAlias(aa);\n }\n\n setBlendMode(blendMode: BlendMode) {\n this.ref.setBlendMode(ckEnum(blendMode));\n }\n\n setColor(color: SkColor) {\n this.ref.setColor(color);\n }\n\n setColorFilter(filter: SkColorFilter | null) {\n this.ref.setColorFilter(filter ? JsiSkColorFilter.fromValue(filter) : null);\n }\n\n setImageFilter(filter: SkImageFilter | null) {\n this.ref.setImageFilter(filter ? JsiSkImageFilter.fromValue(filter) : null);\n }\n\n setMaskFilter(filter: SkMaskFilter | null) {\n this.ref.setMaskFilter(filter ? JsiSkMaskFilter.fromValue(filter) : null);\n }\n\n setPathEffect(effect: SkPathEffect | null) {\n this.ref.setPathEffect(effect ? JsiSkPathEffect.fromValue(effect) : null);\n }\n\n setShader(shader: SkShader | null) {\n this.ref.setShader(shader ? JsiSkShader.fromValue(shader) : null);\n }\n\n setStrokeCap(cap: StrokeCap) {\n this.ref.setStrokeCap(ckEnum(cap));\n }\n\n setStrokeJoin(join: StrokeJoin) {\n this.ref.setStrokeJoin(ckEnum(join));\n }\n\n setStrokeMiter(limit: number) {\n this.ref.setStrokeMiter(limit);\n }\n\n setStrokeWidth(width: number) {\n this.ref.setStrokeWidth(width);\n }\n\n setStyle(style: PaintStyle) {\n this.ref.setStyle({ value: style });\n }\n}\n"]}
@@ -11,4 +11,4 @@ export interface CanvasProps extends ComponentProps<typeof SkiaView> {
11
11
  children: ReactNode;
12
12
  onTouch?: TouchHandler;
13
13
  }
14
- export declare const Canvas: React.ForwardRefExoticComponent<Pick<CanvasProps, "children" | "mode" | "debug" | "onDraw" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "onTouch"> & React.RefAttributes<SkiaView>>;
14
+ export declare const Canvas: React.ForwardRefExoticComponent<Pick<CanvasProps, "mode" | "debug" | "onDraw" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "onTouch"> & React.RefAttributes<SkiaView>>;
@@ -1,21 +1,47 @@
1
- import type { RefObject } from "react";
2
- import type { SkiaView } from "../views";
3
1
  import type { SkiaValue } from "../values";
4
2
  import type { Node } from "./nodes";
3
+ import type { AnimatedProps } from "./processors";
5
4
  declare type Unsubscribe = () => void;
6
- declare type Props = {
7
- [key: string]: unknown;
5
+ declare type Mutator = (value: unknown) => void;
6
+ declare type SubscriptionState = {
7
+ nodes: Map<Node, Mutator[]>;
8
+ unsubscribe: null | Unsubscribe;
8
9
  };
9
10
  export declare class DependencyManager {
10
- ref: RefObject<SkiaView>;
11
- subscriptions: Map<Node, {
12
- values: SkiaValue<unknown>[];
13
- unsubscribe: null | Unsubscribe;
14
- }>;
15
- constructor(ref: RefObject<SkiaView>);
16
- unSubscribeNode(node: Node): void;
17
- subscribeNode(node: Node, props: Props): void;
18
- subscribe(): void;
19
- unsubscribe(): void;
11
+ registerValues: (values: Array<SkiaValue<unknown>>) => () => void;
12
+ subscriptions: Map<SkiaValue<unknown>, SubscriptionState>;
13
+ unregisterDependantValues: null | Unsubscribe;
14
+ constructor(registerValues: (values: Array<SkiaValue<unknown>>) => () => void);
15
+ /**
16
+ * Call to unsubscribe all value listeners from the given node based
17
+ * on the current list of subscriptions for the node. This function
18
+ * is typically called when the node is unmounted or when one or more
19
+ * properties have changed.
20
+ * @param node Node to unsubscribe value listeners from
21
+ */
22
+ unsubscribeNode(node: Node): void;
23
+ /**
24
+ * Adds listeners to the provided values so that the node is notified
25
+ * when a value changes. This is done in an optimized way so that this
26
+ * class only needs to listen to the value once and then forwards the
27
+ * change to the node and its listener. This method is typically called
28
+ * when the node is mounted and when one or more props on the node changes.
29
+ * @param node Node to subscribe to value changes for
30
+ * @param props Node's properties
31
+ * @param onResolveProp Callback when a property value changes
32
+ */
33
+ subscribeNode<P extends Record<string, unknown>>(node: Node, props: AnimatedProps<P>): void;
34
+ /**
35
+ * Called when the hosting container is mounted or updated. This ensures that we have
36
+ * a ref to the underlying SkiaView so that we can registers redraw listeners
37
+ * on values used in the current View automatically.
38
+ */
39
+ update(): void;
40
+ /**
41
+ * Called when the hosting container is unmounted or recreated. This ensures that we remove
42
+ * all subscriptions to Skia values so that we don't have any listeners left after
43
+ * the component is removed.
44
+ */
45
+ remove(): void;
20
46
  }
21
47
  export {};
@@ -8,7 +8,7 @@ export declare type DeclarationResult = SkJSIInstance<string> | null;
8
8
  declare type DeclarationCallback<T> = (props: T, children: DeclarationResult[], ctx: DrawingContext) => DeclarationResult;
9
9
  export declare const createDeclaration: <T>(cb: DeclarationCallback<T>) => DeclarationCallback<T>;
10
10
  export declare const useDeclaration: <P>(cb: DeclarationCallback<P>, deps?: DependencyList | undefined) => DeclarationCallback<P>;
11
- export declare const isDeclarationNode: (node: Node) => node is DeclarationNode<unknown>;
11
+ export declare const isDeclarationNode: <P>(node: Node) => node is DeclarationNode<P>;
12
12
  export interface DeclarationProps<P> {
13
13
  onDeclare: DeclarationCallback<P>;
14
14
  }
@@ -16,7 +16,7 @@ export declare class DeclarationNode<P> extends Node<P> {
16
16
  private onDeclare;
17
17
  constructor(depMgr: DependencyManager, onDeclare: DeclarationCallback<P>, props: AnimatedProps<P>);
18
18
  set props(props: AnimatedProps<P>);
19
- get props(): AnimatedProps<P>;
19
+ get props(): P;
20
20
  draw(ctx: DrawingContext): DeclarationResult;
21
21
  }
22
22
  export {};
@@ -7,8 +7,8 @@ declare type DrawingCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>)
7
7
  declare type OnDrawCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;
8
8
  export declare const createDrawing: <P>(cb: OnDrawCallback<P>) => DrawingCallback<P>;
9
9
  export declare const useDrawing: <P>(cb: OnDrawCallback<P>, deps?: DependencyList | undefined) => OnDrawCallback<P>;
10
- export declare type DrawingProps<T> = {
11
- onDraw: DrawingCallback<T>;
10
+ export declare type DrawingProps<P> = {
11
+ onDraw: DrawingCallback<P>;
12
12
  skipProcessing?: boolean;
13
13
  children?: ReactNode | ReactNode[];
14
14
  };
@@ -9,15 +9,16 @@ export declare enum NodeType {
9
9
  declare type DeclarationResult = SkJSIInstance<string> | null;
10
10
  export declare abstract class Node<P = unknown> {
11
11
  readonly children: Node[];
12
- _props: AnimatedProps<P>;
12
+ resolvedProps: P;
13
13
  memoizable: boolean;
14
14
  memoized: DeclarationResult | null;
15
15
  parent?: Node;
16
16
  depMgr: DependencyManager;
17
17
  constructor(depMgr: DependencyManager, props: AnimatedProps<P>);
18
18
  abstract draw(ctx: DrawingContext): void | DeclarationResult;
19
+ updatePropSubscriptions(props: AnimatedProps<P>): void;
19
20
  set props(props: AnimatedProps<P>);
20
- get props(): AnimatedProps<P>;
21
+ get props(): P;
21
22
  visit(ctx: DrawingContext, children?: Node[]): SkJSIInstance<string>[];
22
23
  }
23
24
  export {};
@@ -5,7 +5,6 @@ export declare const isSelector: <T, R>(value: unknown) => value is {
5
5
  value: SkiaValue<T>;
6
6
  };
7
7
  export declare const isAnimated: <T>(props: AnimatedProps<T>) => boolean;
8
- export declare const materialize: <T>(props: AnimatedProps<T>) => T;
9
8
  export declare type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;
10
9
  export declare type AnimatedProps<T> = {
11
10
  [K in keyof T]: AnimatedProp<T[K]>;
@@ -26,6 +26,11 @@ export interface SkPaint extends SkJSIInstance<"Paint"> {
26
26
  * Returns a copy of this paint.
27
27
  */
28
28
  copy(): SkPaint;
29
+ /**
30
+ * Sets all SkPaint contents to their initial values. This is equivalent to replacing
31
+ SkPaint with the result of SkPaint().
32
+ */
33
+ reset(): void;
29
34
  /**
30
35
  * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values
31
36
  * (sRGB gamut, and encoded with the sRGB transfer function).
@@ -9,7 +9,7 @@ export declare abstract class Host {
9
9
  }
10
10
  export declare abstract class BaseHostObject<T, N extends string> extends Host implements SkJSIInstance<N> {
11
11
  readonly __typename__: N;
12
- readonly ref: T;
12
+ ref: T;
13
13
  constructor(CanvasKit: CanvasKit, ref: T, typename: N);
14
14
  }
15
15
  export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
@@ -4,6 +4,7 @@ import { HostObject } from "./Host";
4
4
  export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
5
5
  constructor(CanvasKit: CanvasKit, ref: Paint);
6
6
  copy(): JsiSkPaint;
7
+ reset(): void;
7
8
  getColor(): Float32Array;
8
9
  getStrokeCap(): number;
9
10
  getStrokeJoin(): number;
@@ -6,32 +6,32 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_arm64e_x86_64-simulator</string>
9
+ <string>ios-arm64_arm64e</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>libskia.a</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
15
  <string>arm64e</string>
16
- <string>x86_64</string>
17
16
  </array>
18
17
  <key>SupportedPlatform</key>
19
18
  <string>ios</string>
20
- <key>SupportedPlatformVariant</key>
21
- <string>simulator</string>
22
19
  </dict>
23
20
  <dict>
24
21
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_arm64e</string>
22
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
26
23
  <key>LibraryPath</key>
27
24
  <string>libskia.a</string>
28
25
  <key>SupportedArchitectures</key>
29
26
  <array>
30
27
  <string>arm64</string>
31
28
  <string>arm64e</string>
29
+ <string>x86_64</string>
32
30
  </array>
33
31
  <key>SupportedPlatform</key>
34
32
  <string>ios</string>
33
+ <key>SupportedPlatformVariant</key>
34
+ <string>simulator</string>
35
35
  </dict>
36
36
  </array>
37
37
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.143",
10
+ "version": "0.1.145",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [