@shopify/react-native-skia 2.13.1 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/android/CMakeLists.txt +2 -0
  2. package/android/cpp/jni/include/JniSkiaPictureView.h +16 -15
  3. package/apple/RNSkApplePlatformContext.h +3 -4
  4. package/apple/RNSkiaModule.h +11 -3
  5. package/apple/RNSkiaModule.mm +46 -19
  6. package/apple/SkiaPictureView.mm +2 -2
  7. package/apple/SkiaUIView.h +0 -1
  8. package/apple/SkiaUIView.mm +1 -1
  9. package/apple/ViewScreenshotService.h +2 -2
  10. package/apple/ViewScreenshotService.mm +5 -4
  11. package/cpp/api/JsiSkPath.h +0 -431
  12. package/cpp/api/JsiSkSkottie.h +2 -3
  13. package/cpp/api/JsiSkStrutStyle.h +1 -1
  14. package/cpp/api/JsiSkSurfaceFactory.h +41 -0
  15. package/cpp/api/recorder/Convertor.h +152 -131
  16. package/cpp/api/recorder/DataTypes.h +11 -11
  17. package/cpp/api/recorder/ImageFit.h +8 -5
  18. package/cpp/api/recorder/JsiRecorder.h +9 -29
  19. package/cpp/api/recorder/Paint.h +3 -3
  20. package/cpp/api/recorder/RNRecorder.h +56 -0
  21. package/cpp/jsi/ViewProperty.cpp +23 -0
  22. package/cpp/jsi/ViewProperty.h +31 -10
  23. package/cpp/rnskia/RNDawnContext.h +33 -0
  24. package/cpp/rnskia/RNSkJsiViewApi.h +69 -2
  25. package/cpp/rnskia/RNSkPictureView.cpp +58 -0
  26. package/cpp/rnskia/RNSkPictureView.h +110 -24
  27. package/lib/commonjs/Platform/IPlatform.js.map +1 -1
  28. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  29. package/lib/commonjs/skia/core/Image.js.map +1 -1
  30. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  31. package/lib/commonjs/skia/types/Path/Path.d.ts +2 -336
  32. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  33. package/lib/commonjs/skia/types/Recorder.d.ts +10 -0
  34. package/lib/commonjs/skia/types/Recorder.js.map +1 -1
  35. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  36. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  37. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  38. package/lib/commonjs/skia/web/JsiSkPath.d.ts +4 -38
  39. package/lib/commonjs/skia/web/JsiSkPath.js +3 -275
  40. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  41. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  42. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +3 -0
  43. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  44. package/lib/commonjs/sksg/Container.native.d.ts +15 -1
  45. package/lib/commonjs/sksg/Container.native.js +34 -33
  46. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  47. package/lib/commonjs/specs/NativeSkiaModule.web.js +4 -0
  48. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  49. package/lib/commonjs/views/types.d.ts +9 -0
  50. package/lib/commonjs/views/types.js.map +1 -1
  51. package/lib/module/Platform/IPlatform.js.map +1 -1
  52. package/lib/module/animation/functions/interpolate.js.map +1 -1
  53. package/lib/module/skia/core/Image.js.map +1 -1
  54. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  55. package/lib/module/skia/types/Path/Path.d.ts +2 -336
  56. package/lib/module/skia/types/Path/Path.js.map +1 -1
  57. package/lib/module/skia/types/Recorder.d.ts +10 -0
  58. package/lib/module/skia/types/Recorder.js.map +1 -1
  59. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  60. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  61. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  62. package/lib/module/skia/web/JsiSkPath.d.ts +4 -38
  63. package/lib/module/skia/web/JsiSkPath.js +4 -276
  64. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  65. package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  66. package/lib/module/skia/web/JsiSkSurfaceFactory.js +4 -1
  67. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  68. package/lib/module/sksg/Container.native.d.ts +15 -1
  69. package/lib/module/sksg/Container.native.js +34 -33
  70. package/lib/module/sksg/Container.native.js.map +1 -1
  71. package/lib/module/specs/NativeSkiaModule.web.js +4 -0
  72. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  73. package/lib/module/views/types.d.ts +9 -0
  74. package/lib/module/views/types.js.map +1 -1
  75. package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -35
  76. package/lib/typescript/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
  77. package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +15 -1
  78. package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +3 -37
  79. package/lib/typescript/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
  80. package/lib/typescript/lib/module/sksg/Container.native.d.ts +15 -1
  81. package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -336
  82. package/lib/typescript/src/skia/types/Recorder.d.ts +10 -0
  83. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  84. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +4 -38
  85. package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  86. package/lib/typescript/src/sksg/Container.native.d.ts +15 -1
  87. package/lib/typescript/src/views/types.d.ts +9 -0
  88. package/package.json +2 -2
  89. package/src/Platform/IPlatform.ts +1 -4
  90. package/src/animation/functions/interpolate.ts +1 -4
  91. package/src/skia/core/Image.ts +1 -2
  92. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +2 -5
  93. package/src/skia/types/Path/Path.ts +2 -420
  94. package/src/skia/types/Recorder.ts +10 -0
  95. package/src/skia/types/Shader/Shader.ts +1 -5
  96. package/src/skia/types/Surface/SurfaceFactory.ts +17 -0
  97. package/src/skia/web/JsiSkPath.ts +4 -495
  98. package/src/skia/web/JsiSkSurfaceFactory.ts +6 -2
  99. package/src/sksg/Container.native.ts +34 -37
  100. package/src/specs/NativeSkiaModule.web.ts +4 -0
  101. package/src/views/types.ts +13 -0
  102. package/apple/SkiaManager.h +0 -23
  103. package/apple/SkiaManager.mm +0 -63
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_Host","_JsiSkPoint","_JsiSkRect","_JsiSkRRect","_JsiSkMatrix","CommandCount","PathVerb","Move","Line","Quad","Conic","Cubic","Close","shownDeprecationWarnings","Set","warnDeprecatedPathMethod","methodName","suggestion","has","add","console","warn","toMatrix3x3","m","matrix","JsiSkMatrix","Array","from","fromValue","length","Error","exports","JsiSkPath","HostObject","constructor","CanvasKit","ref","asPath","snapshot","pathFromValue","value","addPath","src","extend","srcBuilder","srcPath","args","delete","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","JsiSkRect","addOval","isCCW","startIndex","addPoly","points","close","addPolygon","map","p","JsiSkPoint","flat","addRect","rect","addRRect","rrect","JsiSkRRect","addCircle","x","y","r","moveTo","rMoveTo","lineTo","rLineTo","quadTo","x1","y1","x2","y2","rQuadTo","conicTo","w","rConicTo","cubicTo","cpx1","cpy1","cpx2","cpy2","rCubicTo","reset","newBuilder","PathBuilder","rewind","arcToOval","forceMoveTo","arcToRotated","rx","ry","xAxisRotateInDegrees","useSmallArc","rArcTo","dx","dy","arcToTangent","radius","setFillType","fill","getEnum","setIsVolatile","_volatile","offset","transform","makeAsWinding","path","result","old","simplify","makeSimplified","op","self","other","makeCombined","dash","on","off","phase","makeDashed","stroke","opts","makeStroked","undefined","width","miter_limit","precision","join","optEnum","cap","trim","start","stop","isComplement","startT","Math","min","max","stopT","makeTrimmed","countPoints","computeTightBounds","contains","copy","equals","p1","p2","getBounds","getFillType","getPoint","index","isEmpty","isVolatile","getLastPt","count","pt","toSVGString","isInterpolatable","path2","Path","CanInterpolate","interpolate","end","weight","output","MakeFromPathInterpolation","outRef","toCmds","cmds","reduce","acc","cmd","i","push","current"],"sources":["JsiSkPath.ts"],"sourcesContent":["import type { CanvasKit, PathBuilder as CKPathBuilder } 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 InputRRect,\n StrokeOpts,\n InputMatrix,\n} from \"../types\";\n\nimport { getEnum, HostObject, optEnum } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\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\n// Track which deprecation warnings have been shown to avoid spam\nconst shownDeprecationWarnings = new Set<string>();\n\nconst warnDeprecatedPathMethod = (\n methodName: string,\n suggestion: string\n): void => {\n if (shownDeprecationWarnings.has(methodName)) {\n return;\n }\n shownDeprecationWarnings.add(methodName);\n console.warn(\n `[react-native-skia] SkPath.${methodName}() is deprecated and will be removed in a future release. ${suggestion} See migration guide: https://shopify.github.io/react-native-skia/docs/shapes/path-migration`\n );\n};\n\nexport const toMatrix3x3 = (m: InputMatrix): number[] => {\n let matrix =\n m instanceof JsiSkMatrix\n ? Array.from(JsiSkMatrix.fromValue<Float32Array>(m))\n : (m as Exclude<InputMatrix, SkMatrix>);\n if (matrix.length === 16) {\n matrix = [\n matrix[0],\n matrix[1],\n matrix[3],\n matrix[4],\n matrix[5],\n matrix[7],\n matrix[12],\n matrix[13],\n matrix[15],\n ];\n } else if (matrix.length !== 9) {\n throw new Error(`Invalid matrix length: ${matrix.length}`);\n }\n return matrix as number[];\n};\n\n/**\n * SkPath wraps a CK PathBuilder internally, providing both mutable building\n * methods and immutable query methods. Use snapshot() internally to get\n * an immutable CK Path for read-only operations.\n */\nexport class JsiSkPath\n extends HostObject<CKPathBuilder, \"Path\">\n implements SkPath\n{\n constructor(CanvasKit: CanvasKit, ref: CKPathBuilder) {\n super(CanvasKit, ref, \"Path\");\n }\n\n /** Returns an immutable CK Path snapshot for read-only operations. */\n private asPath() {\n return this.ref.snapshot();\n }\n\n /** Extract an immutable CK Path from a JsiSkPath value (for CK interop). */\n static pathFromValue(value: SkPath) {\n return JsiSkPath.fromValue<CKPathBuilder>(value).snapshot();\n }\n\n // ---- Mutable building methods (deprecated) ----\n\n addPath(src: SkPath, matrix?: SkMatrix, extend = false) {\n warnDeprecatedPathMethod(\n \"addPath\",\n \"Use Skia.PathBuilder.Make().addPath() instead.\"\n );\n const srcBuilder = JsiSkPath.fromValue<CKPathBuilder>(src);\n const srcPath = srcBuilder.snapshot();\n const args = [\n srcPath,\n ...(matrix ? JsiSkMatrix.fromValue<Float32Array>(matrix) : []),\n extend,\n ];\n this.ref.addPath(...args);\n srcPath.delete();\n return this;\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n warnDeprecatedPathMethod(\n \"addArc\",\n \"Use Skia.PathBuilder.Make().addArc() instead.\"\n );\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n warnDeprecatedPathMethod(\n \"addOval\",\n \"Use Skia.Path.Oval() or Skia.PathBuilder.Make().addOval() instead.\"\n );\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n warnDeprecatedPathMethod(\n \"addPoly\",\n \"Use Skia.Path.Polygon() or Skia.PathBuilder.Make().addPoly() instead.\"\n );\n this.ref.addPolygon(\n points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n close\n );\n return this;\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n warnDeprecatedPathMethod(\n \"addRect\",\n \"Use Skia.Path.Rect() or Skia.PathBuilder.Make().addRect() instead.\"\n );\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n return this;\n }\n\n addRRect(rrect: InputRRect, isCCW?: boolean) {\n warnDeprecatedPathMethod(\n \"addRRect\",\n \"Use Skia.Path.RRect() or Skia.PathBuilder.Make().addRRect() instead.\"\n );\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n addCircle(x: number, y: number, r: number) {\n warnDeprecatedPathMethod(\n \"addCircle\",\n \"Use Skia.Path.Circle() or Skia.PathBuilder.Make().addCircle() instead.\"\n );\n this.ref.addCircle(x, y, r);\n return this;\n }\n\n moveTo(x: number, y: number) {\n warnDeprecatedPathMethod(\n \"moveTo\",\n \"Use Skia.PathBuilder.Make().moveTo() instead.\"\n );\n this.ref.moveTo(x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n warnDeprecatedPathMethod(\n \"rMoveTo\",\n \"Use Skia.PathBuilder.Make().rMoveTo() instead.\"\n );\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n warnDeprecatedPathMethod(\n \"lineTo\",\n \"Use Skia.PathBuilder.Make().lineTo() instead.\"\n );\n this.ref.lineTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n warnDeprecatedPathMethod(\n \"rLineTo\",\n \"Use Skia.PathBuilder.Make().rLineTo() instead.\"\n );\n this.ref.rLineTo(x, y);\n return this;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n warnDeprecatedPathMethod(\n \"quadTo\",\n \"Use Skia.PathBuilder.Make().quadTo() instead.\"\n );\n this.ref.quadTo(x1, y1, x2, y2);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n warnDeprecatedPathMethod(\n \"rQuadTo\",\n \"Use Skia.PathBuilder.Make().rQuadTo() instead.\"\n );\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n warnDeprecatedPathMethod(\n \"conicTo\",\n \"Use Skia.PathBuilder.Make().conicTo() instead.\"\n );\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n rConicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n warnDeprecatedPathMethod(\n \"rConicTo\",\n \"Use Skia.PathBuilder.Make().rConicTo() instead.\"\n );\n this.ref.rConicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n warnDeprecatedPathMethod(\n \"cubicTo\",\n \"Use Skia.PathBuilder.Make().cubicTo() instead.\"\n );\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\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 warnDeprecatedPathMethod(\n \"rCubicTo\",\n \"Use Skia.PathBuilder.Make().rCubicTo() instead.\"\n );\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n close() {\n warnDeprecatedPathMethod(\n \"close\",\n \"Use Skia.PathBuilder.Make().close() instead.\"\n );\n this.ref.close();\n return this;\n }\n\n reset() {\n warnDeprecatedPathMethod(\n \"reset\",\n \"Use Skia.PathBuilder.Make().reset() instead.\"\n );\n // CK PathBuilder has no reset — recreate\n const newBuilder = new this.CanvasKit.PathBuilder();\n if (\n this.ref !== null &&\n typeof this.ref === \"object\" &&\n \"delete\" in this.ref &&\n typeof this.ref.delete === \"function\"\n ) {\n this.ref.delete();\n }\n this.ref = newBuilder;\n return this;\n }\n\n rewind() {\n warnDeprecatedPathMethod(\n \"rewind\",\n \"Use Skia.PathBuilder.Make().reset() instead.\"\n );\n return this.reset();\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n warnDeprecatedPathMethod(\n \"arcToOval\",\n \"Use Skia.PathBuilder.Make().arcToOval() instead.\"\n );\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, 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 warnDeprecatedPathMethod(\n \"arcToRotated\",\n \"Use Skia.PathBuilder.Make().arcToRotated() instead.\"\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 rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n warnDeprecatedPathMethod(\n \"rArcTo\",\n \"Use Skia.PathBuilder.Make().rArcTo() instead.\"\n );\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n warnDeprecatedPathMethod(\n \"arcToTangent\",\n \"Use Skia.PathBuilder.Make().arcToTangent() instead.\"\n );\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n setFillType(fill: FillType) {\n warnDeprecatedPathMethod(\n \"setFillType\",\n \"Use Skia.PathBuilder.Make().setFillType() instead.\"\n );\n this.ref.setFillType(getEnum(this.CanvasKit, \"FillType\", fill));\n return this;\n }\n\n setIsVolatile(_volatile: boolean) {\n warnDeprecatedPathMethod(\n \"setIsVolatile\",\n \"Use Skia.PathBuilder.Make().setIsVolatile() instead.\"\n );\n // Not supported in CK PathBuilder — no-op\n return this;\n }\n\n // ---- Mutable path operations (deprecated) ----\n\n offset(dx: number, dy: number) {\n warnDeprecatedPathMethod(\n \"offset\",\n \"Use Skia.PathBuilder.Make().offset() instead.\"\n );\n this.ref.offset(dx, dy);\n return this;\n }\n\n transform(m: InputMatrix) {\n warnDeprecatedPathMethod(\n \"transform\",\n \"Use Skia.PathBuilder.Make().transform() instead.\"\n );\n const matrix = toMatrix3x3(m);\n this.ref.transform(matrix);\n return this;\n }\n\n makeAsWinding() {\n warnDeprecatedPathMethod(\n \"makeAsWinding\",\n \"Use Skia.Path.AsWinding(path) instead.\"\n );\n const path = this.asPath();\n const result = path.makeAsWinding();\n path.delete();\n if (result === null) {\n return null;\n }\n const old = this.ref;\n this.ref = new this.CanvasKit.PathBuilder(result);\n result.delete();\n old.delete();\n return this;\n }\n\n simplify() {\n warnDeprecatedPathMethod(\n \"simplify\",\n \"Use Skia.Path.Simplify(path) instead.\"\n );\n const path = this.asPath();\n const result = path.makeSimplified();\n path.delete();\n if (result === null) {\n return false;\n }\n const old = this.ref;\n this.ref = new this.CanvasKit.PathBuilder(result);\n result.delete();\n old.delete();\n return true;\n }\n\n op(path: SkPath, op: PathOp) {\n warnDeprecatedPathMethod(\"op\", \"Use Skia.Path.MakeFromOp() instead.\");\n const self = this.asPath();\n const other = JsiSkPath.fromValue<CKPathBuilder>(path).snapshot();\n const result = self.makeCombined(\n other,\n getEnum(this.CanvasKit, \"PathOp\", op)\n );\n self.delete();\n other.delete();\n if (result === null) {\n return false;\n }\n const old = this.ref;\n this.ref = new this.CanvasKit.PathBuilder(result);\n result.delete();\n old.delete();\n return true;\n }\n\n dash(on: number, off: number, phase: number) {\n warnDeprecatedPathMethod(\n \"dash\",\n \"Use Skia.Path.Dash(path, on, off, phase) instead.\"\n );\n const path = this.asPath();\n const result = path.makeDashed(on, off, phase);\n path.delete();\n if (result === null) {\n return false;\n }\n const old = this.ref;\n this.ref = new this.CanvasKit.PathBuilder(result);\n result.delete();\n old.delete();\n return true;\n }\n\n stroke(opts?: StrokeOpts) {\n warnDeprecatedPathMethod(\n \"stroke\",\n \"Use Skia.Path.Stroke(path, opts) instead.\"\n );\n const path = this.asPath();\n const result = path.makeStroked(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.miter_limit,\n precision: opts.precision,\n join: optEnum(this.CanvasKit, \"StrokeJoin\", opts.join),\n cap: optEnum(this.CanvasKit, \"StrokeCap\", opts.cap),\n }\n );\n path.delete();\n if (result === null) {\n return null;\n }\n const old = this.ref;\n this.ref = new this.CanvasKit.PathBuilder(result);\n result.delete();\n old.delete();\n return this;\n }\n\n trim(start: number, stop: number, isComplement: boolean) {\n warnDeprecatedPathMethod(\n \"trim\",\n \"Use Skia.Path.Trim(path, start, end, isComplement) instead.\"\n );\n const startT = Math.min(Math.max(start, 0), 1);\n const stopT = Math.min(Math.max(stop, 0), 1);\n if (startT === 0 && stopT === 1 && !isComplement) {\n return this;\n }\n const path = this.asPath();\n const result = path.makeTrimmed(startT, stopT, isComplement);\n path.delete();\n if (result === null) {\n return null;\n }\n const old = this.ref;\n this.ref = new this.CanvasKit.PathBuilder(result);\n result.delete();\n old.delete();\n return this;\n }\n\n // ---- Query methods (use snapshot for read-only) ----\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n computeTightBounds(): SkRect {\n const path = this.asPath();\n const result = new JsiSkRect(this.CanvasKit, path.computeTightBounds());\n path.delete();\n return result;\n }\n\n contains(x: number, y: number) {\n const path = this.asPath();\n const result = path.contains(x, y);\n path.delete();\n return result;\n }\n\n copy() {\n const path = this.asPath();\n const result = new JsiSkPath(\n this.CanvasKit,\n new this.CanvasKit.PathBuilder(path)\n );\n path.delete();\n return result;\n }\n\n equals(other: SkPath) {\n const p1 = this.asPath();\n const p2 = JsiSkPath.fromValue<CKPathBuilder>(other).snapshot();\n const result = p1.equals(p2);\n p1.delete();\n p2.delete();\n return result;\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType(): FillType {\n const path = this.asPath();\n const result = path.getFillType().value;\n path.delete();\n return result;\n }\n\n getPoint(index: number): SkPoint {\n const path = this.asPath();\n const result = new JsiSkPoint(this.CanvasKit, path.getPoint(index));\n path.delete();\n return result;\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return false;\n }\n\n getLastPt() {\n const count = this.ref.countPoints();\n if (count === 0) {\n return { x: 0, y: 0 };\n }\n const path = this.asPath();\n const pt = path.getPoint(count - 1);\n path.delete();\n return { x: pt[0], y: pt[1] };\n }\n\n toSVGString() {\n const path = this.asPath();\n const result = path.toSVGString();\n path.delete();\n return result;\n }\n\n isInterpolatable(path2: SkPath): boolean {\n const p1 = this.asPath();\n const p2 = JsiSkPath.fromValue<CKPathBuilder>(path2).snapshot();\n const result = this.CanvasKit.Path.CanInterpolate(p1, p2);\n p1.delete();\n p2.delete();\n return result;\n }\n\n interpolate(end: SkPath, weight: number, output?: SkPath): SkPath | null {\n const p1 = this.asPath();\n const p2 = JsiSkPath.fromValue<CKPathBuilder>(end).snapshot();\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(p1, p2, weight);\n p1.delete();\n p2.delete();\n if (path === null) {\n return null;\n }\n if (output) {\n const outRef = output as JsiSkPath;\n const old = outRef.ref;\n outRef.ref = new this.CanvasKit.PathBuilder(path);\n path.delete();\n old.delete();\n return output;\n }\n const result = new JsiSkPath(\n this.CanvasKit,\n new this.CanvasKit.PathBuilder(path)\n );\n path.delete();\n return result;\n }\n\n toCmds() {\n const path = this.asPath();\n const cmds = path.toCmds();\n path.delete();\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"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAcA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAEA,MAAMM,YAAY,GAAG;EACnB,CAACC,eAAQ,CAACC,IAAI,GAAG,CAAC;EAClB,CAACD,eAAQ,CAACE,IAAI,GAAG,CAAC;EAClB,CAACF,eAAQ,CAACG,IAAI,GAAG,CAAC;EAClB,CAACH,eAAQ,CAACI,KAAK,GAAG,CAAC;EACnB,CAACJ,eAAQ,CAACK,KAAK,GAAG,CAAC;EACnB,CAACL,eAAQ,CAACM,KAAK,GAAG;AACpB,CAAC;;AAED;AACA,MAAMC,wBAAwB,GAAG,IAAIC,GAAG,CAAS,CAAC;AAElD,MAAMC,wBAAwB,GAAGA,CAC/BC,UAAkB,EAClBC,UAAkB,KACT;EACT,IAAIJ,wBAAwB,CAACK,GAAG,CAACF,UAAU,CAAC,EAAE;IAC5C;EACF;EACAH,wBAAwB,CAACM,GAAG,CAACH,UAAU,CAAC;EACxCI,OAAO,CAACC,IAAI,CACV,8BAA8BL,UAAU,6DAA6DC,UAAU,8FACjH,CAAC;AACH,CAAC;AAEM,MAAMK,WAAW,GAAIC,CAAc,IAAe;EACvD,IAAIC,MAAM,GACRD,CAAC,YAAYE,wBAAW,GACpBC,KAAK,CAACC,IAAI,CAACF,wBAAW,CAACG,SAAS,CAAeL,CAAC,CAAC,CAAC,GACjDA,CAAoC;EAC3C,IAAIC,MAAM,CAACK,MAAM,KAAK,EAAE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AE;UAC3B2J,OAAO,CAACD,IAAI,CAACF,GAAG,CAAC;QACnB;QACA,IAAIG,OAAO,CAAC3J,MAAM,KAAKA,MAAM,IAAIyJ,CAAC,KAAKJ,IAAI,CAACrJ,MAAM,GAAG,CAAC,EAAE;UACtDuJ,GAAG,CAACG,IAAI,CAAC,EAAE,CAAC;QACd;MACF;MACA,OAAOH,GAAG;IACZ,CAAC,EAAE,EAAE,CAAC;IACN,OAAO/D,MAAM;EACf;AACF;AAACtF,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","_Host","_JsiSkPoint","_JsiSkRect","_JsiSkMatrix","CommandCount","PathVerb","Move","Line","Quad","Conic","Cubic","Close","toMatrix3x3","m","matrix","JsiSkMatrix","Array","from","fromValue","length","Error","exports","JsiSkPath","HostObject","constructor","CanvasKit","ref","asPath","snapshot","pathFromValue","value","countPoints","computeTightBounds","path","result","JsiSkRect","delete","contains","x","y","copy","PathBuilder","equals","other","p1","p2","getBounds","getFillType","getPoint","index","JsiSkPoint","isEmpty","isVolatile","getLastPt","count","pt","toSVGString","isInterpolatable","path2","Path","CanInterpolate","interpolate","end","weight","MakeFromPathInterpolation","toCmds","cmds","reduce","acc","cmd","i","push","current"],"sources":["JsiSkPath.ts"],"sourcesContent":["import type { CanvasKit, PathBuilder as CKPathBuilder } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n InputMatrix,\n} from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\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\nexport const toMatrix3x3 = (m: InputMatrix): number[] => {\n let matrix =\n m instanceof JsiSkMatrix\n ? Array.from(JsiSkMatrix.fromValue<Float32Array>(m))\n : (m as Exclude<InputMatrix, SkMatrix>);\n if (matrix.length === 16) {\n matrix = [\n matrix[0],\n matrix[1],\n matrix[3],\n matrix[4],\n matrix[5],\n matrix[7],\n matrix[12],\n matrix[13],\n matrix[15],\n ];\n } else if (matrix.length !== 9) {\n throw new Error(`Invalid matrix length: ${matrix.length}`);\n }\n return matrix as number[];\n};\n\n/**\n * SkPath wraps a CK PathBuilder internally, providing immutable query\n * methods. Use snapshot() internally to get\n * an immutable CK Path for read-only operations.\n */\nexport class JsiSkPath\n extends HostObject<CKPathBuilder, \"Path\">\n implements SkPath\n{\n constructor(CanvasKit: CanvasKit, ref: CKPathBuilder) {\n super(CanvasKit, ref, \"Path\");\n }\n\n /** Returns an immutable CK Path snapshot for read-only operations. */\n private asPath() {\n return this.ref.snapshot();\n }\n\n /** Extract an immutable CK Path from a JsiSkPath value (for CK interop). */\n static pathFromValue(value: SkPath) {\n return JsiSkPath.fromValue<CKPathBuilder>(value).snapshot();\n }\n\n // ---- Query methods (use snapshot for read-only) ----\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n computeTightBounds(): SkRect {\n const path = this.asPath();\n const result = new JsiSkRect(this.CanvasKit, path.computeTightBounds());\n path.delete();\n return result;\n }\n\n contains(x: number, y: number) {\n const path = this.asPath();\n const result = path.contains(x, y);\n path.delete();\n return result;\n }\n\n copy() {\n const path = this.asPath();\n const result = new JsiSkPath(\n this.CanvasKit,\n new this.CanvasKit.PathBuilder(path)\n );\n path.delete();\n return result;\n }\n\n equals(other: SkPath) {\n const p1 = this.asPath();\n const p2 = JsiSkPath.fromValue<CKPathBuilder>(other).snapshot();\n const result = p1.equals(p2);\n p1.delete();\n p2.delete();\n return result;\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType(): FillType {\n const path = this.asPath();\n const result = path.getFillType().value;\n path.delete();\n return result;\n }\n\n getPoint(index: number): SkPoint {\n const path = this.asPath();\n const result = new JsiSkPoint(this.CanvasKit, path.getPoint(index));\n path.delete();\n return result;\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return false;\n }\n\n getLastPt() {\n const count = this.ref.countPoints();\n if (count === 0) {\n return { x: 0, y: 0 };\n }\n const path = this.asPath();\n const pt = path.getPoint(count - 1);\n path.delete();\n return { x: pt[0], y: pt[1] };\n }\n\n toSVGString() {\n const path = this.asPath();\n const result = path.toSVGString();\n path.delete();\n return result;\n }\n\n isInterpolatable(path2: SkPath): boolean {\n const p1 = this.asPath();\n const p2 = JsiSkPath.fromValue<CKPathBuilder>(path2).snapshot();\n const result = this.CanvasKit.Path.CanInterpolate(p1, p2);\n p1.delete();\n p2.delete();\n return result;\n }\n\n interpolate(end: SkPath, weight: number): SkPath | null {\n const p1 = this.asPath();\n const p2 = JsiSkPath.fromValue<CKPathBuilder>(end).snapshot();\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(p1, p2, weight);\n p1.delete();\n p2.delete();\n if (path === null) {\n return null;\n }\n const result = new JsiSkPath(\n this.CanvasKit,\n new this.CanvasKit.PathBuilder(path)\n );\n path.delete();\n return result;\n }\n\n toCmds() {\n const path = this.asPath();\n const cmds = path.toCmds();\n path.delete();\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"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAWA,IAAAC,KAAA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CAACF,GAAG,CAAC;QACnB;QACA,IAAIG,OAAO,CAACrD,MAAM,KAAKA,MAAM,IAAImD,CAAC,KAAKJ,IAAI,CAAC/C,MAAM,GAAG,CAAC,EAAE;UACtDiD,GAAG,CAACG,IAAI,CAAC,EAAE,CAAC;QACd;MACF;MACA,OAAOH,GAAG;IACZ,CAAC,EAAE,EAAE,CAAC;IACN,OAAOlC,MAAM;EACf;AACF;AAACb,OAAA,CAAAC,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1,9 +1,10 @@
1
1
  import type { CanvasKit } from "canvaskit-wasm";
2
- import type { SurfaceFactory } from "../types";
2
+ import type { SkSurface, SurfaceFactory } from "../types";
3
3
  import { Host } from "./Host";
4
4
  import { JsiSkSurface } from "./JsiSkSurface";
5
5
  export declare class JsiSkSurfaceFactory extends Host implements SurfaceFactory {
6
6
  constructor(CanvasKit: CanvasKit);
7
7
  Make(width: number, height: number): JsiSkSurface;
8
8
  MakeOffscreen(width: number, height: number): JsiSkSurface | null;
9
+ MakeFromNativeTexture(_pointer: bigint): SkSurface;
9
10
  }
@@ -34,6 +34,9 @@ class JsiSkSurfaceFactory extends _Host.Host {
34
34
  }
35
35
  return new _JsiSkSurface.JsiSkSurface(this.CanvasKit, surface);
36
36
  }
37
+ MakeFromNativeTexture(_pointer) {
38
+ return (0, _Host.throwNotImplementedOnRNWeb)();
39
+ }
37
40
  }
38
41
  exports.JsiSkSurfaceFactory = JsiSkSurfaceFactory;
39
42
  //# sourceMappingURL=JsiSkSurfaceFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_Host","require","_JsiSkSurface","JsiSkSurfaceFactory","Host","constructor","CanvasKit","Make","width","height","JsiSkSurface","MakeSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","surface","undefined","offscreen","webglContext","GetWebGLContext","grContext","MakeWebGLContext","Error","MakeRenderTarget","exports"],"sources":["JsiSkSurfaceFactory.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SurfaceFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkSurfaceFactory extends Host implements SurfaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(width: number, height: number) {\n return new JsiSkSurface(\n this.CanvasKit,\n this.CanvasKit.MakeSurface(width, height)!\n );\n }\n\n MakeOffscreen(width: number, height: number) {\n // OffscreenCanvas may be unvailable in some environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OC = (globalThis as any).OffscreenCanvas;\n let surface: Surface | null;\n if (OC === undefined) {\n return this.Make(width, height);\n } else {\n const offscreen = new OC(width, height);\n const webglContext = this.CanvasKit.GetWebGLContext(offscreen);\n const grContext = this.CanvasKit.MakeWebGLContext(webglContext);\n if (!grContext) {\n throw new Error(\"Could not make a graphics context\");\n }\n surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);\n }\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n}\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEO,MAAME,mBAAmB,SAASC,UAAI,CAA2B;EACtEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAE;IAClC,OAAO,IAAIC,0BAAY,CACrB,IAAI,CAACJ,SAAS,EACd,IAAI,CAACA,SAAS,CAACK,WAAW,CAACH,KAAK,EAAEC,MAAM,CAC1C,CAAC;EACH;EAEAG,aAAaA,CAACJ,KAAa,EAAEC,MAAc,EAAE;IAC3C;IACA;IACA,MAAMI,EAAE,GAAIC,UAAU,CAASC,eAAe;IAC9C,IAAIC,OAAuB;IAC3B,IAAIH,EAAE,KAAKI,SAAS,EAAE;MACpB,OAAO,IAAI,CAACV,IAAI,CAACC,KAAK,EAAEC,MAAM,CAAC;IACjC,CAAC,MAAM;MACL,MAAMS,SAAS,GAAG,IAAIL,EAAE,CAACL,KAAK,EAAEC,MAAM,CAAC;MACvC,MAAMU,YAAY,GAAG,IAAI,CAACb,SAAS,CAACc,eAAe,CAACF,SAAS,CAAC;MAC9D,MAAMG,SAAS,GAAG,IAAI,CAACf,SAAS,CAACgB,gBAAgB,CAACH,YAAY,CAAC;MAC/D,IAAI,CAACE,SAAS,EAAE;QACd,MAAM,IAAIE,KAAK,CAAC,mCAAmC,CAAC;MACtD;MACAP,OAAO,GAAG,IAAI,CAACV,SAAS,CAACkB,gBAAgB,CAACH,SAAS,EAAEb,KAAK,EAAEC,MAAM,CAAC;IACrE;IACA,IAAI,CAACO,OAAO,EAAE;MACZ,OAAO,IAAI;IACb;IACA,OAAO,IAAIN,0BAAY,CAAC,IAAI,CAACJ,SAAS,EAAEU,OAAO,CAAC;EAClD;AACF;AAACS,OAAA,CAAAtB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_Host","require","_JsiSkSurface","JsiSkSurfaceFactory","Host","constructor","CanvasKit","Make","width","height","JsiSkSurface","MakeSurface","MakeOffscreen","OC","globalThis","OffscreenCanvas","surface","undefined","offscreen","webglContext","GetWebGLContext","grContext","MakeWebGLContext","Error","MakeRenderTarget","MakeFromNativeTexture","_pointer","throwNotImplementedOnRNWeb","exports"],"sources":["JsiSkSurfaceFactory.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { SkSurface, SurfaceFactory } from \"../types\";\n\nimport { Host, throwNotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkSurface } from \"./JsiSkSurface\";\n\nexport class JsiSkSurfaceFactory extends Host implements SurfaceFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(width: number, height: number) {\n return new JsiSkSurface(\n this.CanvasKit,\n this.CanvasKit.MakeSurface(width, height)!\n );\n }\n\n MakeOffscreen(width: number, height: number) {\n // OffscreenCanvas may be unvailable in some environments.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const OC = (globalThis as any).OffscreenCanvas;\n let surface: Surface | null;\n if (OC === undefined) {\n return this.Make(width, height);\n } else {\n const offscreen = new OC(width, height);\n const webglContext = this.CanvasKit.GetWebGLContext(offscreen);\n const grContext = this.CanvasKit.MakeWebGLContext(webglContext);\n if (!grContext) {\n throw new Error(\"Could not make a graphics context\");\n }\n surface = this.CanvasKit.MakeRenderTarget(grContext, width, height);\n }\n if (!surface) {\n return null;\n }\n return new JsiSkSurface(this.CanvasKit, surface);\n }\n\n MakeFromNativeTexture(_pointer: bigint): SkSurface {\n return throwNotImplementedOnRNWeb<SkSurface>();\n }\n}\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAEO,MAAME,mBAAmB,SAASC,UAAI,CAA2B;EACtEC,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAE;IAClC,OAAO,IAAIC,0BAAY,CACrB,IAAI,CAACJ,SAAS,EACd,IAAI,CAACA,SAAS,CAACK,WAAW,CAACH,KAAK,EAAEC,MAAM,CAC1C,CAAC;EACH;EAEAG,aAAaA,CAACJ,KAAa,EAAEC,MAAc,EAAE;IAC3C;IACA;IACA,MAAMI,EAAE,GAAIC,UAAU,CAASC,eAAe;IAC9C,IAAIC,OAAuB;IAC3B,IAAIH,EAAE,KAAKI,SAAS,EAAE;MACpB,OAAO,IAAI,CAACV,IAAI,CAACC,KAAK,EAAEC,MAAM,CAAC;IACjC,CAAC,MAAM;MACL,MAAMS,SAAS,GAAG,IAAIL,EAAE,CAACL,KAAK,EAAEC,MAAM,CAAC;MACvC,MAAMU,YAAY,GAAG,IAAI,CAACb,SAAS,CAACc,eAAe,CAACF,SAAS,CAAC;MAC9D,MAAMG,SAAS,GAAG,IAAI,CAACf,SAAS,CAACgB,gBAAgB,CAACH,YAAY,CAAC;MAC/D,IAAI,CAACE,SAAS,EAAE;QACd,MAAM,IAAIE,KAAK,CAAC,mCAAmC,CAAC;MACtD;MACAP,OAAO,GAAG,IAAI,CAACV,SAAS,CAACkB,gBAAgB,CAACH,SAAS,EAAEb,KAAK,EAAEC,MAAM,CAAC;IACrE;IACA,IAAI,CAACO,OAAO,EAAE;MACZ,OAAO,IAAI;IACb;IACA,OAAO,IAAIN,0BAAY,CAAC,IAAI,CAACJ,SAAS,EAAEU,OAAO,CAAC;EAClD;EAEAS,qBAAqBA,CAACC,QAAgB,EAAa;IACjD,OAAO,IAAAC,gCAA0B,EAAY,CAAC;EAChD;AACF;AAACC,OAAA,CAAAzB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -2,11 +2,25 @@ import type { Skia } from "../skia/types";
2
2
  import { Container, StaticContainer } from "./StaticContainer";
3
3
  import "../skia/NativeSetup";
4
4
  import "../views/api";
5
+ /**
6
+ * Records the scene graph on the JS thread and hands the native recorder to
7
+ * the view, which owns it and replays it on every draw. The Reanimated mapper
8
+ * only pushes the shared values into that recorder through the view id: no
9
+ * Skia object is captured by a worklet, so nothing on the UI runtime holds
10
+ * native memory. The JS wrapper is disposed right after the handoff, so the
11
+ * view is the sole owner and the resources referenced by the recording
12
+ * (images, pictures) are released when the view replaces it or is torn down,
13
+ * not when a garbage collector gets around to a wrapper.
14
+ *
15
+ * Unmounting does not clear the view: the native view can outlive the React
16
+ * tree (exit animations, screen transitions) and keeps showing its last frame
17
+ * until it is torn down, which is when the recording is released.
18
+ */
5
19
  declare class NativeReanimatedContainer extends Container {
6
20
  private nativeId;
7
21
  private mapperId;
8
- private picture;
9
22
  constructor(Skia: Skia, nativeId: number);
23
+ private stopMapper;
10
24
  unmount(): void;
11
25
  redraw(): void;
12
26
  }
@@ -19,62 +19,63 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
19
19
  const {
20
20
  SkiaViewApi
21
21
  } = globalThis;
22
- const nativeDrawOnscreen = (nativeId, recorder, picture) => {
23
- "worklet";
24
22
 
25
- //const start = performance.now();
26
- recorder.play(picture);
27
- //const end = performance.now();
28
- //console.log("Recording time: ", end - start);
29
- SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
30
- };
23
+ /**
24
+ * Records the scene graph on the JS thread and hands the native recorder to
25
+ * the view, which owns it and replays it on every draw. The Reanimated mapper
26
+ * only pushes the shared values into that recorder through the view id: no
27
+ * Skia object is captured by a worklet, so nothing on the UI runtime holds
28
+ * native memory. The JS wrapper is disposed right after the handoff, so the
29
+ * view is the sole owner and the resources referenced by the recording
30
+ * (images, pictures) are released when the view replaces it or is torn down,
31
+ * not when a garbage collector gets around to a wrapper.
32
+ *
33
+ * Unmounting does not clear the view: the native view can outlive the React
34
+ * tree (exit animations, screen transitions) and keeps showing its last frame
35
+ * until it is torn down, which is when the recording is released.
36
+ */
31
37
  class NativeReanimatedContainer extends _StaticContainer.Container {
32
38
  constructor(Skia, nativeId) {
33
39
  super(Skia);
34
40
  this.nativeId = nativeId;
35
41
  _defineProperty(this, "mapperId", null);
36
- _defineProperty(this, "picture", void 0);
37
- this.picture = Skia.Picture.MakePicture(null);
38
42
  }
39
- unmount() {
40
- super.unmount();
43
+ stopMapper() {
41
44
  if (this.mapperId !== null) {
42
- // The mapper closure retains the recorder and its resources (e.g.
43
- // images) on the UI runtime and keeps updating the picture of an
44
- // unmounted view — stop it or it leaks for the lifetime of the app.
45
45
  _ReanimatedProxy.default.stopMapper(this.mapperId);
46
46
  this.mapperId = null;
47
47
  }
48
48
  }
49
+ unmount() {
50
+ super.unmount();
51
+ this.stopMapper();
52
+ }
49
53
  redraw() {
50
- if (this.mapperId !== null) {
51
- _ReanimatedProxy.default.stopMapper(this.mapperId);
52
- this.mapperId = null;
53
- }
54
+ this.stopMapper();
54
55
  if (this.unmounted) {
55
56
  return;
56
57
  }
57
58
  const recorder = new _ReanimatedRecorder.ReanimatedRecorder(this.Skia);
58
- const {
59
- nativeId,
60
- picture
61
- } = this;
62
59
  (0, _Visitor.visit)(recorder, this.root);
63
60
  const sharedValues = recorder.getSharedValues();
64
- const sharedRecorder = recorder.getRecorder();
65
- // Draw first frame
66
- _ReanimatedProxy.default.runOnUI(() => {
67
- "worklet";
68
-
69
- nativeDrawOnscreen(nativeId, sharedRecorder, picture);
70
- })();
71
- // Animate
61
+ const {
62
+ nativeId
63
+ } = this;
64
+ const nativeRecorder = recorder.getRecorder();
65
+ // stopMapper() only takes effect on the UI thread later, so the previous
66
+ // mapper can still fire after the new recording is installed. Tagging the
67
+ // updates with the recording id lets the view ignore them.
68
+ const recorderId = nativeRecorder.getId();
69
+ // The view takes ownership of the recorder and draws the first frame. The
70
+ // wrapper is disposed right away: it would otherwise co-own the recording
71
+ // until the JS garbage collector finalizes it.
72
+ SkiaViewApi.setJsiProperty(nativeId, "recorder", nativeRecorder);
73
+ nativeRecorder.dispose();
72
74
  if (sharedValues.length > 0) {
73
75
  this.mapperId = _ReanimatedProxy.default.startMapper(() => {
74
76
  "worklet";
75
77
 
76
- sharedRecorder.applyUpdates(sharedValues);
77
- nativeDrawOnscreen(nativeId, sharedRecorder, picture);
78
+ SkiaViewApi.applyUpdates(nativeId, recorderId, sharedValues);
78
79
  }, sharedValues);
79
80
  }
80
81
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_ReanimatedRecorder","_StaticContainer","_Visitor","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SkiaViewApi","globalThis","nativeDrawOnscreen","nativeId","recorder","picture","play","setJsiProperty","NativeReanimatedContainer","Container","constructor","Skia","Picture","MakePicture","unmount","mapperId","Rea","stopMapper","redraw","unmounted","ReanimatedRecorder","visit","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","hasWarnedAboutReanimatedSupport","reanimatedSupportError","REANIMATED_VERSION_MAJOR","createContainer","HAS_REANIMATED_4","HAS_REANIMATED_3","message","__DEV__","Error","console","error","StaticContainer","exports"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkPicture } from \"../skia/types\";\nimport {\n HAS_REANIMATED_3,\n HAS_REANIMATED_4,\n REANIMATED_VERSION_MAJOR,\n} from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\n// create local reference for `strictGlobal` option in Worklets\nconst { SkiaViewApi } = globalThis;\n\nconst nativeDrawOnscreen = (\n nativeId: number,\n recorder: JsiRecorder,\n picture: SkPicture\n) => {\n \"worklet\";\n\n //const start = performance.now();\n recorder.play(picture);\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n private picture: SkPicture;\n\n constructor(\n Skia: Skia,\n private nativeId: number\n ) {\n super(Skia);\n this.picture = Skia.Picture.MakePicture(null)!;\n }\n\n unmount() {\n super.unmount();\n if (this.mapperId !== null) {\n // The mapper closure retains the recorder and its resources (e.g.\n // images) on the UI runtime and keeps updating the picture of an\n // unmounted view — stop it or it leaks for the lifetime of the app.\n Rea.stopMapper(this.mapperId);\n this.mapperId = null;\n }\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n this.mapperId = null;\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new ReanimatedRecorder(this.Skia);\n const { nativeId, picture } = this;\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n // Draw first frame\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n })();\n // Animate\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n }, sharedValues);\n }\n }\n}\n\nlet hasWarnedAboutReanimatedSupport = false;\n\nconst reanimatedSupportError = () => {\n if (REANIMATED_VERSION_MAJOR !== null && REANIMATED_VERSION_MAJOR >= 4) {\n return (\n \"React Native Skia requires react-native-worklets >= 0.7.0 for its \" +\n \"Reanimated integration on native platforms. Reanimated 4 is \" +\n \"installed, but react-native-worklets is missing or too old. \" +\n \"Please install or upgrade react-native-worklets.\"\n );\n }\n return (\n \"React Native Skia requires Reanimated 4 (react-native-worklets >= \" +\n \"0.7.0) for its Reanimated integration on native platforms. \" +\n \"Reanimated 3 is not supported anymore: Skia objects cannot be used \" +\n \"inside worklets or shared values with it. \" +\n \"Please upgrade to react-native-reanimated >= 4.0.0.\"\n );\n};\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n if (HAS_REANIMATED_4 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n if (HAS_REANIMATED_3 && !HAS_REANIMATED_4) {\n const message = reanimatedSupportError();\n if (__DEV__) {\n // Fail loudly in development — a silent fallback to static rendering\n // would only be noticed as frozen animations.\n throw new Error(message);\n }\n if (!hasWarnedAboutReanimatedSupport) {\n hasWarnedAboutReanimatedSupport = true;\n console.error(\n `${message} Falling back to static rendering (animations will not run).`\n );\n }\n }\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAOA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAA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;QACpC,SAAS;;QACTJ,cAAc,CAACK,YAAY,CAACP,YAAY,CAAC;QACzCrB,kBAAkB,CAACC,QAAQ,EAAEsB,cAAc,EAAEpB,OAAO,CAAC;MACvD,CAAC,EAAEkB,YAAY,CAAC;IAClB;EACF;AACF;AAEA,IAAIQ,+BAA+B,GAAG,KAAK;AAE3C,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACnC,IAAIC,uCAAwB,KAAK,IAAI,IAAIA,uCAAwB,IAAI,CAAC,EAAE;IACtE,OACE,oEAAoE,GACpE,8DAA8D,GAC9D,8DAA8D,GAC9D,kDAAkD;EAEtD;EACA,OACE,oEAAoE,GACpE,6DAA6D,GAC7D,qEAAqE,GACrE,4CAA4C,GAC5C,qDAAqD;AAEzD,CAAC;AAEM,MAAMC,eAAe,GAAGA,CAACvB,IAAU,EAAER,QAAgB,KAAK;EAC/D,IAAIgC,+BAAgB,IAAIhC,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAIK,yBAAyB,CAACG,IAAI,EAAER,QAAQ,CAAC;EACtD,CAAC,MAAM;IACL,IAAIiC,+BAAgB,IAAI,CAACD,+BAAgB,EAAE;MACzC,MAAME,OAAO,GAAGL,sBAAsB,CAAC,CAAC;MACxC,IAAIM,OAAO,EAAE;QACX;QACA;QACA,MAAM,IAAIC,KAAK,CAACF,OAAO,CAAC;MAC1B;MACA,IAAI,CAACN,+BAA+B,EAAE;QACpCA,+BAA+B,GAAG,IAAI;QACtCS,OAAO,CAACC,KAAK,CACX,GAAGJ,OAAO,8DACZ,CAAC;MACH;IACF;IACA,OAAO,IAAIK,gCAAe,CAAC/B,IAAI,EAAER,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACwC,OAAA,CAAAT,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_ReanimatedRecorder","_StaticContainer","_Visitor","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","SkiaViewApi","globalThis","NativeReanimatedContainer","Container","constructor","Skia","nativeId","stopMapper","mapperId","Rea","unmount","redraw","unmounted","recorder","ReanimatedRecorder","visit","root","sharedValues","getSharedValues","nativeRecorder","getRecorder","recorderId","getId","setJsiProperty","dispose","length","startMapper","applyUpdates","hasWarnedAboutReanimatedSupport","reanimatedSupportError","REANIMATED_VERSION_MAJOR","createContainer","HAS_REANIMATED_4","HAS_REANIMATED_3","message","__DEV__","Error","console","error","StaticContainer","exports"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia } from \"../skia/types\";\nimport {\n HAS_REANIMATED_3,\n HAS_REANIMATED_4,\n REANIMATED_VERSION_MAJOR,\n} from \"../external/reanimated/renderHelpers\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\n// create local reference for `strictGlobal` option in Worklets\nconst { SkiaViewApi } = globalThis;\n\n/**\n * Records the scene graph on the JS thread and hands the native recorder to\n * the view, which owns it and replays it on every draw. The Reanimated mapper\n * only pushes the shared values into that recorder through the view id: no\n * Skia object is captured by a worklet, so nothing on the UI runtime holds\n * native memory. The JS wrapper is disposed right after the handoff, so the\n * view is the sole owner and the resources referenced by the recording\n * (images, pictures) are released when the view replaces it or is torn down,\n * not when a garbage collector gets around to a wrapper.\n *\n * Unmounting does not clear the view: the native view can outlive the React\n * tree (exit animations, screen transitions) and keeps showing its last frame\n * until it is torn down, which is when the recording is released.\n */\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(\n Skia: Skia,\n private nativeId: number\n ) {\n super(Skia);\n }\n\n private stopMapper() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n this.mapperId = null;\n }\n }\n\n unmount() {\n super.unmount();\n this.stopMapper();\n }\n\n redraw() {\n this.stopMapper();\n if (this.unmounted) {\n return;\n }\n const recorder = new ReanimatedRecorder(this.Skia);\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const { nativeId } = this;\n const nativeRecorder = recorder.getRecorder();\n // stopMapper() only takes effect on the UI thread later, so the previous\n // mapper can still fire after the new recording is installed. Tagging the\n // updates with the recording id lets the view ignore them.\n const recorderId = nativeRecorder.getId();\n // The view takes ownership of the recorder and draws the first frame. The\n // wrapper is disposed right away: it would otherwise co-own the recording\n // until the JS garbage collector finalizes it.\n SkiaViewApi.setJsiProperty(nativeId, \"recorder\", nativeRecorder);\n nativeRecorder.dispose();\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n SkiaViewApi.applyUpdates(nativeId, recorderId, sharedValues);\n }, sharedValues);\n }\n }\n}\n\nlet hasWarnedAboutReanimatedSupport = false;\n\nconst reanimatedSupportError = () => {\n if (REANIMATED_VERSION_MAJOR !== null && REANIMATED_VERSION_MAJOR >= 4) {\n return (\n \"React Native Skia requires react-native-worklets >= 0.7.0 for its \" +\n \"Reanimated integration on native platforms. Reanimated 4 is \" +\n \"installed, but react-native-worklets is missing or too old. \" +\n \"Please install or upgrade react-native-worklets.\"\n );\n }\n return (\n \"React Native Skia requires Reanimated 4 (react-native-worklets >= \" +\n \"0.7.0) for its Reanimated integration on native platforms. \" +\n \"Reanimated 3 is not supported anymore: Skia objects cannot be used \" +\n \"inside worklets or shared values with it. \" +\n \"Please upgrade to react-native-reanimated >= 4.0.0.\"\n );\n};\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n if (HAS_REANIMATED_4 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n if (HAS_REANIMATED_3 && !HAS_REANIMATED_4) {\n const message = reanimatedSupportError();\n if (__DEV__) {\n // Fail loudly in development — a silent fallback to static rendering\n // would only be noticed as frozen animations.\n throw new Error(message);\n }\n if (!hasWarnedAboutReanimatedSupport) {\n hasWarnedAboutReanimatedSupport = true;\n console.error(\n `${message} Falling back to static rendering (animations will not run).`\n );\n }\n }\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAMA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEAA,OAAA;AACAA,OAAA;AAAsB,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEtB;AACA,MAAM;EAAEgB;AAAY,C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AACjB,QAAQ,GAAGC,wBAAG,CAACiB,WAAW,CAAC,MAAM;QACpC,SAAS;;QACT1B,WAAW,CAAC2B,YAAY,CAACrB,QAAQ,EAAEe,UAAU,EAAEJ,YAAY,CAAC;MAC9D,CAAC,EAAEA,YAAY,CAAC;IAClB;EACF;AACF;AAEA,IAAIW,+BAA+B,GAAG,KAAK;AAE3C,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACnC,IAAIC,uCAAwB,KAAK,IAAI,IAAIA,uCAAwB,IAAI,CAAC,EAAE;IACtE,OACE,oEAAoE,GACpE,8DAA8D,GAC9D,8DAA8D,GAC9D,kDAAkD;EAEtD;EACA,OACE,oEAAoE,GACpE,6DAA6D,GAC7D,qEAAqE,GACrE,4CAA4C,GAC5C,qDAAqD;AAEzD,CAAC;AAEM,MAAMC,eAAe,GAAGA,CAAC1B,IAAU,EAAEC,QAAgB,KAAK;EAC/D,IAAI0B,+BAAgB,IAAI1B,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAIJ,yBAAyB,CAACG,IAAI,EAAEC,QAAQ,CAAC;EACtD,CAAC,MAAM;IACL,IAAI2B,+BAAgB,IAAI,CAACD,+BAAgB,EAAE;MACzC,MAAME,OAAO,GAAGL,sBAAsB,CAAC,CAAC;MACxC,IAAIM,OAAO,EAAE;QACX;QACA;QACA,MAAM,IAAIC,KAAK,CAACF,OAAO,CAAC;MAC1B;MACA,IAAI,CAACN,+BAA+B,EAAE;QACpCA,+BAA+B,GAAG,IAAI;QACtCS,OAAO,CAACC,KAAK,CACX,GAAGJ,OAAO,8DACZ,CAAC;MACH;IACF;IACA,OAAO,IAAIK,gCAAe,CAAClC,IAAI,EAAEC,QAAQ,CAAC;EAC5C;AACF,CAAC;AAACkC,OAAA,CAAAT,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -57,6 +57,10 @@ global.SkiaViewApi = {
57
57
  // The view may already have unmounted (e.g. a trailing animation frame).
58
58
  (_this$views = this.views[`${nativeId}`]) === null || _this$views === void 0 || _this$views.redraw();
59
59
  },
60
+ applyUpdates() {
61
+ // Web canvases are driven from JS (see Container.web.ts); there is no
62
+ // view-owned recorder to update.
63
+ },
60
64
  makeImageSnapshot(nativeId, rect) {
61
65
  const view = this.views[`${nativeId}`];
62
66
  if (!view) {
@@ -1 +1 @@
1
- {"version":3,"names":["global","SkiaViewApi","views","deferedPictures","unregisteredViews","Set","deferedOnSize","web","registerView","nativeId","view","delete","setPicture","unregisterView","add","setJsiProperty","name","value","id","has","size","getSize","width","height","requestRedraw","_this$views","redraw","makeImageSnapshot","rect","Error","makeImageSnapshotAsync","Promise","resolve","reject","result","_default","exports","default"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureViewHandle } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureViewHandle>;\n deferedPictures: Record<string, SkPicture>;\n unregisteredViews: Set<string>;\n registerView(nativeId: string, view: SkiaPictureViewHandle): void;\n unregisterView(nativeId: string): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n unregisteredViews: new Set<string>(),\n deferedOnSize: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureViewHandle) {\n this.unregisteredViews.delete(nativeId);\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n delete this.deferedPictures[nativeId];\n }\n this.views[nativeId] = view;\n },\n unregisterView(nativeId: string) {\n // Views must be removed on unmount: the handle's closures capture the\n // canvas element, so a stale entry retains the whole detached DOM tree.\n this.unregisteredViews.add(nativeId);\n delete this.views[nativeId];\n delete this.deferedPictures[nativeId];\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n const id = `${nativeId}`;\n if (this.views[id]) {\n this.views[id].setPicture(value);\n } else if (!this.unregisteredViews.has(id)) {\n this.deferedPictures[id] = value;\n }\n // Otherwise the view has unmounted (e.g. a trailing animation frame):\n // drop the picture instead of deferring it for an id that will never\n // register again, which would retain it forever.\n }\n },\n size(nativeId: number) {\n if (this.views[`${nativeId}`]) {\n return this.views[`${nativeId}`].getSize();\n } else {\n return { width: 0, height: 0 };\n }\n },\n requestRedraw(nativeId: number) {\n // The view may already have unmounted (e.g. a trailing animation frame).\n this.views[`${nativeId}`]?.redraw();\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n const view = this.views[`${nativeId}`];\n if (!view) {\n throw new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n );\n }\n return view.makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const view = this.views[`${nativeId}`];\n if (!view) {\n reject(\n new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n )\n );\n return;\n }\n const result = view.makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":";;;;;;AAAA;;AAaAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,iBAAiB,EAAE,IAAIC,GAAG,CAAS,CAAC;EACpCC,aAAa,EAAE,CAAC,CAAC;EACjBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAA2B,EAAE;IAC1D,IAAI,CAACN,iBAAiB,CAACO,MAAM,CAACF,QAAQ,CAAC;IACvC;IACA,IAAI,IAAI,CAACN,eAAe,CAACM,QAAQ,CAAC,EAAE;MAClC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,OAAI,CAACvB,KAAK,CAAC,GAAGO,QAAQ,EAAE,CAAC,cAAAgB,WAAA,eAAzBA,WAAA,CAA2BC,MAAM,CAAC,CAAC;EACrC,CAAC;EACDC,iBAAiBA,CAAClB,QAAgB,EAAEmB,IAAa,EAAE;IACjD,MAAMlB,IAAI,GAAG,IAAI,CAACR,KAAK,CAAC,GAAGO,QAAQ,EAAE,CAAC;IACtC,IAAI,CAACC,IAAI,EAAE;MACT,MAAM,IAAImB,KAAK,CACb,kDAAkDpB,QAAQ,4CAC5D,CAAC;IACH;IACA,OAAOC,IAAI,CAACiB,iBAAiB,CAACC,IAAI,CAAC;EACrC,CAAC;EACDE,sBAAsBA,CAACrB,QAAgB,EAAEmB,IAAa,EAAE;IACtD,OAAO,IAAIG,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMvB,IAAI,GAAG,IAAI,CAACR,KAAK,CAAC,GAAGO,QAAQ,EAAE,CAAC;MACtC,IAAI,CAACC,IAAI,EAAE;QACTuB,MAAM,CACJ,IAAIJ,KAAK,CACP,kDAAkDpB,QAAQ,4CAC5D,CACF,CAAC;QACD;MACF;MACA,MAAMyB,MAAM,GAAGxB,IAAI,CAACiB,iBAAiB,CAACC,IAAI,CAAC;MAC3C,IAAIM,MAAM,EAAE;QACVF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,MAAM;QACLD,MAAM,CAAC,IAAIJ,KAAK,CAAC,+BAA+B,CAAC,CAAC;MACpD;IACF,CAAC,CAAC;EACJ;AACF,CAAoB;;AAEpB;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["global","SkiaViewApi","views","deferedPictures","unregisteredViews","Set","deferedOnSize","web","registerView","nativeId","view","delete","setPicture","unregisterView","add","setJsiProperty","name","value","id","has","size","getSize","width","height","requestRedraw","_this$views","redraw","applyUpdates","makeImageSnapshot","rect","Error","makeImageSnapshotAsync","Promise","resolve","reject","result","_default","exports","default"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureViewHandle } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureViewHandle>;\n deferedPictures: Record<string, SkPicture>;\n unregisteredViews: Set<string>;\n registerView(nativeId: string, view: SkiaPictureViewHandle): void;\n unregisterView(nativeId: string): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n unregisteredViews: new Set<string>(),\n deferedOnSize: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureViewHandle) {\n this.unregisteredViews.delete(nativeId);\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n delete this.deferedPictures[nativeId];\n }\n this.views[nativeId] = view;\n },\n unregisterView(nativeId: string) {\n // Views must be removed on unmount: the handle's closures capture the\n // canvas element, so a stale entry retains the whole detached DOM tree.\n this.unregisteredViews.add(nativeId);\n delete this.views[nativeId];\n delete this.deferedPictures[nativeId];\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n const id = `${nativeId}`;\n if (this.views[id]) {\n this.views[id].setPicture(value);\n } else if (!this.unregisteredViews.has(id)) {\n this.deferedPictures[id] = value;\n }\n // Otherwise the view has unmounted (e.g. a trailing animation frame):\n // drop the picture instead of deferring it for an id that will never\n // register again, which would retain it forever.\n }\n },\n size(nativeId: number) {\n if (this.views[`${nativeId}`]) {\n return this.views[`${nativeId}`].getSize();\n } else {\n return { width: 0, height: 0 };\n }\n },\n requestRedraw(nativeId: number) {\n // The view may already have unmounted (e.g. a trailing animation frame).\n this.views[`${nativeId}`]?.redraw();\n },\n applyUpdates() {\n // Web canvases are driven from JS (see Container.web.ts); there is no\n // view-owned recorder to update.\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n const view = this.views[`${nativeId}`];\n if (!view) {\n throw new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n );\n }\n return view.makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const view = this.views[`${nativeId}`];\n if (!view) {\n reject(\n new Error(\n `Cannot make image snapshot: view with nativeID ${nativeId} is not registered (it may have unmounted)`\n )\n );\n return;\n }\n const result = view.makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":";;;;;;AAAA;;AAaAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,iBAAiB,EAAE,IAAIC,GAAG,CAAS,CAAC;EACpCC,aAAa,EAAE,CAAC,CAAC;EACjBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAA2B,EAAE;IAC1D,IAAI,CAACN,iBAAiB,CAACO,MAAM,CAACF,QAAQ,CAAC;IACvC;IACA,IAAI,IAAI,CAACN,eAAe,CAACM,QAAQ,CAAC,EAAE;MAClCC,IAAI,CAACE,UAAU,CAAC,IAAI,CAACT,eAAe,CAACM,QAAQ,CAAc,CAAC;MAC5D,OAAO,IAAI,CAACN,eAAe,CAACM,QAAQ,CAAC;IACvC;IACA,IAAI,CAACP,KAAK,CAACO,QAAQ,CAAC,GAAGC,IAAI;EAC7B,CAAC;EACDG,cAAcA,CAACJ,QAAgB,EAAE;IAC/B;IACA;IACA,IAAI,CAACL,iBAAiB,CAACU,GAAG,CAACL,QAAQ,CAAC;IACpC,OAAO,IAAI,CAACP,KA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MACT,MAAM,IAAIoB,KAAK,CACb,kDAAkDrB,QAAQ,4CAC5D,CAAC;IACH;IACA,OAAOC,IAAI,CAACkB,iBAAiB,CAACC,IAAI,CAAC;EACrC,CAAC;EACDE,sBAAsBA,CAACtB,QAAgB,EAAEoB,IAAa,EAAE;IACtD,OAAO,IAAIG,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMxB,IAAI,GAAG,IAAI,CAACR,KAAK,CAAC,GAAGO,QAAQ,EAAE,CAAC;MACtC,IAAI,CAACC,IAAI,EAAE;QACTwB,MAAM,CACJ,IAAIJ,KAAK,CACP,kDAAkDrB,QAAQ,4CAC5D,CACF,CAAC;QACD;MACF;MACA,MAAM0B,MAAM,GAAGzB,IAAI,CAACkB,iBAAiB,CAACC,IAAI,CAAC;MAC3C,IAAIM,MAAM,EAAE;QACVF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,MAAM;QACLD,MAAM,CAAC,IAAIJ,KAAK,CAAC,+BAA+B,CAAC,CAAC;MACpD;IACF,CAAC,CAAC;EACJ;AACF,CAAoB;;AAEpB;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe,CAAC,CAAC","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import type { ViewProps } from "react-native";
2
+ import type { SharedValue } from "react-native-reanimated";
2
3
  import type { SkImage, SkPicture, SkRect, SkSize } from "../skia/types";
3
4
  export type NativeSkiaViewProps = ViewProps & {
4
5
  debug?: boolean;
@@ -22,6 +23,14 @@ export interface ISkiaViewApi {
22
23
  web?: boolean;
23
24
  setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
24
25
  requestRedraw: (nativeId: number) => void;
26
+ /**
27
+ * Reads the shared values into the recording held for the view and
28
+ * schedules a redraw. Native only; called from a worklet on every frame.
29
+ * Until the view registers, the recording is queued for it and kept
30
+ * current all the same. Ignored when the recording `recorderId` is neither
31
+ * held by the view nor queued for it.
32
+ */
33
+ applyUpdates: (nativeId: number, recorderId: number, values: SharedValue<unknown>[]) => void;
25
34
  makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
26
35
  makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;
27
36
  size: (nativeId: number) => SkSize;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport type AndroidSurfaceType = \"SurfaceView\" | \"TextureView\";\n\nexport interface AndroidCanvasProps {\n /**\n * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to\n * `TextureView` otherwise; both composite correctly in React Native stacking\n * order without further flags.\n */\n surfaceType?: AndroidSurfaceType;\n /**\n * SurfaceView only: composite above every React Native view in the window,\n * ignoring `zIndex`. Ignored for TextureView. Defaults to false.\n */\n zOrderOnTop?: boolean;\n}\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n size: (nativeId: number) => SkSize;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n\n /**\n * Declares that the canvas covers every pixel of its bounds. On Android an\n * opaque canvas is backed by a `SurfaceView` by default, the cheapest path\n * (see `android.surfaceType`). Defaults to false.\n */\n opaque?: boolean;\n\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android\n * the extra precision survives composition only when combined with `opaque`.\n */\n highBitDepth?: boolean;\n\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n\n // On web, only 16 WebGL contextes are allowed. If the drawing is non-animated, set\n // __destroyWebGLContextAfterRender to true to release the context after each draw.\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n androidWarmup?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { SkImage, SkPicture, SkRect, SkSize } from \"../skia/types\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n debug?: boolean;\n opaque?: boolean;\n};\n\nexport type AndroidSurfaceType = \"SurfaceView\" | \"TextureView\";\n\nexport interface AndroidCanvasProps {\n /**\n * Backing view. Defaults to `SurfaceView` when the canvas is `opaque` and to\n * `TextureView` otherwise; both composite correctly in React Native stacking\n * order without further flags.\n */\n surfaceType?: AndroidSurfaceType;\n /**\n * SurfaceView only: composite above every React Native view in the window,\n * ignoring `zIndex`. Ignored for TextureView. Defaults to false.\n */\n zOrderOnTop?: boolean;\n}\n\nexport interface ISkiaViewApi {\n web?: boolean;\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n requestRedraw: (nativeId: number) => void;\n /**\n * Reads the shared values into the recording held for the view and\n * schedules a redraw. Native only; called from a worklet on every frame.\n * Until the view registers, the recording is queued for it and kept\n * current all the same. Ignored when the recording `recorderId` is neither\n * held by the view nor queued for it.\n */\n applyUpdates: (\n nativeId: number,\n recorderId: number,\n values: SharedValue<unknown>[]\n ) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n makeImageSnapshotAsync: (nativeId: number, rect?: SkRect) => Promise<SkImage>;\n size: (nativeId: number) => SkSize;\n}\n\nexport interface SkiaBaseViewProps extends ViewProps {\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n\n /**\n * Declares that the canvas covers every pixel of its bounds. On Android an\n * opaque canvas is backed by a `SurfaceView` by default, the cheapest path\n * (see `android.surfaceType`). Defaults to false.\n */\n opaque?: boolean;\n\n /**\n * Renders into a surface with more than 8 bits per channel (16-bit float on\n * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android\n * the extra precision survives composition only when combined with `opaque`.\n */\n highBitDepth?: boolean;\n\n /** Android-only rendering options. Ignored on iOS and web. */\n android?: AndroidCanvasProps;\n\n // On web, only 16 WebGL contextes are allowed. If the drawing is non-animated, set\n // __destroyWebGLContextAfterRender to true to release the context after each draw.\n __destroyWebGLContextAfterRender?: boolean;\n}\n\nexport interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {\n picture?: SkPicture;\n androidWarmup?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["IPlatform.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { NodeHandle, ViewComponent } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\n\nexport interface IPlatform {\n OS: string;\n PixelRatio: number;\n findNodeHandle: (\n componentOrHandle:\n | null\n | number\n | React.Component<any, any>\n | React.ComponentClass<any>\n ) => null | NodeHandle;\n resolveAsset: (source: DataModule) => string;\n View: typeof ViewComponent;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["IPlatform.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { NodeHandle, ViewComponent } from \"react-native\";\n\nimport type { DataModule } from \"../skia/types\";\n\nexport interface IPlatform {\n OS: string;\n PixelRatio: number;\n findNodeHandle: (\n componentOrHandle:\n null | number | React.Component<any, any> | React.ComponentClass<any>\n ) => null | NodeHandle;\n resolveAsset: (source: DataModule) => string;\n View: typeof ViewComponent;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["export enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n \"worklet\";\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n \"worklet\";\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n \"worklet\";\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n \"worklet\";\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n \"worklet\";\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":"AAAA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA6BvB,SAASC,MAAMA,CACbC,IAAiB,EACjBC,IAAY,EACZC,GAAW,EACXC,cAAsB,EACtBC,eAAuB,EACvBC,CAAS,EACD;EACR,SAAS;;EACT,QAAQL,IAAI;IACV,KAAKF,WAAW,CAACQ,QAAQ;MACvB,OAAOD,CAAC;IACV,KAAKP,WAAW,CAACS,KAAK;MACpB,IAAIN,IAAI,GAAGC,GAAG,GAAGD,IAAI,GAAGE,cAAc,EAAE;QACtC,OAAOA,cAAc;MACvB;MACA,OAAOC,eAAe;IACxB,KAAKN,WAAW,CAACU,MAAM;IACvB;MACE,OAAON,GAAG;EACd;AACF;AAEA,SAASO,aAAaA,CAACC,KAAa,EAAwB;EAC1D,SAAS;;EACT,OACEA,KAAK,KAAKZ,WAAW,CAACU,MAAM,IAC5B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EAAE;MACzBP,aAAa,CAACC,aAAa,GAAGI,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC;MAC/CP,aAAa,CAACE,cAAc,GAAGG,KAAK,CAACE,MAAM,GAAG,CAAC,CAAC;MAChDP,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;MACjDP,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACC,MAAM,GAAG,CAAC,CAAC;IACpD,CAAC,MAAM;MACL,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAE,EAAEC,CAAC,EAAE;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAC,CAAC,EAAE;UACjBR,aAAa,CAACC,aAAa,GAAGI,KAAK,CAACG,CAAC,GAAG,CAAC,CAAC;UAC1CR,aAAa,CAACE,cAAc,GAAGG,KAAK,CAACG,CAAC,CAAC;UACvCR,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACE,CAAC,GAAG,CAAC,CAAC;UAC5CR,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACE,CAAC,CAAC;UACzC;QACF;MACF;IACF;EACF;EAEA,OAAOT,mBAAmB,CAACb,CAAC,EAAEc,aAAa,EAAEP,mBAAmB,CAAC;AACnE","ignoreList":[]}
1
+ {"version":3,"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["export enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n ExtrapolationConfig | Extrapolate | string | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n \"worklet\";\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n \"worklet\";\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n \"worklet\";\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n \"worklet\";\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n \"worklet\";\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":"AAAA,WAAYA,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA0BvB,SAASC,MAAMA,CACbC,IAAiB,EACjBC,IAAY,EACZC,GAAW,EACXC,cAAsB,EACtBC,eAAuB,EACvBC,CAAS,EACD;EACR,SAAS;;EACT,QAAQL,IAAI;IACV,KAAKF,WAAW,CAACQ,QAAQ;MACvB,OAAOD,CAAC;IACV,KAAKP,WAAW,CAACS,KAAK;MACpB,IAAIN,IAAI,GAAGC,GAAG,GAAGD,IAAI,GAAGE,cAAc,EAAE;QACtC,OAAOA,cAAc;MACvB;MACA,OAAOC,eAAe;IACxB,KAAKN,WAAW,CAACU,MAAM;IACvB;MACE,OAAON,GAAG;EACd;AACF;AAEA,SAASO,aAAaA,CAACC,KAAa,EAAwB;EAC1D,SAAS;;EACT,OACEA,KAAK,KAAKZ,WAAW,CAACU,MAAM,IAC5BE,KAAK,KAAKZ,WAAW,CAACS,KAAK,IAC3BG,KAAK,KAAKZ,WAAW,CAACQ,QAAQ;AAElC;;AAEA;AACA;AACA,OAAO,SAASK,4BAA4BA,CAC1CX,IAAuB,EACM;EAC7B,SAAS;;EACT;EACA,MAAMY,mBAAgD,GAAG;IACvDC,eAAe,EAAEf,WAAW,CAACU,MAAM;IACnCM,gBAAgB,EAAEhB,WAAW,CAACU;EAChC,CAAC;EAED,IAAI,CAACR,IAAI,EAAE;IACT,OAAOY,mBAAmB;EAC5B;E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CAAC,EAAEA,CAAC,GAAGD,MAAM,EAAE,EAAEC,CAAC,EAAE;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAC,CAAC,EAAE;UACjBR,aAAa,CAACC,aAAa,GAAGI,KAAK,CAACG,CAAC,GAAG,CAAC,CAAC;UAC1CR,aAAa,CAACE,cAAc,GAAGG,KAAK,CAACG,CAAC,CAAC;UACvCR,aAAa,CAAChB,cAAc,GAAGsB,MAAM,CAACE,CAAC,GAAG,CAAC,CAAC;UAC5CR,aAAa,CAACf,eAAe,GAAGqB,MAAM,CAACE,CAAC,CAAC;UACzC;QACF;MACF;IACF;EACF;EAEA,OAAOT,mBAAmB,CAACb,CAAC,EAAEc,aAAa,EAAEP,mBAAmB,CAAC;AACnE","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","Skia","useRawData","imgFactory","Image","MakeImageFromEncoded","bind","useImage","source","onError","makeImageFromView","viewRef","callback","OS","Promise","reject","Error","viewTag","findNodeHandle","current","MakeImageFromViewTag"],"sources":["Image.ts"],"sourcesContent":["import { Platform } from \"../../Platform\";\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam, SkImage } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n\n/**\n * Creates an image from a given view reference. NOTE: This method has different implementations\n * on web/native. On web, the callback is called with the view ref and the callback is expected to\n * return a promise that resolves to a Skia Image object. On native, the view ref is used to\n * find the view tag and the Skia Image object is created from the view tag. This means that on web\n * you will need to implement the logic to create the image from the view ref yourself.\n * @param viewRef Ref to the view we're creating an image from\n * @returns A promise that resolves to a Skia Image object or rejects\n * with an error id the view tag is invalid.\n */\nexport const makeImageFromView = <\n T extends\n | number\n | React.Component<unknown, unknown>\n | React.ComponentClass<unknown>\n | null,\n>(\n viewRef: React.RefObject<T>,\n callback:\n | null\n | ((viewRef: React.RefObject<T>) => Promise<SkImage | null>) = null\n) => {\n // In web implementation we just delegate the work to the provided callback\n if (Platform.OS === \"web\") {\n if (callback) {\n return callback(viewRef);\n } else {\n Promise.reject(\n new Error(\n \"Callback is required on web in the makeImageFromView function.\"\n )\n );\n }\n }\n const viewTag = Platform.findNodeHandle(viewRef.current);\n if (viewTag !== null && viewTag !== 0) {\n return Skia.Image.MakeImageFromViewTag(viewTag);\n }\n return Promise.reject(new Error(\"Invalid view tag\"));\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,IAAI,QAAQ,SAAS;AAG9B,SAASC,UAAU,QAAQ,QAAQ;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,KAAK,CAACC,oBAAoB,CAACC,IAAI,CAACL,IAAI,CAACG,KAAK,CAAC;;AAEnE;AACA;AACA;AACA,OAAO,MAAMG,QAAQ,GAAGA,CACtBC,MAAuB,EACvBC,OAA8B,KAC3BP,UAAU,CAACM,MAAM,EAAEL,UAAU,EAAEM,OAAO,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAO/BC,OAA2B,EAC3BC,QAE8D,GAAG,IAAI,KAClE;EACH;EACA,IAAIZ,QAAQ,CAACa,EAAE,KAAK,KAAK,EAAE;IACzB,IAAID,QAAQ,EAAE;MACZ,OAAOA,QAAQ,CAACD,OAAO,CAAC;IAC1B,CAAC,MAAM;MACLG,OAAO,CAACC,MAAM,CACZ,IAAIC,KAAK,CACP,gEACF,CACF,CAAC;IACH;EACF;EACA,MAAMC,OAAO,GAAGjB,QAAQ,CAACkB,cAAc,CAACP,OAAO,CAACQ,OAAO,CAAC;EACxD,IAAIF,OAAO,KAAK,IAAI,IAAIA,OAAO,KAAK,CAAC,EAAE;IACrC,OAAOhB,IAAI,CAACG,KAAK,CAACgB,oBAAoB,CAACH,OAAO,CAAC;EACjD;EACA,OAAOH,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,kBAAkB,CAAC,CAAC;AACtD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","Skia","useRawData","imgFactory","Image","MakeImageFromEncoded","bind","useImage","source","onError","makeImageFromView","viewRef","callback","OS","Promise","reject","Error","viewTag","findNodeHandle","current","MakeImageFromViewTag"],"sources":["Image.ts"],"sourcesContent":["import { Platform } from \"../../Platform\";\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam, SkImage } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n\n/**\n * Creates an image from a given view reference. NOTE: This method has different implementations\n * on web/native. On web, the callback is called with the view ref and the callback is expected to\n * return a promise that resolves to a Skia Image object. On native, the view ref is used to\n * find the view tag and the Skia Image object is created from the view tag. This means that on web\n * you will need to implement the logic to create the image from the view ref yourself.\n * @param viewRef Ref to the view we're creating an image from\n * @returns A promise that resolves to a Skia Image object or rejects\n * with an error id the view tag is invalid.\n */\nexport const makeImageFromView = <\n T extends\n | number\n | React.Component<unknown, unknown>\n | React.ComponentClass<unknown>\n | null,\n>(\n viewRef: React.RefObject<T>,\n callback:\n null | ((viewRef: React.RefObject<T>) => Promise<SkImage | null>) = null\n) => {\n // In web implementation we just delegate the work to the provided callback\n if (Platform.OS === \"web\") {\n if (callback) {\n return callback(viewRef);\n } else {\n Promise.reject(\n new Error(\n \"Callback is required on web in the makeImageFromView function.\"\n )\n );\n }\n }\n const viewTag = Platform.findNodeHandle(viewRef.current);\n if (viewTag !== null && viewTag !== 0) {\n return Skia.Image.MakeImageFromViewTag(viewTag);\n }\n return Promise.reject(new Error(\"Invalid view tag\"));\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,IAAI,QAAQ,SAAS;AAG9B,SAASC,UAAU,QAAQ,QAAQ;AAEnC,MAAMC,UAAU,GAAGF,IAAI,CAACG,KAAK,CAACC,oBAAoB,CAACC,IAAI,CAACL,IAAI,CAACG,KAAK,CAAC;;AAEnE;AACA;AACA;AACA,OAAO,MAAMG,QAAQ,GAAGA,CACtBC,MAAuB,EACvBC,OAA8B,KAC3BP,UAAU,CAACM,MAAM,EAAEL,UAAU,EAAEM,OAAO,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAO/BC,OAA2B,EAC3BC,QACmE,GAAG,IAAI,KACvE;EACH;EACA,IAAIZ,QAAQ,CAACa,EAAE,KAAK,KAAK,EAAE;IACzB,IAAID,QAAQ,EAAE;MACZ,OAAOA,QAAQ,CAACD,OAAO,CAAC;IAC1B,CAAC,MAAM;MACLG,OAAO,CAACC,MAAM,CACZ,IAAIC,KAAK,CACP,gEACF,CACF,CAAC;IACH;EACF;EACA,MAAMC,OAAO,GAAGjB,QAAQ,CAACkB,cAAc,CAACP,OAAO,CAACQ,OAAO,CAAC;EACxD,IAAIF,OAAO,KAAK,IAAI,IAAIA,OAAO,KAAK,CAAC,EAAE;IACrC,OAAOhB,IAAI,CAACG,KAAK,CAACgB,oBAAoB,CAACH,OAAO,CAAC;EACjD;EACA,OAAOH,OAAO,CAACC,MAAM,CAAC,IAAIC,KAAK,CAAC,kBAAkB,CAAC,CAAC;AACtD,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferAddr","buffer","BigInt","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport abstract class CanvasKitWebGLBuffer {}\n\nexport type NativeBuffer<\n T extends\n | bigint\n | ArrayBuffer\n | CanvasImageSource\n | CanvasKitWebGLBuffer\n | unknown = unknown,\n> = T;\n\nexport type NativeBufferAddr = NativeBuffer<bigint>;\nexport type NativeBufferWeb = NativeBuffer<CanvasImageSource>;\nexport type NativeBufferNode = NativeBuffer<ArrayBuffer>;\n\nexport const isNativeBufferAddr = (\n buffer: NativeBuffer\n): buffer is NativeBufferAddr => buffer instanceof BigInt;\nexport const isNativeBufferWeb = (\n buffer: NativeBuffer\n): buffer is NativeBufferWeb =>\n buffer instanceof HTMLVideoElement ||\n buffer instanceof HTMLCanvasElement ||\n buffer instanceof ImageBitmap ||\n buffer instanceof OffscreenCanvas ||\n (typeof VideoFrame !== \"undefined\" && buffer instanceof VideoFrame) ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement ||\n buffer instanceof CanvasKitWebGLBuffer;\n\nexport const isNativeBufferNode = (\n buffer: NativeBuffer\n): buffer is NativeBufferNode => buffer instanceof ArrayBuffer;\n\nexport interface NativeBufferFactory {\n /**\n * Copy pixels to a native buffer.\n */\n MakeFromImage: (image: SkImage) => NativeBuffer;\n /**\n * Create a native buffer of the given size filled with a procedural test\n * pattern (RGB gradient + diagonal stripes), entirely on the CPU. Useful for\n * examples and tests that need a buffer to feed into\n * `GPUDevice.importExternalTexture` without a camera/video source. Release it\n * with `Release`.\n */\n MakeTestBuffer: (width: number, height: number) => NativeBuffer;\n /**\n * Release a native buffer that was created with `MakeFromImage` or\n * `MakeTestBuffer`.\n */\n Release: (nativeBuffer: NativeBuffer) => void;\n}\n"],"mappings":"AAEA,OAAO,MAAeA,oBAAoB,CAAC;AAe3C,OAAO,MAAMC,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AACzD,OAAO,MAAMC,iBAAiB,GAC5BF,MAAoB,IAEpBA,MAAM,YAAYG,gBAAgB,IAClCH,MAAM,YAAYI,iBAAiB,IACnCJ,MAAM,YAAYK,WAAW,IAC7BL,MAAM,YAAYM,eAAe,IAChC,OAAOC,UAAU,KAAK,WAAW,IAAIP,MAAM,YAAYO,UAAW,IACnEP,MAAM,YAAYQ,gBAAgB,IAClCR,MAAM,YAAYS,eAAe,IACjCT,MAAM,YAAYF,oBAAoB;AAExC,OAAO,MAAMY,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferAddr","buffer","BigInt","isNativeBufferWeb","HTMLVideoElement","HTMLCanvasElement","ImageBitmap","OffscreenCanvas","VideoFrame","HTMLImageElement","SVGImageElement","isNativeBufferNode","ArrayBuffer"],"sources":["NativeBufferFactory.ts"],"sourcesContent":["import type { SkImage } from \"../Image\";\n\nexport abstract class CanvasKitWebGLBuffer {}\n\nexport type NativeBuffer<\n T extends\n bigint | ArrayBuffer | CanvasImageSource | CanvasKitWebGLBuffer | unknown =\n unknown,\n> = T;\n\nexport type NativeBufferAddr = NativeBuffer<bigint>;\nexport type NativeBufferWeb = NativeBuffer<CanvasImageSource>;\nexport type NativeBufferNode = NativeBuffer<ArrayBuffer>;\n\nexport const isNativeBufferAddr = (\n buffer: NativeBuffer\n): buffer is NativeBufferAddr => buffer instanceof BigInt;\nexport const isNativeBufferWeb = (\n buffer: NativeBuffer\n): buffer is NativeBufferWeb =>\n buffer instanceof HTMLVideoElement ||\n buffer instanceof HTMLCanvasElement ||\n buffer instanceof ImageBitmap ||\n buffer instanceof OffscreenCanvas ||\n (typeof VideoFrame !== \"undefined\" && buffer instanceof VideoFrame) ||\n buffer instanceof HTMLImageElement ||\n buffer instanceof SVGImageElement ||\n buffer instanceof CanvasKitWebGLBuffer;\n\nexport const isNativeBufferNode = (\n buffer: NativeBuffer\n): buffer is NativeBufferNode => buffer instanceof ArrayBuffer;\n\nexport interface NativeBufferFactory {\n /**\n * Copy pixels to a native buffer.\n */\n MakeFromImage: (image: SkImage) => NativeBuffer;\n /**\n * Create a native buffer of the given size filled with a procedural test\n * pattern (RGB gradient + diagonal stripes), entirely on the CPU. Useful for\n * examples and tests that need a buffer to feed into\n * `GPUDevice.importExternalTexture` without a camera/video source. Release it\n * with `Release`.\n */\n MakeTestBuffer: (width: number, height: number) => NativeBuffer;\n /**\n * Release a native buffer that was created with `MakeFromImage` or\n * `MakeTestBuffer`.\n */\n Release: (nativeBuffer: NativeBuffer) => void;\n}\n"],"mappings":"AAEA,OAAO,MAAeA,oBAAoB,CAAC;AAY3C,OAAO,MAAMC,kBAAkB,GAC7BC,MAAoB,IACWA,MAAM,YAAYC,MAAM;AACzD,OAAO,MAAMC,iBAAiB,GAC5BF,MAAoB,IAEpBA,MAAM,YAAYG,gBAAgB,IAClCH,MAAM,YAAYI,iBAAiB,IACnCJ,MAAM,YAAYK,WAAW,IAC7BL,MAAM,YAAYM,eAAe,IAChC,OAAOC,UAAU,KAAK,WAAW,IAAIP,MAAM,YAAYO,UAAW,IACnEP,MAAM,YAAYQ,gBAAgB,IAClCR,MAAM,YAAYS,eAAe,IACjCT,MAAM,YAAYF,oBAAoB;AAExC,OAAO,MAAMY,kBAAkB,GAC7BV,MAAoB,IACWA,MAAM,YAAYW,WAAW","ignoreList":[]}