@shopify/react-native-skia 0.1.131 → 0.1.134

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/android/CMakeLists.txt +1 -1
  2. package/android/build.gradle +17 -2
  3. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +5 -0
  4. package/cpp/api/JsiSkFont.h +6 -2
  5. package/cpp/api/JsiSkImage.h +2 -19
  6. package/cpp/api/JsiSkPaint.h +5 -32
  7. package/cpp/api/JsiSkPath.h +4 -4
  8. package/cpp/rnskia/RNSkValueApi.h +6 -6
  9. package/cpp/rnskia/values/{RNSkDerivedValue.h → RNSkComputedValue.h} +7 -7
  10. package/cpp/utils/RNSkLog.h +5 -0
  11. package/ios/RNSkia-iOS/SkiaManager.mm +1 -1
  12. package/lib/commonjs/mock/index.js +190 -0
  13. package/lib/commonjs/mock/index.js.map +1 -0
  14. package/lib/commonjs/skia/core/Data.js +33 -43
  15. package/lib/commonjs/skia/core/Data.js.map +1 -1
  16. package/lib/commonjs/skia/core/Typeface.js +1 -1
  17. package/lib/commonjs/skia/core/Typeface.js.map +1 -1
  18. package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
  19. package/lib/commonjs/skia/types/Image/Image.js +5 -5
  20. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  21. package/lib/commonjs/skia/types/Paint/Paint.js +3 -3
  22. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  23. package/lib/commonjs/skia/types/Path/Path.js +0 -1
  24. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  25. package/lib/commonjs/skia/types/Shader/Shader.js +1 -7
  26. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  27. package/lib/commonjs/skia/web/JsiSkCanvas.js +1 -1
  28. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  29. package/lib/commonjs/skia/web/JsiSkFont.js +4 -2
  30. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  31. package/lib/commonjs/skia/web/JsiSkFontMgr.js +0 -2
  32. package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
  33. package/lib/commonjs/skia/web/JsiSkImage.js +10 -6
  34. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  35. package/lib/commonjs/skia/web/{JsiImageFilterFactory.js → JsiSkImageFilterFactory.js} +1 -1
  36. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -0
  37. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  38. package/lib/commonjs/skia/web/JsiSkPath.js +65 -52
  39. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  40. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +1 -1
  41. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  42. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +23 -1
  43. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
  44. package/lib/commonjs/skia/web/JsiSkia.js +2 -2
  45. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  46. package/lib/commonjs/values/api.js +3 -3
  47. package/lib/commonjs/values/api.js.map +1 -1
  48. package/lib/commonjs/values/api.web.js +3 -3
  49. package/lib/commonjs/values/api.web.js.map +1 -1
  50. package/lib/commonjs/values/hooks/index.js +4 -4
  51. package/lib/commonjs/values/hooks/index.js.map +1 -1
  52. package/lib/commonjs/values/hooks/useComputedValue.js +32 -0
  53. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -0
  54. package/lib/commonjs/values/web/{RNSkDerivedValue.js → RNSkComputedValue.js} +4 -4
  55. package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -0
  56. package/lib/commonjs/values/web/api.js +3 -3
  57. package/lib/commonjs/values/web/api.js.map +1 -1
  58. package/lib/commonjs/views/SkiaView.web.js +4 -4
  59. package/lib/commonjs/views/SkiaView.web.js.map +1 -1
  60. package/lib/commonjs/web/index.js +4 -2
  61. package/lib/commonjs/web/index.js.map +1 -1
  62. package/lib/module/mock/index.js +152 -0
  63. package/lib/module/mock/index.js.map +1 -0
  64. package/lib/module/skia/core/Data.js +32 -41
  65. package/lib/module/skia/core/Data.js.map +1 -1
  66. package/lib/module/skia/core/Typeface.js +1 -1
  67. package/lib/module/skia/core/Typeface.js.map +1 -1
  68. package/lib/module/skia/types/Font/Font.js.map +1 -1
  69. package/lib/module/skia/types/Image/Image.js +5 -5
  70. package/lib/module/skia/types/Image/Image.js.map +1 -1
  71. package/lib/module/skia/types/Paint/Paint.js +3 -3
  72. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  73. package/lib/module/skia/types/Path/Path.js +0 -1
  74. package/lib/module/skia/types/Path/Path.js.map +1 -1
  75. package/lib/module/skia/types/Shader/Shader.js +1 -7
  76. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  77. package/lib/module/skia/web/JsiSkCanvas.js +1 -1
  78. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  79. package/lib/module/skia/web/JsiSkFont.js +5 -3
  80. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  81. package/lib/module/skia/web/JsiSkFontMgr.js +0 -2
  82. package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
  83. package/lib/module/skia/web/JsiSkImage.js +10 -7
  84. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  85. package/lib/module/skia/web/{JsiImageFilterFactory.js → JsiSkImageFilterFactory.js} +1 -1
  86. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -0
  87. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  88. package/lib/module/skia/web/JsiSkPath.js +65 -52
  89. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  90. package/lib/module/skia/web/JsiSkShaderFactory.js +1 -1
  91. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  92. package/lib/module/skia/web/JsiSkVerticesFactory.js +24 -1
  93. package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
  94. package/lib/module/skia/web/JsiSkia.js +1 -1
  95. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  96. package/lib/module/values/api.js +1 -1
  97. package/lib/module/values/api.js.map +1 -1
  98. package/lib/module/values/api.web.js +1 -1
  99. package/lib/module/values/api.web.js.map +1 -1
  100. package/lib/module/values/hooks/index.js +1 -1
  101. package/lib/module/values/hooks/index.js.map +1 -1
  102. package/lib/module/values/hooks/useComputedValue.js +18 -0
  103. package/lib/module/values/hooks/useComputedValue.js.map +1 -0
  104. package/lib/module/values/web/{RNSkDerivedValue.js → RNSkComputedValue.js} +2 -2
  105. package/lib/module/values/web/RNSkComputedValue.js.map +1 -0
  106. package/lib/module/values/web/api.js +3 -3
  107. package/lib/module/values/web/api.js.map +1 -1
  108. package/lib/module/views/SkiaView.web.js +4 -4
  109. package/lib/module/views/SkiaView.web.js.map +1 -1
  110. package/lib/module/web/index.js +3 -1
  111. package/lib/module/web/index.js.map +1 -1
  112. package/lib/typescript/src/mock/index.d.ts +47 -0
  113. package/lib/typescript/src/skia/core/Data.d.ts +3 -3
  114. package/lib/typescript/src/skia/types/Font/Font.d.ts +8 -9
  115. package/lib/typescript/src/skia/types/Image/Image.d.ts +5 -5
  116. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +3 -3
  117. package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -2
  118. package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +1 -0
  119. package/lib/typescript/src/skia/types/Skia.d.ts +1 -1
  120. package/lib/typescript/src/skia/web/JsiSkFont.d.ts +1 -1
  121. package/lib/typescript/src/skia/web/JsiSkImage.d.ts +3 -3
  122. package/lib/typescript/src/skia/web/{JsiImageFilterFactory.d.ts → JsiSkImageFilterFactory.d.ts} +0 -0
  123. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -1
  124. package/lib/typescript/src/values/api.d.ts +1 -1
  125. package/lib/typescript/src/values/api.web.d.ts +1 -1
  126. package/lib/typescript/src/values/hooks/index.d.ts +1 -1
  127. package/lib/typescript/src/values/hooks/{useDerivedValue.d.ts → useComputedValue.d.ts} +2 -1
  128. package/lib/typescript/src/values/types.d.ts +2 -2
  129. package/lib/typescript/src/values/web/{RNSkDerivedValue.d.ts → RNSkComputedValue.d.ts} +1 -1
  130. package/package.json +2 -1
  131. package/src/mock/index.ts +156 -0
  132. package/src/skia/core/Data.ts +67 -50
  133. package/src/skia/core/Typeface.ts +6 -1
  134. package/src/skia/types/Font/Font.ts +9 -14
  135. package/src/skia/types/Image/Image.ts +4 -4
  136. package/src/skia/types/Paint/Paint.ts +1 -1
  137. package/src/skia/types/Path/Path.ts +0 -1
  138. package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -0
  139. package/src/skia/types/Shader/Shader.ts +3 -5
  140. package/src/skia/types/Skia.ts +1 -1
  141. package/src/skia/web/JsiSkCanvas.ts +2 -2
  142. package/src/skia/web/JsiSkFont.ts +7 -3
  143. package/src/skia/web/JsiSkFontMgr.ts +0 -4
  144. package/src/skia/web/JsiSkImage.ts +37 -16
  145. package/src/skia/web/{JsiImageFilterFactory.ts → JsiSkImageFilterFactory.ts} +0 -0
  146. package/src/skia/web/JsiSkPaint.ts +1 -1
  147. package/src/skia/web/JsiSkPath.ts +64 -47
  148. package/src/skia/web/JsiSkShaderFactory.ts +4 -1
  149. package/src/skia/web/JsiSkVerticesFactory.ts +15 -1
  150. package/src/skia/web/JsiSkia.ts +2 -2
  151. package/src/values/api.ts +1 -1
  152. package/src/values/api.web.ts +1 -1
  153. package/src/values/hooks/index.ts +1 -1
  154. package/src/values/hooks/{useDerivedValue.ts → useComputedValue.ts} +8 -3
  155. package/src/values/types.ts +2 -2
  156. package/src/values/web/{RNSkDerivedValue.ts → RNSkComputedValue.ts} +1 -1
  157. package/src/values/web/api.ts +3 -3
  158. package/src/views/SkiaView.web.tsx +9 -11
  159. package/src/web/index.ts +3 -1
  160. package/lib/commonjs/skia/web/JsiImageFilterFactory.js.map +0 -1
  161. package/lib/commonjs/values/hooks/useDerivedValue.js +0 -25
  162. package/lib/commonjs/values/hooks/useDerivedValue.js.map +0 -1
  163. package/lib/commonjs/values/web/RNSkDerivedValue.js.map +0 -1
  164. package/lib/module/skia/web/JsiImageFilterFactory.js.map +0 -1
  165. package/lib/module/values/hooks/useDerivedValue.js +0 -14
  166. package/lib/module/values/hooks/useDerivedValue.js.map +0 -1
  167. package/lib/module/values/web/RNSkDerivedValue.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkPath.ts"],"names":["PathVerb","ckEnum","HostObject","optEnum","toValue","JsiSkPoint","JsiSkRect","JsiSkPath","constructor","CanvasKit","ref","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","cap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","getPoint","index","isEmpty","isVolatile","addCircle","r","LTRBRect","getLastPt","op","path","simplify","toSVGString","trim","startT","stopT","isComplement","transform","m3","interpolate","end","t","cmd1","toCmds","cmd2","length","interpolated","i","cmd","j","push","Path","MakeFromCmds","flat","isInterpolatable","path2","cmds","flatCmds","CmdCount","Move","Line","Quad","Conic","Cubic","Close","Done","c","concat"],"mappings":"AAEA,SAASA,QAAT,QAAyB,UAAzB;AAaA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,EAAsCC,OAAtC,QAAqD,QAArD;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA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;AAOf,OAACzI,QAAQ,CAAC0I,IAAV,GAAiB;AAPF,KAAjB;;AASA,SAAK,IAAIlB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGU,QAAQ,CAACZ,MAA7B,EAAqCE,CAAC,EAAtC,EAA0C;AACxC,UAAIC,GAAG,CAACH,MAAJ,KAAe,CAAf,IAAoBY,QAAQ,CAACV,CAAD,CAAR,KAAgBxH,QAAQ,CAAC0I,IAAjD,EAAuD;AACrD;AACD;;AACD,YAAMC,CAAC,GAAGT,QAAQ,CAACV,CAAD,CAAlB;AACAC,MAAAA,GAAG,CAACE,IAAJ,CAASgB,CAAT;;AACA,UAAIlB,GAAG,CAACH,MAAJ,GAAa,CAAjB,EAAoB;AAClB,cAAMA,MAAM,GAAGa,QAAQ,CAACV,GAAG,CAAC,CAAD,CAAJ,CAAvB;;AACA,YAAIA,GAAG,CAACH,MAAJ,KAAeA,MAAnB,EAA2B;AACzBW,UAAAA,IAAI,CAACN,IAAL,CAAUF,GAAV;AACAA,UAAAA,GAAG,GAAG,EAAN;AACD;AACF;AACF;;AACD,WAAOQ,IAAI,CAACW,MAAL,CAAYnB,GAAZ,CAAP;AACD;;AA5VuE","sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n SkRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { ckEnum, HostObject, optEnum, toValue } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(toValue(oval), startAngleInDegrees, sweepAngleInDegrees);\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(toValue(oval), isCCW, startIndex);\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => toValue(p)),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(ckEnum(fill));\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(opts.join),\n cap: optEnum(opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n }\n\n reset() {\n this.ref.reset();\n }\n\n rewind() {\n this.ref.rewind();\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n toValue(oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(toValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(toValue(rect), isCCW);\n }\n\n addRRect(rrect: SkRRect, isCCW?: boolean) {\n this.ref.addRRect(toValue(rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n // We leave the comment below to remind us that this is not implemented in CanvasKit\n // throw new NotImplementedOnRNWeb();\n this.ref.addOval(this.CanvasKit.LTRBRect(x - r, y - r, x + r, y + r));\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(toValue(path), ckEnum(op));\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(startT: number, stopT: number, isComplement: boolean) {\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(toValue(m3));\n }\n\n interpolate(end: SkPath, t: number) {\n // Do not remove the comment below. We use it to track missing APIs in CanvasKit\n // throw new NotImplementedOnRNWeb();\n const cmd1 = this.toCmds();\n const cmd2 = end.toCmds();\n if (cmd1.length !== cmd2.length) {\n return null;\n }\n const interpolated: PathCommand[] = [];\n for (let i = 0; i < cmd1.length; i++) {\n if (cmd1[i][0] !== cmd2[i][0]) {\n return null;\n }\n const cmd: PathCommand = [cmd1[i][0]];\n for (let j = 1; j < cmd1[i].length; j++) {\n cmd.push(cmd2[i][j] + (cmd1[i][j] - cmd2[i][j]) * t);\n }\n interpolated.push(cmd);\n }\n const path = this.CanvasKit.Path.MakeFromCmds(interpolated.flat());\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n isInterpolatable(path2: SkPath): boolean {\n // Do not remove the comment below. We use it to track missing APIs in CanvasKit\n // throw new NotImplementedOnRNWeb();\n const cmd1 = this.toCmds();\n const cmd2 = path2.toCmds();\n if (cmd1.length !== cmd2.length) {\n return false;\n }\n for (let i = 0; i < cmd1.length; i++) {\n if (cmd1[i][0] !== cmd2[i][0]) {\n return false;\n }\n }\n return true;\n }\n\n toCmds(): PathCommand[] {\n const cmds: PathCommand[] = [];\n let cmd = [];\n const flatCmds = this.ref.toCmds();\n const CmdCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 0,\n [PathVerb.Done]: 0,\n };\n for (let i = 0; i < flatCmds.length; i++) {\n if (cmd.length === 0 && flatCmds[i] === PathVerb.Done) {\n break;\n }\n const c = flatCmds[i];\n cmd.push(c);\n if (cmd.length > 1) {\n const length = CmdCount[cmd[0] as PathVerb];\n if (cmd.length === length) {\n cmds.push(cmd);\n cmd = [];\n }\n }\n }\n return cmds.concat(cmd);\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkPath.ts"],"names":["PathVerb","ckEnum","HostObject","optEnum","toValue","JsiSkPoint","JsiSkRect","CommandCount","Move","Line","Quad","Conic","Cubic","Close","areCmdsInterpolatable","cmd1","cmd2","length","i","JsiSkPath","constructor","CanvasKit","ref","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","cap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","getPoint","index","isEmpty","isVolatile","addCircle","r","LTRBRect","getLastPt","op","path","simplify","toSVGString","trim","startT","stopT","isComplement","transform","m3","interpolate","end","t","toCmds","interpolated","forEach","cmd","interpolatedCmd","push","c","j","c2","Path","MakeFromCmds","flat","isInterpolatable","path2","cmds","reduce","acc","current"],"mappings":"AAEA,SAASA,QAAT,QAAyB,UAAzB;AAaA,SAASC,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,EAAsCC,OAAtC,QAAqD,QAArD;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,MAAMC,YAAY,GAAG;AACnB,GAACP,QAAQ,CAACQ,IAAV,GAAiB,CADE;AAEnB,GAACR,QAAQ,CAACS,IAAV,GAAiB,CAFE;AAGnB,GAACT,QAAQ,CAACU,IAAV,GAAiB,CAHE;AAInB,GAACV,QAAQ,CAACW,KAAV,GAAkB,CAJC;AAKnB,GAACX,QAAQ,CAACY,KAAV,GAAkB,CALC;AAMnB,GAACZ,QAAQ,CAACa,KAAV,GAAkB;AANC,CAArB;;AASA,MAAMC,qBAAqB,GAAG,CAACC,IAAD,EAAsBC,IAAtB,KAA8C;AAC1E,MAAID,IAAI,CAACE,MAAL,KAAgBD,IAAI,CAACC,MAAzB,EAAiC;AAC/B,WAAO,KAAP;AACD;;AACD,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,IAAI,CAACE,MAAzB,EAAiCC,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACG,CAAD,CAAJ,CAAQ,CAAR,MAAeF,IAAI,CAACE,CAAD,CAAJ,CAAQ,CAAR,CAAnB,EAA+B;AAC7B,aAAO,KAAP;AACD,KAFD,MAEO,IAAIH,IAAI,CAACG,CAAD,CAAJ,CAAQ,CAAR,MAAelB,QAAQ,CAACW,KAAxB,IAAiCI,IAAI,CAACG,CAAD,CAAJ,CAAQ,CAAR,MAAeF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,CAAS,EAAT;AACD;AACF,OAND,MAMO;AACL,cAAMnH,MAAM,GAAGV,YAAY,CAACyI,OAAO,CAAC,CAAD,CAAR,CAA3B;;AACA,YAAIA,OAAO,CAAC/H,MAAR,GAAiBA,MAArB,EAA6B;AAC3B+H,UAAAA,OAAO,CAACZ,IAAR,CAAaF,GAAb;AACD;;AACD,YAAIc,OAAO,CAAC/H,MAAR,KAAmBA,MAAnB,IAA6BC,CAAC,KAAK2H,IAAI,CAAC5H,MAAL,GAAc,CAArD,EAAwD;AACtD8H,UAAAA,GAAG,CAACX,IAAJ,CAAS,EAAT;AACD;AACF;;AACD,aAAOW,GAAP;AACD,KArBc,EAqBZ,EArBY,CAAf;AAsBA,WAAOtG,MAAP;AACD;;AAtVuE","sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n SkRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { ckEnum, HostObject, optEnum, toValue } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nconst areCmdsInterpolatable = (cmd1: PathCommand[], cmd2: PathCommand[]) => {\n if (cmd1.length !== cmd2.length) {\n return false;\n }\n for (let i = 0; i < cmd1.length; i++) {\n if (cmd1[i][0] !== cmd2[i][0]) {\n return false;\n } else if (cmd1[i][0] === PathVerb.Conic && cmd1[i][5] !== cmd2[i][5]) {\n return false;\n }\n }\n return true;\n};\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(toValue(oval), startAngleInDegrees, sweepAngleInDegrees);\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(toValue(oval), isCCW, startIndex);\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => toValue(p)),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(ckEnum(fill));\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(opts.join),\n cap: optEnum(opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n }\n\n reset() {\n this.ref.reset();\n }\n\n rewind() {\n this.ref.rewind();\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n toValue(oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(toValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(toValue(rect), isCCW);\n }\n\n addRRect(rrect: SkRRect, isCCW?: boolean) {\n this.ref.addRRect(toValue(rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n // We leave the comment below to remind us that this is not implemented in CanvasKit\n // throw new NotImplementedOnRNWeb();\n this.ref.addOval(this.CanvasKit.LTRBRect(x - r, y - r, x + r, y + r));\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(toValue(path), ckEnum(op));\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(startT: number, stopT: number, isComplement: boolean) {\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(toValue(m3));\n }\n\n interpolate(end: SkPath, t: number) {\n // Do not remove the comment below. We use it to track missing APIs in CanvasKit\n // throw new NotImplementedOnRNWeb();\n const cmd1 = this.toCmds();\n const cmd2 = end.toCmds();\n if (!areCmdsInterpolatable(cmd1, cmd2)) {\n return null;\n }\n const interpolated: PathCommand[] = [];\n cmd1.forEach((cmd, i) => {\n const interpolatedCmd = [cmd[0]];\n interpolated.push(interpolatedCmd);\n cmd.forEach((c, j) => {\n if (j === 0) {\n return;\n }\n if (interpolatedCmd[0] === PathVerb.Conic && j === 5) {\n interpolatedCmd.push(c);\n } else {\n const c2 = cmd2[i][j];\n interpolatedCmd.push(c2 + (c - c2) * t);\n }\n });\n });\n const path = this.CanvasKit.Path.MakeFromCmds(interpolated.flat());\n if (path === null) {\n return null;\n }\n return new JsiSkPath(this.CanvasKit, path);\n }\n\n isInterpolatable(path2: SkPath): boolean {\n // Do not remove the comment below. We use it to track missing APIs in CanvasKit\n // throw new NotImplementedOnRNWeb();\n const cmd1 = this.toCmds();\n const cmd2 = path2.toCmds();\n return areCmdsInterpolatable(cmd1, cmd2);\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"]}
@@ -34,7 +34,7 @@ export class JsiSkShaderFactory extends Host {
34
34
  }
35
35
 
36
36
  MakeColor(color) {
37
- return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeColor(toValue(color)));
37
+ return new JsiSkShader(this.CanvasKit, this.CanvasKit.Shader.MakeColor(toValue(color), this.CanvasKit.ColorSpace.SRGB));
38
38
  }
39
39
 
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkShaderFactory.ts"],"names":["Host","toValue","ckEnum","JsiSkShader","JsiSkShaderFactory","constructor","CanvasKit","MakeLinearGradient","start","end","colors","pos","mode","localMatrix","flags","Shader","undefined","MakeRadialGradient","center","radius","MakeTwoPointConicalGradient","startRadius","endRadius","MakeSweepGradient","cx","cy","startAngleInDegrees","endAngleInDegrees","MakeTurbulence","baseFreqX","baseFreqY","octaves","seed","tileW","tileH","MakeFractalNoise","MakeBlend","one","two","MakeColor","color"],"mappings":"AAYA,SAASA,IAAT,EAAeC,OAAf,EAAwBC,MAAxB,QAAsC,QA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SAAL,CAAeS,MAAf,CAAsBoB,gBAAtB,CACEN,SADF,EAEEC,SAFF,EAGEC,OAHF,EAIEC,IAJF,EAKEC,KALF,EAMEC,KANF,CAFK,CAAP;AAWD;;AAEDE,EAAAA,SAAS,CAACxB,IAAD,EAAkByB,GAAlB,EAAiCC,GAAjC,EAAgD;AACvD,WAAO,IAAInC,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeS,MAAf,CAAsBqB,SAAtB,CAAgClC,MAAM,CAACU,IAAD,CAAtC,EAA8CX,OAAO,CAACoC,GAAD,CAArD,EAA4DpC,OAAO,CAACqC,GAAD,CAAnE,CAFK,CAAP;AAID;;AAEDC,EAAAA,SAAS,CAACC,KAAD,EAAiB;AACxB,WAAO,IAAIrC,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeS,MAAf,CAAsBwB,SAAtB,CAAgCtC,OAAO,CAACuC,KAAD,CAAvC,CAFK,CAAP;AAID;;AAjKmE","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n SkColor,\n SkMatrix,\n SkPoint,\n SkShader,\n TileMode,\n} from \"../types\";\nimport type { ShaderFactory } from \"../types/Shader/ShaderFactory\";\n\nimport { Host, toValue, ckEnum } from \"./Host\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkShaderFactory extends Host implements ShaderFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeLinearGradient(\n start: SkPoint,\n end: SkPoint,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeLinearGradient(\n toValue(start),\n toValue(end),\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined ? undefined : toValue(localMatrix),\n flags\n )\n );\n }\n\n MakeRadialGradient(\n center: SkPoint,\n radius: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeRadialGradient(\n toValue(center),\n radius,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined ? undefined : toValue(localMatrix),\n flags\n )\n );\n }\n\n MakeTwoPointConicalGradient(\n start: SkPoint,\n startRadius: number,\n end: SkPoint,\n endRadius: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeTwoPointConicalGradient(\n toValue(start),\n startRadius,\n toValue(end),\n endRadius,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined ? undefined : toValue(localMatrix),\n flags\n )\n );\n }\n\n MakeSweepGradient(\n cx: number,\n cy: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix | null,\n flags?: number,\n startAngleInDegrees?: number,\n endAngleInDegrees?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeSweepGradient(\n cx,\n cy,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined || localMatrix === null\n ? undefined\n : toValue(localMatrix),\n flags,\n startAngleInDegrees,\n endAngleInDegrees\n )\n );\n }\n\n MakeTurbulence(\n baseFreqX: number,\n baseFreqY: number,\n octaves: number,\n seed: number,\n tileW: number,\n tileH: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeTurbulence(\n baseFreqX,\n baseFreqY,\n octaves,\n seed,\n tileW,\n tileH\n )\n );\n }\n\n MakeFractalNoise(\n baseFreqX: number,\n baseFreqY: number,\n octaves: number,\n seed: number,\n tileW: number,\n tileH: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeFractalNoise(\n baseFreqX,\n baseFreqY,\n octaves,\n seed,\n tileW,\n tileH\n )\n );\n }\n\n MakeBlend(mode: BlendMode, one: SkShader, two: SkShader) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeBlend(ckEnum(mode), toValue(one), toValue(two))\n );\n }\n\n MakeColor(color: SkColor) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeColor(toValue(color))\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkShaderFactory.ts"],"names":["Host","toValue","ckEnum","JsiSkShader","JsiSkShaderFactory","constructor","CanvasKit","MakeLinearGradient","start","end","colors","pos","mode","localMatrix","flags","Shader","undefined","MakeRadialGradient","center","radius","MakeTwoPointConicalGradient","startRadius","endRadius","MakeSweepGradient","cx","cy","startAngleInDegrees","endAngleInDegrees","MakeTurbulence","baseFreqX","baseFreqY","octaves","seed","tileW","tileH","MakeFractalNoise","MakeBlend","one","two","MakeColor","color","ColorSpace","SRGB"],"mappings":"AAYA,SAASA,IAAT,EAAeC,OAAf,EAAwBC,MAAxB,QAAsC,QAAtC;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,kBAAN,SAAiCJ,IAAjC,CAA+D;AACpEK,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,kBAAkB,CAChBC,KADgB,EAEhBC,GAFgB,EAGhBC,MAHgB,EAIhBC,GAJgB,EAKhBC,IALgB,EAMhBC,WANgB,EAOhBC,KAPgB,EAQhB;AACA,WAAO,IAAIX,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeS,MAAf,CAAsBR,kBAAtB,CACEN,OAAO,CAACO,KAAD,CADT,EAEEP,OAAO,CAACQ,GAAD,CAFT,EAGEC,MAHF,EAIEC,GAJF,EAKET,MAAM,CAACU,IAAD,CALR,EAMEC,WAAW,KAAKG,SAAhB,GAA4BA,SAA5B,GAAwCf,OAAO,CAACY,WAAD,CANjD,EAOEC,KAPF,CAFK,CA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KlC,SAAL,CAAemC,UAAf,CAA0BC,IAF5B,CAFK,CAAP;AAOD;;AApKmE","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n SkColor,\n SkMatrix,\n SkPoint,\n SkShader,\n TileMode,\n} from \"../types\";\nimport type { ShaderFactory } from \"../types/Shader/ShaderFactory\";\n\nimport { Host, toValue, ckEnum } from \"./Host\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkShaderFactory extends Host implements ShaderFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeLinearGradient(\n start: SkPoint,\n end: SkPoint,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeLinearGradient(\n toValue(start),\n toValue(end),\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined ? undefined : toValue(localMatrix),\n flags\n )\n );\n }\n\n MakeRadialGradient(\n center: SkPoint,\n radius: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeRadialGradient(\n toValue(center),\n radius,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined ? undefined : toValue(localMatrix),\n flags\n )\n );\n }\n\n MakeTwoPointConicalGradient(\n start: SkPoint,\n startRadius: number,\n end: SkPoint,\n endRadius: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix,\n flags?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeTwoPointConicalGradient(\n toValue(start),\n startRadius,\n toValue(end),\n endRadius,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined ? undefined : toValue(localMatrix),\n flags\n )\n );\n }\n\n MakeSweepGradient(\n cx: number,\n cy: number,\n colors: SkColor[],\n pos: number[] | null,\n mode: TileMode,\n localMatrix?: SkMatrix | null,\n flags?: number,\n startAngleInDegrees?: number,\n endAngleInDegrees?: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeSweepGradient(\n cx,\n cy,\n colors,\n pos,\n ckEnum(mode),\n localMatrix === undefined || localMatrix === null\n ? undefined\n : toValue(localMatrix),\n flags,\n startAngleInDegrees,\n endAngleInDegrees\n )\n );\n }\n\n MakeTurbulence(\n baseFreqX: number,\n baseFreqY: number,\n octaves: number,\n seed: number,\n tileW: number,\n tileH: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeTurbulence(\n baseFreqX,\n baseFreqY,\n octaves,\n seed,\n tileW,\n tileH\n )\n );\n }\n\n MakeFractalNoise(\n baseFreqX: number,\n baseFreqY: number,\n octaves: number,\n seed: number,\n tileW: number,\n tileH: number\n ) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeFractalNoise(\n baseFreqX,\n baseFreqY,\n octaves,\n seed,\n tileW,\n tileH\n )\n );\n }\n\n MakeBlend(mode: BlendMode, one: SkShader, two: SkShader) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeBlend(ckEnum(mode), toValue(one), toValue(two))\n );\n }\n\n MakeColor(color: SkColor) {\n return new JsiSkShader(\n this.CanvasKit,\n this.CanvasKit.Shader.MakeColor(\n toValue(color),\n this.CanvasKit.ColorSpace.SRGB\n )\n );\n }\n}\n"]}
@@ -1,5 +1,28 @@
1
1
  import { ckEnum } from "./Host";
2
2
  import { JsiSkVertices } from "./JsiSkVertices";
3
+
4
+ const concat = function () {
5
+ let totalLength = 0;
6
+
7
+ for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
8
+ arrays[_key] = arguments[_key];
9
+ }
10
+
11
+ for (const arr of arrays) {
12
+ totalLength += arr.length;
13
+ }
14
+
15
+ const result = new Float32Array(totalLength);
16
+ let offset = 0;
17
+
18
+ for (const arr of arrays) {
19
+ result.set(arr, offset);
20
+ offset += arr.length;
21
+ }
22
+
23
+ return result;
24
+ };
25
+
3
26
  export const MakeVertices = (CanvasKit, mode, positions, textureCoordinates, colors, indices, isVolatile) => new JsiSkVertices(CanvasKit, CanvasKit.MakeVertices(ckEnum(mode), positions.map(_ref => {
4
27
  let {
5
28
  x,
@@ -12,5 +35,5 @@ export const MakeVertices = (CanvasKit, mode, positions, textureCoordinates, col
12
35
  y
13
36
  } = _ref2;
14
37
  return [x, y];
15
- }).flat(), colors, indices, isVolatile));
38
+ }).flat(), !colors ? null : colors.reduce((a, c) => concat(a, c)), indices, isVolatile));
16
39
  //# sourceMappingURL=JsiSkVerticesFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkVerticesFactory.ts"],"names":["ckEnum","JsiSkVertices","MakeVertices","CanvasKit","mode","positions","textureCoordinates","colors","indices","isVolatile","map","x","y","flat"],"mappings":"AAIA,SAASA,MAAT,QAAuB,QAAvB;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,YAAY,GAAG,CAC1BC,SAD0B,EAE1BC,IAF0B,EAG1BC,SAH0B,EAI1BC,kBAJ0B,EAK1BC,MAL0B,EAM1BC,OAN0B,EAO1BC,UAP0B,KAS1B,IAAIR,aAAJ,CACEE,SADF,EAEEA,SAAS,CAACD,YAAV,CACEF,MAAM,CAACI,IAAD,CADR,EAEEC,SAAS,CAACK,GAAV,CAAc;AAAA,MAAC;AAAEC,IAAAA,CAAF;AAAKC,IAAAA;AAAL,GAAD;AAAA,SAAc,CAACD,CAAD,EAAIC,CAAJ,CAAd;AAAA,CAAd,EAAoCC,IAApC,EAFF,EAGE,CAACP,kBAAkB,IAAI,EAAvB,EAA2BI,GAA3B,CAA+B;AAAA,MAAC;AAAEC,IAAAA,CAAF;AAAKC,IAAAA;AAAL,GAAD;AAAA,SAAc,CAACD,CAAD,EAAIC,CAAJ,CAAd;AAAA,CAA/B,EAAqDC,IAArD,EAHF,EAIEN,MAJF,EAKEC,OALF,EAMEC,UANF,CAFF,CATK","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkColor, SkPoint, VertexMode } from \"../types\";\n\nimport { ckEnum } from \"./Host\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\n\nexport const MakeVertices = (\n CanvasKit: CanvasKit,\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n) =>\n new JsiSkVertices(\n CanvasKit,\n CanvasKit.MakeVertices(\n ckEnum(mode),\n positions.map(({ x, y }) => [x, y]).flat(),\n (textureCoordinates || []).map(({ x, y }) => [x, y]).flat(),\n colors,\n indices,\n isVolatile\n )\n );\n"]}
1
+ {"version":3,"sources":["JsiSkVerticesFactory.ts"],"names":["ckEnum","JsiSkVertices","concat","totalLength","arrays","arr","length","result","Float32Array","offset","set","MakeVertices","CanvasKit","mode","positions","textureCoordinates","colors","indices","isVolatile","map","x","y","flat","reduce","a","c"],"mappings":"AAIA,SAASA,MAAT,QAAuB,QAAvB;AACA,SAASC,aAAT,QAA8B,iBAA9B;;AAEA,MAAMC,MAAM,GAAG,YAA+B;AAC5C,MAAIC,WAAW,GAAG,CAAlB;;AAD4C,oCAA3BC,MAA2B;AAA3BA,IAAAA,MAA2B;AAAA;;AAE5C,OAAK,MAAMC,GAAX,IAAkBD,MAAlB,EAA0B;AACxBD,IAAAA,WAAW,IAAIE,GAAG,CAACC,MAAnB;AACD;;AACD,QAAMC,MAAM,GAAG,IAAIC,YAAJ,CAAiBL,WAAjB,CAAf;AACA,MAAIM,MAAM,GAAG,CAAb;;AACA,OAAK,MAAMJ,GAAX,IAAkBD,MAAlB,EAA0B;AACxBG,IAAAA,MAAM,CAACG,GAAP,CAAWL,GAAX,EAAgBI,MAAhB;AACAA,IAAAA,MAAM,IAAIJ,GAAG,CAACC,MAAd;AACD;;AACD,SAAOC,MAAP;AACD,CAZD;;AAcA,OAAO,MAAMI,YAAY,GAAG,CAC1BC,SAD0B,EAE1BC,IAF0B,EAG1BC,SAH0B,EAI1BC,kBAJ0B,EAK1BC,MAL0B,EAM1BC,OAN0B,EAO1BC,UAP0B,KAS1B,IAAIjB,aAAJ,CACEW,SADF,EAEEA,SAAS,CAACD,YAAV,CACEX,MAAM,CAACa,IAAD,CADR,EAEEC,SAAS,CAACK,GAAV,CAAc;AAAA,MAAC;AAAEC,IAAAA,CAAF;AAAKC,IAAAA;AAAL,GAAD;AAAA,SAAc,CAACD,CAAD,EAAIC,CAAJ,CAAd;AAAA,CAAd,EAAoCC,IAApC,EAFF,EAGE,CAACP,kBAAkB,IAAI,EAAvB,EAA2BI,GAA3B,CAA+B;AAAA,MAAC;AAAEC,IAAAA,CAAF;AAAKC,IAAAA;AAAL,GAAD;AAAA,SAAc,CAACD,CAAD,EAAIC,CAAJ,CAAd;AAAA,CAA/B,EAAqDC,IAArD,EAHF,EAIE,CAACN,MAAD,GAAU,IAAV,GAAiBA,MAAM,CAACO,MAAP,CAAc,CAACC,CAAD,EAAIC,CAAJ,KAAUvB,MAAM,CAACsB,CAAD,EAAIC,CAAJ,CAA9B,CAJnB,EAKER,OALF,EAMEC,UANF,CAFF,CATK","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkColor, SkPoint, VertexMode } from \"../types\";\n\nimport { ckEnum } from \"./Host\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\n\nconst concat = (...arrays: Float32Array[]) => {\n let totalLength = 0;\n for (const arr of arrays) {\n totalLength += arr.length;\n }\n const result = new Float32Array(totalLength);\n let offset = 0;\n for (const arr of arrays) {\n result.set(arr, offset);\n offset += arr.length;\n }\n return result;\n};\n\nexport const MakeVertices = (\n CanvasKit: CanvasKit,\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n) =>\n new JsiSkVertices(\n CanvasKit,\n CanvasKit.MakeVertices(\n ckEnum(mode),\n positions.map(({ x, y }) => [x, y]).flat(),\n (textureCoordinates || []).map(({ x, y }) => [x, y]).flat(),\n !colors ? null : colors.reduce((a, c) => concat(a, c)),\n indices,\n isVolatile\n )\n );\n"]}
@@ -15,7 +15,7 @@ import { JsiSkColorFilterFactory } from "./JsiSkColorFilterFactory";
15
15
  import { JsiSkTypefaceFactory } from "./JsiSkTypefaceFactory";
16
16
  import { JsiSkMaskFilterFactory } from "./JsiSkMaskFilterFactory";
17
17
  import { JsiSkRuntimeEffectFactory } from "./JsiSkRuntimeEffectFactory";
18
- import { JsiSkImageFilterFactory } from "./JsiImageFilterFactory";
18
+ import { JsiSkImageFilterFactory } from "./JsiSkImageFilterFactory";
19
19
  import { JsiSkShaderFactory } from "./JsiSkShaderFactory";
20
20
  import { JsiSkPathEffectFactory } from "./JsiSkPathEffectFactory";
21
21
  import { JsiSkDataFactory } from "./JsiSkDataFactory";
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkia.ts"],"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","toValue","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFontMgrFactory","JsiSkFont","MakeVertices","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","ContourMeasureIter","path","forceClosed","resScale","Paint","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","SVG","TextBlob","FontMgr","XYWHRect","width","height","Surface"],"mappings":"AAYA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,OAAT,QAAwB,QAAxB;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AACA,SAASC,uBAAT,QAAwC,yBAAxC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AAEA,OAAO,MAAMC,QAAQ,GAAIC,SAAD,KAAiC;AACvDC,EAAAA,KAAK,EAAE,CAACC,CAAD,EAAYC,CAAZ,KACL,IAAI/B,UAAJ,CAAe4B,SAAf,EAA0BI,YAAY,CAACC,EAAb,CAAgBH,CAAhB,EAAmBC,CAAnB,CAA1B,CAFqD;AAGvDG,EAAAA,oBAAoB,EAAGC,C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C,EAAAA,OAAO,EAAE,IAAIjD,mBAAJ,CAAwBI,SAAxB,CApD8C;AAqDvD8C,EAAAA,QAAQ,EAAE,CAAC5C,CAAD,EAAYC,CAAZ,EAAuB4C,KAAvB,EAAsCC,MAAtC,KAAyD;AACjE,WAAO,IAAI1E,SAAJ,CAAc0B,SAAd,EAAyBA,SAAS,CAAC8C,QAAV,CAAmB5C,CAAnB,EAAsBC,CAAtB,EAAyB4C,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;AACD,GAvDsD;AAwDvDC,EAAAA,OAAO,EAAE,IAAIzE,mBAAJ,CAAwBwB,SAAxB;AAxD8C,CAAjC,CAAjB","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { toValue } from \"./Host\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, CanvasKit.RRectXY(toValue(rect), rx, ry)),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(toValue(path), forceClosed, resScale)\n ),\n Paint: () => new JsiSkPaint(CanvasKit, new CanvasKit.Paint()),\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : toValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n});\n"]}
1
+ {"version":3,"sources":["JsiSkia.ts"],"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","toValue","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFontMgrFactory","JsiSkFont","MakeVertices","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","ContourMeasureIter","path","forceClosed","resScale","Paint","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","SVG","TextBlob","FontMgr","XYWHRect","width","height","Surface"],"mappings":"AAYA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,OAAT,QAAwB,QAAxB;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AAEA,OAAO,MAAMC,QAAQ,GAAIC,SAAD,KAAiC;AACvDC,EAAAA,KAAK,EAAE,CAACC,CAAD,EAAYC,CAAZ,KACL,IAAI/B,UAAJ,CAAe4B,SAAf,EAA0BI,YAAY,CAACC,EAAb,CAAgBH,CAAhB,EAAmBC,CAAnB,CAA1B,CAFqD;AAGvDG,EAAAA,oBAAoB,EAAGC,CAAD,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AAA,OAAO,EAAE,IAAIjD,mBAAJ,CAAwBI,SAAxB,CApD8C;AAqDvD8C,EAAAA,QAAQ,EAAE,CAAC5C,CAAD,EAAYC,CAAZ,EAAuB4C,KAAvB,EAAsCC,MAAtC,KAAyD;AACjE,WAAO,IAAI1E,SAAJ,CAAc0B,SAAd,EAAyBA,SAAS,CAAC8C,QAAV,CAAmB5C,CAAnB,EAAsBC,CAAtB,EAAyB4C,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;AACD,GAvDsD;AAwDvDC,EAAAA,OAAO,EAAE,IAAIzE,mBAAJ,CAAwBwB,SAAxB;AAxD8C,CAAjC,CAAjB","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { toValue } from \"./Host\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, CanvasKit.RRectXY(toValue(rect), rx, ry)),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(toValue(path), forceClosed, resScale)\n ),\n Paint: () => new JsiSkPaint(CanvasKit, new CanvasKit.Paint()),\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : toValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n});\n"]}
@@ -4,6 +4,6 @@ const {
4
4
  export const ValueApi = SkiaValueApi;
5
5
  export const {
6
6
  createValue,
7
- createDerivedValue
7
+ createComputedValue
8
8
  } = ValueApi;
9
9
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["api.ts"],"names":["SkiaValueApi","global","ValueApi","createValue","createDerivedValue"],"mappings":"AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,MAAzB;AACA,OAAO,MAAMC,QAAQ,GAAGF,YAAjB;AAEP,OAAO,MAAM;AAAEG,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCF,QAA5C","sourcesContent":["import type { ISkiaValueApi } from \"./types\";\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nconst { SkiaValueApi } = global;\nexport const ValueApi = SkiaValueApi;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
1
+ {"version":3,"sources":["api.ts"],"names":["SkiaValueApi","global","ValueApi","createValue","createComputedValue"],"mappings":"AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,MAAzB;AACA,OAAO,MAAMC,QAAQ,GAAGF,YAAjB;AAEP,OAAO,MAAM;AAAEG,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAuCF,QAA7C","sourcesContent":["import type { ISkiaValueApi } from \"./types\";\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nconst { SkiaValueApi } = global;\nexport const ValueApi = SkiaValueApi;\n\nexport const { createValue, createComputedValue } = ValueApi;\n"]}
@@ -2,6 +2,6 @@ import { ValueApi as ValueApiWeb } from "./web";
2
2
  export const ValueApi = ValueApiWeb;
3
3
  export const {
4
4
  createValue,
5
- createDerivedValue
5
+ createComputedValue
6
6
  } = ValueApi;
7
7
  //# sourceMappingURL=api.web.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["api.web.ts"],"names":["ValueApi","ValueApiWeb","createValue","createDerivedValue"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,WAArB,QAAwC,OAAxC;AAEA,OAAO,MAAMD,QAAQ,GAAGC,WAAjB;AAEP,OAAO,MAAM;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCH,QAA5C","sourcesContent":["import { ValueApi as ValueApiWeb } from \"./web\";\n\nexport const ValueApi = ValueApiWeb;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
1
+ {"version":3,"sources":["api.web.ts"],"names":["ValueApi","ValueApiWeb","createValue","createComputedValue"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,WAArB,QAAwC,OAAxC;AAEA,OAAO,MAAMD,QAAQ,GAAGC,WAAjB;AAEP,OAAO,MAAM;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAuCH,QAA7C","sourcesContent":["import { ValueApi as ValueApiWeb } from \"./web\";\n\nexport const ValueApi = ValueApiWeb;\n\nexport const { createValue, createComputedValue } = ValueApi;\n"]}
@@ -1,5 +1,5 @@
1
1
  export * from "./useClockValue";
2
- export * from "./useDerivedValue";
2
+ export * from "./useComputedValue";
3
3
  export * from "./useValue";
4
4
  export * from "./useValueEffect";
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAd;AACA,cAAc,mBAAd;AACA,cAAc,YAAd;AACA,cAAc,kBAAd","sourcesContent":["export * from \"./useClockValue\";\nexport * from \"./useDerivedValue\";\nexport * from \"./useValue\";\nexport * from \"./useValueEffect\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAd;AACA,cAAc,oBAAd;AACA,cAAc,YAAd;AACA,cAAc,kBAAd","sourcesContent":["export * from \"./useClockValue\";\nexport * from \"./useComputedValue\";\nexport * from \"./useValue\";\nexport * from \"./useValueEffect\";\n"]}
@@ -0,0 +1,18 @@
1
+ import { useMemo } from "react";
2
+ import { ValueApi } from "../api";
3
+ import { isValue } from "../../renderer/processors";
4
+ /**
5
+ * Creates a new computed value - a value that will calculate its value depending
6
+ * on other values.
7
+ * @param cb Callback to calculate new value
8
+ * @param values Dependant values
9
+ * @returns A readonly value
10
+ */
11
+
12
+ export const useComputedValue = (cb, values) => useMemo(() => ValueApi.createComputedValue(cb, values.filter(isValue)), // eslint-disable-next-line react-hooks/exhaustive-deps
13
+ values);
14
+ export const useDerivedValue = (cb, values) => {
15
+ console.warn("useDerivedValue is deprecated. Use useComputedValue instead.");
16
+ return useComputedValue(cb, values);
17
+ };
18
+ //# sourceMappingURL=useComputedValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useComputedValue.ts"],"names":["useMemo","ValueApi","isValue","useComputedValue","cb","values","createComputedValue","filter","useDerivedValue","console","warn"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,QAAT,QAAyB,QAAzB;AACA,SAASC,OAAT,QAAwB,2BAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,gBAAgB,GAAG,CAAIC,EAAJ,EAAiBC,MAAjB,KAC9BL,OAAO,CACL,MAAMC,QAAQ,CAACK,mBAAT,CAAgCF,EAAhC,EAAoCC,MAAM,CAACE,MAAP,CAAcL,OAAd,CAApC,CADD,EAEL;AACAG,MAHK,CADF;AAOP,OAAO,MAAMG,eAAe,GAAG,CAAIJ,EAAJ,EAAiBC,MAAjB,KAAuC;AACpEI,EAAAA,OAAO,CAACC,IAAR,CAAa,8DAAb;AACA,SAAOP,gBAAgB,CAACC,EAAD,EAAKC,MAAL,CAAvB;AACD,CAHM","sourcesContent":["import { useMemo } from \"react\";\n\nimport { ValueApi } from \"../api\";\nimport { isValue } from \"../../renderer/processors\";\n\n/**\n * Creates a new computed value - a value that will calculate its value depending\n * on other values.\n * @param cb Callback to calculate new value\n * @param values Dependant values\n * @returns A readonly value\n */\nexport const useComputedValue = <R>(cb: () => R, values: unknown[]) =>\n useMemo(\n () => ValueApi.createComputedValue<R>(cb, values.filter(isValue)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n values\n );\n\nexport const useDerivedValue = <R>(cb: () => R, values: unknown[]) => {\n console.warn(\"useDerivedValue is deprecated. Use useComputedValue instead.\");\n return useComputedValue(cb, values);\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 { RNSkReadonlyValue } from "./RNSkReadonlyValue";
4
- export class RNSkDerivedValue extends RNSkReadonlyValue {
4
+ export class RNSkComputedValue extends RNSkReadonlyValue {
5
5
  constructor(callback, dependencies) {
6
6
  // Initialize dependencies - we can't call this yet, since
7
7
  // super if not called and it requires a start value to be set.
@@ -38,4 +38,4 @@ export class RNSkDerivedValue extends RNSkReadonlyValue {
38
38
  }
39
39
 
40
40
  }
41
- //# sourceMappingURL=RNSkDerivedValue.js.map
41
+ //# sourceMappingURL=RNSkComputedValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkComputedValue.ts"],"names":["RNSkReadonlyValue","RNSkComputedValue","constructor","callback","dependencies","unsubscribers","notifyUpdateRef","current","undefined","forEach","dep","push","addListener","_unsubscribers","dependecyUpdated","bind","_callback","update","unsubscribe"],"mappings":";;AAEA,SAASA,iBAAT,QAAkC,qBAAlC;AAEA,OAAO,MAAMC,iBAAN,SAAmCD,iBAAnC,CAAwD;AAC7DE,EAAAA,WAAW,CAACC,QAAD,EAAoBC,YAApB,EAAkD;AAC3D;AACA;AACA,UAAMC,aAAgC,GAAG,EAAzC;AACA,UAAMC,eAAsD,GAAG;AAC7DC,MAAAA,OAAO,EAAEC;AADoD,KAA/D;AAGAJ,IAAAA,YAAY,CAACK,OAAb,CAAsBC,GAAD,IAAS;AAC5B,UAAI,kBAAkBA,GAAlB,IAAyB,iBAAiBA,GAA9C,EAAmD;AACjDL,QAAAA,aAAa,CAACM,IAAd,CACGD,GAAD,CAAoCE,WAApC,CAAgD;AAAA;;AAAA,0CAC9CN,eAAe,CAACC,OAD8B,0DAC9C,2BAAAD,eAAe,CAD+B;AAAA,SAAhD,CADF;AAKD;AACF,KARD;AASA,UAAMH,QAAQ,EAAd;;AAhB2D;;AAAA;;AAiB3D,SAAKU,cAAL,GAAsBR,aAAtB;AACAC,IAAAA,eAAe,CAACC,OAAhB,GAA0B,KAAKO,gBAAL,CAAsBC,IAAtB,CAA2B,IAA3B,CAA1B;AACA,SAAKC,SAAL,GAAiBb,QAAjB;AACD;;AAEOW,EAAAA,gBAAgB,GAAG;AACzB,SAAKG,MAAL,CAAY,KAAKD,SAAL,EAAZ;AACD;;AAKME,EAAAA,WAAW,GAAG;AACnB,SAAKL,cAAL,CAAoBJ,OAApB,CAA6BS,WAAD,IAAiBA,WAAW,EAAxD;AACD;;AAhC4D","sourcesContent":["import type { DependencyList } from \"react\";\n\nimport { RNSkReadonlyValue } from \"./RNSkReadonlyValue\";\n\nexport class RNSkComputedValue<T> extends RNSkReadonlyValue<T> {\n constructor(callback: () => T, dependencies: DependencyList) {\n // Initialize dependencies - we can't call this yet, since\n // super if not called and it requires a start value to be set.\n const unsubscribers: Array<() => void> = [];\n const notifyUpdateRef: { current: (() => void) | undefined } = {\n current: undefined,\n };\n dependencies.forEach((dep) => {\n if (\"__typename__\" in dep && \"addListener\" in dep) {\n unsubscribers.push(\n (dep as RNSkReadonlyValue<unknown>).addListener(() =>\n notifyUpdateRef.current?.()\n )\n );\n }\n });\n super(callback());\n this._unsubscribers = unsubscribers;\n notifyUpdateRef.current = this.dependecyUpdated.bind(this);\n this._callback = callback;\n }\n\n private dependecyUpdated() {\n this.update(this._callback());\n }\n\n private _callback: () => T;\n private _unsubscribers: Array<() => void>;\n\n public unsubscribe() {\n this._unsubscribers.forEach((unsubscribe) => unsubscribe());\n }\n}\n"]}
@@ -1,13 +1,13 @@
1
1
  import { RNSkAnimation } from "./RNSkAnimation";
2
2
  import { RNSkClockValue } from "./RNSkClockValue";
3
- import { RNSkDerivedValue } from "./RNSkDerivedValue";
3
+ import { RNSkComputedValue } from "./RNSkComputedValue";
4
4
  import { RNSkValue } from "./RNSkValue";
5
5
  export const ValueApi = {
6
6
  createValue: function (initialValue) {
7
7
  return new RNSkValue(initialValue);
8
8
  },
9
- createDerivedValue: function (cb, values) {
10
- return new RNSkDerivedValue(cb, values);
9
+ createComputedValue: function (cb, values) {
10
+ return new RNSkComputedValue(cb, values);
11
11
  },
12
12
  createClockValue: function () {
13
13
  return new RNSkClockValue(requestAnimationFrame.bind(window));
@@ -1 +1 @@
1
- {"version":3,"sources":["api.ts"],"names":["RNSkAnimation","RNSkClockValue","RNSkDerivedValue","RNSkValue","ValueApi","createValue","initialValue","createDerivedValue","cb","values","createClockValue","requestAnimationFrame","bind","window","createAnimation"],"mappings":"AASA,SAASA,aAAT,QAA8B,iBAA9B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,QAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAE,UAAaC,YAAb,EAAmD;AAC9D,WAAO,IAAIH,SAAJ,CAAcG,YAAd,CAAP;AACD,GAHoC;AAIrCC,EAAAA,kBAAkB,EAAE,UAClBC,EADkB,EAElBC,MAFkB,EAGJ;AACd,WAAO,IAAIP,gBAAJ,CAAqBM,EAArB,EAAyBC,MAAzB,CAAP;AACD,GAToC;AAUrCC,EAAAA,gBAAgB,EAAE,YAA4B;AAC5C,WAAO,IAAIT,cAAJ,CAAmBU,qBAAqB,CAACC,IAAtB,CAA2BC,MAA3B,CAAnB,CAAP;AACD,GAZoC;AAarCC,EAAAA,eAAe,EAAE,UACfN,EADe,EAEA;AACf,WAAO,IAAIR,aAAJ,CAAkBQ,EAAlB,EAAsBG,qBAAqB,CAACC,IAAtB,CAA2BC,MAA3B,CAAtB,CAAP;AACD;AAjBoC,CAAhC","sourcesContent":["import type {\n ISkiaValueApi,\n SkiaMutableValue,\n SkiaValue,\n SkiaClockValue,\n AnimationState,\n SkiaAnimation,\n} from \"../types\";\n\nimport { RNSkAnimation } from \"./RNSkAnimation\";\nimport { RNSkClockValue } from \"./RNSkClockValue\";\nimport { RNSkDerivedValue } from \"./RNSkDerivedValue\";\nimport { RNSkValue } from \"./RNSkValue\";\n\nexport const ValueApi: ISkiaValueApi = {\n createValue: function <T>(initialValue: T): SkiaMutableValue<T> {\n return new RNSkValue(initialValue);\n },\n createDerivedValue: function <R>(\n cb: () => R,\n values: SkiaValue<unknown>[]\n ): SkiaValue<R> {\n return new RNSkDerivedValue(cb, values);\n },\n createClockValue: function (): SkiaClockValue {\n return new RNSkClockValue(requestAnimationFrame.bind(window));\n },\n createAnimation: function <S extends AnimationState = AnimationState>(\n cb: (t: number, state: S | undefined) => S\n ): SkiaAnimation {\n return new RNSkAnimation(cb, requestAnimationFrame.bind(window));\n },\n};\n"]}
1
+ {"version":3,"sources":["api.ts"],"names":["RNSkAnimation","RNSkClockValue","RNSkComputedValue","RNSkValue","ValueApi","createValue","initialValue","createComputedValue","cb","values","createClockValue","requestAnimationFrame","bind","window","createAnimation"],"mappings":"AASA,SAASA,aAAT,QAA8B,iBAA9B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,QAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAE,UAAaC,YAAb,EAAmD;AAC9D,WAAO,IAAIH,SAAJ,CAAcG,YAAd,CAAP;AACD,GAHoC;AAIrCC,EAAAA,mBAAmB,EAAE,UACnBC,EADmB,EAEnBC,MAFmB,EAGL;AACd,WAAO,IAAIP,iBAAJ,CAAsBM,EAAtB,EAA0BC,MAA1B,CAAP;AACD,GAToC;AAUrCC,EAAAA,gBAAgB,EAAE,YAA4B;AAC5C,WAAO,IAAIT,cAAJ,CAAmBU,qBAAqB,CAACC,IAAtB,CAA2BC,MAA3B,CAAnB,CAAP;AACD,GAZoC;AAarCC,EAAAA,eAAe,EAAE,UACfN,EADe,EAEA;AACf,WAAO,IAAIR,aAAJ,CAAkBQ,EAAlB,EAAsBG,qBAAqB,CAACC,IAAtB,CAA2BC,MAA3B,CAAtB,CAAP;AACD;AAjBoC,CAAhC","sourcesContent":["import type {\n ISkiaValueApi,\n SkiaMutableValue,\n SkiaValue,\n SkiaClockValue,\n AnimationState,\n SkiaAnimation,\n} from \"../types\";\n\nimport { RNSkAnimation } from \"./RNSkAnimation\";\nimport { RNSkClockValue } from \"./RNSkClockValue\";\nimport { RNSkComputedValue } from \"./RNSkComputedValue\";\nimport { RNSkValue } from \"./RNSkValue\";\n\nexport const ValueApi: ISkiaValueApi = {\n createValue: function <T>(initialValue: T): SkiaMutableValue<T> {\n return new RNSkValue(initialValue);\n },\n createComputedValue: function <R>(\n cb: () => R,\n values: SkiaValue<unknown>[]\n ): SkiaValue<R> {\n return new RNSkComputedValue(cb, values);\n },\n createClockValue: function (): SkiaClockValue {\n return new RNSkClockValue(requestAnimationFrame.bind(window));\n },\n createAnimation: function <S extends AnimationState = AnimationState>(\n cb: (t: number, state: S | undefined) => S\n ): SkiaAnimation {\n return new RNSkAnimation(cb, requestAnimationFrame.bind(window));\n },\n};\n"]}
@@ -187,15 +187,15 @@ export class SkiaView extends React.Component {
187
187
  } = this.props;
188
188
  return /*#__PURE__*/React.createElement(View, _extends({}, viewProps, {
189
189
  onLayout: this.onLayout.bind(this)
190
- }), this.state.width > -1 ? /*#__PURE__*/React.createElement("canvas", {
190
+ }), /*#__PURE__*/React.createElement("canvas", {
191
191
  ref: this._canvasRef,
192
- width: `${this.state.width}px`,
193
- height: `${this.state.height}px`,
192
+ width: this.state.width,
193
+ height: this.state.height,
194
194
  onPointerDown: this.handleTouchStart.bind(this),
195
195
  onPointerMove: this.handleTouchMove.bind(this),
196
196
  onPointerUp: this.handleTouchEnd.bind(this),
197
197
  onPointerCancel: this.handleTouchCancel.bind(this)
198
- }) : null);
198
+ }));
199
199
  }
200
200
 
201
201
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["SkiaView.web.tsx"],"names":["React","View","JsiSkSurface","TouchType","SkiaView","Component","constructor","props","createRef","state","width","height","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","onLayout","evt","setState","nativeEvent","layout","_canvasRef","current","_surface","global","CanvasKit","MakeCanvasSurface","_canvas","getCanvas","requestRedraw","redraw","componentDidMount","componentWillUnmount","_unmounted","makeImageSnapshot","rect","_redrawRequests","onDraw","touches","_touches","info","timestamp","Date","now","ref","flush","requestAnimationFrame","bind","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","handleTouchStart","Start","handleTouchMove","Active","handleTouchEnd","Cancelled","handleTouchCancel","End","render","debug","viewProps"],"mappings":";;;;AAAA;A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eAAe,EAAE,KAAK4B,iBAAL,CAAuB5B,IAAvB,CAA4B,IAA5B;AAPnB,MADD,GAUG,IAXN,CADF;AAeD;;AA9KD","sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\nimport { View } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\n\nimport type { DrawingInfo, DrawMode, SkiaViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nexport class SkiaView extends React.Component<\n SkiaViewProps,\n { width: number; height: number }\n> {\n constructor(props: SkiaViewProps) {\n super(props);\n this.state = { width: -1, height: -1 };\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef: React.RefObject<HTMLCanvasElement> = React.createRef();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private _unmounted = false;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayout(evt: LayoutChangeEvent) {\n this.setState({\n width: evt.nativeEvent.layout.width,\n height: evt.nativeEvent.layout.height,\n });\n // Reset canvas / surface on layout change\n if (this._canvasRef.current) {\n // Create surface\n this._surface = new JsiSkSurface(\n global.CanvasKit,\n global.CanvasKit.MakeCanvasSurface(this._canvasRef.current)!\n );\n // Get canvas and repaint\n if (this._surface) {\n this._canvas = this._surface.getCanvas();\n this.requestRedraw();\n this.redraw();\n }\n }\n }\n\n componentDidMount() {\n // Start render loop\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n this._surface = null;\n this._canvas = null;\n this._unmounted = true;\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private redraw() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (\n this._canvas &&\n this.props.onDraw &&\n this.state.height !== -1 &&\n this.state.width !== -1\n ) {\n const touches = [...this._touches];\n this._touches = [];\n const info: DrawingInfo = {\n height: this.state.height,\n width: this.state.width,\n timestamp: Date.now(),\n touches: [touches],\n };\n this.props.onDraw && this.props.onDraw(this._canvas!, info);\n this._surface?.ref.flush();\n }\n }\n // Always request a new redraw as long as we're not unmounted\n if (!this._unmounted) {\n requestAnimationFrame(this.redraw.bind(this));\n }\n }\n\n public requestRedraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.redraw();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.requestRedraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.requestRedraw();\n }\n\n handleTouchStart(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.Start);\n }\n\n handleTouchMove(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.Active);\n }\n\n handleTouchEnd(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.Cancelled);\n }\n\n handleTouchCancel(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.End);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <View {...viewProps} onLayout={this.onLayout.bind(this)}>\n {this.state.width > -1 ? (\n <canvas\n ref={this._canvasRef}\n width={`${this.state.width}px`}\n height={`${this.state.height}px`}\n onPointerDown={this.handleTouchStart.bind(this)}\n onPointerMove={this.handleTouchMove.bind(this)}\n onPointerUp={this.handleTouchEnd.bind(this)}\n onPointerCancel={this.handleTouchCancel.bind(this)}\n />\n ) : null}\n </View>\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["SkiaView.web.tsx"],"names":["React","View","JsiSkSurface","TouchType","SkiaView","Component","constructor","props","createRef","state","width","height","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","onLayout","evt","setState","nativeEvent","layout","_canvasRef","current","_surface","global","CanvasKit","MakeCanvasSurface","_canvas","getCanvas","requestRedraw","redraw","componentDidMount","componentWillUnmount","_unmounted","makeImageSnapshot","rect","_redrawRequests","onDraw","touches","_touches","info","timestamp","Date","now","ref","flush","requestAnimationFrame","bind","setDrawMode","registerValues","_values","v","push","addListener","handleTouchEvent","touchType","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","handleTouchStart","Start","handleTouchMove","Active","handleTouchEnd","Cancelled","handleTouchCancel","End","render","debug","viewProps"],"mappings":";;;;AAAA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,IAAT,QAAqB,cAArB;AAIA,SAASC,YAAT,QAA6B,0BAA7B;AAGA,SAASC,SAAT,QAA0B,SAA1B;AAEA,OAAO,MAAMC,QAAN,SAAuBJ,KAAK,CAACK,SAA7B,CAGL;AACAC,EAAAA,WAAW,CAACC,KAAD,EAAuB;AAAA;;AACh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AsBrC,GAAtB,EAA2BhB,SAAS,CAACuE,MAArC;AACD;;AAEDC,EAAAA,cAAc,CAACxD,GAAD,EAAoB;AAChC,SAAKqC,gBAAL,CAAsBrC,GAAtB,EAA2BhB,SAAS,CAACyE,SAArC;AACD;;AAEDC,EAAAA,iBAAiB,CAAC1D,GAAD,EAAoB;AACnC,SAAKqC,gBAAL,CAAsBrC,GAAtB,EAA2BhB,SAAS,CAAC2E,GAArC;AACD;;AAEDC,EAAAA,MAAM,GAAG;AACP,UAAM;AAAElE,MAAAA,IAAF;AAAQmE,MAAAA,KAAK,GAAG,KAAhB;AAAuB,SAAGC;AAA1B,QAAwC,KAAK1E,KAAnD;AACA,wBACE,oBAAC,IAAD,eAAU0E,SAAV;AAAqB,MAAA,QAAQ,EAAE,KAAK/D,QAAL,CAAc+B,IAAd,CAAmB,IAAnB;AAA/B,qBACE;AACE,MAAA,GAAG,EAAE,KAAK1B,UADZ;AAEE,MAAA,KAAK,EAAE,KAAKd,KAAL,CAAWC,KAFpB;AAGE,MAAA,MAAM,EAAE,KAAKD,KAAL,CAAWE,MAHrB;AAIE,MAAA,aAAa,EAAE,KAAK4D,gBAAL,CAAsBtB,IAAtB,CAA2B,IAA3B,CAJjB;AAKE,MAAA,aAAa,EAAE,KAAKwB,eAAL,CAAqBxB,IAArB,CAA0B,IAA1B,CALjB;AAME,MAAA,WAAW,EAAE,KAAK0B,cAAL,CAAoB1B,IAApB,CAAyB,IAAzB,CANf;AAOE,MAAA,eAAe,EAAE,KAAK4B,iBAAL,CAAuB5B,IAAvB,CAA4B,IAA5B;AAPnB,MADF,CADF;AAaD;;AA5KD","sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\nimport { View } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\n\nimport type { DrawingInfo, DrawMode, SkiaViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nexport class SkiaView extends React.Component<\n SkiaViewProps,\n { width: number; height: number }\n> {\n constructor(props: SkiaViewProps) {\n super(props);\n this.state = { width: -1, height: -1 };\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef: React.RefObject<HTMLCanvasElement> = React.createRef();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private _unmounted = false;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayout(evt: LayoutChangeEvent) {\n this.setState({\n width: evt.nativeEvent.layout.width,\n height: evt.nativeEvent.layout.height,\n });\n // Reset canvas / surface on layout change\n if (this._canvasRef.current) {\n // Create surface\n this._surface = new JsiSkSurface(\n global.CanvasKit,\n global.CanvasKit.MakeCanvasSurface(this._canvasRef.current)!\n );\n // Get canvas and repaint\n if (this._surface) {\n this._canvas = this._surface.getCanvas();\n this.requestRedraw();\n this.redraw();\n }\n }\n }\n\n componentDidMount() {\n // Start render loop\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n this._surface = null;\n this._canvas = null;\n this._unmounted = true;\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private redraw() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (\n this._canvas &&\n this.props.onDraw &&\n this.state.height !== -1 &&\n this.state.width !== -1\n ) {\n const touches = [...this._touches];\n this._touches = [];\n const info: DrawingInfo = {\n height: this.state.height,\n width: this.state.width,\n timestamp: Date.now(),\n touches: [touches],\n };\n this.props.onDraw && this.props.onDraw(this._canvas!, info);\n this._surface?.ref.flush();\n }\n }\n // Always request a new redraw as long as we're not unmounted\n if (!this._unmounted) {\n requestAnimationFrame(this.redraw.bind(this));\n }\n }\n\n public requestRedraw() {\n this._redrawRequests++;\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n this._mode = mode;\n this.redraw();\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(_values: SkiaValue<unknown>[]) {\n // Unsubscribe from dependency values\n this.unsubscribeAll();\n // Register redraw dependencies on values\n _values.forEach((v) => {\n this._unsubscriptions.push(\n v.addListener(() => {\n this.requestRedraw();\n })\n );\n });\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.requestRedraw();\n }\n\n handleTouchStart(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.Start);\n }\n\n handleTouchMove(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.Active);\n }\n\n handleTouchEnd(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.Cancelled);\n }\n\n handleTouchCancel(evt: PointerEvent) {\n this.handleTouchEvent(evt, TouchType.End);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <View {...viewProps} onLayout={this.onLayout.bind(this)}>\n <canvas\n ref={this._canvasRef}\n width={this.state.width}\n height={this.state.height}\n onPointerDown={this.handleTouchStart.bind(this)}\n onPointerMove={this.handleTouchMove.bind(this)}\n onPointerUp={this.handleTouchEnd.bind(this)}\n onPointerCancel={this.handleTouchCancel.bind(this)}\n />\n </View>\n );\n }\n}\n"]}
@@ -1,4 +1,6 @@
1
- import CanvasKitInit from "canvaskit-wasm";
1
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
+ // @ts-expect-error
3
+ import CanvasKitInit from "canvaskit-wasm/bin/full/canvaskit";
2
4
  export const LoadSkia = async () => {
3
5
  const CanvasKit = await CanvasKitInit(); // The CanvasKit API is stored on the global object and used
4
6
  // to create the JsiSKApi in the Skia.web.ts file.
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["CanvasKitInit","LoadSkia","CanvasKit","global"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,gBAA1B;AAOA,OAAO,MAAMC,QAAQ,GAAG,YAAY;AAClC,QAAMC,SAAS,GAAG,MAAMF,aAAa,EAArC,CADkC,CAElC;AACA;;AACAG,EAAAA,MAAM,CAACD,SAAP,GAAmBA,SAAnB;AACD,CALM","sourcesContent":["import CanvasKitInit from \"canvaskit-wasm\";\nimport type { CanvasKit as CanvasKitType } from \"canvaskit-wasm\";\n\ndeclare global {\n var CanvasKit: CanvasKitType;\n}\n\nexport const LoadSkia = async () => {\n const CanvasKit = await CanvasKitInit();\n // The CanvasKit API is stored on the global object and used\n // to create the JsiSKApi in the Skia.web.ts file.\n global.CanvasKit = CanvasKit;\n};\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["CanvasKitInit","LoadSkia","CanvasKit","global"],"mappings":"AAAA;AACA;AACA,OAAOA,aAAP,MAA0B,mCAA1B;AAOA,OAAO,MAAMC,QAAQ,GAAG,YAAY;AAClC,QAAMC,SAAS,GAAG,MAAMF,aAAa,EAArC,CADkC,CAElC;AACA;;AACAG,EAAAA,MAAM,CAACD,SAAP,GAAmBA,SAAnB;AACD,CALM","sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-expect-error\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { CanvasKit as CanvasKitType } from \"canvaskit-wasm\";\n\ndeclare global {\n var CanvasKit: CanvasKitType;\n}\n\nexport const LoadSkia = async () => {\n const CanvasKit = await CanvasKitInit();\n // The CanvasKit API is stored on the global object and used\n // to create the JsiSKApi in the Skia.web.ts file.\n global.CanvasKit = CanvasKit;\n};\n"]}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Mock implementation for test runners.
3
+ *
4
+ * Example:
5
+ *
6
+ * ```js
7
+ * jest.mock('@shopify/react-native-skia', () => require('@shopify/react-native-skia/lib/commonjs/mock'));
8
+ * ```
9
+ */
10
+ import type { Skia as SkiaApi, SkRect } from "../skia/types";
11
+ export declare const Skia: SkiaApi;
12
+ export declare const vec: (x: number, y: number) => {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ export declare const rect: (x: number, y: number, width: number, height: number) => {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ };
22
+ export declare const rrect: (r: SkRect, rx: number, ry: number) => {
23
+ rect: SkRect;
24
+ rx: number;
25
+ ry: number;
26
+ };
27
+ export declare const useTouchHandler: () => any;
28
+ export declare const useComputedValue: () => any;
29
+ export declare const useValue: () => any;
30
+ export declare const useClockValue: () => any;
31
+ export declare const useValueEffect: () => any;
32
+ export declare const useTiming: () => any;
33
+ export declare const runTiming: () => any;
34
+ export declare const timing: () => any;
35
+ export declare const useSpring: () => any;
36
+ export declare const runSpring: () => any;
37
+ export declare const spring: () => any;
38
+ export declare const runDecay: () => any;
39
+ export declare const decay: () => any;
40
+ export declare const useSharedValueEffect: () => any;
41
+ export declare const useData: () => any;
42
+ export declare const useDataCollection: () => any;
43
+ export declare const useFont: () => any;
44
+ export declare const useImage: () => any;
45
+ export declare const usePicture: () => any;
46
+ export declare const useSVG: () => any;
47
+ export declare const useTypeface: () => any;
@@ -1,5 +1,5 @@
1
1
  import type { DependencyList } from "react";
2
2
  import type { SkData, DataSource } from "../types";
3
- export declare const useDataCollection: <T>(sources: DataSource[], factory: (data: SkData[]) => T, deps?: DependencyList) => T | null;
4
- export declare const useRawData: <T>(source: DataSource | null | undefined, factory: (data: SkData) => T, onError?: ((err: Error) => void) | undefined) => T | null;
5
- export declare const useData: (source: DataSource | null | undefined, onError?: ((err: Error) => void) | undefined) => SkData | null;
3
+ export declare const useDataCollection: <T>(sources: DataSource[], factory: (data: SkData) => T, onError?: ((err: Error) => void) | undefined, deps?: DependencyList | undefined) => (T | null)[] | null;
4
+ export declare const useRawData: <T>(source: DataSource | null | undefined, factory: (data: SkData) => T, onError?: ((err: Error) => void) | undefined, deps?: DependencyList | undefined) => T | null;
5
+ export declare const useData: (source: DataSource | null | undefined, onError?: ((err: Error) => void) | undefined, deps?: DependencyList | undefined) => SkData | null;
@@ -10,6 +10,14 @@ export interface FontMetrics {
10
10
  bounds?: SkRect;
11
11
  }
12
12
  export interface SkFont extends SkJSIInstance<"Font"> {
13
+ /**
14
+ * Retrieves the advanceX measurements for each glyph.
15
+ * If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected.
16
+ * One width per glyph is returned in the returned array.
17
+ * @param glyphs
18
+ * @param paint
19
+ */
20
+ getGlyphWidths(glyphs: number[], paint?: SkPaint): number[];
13
21
  /** Returns the advance width of text.
14
22
  The advance is the normal distance to move before drawing additional text.
15
23
  Returns the bounding box of text if bounds is not nullptr. The paint
@@ -34,15 +42,6 @@ export interface SkFont extends SkJSIInstance<"Font"> {
34
42
  * @param numCodePoints - the number of code points in the string. Defaults to str.length.
35
43
  */
36
44
  getGlyphIDs(str: string, numCodePoints?: number): number[];
37
- /**
38
- * Retrieves the advanceX measurements for each glyph.
39
- * If paint is not null, its stroking, PathEffect, and MaskFilter fields are respected.
40
- * One width per glyph is returned in the returned array.
41
- * @param glyphs
42
- * @param paint
43
- * @param output - if provided, the results will be copied into this array.
44
- */
45
- getGlyphWidths(glyphs: number[], paint?: SkPaint | null, output?: Float32Array): Float32Array;
46
45
  /**
47
46
  * Computes any intersections of a thick "line" and a run of positionsed glyphs.
48
47
  * The thick line is represented as a top and bottom coordinate (positive for
@@ -3,8 +3,8 @@ import type { SkJSIInstance } from "../JsiInstance";
3
3
  import type { TileMode } from "../ImageFilter";
4
4
  import type { SkShader } from "../Shader";
5
5
  export declare enum FilterMode {
6
- Linear = 0,
7
- Nearest = 1
6
+ Nearest = 0,
7
+ Linear = 1
8
8
  }
9
9
  export declare enum MipmapMode {
10
10
  None = 0,
@@ -12,9 +12,9 @@ export declare enum MipmapMode {
12
12
  Linear = 2
13
13
  }
14
14
  export declare enum ImageFormat {
15
- PNG = 0,
16
- JPEG = 1,
17
- WEBP = 2
15
+ JPEG = 3,
16
+ PNG = 4,
17
+ WEBP = 6
18
18
  }
19
19
  export interface SkImage extends SkJSIInstance<"Image"> {
20
20
  /**