@shopify/react-native-skia 0.1.142 → 0.1.146

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. package/cpp/api/JsiSkContourMeasure.h +4 -4
  2. package/cpp/api/JsiSkDataFactory.h +3 -3
  3. package/cpp/api/JsiSkFont.h +1 -1
  4. package/cpp/api/JsiSkPaint.h +6 -0
  5. package/cpp/api/JsiSkPathFactory.h +2 -2
  6. package/cpp/api/JsiSkPicture.h +7 -1
  7. package/cpp/api/JsiSkPictureFactory.h +1 -1
  8. package/cpp/api/JsiSkRuntimeEffect.h +6 -6
  9. package/cpp/api/JsiSkRuntimeEffectFactory.h +1 -1
  10. package/cpp/jsi/JsiSimpleValueWrapper.h +27 -27
  11. package/cpp/jsi/JsiValueWrapper.h +127 -0
  12. package/cpp/rnskia/RNSkDrawView.cpp +44 -20
  13. package/cpp/rnskia/RNSkDrawView.h +18 -20
  14. package/cpp/rnskia/RNSkJsiViewApi.h +180 -166
  15. package/cpp/rnskia/values/RNSkComputedValue.h +11 -11
  16. package/cpp/rnskia/values/RNSkReadonlyValue.h +19 -19
  17. package/cpp/rnskia/values/RNSkValue.h +13 -13
  18. package/cpp/utils/RNSkLog.h +4 -4
  19. package/lib/commonjs/renderer/Canvas.js +17 -7
  20. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  21. package/lib/commonjs/renderer/DependencyManager.js +144 -36
  22. package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
  23. package/lib/commonjs/renderer/HostConfig.js +18 -2
  24. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  25. package/lib/commonjs/renderer/components/Blend.js +20 -5
  26. package/lib/commonjs/renderer/components/Blend.js.map +1 -1
  27. package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  28. package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
  29. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  30. package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
  31. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
  32. package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
  33. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  34. package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
  35. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  36. package/lib/commonjs/renderer/nodes/Node.js +9 -7
  37. package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
  38. package/lib/commonjs/renderer/processors/Animations/Animations.js +3 -22
  39. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  40. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  41. package/lib/commonjs/skia/web/Host.js +12 -21
  42. package/lib/commonjs/skia/web/Host.js.map +1 -1
  43. package/lib/commonjs/skia/web/JsiSkCanvas.js +46 -26
  44. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  45. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
  46. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
  48. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  49. package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
  50. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  51. package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
  52. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  53. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
  54. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  55. package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
  56. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  57. package/lib/commonjs/skia/web/JsiSkPaint.js +19 -6
  58. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  59. package/lib/commonjs/skia/web/JsiSkPath.js +9 -55
  60. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  61. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
  62. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  63. package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
  64. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  65. package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
  66. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  67. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
  68. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  69. package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
  70. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  71. package/lib/commonjs/skia/web/JsiSkRRect.js +1 -1
  72. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  73. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  74. package/lib/commonjs/skia/web/JsiSkRect.js +1 -1
  75. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  76. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
  77. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  78. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
  79. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  80. package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
  81. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  82. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
  83. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  84. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
  85. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  86. package/lib/commonjs/skia/web/JsiSkia.js +12 -6
  87. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  88. package/lib/commonjs/views/SkiaView.js +11 -27
  89. package/lib/commonjs/views/SkiaView.js.map +1 -1
  90. package/lib/commonjs/views/types.js.map +1 -1
  91. package/lib/module/renderer/Canvas.js +17 -6
  92. package/lib/module/renderer/Canvas.js.map +1 -1
  93. package/lib/module/renderer/DependencyManager.js +140 -33
  94. package/lib/module/renderer/DependencyManager.js.map +1 -1
  95. package/lib/module/renderer/HostConfig.js +18 -2
  96. package/lib/module/renderer/HostConfig.js.map +1 -1
  97. package/lib/module/renderer/components/Blend.js +21 -5
  98. package/lib/module/renderer/components/Blend.js.map +1 -1
  99. package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  100. package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
  101. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  102. package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
  103. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
  104. package/lib/module/renderer/nodes/Declaration.js +3 -4
  105. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  106. package/lib/module/renderer/nodes/Drawing.js +3 -6
  107. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  108. package/lib/module/renderer/nodes/Node.js +9 -7
  109. package/lib/module/renderer/nodes/Node.js.map +1 -1
  110. package/lib/module/renderer/processors/Animations/Animations.js +1 -16
  111. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  112. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  113. package/lib/module/skia/web/Host.js +9 -9
  114. package/lib/module/skia/web/Host.js.map +1 -1
  115. package/lib/module/skia/web/JsiSkCanvas.js +37 -27
  116. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  117. package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
  118. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  119. package/lib/module/skia/web/JsiSkFont.js +6 -4
  120. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  121. package/lib/module/skia/web/JsiSkImage.js +4 -3
  122. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  123. package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
  124. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  125. package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
  126. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  127. package/lib/module/skia/web/JsiSkMatrix.js +2 -2
  128. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  129. package/lib/module/skia/web/JsiSkPaint.js +15 -7
  130. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  131. package/lib/module/skia/web/JsiSkPath.js +9 -57
  132. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  133. package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
  134. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  135. package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
  136. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  137. package/lib/module/skia/web/JsiSkPicture.js +4 -2
  138. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  139. package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
  140. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  141. package/lib/module/skia/web/JsiSkPoint.js +10 -2
  142. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  143. package/lib/module/skia/web/JsiSkRRect.js +2 -2
  144. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  145. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  146. package/lib/module/skia/web/JsiSkRect.js +2 -2
  147. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  148. package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
  149. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  150. package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
  151. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  152. package/lib/module/skia/web/JsiSkSurface.js +3 -2
  153. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  154. package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
  155. package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  156. package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
  157. package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  158. package/lib/module/skia/web/JsiSkia.js +10 -5
  159. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  160. package/lib/module/views/SkiaView.js +11 -26
  161. package/lib/module/views/SkiaView.js.map +1 -1
  162. package/lib/module/views/types.js.map +1 -1
  163. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  164. package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
  165. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
  166. package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
  167. package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
  168. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +0 -1
  169. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
  170. package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
  171. package/lib/typescript/src/skia/web/Host.d.ts +6 -8
  172. package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
  173. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  174. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
  175. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
  176. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
  177. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +2 -2
  178. package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
  179. package/lib/typescript/src/views/SkiaView.d.ts +1 -11
  180. package/lib/typescript/src/views/types.d.ts +5 -5
  181. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  182. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  183. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  184. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  185. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  186. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  187. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  188. package/package.json +2 -2
  189. package/src/renderer/Canvas.tsx +19 -7
  190. package/src/renderer/DependencyManager.tsx +170 -39
  191. package/src/renderer/HostConfig.ts +12 -2
  192. package/src/renderer/components/Blend.tsx +25 -5
  193. package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
  194. package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
  195. package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
  196. package/src/renderer/nodes/Declaration.tsx +6 -8
  197. package/src/renderer/nodes/Drawing.tsx +5 -7
  198. package/src/renderer/nodes/Node.ts +11 -9
  199. package/src/renderer/processors/Animations/Animations.ts +2 -15
  200. package/src/skia/types/Paint/Paint.ts +6 -0
  201. package/src/skia/types/Picture/Picture.ts +2 -1
  202. package/src/skia/web/Host.ts +12 -22
  203. package/src/skia/web/JsiSkCanvas.ts +78 -47
  204. package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
  205. package/src/skia/web/JsiSkFont.ts +11 -4
  206. package/src/skia/web/JsiSkImage.ts +4 -3
  207. package/src/skia/web/JsiSkImageFactory.ts +6 -3
  208. package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
  209. package/src/skia/web/JsiSkMatrix.ts +4 -2
  210. package/src/skia/web/JsiSkPaint.ts +15 -7
  211. package/src/skia/web/JsiSkPath.ts +16 -51
  212. package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
  213. package/src/skia/web/JsiSkPathFactory.ts +3 -3
  214. package/src/skia/web/JsiSkPicture.ts +5 -3
  215. package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
  216. package/src/skia/web/JsiSkPoint.ts +12 -2
  217. package/src/skia/web/JsiSkRRect.ts +5 -2
  218. package/src/skia/web/JsiSkRSXform.ts +1 -1
  219. package/src/skia/web/JsiSkRect.ts +2 -2
  220. package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
  221. package/src/skia/web/JsiSkShaderFactory.ts +24 -15
  222. package/src/skia/web/JsiSkSurface.ts +7 -2
  223. package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
  224. package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
  225. package/src/skia/web/JsiSkia.ts +17 -5
  226. package/src/views/SkiaView.tsx +17 -28
  227. package/src/views/types.ts +7 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["Node.ts"],"names":["NodeType","Node","constructor","depMgr","props","_props","unSubscribeNode","subscribeNode","visit","ctx","children","returnedValues","forEach","child","memoized","memoizable","push","ret","draw"],"mappings":";;AAKA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q;AAAAA,EAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,OAAO,MAAeC,IAAf,CAAiC;AAQtCC,EAAAA,WAAW,CAACC,MAAD,EAA4BC,KAA5B,EAAqD;AAAA,sCAPpC,EAOoC;;AAAA;;AAAA,wCALnD,KAKmD;;AAAA,sCAJ3B,IAI2B;;AAAA;;AAAA;;AAC9D,SAAKC,MAAL,GAAcD,KAAd;AACA,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKA,MAAL,CAAYG,eAAZ,CAA4B,IAA5B;AACA,SAAKH,MAAL,CAAYI,aAAZ,CAA0B,IAA1B,EAAgCH,KAAhC;AACD;;AAIQ,MAALA,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKD,MAAL,CAAYG,eAAZ,CAA4B,IAA5B;AACA,SAAKH,MAAL,CAAYI,aAAZ,CAA0B,IAA1B,EAAgCH,KAAhC;AACA,SAAKC,MAAL,GAAcD,KAAd;AACD;;AAEQ,MAALA,KAAK,GAAG;AACV,WAAO,KAAKC,MAAZ;AACD;;AAEDG,EAAAA,KAAK,CAACC,GAAD,EAAsBC,QAAtB,EAAyC;AAC5C,UAAMC,cAAkD,GAAG,EAA3D;AACA,KAACD,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,KAAKA,QAAlB,EAA4BE,OAA5B,CAAqCC,KAAD,IAAW;AAC7C,UAAIA,KAAK,CAACC,QAAN,IAAkBD,KAAK,CAACE,UAA5B,EAAwC;AACtCJ,QAAAA,cAAc,CAACK,IAAf,CAAoBH,KAAK,CAACC,QAA1B;AACD,OAFD,MAEO;AACL,cAAMG,GAAG,GAAGJ,KAAK,CAACK,IAAN,CAAWT,GAAX,CAAZ;;AACA,YAAIQ,GAAJ,EAAS;AACPN,UAAAA,cAAc,CAACK,IAAf,CAAoBC,GAApB;;AACA,cAAIJ,KAAK,CAACE,UAAV,EAAsB;AACpBF,YAAAA,KAAK,CAACC,QAAN,GAAiBG,GAAjB;AACD;AACF;AACF;AACF,KAZD;AAaA,WAAON,cAAP;AACD;;AA3CqC","sourcesContent":["import type { SkJSIInstance } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\n\nexport enum NodeType {\n Declaration = \"skDeclaration\",\n Drawing = \"skDrawing\",\n}\n\ntype DeclarationResult = SkJSIInstance<string> | null;\n\nexport abstract class Node<P = unknown> {\n readonly children: Node[] = [];\n _props: AnimatedProps<P>;\n memoizable = false;\n memoized: DeclarationResult | null = null;\n parent?: Node;\n depMgr: DependencyManager;\n\n constructor(depMgr: DependencyManager, props: AnimatedProps<P>) {\n this._props = props;\n this.depMgr = depMgr;\n this.depMgr.unSubscribeNode(this);\n this.depMgr.subscribeNode(this, props);\n }\n\n abstract draw(ctx: DrawingContext): void | DeclarationResult;\n\n set props(props: AnimatedProps<P>) {\n this.depMgr.unSubscribeNode(this);\n this.depMgr.subscribeNode(this, props);\n this._props = props;\n }\n\n get props() {\n return this._props;\n }\n\n visit(ctx: DrawingContext, children?: Node[]) {\n const returnedValues: Exclude<DeclarationResult, null>[] = [];\n (children ?? this.children).forEach((child) => {\n if (child.memoized && child.memoizable) {\n returnedValues.push(child.memoized);\n } else {\n const ret = child.draw(ctx);\n if (ret) {\n returnedValues.push(ret);\n if (child.memoizable) {\n child.memoized = ret;\n }\n }\n }\n });\n return returnedValues;\n }\n}\n"]}
1
+ {"version":3,"sources":["Node.ts"],"names":["NodeType","Node","constructor","depMgr","props","updatePropSubscriptions","subscribeNode","unsubscribeNode","resolvedProps","visit","ctx","children","returnedValues","forEach","child","memoized","memoizable","push","ret","draw"],"mappings":";;AAKA,WAAYA,QAAZ;;WAAYA,Q;AAAAA,EAAAA,Q;AAAAA,EAAAA,Q;GAAAA,Q,KAAAA,Q;;AAOZ,OAAO,MAAeC,IAAf,CAAiC;AAEtC;AAOAC,EAAAA,WAAW,CAACC,MAAD,EAA4BC,KAA5B,EAAqD;AAAA,sCARpC,EAQoC;;AAAA,2CAN7C,EAM6C;;AAAA,wCALnD,KAKmD;;AAAA,sCAJ3B,IAI2B;;AAAA;;AAAA;;AAC9D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,uBAAL,CAA6BD,KAA7B;AACD;;AAIDC,EAAAA,uBAAuB,CAACD,KAAD,EAA0B;AAC/C,SAAKD,MAAL,CAAYG,aAAZ,CAA0B,IAA1B,EAAgCF,KAAhC;AACD;;AAEQ,MAALA,KAAK,CAACA,KAAD,EAA0B;AACjC,SAAKD,MAAL,CAAYI,eAAZ,CAA4B,IAA5B;AACA,SAAKF,uBAAL,CAA6BD,KAA7B;AACD;;AAEQ,MAALA,KAAK,GAAM;AACb,WAAO,KAAKI,aAAZ;AACD;;AAEDC,EAAAA,KAAK,CAACC,GAAD,EAAsBC,QAAtB,EAAyC;AAC5C,UAAMC,cAAkD,GAAG,EAA3D;AACA,KAACD,QAAD,aAACA,QAAD,cAACA,QAAD,GAAa,KAAKA,QAAlB,EAA4BE,OAA5B,CAAqCC,KAAD,IAAW;AAC7C,UAAIA,KAAK,CAACC,QAAN,IAAkBD,KAAK,CAACE,UAA5B,EAAwC;AACtCJ,QAAAA,cAAc,CAACK,IAAf,CAAoBH,KAAK,CAACC,QAA1B;AACD,OAFD,MAEO;AACL,cAAMG,GAAG,GAAGJ,KAAK,CAACK,IAAN,CAAWT,GAAX,CAAZ;;AACA,YAAIQ,GAAJ,EAAS;AACPN,UAAAA,cAAc,CAACK,IAAf,CAAoBC,GAApB;;AACA,cAAIJ,KAAK,CAACE,UAAV,EAAsB;AACpBF,YAAAA,KAAK,CAACC,QAAN,GAAiBG,GAAjB;AACD;AACF;AACF;AACF,KAZD;AAaA,WAAON,cAAP;AACD;;AA7CqC","sourcesContent":["import type { SkJSIInstance } from \"../../skia/types\";\nimport type { DependencyManager } from \"../DependencyManager\";\nimport type { DrawingContext } from \"../DrawingContext\";\nimport type { AnimatedProps } from \"../processors\";\n\nexport enum NodeType {\n Declaration = \"skDeclaration\",\n Drawing = \"skDrawing\",\n}\n\ntype DeclarationResult = SkJSIInstance<string> | null;\n\nexport abstract class Node<P = unknown> {\n readonly children: Node[] = [];\n // This cast is ok because we understand that the dependency manager will setup the initial props\n resolvedProps: P = {} as P;\n memoizable = false;\n memoized: DeclarationResult | null = null;\n parent?: Node;\n depMgr: DependencyManager;\n\n constructor(depMgr: DependencyManager, props: AnimatedProps<P>) {\n this.depMgr = depMgr;\n this.updatePropSubscriptions(props);\n }\n\n abstract draw(ctx: DrawingContext): void | DeclarationResult;\n\n updatePropSubscriptions(props: AnimatedProps<P>) {\n this.depMgr.subscribeNode(this, props);\n }\n\n set props(props: AnimatedProps<P>) {\n this.depMgr.unsubscribeNode(this);\n this.updatePropSubscriptions(props);\n }\n\n get props(): P {\n return this.resolvedProps;\n }\n\n visit(ctx: DrawingContext, children?: Node[]) {\n const returnedValues: Exclude<DeclarationResult, null>[] = [];\n (children ?? this.children).forEach((child) => {\n if (child.memoized && child.memoizable) {\n returnedValues.push(child.memoized);\n } else {\n const ret = child.draw(ctx);\n if (ret) {\n returnedValues.push(ret);\n if (child.memoizable) {\n child.memoized = ret;\n }\n }\n }\n });\n return returnedValues;\n }\n}\n"]}
@@ -1,4 +1,3 @@
1
- import { mapKeys } from "../../typeddash";
2
1
  export const isValue = value => {
3
2
  if (value === undefined || value === null) {
4
3
  return false;
@@ -21,25 +20,11 @@ export const isSelector = value => {
21
20
  };
22
21
  export const isAnimated = props => {
23
22
  for (const value of Object.values(props)) {
24
- if (isValue(value)) {
23
+ if (isValue(value) || isSelector(value)) {
25
24
  return true;
26
25
  }
27
26
  }
28
27
 
29
28
  return false;
30
- };
31
- export const materialize = props => {
32
- const result = { ...props
33
- };
34
- mapKeys(props).forEach(key => {
35
- const prop = props[key];
36
-
37
- if (isValue(prop)) {
38
- result[key] = prop.current;
39
- } else if (isSelector(prop)) {
40
- result[key] = prop.selector(prop.value.current);
41
- }
42
- });
43
- return result;
44
29
  }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
30
  //# sourceMappingURL=Animations.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Animations.ts"],"names":["mapKeys","isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values","materialize","result","forEach","key","prop","current"],"mappings":"AACA,SAASA,OAAT,QAAwB,iBAAxB;AAEA,OAAO,MAAMC,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;AAgBP,OAAO,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;AAkBP,OAAO,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClB,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM;AASP,OAAO,MAAMS,WAAW,GAAOH,KAAJ,IAAgC;AACzD,QAAMI,MAAM,GAAG,EAAE,GAAGJ;AAAL,GAAf;AACAR,EAAAA,OAAO,CAACQ,KAAD,CAAP,CAAeK,OAAf,CAAwBC,GAAD,IAAS;AAC9B,UAAMC,IAAI,GAAGP,KAAK,CAACM,GAAD,CAAlB;;AACA,QAAIb,OAAO,CAACc,IAAD,CAAX,EAAmB;AACjBH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAeC,IAAD,CAAmCC,OAAjD;AACD,KAFD,MAEO,IAAIX,UAAU,CAACU,IAAD,CAAd,EAAsB;AAC3BH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAcC,IAAI,CAACT,QAAL,CAAcS,IAAI,CAACb,KAAL,CAAWc,OAAzB,CAAd;AACD;AACF,GAPD;AAQA,SAAOJ,MAAP;AACD,CAXM,C,CAaP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\nimport { mapKeys } from \"../../typeddash\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value)) {\n return true;\n }\n }\n return false;\n};\n\nexport const materialize = <T>(props: AnimatedProps<T>) => {\n const result = { ...props };\n mapKeys(props).forEach((key) => {\n const prop = props[key];\n if (isValue(prop)) {\n result[key] = (prop as SkiaValue<T[typeof key]>).current;\n } else if (isSelector(prop)) {\n result[key] = prop.selector(prop.value.current) as T[typeof key];\n }\n });\n return result as T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
1
+ {"version":3,"sources":["Animations.ts"],"names":["isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values"],"mappings":"AAEA,OAAO,MAAMA,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;AAgBP,OAAO,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;AAkBP,OAAO,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAP,IAAkBG,UAAU,CAACH,KAAD,CAAhC,EAAyC;AACvC,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM,C,CASP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value) || isSelector(value)) {\n return true;\n }\n }\n return false;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\n\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":"AAUA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAMZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,OAAO,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { SkMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkColor } from \"../Color\";\nimport type { SkPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Miter,\n Round,\n Bevel,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: SkMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: SkPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
1
+ {"version":3,"sources":["Paint.ts"],"names":["PaintStyle","StrokeCap","StrokeJoin","isPaint","obj","__typename__"],"mappings":"AAUA,WAAYA,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAKZ,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S;;AAMZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U;;AAMZ,OAAO,MAAMC,OAAO,GAAIC,GAAD,IACrBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,OADhC","sourcesContent":["import type { SkImageFilter } from \"../ImageFilter\";\nimport type { SkMaskFilter } from \"../MaskFilter\";\nimport type { SkColorFilter } from \"../ColorFilter\";\nimport type { SkColor } from \"../Color\";\nimport type { SkPathEffect } from \"../PathEffect\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkShader } from \"../Shader\";\n\nimport type { BlendMode } from \"./BlendMode\";\n\nexport enum PaintStyle {\n Fill,\n Stroke,\n}\n\nexport enum StrokeCap {\n Butt,\n Round,\n Square,\n}\n\nexport enum StrokeJoin {\n Miter,\n Round,\n Bevel,\n}\n\nexport const isPaint = (obj: SkJSIInstance<string> | null): obj is SkPaint =>\n obj !== null && obj.__typename__ === \"Paint\";\n\nexport interface SkPaint extends SkJSIInstance<\"Paint\"> {\n /**\n * Returns a copy of this paint.\n */\n copy(): SkPaint;\n\n /**\n * Sets all SkPaint contents to their initial values. This is equivalent to replacing\n SkPaint with the result of SkPaint().\n */\n reset(): void;\n\n /**\n * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values\n * (sRGB gamut, and encoded with the sRGB transfer function).\n */\n getColor(): SkColor;\n\n /**\n * Returns the geometry drawn at the beginning and end of strokes.\n */\n getStrokeCap(): StrokeCap;\n\n /**\n * Returns the geometry drawn at the corners of strokes.\n */\n getStrokeJoin(): StrokeJoin;\n\n /**\n * Returns the limit at which a sharp corner is drawn beveled.\n */\n getStrokeMiter(): number;\n\n /**\n * Returns the thickness of the pen used to outline the shape.\n */\n getStrokeWidth(): number;\n\n /**\n * Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.\n * @param alpha\n */\n setAlphaf(alpha: number): void;\n\n /**\n * Requests, but does not require, that edge pixels draw opaque or with\n * partial transparency.\n * @param aa\n */\n setAntiAlias: (aa: boolean) => void;\n\n /**\n * Sets the blend mode that is, the mode used to combine source color\n * with destination color.\n * @param mode\n */\n setBlendMode: (blendMode: BlendMode) => void;\n\n /**\n * Sets alpha and RGB used when stroking and filling. The color is a 32-bit\n * value, unpremultiplied, packing 8-bit components for alpha, red, blue,\n * and green.\n *\n * @param color unpremultiplied ARGB\n *\n * example: https://fiddle.skia.org/c/@Paint_setColor\n */\n setColor(color: SkColor): void;\n\n /**\n * Sets the current color filter, replacing the existing one if there was one.\n * @param filter\n */\n setColorFilter(filter: SkColorFilter | null): void;\n\n /**\n * Sets the current image filter, replacing the existing one if there was one.\n * @param filter\n */\n setImageFilter(filter: SkImageFilter | null): void;\n\n /**\n * Sets the current mask filter, replacing the existing one if there was one.\n * @param filter\n */\n setMaskFilter(filter: SkMaskFilter | null): void;\n\n /**\n * Sets the current path effect, replacing the existing one if there was one.\n * @param effect\n */\n setPathEffect(effect: SkPathEffect | null): void;\n\n /**\n * Sets the current shader, replacing the existing one if there was one.\n * @param shader\n */\n setShader(shader: SkShader | null): void;\n\n /**\n * Sets the geometry drawn at the beginning and end of strokes.\n * @param cap\n */\n setStrokeCap(cap: StrokeCap): void;\n\n /**\n * Sets the geometry drawn at the corners of strokes.\n * @param join\n */\n setStrokeJoin(join: StrokeJoin): void;\n\n /**\n * Sets the limit at which a sharp corner is drawn beveled.\n * @param limit\n */\n setStrokeMiter(limit: number): void;\n\n /**\n * Sets the thickness of the pen used to outline the shape.\n * @param width\n */\n setStrokeWidth(width: number): void;\n\n /**\n * Sets whether the geometry is filled or stroked.\n * @param style\n */\n setStyle(style: PaintStyle): void;\n}\n"]}
@@ -1,9 +1,8 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
2
 
3
- /* eslint-disable no-nested-ternary */
4
3
  export class NotImplementedOnRNWeb extends Error {
5
- constructor() {
6
- super("Not implemented on React Native Web");
4
+ constructor(msg) {
5
+ super(msg !== null && msg !== void 0 ? msg : "Not implemented on React Native Web");
7
6
  }
8
7
 
9
8
  }
@@ -15,7 +14,7 @@ export class Host {
15
14
  }
16
15
 
17
16
  }
18
- export class HostObject extends Host {
17
+ export class BaseHostObject extends Host {
19
18
  constructor(CanvasKit, ref, typename) {
20
19
  super(CanvasKit);
21
20
 
@@ -27,12 +26,13 @@ export class HostObject extends Host {
27
26
  this.__typename__ = typename;
28
27
  }
29
28
 
30
- } // eslint-disable-next-line @typescript-eslint/ban-types
29
+ }
30
+ export class HostObject extends BaseHostObject {
31
+ static fromValue(value) {
32
+ return value.ref;
33
+ }
31
34
 
32
- export const toOptionalValue = value => value === undefined ? undefined : value === null ? null : toValue(value);
33
- export const toUndefinedableValue = value => value === undefined ? undefined : toValue(value);
34
- export const toNullableValue = value => value === null ? null : toValue(value);
35
- export const toValue = value => value.ref;
35
+ }
36
36
  export const ckEnum = value => ({
37
37
  value
38
38
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","Host","CanvasKit","HostObject","ref","typename","__typename__","toOptionalValue","value","undefined","toValue","toUndefinedableValue","toNullableValue","ckEnum","optEnum"],"mappings":";;AAAA;AAKA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,GAAG;AACZ,UAAM,qCAAN;AACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;AAGzBD,EAAAA,WAAW,CAACE,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;AAQ3B,OAAO,MAAeC,UAAf,SACGF,IADH,CAGP;AAIED,EAAAA,WAAW,CAACE,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH,C,CAWA;;AAGA,OAAO,MAAME,eAAe,GAC1BC,KAD6B,IAG7BA,KAAK,KAAKC,SAAV,GAAsBA,SAAtB,GAAkCD,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBE,OAAO,CAACF,KAAD,CAH5D;AAKP,OAAO,MAAMG,oBAAoB,GAC/BH,KADkC,IAEfA,KAAK,KAAKC,SAAV,GAAsBA,SAAtB,GAAkCC,OAAO,CAACF,KAAD,CAFvD;AAIP,OAAO,MAAMI,eAAe,GAAOJ,KAAJ,IAC7BA,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBE,OAAO,CAACF,KAAD,CAD1B;AAGP,OAAO,MAAME,OAAO,GAAOF,KAAJ,IACpBA,KAAD,CAAiCJ,GAD5B;AAGP,OAAO,MAAMS,MAAM,GAAIL,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAMM,OAAO,GAClBN,KADqB,IAGrBA,KAAK,KAAKC,SAAV,GAAsBA,SAAtB,GAAkC;AAAED,EAAAA;AAAF,CAH7B","sourcesContent":["/* eslint-disable no-nested-ternary */\nimport type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor() {\n super(\"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class HostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n readonly ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NonNullish = {};\n\nexport const toOptionalValue = <T>(\n value: NonNullish | undefined | null\n): T | undefined | null =>\n value === undefined ? undefined : value === null ? null : toValue(value);\n\nexport const toUndefinedableValue = <T>(\n value: NonNullish | undefined\n): T | undefined => (value === undefined ? undefined : toValue(value));\n\nexport const toNullableValue = <T>(value: NonNullish | null): T | null =>\n value === null ? null : toValue(value);\n\nexport const toValue = <T>(value: NonNullish): T =>\n (value as HostObject<T, string>).ref;\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
1
+ {"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"mappings":";;AAIA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,CAACC,GAAD,EAAe;AACxB,UAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;AACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;AAGzBF,EAAAA,WAAW,CAACG,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;AAQ3B,OAAO,MAAeC,cAAf,SACGF,IADH,CAGP;AAIEF,EAAAA,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH;AAWA,OAAO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;AACgB,SAATK,SAAS,CAAIC,KAAJ,EAAkC;AAChD,WAAQA,KAAD,CAAiCL,GAAxC;AACD;;AAHD;AAMF,OAAO,MAAMM,MAAM,GAAID,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;AAAEH,EAAAA;AAAF,CAH7B","sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
@@ -1,57 +1,67 @@
1
- import { ckEnum, HostObject, toValue, toUndefinedableValue, toOptionalValue } from "./Host";
1
+ import { ckEnum, HostObject } from "./Host";
2
+ import { JsiSkPaint } from "./JsiSkPaint";
2
3
  import { JsiSkRect } from "./JsiSkRect";
3
4
  import { JsiSkRRect } from "./JsiSkRRect";
5
+ import { JsiSkImage } from "./JsiSkImage";
6
+ import { JsiSkVertices } from "./JsiSkVertices";
7
+ import { JsiSkPath } from "./JsiSkPath";
8
+ import { JsiSkFont } from "./JsiSkFont";
9
+ import { JsiSkTextBlob } from "./JsiSkTextBlob";
10
+ import { JsiSkPicture } from "./JsiSkPicture";
11
+ import { JsiSkMatrix } from "./JsiSkMatrix";
12
+ import { JsiSkImageFilter } from "./JsiSkImageFilter";
13
+ import { JsiSkPoint } from "./JsiSkPoint";
4
14
  export class JsiSkCanvas extends HostObject {
5
15
  constructor(CanvasKit, ref) {
6
16
  super(CanvasKit, ref, "Canvas");
7
17
  }
8
18
 
9
19
  drawRect(rect, paint) {
10
- this.ref.drawRect(JsiSkRect.fromValue(this.CanvasKit, rect), toValue(paint));
20
+ this.ref.drawRect(JsiSkRect.fromValue(this.CanvasKit, rect), JsiSkPaint.fromValue(paint));
11
21
  }
12
22
 
13
23
  drawImage(image, x, y, paint) {
14
- this.ref.drawImage(toValue(image), x, y, toOptionalValue(paint));
24
+ this.ref.drawImage(JsiSkImage.fromValue(image), x, y, paint ? JsiSkPaint.fromValue(paint) : paint);
15
25
  }
16
26
 
17
27
  drawImageRect(img, src, dest, paint, fastSample) {
18
- this.ref.drawImageRect(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), toValue(paint), fastSample);
28
+ this.ref.drawImageRect(JsiSkImage.fromValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), JsiSkPaint.fromValue(paint), fastSample);
19
29
  }
20
30
 
21
31
  drawImageCubic(img, left, top, B, C, paint) {
22
- this.ref.drawImageCubic(toValue(img), left, top, B, C, toOptionalValue(paint));
32
+ this.ref.drawImageCubic(JsiSkImage.fromValue(img), left, top, B, C, paint ? JsiSkPaint.fromValue(paint) : paint);
23
33
  }
24
34
 
25
35
  drawImageOptions(img, left, top, fm, mm, paint) {
26
- this.ref.drawImageOptions(toValue(img), left, top, ckEnum(fm), ckEnum(mm), toOptionalValue(paint));
36
+ this.ref.drawImageOptions(JsiSkImage.fromValue(img), left, top, ckEnum(fm), ckEnum(mm), paint ? JsiSkPaint.fromValue(paint) : paint);
27
37
  }
28
38
 
29
39
  drawImageNine(img, center, dest, filter, paint) {
30
- this.ref.drawImageNine(toValue(img), toValue(center), toValue(dest), ckEnum(filter), toOptionalValue(paint));
40
+ this.ref.drawImageNine(JsiSkImage.fromValue(img), Array.from(JsiSkRect.fromValue(this.CanvasKit, center)), JsiSkRect.fromValue(this.CanvasKit, dest), ckEnum(filter), paint ? JsiSkPaint.fromValue(paint) : paint);
31
41
  }
32
42
 
33
43
  drawImageRectCubic(img, src, dest, B, C, paint) {
34
- this.ref.drawImageRectCubic(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), B, C, toOptionalValue(paint));
44
+ this.ref.drawImageRectCubic(JsiSkImage.fromValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), B, C, paint ? JsiSkPaint.fromValue(paint) : paint);
35
45
  }
36
46
 
37
47
  drawImageRectOptions(img, src, dest, fm, mm, paint) {
38
- this.ref.drawImageRectOptions(toValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), ckEnum(fm), ckEnum(mm), toOptionalValue(paint));
48
+ this.ref.drawImageRectOptions(JsiSkImage.fromValue(img), JsiSkRect.fromValue(this.CanvasKit, src), JsiSkRect.fromValue(this.CanvasKit, dest), ckEnum(fm), ckEnum(mm), paint ? JsiSkPaint.fromValue(paint) : paint);
39
49
  }
40
50
 
41
51
  drawPaint(paint) {
42
- this.ref.drawPaint(toValue(paint));
52
+ this.ref.drawPaint(JsiSkPaint.fromValue(paint));
43
53
  }
44
54
 
45
55
  drawLine(x0, y0, x1, y1, paint) {
46
- this.ref.drawLine(x0, y0, x1, y1, toValue(paint));
56
+ this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));
47
57
  }
48
58
 
49
59
  drawCircle(cx, cy, radius, paint) {
50
- this.ref.drawCircle(cx, cy, radius, toValue(paint));
60
+ this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));
51
61
  }
52
62
 
53
63
  drawVertices(verts, mode, paint) {
54
- this.ref.drawVertices(toValue(verts), ckEnum(mode), toValue(paint));
64
+ this.ref.drawVertices(JsiSkVertices.fromValue(verts), ckEnum(mode), JsiSkPaint.fromValue(paint));
55
65
  }
56
66
 
57
67
  drawPatch(cubics, colors, texs, mode, paint) {
@@ -61,7 +71,7 @@ export class JsiSkCanvas extends HostObject {
61
71
  y
62
72
  } = _ref;
63
73
  return [x, y];
64
- }).flat(), colors, toOptionalValue(texs), mode ? ckEnum(mode) : null, toUndefinedableValue(paint));
74
+ }).flat(), colors, texs ? texs.flatMap(p => Array.from(JsiSkPoint.fromValue(p))) : texs, mode ? ckEnum(mode) : null, paint ? JsiSkPaint.fromValue(paint) : undefined);
65
75
  }
66
76
 
67
77
  restoreToCount(saveCount) {
@@ -75,39 +85,39 @@ export class JsiSkCanvas extends HostObject {
75
85
  y
76
86
  } = _ref2;
77
87
  return [x, y];
78
- }).flat(), toValue(paint));
88
+ }).flat(), JsiSkPaint.fromValue(paint));
79
89
  }
80
90
 
81
91
  drawArc(oval, startAngle, sweepAngle, useCenter, paint) {
82
- this.ref.drawArc(toValue(oval), startAngle, sweepAngle, useCenter, toValue(paint));
92
+ this.ref.drawArc(JsiSkRect.fromValue(this.CanvasKit, oval), startAngle, sweepAngle, useCenter, JsiSkPaint.fromValue(paint));
83
93
  }
84
94
 
85
95
  drawRRect(rrect, paint) {
86
- this.ref.drawRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), toValue(paint));
96
+ this.ref.drawRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), JsiSkPaint.fromValue(paint));
87
97
  }
88
98
 
89
99
  drawDRRect(outer, inner, paint) {
90
- this.ref.drawDRRect(toValue(outer), toValue(inner), toValue(paint));
100
+ this.ref.drawDRRect(JsiSkRRect.fromValue(this.CanvasKit, outer), JsiSkRRect.fromValue(this.CanvasKit, inner), JsiSkPaint.fromValue(paint));
91
101
  }
92
102
 
93
103
  drawOval(oval, paint) {
94
- this.ref.drawOval(toValue(oval), toValue(paint));
104
+ this.ref.drawOval(JsiSkRect.fromValue(this.CanvasKit, oval), JsiSkPaint.fromValue(paint));
95
105
  }
96
106
 
97
107
  drawPath(path, paint) {
98
- this.ref.drawPath(toValue(path), toValue(paint));
108
+ this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));
99
109
  }
100
110
 
101
111
  drawText(str, x, y, paint, font) {
102
- this.ref.drawText(str, x, y, toValue(paint), toValue(font));
112
+ this.ref.drawText(str, x, y, JsiSkPaint.fromValue(paint), JsiSkFont.fromValue(font));
103
113
  }
104
114
 
105
115
  drawTextBlob(blob, x, y, paint) {
106
- this.ref.drawTextBlob(toValue(blob), x, y, toValue(paint));
116
+ this.ref.drawTextBlob(JsiSkTextBlob.fromValue(blob), x, y, JsiSkPaint.fromValue(paint));
107
117
  }
108
118
 
109
119
  drawGlyphs(glyphs, positions, x, y, font, paint) {
110
- this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y, toValue(font), toValue(paint));
120
+ this.ref.drawGlyphs(glyphs, positions.map(p => [p.x, p.y]).flat(), x, y, JsiSkFont.fromValue(font), JsiSkPaint.fromValue(paint));
111
121
  }
112
122
 
113
123
  drawSvg(_svgDom, _width, _height) {
@@ -119,7 +129,7 @@ export class JsiSkCanvas extends HostObject {
119
129
  }
120
130
 
121
131
  saveLayer(paint, bounds, backdrop, flags) {
122
- return this.ref.saveLayer(toUndefinedableValue(paint), toOptionalValue(bounds), toOptionalValue(backdrop), flags);
132
+ return this.ref.saveLayer(paint ? JsiSkPaint.fromValue(paint) : undefined, bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds, backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop, flags);
123
133
  }
124
134
 
125
135
  restore() {
@@ -151,7 +161,7 @@ export class JsiSkCanvas extends HostObject {
151
161
  }
152
162
 
153
163
  clipPath(path, op, doAntiAlias) {
154
- this.ref.clipPath(toValue(path), ckEnum(op), doAntiAlias);
164
+ this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);
155
165
  }
156
166
 
157
167
  clipRect(rect, op, doAntiAlias) {
@@ -163,11 +173,11 @@ export class JsiSkCanvas extends HostObject {
163
173
  }
164
174
 
165
175
  concat(m) {
166
- this.ref.concat(toValue(m));
176
+ this.ref.concat(JsiSkMatrix.fromValue(m));
167
177
  }
168
178
 
169
179
  drawPicture(skp) {
170
- this.ref.drawPicture(toValue(skp));
180
+ this.ref.drawPicture(JsiSkPicture.fromValue(skp));
171
181
  }
172
182
 
173
183
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkCanvas.ts"],"names":["ckEnum","HostObject","toValue","toUndefinedableValue","toOptionalValue","JsiSkRect","JsiSkRRect","JsiSkCanvas","constructor","CanvasKit","ref","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","p","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","undefined","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp"],"mappings":"AA0BA,SACEA,MADF,EAEEC,UAFF,EAGEC,OAHF,EAIEC,oBAJF,EAKEC,eALF,QAMO,QANP;AAOA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,WAAN,SACGN,UADH,CAGP;AACEO,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;AAC7C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;AACrC,SAAKH,GAAL,CAASC,QAAT,CACEN,SAAS,CAACS,SAAV,CAAoB,KAAKL,SAAzB,EAAoCG,IAApC,CADF,EAEEV,OAAO,CAAQW,KAAR,CAFT;AAID;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCL,KAAvC,EAAwD;AAC/D,SAAKH,GAAL,CAASK,SAAT,CAAmBb,OAAO,CAAQc,KAAR,CAA1B,EAA0CC,CAA1C,EAA6CC,CAA7C,EAAgDd,eAAe,CAACS,KAAD,CAA/D;AACD;;AAEDM,EAAAA,aAAa,CACXC,GADW,EAEXC,GAFW,EAGXC,IAHW,EAIXT,KAJW,EAKXU,UALW,EAMX;AACA,SAAKb,GAAL,CAASS,aAAT,CACEjB,OAAO,CAAQkB,GAAR,CADT,EAEEf,SAAS,CAACS,SAAV,CAAoB,KAAKL,SAAzB,EAAoCY,GAApC,CAFF,EAGEhB,SAAS,CAACS,SAAV,CAAoB,KAAKL,SAAzB,EAAoCa,IAApC,CAHF,EAIEpB,OAAO,CAAQW,KAAR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D,CAA5B;AACD;;AA7SH","sourcesContent":["import type { Canvas, Image, CanvasKit, Paint } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport {\n ckEnum,\n HostObject,\n toValue,\n toUndefinedableValue,\n toOptionalValue,\n} from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n toValue<Paint>(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(toValue<Image>(image), x, y, toOptionalValue(paint));\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n toValue<Paint>(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n toValue(img),\n left,\n top,\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n toValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n toValue(img),\n toValue(center),\n toValue(dest),\n ckEnum(filter),\n toOptionalValue(paint)\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n toOptionalValue(paint)\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n toValue<Image>(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(fm),\n ckEnum(mm),\n toOptionalValue(paint)\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(toValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, toValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, toValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(toValue(verts), ckEnum(mode), toValue(paint));\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n toOptionalValue(texs),\n mode ? ckEnum(mode) : null,\n toUndefinedableValue(paint)\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n toValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n toValue(oval),\n startAngle,\n sweepAngle,\n useCenter,\n toValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n toValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(toValue(outer), toValue(inner), toValue(paint));\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(toValue(oval), toValue(paint));\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(toValue(path), toValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(str, x, y, toValue(paint), toValue(font));\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(toValue(blob), x, y, toValue(paint));\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n toValue(font),\n toValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n toUndefinedableValue(paint),\n toOptionalValue(bounds),\n toOptionalValue(backdrop),\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(toValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(toValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(toValue(skp));\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkCanvas.ts"],"names":["ckEnum","HostObject","JsiSkPaint","JsiSkRect","JsiSkRRect","JsiSkImage","JsiSkVertices","JsiSkPath","JsiSkFont","JsiSkTextBlob","JsiSkPicture","JsiSkMatrix","JsiSkImageFilter","JsiSkPoint","JsiSkCanvas","constructor","CanvasKit","ref","drawRect","rect","paint","fromValue","drawImage","image","x","y","drawImageRect","img","src","dest","fastSample","drawImageCubic","left","top","B","C","drawImageOptions","fm","mm","drawImageNine","center","filter","Array","from","drawImageRectCubic","drawImageRectOptions","drawPaint","drawLine","x0","y0","x1","y1","drawCircle","cx","cy","radius","drawVertices","verts","mode","drawPatch","cubics","colors","texs","map","flat","flatMap","p","undefined","restoreToCount","saveCount","drawPoints","points","drawArc","oval","startAngle","sweepAngle","useCenter","drawRRect","rrect","drawDRRect","outer","inner","drawOval","drawPath","path","drawText","str","font","drawTextBlob","blob","drawGlyphs","glyphs","positions","drawSvg","_svgDom","_width","_height","Error","save","saveLayer","bounds","backdrop","flags","restore","rotate","rotationInDegrees","rx","ry","scale","sx","sy","skew","translate","dx","dy","drawColor","color","blendMode","clear","clipPath","op","doAntiAlias","clipRect","clipRRect","concat","m","drawPicture","skp"],"mappings":"AA0BA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,QAAnC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,WAAN,SACGb,UADH,CAGP;AACEc,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAoC;AAC7C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,QAAtB;AACD;;AAEDC,EAAAA,QAAQ,CAACC,IAAD,EAAeC,KAAf,EAA+B;AACrC,SAAKH,GAAL,CAASC,QAAT,CACEf,SAAS,CAACkB,SAAV,CAAoB,KAAKL,SAAzB,EAAoCG,IAApC,CADF,EAEEjB,UAAU,CAACmB,SAAX,CAAqBD,KAArB,CAFF;AAID;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAiBC,CAAjB,EAA4BC,CAA5B,EAAuCL,KAAvC,EAAwD;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EAAiB0C,EAAjB,EAA6BC,WAA7B,EAAmD;AAC1D,SAAKxG,GAAL,CAAS0G,SAAT,CACEvH,UAAU,CAACiB,SAAX,CAAqB,KAAKL,SAA1B,EAAqC8D,KAArC,CADF,EAEE9E,MAAM,CAACwH,EAAD,CAFR,EAGEC,WAHF;AAKD;;AAEDG,EAAAA,MAAM,CAACC,CAAD,EAAc;AAClB,SAAK5G,GAAL,CAAS2G,MAAT,CAAgBjH,WAAW,CAACU,SAAZ,CAAsBwG,CAAtB,CAAhB;AACD;;AAEDC,EAAAA,WAAW,CAACC,GAAD,EAAiB;AAC1B,SAAK9G,GAAL,CAAS6G,WAAT,CAAqBpH,YAAY,CAACW,SAAb,CAAuB0G,GAAvB,CAArB;AACD;;AAxUH","sourcesContent":["import type { Canvas, CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n BlendMode,\n ClipOp,\n FilterMode,\n MipmapMode,\n PointMode,\n SaveLayerFlag,\n SkCanvas,\n SkColor,\n SkFont,\n SkImage,\n SkImageFilter,\n SkMatrix,\n SkPaint,\n SkPath,\n SkPicture,\n SkPoint,\n SkRect,\n SkRRect,\n SkSVG,\n SkTextBlob,\n SkVertices,\n} from \"../types\";\n\nimport { ckEnum, HostObject } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkVertices } from \"./JsiSkVertices\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { JsiSkTextBlob } from \"./JsiSkTextBlob\";\nimport { JsiSkPicture } from \"./JsiSkPicture\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkImageFilter } from \"./JsiSkImageFilter\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\n\nexport class JsiSkCanvas\n extends HostObject<Canvas, \"Canvas\">\n implements SkCanvas\n{\n constructor(CanvasKit: CanvasKit, ref: Canvas) {\n super(CanvasKit, ref, \"Canvas\");\n }\n\n drawRect(rect: SkRect, paint: SkPaint) {\n this.ref.drawRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawImage(image: SkImage, x: number, y: number, paint?: SkPaint) {\n this.ref.drawImage(\n JsiSkImage.fromValue(image),\n x,\n y,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRect(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n paint: SkPaint,\n fastSample?: boolean\n ) {\n this.ref.drawImageRect(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n JsiSkPaint.fromValue(paint),\n fastSample\n );\n }\n\n drawImageCubic(\n img: SkImage,\n left: number,\n top: number,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageCubic(\n JsiSkImage.fromValue(img),\n left,\n top,\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageOptions(\n img: SkImage,\n left: number,\n top: number,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageOptions(\n JsiSkImage.fromValue(img),\n left,\n top,\n ckEnum(fm),\n ckEnum(mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageNine(\n img: SkImage,\n center: SkRect,\n dest: SkRect,\n filter: FilterMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageNine(\n JsiSkImage.fromValue(img),\n Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(filter),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectCubic(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n B: number,\n C: number,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectCubic(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n B,\n C,\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawImageRectOptions(\n img: SkImage,\n src: SkRect,\n dest: SkRect,\n fm: FilterMode,\n mm: MipmapMode,\n paint?: SkPaint | null\n ) {\n this.ref.drawImageRectOptions(\n JsiSkImage.fromValue(img),\n JsiSkRect.fromValue(this.CanvasKit, src),\n JsiSkRect.fromValue(this.CanvasKit, dest),\n ckEnum(fm),\n ckEnum(mm),\n paint ? JsiSkPaint.fromValue(paint) : paint\n );\n }\n\n drawPaint(paint: SkPaint) {\n this.ref.drawPaint(JsiSkPaint.fromValue(paint));\n }\n\n drawLine(x0: number, y0: number, x1: number, y1: number, paint: SkPaint) {\n this.ref.drawLine(x0, y0, x1, y1, JsiSkPaint.fromValue(paint));\n }\n\n drawCircle(cx: number, cy: number, radius: number, paint: SkPaint) {\n this.ref.drawCircle(cx, cy, radius, JsiSkPaint.fromValue(paint));\n }\n\n drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {\n this.ref.drawVertices(\n JsiSkVertices.fromValue(verts),\n ckEnum(mode),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPatch(\n cubics: SkPoint[],\n colors?: SkColor[] | null,\n texs?: SkPoint[] | null,\n mode?: BlendMode | null,\n paint?: SkPaint\n ) {\n this.ref.drawPatch(\n cubics.map(({ x, y }) => [x, y]).flat(),\n colors,\n texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,\n mode ? ckEnum(mode) : null,\n paint ? JsiSkPaint.fromValue(paint) : undefined\n );\n }\n\n restoreToCount(saveCount: number) {\n this.ref.restoreToCount(saveCount);\n }\n\n drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {\n this.ref.drawPoints(\n ckEnum(mode),\n points.map(({ x, y }) => [x, y]).flat(),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawArc(\n oval: SkRect,\n startAngle: number,\n sweepAngle: number,\n useCenter: boolean,\n paint: SkPaint\n ) {\n this.ref.drawArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngle,\n sweepAngle,\n useCenter,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawRRect(rrect: SkRRect, paint: SkPaint) {\n this.ref.drawRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawDRRect(outer: SkRRect, inner: SkRRect, paint: SkPaint) {\n this.ref.drawDRRect(\n JsiSkRRect.fromValue(this.CanvasKit, outer),\n JsiSkRRect.fromValue(this.CanvasKit, inner),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawOval(oval: SkRect, paint: SkPaint) {\n this.ref.drawOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawPath(path: SkPath, paint: SkPaint) {\n this.ref.drawPath(JsiSkPath.fromValue(path), JsiSkPaint.fromValue(paint));\n }\n\n drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {\n this.ref.drawText(\n str,\n x,\n y,\n JsiSkPaint.fromValue(paint),\n JsiSkFont.fromValue(font)\n );\n }\n\n drawTextBlob(blob: SkTextBlob, x: number, y: number, paint: SkPaint) {\n this.ref.drawTextBlob(\n JsiSkTextBlob.fromValue(blob),\n x,\n y,\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawGlyphs(\n glyphs: number[],\n positions: SkPoint[],\n x: number,\n y: number,\n font: SkFont,\n paint: SkPaint\n ) {\n this.ref.drawGlyphs(\n glyphs,\n positions.map((p) => [p.x, p.y]).flat(),\n x,\n y,\n JsiSkFont.fromValue(font),\n JsiSkPaint.fromValue(paint)\n );\n }\n\n drawSvg(_svgDom: SkSVG, _width?: number, _height?: number) {\n throw new Error(\"drawSvg is not implemented on React Native Web\");\n }\n\n save() {\n return this.ref.save();\n }\n\n saveLayer(\n paint?: SkPaint,\n bounds?: SkRect | null,\n backdrop?: SkImageFilter | null,\n flags?: SaveLayerFlag\n ) {\n return this.ref.saveLayer(\n paint ? JsiSkPaint.fromValue(paint) : undefined,\n bounds ? JsiSkRect.fromValue(this.CanvasKit, bounds) : bounds,\n backdrop ? JsiSkImageFilter.fromValue(backdrop) : backdrop,\n flags\n );\n }\n\n restore() {\n this.ref.restore();\n }\n\n rotate(rotationInDegrees: number, rx: number, ry: number) {\n this.ref.rotate(rotationInDegrees, rx, ry);\n }\n\n scale(sx: number, sy: number) {\n this.ref.scale(sx, sy);\n }\n\n skew(sx: number, sy: number) {\n this.ref.skew(sx, sy);\n }\n\n translate(dx: number, dy: number) {\n this.ref.translate(dx, dy);\n }\n\n drawColor(color: SkColor, blendMode?: BlendMode) {\n this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);\n }\n\n clear(color: SkColor) {\n this.ref.clear(color);\n }\n\n clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);\n }\n\n clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRect(\n JsiSkRect.fromValue(this.CanvasKit, rect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {\n this.ref.clipRRect(\n JsiSkRRect.fromValue(this.CanvasKit, rrect),\n ckEnum(op),\n doAntiAlias\n );\n }\n\n concat(m: SkMatrix) {\n this.ref.concat(JsiSkMatrix.fromValue(m));\n }\n\n drawPicture(skp: SkPicture) {\n this.ref.drawPicture(JsiSkPicture.fromValue(skp));\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { ckEnum, Host, toValue, NotImplementedOnRNWeb } from "./Host";
1
+ import { ckEnum, Host } from "./Host";
2
2
  import { JsiSkColorFilter } from "./JsiSkColorFilter";
3
3
  export class JsiSkColorFilterFactory extends Host {
4
4
  constructor(CanvasKit) {
@@ -10,15 +10,15 @@ export class JsiSkColorFilterFactory extends Host {
10
10
  }
11
11
 
12
12
  MakeBlend(color, mode) {
13
- return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(toValue(color), ckEnum(mode)));
13
+ return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeBlend(color, ckEnum(mode)));
14
14
  }
15
15
 
16
16
  MakeCompose(outer, inner) {
17
- return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(toValue(outer), toValue(inner)));
17
+ return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeCompose(JsiSkColorFilter.fromValue(outer), JsiSkColorFilter.fromValue(inner)));
18
18
  }
19
19
 
20
20
  MakeLerp(t, dst, src) {
21
- return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLerp(t, toValue(dst), toValue(src)));
21
+ return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLerp(t, JsiSkColorFilter.fromValue(dst), JsiSkColorFilter.fromValue(src)));
22
22
  }
23
23
 
24
24
  MakeLinearToSRGBGamma() {
@@ -30,7 +30,7 @@ export class JsiSkColorFilterFactory extends Host {
30
30
  }
31
31
 
32
32
  MakeLumaColorFilter() {
33
- throw new NotImplementedOnRNWeb();
33
+ return new JsiSkColorFilter(this.CanvasKit, this.CanvasKit.ColorFilter.MakeLuma());
34
34
  }
35
35
 
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkColorFilterFactory.ts"],"names":["ckEnum","Host","toValue","NotImplementedOnRNWeb","JsiSkColorFilter","JsiSkColorFilterFactory","constructor","CanvasKit","MakeMatrix","cMatrix","ColorFilter","MakeBlend","color","mode","MakeCompose","outer","inner","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter"],"mappings":"AAUA,SAASA,MA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AA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAIlB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BY,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,mBAAmB,GAAkB;AACnC,UAAM,IAAIpB,qBAAJ,EAAN;AACD;;AAjDH","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ColorFilterFactory,\n SkColorFilter,\n InputColorMatrix,\n SkColor,\n BlendMode,\n} from \"../types\";\n\nimport { ckEnum, Host, toValue, NotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkColorFilterFactory\n extends Host\n implements ColorFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeMatrix(cMatrix: InputColorMatrix) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeMatrix(cMatrix)\n );\n }\n\n MakeBlend(color: SkColor, mode: BlendMode) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeBlend(toValue(color), ckEnum(mode))\n );\n }\n\n MakeCompose(outer: SkColorFilter, inner: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeCompose(toValue(outer), toValue(inner))\n );\n }\n\n MakeLerp(t: number, dst: SkColorFilter, src: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLerp(t, toValue(dst), toValue(src))\n );\n }\n\n MakeLinearToSRGBGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLinearToSRGBGamma()\n );\n }\n\n MakeSRGBToLinearGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeSRGBToLinearGamma()\n );\n }\n\n MakeLumaColorFilter(): SkColorFilter {\n throw new NotImplementedOnRNWeb();\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkColorFilterFactory.ts"],"names":["ckEnum","Host","JsiSkColorFilter","JsiSkColorFilterFactory","constructor","CanvasKit","MakeMatrix","cMatrix","ColorFilter","MakeBlend","color","mode","MakeCompose","outer","inner","fromValue","MakeLerp","t","dst","src","MakeLinearToSRGBGamma","MakeSRGBToLinearGamma","MakeLumaColorFilter","MakeLuma"],"mappings":"AAUA,SAASA,MAAT,EAAiBC,IAAjB,QAA6B,QAA7B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA,OAAO,MAAMC,uBAAN,SACGF,IADH,CAGP;AACEG,EAAAA,WAAW,CAACC,SAAD,EAAuB;AAChC,UAAMA,SAAN;AACD;;AAEDC,EAAAA,UAAU,CAACC,OAAD,EAA4B;AACpC,WAAO,IAAIL,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BF,UAA3B,CAAsCC,OAAtC,CAFK,CAAP;AAID;;AAEDE,EAAAA,SAAS,CAACC,KAAD,EAAiBC,IAAjB,EAAkC;AACzC,WAAO,IAAIT,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BC,SAA3B,CAAqCC,KAArC,EAA4CV,MAAM,CAACW,IAAD,CAAlD,CAFK,CAAP;AAID;;AAEDC,EAAAA,WAAW,CAACC,KAAD,EAAuBC,KAAvB,EAA6C;AACtD,WAAO,IAAIZ,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BI,WAA3B,CACEV,gBAAgB,CAACa,SAAjB,CAA2BF,KAA3B,CADF,EAEEX,gBAAgB,CAACa,SAAjB,CAA2BD,KAA3B,CAFF,CAFK,CAAP;AAOD;;AAEDE,EAAAA,QAAQ,CAACC,CAAD,EAAYC,GAAZ,EAAgCC,GAAhC,EAAoD;AAC1D,WAAO,IAAIjB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BQ,QAA3B,CACEC,CADF,EAEEf,gBAAgB,CAACa,SAAjB,CAA2BG,GAA3B,CAFF,EAGEhB,gBAAgB,CAACa,SAAjB,CAA2BI,GAA3B,CAHF,CAFK,CAAP;AAQD;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAIlB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2BY,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,qBAAqB,GAAG;AACtB,WAAO,IAAInB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2Ba,qBAA3B,EAFK,CAAP;AAID;;AAEDC,EAAAA,mBAAmB,GAAkB;AACnC,WAAO,IAAIpB,gBAAJ,CACL,KAAKG,SADA,EAEL,KAAKA,SAAL,CAAeG,WAAf,CAA2Be,QAA3B,EAFK,CAAP;AAID;;AA3DH","sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ColorFilterFactory,\n SkColorFilter,\n InputColorMatrix,\n SkColor,\n BlendMode,\n} from \"../types\";\n\nimport { ckEnum, Host } from \"./Host\";\nimport { JsiSkColorFilter } from \"./JsiSkColorFilter\";\n\nexport class JsiSkColorFilterFactory\n extends Host\n implements ColorFilterFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeMatrix(cMatrix: InputColorMatrix) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeMatrix(cMatrix)\n );\n }\n\n MakeBlend(color: SkColor, mode: BlendMode) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeBlend(color, ckEnum(mode))\n );\n }\n\n MakeCompose(outer: SkColorFilter, inner: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeCompose(\n JsiSkColorFilter.fromValue(outer),\n JsiSkColorFilter.fromValue(inner)\n )\n );\n }\n\n MakeLerp(t: number, dst: SkColorFilter, src: SkColorFilter) {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLerp(\n t,\n JsiSkColorFilter.fromValue(dst),\n JsiSkColorFilter.fromValue(src)\n )\n );\n }\n\n MakeLinearToSRGBGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLinearToSRGBGamma()\n );\n }\n\n MakeSRGBToLinearGamma() {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeSRGBToLinearGamma()\n );\n }\n\n MakeLumaColorFilter(): SkColorFilter {\n return new JsiSkColorFilter(\n this.CanvasKit,\n this.CanvasKit.ColorFilter.MakeLuma()\n );\n }\n}\n"]}
@@ -1,4 +1,6 @@
1
- import { HostObject, toValue, ckEnum } from "./Host";
1
+ import { HostObject, ckEnum } from "./Host";
2
+ import { JsiSkPaint } from "./JsiSkPaint";
3
+ import { JsiSkPoint } from "./JsiSkPoint";
2
4
  import { JsiSkRect } from "./JsiSkRect";
3
5
  import { JsiSkTypeface } from "./JsiSkTypeface";
4
6
  export class JsiSkFont extends HostObject {
@@ -29,11 +31,11 @@ export class JsiSkFont extends HostObject {
29
31
 
30
32
 
31
33
  getGlyphWidths(glyphs, paint) {
32
- return [...this.ref.getGlyphWidths(glyphs, paint ? toValue(paint) : null)];
34
+ return [...this.ref.getGlyphWidths(glyphs, paint ? JsiSkPaint.fromValue(paint) : null)];
33
35
  }
34
36
 
35
37
  getGlyphIntercepts(glyphs, positions, top, bottom) {
36
- return [...this.ref.getGlyphIntercepts(glyphs, positions.map(p => toValue(p)), top, bottom)];
38
+ return [...this.ref.getGlyphIntercepts(glyphs, positions.map(p => Array.from(JsiSkPoint.fromValue(p))).flat(), top, bottom)];
37
39
  }
38
40
 
39
41
  getScaleX() {
@@ -94,7 +96,7 @@ export class JsiSkFont extends HostObject {
94
96
  }
95
97
 
96
98
  setTypeface(face) {
97
- this.ref.setTypeface(face ? toValue(face) : null);
99
+ this.ref.setTypeface(face ? JsiSkTypeface.fromValue(face) : null);
98
100
  }
99
101
 
100
102
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkFont.ts"],"names":["HostObject","toValue","ckEnum","JsiSkRect","JsiSkTypeface","JsiSkFont","constructor","CanvasKit","ref","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","undefined","str","numCodePoints","glyphs","getGlyphIntercepts","positions","top","bottom","map","p","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","setEdging","edging","setEmbeddedBitmaps","embeddedBitmaps","setHinting","hinting","setLinearMetrics","linearMetrics","setScaleX","sx","setSize","points","setSkewX","setEmbolden","embolden","setSubpixel","subpixel","setTypeface","face"],"mappings":"AAWA,SAASA,UAAT,EAAqBC,OAArB,EAA8BC,MAA9B,QAA4C,QAA5C;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,SAAN,SAAwBL,UAAxB,CAAmE;AACxEM,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;AAC3C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,MAAtB;AACD;;AAEDC,EAAAA,YAAY,CAACC,IAAD,EAAeC,KAAf,EAA4C;AACtD,UAAMC,GAAG,GAAG,KAAKC,WAAL,CAAiBH,IAAjB,CAAZ;AACA,UAAMI,MAAM,GAAG,KAAKC,cAAL,CAAoBH,GAApB,EAAyBD,KAAzB,CAAf;AACA,WAAOG,MAAM,CAACE,MAAP,CAAc,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,GAAGC,CAA5B,EAA+B,CAA/B,CAAP;AACD;;AAEDC,EAAAA,UAAU,GAAG;AACX,U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,GAAL,CAASkD,WAAT,CAAqBC,IAAI,GAAG1D,OAAO,CAAC0D,IAAD,CAAV,GAAmB,IAA5C;AACD;;AA5GuE","sourcesContent":["import type { CanvasKit, Font } from \"canvaskit-wasm\";\n\nimport type {\n FontEdging,\n FontHinting,\n SkFont,\n SkPaint,\n SkPoint,\n SkTypeface,\n} from \"../types\";\n\nimport { HostObject, toValue, ckEnum } from \"./Host\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport class JsiSkFont extends HostObject<Font, \"Font\"> implements SkFont {\n constructor(CanvasKit: CanvasKit, ref: Font) {\n super(CanvasKit, ref, \"Font\");\n }\n\n getTextWidth(text: string, paint?: SkPaint | undefined) {\n const ids = this.getGlyphIDs(text);\n const widths = this.getGlyphWidths(ids, paint);\n return widths.reduce((a, b) => a + b, 0);\n }\n\n getMetrics() {\n const result = this.ref.getMetrics();\n return {\n ascent: result.ascent,\n descent: result.descent,\n leading: result.leading,\n bounds: result.bounds\n ? new JsiSkRect(this.CanvasKit, result.bounds)\n : undefined,\n };\n }\n\n getGlyphIDs(str: string, numCodePoints?: number) {\n // TODO: Fix return value in the C++ implementation\n return [...this.ref.getGlyphIDs(str, numCodePoints)];\n }\n\n // TODO: Fix return value in the C++ implementation, it return float32\n getGlyphWidths(glyphs: number[], paint?: SkPaint | null) {\n return [...this.ref.getGlyphWidths(glyphs, paint ? toValue(paint) : null)];\n }\n\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ) {\n return [\n ...this.ref.getGlyphIntercepts(\n glyphs,\n positions.map((p) => toValue(p)),\n top,\n bottom\n ),\n ];\n }\n\n getScaleX() {\n return this.ref.getScaleX();\n }\n\n getSize() {\n return this.ref.getSize();\n }\n\n getSkewX() {\n return this.ref.getSkewX();\n }\n\n isEmbolden() {\n return this.ref.isEmbolden();\n }\n\n getTypeface() {\n const tf = this.ref.getTypeface();\n return tf ? new JsiSkTypeface(this.CanvasKit, tf) : null;\n }\n\n setEdging(edging: FontEdging) {\n this.ref.setEdging(ckEnum(edging));\n }\n\n setEmbeddedBitmaps(embeddedBitmaps: boolean) {\n this.ref.setEmbeddedBitmaps(embeddedBitmaps);\n }\n\n setHinting(hinting: FontHinting) {\n this.ref.setHinting(ckEnum(hinting));\n }\n\n setLinearMetrics(linearMetrics: boolean) {\n this.ref.setLinearMetrics(linearMetrics);\n }\n\n setScaleX(sx: number) {\n this.ref.setScaleX(sx);\n }\n\n setSize(points: number) {\n this.ref.setSize(points);\n }\n\n setSkewX(sx: number) {\n this.ref.setSkewX(sx);\n }\n\n setEmbolden(embolden: boolean) {\n this.ref.setEmbolden(embolden);\n }\n\n setSubpixel(subpixel: boolean) {\n this.ref.setSubpixel(subpixel);\n }\n\n setTypeface(face: SkTypeface | null) {\n this.ref.setTypeface(face ? toValue(face) : null);\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkFont.ts"],"names":["HostObject","ckEnum","JsiSkPaint","JsiSkPoint","JsiSkRect","JsiSkTypeface","JsiSkFont","constructor","CanvasKit","ref","getTextWidth","text","paint","ids","getGlyphIDs","widths","getGlyphWidths","reduce","a","b","getMetrics","result","ascent","descent","leading","bounds","undefined","str","numCodePoints","glyphs","fromValue","getGlyphIntercepts","positions","top","bottom","map","p","Array","from","flat","getScaleX","getSize","getSkewX","isEmbolden","getTypeface","tf","setEdging","edging","setEmbeddedBitmaps","embeddedBitmaps","setHinting","hinting","setLinearMetrics","linearMetrics","setScaleX","sx","setSize","points","setSkewX","setEmbolden","embolden","setSubpixel","subpixel","setTypeface","face"],"mappings":"AAWA,SAASA,UAAT,EAAqBC,MAArB,QAAmC,QAAnC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,SAAN,SAAwBN,UAAxB,CAAmE;AACx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S,CAACC,EAAD,EAAa;AACpB,SAAK9C,GAAL,CAAS6C,SAAT,CAAmBC,EAAnB;AACD;;AAEDC,EAAAA,OAAO,CAACC,MAAD,EAAiB;AACtB,SAAKhD,GAAL,CAAS+C,OAAT,CAAiBC,MAAjB;AACD;;AAEDC,EAAAA,QAAQ,CAACH,EAAD,EAAa;AACnB,SAAK9C,GAAL,CAASiD,QAAT,CAAkBH,EAAlB;AACD;;AAEDI,EAAAA,WAAW,CAACC,QAAD,EAAoB;AAC7B,SAAKnD,GAAL,CAASkD,WAAT,CAAqBC,QAArB;AACD;;AAEDC,EAAAA,WAAW,CAACC,QAAD,EAAoB;AAC7B,SAAKrD,GAAL,CAASoD,WAAT,CAAqBC,QAArB;AACD;;AAEDC,EAAAA,WAAW,CAACC,IAAD,EAA0B;AACnC,SAAKvD,GAAL,CAASsD,WAAT,CAAqBC,IAAI,GAAG3D,aAAa,CAACyB,SAAd,CAAwBkC,IAAxB,CAAH,GAAmC,IAA5D;AACD;;AAjHuE","sourcesContent":["import type { CanvasKit, Font } from \"canvaskit-wasm\";\n\nimport type {\n FontEdging,\n FontHinting,\n SkFont,\n SkPaint,\n SkPoint,\n SkTypeface,\n} from \"../types\";\n\nimport { HostObject, ckEnum } from \"./Host\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport class JsiSkFont extends HostObject<Font, \"Font\"> implements SkFont {\n constructor(CanvasKit: CanvasKit, ref: Font) {\n super(CanvasKit, ref, \"Font\");\n }\n\n getTextWidth(text: string, paint?: SkPaint | undefined) {\n const ids = this.getGlyphIDs(text);\n const widths = this.getGlyphWidths(ids, paint);\n return widths.reduce((a, b) => a + b, 0);\n }\n\n getMetrics() {\n const result = this.ref.getMetrics();\n return {\n ascent: result.ascent,\n descent: result.descent,\n leading: result.leading,\n bounds: result.bounds\n ? new JsiSkRect(this.CanvasKit, result.bounds)\n : undefined,\n };\n }\n\n getGlyphIDs(str: string, numCodePoints?: number) {\n // TODO: Fix return value in the C++ implementation\n return [...this.ref.getGlyphIDs(str, numCodePoints)];\n }\n\n // TODO: Fix return value in the C++ implementation, it return float32\n getGlyphWidths(glyphs: number[], paint?: SkPaint | null) {\n return [\n ...this.ref.getGlyphWidths(\n glyphs,\n paint ? JsiSkPaint.fromValue(paint) : null\n ),\n ];\n }\n\n getGlyphIntercepts(\n glyphs: number[],\n positions: SkPoint[],\n top: number,\n bottom: number\n ) {\n return [\n ...this.ref.getGlyphIntercepts(\n glyphs,\n positions.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n top,\n bottom\n ),\n ];\n }\n\n getScaleX() {\n return this.ref.getScaleX();\n }\n\n getSize() {\n return this.ref.getSize();\n }\n\n getSkewX() {\n return this.ref.getSkewX();\n }\n\n isEmbolden() {\n return this.ref.isEmbolden();\n }\n\n getTypeface() {\n const tf = this.ref.getTypeface();\n return tf ? new JsiSkTypeface(this.CanvasKit, tf) : null;\n }\n\n setEdging(edging: FontEdging) {\n this.ref.setEdging(ckEnum(edging));\n }\n\n setEmbeddedBitmaps(embeddedBitmaps: boolean) {\n this.ref.setEmbeddedBitmaps(embeddedBitmaps);\n }\n\n setHinting(hinting: FontHinting) {\n this.ref.setHinting(ckEnum(hinting));\n }\n\n setLinearMetrics(linearMetrics: boolean) {\n this.ref.setLinearMetrics(linearMetrics);\n }\n\n setScaleX(sx: number) {\n this.ref.setScaleX(sx);\n }\n\n setSize(points: number) {\n this.ref.setSize(points);\n }\n\n setSkewX(sx: number) {\n this.ref.setSkewX(sx);\n }\n\n setEmbolden(embolden: boolean) {\n this.ref.setEmbolden(embolden);\n }\n\n setSubpixel(subpixel: boolean) {\n this.ref.setSubpixel(subpixel);\n }\n\n setTypeface(face: SkTypeface | null) {\n this.ref.setTypeface(face ? JsiSkTypeface.fromValue(face) : null);\n }\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  /*global btoa, atob*/
2
- import { ckEnum, HostObject, toValue } from "./Host";
2
+ import { ckEnum, HostObject } from "./Host";
3
+ import { JsiSkMatrix } from "./JsiSkMatrix";
3
4
  import { JsiSkShader } from "./JsiSkShader";
4
5
  export class JsiSkImage extends HostObject {
5
6
  constructor(CanvasKit, ref) {
@@ -15,11 +16,11 @@ export class JsiSkImage extends HostObject {
15
16
  }
16
17
 
17
18
  makeShaderOptions(tx, ty, fm, mm, localMatrix) {
18
- return new JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions(ckEnum(tx), ckEnum(ty), ckEnum(fm), ckEnum(mm), localMatrix ? toValue(localMatrix) : undefined));
19
+ return new JsiSkShader(this.CanvasKit, this.ref.makeShaderOptions(ckEnum(tx), ckEnum(ty), ckEnum(fm), ckEnum(mm), localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined));
19
20
  }
20
21
 
21
22
  makeShaderCubic(tx, ty, B, C, localMatrix) {
22
- return new JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic(ckEnum(tx), ckEnum(ty), B, C, localMatrix ? toValue(localMatrix) : undefined));
23
+ return new JsiSkShader(this.CanvasKit, this.ref.makeShaderCubic(ckEnum(tx), ckEnum(ty), B, C, localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined));
23
24
  }
24
25
 
25
26
  encodeToBytes(fmt, quality) {
@@ -1 +1 @@
1
- {"version":3,"sources":["JsiSkImage.ts"],"names":["ckEnum","HostObject","toValue","JsiSkShader","JsiSkImage","constructor","CanvasKit","ref","height","width","makeShaderOptions","tx","ty","fm","mm","localMatrix","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","result","Error","encodeToBase64","bytes","btoa","String","fromCharCode"],"mappings":"AAAA;AAaA,SAASA,MAAT,EAAiBC,UAAjB,EAA6BC,OAA7B,QAA4C,QAA5C;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,UAAN,SAAyBH,UAAzB,CAAuE;AAC5E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AM,GAAG,KAAKhB,GAAL,CAASa,aAAT,CAAuBpB,MAAM,CAACqB,GAAD,CAA7B,CAAT;AACD,KAFM,MAEA;AACLE,MAAAA,MAAM,GAAG,KAAKhB,GAAL,CAASa,aAAT,EAAT;AACD;;AACD,QAAI,CAACG,MAAL,EAAa;AACX,YAAM,IAAIC,KAAJ,CAAU,sBAAV,CAAN;AACD;;AACD,WAAOD,MAAP;AACD;;AAEDE,EAAAA,cAAc,CAACJ,GAAD,EAAoBC,OAApB,EAAsC;AAClD,UAAMI,KAAK,GAAG,KAAKN,aAAL,CAAmBC,GAAnB,EAAwBC,OAAxB,CAAd;AACA,WAAOK,IAAI,CAACC,MAAM,CAACC,YAAP,CAAoB,GAAGH,KAAvB,CAAD,CAAX;AACD;;AArE2E","sourcesContent":["/*global btoa, atob*/\nimport type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport type {\n ImageFormat,\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { ckEnum, HostObject, toValue } from \"./Host\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(CanvasKit: CanvasKit, ref: Image) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n ckEnum(tx),\n ckEnum(ty),\n ckEnum(fm),\n ckEnum(mm),\n localMatrix ? toValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n ckEnum(tx),\n ckEnum(ty),\n B,\n C,\n localMatrix ? toValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(ckEnum(fmt), quality);\n } else if (fmt) {\n result = this.ref.encodeToBytes(ckEnum(fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return btoa(String.fromCharCode(...bytes));\n }\n}\n"]}
1
+ {"version":3,"sources":["JsiSkImage.ts"],"names":["ckEnum","HostObject","JsiSkMatrix","JsiSkShader","JsiSkImage","constructor","CanvasKit","ref","height","width","makeShaderOptions","tx","ty","fm","mm","localMatrix","fromValue","undefined","makeShaderCubic","B","C","encodeToBytes","fmt","quality","result","Error","encodeToBase64","bytes","btoa","String","fromCharCode"],"mappings":"AAAA;AAaA,SAASA,MAAT,EAAiBC,UAAjB,QAAmC,QAAnC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,UAAN,SAAyBH,UAAzB,CAAuE;AAC5EI,EAAAA,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAmC;AAC5C,UAAMD,SAAN,EAAiBC,GAAjB,EAAsB,OAAtB;AACD;;AAEDC,EAAAA,MAAM,GAAG;AACP,WAAO,KAAKD,GAAL,CAASC,MAAT,EAAP;AACD;;AAEDC,EAAAA,KAAK,GAAG;AACN,WAAO,KAAKF,GAAL,CAASE,KAAT,EAAP;AACD;;AAEDC,EAAAA,iBAAiB,CACfC,EADe,EAEfC,EAFe,EAGfC,EAHe,EAIfC,EAJe,EAKfC,WALe,EAML;AACV,WAAO,IAAIZ,WAAJ,CACL,KAAKG,SADA,EAEL,KAAKC,GAAL,CAASG,iBAAT,CACEV,MAAM,CAACW,EA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AACC,MAAM,CAACC,YAAP,CAAoB,GAAGH,KAAvB,CAAD,CAAX;AACD;;AArE2E","sourcesContent":["/*global btoa, atob*/\nimport type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport type {\n ImageFormat,\n FilterMode,\n MipmapMode,\n SkImage,\n SkMatrix,\n SkShader,\n TileMode,\n} from \"../types\";\n\nimport { ckEnum, HostObject } from \"./Host\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkShader } from \"./JsiSkShader\";\n\nexport class JsiSkImage extends HostObject<Image, \"Image\"> implements SkImage {\n constructor(CanvasKit: CanvasKit, ref: Image) {\n super(CanvasKit, ref, \"Image\");\n }\n\n height() {\n return this.ref.height();\n }\n\n width() {\n return this.ref.width();\n }\n\n makeShaderOptions(\n tx: TileMode,\n ty: TileMode,\n fm: FilterMode,\n mm: MipmapMode,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderOptions(\n ckEnum(tx),\n ckEnum(ty),\n ckEnum(fm),\n ckEnum(mm),\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n makeShaderCubic(\n tx: TileMode,\n ty: TileMode,\n B: number,\n C: number,\n localMatrix?: SkMatrix\n ): SkShader {\n return new JsiSkShader(\n this.CanvasKit,\n this.ref.makeShaderCubic(\n ckEnum(tx),\n ckEnum(ty),\n B,\n C,\n localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined\n )\n );\n }\n\n encodeToBytes(fmt?: ImageFormat, quality?: number) {\n let result: Uint8Array | null;\n if (fmt && quality) {\n result = this.ref.encodeToBytes(ckEnum(fmt), quality);\n } else if (fmt) {\n result = this.ref.encodeToBytes(ckEnum(fmt));\n } else {\n result = this.ref.encodeToBytes();\n }\n if (!result) {\n throw new Error(\"encodeToBytes failed\");\n }\n return result;\n }\n\n encodeToBase64(fmt?: ImageFormat, quality?: number) {\n const bytes = this.encodeToBytes(fmt, quality);\n return btoa(String.fromCharCode(...bytes));\n }\n}\n"]}
@@ -1,12 +1,13 @@
1
- import { Host, toValue, ckEnum } from "./Host";
1
+ import { Host, ckEnum } from "./Host";
2
2
  import { JsiSkImage } from "./JsiSkImage";
3
+ import { JsiSkData } from "./JsiSkData";
3
4
  export class JsiSkImageFactory extends Host {
4
5
  constructor(CanvasKit) {
5
6
  super(CanvasKit);
6
7
  }
7
8
 
8
9
  MakeImageFromEncoded(encoded) {
9
- const image = this.CanvasKit.MakeImageFromEncoded(toValue(encoded));
10
+ const image = this.CanvasKit.MakeImageFromEncoded(JsiSkData.fromValue(encoded));
10
11
 
11
12
  if (image === null) {
12
13
  return null;
@@ -23,7 +24,7 @@ export class JsiSkImageFactory extends Host {
23
24
  colorType: ckEnum(info.colorType),
24
25
  height: info.height,
25
26
  width: info.width
26
- }, toValue(data), bytesPerRow);
27
+ }, JsiSkData.fromValue(data), bytesPerRow);
27
28
 
28
29
  if (image === null) {
29
30
  return null;