@shopify/react-native-skia 1.11.18 → 1.12.1

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 (211) hide show
  1. package/android/cpp/jni/JniPlatformContext.cpp +1 -0
  2. package/cpp/api/JsiSkContourMeasure.h +1 -1
  3. package/cpp/api/JsiSkHostObjects.h +21 -10
  4. package/cpp/api/JsiSkParagraph.h +17 -27
  5. package/cpp/api/JsiSkPathEffect.h +1 -1
  6. package/cpp/api/JsiSkPictureFactory.h +1 -1
  7. package/cpp/api/recorder/Drawings.h +4 -3
  8. package/cpp/rnskia/DawnContext.h +1 -1
  9. package/cpp/skia/include/codec/SkCodec.h +7 -2
  10. package/cpp/skia/include/config/SkUserConfig.h +11 -0
  11. package/cpp/skia/include/core/SkCanvas.h +11 -7
  12. package/cpp/skia/include/core/SkColor.h +10 -0
  13. package/cpp/skia/include/core/SkColorSpace.h +184 -2
  14. package/cpp/skia/include/core/SkColorType.h +114 -32
  15. package/cpp/skia/include/core/SkFontScanner.h +5 -8
  16. package/cpp/skia/include/core/SkFontStyle.h +1 -1
  17. package/cpp/skia/include/core/SkMaskFilter.h +0 -8
  18. package/cpp/skia/include/core/SkMilestone.h +1 -1
  19. package/cpp/skia/include/core/SkPath.h +1 -1
  20. package/cpp/skia/include/core/SkRRect.h +3 -1
  21. package/cpp/skia/include/core/SkShader.h +3 -3
  22. package/cpp/skia/include/core/SkString.h +8 -8
  23. package/cpp/skia/include/core/SkSurface.h +14 -0
  24. package/cpp/skia/include/core/SkTypeface.h +24 -7
  25. package/cpp/skia/include/effects/SkGradientShader.h +6 -1
  26. package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -0
  27. package/cpp/skia/include/encode/SkPngEncoder.h +14 -0
  28. package/cpp/skia/include/gpu/GpuTypes.h +9 -0
  29. package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +135 -133
  30. package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +5 -0
  31. package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
  32. package/cpp/skia/include/gpu/ganesh/GrTypes.h +14 -9
  33. package/cpp/skia/include/gpu/graphite/Context.h +25 -2
  34. package/cpp/skia/include/gpu/graphite/ContextOptions.h +23 -5
  35. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +20 -1
  36. package/cpp/skia/include/gpu/graphite/Image.h +1 -0
  37. package/cpp/skia/include/gpu/graphite/LogPriority.h +36 -0
  38. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +52 -0
  39. package/cpp/skia/include/gpu/graphite/Recorder.h +6 -0
  40. package/cpp/skia/include/gpu/graphite/Recording.h +3 -1
  41. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +4 -36
  42. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +48 -0
  43. package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +3 -2
  44. package/cpp/skia/include/pathops/SkPathOps.h +9 -1
  45. package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +3 -0
  46. package/cpp/skia/include/private/SkPathRef.h +15 -21
  47. package/cpp/skia/include/private/base/SkAttributes.h +16 -10
  48. package/cpp/skia/include/private/base/SkMutex.h +8 -0
  49. package/cpp/skia/include/private/base/SkTArray.h +1 -1
  50. package/cpp/skia/include/private/base/SkTDArray.h +1 -1
  51. package/cpp/skia/include/private/base/SkTemplates.h +24 -11
  52. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
  53. package/cpp/skia/include/sksl/SkSLDebugTrace.h +0 -3
  54. package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
  55. package/cpp/skia/modules/skcms/src/skcms_Transform.h +4 -3
  56. package/cpp/skia/modules/skcms/src/skcms_public.h +19 -15
  57. package/cpp/skia/modules/skresources/include/SkResources.h +3 -1
  58. package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
  59. package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
  60. package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
  61. package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
  62. package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
  63. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  64. package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
  65. package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +2 -0
  66. package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -0
  67. package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
  68. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +4 -0
  69. package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
  70. package/cpp/skia/src/core/SkLRUCache.h +19 -13
  71. package/cpp/skia/src/core/SkTHash.h +50 -4
  72. package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1 -0
  73. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +4 -3
  74. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  75. package/lib/commonjs/mock/index.js +1 -2
  76. package/lib/commonjs/mock/index.js.map +1 -1
  77. package/lib/commonjs/skia/web/Host.d.ts +1 -3
  78. package/lib/commonjs/skia/web/Host.js +7 -6
  79. package/lib/commonjs/skia/web/Host.js.map +1 -1
  80. package/lib/commonjs/skia/web/JsiSkFont.js +1 -1
  81. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  82. package/lib/commonjs/skia/web/JsiSkFontMgr.js +1 -1
  83. package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
  84. package/lib/commonjs/skia/web/JsiSkImageFactory.js +1 -1
  85. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  86. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +6 -6
  87. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  88. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +2 -2
  89. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  90. package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
  91. package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
  92. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  93. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +1 -1
  94. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  95. package/lib/commonjs/skia/web/JsiSkia.js +4 -3
  96. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  97. package/lib/commonjs/skia/web/JsiVideo.js +2 -1
  98. package/lib/commonjs/skia/web/JsiVideo.js.map +1 -1
  99. package/lib/commonjs/sksg/Recorder/Core.d.ts +1 -5
  100. package/lib/commonjs/sksg/Recorder/Core.js +12 -4
  101. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  102. package/lib/commonjs/sksg/Recorder/Player.js +4 -5
  103. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  104. package/lib/commonjs/sksg/Recorder/commands/Box.js +2 -4
  105. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
  106. package/lib/module/external/reanimated/useAnimatedImageValue.js +4 -3
  107. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  108. package/lib/module/mock/index.js +1 -2
  109. package/lib/module/mock/index.js.map +1 -1
  110. package/lib/module/skia/web/Host.d.ts +1 -3
  111. package/lib/module/skia/web/Host.js +5 -4
  112. package/lib/module/skia/web/Host.js.map +1 -1
  113. package/lib/module/skia/web/JsiSkFont.js +2 -2
  114. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  115. package/lib/module/skia/web/JsiSkFontMgr.js +2 -2
  116. package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
  117. package/lib/module/skia/web/JsiSkImageFactory.js +2 -2
  118. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  119. package/lib/module/skia/web/JsiSkImageFilterFactory.js +7 -7
  120. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  121. package/lib/module/skia/web/JsiSkPathEffectFactory.js +3 -3
  122. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  123. package/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
  124. package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
  125. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  126. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +2 -2
  127. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
  128. package/lib/module/skia/web/JsiSkia.js +4 -3
  129. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  130. package/lib/module/skia/web/JsiVideo.js +2 -1
  131. package/lib/module/skia/web/JsiVideo.js.map +1 -1
  132. package/lib/module/sksg/Recorder/Core.d.ts +1 -5
  133. package/lib/module/sksg/Recorder/Core.js +10 -2
  134. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  135. package/lib/module/sksg/Recorder/Player.js +5 -6
  136. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  137. package/lib/module/sksg/Recorder/commands/Box.js +3 -5
  138. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
  139. package/lib/typescript/lib/commonjs/mock/index.d.ts +1 -1
  140. package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +1 -3
  141. package/lib/typescript/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
  142. package/lib/typescript/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +1 -1
  143. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -1
  144. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
  145. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
  146. package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
  147. package/lib/typescript/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
  148. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +3 -3
  149. package/lib/typescript/lib/commonjs/skia/web/JsiVideo.d.ts +1 -1
  150. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -1
  151. package/lib/typescript/lib/module/mock/index.d.ts +1 -1
  152. package/lib/typescript/lib/module/skia/Skia.web.d.ts +3 -3
  153. package/lib/typescript/lib/module/skia/web/Host.d.ts +1 -3
  154. package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -1
  155. package/lib/typescript/lib/module/skia/web/JsiSkFontMgr.d.ts +1 -1
  156. package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -1
  157. package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
  158. package/lib/typescript/lib/module/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
  159. package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
  160. package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
  161. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +3 -3
  162. package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +1 -1
  163. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -1
  164. package/lib/typescript/src/skia/web/Host.d.ts +1 -3
  165. package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +1 -1
  166. package/lib/typescript/src/sksg/Recorder/Core.d.ts +1 -5
  167. package/package.json +1 -1
  168. package/react-native-skia.podspec +3 -3
  169. package/src/external/reanimated/useAnimatedImageValue.ts +4 -3
  170. package/src/mock/index.ts +1 -2
  171. package/src/skia/web/Host.ts +5 -4
  172. package/src/skia/web/JsiSkFont.ts +3 -3
  173. package/src/skia/web/JsiSkFontMgr.ts +3 -3
  174. package/src/skia/web/JsiSkImageFactory.ts +3 -3
  175. package/src/skia/web/JsiSkImageFilterFactory.ts +8 -18
  176. package/src/skia/web/JsiSkPathEffectFactory.ts +5 -5
  177. package/src/skia/web/JsiSkPathFactory.ts +3 -8
  178. package/src/skia/web/JsiSkTypefaceFontProvider.ts +3 -3
  179. package/src/skia/web/JsiSkia.ts +7 -4
  180. package/src/skia/web/JsiVideo.ts +2 -1
  181. package/src/sksg/Recorder/Core.ts +5 -7
  182. package/src/sksg/Recorder/Player.ts +5 -6
  183. package/src/sksg/Recorder/commands/Box.ts +3 -5
  184. package/ios/RNSkia-iOS/MetalContext.h +0 -134
  185. package/ios/RNSkia-iOS/MetalContext.mm +0 -34
  186. package/ios/RNSkia-iOS/MetalWindowContext.h +0 -39
  187. package/ios/RNSkia-iOS/MetalWindowContext.mm +0 -60
  188. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +0 -38
  189. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +0 -103
  190. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +0 -75
  191. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +0 -303
  192. package/ios/RNSkia-iOS/RNSkiOSVideo.h +0 -51
  193. package/ios/RNSkia-iOS/RNSkiOSVideo.mm +0 -137
  194. package/ios/RNSkia-iOS/RNSkiOSView.h +0 -37
  195. package/ios/RNSkia-iOS/RNSkiOSView.mm +0 -35
  196. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +0 -119
  197. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +0 -344
  198. package/ios/RNSkia-iOS/SkiaManager.h +0 -25
  199. package/ios/RNSkia-iOS/SkiaManager.mm +0 -62
  200. package/ios/RNSkia-iOS/SkiaPictureView.h +0 -7
  201. package/ios/RNSkia-iOS/SkiaPictureView.mm +0 -66
  202. package/ios/RNSkia-iOS/SkiaPictureViewManager.h +0 -8
  203. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +0 -51
  204. package/ios/RNSkia-iOS/SkiaUIView.h +0 -37
  205. package/ios/RNSkia-iOS/SkiaUIView.mm +0 -168
  206. package/ios/RNSkia-iOS/ViewScreenshotService.h +0 -21
  207. package/ios/RNSkia-iOS/ViewScreenshotService.mm +0 -85
  208. package/ios/RNSkiaModule.h +0 -20
  209. package/ios/RNSkiaModule.mm +0 -55
  210. package/ios/Rnskia.xcodeproj/project.pbxproj +0 -281
  211. package/ios/Rnskia.xcworkspace/contents.xcworkspacedata +0 -7
@@ -1,14 +1,14 @@
1
1
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
- import { HostObject, NotImplementedOnRNWeb } from "./Host";
4
+ import { HostObject, throwNotImplementedOnRNWeb } from "./Host";
5
5
  export class JsiSkTypefaceFontProvider extends HostObject {
6
6
  constructor(CanvasKit, ref) {
7
7
  super(CanvasKit, ref, "FontMgr");
8
8
  _defineProperty(this, "allocatedPointers", []);
9
9
  }
10
10
  matchFamilyStyle(_name, _style) {
11
- throw new NotImplementedOnRNWeb();
11
+ return throwNotImplementedOnRNWeb();
12
12
  }
13
13
  countFamilies() {
14
14
  return this.ref.countFamilies();
@@ -1 +1 @@
1
- {"version":3,"names":["HostObject","NotImplementedOnRNWeb","JsiSkTypefaceFontProvider","constructor","CanvasKit","ref","_defineProperty","matchFamilyStyle","_name","_style","countFamilies","getFamilyName","index","registerFont","typeface","familyName","strLen","lengthBytesUTF8","strPtr","_malloc","stringToUTF8","_registerFont","dispose","ptr","allocatedPointers","_free","delete","str","encoder","TextEncoder","utf8","encode","length","outPtr","maxBytesToWrite","heap","HEAPU8","Error","i"],"sources":["JsiSkTypefaceFontProvider.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from \"canvaskit-wasm\";\n\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\nimport type { FontStyle, SkTypeface } from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkTypefaceFontProvider\n extends HostObject<TypefaceFontProvider, \"FontMgr\">\n implements SkTypefaceFontProvider\n{\n private allocatedPointers: number[] = [];\n\n constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n\n matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface {\n throw new NotImplementedOnRNWeb();\n }\n countFamilies() {\n return this.ref.countFamilies();\n }\n getFamilyName(index: number) {\n return this.ref.getFamilyName(index);\n }\n registerFont(typeface: SkTypeface, familyName: string) {\n const strLen = lengthBytesUTF8(familyName) + 1;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const strPtr = this.CanvasKit._malloc(strLen);\n stringToUTF8(this.CanvasKit, familyName, strPtr, strLen);\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.ref._registerFont(typeface.ref, strPtr);\n }\n\n dispose() {\n for (const ptr of this.allocatedPointers) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.CanvasKit._free(ptr);\n }\n\n this.ref.delete();\n }\n}\n\nconst lengthBytesUTF8 = (str: string) => {\n // TextEncoder will give us the byte length in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n return utf8.length;\n};\n\nconst stringToUTF8 = (\n CanvasKit: CanvasKit,\n str: string,\n outPtr: number,\n maxBytesToWrite: number\n) => {\n // TextEncoder will give us the byte array in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const heap: Int8Array = CanvasKit.HEAPU8;\n\n // Check if there's enough space\n if (utf8.length > maxBytesToWrite) {\n throw new Error(\"Not enough space to write UTF8 encoded string\");\n }\n\n // Copy the bytes\n for (let i = 0; i < utf8.length; i++) {\n heap[outPtr + i] = utf8[i];\n }\n\n // Null terminate\n if (utf8.length < maxBytesToWrite) {\n heap[outPtr + utf8.length] = 0;\n }\n};\n"],"mappings":";;;AAKA,SAASA,UAAU,EAAEC,qBAAqB,QAAQ,QAAQ;AAE1D,OAAO,MAAMC,yBAAyB,SAC5BF,UAAU,CAEpB;EAGEG,WAAWA,CAACC,SAAoB,EAAEC,GAAyB,EAAE;IAC3D,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,SAAS,CAAC;IAACC,eAAA,4BAHG,EAAE;EAIxC;EAEAC,gBAAgBA,CAACC,KAAa,EAAEC,MAAiB,EAAc;IAC7D,MAAM,IAAIR,qBAAqB,CAAC,CAAC;EACnC;EACAS,aAAaA,CAAA,EAAG;IACd,OAAO,IAAI,CAACL,GAAG,CAACK,aAAa,CAAC,CAAC;EACjC;EACAC,aAAaA,CAACC,KAAa,EAAE;IAC3B,OAAO,IAAI,CAACP,GAAG,CAACM,aAAa,CAACC,KAAK,CAAC;EACtC;EACAC,YAAYA,CAACC,QAAoB,EAAEC,UAAkB,EAAE;IACrD,MAAMC,MAAM,GAAGC,eAAe,CAACF,UAAU,CAAC,GAAG,CAAC;;IAE9C;IACA;IACA,MAAMG,MAAM,GAAG,IAAI,CAACd,SAAS,CAACe,OAAO,CAACH,MAAM,CAAC;IAC7CI,YAAY,CAAC,IAAI,CAAChB,SAAS,EAAEW,UAAU,EAAEG,MAAM,EAAEF,MAAM,CAAC;;IAExD;IACA;IACA,IAAI,CAACX,GAAG,CAACgB,aAAa,CAACP,QAAQ,CAACT,GAAG,EAAEa,MAAM,CAAC;EAC9C;EAEAI,OAAOA,CAAA,EAAG;IACR,KAAK,MAAMC,GAAG,IAAI,IAAI,CAACC,iBAAiB,EAAE;MACxC;MACA;MACA,IAAI,CAACpB,SAAS,CAACqB,KAAK,CAACF,GAAG,CAAC;IAC3B;IAEA,IAAI,CAAClB,GAAG,CAACqB,MAAM,CAAC,CAAC;EACnB;AACF;AAEA,MAAMT,eAAe,GAAIU,GAAW,IAAK;EACvC;EACA,MAAMC,OAAO,GAAG,IAAIC,WAAW,CAAC,CAAC;EACjC,MAAMC,IAAI,GAAGF,OAAO,CAACG,MAAM,CAACJ,GAAG,CAAC;EAChC,OAAOG,IAAI,CAACE,MAAM;AACpB,CAAC;AAED,MAAMZ,YAAY,GAAGA,CACnBhB,SAAoB,EACpBuB,GAAW,EACXM,MAAc,EACdC,eAAuB,KACpB;EACH;EACA,MAAMN,OAAO,GAAG,IAAIC,WAAW,CAAC,CAAC;EACjC,MAAMC,IAAI,GAAGF,OAAO,CAACG,MAAM,CAACJ,GAAG,CAAC;EAChC;EACA;EACA,MAAMQ,IAAe,GAAG/B,SAAS,CAACgC,MAAM;;EAExC;EACA,IAAIN,IAAI,CAACE,MAAM,GAAGE,eAAe,EAAE;IACjC,MAAM,IAAIG,KAAK,CAAC,+CAA+C,CAAC;EAClE;;EAEA;EACA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,IAAI,CAACE,MAAM,EAAEM,CAAC,EAAE,EAAE;IACpCH,IAAI,CAACF,MAAM,GAAGK,CAAC,CAAC,GAAGR,IAAI,CAACQ,CAAC,CAAC;EAC5B;;EAEA;EACA,IAAIR,IAAI,CAACE,MAAM,GAAGE,eAAe,EAAE;IACjCC,IAAI,CAACF,MAAM,GAAGH,IAAI,CAACE,MAAM,CAAC,GAAG,CAAC;EAChC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["HostObject","throwNotImplementedOnRNWeb","JsiSkTypefaceFontProvider","constructor","CanvasKit","ref","_defineProperty","matchFamilyStyle","_name","_style","countFamilies","getFamilyName","index","registerFont","typeface","familyName","strLen","lengthBytesUTF8","strPtr","_malloc","stringToUTF8","_registerFont","dispose","ptr","allocatedPointers","_free","delete","str","encoder","TextEncoder","utf8","encode","length","outPtr","maxBytesToWrite","heap","HEAPU8","Error","i"],"sources":["JsiSkTypefaceFontProvider.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from \"canvaskit-wasm\";\n\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\nimport type { FontStyle, SkTypeface } from \"../types\";\n\nimport { HostObject, throwNotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkTypefaceFontProvider\n extends HostObject<TypefaceFontProvider, \"FontMgr\">\n implements SkTypefaceFontProvider\n{\n private allocatedPointers: number[] = [];\n\n constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n\n matchFamilyStyle(_name: string, _style: FontStyle) {\n return throwNotImplementedOnRNWeb<SkTypeface>();\n }\n countFamilies() {\n return this.ref.countFamilies();\n }\n getFamilyName(index: number) {\n return this.ref.getFamilyName(index);\n }\n registerFont(typeface: SkTypeface, familyName: string) {\n const strLen = lengthBytesUTF8(familyName) + 1;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const strPtr = this.CanvasKit._malloc(strLen);\n stringToUTF8(this.CanvasKit, familyName, strPtr, strLen);\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.ref._registerFont(typeface.ref, strPtr);\n }\n\n dispose() {\n for (const ptr of this.allocatedPointers) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.CanvasKit._free(ptr);\n }\n\n this.ref.delete();\n }\n}\n\nconst lengthBytesUTF8 = (str: string) => {\n // TextEncoder will give us the byte length in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n return utf8.length;\n};\n\nconst stringToUTF8 = (\n CanvasKit: CanvasKit,\n str: string,\n outPtr: number,\n maxBytesToWrite: number\n) => {\n // TextEncoder will give us the byte array in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const heap: Int8Array = CanvasKit.HEAPU8;\n\n // Check if there's enough space\n if (utf8.length > maxBytesToWrite) {\n throw new Error(\"Not enough space to write UTF8 encoded string\");\n }\n\n // Copy the bytes\n for (let i = 0; i < utf8.length; i++) {\n heap[outPtr + i] = utf8[i];\n }\n\n // Null terminate\n if (utf8.length < maxBytesToWrite) {\n heap[outPtr + utf8.length] = 0;\n }\n};\n"],"mappings":";;;AAKA,SAASA,UAAU,EAAEC,0BAA0B,QAAQ,QAAQ;AAE/D,OAAO,MAAMC,yBAAyB,SAC5BF,UAAU,CAEpB;EAGEG,WAAWA,CAACC,SAAoB,EAAEC,GAAyB,EAAE;IAC3D,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,SAAS,CAAC;IAACC,eAAA,4BAHG,EAAE;EAIxC;EAEAC,gBAAgBA,CAACC,KAAa,EAAEC,MAAiB,EAAE;IACjD,OAAOR,0BAA0B,CAAa,CAAC;EACjD;EACAS,aAAaA,CAAA,EAAG;IACd,OAAO,IAAI,CAACL,GAAG,CAACK,aAAa,CAAC,CAAC;EACjC;EACAC,aAAaA,CAACC,KAAa,EAAE;IAC3B,OAAO,IAAI,CAACP,GAAG,CAACM,aAAa,CAACC,KAAK,CAAC;EACtC;EACAC,YAAYA,CAACC,QAAoB,EAAEC,UAAkB,EAAE;IACrD,MAAMC,MAAM,GAAGC,eAAe,CAACF,UAAU,CAAC,GAAG,CAAC;;IAE9C;IACA;IACA,MAAMG,MAAM,GAAG,IAAI,CAACd,SAAS,CAACe,OAAO,CAACH,MAAM,CAAC;IAC7CI,YAAY,CAAC,IAAI,CAAChB,SAAS,EAAEW,UAAU,EAAEG,MAAM,EAAEF,MAAM,CAAC;;IAExD;IACA;IACA,IAAI,CAACX,GAAG,CAACgB,aAAa,CAACP,QAAQ,CAACT,GAAG,EAAEa,MAAM,CAAC;EAC9C;EAEAI,OAAOA,CAAA,EAAG;IACR,KAAK,MAAMC,GAAG,IAAI,IAAI,CAACC,iBAAiB,EAAE;MACxC;MACA;MACA,IAAI,CAACpB,SAAS,CAACqB,KAAK,CAACF,GAAG,CAAC;IAC3B;IAEA,IAAI,CAAClB,GAAG,CAACqB,MAAM,CAAC,CAAC;EACnB;AACF;AAEA,MAAMT,eAAe,GAAIU,GAAW,IAAK;EACvC;EACA,MAAMC,OAAO,GAAG,IAAIC,WAAW,CAAC,CAAC;EACjC,MAAMC,IAAI,GAAGF,OAAO,CAACG,MAAM,CAACJ,GAAG,CAAC;EAChC,OAAOG,IAAI,CAACE,MAAM;AACpB,CAAC;AAED,MAAMZ,YAAY,GAAGA,CACnBhB,SAAoB,EACpBuB,GAAW,EACXM,MAAc,EACdC,eAAuB,KACpB;EACH;EACA,MAAMN,OAAO,GAAG,IAAIC,WAAW,CAAC,CAAC;EACjC,MAAMC,IAAI,GAAGF,OAAO,CAACG,MAAM,CAACJ,GAAG,CAAC;EAChC;EACA;EACA,MAAMQ,IAAe,GAAG/B,SAAS,CAACgC,MAAM;;EAExC;EACA,IAAIN,IAAI,CAACE,MAAM,GAAGE,eAAe,EAAE;IACjC,MAAM,IAAIG,KAAK,CAAC,+CAA+C,CAAC;EAClE;;EAEA;EACA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,IAAI,CAACE,MAAM,EAAEM,CAAC,EAAE,EAAE;IACpCH,IAAI,CAACF,MAAM,GAAGK,CAAC,CAAC,GAAGR,IAAI,CAACQ,CAAC,CAAC;EAC5B;;EAEA;EACA,IAAIR,IAAI,CAACE,MAAM,GAAGE,eAAe,EAAE;IACjCC,IAAI,CAACF,MAAM,GAAGH,IAAI,CAACE,MAAM,CAAC,GAAG,CAAC;EAChC;AACF,CAAC","ignoreList":[]}
@@ -31,10 +31,11 @@ import { JsiSkAnimatedImageFactory } from "./JsiSkAnimatedImageFactory";
31
31
  import { JsiSkParagraphBuilderFactory } from "./JsiSkParagraphBuilderFactory";
32
32
  import { JsiSkNativeBufferFactory } from "./JsiSkNativeBufferFactory";
33
33
  import { createVideo } from "./JsiVideo";
34
+ import { throwNotImplementedOnRNWeb } from "./Host";
34
35
  export const JsiSkApi = CanvasKit => ({
35
36
  Point: (x, y) => new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),
36
37
  RuntimeShaderBuilder: _ => {
37
- throw new Error("Not implemented on React Native Web");
38
+ return throwNotImplementedOnRNWeb();
38
39
  },
39
40
  RRectXY: (rect, rx, ry) => new JsiSkRRect(CanvasKit, rect, rx, ry),
40
41
  RSXform: (scos, ssin, tx, ty) => new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),
@@ -78,10 +79,10 @@ export const JsiSkApi = CanvasKit => ({
78
79
  NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),
79
80
  Video: createVideo.bind(null, CanvasKit),
80
81
  Context: (_surface, _width, _height) => {
81
- throw new Error("Not implemented on React Native Web");
82
+ return throwNotImplementedOnRNWeb();
82
83
  },
83
84
  Recorder: () => {
84
- throw new Error("Not implemented on React Native Web");
85
+ return throwNotImplementedOnRNWeb();
85
86
  }
86
87
  });
87
88
  //# sourceMappingURL=JsiSkia.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","createVideo","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer","Video","Context","_surface","_width","_height","Recorder"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n Recorder: () => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n});\n"],"mappings":"AAYA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,SAAS,QAAQ,aAA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AAY,EAAE,IAAIrE,wBAAwB,CAACG,SAAS,CAAC;EACrDmE,KAAK,EAAErE,WAAW,CAACuD,IAAI,CAAC,IAAI,EAAErD,SAAS,CAAC;EACxCoE,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,MAAM,IAAI/D,KAAK,CAAC,qCAAqC,CAAC;EACxD,CAAC;EACDgE,QAAQ,EAAEA,CAAA,KAAM;IACd,MAAM,IAAIhE,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","createVideo","throwNotImplementedOnRNWeb","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer","Video","Context","_surface","_width","_height","Recorder"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n JsiRecorder,\n SkContourMeasureIter,\n Skia,\n SkiaContext,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\nimport { throwNotImplementedOnRNWeb } from \"./Host\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect) => {\n return throwNotImplementedOnRNWeb<SkRuntimeShaderBuilder>();\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n return throwNotImplementedOnRNWeb<SkiaContext>();\n },\n Recorder: () => {\n return throwNotImplementedOnRNWeb<JsiRecorder>();\n },\n});\n"],"mappings":"AAcA,SAASA,UAAU,QAAQ,cAAc;A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
@@ -3,6 +3,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import { CanvasKitWebGLBufferImpl } from "./CanvasKitWebGLBufferImpl";
5
5
  import { JsiSkImageFactory } from "./JsiSkImageFactory";
6
+ import { throwNotImplementedOnRNWeb } from "./Host";
6
7
  export const createVideo = async (CanvasKit, url) => {
7
8
  const video = document.createElement("video");
8
9
  return new Promise((resolve, reject) => {
@@ -31,7 +32,7 @@ export class JsiVideo {
31
32
  return this.videoElement.duration * 1000;
32
33
  }
33
34
  framerate() {
34
- throw new Error("Video.frame is not available on React Native Web");
35
+ return throwNotImplementedOnRNWeb();
35
36
  }
36
37
  setSurface(surface) {
37
38
  // If we have the surface, we can use the WebGL buffer which is slightly faster
@@ -1 +1 @@
1
- {"version":3,"names":["CanvasKitWebGLBufferImpl","JsiSkImageFactory","createVideo","CanvasKit","url","video","document","createElement","Promise","resolve","reject","src","style","display","crossOrigin","volume","addEventListener","body","appendChild","JsiVideo","Error","constructor","ImageFactory","videoElement","_defineProperty","duration","framerate","setSurface","surface","webglBuffer","nextImage","MakeImageFromNativeBuffer","seek","time","isNaN","currentTime","rotation","size","width","videoWidth","height","videoHeight","pause","play","setVolume","dispose","parentNode","removeChild"],"sources":["JsiVideo.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { CanvasKitWebGLBuffer, Video, ImageFactory } from \"../types\";\n\nimport { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\n\nexport const createVideo = async (\n CanvasKit: CanvasKit,\n url: string\n): Promise<Video> => {\n const video = document.createElement(\"video\");\n return new Promise((resolve, reject) => {\n video.src = url;\n video.style.display = \"none\";\n video.crossOrigin = \"anonymous\";\n video.volume = 0;\n video.addEventListener(\"loadedmetadata\", () => {\n document.body.appendChild(video);\n resolve(new JsiVideo(new JsiSkImageFactory(CanvasKit), video));\n });\n video.addEventListener(\"error\", () => {\n reject(new Error(`Failed to load video from URL: ${url}`));\n });\n });\n};\n\nexport class JsiVideo implements Video {\n __typename__ = \"Video\" as const;\n\n private webglBuffer: CanvasKitWebGLBuffer | null = null;\n\n constructor(\n private ImageFactory: ImageFactory,\n private videoElement: HTMLVideoElement\n ) {\n document.body.appendChild(this.videoElement);\n }\n\n duration() {\n return this.videoElement.duration * 1000;\n }\n\n framerate(): number {\n throw new Error(\"Video.frame is not available on React Native Web\");\n }\n\n setSurface(surface: Surface) {\n // If we have the surface, we can use the WebGL buffer which is slightly faster\n // This is because WebGL cannot be shared across contextes.\n // This can be removed with WebGPU\n this.webglBuffer = new CanvasKitWebGLBufferImpl(surface, this.videoElement);\n }\n\n nextImage() {\n return this.ImageFactory.MakeImageFromNativeBuffer(\n this.webglBuffer ? this.webglBuffer : this.videoElement\n );\n }\n\n seek(time: number) {\n if (isNaN(time)) {\n throw new Error(`Invalid time: ${time}`);\n }\n this.videoElement.currentTime = time / 1000;\n }\n\n rotation() {\n return 0 as const;\n }\n\n size() {\n return {\n width: this.videoElement.videoWidth,\n height: this.videoElement.videoHeight,\n };\n }\n\n pause() {\n this.videoElement.pause();\n }\n\n play() {\n this.videoElement.play();\n }\n\n setVolume(volume: number) {\n this.videoElement.volume = volume;\n }\n\n dispose() {\n if (this.videoElement.parentNode) {\n this.videoElement.parentNode.removeChild(this.videoElement);\n }\n }\n}\n"],"mappings":";;;AAIA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,OAAO,MAAMC,WAAW,GAAG,MAAAA,CACzBC,SAAoB,EACpBC,GAAW,KACQ;EACnB,MAAMC,KAAK,GAAGC,QAAQ,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AI,CAACL,YAAY,CAAC;EAC7E;EAEAO,SAASA,CAAA,EAAG;IACV,OAAO,IAAI,CAACR,YAAY,CAACS,yBAAyB,CAChD,IAAI,CAACF,WAAW,GAAG,IAAI,CAACA,WAAW,GAAG,IAAI,CAACN,YAC7C,CAAC;EACH;EAEAS,IAAIA,CAACC,IAAY,EAAE;IACjB,IAAIC,KAAK,CAACD,IAAI,CAAC,EAAE;MACf,MAAM,IAAIb,KAAK,CAAC,iBAAiBa,IAAI,EAAE,CAAC;IAC1C;IACA,IAAI,CAACV,YAAY,CAACY,WAAW,GAAGF,IAAI,GAAG,IAAI;EAC7C;EAEAG,QAAQA,CAAA,EAAG;IACT,OAAO,CAAC;EACV;EAEAC,IAAIA,CAAA,EAAG;IACL,OAAO;MACLC,KAAK,EAAE,IAAI,CAACf,YAAY,CAACgB,UAAU;MACnCC,MAAM,EAAE,IAAI,CAACjB,YAAY,CAACkB;IAC5B,CAAC;EACH;EAEAC,KAAKA,CAAA,EAAG;IACN,IAAI,CAACnB,YAAY,CAACmB,KAAK,CAAC,CAAC;EAC3B;EAEAC,IAAIA,CAAA,EAAG;IACL,IAAI,CAACpB,YAAY,CAACoB,IAAI,CAAC,CAAC;EAC1B;EAEAC,SAASA,CAAC7B,MAAc,EAAE;IACxB,IAAI,CAACQ,YAAY,CAACR,MAAM,GAAGA,MAAM;EACnC;EAEA8B,OAAOA,CAAA,EAAG;IACR,IAAI,IAAI,CAACtB,YAAY,CAACuB,UAAU,EAAE;MAChC,IAAI,CAACvB,YAAY,CAACuB,UAAU,CAACC,WAAW,CAAC,IAAI,CAACxB,YAAY,CAAC;IAC7D;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"names":["CanvasKitWebGLBufferImpl","JsiSkImageFactory","throwNotImplementedOnRNWeb","createVideo","CanvasKit","url","video","document","createElement","Promise","resolve","reject","src","style","display","crossOrigin","volume","addEventListener","body","appendChild","JsiVideo","Error","constructor","ImageFactory","videoElement","_defineProperty","duration","framerate","setSurface","surface","webglBuffer","nextImage","MakeImageFromNativeBuffer","seek","time","isNaN","currentTime","rotation","size","width","videoWidth","height","videoHeight","pause","play","setVolume","dispose","parentNode","removeChild"],"sources":["JsiVideo.ts"],"sourcesContent":["import type { CanvasKit, Surface } from \"canvaskit-wasm\";\n\nimport type { CanvasKitWebGLBuffer, Video, ImageFactory } from \"../types\";\n\nimport { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { throwNotImplementedOnRNWeb } from \"./Host\";\n\nexport const createVideo = async (\n CanvasKit: CanvasKit,\n url: string\n): Promise<Video> => {\n const video = document.createElement(\"video\");\n return new Promise((resolve, reject) => {\n video.src = url;\n video.style.display = \"none\";\n video.crossOrigin = \"anonymous\";\n video.volume = 0;\n video.addEventListener(\"loadedmetadata\", () => {\n document.body.appendChild(video);\n resolve(new JsiVideo(new JsiSkImageFactory(CanvasKit), video));\n });\n video.addEventListener(\"error\", () => {\n reject(new Error(`Failed to load video from URL: ${url}`));\n });\n });\n};\n\nexport class JsiVideo implements Video {\n __typename__ = \"Video\" as const;\n\n private webglBuffer: CanvasKitWebGLBuffer | null = null;\n\n constructor(\n private ImageFactory: ImageFactory,\n private videoElement: HTMLVideoElement\n ) {\n document.body.appendChild(this.videoElement);\n }\n\n duration() {\n return this.videoElement.duration * 1000;\n }\n\n framerate(): number {\n return throwNotImplementedOnRNWeb<number>();\n }\n\n setSurface(surface: Surface) {\n // If we have the surface, we can use the WebGL buffer which is slightly faster\n // This is because WebGL cannot be shared across contextes.\n // This can be removed with WebGPU\n this.webglBuffer = new CanvasKitWebGLBufferImpl(surface, this.videoElement);\n }\n\n nextImage() {\n return this.ImageFactory.MakeImageFromNativeBuffer(\n this.webglBuffer ? this.webglBuffer : this.videoElement\n );\n }\n\n seek(time: number) {\n if (isNaN(time)) {\n throw new Error(`Invalid time: ${time}`);\n }\n this.videoElement.currentTime = time / 1000;\n }\n\n rotation() {\n return 0 as const;\n }\n\n size() {\n return {\n width: this.videoElement.videoWidth,\n height: this.videoElement.videoHeight,\n };\n }\n\n pause() {\n this.videoElement.pause();\n }\n\n play() {\n this.videoElement.play();\n }\n\n setVolume(volume: number) {\n this.videoElement.volume = volume;\n }\n\n dispose() {\n if (this.videoElement.parentNode) {\n this.videoElement.parentNode.removeChild(this.videoElement);\n }\n }\n}\n"],"mappings":";;;AAIA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,0BAA0B,QAAQ,QAAQ;AAEnD,OAAO,MAAMC,WAAW,GAAG,MAAAA,CACzBC,SAAoB,EACpBC,GAAW,KACQ;EACnB,MAAMC,KAAK,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;EAC7C,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCL,KAAK,CAACM,GAAG,GAAGP,GAAG;IACfC,KAAK,CAACO,KAAK,CAACC,OAAO,GAAG,MAAM;IAC5BR,KAAK,CAACS,WAAW,GAAG,WAAW;IAC/BT,KAAK,CAACU,MAAM,GAAG,CAAC;IAChBV,KAAK,CAACW,gBAAgB,CAAC,gBAAgB,EAAE,MAAM;MAC7CV,QAAQ,CAACW,IAAI,CAACC,WAAW,CAACb,KAAK,CAAC;MAChCI,OAAO,CAAC,IAAIU,QAAQ,CAAC,IAAInB,iBAAiB,CAACG,SAAS,CAAC,EAAEE,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC;IACFA,KAAK,CAACW,gBAAgB,CAAC,OAAO,EAAE,MAAM;MACpCN,MAAM,CAAC,IAAIU,KAAK,CAAC,kCAAkChB,GAAG,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAMe,QAAQ,CAAkB;EAKrCE,WAAWA,CACDC,YAA0B,EAC1BC,YAA8B,EACtC;IAAA,KAFQD,YAA0B,GAA1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MAAc,EAAE;IACxB,IAAI,CAACQ,YAAY,CAACR,MAAM,GAAGA,MAAM;EACnC;EAEA8B,OAAOA,CAAA,EAAG;IACR,IAAI,IAAI,CAACtB,YAAY,CAACuB,UAAU,EAAE;MAChC,IAAI,CAACvB,YAAY,CAACuB,UAAU,CAACC,WAAW,CAAC,IAAI,CAACxB,YAAY,CAAC;IAC7D;EACF;AACF","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- import type { SharedValue } from "react-native-reanimated";
2
1
  import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
3
2
  export declare enum CommandType {
4
3
  Group = 0,
@@ -44,10 +43,7 @@ export type Command<T extends CommandType = CommandType> = {
44
43
  type: T;
45
44
  [key: string]: unknown;
46
45
  };
47
- export declare const materializeProps: (command: {
48
- props: Record<string, unknown>;
49
- animatedProps?: Record<string, SharedValue<unknown>>;
50
- }) => void;
46
+ export declare const materializeCommand: (command: any) => any;
51
47
  export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
52
48
  interface GroupCommand extends Command<CommandType.Group> {
53
49
  children: Command[];
@@ -83,14 +83,22 @@ export let CommandType = /*#__PURE__*/function (CommandType) {
83
83
  CommandType[CommandType["DrawAtlas"] = 37] = "DrawAtlas";
84
84
  return CommandType;
85
85
  }({});
86
- export const materializeProps = command => {
86
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
+ export const materializeCommand = command => {
87
88
  "worklet";
88
89
 
90
+ const newProps = {
91
+ ...command.props
92
+ };
89
93
  if (command.animatedProps) {
90
94
  for (const key in command.animatedProps) {
91
- command.props[key] = command.animatedProps[key].value;
95
+ newProps[key] = command.animatedProps[key].value;
92
96
  }
93
97
  }
98
+ return {
99
+ ...command,
100
+ props: newProps
101
+ };
94
102
  };
95
103
  export const isCommand = (command, type) => {
96
104
  "worklet";
@@ -1 +1 @@
1
- {"version":3,"names":["CommandType","materializeProps","command","animatedProps","key","props","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EACrB;EADUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EA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AAO,CAACM,IAAI,KAAKR,WAAW,CAACU,KAAK;AAC3C,CAAC;AA+BD,OAAO,MAAMC,aAAa,GAAGA,CAC3BT,OAAgB,EAChBM,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["CommandType","materializeCommand","command","newProps","props","animatedProps","key","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const materializeCommand = (command: any) => {\n \"worklet\";\n const newProps = { ...command.props };\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n newProps[key] = command.animatedProps[key].value;\n }\n }\n return { ...command, props: newProps };\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"AAyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EACrB;EADUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAX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EAAED;EAAS,CAAC;AACxC,CAAC;AAED,OAAO,MAAMK,SAAS,GAAGA,CACvBN,OAAgB,EAChBO,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC;AAMD,OAAO,MAAMC,OAAO,GAAIR,OAAgB,IAA8B;EACpE,SAAS;;EACT,OAAOA,OAAO,CAACO,IAAI,KAAKT,WAAW,CAACW,KAAK;AAC3C,CAAC;AA+BD,OAAO,MAAMC,aAAa,GAAGA,CAC3BV,OAAgB,EAChBO,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAOP,OAAO,CAACO,IAAI,KAAKA,IAAI;AAC9B,CAAC","ignoreList":[]}
@@ -6,16 +6,15 @@ import { setBlurMaskFilter, isPushImageFilter, pushImageFilter, composeImageFilt
6
6
  import { setPaintProperties } from "./commands/Paint";
7
7
  import { composePathEffects, isPushPathEffect, pushPathEffect } from "./commands/PathEffects";
8
8
  import { isPushShader, pushShader } from "./commands/Shaders";
9
- import { CommandType, isCommand, isDrawCommand, isGroup, materializeProps } from "./Core";
10
- function play(ctx, command) {
9
+ import { CommandType, isCommand, isDrawCommand, isGroup, materializeCommand } from "./Core";
10
+ function play(ctx, _command) {
11
11
  "worklet";
12
12
 
13
- if (isGroup(command)) {
14
- command.children.forEach(child => play(ctx, child));
13
+ if (isGroup(_command)) {
14
+ _command.children.forEach(child => play(ctx, child));
15
15
  return;
16
16
  }
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- materializeProps(command);
17
+ const command = materializeCommand(_command);
19
18
  if (isCommand(command, CommandType.SaveBackdropFilter)) {
20
19
  ctx.saveBackdropFilter();
21
20
  } else if (isCommand(command, CommandType.SaveLayer)) {
@@ -1 +1 @@
1
- {"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeProps","play","ctx","command","children","forEach","child","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeProps,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, command: Command) {\n \"worklet\";\n if (isGroup(command)) {\n command.children.forEach((child) => play(ctx, child));\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(command as any);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,gBAAgB,QAEX,QAAQ;AAGf,SAASC,IAAIA,CAACC,GAAmB,EAAEC,OAAgB,EAAE;EACnD,SAAS;;EACT,IAAIJ,OAAO,CAACI,OAAO,CAAC,EAAE;IACpBA,OAAO,CAACC,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKL,IAAI,CAACC,GAAG,EAAEI,KAAK,CAAC,CAAC;IACrD;EACF;EACA;EACAN,gBAAgB,CAACG,OAAc,CAAC;EAChC,IAAIN,SAAS,CAACM,OAAO,EAAEP,WAAW,CAACW,kBAAkB,CAAC,EAAE;IACtDL,GAAG,CAACM,kBAAkB,CAAC,CAAC;EAC1B,C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,aAAa,CAACK,OAAO,EAAEP,WAAW,CAACuD,UAAU,CAAC,EAAE;QACzD9E,UAAU,CAAC6B,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAChC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAACwD,WAAW,CAAC,EAAE;QAC1DhF,WAAW,CAAC8B,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MACjC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAACyD,YAAY,CAAC,EAAE;QAC3DlF,YAAY,CAAC+B,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAClC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAAC0D,aAAa,CAAC,EAAE;QAC5DpF,aAAa,CAACgC,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MACnC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAAC2D,SAAS,CAAC,EAAE;QACxDtF,SAAS,CAACiC,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAC/B,CAAC,MAAM;QACLuC,OAAO,CAACC,IAAI,CAAC,oBAAoBtD,OAAO,CAACuD,IAAI,EAAE,CAAC;MAClD;MACAxD,GAAG,CAACgB,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAM8C,MAAM,GAAGA,CAACzD,GAAmB,EAAE0D,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAACvD,OAAO,CAAEF,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeCommand","play","ctx","_command","children","forEach","child","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,kBAAkB,QAEb,QAAQ;AAGf,SAASC,IAAIA,CAACC,GAAmB,EAAEC,QAAiB,EAAE;EACpD,SAAS;;EACT,IAAIJ,OAAO,CAACI,QAAQ,CAAC,EAAE;IACrBA,QAAQ,CAACC,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKL,IAAI,CAACC,GAAG,EAAEI,KAAK,CAAC,CAAC;IACtD;EACF;EACA,MAAMC,OAAO,GAAGP,kBAAkB,CAACG,QAAQ,CAAC;EAC5C,IAAIN,SAAS,CAACU,OAAO,EAAEX,WAAW,CAACY,kBAAkB,CAAC,EAAE;IACtDN,GAAG,CAACO,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MA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,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAACwD,UAAU,CAAC,EAAE;QACzD/E,UAAU,CAAC6B,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAChC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAACyD,WAAW,CAAC,EAAE;QAC1DjF,WAAW,CAAC8B,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MACjC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAAC0D,YAAY,CAAC,EAAE;QAC3DnF,YAAY,CAAC+B,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAClC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAAC2D,aAAa,CAAC,EAAE;QAC5DrF,aAAa,CAACgC,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MACnC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAAC4D,SAAS,CAAC,EAAE;QACxDvF,SAAS,CAACiC,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAC/B,CAAC,MAAM;QACLuC,OAAO,CAACC,IAAI,CAAC,oBAAoBnD,OAAO,CAACoD,IAAI,EAAE,CAAC;MAClD;MACAzD,GAAG,CAACiB,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAM8C,MAAM,GAAGA,CAAC1D,GAAmB,EAAE2D,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAACxD,OAAO,CAAEE,OAAO,IAAK;IAC5BN,IAAI,CAACC,GAAG,EAAEK,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { deflate, inflate, processColor } from "../../../dom/nodes";
2
2
  import { BlurStyle, ClipOp, isRRect } from "../../../skia/types";
3
- import { CommandType, materializeProps } from "../Core";
3
+ import { CommandType, materializeCommand } from "../Core";
4
4
  export const isBoxCommand = command => {
5
5
  "worklet";
6
6
 
@@ -9,11 +9,9 @@ export const isBoxCommand = command => {
9
9
  export const drawBox = (ctx, command) => {
10
10
  "worklet";
11
11
 
12
- command.shadows.forEach(shadow => {
13
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
- materializeProps(shadow);
12
+ const shadows = command.shadows.map(shadow => {
13
+ return materializeCommand(shadow).props;
15
14
  });
16
- const shadows = command.shadows.map(shadow => shadow.props);
17
15
  const {
18
16
  paint,
19
17
  Skia,
@@ -1 +1 @@
1
- {"version":3,"names":["deflate","inflate","processColor","BlurStyle","ClipOp","isRRect","CommandType","materializeProps","isBoxCommand","command","type","DrawBox","drawBox","ctx","shadows","forEach","shadow","map","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","Color","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate, processColor } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeProps } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n command.shadows.forEach((shadow) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(shadow as any);\n });\n const shadows = command.shadows.map((shadow) => shadow.props);\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(Skia, color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,YAAY,QAAQ,oBAAoB;AAEnE,SAASC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AAEhE,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,SAAS;AAQvD,OAAO,MAAMC,YAAY,GAAIC,OAAgB,IAA4B;EACvE,SAAS;;EACT,OAAOA,OAAO,CAACC,IAAI,KAAKJ,WAAW,CAACK,OAAO;AAC7C,CAAC;AAED,OAAO,MAAMC,OAAO,GAAGA,CAACC,GAAmB,EAAEJ,OAAmB,KAAK;EACnE,SAAS;;EACTA,OAAO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AACU,CAAC,CAAC;IAClDhC,MAAM,CAACiC,UAAU,CAACH,KAAK,EAAEvB,KAAK,EAAEM,MAAM,CAAC;IACvCb,MAAM,CAACkC,OAAO,CAAC,CAAC;EAClB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["deflate","inflate","processColor","BlurStyle","ClipOp","isRRect","CommandType","materializeCommand","isBoxCommand","command","type","DrawBox","drawBox","ctx","shadows","map","shadow","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","Color","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate, processColor } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeCommand } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n const shadows = command.shadows.map((shadow) => {\n return materializeCommand(shadow).props;\n });\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(Skia, color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,YAAY,QAAQ,oBAAoB;AAEnE,SAASC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AAEhE,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,SAAS;AAQzD,OAAO,MAAMC,YAAY,GAAIC,OAAgB,IAA4B;EACvE,SAAS;;EACT,OAAOA,OAAO,CAACC,IAAI,KAAKJ,WAAW,CAACK,OAAO;AAC7C,CAAC;AAED,OAAO,MAAMC,OAAO,GAAGA,CAACC,GAAmB,EAAEJ,OAAmB,KAAK;EACnE,SAAS;;EACT,MAAMK,OAAO,GAAGL,OAAO,CAACK,OAAO,CAACC,GAAG,CAAEC,MAAM,IAAK;IAC9C,OAAOT,kBAAkB,CAACS,MAAM,CAAC,CAACC,KAAK;EACzC,CAAC,CAAC;EACF,MAAM;IAAEC,KAAK;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGP,GAAG;EACnC,MAAM;IAAEQ,GAAG,EAAEC;EAAW,CAAC,GAAGb,OA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AAC;MAAEC,EAAE,GAAG;IAAE,CAAC,GAAGhB,MAAM;IACpE,MAAM0B,KAAK,GAAGvB,IAAI,CAACwB,KAAK,CAAC,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACd,EAAE,CAAC,EAAE,EAAE,GAAGa,IAAI,CAACC,GAAG,CAACb,EAAE,CAAC,CAAC;IAC9DZ,MAAM,CAAC0B,IAAI,CAAC,CAAC;IACb1B,MAAM,CAAC2B,SAAS,CAAC1B,GAAG,EAAEjB,MAAM,CAAC4C,SAAS,EAAE,KAAK,CAAC;IAC9C,MAAMf,MAAM,GAAGd,IAAI,CAACe,KAAK,CAAC,CAAC;IAC3BD,MAAM,CAACE,QAAQ,CAAChB,IAAI,CAAC8B,KAAK,CAACrB,KAAK,CAAC,CAAC;IAClCK,MAAM,CAACG,SAAS,CAAClB,KAAK,CAACM,SAAS,CAAC,CAAC,GAAGD,OAAO,CAAC;IAE7CU,MAAM,CAACI,aAAa,CAClBlB,IAAI,CAACmB,UAAU,CAACC,QAAQ,CAACpC,SAAS,CAACqC,MAAM,EAAEX,IAAI,EAAE,IAAI,CACvD,CAAC;IACD,MAAMF,KAAK,GAAG3B,OAAO,CAACmB,IAAI,EAAEE,GAAG,EAAES,MAAM,EAAEA,MAAM,EAAEC,EAAE,EAAEC,EAAE,CAAC;IACxD,MAAMkB,KAAK,GAAGjD,OAAO,CAACkB,IAAI,EAAEE,GAAG,EAAEqB,KAAK,CAACS,CAAC,EAAET,KAAK,CAACU,CAAC,CAAC;IAClDhC,MAAM,CAACiC,UAAU,CAACH,KAAK,EAAEvB,KAAK,EAAEM,MAAM,CAAC;IACvCb,MAAM,CAACkC,OAAO,CAAC,CAAC;EAClB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  export const __esModule: boolean;
2
2
  export function Mock(CanvasKit: any): {
3
- Canvas: () => undefined;
3
+ Canvas: typeof import("react-native").View;
4
4
  useValue: () => {
5
5
  current: number;
6
6
  };
@@ -1,7 +1,5 @@
1
1
  export const __esModule: boolean;
2
- export class NotImplementedOnRNWeb extends Error {
3
- constructor(msg: any);
4
- }
2
+ export function throwNotImplementedOnRNWeb(): jest.Mock<any, any, any>;
5
3
  export class Host {
6
4
  constructor(CanvasKit: any);
7
5
  CanvasKit: any;
@@ -1,7 +1,7 @@
1
1
  export const __esModule: boolean;
2
2
  export class JsiSkFont extends _Host.HostObject {
3
3
  constructor(CanvasKit: any, ref: any);
4
- measureText(_text: any, _paint: any): void;
4
+ measureText(_text: any, _paint: any): jest.Mock<any, any, any>;
5
5
  getTextWidth(text: any, paint: any): any;
6
6
  getMetrics(): {
7
7
  ascent: any;
@@ -4,6 +4,6 @@ export class JsiSkFontMgr extends _Host.HostObject {
4
4
  dispose(): void;
5
5
  countFamilies(): any;
6
6
  getFamilyName(index: any): any;
7
- matchFamilyStyle(_familyName: any, _fontStyle: any): void;
7
+ matchFamilyStyle(_familyName: any, _fontStyle: any): jest.Mock<any, any, any>;
8
8
  }
9
9
  import _Host = require("./Host");
@@ -3,7 +3,7 @@ export class JsiSkImageFactory extends _Host.Host {
3
3
  MakeImageFromViewTag(viewTag: any): Promise<null>;
4
4
  MakeImageFromNativeBuffer(buffer: any, surface: any, image: any): _JsiSkImage.JsiSkImage;
5
5
  MakeImageFromEncoded(encoded: any): _JsiSkImage.JsiSkImage | null;
6
- MakeImageFromNativeTextureUnstable(): void;
6
+ MakeImageFromNativeTextureUnstable(): jest.Mock<any, any, any>;
7
7
  MakeImage(info: any, data: any, bytesPerRow: any): _JsiSkImage.JsiSkImage | null;
8
8
  }
9
9
  import _Host = require("./Host");
@@ -11,7 +11,7 @@ export class JsiSkImageFilterFactory extends _Host.Host {
11
11
  MakeErode(rx: any, ry: any, input: any, cropRect: any): _JsiSkImageFilter.JsiSkImageFilter;
12
12
  MakeDilate(rx: any, ry: any, input: any, cropRect: any): _JsiSkImageFilter.JsiSkImageFilter;
13
13
  MakeBlend(mode: any, background: any, foreground: any, cropRect: any): _JsiSkImageFilter.JsiSkImageFilter;
14
- MakeRuntimeShader(_builder: any, _childShaderName: any, _input: any): void;
14
+ MakeRuntimeShader(_builder: any, _childShaderName: any, _input: any): jest.Mock<any, any, any>;
15
15
  }
16
16
  import _Host = require("./Host");
17
17
  import _JsiSkImageFilter = require("./JsiSkImageFilter");
@@ -3,8 +3,8 @@ export class JsiSkPathEffectFactory extends _Host.Host {
3
3
  MakeCorner(radius: any): _JsiSkPathEffect.JsiSkPathEffect | null;
4
4
  MakeDash(intervals: any, phase: any): _JsiSkPathEffect.JsiSkPathEffect;
5
5
  MakeDiscrete(segLength: any, dev: any, seedAssist: any): _JsiSkPathEffect.JsiSkPathEffect;
6
- MakeCompose(_outer: any, _inner: any): void;
7
- MakeSum(_outer: any, _inner: any): void;
6
+ MakeCompose(_outer: any, _inner: any): jest.Mock<any, any, any>;
7
+ MakeSum(_outer: any, _inner: any): jest.Mock<any, any, any>;
8
8
  MakeLine2D(width: any, matrix: any): _JsiSkPathEffect.JsiSkPathEffect | null;
9
9
  MakePath1D(path: any, advance: any, phase: any, style: any): _JsiSkPathEffect.JsiSkPathEffect | null;
10
10
  MakePath2D(matrix: any, path: any): _JsiSkPathEffect.JsiSkPathEffect | null;
@@ -4,7 +4,7 @@ export class JsiSkPathFactory extends _Host.Host {
4
4
  MakeFromSVGString(str: any): _JsiSkPath.JsiSkPath | null;
5
5
  MakeFromOp(one: any, two: any, op: any): _JsiSkPath.JsiSkPath | null;
6
6
  MakeFromCmds(cmds: any): _JsiSkPath.JsiSkPath | null;
7
- MakeFromText(_text: any, _x: any, _y: any, _font: any): void;
7
+ MakeFromText(_text: any, _x: any, _y: any, _font: any): jest.Mock<any, any, any>;
8
8
  }
9
9
  import _Host = require("./Host");
10
10
  import _JsiSkPath = require("./JsiSkPath");
@@ -1,7 +1,7 @@
1
1
  export const __esModule: boolean;
2
2
  export class JsiSkTypefaceFontProvider extends _Host.HostObject {
3
3
  constructor(CanvasKit: any, ref: any);
4
- matchFamilyStyle(_name: any, _style: any): void;
4
+ matchFamilyStyle(_name: any, _style: any): jest.Mock<any, any, any>;
5
5
  countFamilies(): any;
6
6
  getFamilyName(index: any): any;
7
7
  registerFont(typeface: any, familyName: any): void;
@@ -1,7 +1,7 @@
1
1
  export const __esModule: boolean;
2
2
  export function JsiSkApi(CanvasKit: any): {
3
3
  Point: (x: any, y: any) => _JsiSkPoint.JsiSkPoint;
4
- RuntimeShaderBuilder: (_: any) => never;
4
+ RuntimeShaderBuilder: (_: any) => jest.Mock<any, any, any>;
5
5
  RRectXY: (rect: any, rx: any, ry: any) => _JsiSkRRect.JsiSkRRect;
6
6
  RSXform: (scos: any, ssin: any, tx: any, ty: any) => _JsiSkRSXform.JsiSkRSXform;
7
7
  RSXformFromRadians: (scale: any, r: any, tx: any, ty: any, px: any, py: any) => _JsiSkRSXform.JsiSkRSXform;
@@ -33,8 +33,8 @@ export function JsiSkApi(CanvasKit: any): {
33
33
  ParagraphBuilder: _JsiSkParagraphBuilderFactory.JsiSkParagraphBuilderFactory;
34
34
  NativeBuffer: _JsiSkNativeBufferFactory.JsiSkNativeBufferFactory;
35
35
  Video: (url?: any) => Promise<any>;
36
- Context: (_surface: any, _width: any, _height: any) => never;
37
- Recorder: () => never;
36
+ Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
37
+ Recorder: () => jest.Mock<any, any, any>;
38
38
  };
39
39
  import _JsiSkPoint = require("./JsiSkPoint");
40
40
  import _JsiSkRRect = require("./JsiSkRRect");
@@ -5,7 +5,7 @@ export class JsiVideo {
5
5
  ImageFactory: any;
6
6
  videoElement: any;
7
7
  duration(): number;
8
- framerate(): void;
8
+ framerate(): jest.Mock<any, any, any>;
9
9
  setSurface(surface: any): void;
10
10
  webglBuffer: _CanvasKitWebGLBufferImpl.CanvasKitWebGLBufferImpl | undefined;
11
11
  nextImage(): any;
@@ -1,6 +1,6 @@
1
1
  export const __esModule: boolean;
2
2
  export const CommandType: {};
3
- export function materializeProps(command: any): void;
3
+ export function materializeCommand(command: any): any;
4
4
  export function isCommand(command: any, type: any): boolean;
5
5
  export function isGroup(command: any): boolean;
6
6
  export function isDrawCommand(command: any, type: any): boolean;
@@ -1,5 +1,5 @@
1
1
  export function Mock(CanvasKit: any): {
2
- Canvas: () => undefined;
2
+ Canvas: typeof import("react-native").View;
3
3
  useValue: () => {
4
4
  current: number;
5
5
  };
@@ -1,6 +1,6 @@
1
1
  export const Skia: {
2
2
  Point: (x: any, y: any) => import("./web/JsiSkPoint").JsiSkPoint;
3
- RuntimeShaderBuilder: (_: any) => never;
3
+ RuntimeShaderBuilder: (_: any) => jest.Mock<any, any, any>;
4
4
  RRectXY: (rect: any, rx: any, ry: any) => import("./web/JsiSkRRect").JsiSkRRect;
5
5
  RSXform: (scos: any, ssin: any, tx: any, ty: any) => import("./web/JsiSkRSXform").JsiSkRSXform;
6
6
  RSXformFromRadians: (scale: any, r: any, tx: any, ty: any, px: any, py: any) => import("./web/JsiSkRSXform").JsiSkRSXform;
@@ -32,6 +32,6 @@ export const Skia: {
32
32
  ParagraphBuilder: import("./web/JsiSkParagraphBuilderFactory").JsiSkParagraphBuilderFactory;
33
33
  NativeBuffer: import("./web/JsiSkNativeBufferFactory").JsiSkNativeBufferFactory;
34
34
  Video: (url?: any) => Promise<any>;
35
- Context: (_surface: any, _width: any, _height: any) => never;
36
- Recorder: () => never;
35
+ Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
36
+ Recorder: () => jest.Mock<any, any, any>;
37
37
  };
@@ -1,6 +1,4 @@
1
- export class NotImplementedOnRNWeb extends Error {
2
- constructor(msg: any);
3
- }
1
+ export function throwNotImplementedOnRNWeb(): jest.Mock<any, any, any>;
4
2
  export class Host {
5
3
  constructor(CanvasKit: any);
6
4
  CanvasKit: any;
@@ -1,6 +1,6 @@
1
1
  export class JsiSkFont extends HostObject {
2
2
  constructor(CanvasKit: any, ref: any);
3
- measureText(_text: any, _paint: any): void;
3
+ measureText(_text: any, _paint: any): jest.Mock<any, any, any>;
4
4
  getTextWidth(text: any, paint: any): any;
5
5
  getMetrics(): {
6
6
  ascent: any;