@shopify/react-native-skia 0.1.122 → 0.1.125

Sign up to get free protection for your applications and to get access to all the features.
Files changed (466) hide show
  1. package/android/CMakeLists.txt +6 -1
  2. package/android/build.gradle +1 -1
  3. package/android/cpp/jni/JniSkiaDrawView.cpp +14 -71
  4. package/android/cpp/jni/JniSkiaManager.cpp +1 -1
  5. package/android/cpp/jni/include/JniSkiaDrawView.h +18 -22
  6. package/android/cpp/jni/include/JniSkiaManager.h +4 -4
  7. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +68 -0
  8. package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +48 -0
  9. package/android/cpp/{jni/include/JniPlatformContextWrapper.h → rnskia-android/RNSkPlatformContextImpl.h} +4 -4
  10. package/android/cpp/{jni → rnskia-android}/SkiaOpenGLRenderer.cpp +39 -54
  11. package/android/cpp/{jni/include → rnskia-android}/SkiaOpenGLRenderer.h +2 -31
  12. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaViewManager.java +1 -1
  13. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +21 -28
  14. package/cpp/api/JsiSkApi.h +3 -1
  15. package/cpp/api/JsiSkCanvas.h +1 -1
  16. package/cpp/api/JsiSkColor.h +41 -7
  17. package/cpp/api/JsiSkColorFilterFactory.h +2 -1
  18. package/cpp/api/JsiSkImageFilter.h +0 -2
  19. package/cpp/api/JsiSkImageFilterFactory.h +37 -17
  20. package/cpp/api/JsiSkMatrix.h +44 -2
  21. package/cpp/api/JsiSkPaint.h +4 -7
  22. package/cpp/api/JsiSkRuntimeEffect.h +7 -0
  23. package/cpp/api/JsiSkRuntimeEffectFactory.h +3 -2
  24. package/cpp/api/JsiSkRuntimeShaderBuilder.h +70 -0
  25. package/cpp/api/JsiSkShaderFactory.h +2 -2
  26. package/cpp/api/JsiSkVertices.h +1 -1
  27. package/cpp/api/third_party/CSSColorParser.cpp +194 -0
  28. package/cpp/api/third_party/CSSColorParser.h +1 -191
  29. package/cpp/jsi/JsiSimpleValueWrapper.h +98 -0
  30. package/cpp/rnskia/RNSkAnimation.h +0 -2
  31. package/cpp/rnskia/RNSkDrawView.cpp +84 -126
  32. package/cpp/rnskia/RNSkDrawView.h +7 -37
  33. package/cpp/rnskia/RNSkJsiViewApi.h +8 -5
  34. package/cpp/rnskia/RNSkManager.cpp +2 -2
  35. package/cpp/rnskia/RNSkManager.h +2 -2
  36. package/cpp/rnskia/RNSkPlatformContext.h +1 -1
  37. package/cpp/rnskia/RNSkValueApi.h +6 -2
  38. package/cpp/rnskia/values/RNSkClockValue.h +18 -10
  39. package/cpp/rnskia/values/RNSkDerivedValue.h +12 -5
  40. package/cpp/rnskia/values/RNSkReadonlyValue.h +25 -17
  41. package/cpp/rnskia/values/RNSkValue.h +8 -3
  42. package/cpp/utils/RNSkTimingInfo.h +13 -1
  43. package/ios/RNSkia-iOS/PlatformContext.h +30 -4
  44. package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +8 -10
  45. package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +25 -10
  46. package/ios/RNSkia-iOS/SkiaDrawView.mm +22 -20
  47. package/lib/commonjs/{values/animation → animation}/decay/decay.js +0 -0
  48. package/lib/commonjs/{values/animation → animation}/decay/decay.js.map +0 -0
  49. package/lib/commonjs/{values/animation → animation}/decay/index.js +0 -0
  50. package/lib/commonjs/{values/animation → animation}/decay/index.js.map +0 -0
  51. package/lib/commonjs/{values/animation → animation}/decay/runDecay.js +1 -1
  52. package/lib/commonjs/animation/decay/runDecay.js.map +1 -0
  53. package/lib/commonjs/{values/animation → animation}/decay/types.js +0 -0
  54. package/lib/commonjs/{values/animation → animation}/decay/types.js.map +0 -0
  55. package/lib/commonjs/{values/animation → animation}/functions/index.js +0 -0
  56. package/lib/commonjs/{values/animation → animation}/functions/index.js.map +0 -0
  57. package/lib/commonjs/animation/functions/interpolate.js +141 -0
  58. package/lib/commonjs/animation/functions/interpolate.js.map +1 -0
  59. package/lib/commonjs/animation/functions/interpolateColors.js +39 -0
  60. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -0
  61. package/lib/commonjs/{values/animation → animation}/index.js +0 -0
  62. package/lib/commonjs/{values/animation → animation}/index.js.map +0 -0
  63. package/lib/commonjs/{values/animation → animation}/spring/Spring.js +0 -0
  64. package/lib/commonjs/{values/animation → animation}/spring/Spring.js.map +0 -0
  65. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js +0 -0
  66. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js.map +0 -0
  67. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js +0 -0
  68. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  69. package/lib/commonjs/{values/animation → animation}/spring/index.js +0 -0
  70. package/lib/commonjs/{values/animation → animation}/spring/index.js.map +0 -0
  71. package/lib/commonjs/{values/animation → animation}/spring/runSpring.js +0 -0
  72. package/lib/commonjs/animation/spring/runSpring.js.map +1 -0
  73. package/lib/commonjs/{values/animation → animation}/spring/types.js +0 -0
  74. package/lib/commonjs/{values/animation → animation}/spring/types.js.map +0 -0
  75. package/lib/commonjs/{values/animation → animation}/spring/useSpring.js +0 -0
  76. package/lib/commonjs/animation/spring/useSpring.js.map +1 -0
  77. package/lib/commonjs/{values/animation → animation}/timing/Easing.js +0 -0
  78. package/lib/commonjs/{values/animation → animation}/timing/Easing.js.map +0 -0
  79. package/lib/commonjs/{values/animation → animation}/timing/createTiming.js +1 -1
  80. package/lib/commonjs/animation/timing/createTiming.js.map +1 -0
  81. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js +0 -0
  82. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  83. package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
  84. package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +1 -0
  85. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js +0 -0
  86. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js.map +0 -0
  87. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js +0 -0
  88. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  89. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js +0 -0
  90. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js.map +0 -0
  91. package/lib/commonjs/{values/animation → animation}/timing/index.js +0 -0
  92. package/lib/commonjs/{values/animation → animation}/timing/index.js.map +0 -0
  93. package/lib/commonjs/{values/animation → animation}/timing/runTiming.js +0 -0
  94. package/lib/commonjs/animation/timing/runTiming.js.map +1 -0
  95. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js +0 -0
  96. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js.map +0 -0
  97. package/lib/commonjs/{values/animation → animation}/timing/useTiming.js +1 -1
  98. package/lib/commonjs/animation/timing/useTiming.js.map +1 -0
  99. package/lib/commonjs/{values/animation → animation}/types.js +0 -0
  100. package/lib/commonjs/{values/animation → animation}/types.js.map +0 -0
  101. package/lib/commonjs/index.js +13 -0
  102. package/lib/commonjs/index.js.map +1 -1
  103. package/lib/commonjs/renderer/Canvas.js +17 -8
  104. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  105. package/lib/commonjs/renderer/components/Paint.js +1 -1
  106. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  107. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
  108. package/lib/commonjs/renderer/components/colorFilters/Lerp.js +1 -1
  109. package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
  110. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +4 -2
  111. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  112. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +37 -0
  113. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  114. package/lib/commonjs/renderer/components/imageFilters/index.js +13 -0
  115. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  116. package/lib/commonjs/renderer/components/shaders/Gradient.js +1 -1
  117. package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
  118. package/lib/commonjs/renderer/components/shaders/Shader.js +2 -2
  119. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  120. package/lib/commonjs/renderer/components/shapes/Path.js +9 -1
  121. package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
  122. package/lib/commonjs/renderer/processors/Circles.js +3 -2
  123. package/lib/commonjs/renderer/processors/Circles.js.map +1 -1
  124. package/lib/commonjs/renderer/processors/Font.js +1 -1
  125. package/lib/commonjs/renderer/processors/Font.js.map +1 -1
  126. package/lib/commonjs/renderer/processors/Paint.js +6 -1
  127. package/lib/commonjs/renderer/processors/Paint.js.map +1 -1
  128. package/lib/commonjs/renderer/processors/Rects.js +11 -21
  129. package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
  130. package/lib/commonjs/renderer/processors/math/Matrix3.js +42 -63
  131. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  132. package/lib/commonjs/renderer/processors/math/Vector.js +4 -5
  133. package/lib/commonjs/renderer/processors/math/Vector.js.map +1 -1
  134. package/lib/commonjs/skia/Color.js +14 -38
  135. package/lib/commonjs/skia/Color.js.map +1 -1
  136. package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  137. package/lib/commonjs/skia/Matrix.js.map +1 -1
  138. package/lib/commonjs/skia/Paint/Paint.js +13 -1
  139. package/lib/commonjs/skia/Paint/Paint.js.map +1 -1
  140. package/lib/commonjs/skia/Paint/usePaint.js +2 -4
  141. package/lib/commonjs/skia/Paint/usePaint.js.map +1 -1
  142. package/lib/commonjs/skia/Shader/useShader.js +4 -1
  143. package/lib/commonjs/skia/Shader/useShader.js.map +1 -1
  144. package/lib/commonjs/skia/Skia.js +3 -43
  145. package/lib/commonjs/skia/Skia.js.map +1 -1
  146. package/lib/commonjs/skia/SkiaApi.js +4 -0
  147. package/lib/commonjs/skia/SkiaApi.js.map +1 -0
  148. package/lib/commonjs/values/api.js +4 -6
  149. package/lib/commonjs/values/api.js.map +1 -1
  150. package/lib/commonjs/values/api.web.js +18 -0
  151. package/lib/commonjs/values/api.web.js.map +1 -0
  152. package/lib/commonjs/values/index.js +0 -13
  153. package/lib/commonjs/values/index.js.map +1 -1
  154. package/lib/commonjs/values/web/RNSkAnimation.js +46 -0
  155. package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -0
  156. package/lib/commonjs/values/web/RNSkClockValue.js +75 -0
  157. package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -0
  158. package/lib/commonjs/values/web/RNSkDerivedValue.js +51 -0
  159. package/lib/commonjs/values/web/RNSkDerivedValue.js.map +1 -0
  160. package/lib/commonjs/values/web/RNSkReadonlyValue.js +45 -0
  161. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -0
  162. package/lib/commonjs/values/web/RNSkValue.js +73 -0
  163. package/lib/commonjs/values/web/RNSkValue.js.map +1 -0
  164. package/lib/commonjs/values/web/api.js +31 -0
  165. package/lib/commonjs/values/web/api.js.map +1 -0
  166. package/lib/commonjs/values/web/index.js +19 -0
  167. package/lib/commonjs/values/web/index.js.map +1 -0
  168. package/lib/commonjs/views/SkiaView.js +13 -10
  169. package/lib/commonjs/views/SkiaView.js.map +1 -1
  170. package/lib/commonjs/views/api.js +11 -0
  171. package/lib/commonjs/views/api.js.map +1 -0
  172. package/lib/commonjs/views/types.js.map +1 -1
  173. package/lib/module/{values/animation → animation}/decay/decay.js +0 -0
  174. package/lib/module/{values/animation → animation}/decay/decay.js.map +0 -0
  175. package/lib/module/{values/animation → animation}/decay/index.js +0 -0
  176. package/lib/module/{values/animation → animation}/decay/index.js.map +0 -0
  177. package/lib/module/{values/animation → animation}/decay/runDecay.js +1 -1
  178. package/lib/module/animation/decay/runDecay.js.map +1 -0
  179. package/lib/module/{values/animation → animation}/decay/types.js +0 -0
  180. package/lib/module/{values/animation → animation}/decay/types.js.map +0 -0
  181. package/lib/module/{values/animation → animation}/functions/index.js +0 -0
  182. package/lib/module/{values/animation → animation}/functions/index.js.map +0 -0
  183. package/lib/module/animation/functions/interpolate.js +132 -0
  184. package/lib/module/animation/functions/interpolate.js.map +1 -0
  185. package/lib/module/animation/functions/interpolateColors.js +23 -0
  186. package/lib/module/animation/functions/interpolateColors.js.map +1 -0
  187. package/lib/module/{values/animation → animation}/index.js +0 -0
  188. package/lib/module/{values/animation → animation}/index.js.map +0 -0
  189. package/lib/module/{values/animation → animation}/spring/Spring.js +0 -0
  190. package/lib/module/{values/animation → animation}/spring/Spring.js.map +0 -0
  191. package/lib/module/{values/animation → animation}/spring/functions/index.js +0 -0
  192. package/lib/module/{values/animation → animation}/spring/functions/index.js.map +0 -0
  193. package/lib/module/{values/animation → animation}/spring/functions/spring.js +0 -0
  194. package/lib/module/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  195. package/lib/module/{values/animation → animation}/spring/index.js +0 -0
  196. package/lib/module/{values/animation → animation}/spring/index.js.map +0 -0
  197. package/lib/module/{values/animation → animation}/spring/runSpring.js +0 -0
  198. package/lib/module/animation/spring/runSpring.js.map +1 -0
  199. package/lib/module/{values/animation → animation}/spring/types.js +0 -0
  200. package/lib/module/{values/animation → animation}/spring/types.js.map +0 -0
  201. package/lib/module/{values/animation → animation}/spring/useSpring.js +0 -0
  202. package/lib/module/animation/spring/useSpring.js.map +1 -0
  203. package/lib/module/{values/animation → animation}/timing/Easing.js +0 -0
  204. package/lib/module/{values/animation → animation}/timing/Easing.js.map +0 -0
  205. package/lib/module/{values/animation → animation}/timing/createTiming.js +1 -1
  206. package/lib/module/animation/timing/createTiming.js.map +1 -0
  207. package/lib/module/{values/animation → animation}/timing/functions/bezier.js +0 -0
  208. package/lib/module/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  209. package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
  210. package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -0
  211. package/lib/module/{values/animation → animation}/timing/functions/index.js +0 -0
  212. package/lib/module/{values/animation → animation}/timing/functions/index.js.map +0 -0
  213. package/lib/module/{values/animation → animation}/timing/functions/timing.js +0 -0
  214. package/lib/module/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  215. package/lib/module/{values/animation → animation}/timing/functions/types.js +0 -0
  216. package/lib/module/{values/animation → animation}/timing/functions/types.js.map +0 -0
  217. package/lib/module/{values/animation → animation}/timing/index.js +0 -0
  218. package/lib/module/{values/animation → animation}/timing/index.js.map +0 -0
  219. package/lib/module/{values/animation → animation}/timing/runTiming.js +0 -0
  220. package/lib/module/animation/timing/runTiming.js.map +1 -0
  221. package/lib/module/{values/animation → animation}/timing/useLoop.js +0 -0
  222. package/lib/module/{values/animation → animation}/timing/useLoop.js.map +0 -0
  223. package/lib/module/{values/animation → animation}/timing/useTiming.js +1 -1
  224. package/lib/module/animation/timing/useTiming.js.map +1 -0
  225. package/lib/module/{values/animation → animation}/types.js +0 -0
  226. package/lib/module/{values/animation → animation}/types.js.map +0 -0
  227. package/lib/module/index.js +1 -0
  228. package/lib/module/index.js.map +1 -1
  229. package/lib/module/renderer/Canvas.js +12 -6
  230. package/lib/module/renderer/Canvas.js.map +1 -1
  231. package/lib/module/renderer/components/Paint.js +2 -2
  232. package/lib/module/renderer/components/Paint.js.map +1 -1
  233. package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
  234. package/lib/module/renderer/components/colorFilters/Lerp.js +1 -1
  235. package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
  236. package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -2
  237. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  238. package/lib/module/renderer/components/imageFilters/RuntimeShader.js +19 -0
  239. package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  240. package/lib/module/renderer/components/imageFilters/index.js +1 -0
  241. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  242. package/lib/module/renderer/components/shaders/Gradient.js +2 -2
  243. package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
  244. package/lib/module/renderer/components/shaders/Shader.js +3 -2
  245. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  246. package/lib/module/renderer/components/shapes/Path.js +9 -2
  247. package/lib/module/renderer/components/shapes/Path.js.map +1 -1
  248. package/lib/module/renderer/processors/Circles.js +3 -2
  249. package/lib/module/renderer/processors/Circles.js.map +1 -1
  250. package/lib/module/renderer/processors/Font.js +1 -1
  251. package/lib/module/renderer/processors/Font.js.map +1 -1
  252. package/lib/module/renderer/processors/Paint.js +6 -1
  253. package/lib/module/renderer/processors/Paint.js.map +1 -1
  254. package/lib/module/renderer/processors/Rects.js +9 -21
  255. package/lib/module/renderer/processors/Rects.js.map +1 -1
  256. package/lib/module/renderer/processors/math/Matrix3.js +52 -72
  257. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  258. package/lib/module/renderer/processors/math/Vector.js +3 -5
  259. package/lib/module/renderer/processors/math/Vector.js.map +1 -1
  260. package/lib/module/skia/Color.js +9 -25
  261. package/lib/module/skia/Color.js.map +1 -1
  262. package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  263. package/lib/module/skia/Matrix.js.map +1 -1
  264. package/lib/module/skia/Paint/Paint.js +6 -0
  265. package/lib/module/skia/Paint/Paint.js.map +1 -1
  266. package/lib/module/skia/Paint/usePaint.js +2 -3
  267. package/lib/module/skia/Paint/usePaint.js.map +1 -1
  268. package/lib/module/skia/Shader/useShader.js +4 -1
  269. package/lib/module/skia/Shader/useShader.js.map +1 -1
  270. package/lib/module/skia/Skia.js +2 -44
  271. package/lib/module/skia/Skia.js.map +1 -1
  272. package/lib/module/skia/SkiaApi.js +2 -0
  273. package/lib/module/skia/SkiaApi.js.map +1 -0
  274. package/lib/module/values/api.js +4 -6
  275. package/lib/module/values/api.js.map +1 -1
  276. package/lib/module/values/api.web.js +7 -0
  277. package/lib/module/values/api.web.js.map +1 -0
  278. package/lib/module/values/index.js +0 -1
  279. package/lib/module/values/index.js.map +1 -1
  280. package/lib/module/values/web/RNSkAnimation.js +36 -0
  281. package/lib/module/values/web/RNSkAnimation.js.map +1 -0
  282. package/lib/module/values/web/RNSkClockValue.js +65 -0
  283. package/lib/module/values/web/RNSkClockValue.js.map +1 -0
  284. package/lib/module/values/web/RNSkDerivedValue.js +41 -0
  285. package/lib/module/values/web/RNSkDerivedValue.js.map +1 -0
  286. package/lib/module/values/web/RNSkReadonlyValue.js +36 -0
  287. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -0
  288. package/lib/module/values/web/RNSkValue.js +63 -0
  289. package/lib/module/values/web/RNSkValue.js.map +1 -0
  290. package/lib/module/values/web/api.js +19 -0
  291. package/lib/module/values/web/api.js.map +1 -0
  292. package/lib/module/values/web/index.js +2 -0
  293. package/lib/module/values/web/index.js.map +1 -0
  294. package/lib/module/views/SkiaView.js +1 -3
  295. package/lib/module/views/SkiaView.js.map +1 -1
  296. package/lib/module/views/api.js +4 -0
  297. package/lib/module/views/api.js.map +1 -0
  298. package/lib/module/views/types.js.map +1 -1
  299. package/lib/typescript/src/{values/animation → animation}/decay/decay.d.ts +0 -0
  300. package/lib/typescript/src/{values/animation → animation}/decay/index.d.ts +0 -0
  301. package/lib/typescript/src/{values/animation → animation}/decay/runDecay.d.ts +2 -2
  302. package/lib/typescript/src/{values/animation → animation}/decay/types.d.ts +1 -1
  303. package/lib/typescript/src/{values/animation → animation}/functions/index.d.ts +0 -0
  304. package/lib/typescript/src/animation/functions/interpolate.d.ts +11 -0
  305. package/lib/typescript/src/animation/functions/interpolateColors.d.ts +3 -0
  306. package/lib/typescript/src/{values/animation → animation}/index.d.ts +0 -0
  307. package/lib/typescript/src/{values/animation → animation}/spring/Spring.d.ts +0 -0
  308. package/lib/typescript/src/{values/animation → animation}/spring/functions/index.d.ts +0 -0
  309. package/lib/typescript/src/{values/animation → animation}/spring/functions/spring.d.ts +0 -0
  310. package/lib/typescript/src/{values/animation → animation}/spring/index.d.ts +0 -0
  311. package/lib/typescript/src/{values/animation → animation}/spring/runSpring.d.ts +1 -1
  312. package/lib/typescript/src/{values/animation → animation}/spring/types.d.ts +0 -0
  313. package/lib/typescript/src/{values/animation → animation}/spring/useSpring.d.ts +1 -1
  314. package/lib/typescript/src/{values/animation → animation}/timing/Easing.d.ts +0 -0
  315. package/lib/typescript/src/{values/animation → animation}/timing/createTiming.d.ts +2 -2
  316. package/lib/typescript/src/{values/animation → animation}/timing/functions/bezier.d.ts +0 -0
  317. package/lib/typescript/src/{values/animation → animation}/timing/functions/getResolvedParams.d.ts +0 -0
  318. package/lib/typescript/src/{values/animation → animation}/timing/functions/index.d.ts +0 -0
  319. package/lib/typescript/src/{values/animation → animation}/timing/functions/timing.d.ts +1 -1
  320. package/lib/typescript/src/{values/animation → animation}/timing/functions/types.d.ts +0 -0
  321. package/lib/typescript/src/{values/animation → animation}/timing/index.d.ts +0 -0
  322. package/lib/typescript/src/{values/animation → animation}/timing/runTiming.d.ts +1 -1
  323. package/lib/typescript/src/{values/animation → animation}/timing/useLoop.d.ts +0 -0
  324. package/lib/typescript/src/{values/animation → animation}/timing/useTiming.d.ts +1 -1
  325. package/lib/typescript/src/{values/animation → animation}/types.d.ts +5 -5
  326. package/lib/typescript/src/index.d.ts +1 -0
  327. package/lib/typescript/src/renderer/Canvas.d.ts +6 -0
  328. package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +1 -1
  329. package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +7 -0
  330. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -0
  331. package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +1 -1
  332. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
  333. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -4
  334. package/lib/typescript/src/renderer/components/shapes/Path.d.ts +3 -1
  335. package/lib/typescript/src/renderer/processors/Paint.d.ts +2 -1
  336. package/lib/typescript/src/renderer/processors/Rects.d.ts +9 -41
  337. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -5
  338. package/lib/typescript/src/renderer/processors/math/Vector.d.ts +5 -17
  339. package/lib/typescript/src/skia/Color.d.ts +8 -9
  340. package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +16 -0
  341. package/lib/typescript/src/skia/Matrix.d.ts +7 -1
  342. package/lib/typescript/src/skia/Paint/Paint.d.ts +1 -0
  343. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +2 -1
  344. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffectFactory.d.ts +2 -2
  345. package/lib/typescript/src/skia/Shader/useShader.d.ts +1 -1
  346. package/lib/typescript/src/skia/Skia.d.ts +28 -95
  347. package/lib/typescript/src/skia/SkiaApi.d.ts +71 -0
  348. package/lib/typescript/src/skia/Surface/Surface.d.ts +1 -1
  349. package/lib/typescript/src/skia/Surface/SurfaceFactory.d.ts +2 -2
  350. package/lib/typescript/src/values/api.d.ts +2 -25
  351. package/lib/typescript/src/values/api.web.d.ts +2 -0
  352. package/lib/typescript/src/values/index.d.ts +0 -1
  353. package/lib/typescript/src/values/types.d.ts +24 -1
  354. package/lib/typescript/src/values/web/RNSkAnimation.d.ts +9 -0
  355. package/lib/typescript/src/values/web/RNSkClockValue.d.ts +13 -0
  356. package/lib/typescript/src/values/web/RNSkDerivedValue.d.ts +9 -0
  357. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +11 -0
  358. package/lib/typescript/src/values/web/RNSkValue.d.ts +14 -0
  359. package/lib/typescript/src/values/web/api.d.ts +2 -0
  360. package/lib/typescript/src/values/web/index.d.ts +1 -0
  361. package/lib/typescript/src/views/SkiaView.d.ts +3 -36
  362. package/lib/typescript/src/views/api.d.ts +5 -0
  363. package/lib/typescript/src/views/types.d.ts +32 -0
  364. package/package.json +2 -2
  365. package/src/{values/animation → animation}/decay/decay.ts +0 -0
  366. package/src/{values/animation → animation}/decay/index.ts +0 -0
  367. package/src/{values/animation → animation}/decay/runDecay.ts +2 -2
  368. package/src/{values/animation → animation}/decay/types.ts +1 -1
  369. package/src/{values/animation → animation}/functions/index.ts +0 -0
  370. package/src/animation/functions/interpolate.ts +182 -0
  371. package/src/animation/functions/interpolateColors.ts +58 -0
  372. package/src/{values/animation → animation}/index.ts +0 -0
  373. package/src/{values/animation → animation}/spring/Spring.ts +0 -0
  374. package/src/{values/animation → animation}/spring/functions/index.ts +0 -0
  375. package/src/{values/animation → animation}/spring/functions/spring.ts +0 -0
  376. package/src/{values/animation → animation}/spring/index.ts +0 -0
  377. package/src/{values/animation → animation}/spring/runSpring.ts +1 -1
  378. package/src/{values/animation → animation}/spring/types.ts +0 -0
  379. package/src/{values/animation → animation}/spring/useSpring.ts +1 -1
  380. package/src/{values/animation → animation}/timing/Easing.ts +0 -0
  381. package/src/{values/animation → animation}/timing/createTiming.ts +2 -2
  382. package/src/{values/animation → animation}/timing/functions/__tests__/timing.spec.ts +0 -0
  383. package/src/{values/animation → animation}/timing/functions/bezier.ts +0 -0
  384. package/src/{values/animation → animation}/timing/functions/getResolvedParams.ts +2 -2
  385. package/src/{values/animation → animation}/timing/functions/index.ts +0 -0
  386. package/src/{values/animation → animation}/timing/functions/timing.ts +1 -1
  387. package/src/{values/animation → animation}/timing/functions/types.ts +0 -0
  388. package/src/{values/animation → animation}/timing/index.ts +0 -0
  389. package/src/{values/animation → animation}/timing/runTiming.ts +1 -1
  390. package/src/{values/animation → animation}/timing/useLoop.ts +0 -0
  391. package/src/{values/animation → animation}/timing/useTiming.ts +2 -2
  392. package/src/{values/animation → animation}/types.ts +5 -5
  393. package/src/index.ts +1 -0
  394. package/src/renderer/Canvas.tsx +13 -6
  395. package/src/renderer/components/Paint.tsx +2 -2
  396. package/src/renderer/components/colorFilters/BlendColor.tsx +1 -1
  397. package/src/renderer/components/colorFilters/Lerp.tsx +1 -1
  398. package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -2
  399. package/src/renderer/components/imageFilters/RuntimeShader.tsx +23 -0
  400. package/src/renderer/components/imageFilters/index.ts +1 -0
  401. package/src/renderer/components/shaders/Gradient.ts +2 -4
  402. package/src/renderer/components/shaders/Shader.tsx +3 -3
  403. package/src/renderer/components/shapes/Path.tsx +11 -3
  404. package/src/renderer/processors/Circles.ts +2 -1
  405. package/src/renderer/processors/Font.ts +1 -1
  406. package/src/renderer/processors/Paint.ts +5 -0
  407. package/src/renderer/processors/Rects.ts +9 -14
  408. package/src/renderer/processors/math/Matrix3.ts +24 -105
  409. package/src/renderer/processors/math/Vector.ts +3 -2
  410. package/src/skia/Color.ts +13 -27
  411. package/src/skia/ImageFilter/ImageFilterFactory.ts +20 -0
  412. package/src/skia/Matrix.ts +8 -1
  413. package/src/skia/Paint/Paint.ts +7 -0
  414. package/src/skia/Paint/usePaint.ts +2 -4
  415. package/src/skia/RuntimeEffect/RuntimeEffect.ts +3 -1
  416. package/src/skia/RuntimeEffect/RuntimeEffectFactory.ts +2 -2
  417. package/src/skia/Shader/useShader.ts +4 -1
  418. package/src/skia/Skia.ts +4 -123
  419. package/src/skia/SkiaApi.ts +86 -0
  420. package/src/skia/Surface/Surface.ts +1 -1
  421. package/src/skia/Surface/SurfaceFactory.ts +2 -2
  422. package/src/values/api.ts +3 -42
  423. package/src/values/api.web.ts +5 -0
  424. package/src/values/index.ts +0 -1
  425. package/src/values/types.ts +30 -1
  426. package/src/values/web/RNSkAnimation.ts +33 -0
  427. package/src/values/web/RNSkClockValue.ts +58 -0
  428. package/src/values/web/RNSkDerivedValue.ts +38 -0
  429. package/src/values/web/RNSkReadonlyValue.ts +32 -0
  430. package/src/values/web/RNSkValue.ts +57 -0
  431. package/src/values/web/__tests__/RNSkAnimation.spec.ts +21 -0
  432. package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +15 -0
  433. package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +8 -0
  434. package/src/values/web/__tests__/RNSkValue.spec.ts +11 -0
  435. package/src/values/web/api.ts +33 -0
  436. package/src/values/web/index.ts +1 -0
  437. package/src/views/SkiaView.tsx +3 -49
  438. package/src/views/api.ts +7 -0
  439. package/src/views/types.ts +40 -0
  440. package/lib/commonjs/values/animation/decay/runDecay.js.map +0 -1
  441. package/lib/commonjs/values/animation/functions/interpolate.js +0 -139
  442. package/lib/commonjs/values/animation/functions/interpolate.js.map +0 -1
  443. package/lib/commonjs/values/animation/functions/interpolateColors.js +0 -47
  444. package/lib/commonjs/values/animation/functions/interpolateColors.js.map +0 -1
  445. package/lib/commonjs/values/animation/spring/runSpring.js.map +0 -1
  446. package/lib/commonjs/values/animation/spring/useSpring.js.map +0 -1
  447. package/lib/commonjs/values/animation/timing/createTiming.js.map +0 -1
  448. package/lib/commonjs/values/animation/timing/functions/getResolvedParams.js.map +0 -1
  449. package/lib/commonjs/values/animation/timing/runTiming.js.map +0 -1
  450. package/lib/commonjs/values/animation/timing/useTiming.js.map +0 -1
  451. package/lib/module/values/animation/decay/runDecay.js.map +0 -1
  452. package/lib/module/values/animation/functions/interpolate.js +0 -132
  453. package/lib/module/values/animation/functions/interpolate.js.map +0 -1
  454. package/lib/module/values/animation/functions/interpolateColors.js +0 -32
  455. package/lib/module/values/animation/functions/interpolateColors.js.map +0 -1
  456. package/lib/module/values/animation/spring/runSpring.js.map +0 -1
  457. package/lib/module/values/animation/spring/useSpring.js.map +0 -1
  458. package/lib/module/values/animation/timing/createTiming.js.map +0 -1
  459. package/lib/module/values/animation/timing/functions/getResolvedParams.js.map +0 -1
  460. package/lib/module/values/animation/timing/runTiming.js.map +0 -1
  461. package/lib/module/values/animation/timing/useTiming.js.map +0 -1
  462. package/lib/typescript/scripts/install-npm.d.ts +0 -1
  463. package/lib/typescript/src/values/animation/functions/interpolate.d.ts +0 -7
  464. package/lib/typescript/src/values/animation/functions/interpolateColors.d.ts +0 -3
  465. package/src/values/animation/functions/interpolate.ts +0 -169
  466. package/src/values/animation/functions/interpolateColors.ts +0 -62
@@ -1 +1 @@
1
- {"version":3,"sources":["Canvas.tsx"],"names":["React","useEffect","useState","useCallback","useMemo","useContext","forwardRef","useRef","ReactReconciler","SkiaView","useDrawCallback","Skia","useValue","debug","hostDebug","skHostConfig","vec","Container","DependencyManager","CanvasContext","createContext","useCanvasSize","canvas","Error","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","render","element","root","container","updateContainer","depMgr","subscribe","useCanvasRef","defaultFontMgr","FontMgr","RefDefault","Canvas","forwardedRef","children","style","mode","onTouch","fontMgr","canvasCtx","width","height","innerRef","ref","useCombinedRefs","tick","setTick","redraw","t","createContainer","onDraw","info","timestamp","touches","current","paint","Paint","setAntiAlias","ctx","opacity","center","draw","unsubscribe","refs","targetRef","forEach"],"mappings":"AAAA,OAAOA,KAAP,IACEC,SADF,EAEEC,QAFF,EAGEC,WAHF,EAIEC,OAJF,EAKEC,UALF,EAMEC,UANF,EAOEC,MAPF,QAQO,OARP;AAiBA,OAAOC,eAAP,MAA4B,kBAA5B;AAEA,SAASC,QAAT,EAAmBC,eAAnB,QAA0C,UAA1C;AAEA,SAASC,IAAT,QAAqB,SAArB;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAGA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,YAA7B,QAAiD,cAAjD,C,CACA;;AACA,SAASC,GAAT,QAAoB,cAApB;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAEA,MAAMC,aAAa,gBAAGnB,KAAK,CAACoB,aAAN,CAGX,IAHW,CAAtB;AAKA,OAAO,MAAMC,aAAa,GAAG,MAAM;AACjC,QAAMC,MAAM,GAAGjB,UAAU,CAACc,aAAD,CAAzB;;AACA,MAAI,CAACG,MAAL,EAAa;AACX,UAAM,IAAIC,KAAJ,CAAU,iCAAV,CAAN;AACD;;AACD,SAAOD,MAAP;AACD,CANM;AAQP,OAAO,MAAME,cAAc,GAAGhB,eAAe,CAACO,YAAD,CAAtC;AAEPS,cAAc,CAACC,kBAAf,CAAkC;A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,IAAD,CAVH;AAWA,SAAOC,SAAP;AACD,CAhBD","sourcesContent":["import React, {\n useEffect,\n useState,\n useCallback,\n useMemo,\n useContext,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n ComponentProps,\n MutableRefObject,\n ForwardedRef,\n} from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport { SkiaView, useDrawCallback } from \"../views\";\nimport type { TouchHandler } from \"../views\";\nimport { Skia } from \"../skia\";\nimport type { FontMgr } from \"../skia/FontMgr/FontMgr\";\nimport { useValue } from \"../values/hooks/useValue\";\nimport type { SkiaReadonlyValue } from \"../values/types\";\n\nimport { debug as hostDebug, skHostConfig } from \"./HostConfig\";\n// import { debugTree } from \"./nodes\";\nimport { vec } from \"./processors\";\nimport { Container } from \"./nodes\";\nimport { DependencyManager } from \"./DependencyManager\";\n\nconst CanvasContext = React.createContext<SkiaReadonlyValue<{\n width: number;\n height: number;\n}> | null>(null);\n\nexport const useCanvasSize = () => {\n const canvas = useContext(CanvasContext);\n if (!canvas) {\n throw new Error(\"Canvas context is not available\");\n }\n return canvas;\n};\n\nexport const skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nconst render = (element: ReactNode, root: OpaqueRoot, container: Container) => {\n skiaReconciler.updateContainer(element, root, null, () => {\n hostDebug(\"updateContainer\");\n\n container.depMgr.subscribe();\n });\n};\n\nexport const useCanvasRef = () => useRef<SkiaView>(null);\n\nexport interface CanvasProps extends ComponentProps<typeof SkiaView> {\n ref?: RefObject<SkiaView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n fontMgr?: FontMgr;\n}\n\nconst defaultFontMgr = Skia.FontMgr.RefDefault();\n\nexport const Canvas = forwardRef<SkiaView, CanvasProps>(\n ({ children, style, debug, mode, onTouch, fontMgr }, forwardedRef) => {\n const canvasCtx = useValue({ width: 0, height: 0 });\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const [tick, setTick] = useState(0);\n const redraw = useCallback(() => setTick((t) => t + 1), []);\n\n const container = useMemo(\n () => new Container(new DependencyManager(ref), redraw),\n [redraw, ref]\n );\n\n const root = useMemo(\n () => skiaReconciler.createContainer(container, 0, false, null),\n [container]\n );\n // Render effect\n useEffect(() => {\n render(\n <CanvasContext.Provider value={canvasCtx}>\n {children}\n </CanvasContext.Provider>,\n root,\n container\n );\n }, [children, root, redraw, container, canvasCtx]);\n\n // Draw callback\n const onDraw = useDrawCallback(\n (canvas, info) => {\n // TODO: if tree is empty (count === 1) maybe we should not render?\n const { width, height, timestamp } = info;\n if (onTouch) {\n onTouch(info.touches);\n }\n if (\n width !== canvasCtx.current.width ||\n height !== canvasCtx.current.height\n ) {\n canvasCtx.current = { width, height };\n }\n const paint = Skia.Paint();\n paint.setAntiAlias(true);\n const ctx = {\n width,\n height,\n timestamp,\n canvas,\n paint,\n opacity: 1,\n ref,\n center: vec(width / 2, height / 2),\n fontMgr: fontMgr ?? defaultFontMgr,\n };\n container.draw(ctx);\n },\n [tick, onTouch]\n );\n\n useEffect(() => {\n return () => {\n container.depMgr.unsubscribe();\n };\n }, [container]);\n\n return (\n <SkiaView\n ref={ref}\n style={style}\n onDraw={onDraw}\n mode={mode}\n debug={debug}\n />\n );\n }\n);\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"]}
1
+ {"version":3,"sources":["Canvas.tsx"],"names":["React","useEffect","useState","useCallback","useMemo","useContext","forwardRef","useRef","ReactReconciler","SkiaView","useDrawCallback","Skia","useValue","SkiaPaint","debug","hostDebug","skHostConfig","vec","Container","DependencyManager","CanvasContext","createContext","useCanvas","size","Error","useCanvasSize","console","warn","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","render","element","root","container","updateContainer","depMgr","subscribe","useCanvasRef","defaultFontMgr","FontMgr","RefDefault","Canvas","forwardedRef","children","style","mode","onTouch","fontMgr","canvasCtx","width","height","innerRef","ref","useCombinedRefs","tick","setTick","redraw","t","createContainer","onDraw","canvas","info","timestamp","touches","current","paint","ctx","opacity","center","draw","unsubscribe","refs","targetRef","forEach"],"mappings":"AAAA,OAAOA,KAAP,IACEC,SADF,EAEEC,QAFF,EAGEC,WAHF,EAIEC,OAJF,EAKEC,UALF,EAMEC,UANF,EAOEC,MAPF,QAQO,OARP;AAiBA,OAAOC,eAAP,MAA4B,kBAA5B;AAEA,SAASC,QAAT,EAAmBC,eAAnB,QAA0C,UAA1C;AAEA,SAASC,IAAT,QAAqB,SAArB;AAEA,SAASC,QAAT,QAAyB,0BAAzB;AAEA,SAASC,SAAT,QAA0B,qBAA1B;AAEA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,YAA7B,QAAiD,cAAjD,C,CACA;;AACA,SAASC,GAAT,QAAoB,cAApB;AACA,SAASC,SAAT,QAA0B,SAA1B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAEA,MAAMC,aAAa,gBAAGpB,KAAK,CAACqB,aAAN,CAGX,IAHW,CAAtB;AAKA,OAAO,MAAMC,SAAS,GAAG,MAAM;AAC7B,QAAMC,IAAI,GAAGlB,UAAU,CAACe,aAAD,CAAvB;;AACA,MAAI,CAACG,IAAL,EAAW;AACT,UAAM,IAAIC,KAAJ,CAAU,iCAAV,CAAN;AACD;;AACD,SAAO;AAAED,IAAAA;AAAF,GAAP;AACD,CANM;AAQP,OAA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A,GAAG,CAACoB,SAAS,CAACR,OAAX,CAAH;AACD,SAFD,MAEO;AACLZ,UAAAA,GAAG,CAACY,OAAJ,GAAcQ,SAAS,CAACR,OAAxB;AACD;AACF;AACF,KARD;AASD,GAVD,EAUG,CAACO,IAAD,CAVH;AAWA,SAAOC,SAAP;AACD,CAhBD","sourcesContent":["import React, {\n useEffect,\n useState,\n useCallback,\n useMemo,\n useContext,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n ComponentProps,\n MutableRefObject,\n ForwardedRef,\n} from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport { SkiaView, useDrawCallback } from \"../views\";\nimport type { TouchHandler } from \"../views\";\nimport { Skia } from \"../skia\";\nimport type { FontMgr } from \"../skia/FontMgr/FontMgr\";\nimport { useValue } from \"../values/hooks/useValue\";\nimport type { SkiaReadonlyValue } from \"../values/types\";\nimport { SkiaPaint } from \"../skia/Paint/Paint\";\n\nimport { debug as hostDebug, skHostConfig } from \"./HostConfig\";\n// import { debugTree } from \"./nodes\";\nimport { vec } from \"./processors\";\nimport { Container } from \"./nodes\";\nimport { DependencyManager } from \"./DependencyManager\";\n\nconst CanvasContext = React.createContext<SkiaReadonlyValue<{\n width: number;\n height: number;\n}> | null>(null);\n\nexport const useCanvas = () => {\n const size = useContext(CanvasContext);\n if (!size) {\n throw new Error(\"Canvas context is not available\");\n }\n return { size };\n};\n\nexport const useCanvasSize = () => {\n console.warn(\n \"useCanvasSize is deprecated, use the size member of useCanvas() instead.\"\n );\n return useCanvas().size;\n};\n\nexport const skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nconst render = (element: ReactNode, root: OpaqueRoot, container: Container) => {\n skiaReconciler.updateContainer(element, root, null, () => {\n hostDebug(\"updateContainer\");\n\n container.depMgr.subscribe();\n });\n};\n\nexport const useCanvasRef = () => useRef<SkiaView>(null);\n\nexport interface CanvasProps extends ComponentProps<typeof SkiaView> {\n ref?: RefObject<SkiaView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n fontMgr?: FontMgr;\n}\n\nconst defaultFontMgr = Skia.FontMgr.RefDefault();\n\nexport const Canvas = forwardRef<SkiaView, CanvasProps>(\n ({ children, style, debug, mode, onTouch, fontMgr }, forwardedRef) => {\n const canvasCtx = useValue({ width: 0, height: 0 });\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const [tick, setTick] = useState(0);\n const redraw = useCallback(() => setTick((t) => t + 1), []);\n\n const container = useMemo(\n () => new Container(new DependencyManager(ref), redraw),\n [redraw, ref]\n );\n\n const root = useMemo(\n () => skiaReconciler.createContainer(container, 0, false, null),\n [container]\n );\n // Render effect\n useEffect(() => {\n render(\n <CanvasContext.Provider value={canvasCtx}>\n {children}\n </CanvasContext.Provider>,\n root,\n container\n );\n }, [children, root, redraw, container, canvasCtx]);\n\n // Draw callback\n const onDraw = useDrawCallback(\n (canvas, info) => {\n // TODO: if tree is empty (count === 1) maybe we should not render?\n const { width, height, timestamp } = info;\n if (onTouch) {\n onTouch(info.touches);\n }\n if (\n width !== canvasCtx.current.width ||\n height !== canvasCtx.current.height\n ) {\n canvasCtx.current = { width, height };\n }\n const paint = SkiaPaint();\n const ctx = {\n width,\n height,\n timestamp,\n canvas,\n paint,\n opacity: 1,\n ref,\n center: vec(width / 2, height / 2),\n fontMgr: fontMgr ?? defaultFontMgr,\n };\n container.draw(ctx);\n },\n [tick, onTouch]\n );\n\n useEffect(() => {\n return () => {\n container.depMgr.unsubscribe();\n };\n }, [container]);\n\n return (\n <SkiaView\n ref={ref}\n style={style}\n onDraw={onDraw}\n mode={mode}\n debug={debug}\n />\n );\n }\n);\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"]}
@@ -1,12 +1,12 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useRef, useMemo, forwardRef, useImperativeHandle } from "react";
4
- import { Skia } from "../../skia";
4
+ import { SkiaPaint } from "../../skia";
5
5
  import { processPaint } from "../processors";
6
6
  import { createDeclaration } from "../nodes";
7
7
  export const usePaintRef = () => useRef(null);
8
8
  export const Paint = /*#__PURE__*/forwardRef((props, ref) => {
9
- const paint = useMemo(() => Skia.Paint(), []);
9
+ const paint = useMemo(() => SkiaPaint(), []);
10
10
  useImperativeHandle(ref, () => paint, [paint]);
11
11
  const onDeclare = useMemo(() => createDeclaration((paintProps, children, ctx) => processPaint(paint, ctx.opacity, paintProps, children)), [paint]);
12
12
  return /*#__PURE__*/React.createElement("skDeclaration", _extends({
@@ -1 +1 @@
1
- {"version":3,"sources":["Paint.tsx"],"names":["React","useRef","useMemo","forwardRef","useImperativeHandle","Skia","processPaint","createDeclaration","usePaintRef","Paint","props","ref","paint","onDeclare","paintProps","children","ctx","opacity"],"mappings":";;AACA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,OAAxB,EAAiCC,UAAjC,EAA6CC,mBAA7C,QAAwE,OAAxE;AAGA,SAASC,IAAT,QAAqB,YAArB;AAEA,SAASC,YAAT,QAA6B,eAA7B;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAEA,OAAO,MAAMC,WAAW,GAAG,MAAMP,MAAM,CAAU,IAAV,CAAhC;AAMP,OAAO,MAAMQ,KAAK,gBAAGN,UAAU,CAC7B,CAACO,KAAD,EAAQC,GAAR,KAAgB;AACd,QAAMC,KAAK,GAAGV,OAAO,CAAC,MAAMG,IAAI,CAACI,KAAL,EAAP,EAAqB,EAArB,CAArB;AACAL,EAAAA,mBAAmB,CAACO,GAAD,EAAM,MAAMC,KAAZ,EAAmB,CAACA,KAAD,CAAnB,CAAnB;AACA,QAAMC,SAAS,GAAGX,OAAO,CACvB,MACEK,iBAAiB,CAAa,CAACO,UAAD,EAAaC,QAAb,EAAuBC,GAAvB,KAC5BV,YAAY,CAACM,KAAD,EAAQI,GAAG,CAACC,OAAZ,EAAqBH,UAArB,EAAiCC,QAAjC,CADG,CAFI,EAKvB,CAACH,KAAD,CALuB,CAAzB;AAOA,sBAAO;AAAe,IAAA,SAAS,EAAEC;AAA1B,KAAyCH,KAAzC,EAAP;AACD,CAZ4B,CAAxB","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useRef, useMemo, forwardRef, useImperativeHandle } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { Skia } from \"../../skia\";\nimport type { CustomPaintProps, AnimatedProps } from \"../processors\";\nimport { processPaint } from \"../processors\";\nimport { createDeclaration } from \"../nodes\";\n\nexport const usePaintRef = () => useRef<SkPaint>(null);\n\nexport interface PaintProps extends Omit<CustomPaintProps, \"paint\"> {\n children?: ReactNode | ReactNode[];\n}\n\nexport const Paint = forwardRef<SkPaint, AnimatedProps<PaintProps>>(\n (props, ref) => {\n const paint = useMemo(() => Skia.Paint(), []);\n useImperativeHandle(ref, () => paint, [paint]);\n const onDeclare = useMemo(\n () =>\n createDeclaration<PaintProps>((paintProps, children, ctx) =>\n processPaint(paint, ctx.opacity, paintProps, children)\n ),\n [paint]\n );\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n }\n);\n"]}
1
+ {"version":3,"sources":["Paint.tsx"],"names":["React","useRef","useMemo","forwardRef","useImperativeHandle","SkiaPaint","processPaint","createDeclaration","usePaintRef","Paint","props","ref","paint","onDeclare","paintProps","children","ctx","opacity"],"mappings":";;AACA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,OAAxB,EAAiCC,UAAjC,EAA6CC,mBAA7C,QAAwE,OAAxE;AAGA,SAASC,SAAT,QAA0B,YAA1B;AAEA,SAASC,YAAT,QAA6B,eAA7B;AACA,SAASC,iBAAT,QAAkC,UAAlC;AAEA,OAAO,MAAMC,WAAW,GAAG,MAAMP,MAAM,CAAU,IAAV,CAAhC;AAMP,OAAO,MAAMQ,KAAK,gBAAGN,UAAU,CAC7B,CAACO,KAAD,EAAQC,GAAR,KAAgB;AACd,QAAMC,KAAK,GAAGV,OAAO,CAAC,MAAMG,SAAS,EAAhB,EAAoB,EAApB,CAArB;AACAD,EAAAA,mBAAmB,CAACO,GAAD,EAAM,MAAMC,KAAZ,EAAmB,CAACA,KAAD,CAAnB,CAAnB;AACA,QAAMC,SAAS,GAAGX,OAAO,CACvB,MACEK,iBAAiB,CAAa,CAACO,UAAD,EAAaC,QAAb,EAAuBC,GAAvB,KAC5BV,YAAY,CAACM,KAAD,EAAQI,GAAG,CAACC,OAAZ,EAAqBH,UAArB,EAAiCC,QAAjC,CADG,CAFI,EAKvB,CAACH,KAAD,CALuB,CAAzB;AAOA,sBAAO;AAAe,IAAA,SAAS,EAAEC;AAA1B,KAAyCH,KAAzC,EAAP;AACD,CAZ4B,CAAxB","sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useRef, useMemo, forwardRef, useImperativeHandle } from \"react\";\n\nimport type { SkPaint } from \"../../skia\";\nimport { SkiaPaint } from \"../../skia\";\nimport type { CustomPaintProps, AnimatedProps } from \"../processors\";\nimport { processPaint } from \"../processors\";\nimport { createDeclaration } from \"../nodes\";\n\nexport const usePaintRef = () => useRef<SkPaint>(null);\n\nexport interface PaintProps extends Omit<CustomPaintProps, \"paint\"> {\n children?: ReactNode | ReactNode[];\n}\n\nexport const Paint = forwardRef<SkPaint, AnimatedProps<PaintProps>>(\n (props, ref) => {\n const paint = useMemo(() => SkiaPaint(), []);\n useImperativeHandle(ref, () => paint, [paint]);\n const onDeclare = useMemo(\n () =>\n createDeclaration<PaintProps>((paintProps, children, ctx) =>\n processPaint(paint, ctx.opacity, paintProps, children)\n ),\n [paint]\n );\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["BlendColor.tsx"],"names":["React","BlendMode","Skia","createDeclaration","enumKey","composeColorFilter","onDeclare","children","mode","color","cf","ColorFilter","MakeBlend","Color","BlendColor","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,SAAT,EAAoBC,IAApB,QAAgC,eAAhC;AACA,SAASC,iBAAT,QAAkC,aAAlC;AAEA,SAASC,OAAT,QAAwB,kBAAxB;AAGA,SAASC,kBAAT,QAAmC,WAAnC;AAQA,MAAMC,SAAS,GAAGH,iBAAiB,CACjC,OAAkBI,QAAlB,KAA+B;AAAA,MAA9B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAA8B;AAC7B,QAAMC,EAAE,GAAGR,IAAI,CAACS,WAAL,CAAiBC,SAAjB,CACTV,IAAI,CAACW,KAAL,CAAWJ,KAAX,CADS,EAETR,SAAS,CAACG,OAAO,CAACI,IAAD,CAAR,CAFA,CAAX;AAIA,SAAOH,kBAAkB,CAACK,EAAD,EAAKH,QAAL,CAAzB;AACD,CAPgC,CAAnC;AAUA,OAAO,MAAMO,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAET;AAA1B,KAAyCS,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { BlendMode, Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes\";\nimport type { SkEnum, AnimatedProps } from \"../../processors\";\nimport { enumKey } from \"../../processors\";\nimport type { Color } from \"../../../skia\";\n\nimport { composeColorFilter } from \"./Compose\";\n\nexport interface BlendColorProps {\n mode: SkEnum<typeof BlendMode>;\n color: Color;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendColorProps>(\n ({ mode, color }, children) => {\n const cf = Skia.ColorFilter.MakeBlend(\n Skia.Color(color),\n BlendMode[enumKey(mode)]\n );\n return composeColorFilter(cf, children);\n }\n);\n\nexport const BlendColor = (props: AnimatedProps<BlendColorProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["BlendColor.tsx"],"names":["React","BlendMode","Skia","createDeclaration","enumKey","composeColorFilter","onDeclare","children","mode","color","cf","ColorFilter","MakeBlend","Color","BlendColor","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,SAAT,EAAoBC,IAApB,QAAgC,eAAhC;AACA,SAASC,iBAAT,QAAkC,aAAlC;AAEA,SAASC,OAAT,QAAwB,kBAAxB;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AAQA,MAAMC,SAAS,GAAGH,iBAAiB,CACjC,OAAkBI,QAAlB,KAA+B;AAAA,MAA9B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAA8B;AAC7B,QAAMC,EAAE,GAAGR,IAAI,CAACS,WAAL,CAAiBC,SAAjB,CACTV,IAAI,CAACW,KAAL,CAAWJ,KAAX,CADS,EAETR,SAAS,CAACG,OAAO,CAACI,IAAD,CAAR,CAFA,CAAX;AAIA,SAAOH,kBAAkB,CAACK,EAAD,EAAKH,QAAL,CAAzB;AACD,CAPgC,CAAnC;AAUA,OAAO,MAAMO,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAET;AAA1B,KAAyCS,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport type { Color } from \"../../../skia\";\nimport { BlendMode, Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes\";\nimport type { SkEnum, AnimatedProps } from \"../../processors\";\nimport { enumKey } from \"../../processors\";\n\nimport { composeColorFilter } from \"./Compose\";\n\nexport interface BlendColorProps {\n mode: SkEnum<typeof BlendMode>;\n color: Color;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendColorProps>(\n ({ mode, color }, children) => {\n const cf = Skia.ColorFilter.MakeBlend(\n Skia.Color(color),\n BlendMode[enumKey(mode)]\n );\n return composeColorFilter(cf, children);\n }\n);\n\nexport const BlendColor = (props: AnimatedProps<BlendColorProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -10,7 +10,7 @@ const onDeclare = createDeclaration((_ref, children) => {
10
10
  t
11
11
  } = _ref;
12
12
  const [src, dst] = children.filter(isColorFilter);
13
- const cf = Skia.ColorFilter.MakeLerp(t, dst, src);
13
+ const cf = Skia.ColorFilter.MakeLerp(t, src, dst);
14
14
  return composeColorFilter(cf, children.filter(c => c !== src && c !== dst));
15
15
  });
16
16
  export const Lerp = props => {
@@ -1 +1 @@
1
- {"version":3,"sources":["Lerp.tsx"],"names":["React","Skia","createDeclaration","isColorFilter","composeColorFilter","onDeclare","children","t","src","dst","filter","cf","ColorFilter","MakeLerp","c","Lerp","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA,SAASC,aAAT,QAA8B,uCAA9B;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AAOA,MAAMC,SAAS,GAAGH,iBAAiB,CAAY,OAAQI,QAAR,KAAqB;AAAA,MAApB;AAAEC,IAAAA;AAAF,GAAoB;AAClE,QAAM,CAACC,GAAD,EAAMC,GAAN,IAAaH,QAAQ,CAACI,MAAT,CAAgBP,aAAhB,CAAnB;AACA,QAAMQ,EAAE,GAAGV,IAAI,CAACW,WAAL,CAAiBC,QAAjB,CAA0BN,CAA1B,EAA6BE,GAA7B,EAAkCD,GAAlC,CAAX;AACA,SAAOJ,kBAAkB,CACvBO,EADuB,EAEvBL,QAAQ,CAACI,MAAT,CAAiBI,CAAD,IAAOA,CAAC,KAAKN,GAAN,IAAaM,CAAC,KAAKL,GAA1C,CAFuB,CAAzB;AAID,CAPkC,CAAnC;AASA,OAAO,MAAMM,IAAI,GAAIC,KAAD,IAAqC;AACvD,sBAAO;AAAe,IAAA,SAAS,EAAEX;AAA1B,KAAyCW,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport { isColorFilter } from \"../../../skia/ColorFilter/ColorFilter\";\n\nimport { composeColorFilter } from \"./Compose\";\n\nexport interface LerpProps {\n t: number;\n children: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<LerpProps>(({ t }, children) => {\n const [src, dst] = children.filter(isColorFilter);\n const cf = Skia.ColorFilter.MakeLerp(t, dst, src);\n return composeColorFilter(\n cf,\n children.filter((c) => c !== src && c !== dst)\n );\n});\n\nexport const Lerp = (props: AnimatedProps<LerpProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["Lerp.tsx"],"names":["React","Skia","createDeclaration","isColorFilter","composeColorFilter","onDeclare","children","t","src","dst","filter","cf","ColorFilter","MakeLerp","c","Lerp","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAEA,SAASC,aAAT,QAA8B,uCAA9B;AAEA,SAASC,kBAAT,QAAmC,WAAnC;AAOA,MAAMC,SAAS,GAAGH,iBAAiB,CAAY,OAAQI,QAAR,KAAqB;AAAA,MAApB;AAAEC,IAAAA;AAAF,GAAoB;AAClE,QAAM,CAACC,GAAD,EAAMC,GAAN,IAAaH,QAAQ,CAACI,MAAT,CAAgBP,aAAhB,CAAnB;AACA,QAAMQ,EAAE,GAAGV,IAAI,CAACW,WAAL,CAAiBC,QAAjB,CAA0BN,CAA1B,EAA6BC,GAA7B,EAAkCC,GAAlC,CAAX;AACA,SAAOL,kBAAkB,CACvBO,EADuB,EAEvBL,QAAQ,CAACI,MAAT,CAAiBI,CAAD,IAAOA,CAAC,KAAKN,GAAN,IAAaM,CAAC,KAAKL,GAA1C,CAFuB,CAAzB;AAID,CAPkC,CAAnC;AASA,OAAO,MAAMM,IAAI,GAAIC,KAAD,IAAqC;AACvD,sBAAO;AAAe,IAAA,SAAS,EAAEX;AAA1B,KAAyCW,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport { isColorFilter } from \"../../../skia/ColorFilter/ColorFilter\";\n\nimport { composeColorFilter } from \"./Compose\";\n\nexport interface LerpProps {\n t: number;\n children: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<LerpProps>(({ t }, children) => {\n const [src, dst] = children.filter(isColorFilter);\n const cf = Skia.ColorFilter.MakeLerp(t, src, dst);\n return composeColorFilter(\n cf,\n children.filter((c) => c !== src && c !== dst)\n );\n});\n\nexport const Lerp = (props: AnimatedProps<LerpProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -1,7 +1,8 @@
1
1
  import { BlendMode, Skia, TileMode } from "../../../skia";
2
+ const Black = Skia.Color("black");
2
3
  export const MakeInnerShadow = (shadowOnly, dx, dy, sigmaX, sigmaY, color, input) => {
3
- const sourceGraphic = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.Dst), null);
4
- const sourceAlpha = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.SrcIn), null);
4
+ const sourceGraphic = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst), null);
5
+ const sourceAlpha = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn), null);
5
6
  const f1 = Skia.ImageFilter.MakeColorFilter(Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut), null);
6
7
  const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);
7
8
  const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);
@@ -1 +1 @@
1
- {"version":3,"sources":["InnerShadow.tsx"],"names":["BlendMode","Skia","TileMode","MakeInnerShadow","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver"],"mappings":"AACA,SAASA,SAAT,EAAoBC,IAApB,EAA0BC,QAA1B,QAA0C,eAA1C;AAGA,OAAO,MAAMC,eAAe,GAAG,CAC7BC,UAD6B,EAE7BC,EAF6B,EAG7BC,EAH6B,EAI7BC,MAJ6B,EAK7BC,MAL6B,EAM7BC,KAN6B,EAO7BC,KAP6B,KAQ1B;AACH,QAAMC,aAAa,GAAGV,IAAI,CAACW,WAAL,CAAiBC,eAAjB,CACpBZ,IAAI,CAACa,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCf,SAAS,CAACgB,GAAjD,CADoB,EAEpB,IAFoB,CAAtB;AAIA,QAAMC,WAAW,GAAGhB,IAAI,CAACW,WAAL,CAAiBC,eAAjB,CAClBZ,IAAI,CAACa,WAAL,CAAiBC,SAAjB,CAA2B,UAA3B,EAAuCf,SAAS,CAACkB,KAAjD,CADkB,EAElB,IAFkB,CAApB;AAIA,QAAMC,EAAE,GAAGlB,IAAI,CAACW,WAAL,CAAiBC,eAAjB,CACTZ,IAAI,CAACa,WAAL,CAAiBC,SAAjB,CAA2BN,KAA3B,EAAkCT,SAAS,CAACoB,MAA5C,CADS,EAET,IAFS,CAAX;AAIA,QAAMC,EAAE,GAAGpB,IAAI,CAACW,WAAL,CAAiBU,UAAjB,CAA4BjB,EAA5B,EAAgCC,EAAhC,EAAoCa,EAApC,CAAX;AACA,QAAMI,EAAE,GAAGtB,IAAI,CAACW,WAAL,CAAiBY,QAAjB,CAA0BjB,MAA1B,EAAkCC,MAAlC,EAA0CN,QAAQ,CAACuB,KAAnD,EAA0DJ,EAA1D,CAAX;AACA,QAAMK,EAAE,GAAGzB,IAAI,CAACW,WAAL,CAAiBG,SAAjB,CAA2Bf,SAAS,CAACkB,KAArC,EAA4CD,WAA5C,EAAyDM,EAAzD,CAAX;;AACA,MAAInB,UAAJ,EAAgB;AACd,WAAOsB,EAAP;AACD;;AACD,SAAOzB,IAAI,CAACW,WAAL,CAAiBe,WAAjB,CACLjB,KADK,EAELT,IAAI,CAACW,WAAL,CAAiBG,SAAjB,CAA2Bf,SAAS,CAAC4B,OAArC,EAA8CjB,aAA9C,EAA6De,EAA7D,CAFK,CAAP;AAID,CA/BM","sourcesContent":["import type { SkColor } from \"../../../skia\";\nimport { BlendMode, Skia, TileMode } from \"../../../skia\";\nimport type { SkImageFilter } from \"../../../skia/ImageFilter/ImageFilter\";\n\nexport const MakeInnerShadow = (\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(0xff000000, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n"]}
1
+ {"version":3,"sources":["InnerShadow.tsx"],"names":["BlendMode","Skia","TileMode","Black","Color","MakeInnerShadow","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver"],"mappings":"AACA,SAASA,SAAT,EAAoBC,IAApB,EAA0BC,QAA1B,QAA0C,eAA1C;AAGA,MAAMC,KAAK,GAAGF,IAAI,CAACG,KAAL,CAAW,OAAX,CAAd;AAEA,OAAO,MAAMC,eAAe,GAAG,CAC7BC,UAD6B,EAE7BC,EAF6B,EAG7BC,EAH6B,EAI7BC,MAJ6B,EAK7BC,MAL6B,EAM7BC,KAN6B,EAO7BC,KAP6B,KAQ1B;AACH,QAAMC,aAAa,GAAGZ,IAAI,CAACa,WAAL,CAAiBC,eAAjB,CACpBd,IAAI,CAACe,WAAL,CAAiBC,SAAjB,CAA2Bd,KAA3B,EAAkCH,SAAS,CAACkB,GAA5C,CADoB,EAEpB,IAFoB,CAAtB;AAIA,QAAMC,WAAW,GAAGlB,IAAI,CAACa,WAAL,CAAiBC,eAAjB,CAClBd,IAAI,CAACe,WAAL,CAAiBC,SAAjB,CAA2Bd,KAA3B,EAAkCH,SAAS,CAACoB,KAA5C,CADkB,EAElB,IAFkB,CAApB;AAIA,QAAMC,EAAE,GAAGpB,IAAI,CAACa,WAAL,CAAiBC,eAAjB,CACTd,IAAI,CAACe,WAAL,CAAiBC,SAAjB,CAA2BN,KAA3B,EAAkCX,SAAS,CAACsB,MAA5C,CADS,EAET,IAFS,CAAX;AAIA,QAAMC,EAAE,GAAGtB,IAAI,CAACa,WAAL,CAAiBU,UAAjB,CAA4BjB,EAA5B,EAAgCC,EAAhC,EAAoCa,EAApC,CAAX;AACA,QAAMI,EAAE,GAAGxB,IAAI,CAACa,WAAL,CAAiBY,QAAjB,CAA0BjB,MAA1B,EAAkCC,MAAlC,EAA0CR,QAAQ,CAACyB,KAAnD,EAA0DJ,EAA1D,CAAX;AACA,QAAMK,EAAE,GAAG3B,IAAI,CAACa,WAAL,CAAiBG,SAAjB,CAA2BjB,SAAS,CAACoB,KAArC,EAA4CD,WAA5C,EAAyDM,EAAzD,CAAX;;AACA,MAAInB,UAAJ,EAAgB;AACd,WAAOsB,EAAP;AACD;;AACD,SAAO3B,IAAI,CAACa,WAAL,CAAiBe,WAAjB,CACLjB,KADK,EAELX,IAAI,CAACa,WAAL,CAAiBG,SAAjB,CAA2BjB,SAAS,CAAC8B,OAArC,EAA8CjB,aAA9C,EAA6De,EAA7D,CAFK,CAAP;AAID,CA/BM","sourcesContent":["import type { SkColor } from \"../../../skia\";\nimport { BlendMode, Skia, TileMode } from \"../../../skia\";\nimport type { SkImageFilter } from \"../../../skia/ImageFilter/ImageFilter\";\n\nconst Black = Skia.Color(\"black\");\n\nexport const MakeInnerShadow = (\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n"]}
@@ -0,0 +1,19 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from "react";
4
+ import { Skia } from "../../../skia";
5
+ import { createDeclaration } from "../../nodes/Declaration";
6
+ import { getInput } from "./getInput";
7
+ const onDeclare = createDeclaration((_ref, children) => {
8
+ let {
9
+ source
10
+ } = _ref;
11
+ const rtb = Skia.RuntimeShaderBuilder(source);
12
+ return Skia.ImageFilter.MakeRuntimeShader(rtb, null, getInput(children));
13
+ });
14
+ export const RuntimeShader = props => {
15
+ return /*#__PURE__*/React.createElement("skDeclaration", _extends({
16
+ onDeclare: onDeclare
17
+ }, props));
18
+ };
19
+ //# sourceMappingURL=RuntimeShader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RuntimeShader.tsx"],"names":["React","Skia","createDeclaration","getInput","onDeclare","children","source","rtb","RuntimeShaderBuilder","ImageFilter","MakeRuntimeShader","RuntimeShader","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAIA,SAASC,QAAT,QAAyB,YAAzB;AAMA,MAAMC,SAAS,GAAGF,iBAAiB,CACjC,OAAaG,QAAb,KAA0B;AAAA,MAAzB;AAAEC,IAAAA;AAAF,GAAyB;AACxB,QAAMC,GAAG,GAAGN,IAAI,CAACO,oBAAL,CAA0BF,MAA1B,CAAZ;AACA,SAAOL,IAAI,CAACQ,WAAL,CAAiBC,iBAAjB,CAAmCH,GAAnC,EAAwC,IAAxC,EAA8CJ,QAAQ,CAACE,QAAD,CAAtD,CAAP;AACD,CAJgC,CAAnC;AAOA,OAAO,MAAMM,aAAa,GAAIC,KAAD,IAA8C;AACzE,sBAAO;AAAe,IAAA,SAAS,EAAER;AAA1B,KAAyCQ,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { SkRuntimeEffect } from \"../../../skia/RuntimeEffect/RuntimeEffect\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface RuntimeShaderProps {\n source: SkRuntimeEffect;\n}\n\nconst onDeclare = createDeclaration<RuntimeShaderProps>(\n ({ source }, children) => {\n const rtb = Skia.RuntimeShaderBuilder(source);\n return Skia.ImageFilter.MakeRuntimeShader(rtb, null, getInput(children));\n }\n);\n\nexport const RuntimeShader = (props: AnimatedProps<RuntimeShaderProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -3,4 +3,5 @@ export * from "./Offset";
3
3
  export * from "./DisplacementMap";
4
4
  export * from "./Shadow";
5
5
  export * from "./Morphology";
6
+ export * from "./RuntimeShader";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAd;AACA,cAAc,UAAd;AACA,cAAc,mBAAd;AACA,cAAc,UAAd;AACA,cAAc,cAAd","sourcesContent":["export * from \"./Blur\";\nexport * from \"./Offset\";\nexport * from \"./DisplacementMap\";\nexport * from \"./Shadow\";\nexport * from \"./Morphology\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAd;AACA,cAAc,UAAd;AACA,cAAc,mBAAd;AACA,cAAc,UAAd;AACA,cAAc,cAAd;AACA,cAAc,iBAAd","sourcesContent":["export * from \"./Blur\";\nexport * from \"./Offset\";\nexport * from \"./DisplacementMap\";\nexport * from \"./Shadow\";\nexport * from \"./Morphology\";\nexport * from \"./RuntimeShader\";\n"]}
@@ -1,4 +1,4 @@
1
- import { TileMode, Skia } from "../../../skia";
1
+ import { Skia, TileMode } from "../../../skia";
2
2
  import { enumKey } from "../../processors/Paint";
3
3
  import { localMatrix } from "../../processors/Transform";
4
4
  export const processGradientProps = _ref => {
@@ -10,7 +10,7 @@ export const processGradientProps = _ref => {
10
10
  ...transform
11
11
  } = _ref;
12
12
  return {
13
- colors: colors.map(color => typeof color === "string" ? Skia.Color(color) : color),
13
+ colors: colors.map(color => Skia.Color(color)),
14
14
  positions: positions !== null && positions !== void 0 ? positions : null,
15
15
  mode: TileMode[enumKey(mode !== null && mode !== void 0 ? mode : "clamp")],
16
16
  flags,
@@ -1 +1 @@
1
- {"version":3,"sources":["Gradient.ts"],"names":["TileMode","Skia","enumKey","localMatrix","processGradientProps","colors","positions","mode","flags","transform","map","color","Color"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,IAAnB,QAA+B,eAA/B;AAGA,SAASC,OAAT,QAAwB,wBAAxB;AACA,SAASC,WAAT,QAA4B,4BAA5B;AAUA,OAAO,MAAMC,oBAAoB,GAAG;AAAA,MAAC;AACnCC,IAAAA,MADmC;AAEnCC,IAAAA,SAFmC;AAGnCC,IAAAA,IAHmC;AAInCC,IAAAA,KAJmC;AAKnC,OAAGC;AALgC,GAAD;AAAA,SAMd;AACpBJ,IAAAA,MAAM,EAAEA,MAAM,CAACK,GAAP,CAAYC,KAAD,IACjB,OAAOA,KAAP,KAAiB,QAAjB,GAA4BV,IAAI,CAACW,KAAL,CAAWD,KAAX,CAA5B,GAAgDA,KAD1C,CADY;AAIpBL,IAAAA,SAAS,EAAEA,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAe,IAJJ;AAKpBC,IAAAA,IAAI,EAAEP,QAAQ,CAACE,OAAO,CAACK,IAAD,aAACA,IAAD,cAACA,IAAD,GAAS,OAAT,CAAR,CALM;AAMpBC,IAAAA,KANoB;AAOpBL,IAAAA,WAAW,EAAEA,WAAW,CAACM,SAAD;AAPJ,GANc;AAAA,CAA7B","sourcesContent":["import { TileMode, Skia } from \"../../../skia\";\nimport type { SkEnum } from \"../../processors/Paint\";\nimport type { TransformProps } from \"../../processors/Transform\";\nimport { enumKey } from \"../../processors/Paint\";\nimport { localMatrix } from \"../../processors/Transform\";\nimport type { Color } from \"../../../skia/Color\";\n\nexport interface GradientProps extends TransformProps {\n colors: Color[];\n positions?: number[];\n mode?: SkEnum<typeof TileMode>;\n flags?: number;\n}\n\nexport const processGradientProps = ({\n colors,\n positions,\n mode,\n flags,\n ...transform\n}: GradientProps) => ({\n colors: colors.map((color) =>\n typeof color === \"string\" ? Skia.Color(color) : color\n ),\n positions: positions ?? null,\n mode: TileMode[enumKey(mode ?? \"clamp\")],\n flags,\n localMatrix: localMatrix(transform),\n});\n"]}
1
+ {"version":3,"sources":["Gradient.ts"],"names":["Skia","TileMode","enumKey","localMatrix","processGradientProps","colors","positions","mode","flags","transform","map","color","Color"],"mappings":"AAAA,SAASA,IAAT,EAAeC,QAAf,QAA+B,eAA/B;AAGA,SAASC,OAAT,QAAwB,wBAAxB;AACA,SAASC,WAAT,QAA4B,4BAA5B;AAUA,OAAO,MAAMC,oBAAoB,GAAG;AAAA,MAAC;AACnCC,IAAAA,MADmC;AAEnCC,IAAAA,SAFmC;AAGnCC,IAAAA,IAHmC;AAInCC,IAAAA,KAJmC;AAKnC,OAAGC;AALgC,GAAD;AAAA,SAMd;AACpBJ,IAAAA,MAAM,EAAEA,MAAM,CAACK,GAAP,CAAYC,KAAD,IAAWX,IAAI,CAACY,KAAL,CAAWD,KAAX,CAAtB,CADY;AAEpBL,IAAAA,SAAS,EAAEA,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAe,IAFJ;AAGpBC,IAAAA,IAAI,EAAEN,QAAQ,CAACC,OAAO,CAACK,IAAD,aAACA,IAAD,cAACA,IAAD,GAAS,OAAT,CAAR,CAHM;AAIpBC,IAAAA,KAJoB;AAKpBL,IAAAA,WAAW,EAAEA,WAAW,CAACM,SAAD;AALJ,GANc;AAAA,CAA7B","sourcesContent":["import { Skia, TileMode } from \"../../../skia\";\nimport type { SkEnum } from \"../../processors/Paint\";\nimport type { TransformProps } from \"../../processors/Transform\";\nimport { enumKey } from \"../../processors/Paint\";\nimport { localMatrix } from \"../../processors/Transform\";\nimport type { Color } from \"../../../skia/Color\";\n\nexport interface GradientProps extends TransformProps {\n colors: Color[];\n positions?: number[];\n mode?: SkEnum<typeof TileMode>;\n flags?: number;\n}\n\nexport const processGradientProps = ({\n colors,\n positions,\n mode,\n flags,\n ...transform\n}: GradientProps) => ({\n colors: colors.map((color) => Skia.Color(color)),\n positions: positions ?? null,\n mode: TileMode[enumKey(mode ?? \"clamp\")],\n flags,\n localMatrix: localMatrix(transform),\n});\n"]}
@@ -3,9 +3,10 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import React from "react";
4
4
  import { isShader } from "../../../skia";
5
5
  import { createDeclaration } from "../../nodes/Declaration";
6
- import { localMatrix } from "../../processors"; // We need to use any here because hasOwnProperty doesn't work on JSI instances
6
+ import { localMatrix } from "../../processors";
7
7
 
8
- const isVector = obj => // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ const isVector = obj => // We have an issue to check property existence on JSI backed instances
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
10
  obj.x !== undefined && obj.y !== undefined;
10
11
 
11
12
  const processValue = value => {
@@ -1 +1 @@
1
- {"version":3,"sources":["Shader.tsx"],"names":["React","isShader","createDeclaration","localMatrix","isVector","obj","x","undefined","y","processValue","value","onDeclare","children","uniforms","source","opaque","transform","processedUniforms","Array","getUniformCount","fill","flatMap","_","i","name","getUniformName","Error","isArray","names","Object","keys","length","usedUniforms","map","unusedUniform","indexOf","filter","n","console","warn","join","makeShaderWithChildren","Shader","props","defaultProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,QAAT,QAAyB,eAAzB;AAGA,SAASC,iBAAT,QAAkC,yBAAlC;AACA,SAASC,WAAT,QAA4B,kBAA5B,C,CAEA;;AACA,MAAMC,QAAQ,GAAIC,GAAD,IACf;AACCA,GAAD,CAAaC,CAAb,KAAmBC,SAAnB,IAAiCF,GAAD,CAAaG,CAAb,KAAmBD,SAFrD;;AAYA,MAAME,YAAY,GAAIC,KAAD,IAAqD;AACxE,MAAIN,QAAQ,CAACM,KAAD,CAAZ,EAAqB;AACnB,WAAO,CAACA,KAAK,CAACJ,CAAP,EAAUI,KAAK,CAACF,CAAhB,CAAP;AACD;;AACD,SAAOE,KAAP;AACD,CALD;;AAcA,MAAMC,SAAS,GAAGT,iBAAiB,CACjC,OAA6CU,QAA7C,KAA0D;AAAA,MAAzD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,MAAZ;AAAoBC,IAAAA,MAApB;AAA4B,OAAGC;AAA/B,GAAyD;AACxD,QAAMC,iBAAiB,GAAG,IAAIC,KAAJ,CAAUJ,MAAM,CAACK,eAAP,EAAV,EACvBC,IADuB,CAClB,CADkB,EAEvBC,OAFuB,CAEf,CAACC,CAAD,EAAIC,CAAJ,KAAU;AACjB,UAAMC,IAAI,GAAGV,MAAM,CAACW,cAAP,CAAsBF,CAAtB,CAAb;AACA,UAAMb,KAAK,GAAGG,QAAQ,CAACW,IAAD,CAAtB;;AACA,QAAId,KAAK,KAAKH,SAAd,EAAyB;AACvB,YAAM,IAAImB,KAAJ,CAAW,kCAAiCF,IAAK,EAAjD,CAAN;AACD;;AACD,QAAIN,KAAK,CAACS,OAAN,CAAcjB,KAAd,CAAJ,EAA0B;AACxB,aAAOA,KAAK,CAACW,OAAN,CAAcZ,YAAd,CAAP;AACD;;AACD,WAAOA,YAAY,CAACC,KAAD,CAAnB;AACD,GAZuB,CAA1B;AAaA,QAAMkB,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYjB,QAAZ,CAAd;;AACA,MAAIe,KAAK,CAACG,MAAN,GAAejB,MAAM,CAACK,eAAP,EAAnB,EAA6C;AAC3C,UAAMa,YAAY,GAAG,IAAId,KAAJ,CAAUJ,MAAM,CAACK,eAAP,EAAV,EAClBC,IADkB,CACb,CADa,EAElBa,GAFkB,CAEd,CAACX,CAAD,EAAIC,CAAJ,KAAUT,MAAM,CAACW,cAAP,CAAsBF,CAAtB,CAFI,CAArB;AAGA,UAAMW,aAAa,GAAGN,KAAK,CACxBK,GADmB,CACdT,IAAD,IAAU;AACb,UAAIQ,YAAY,CAACG,OAAb,CAAqBX,IAArB,MAA+B,CAAC,CAApC,EAAuC;AACrC,eAAOA,IAAP;AACD;;AACD,aAAO,IAAP;AACD,KANmB,EAOnBY,MAPmB,CAOXC,CAAD,IAAOA,CAAC,KAAK,IAPD,CAAtB;AAQAC,IAAAA,OAAO,CAACC,IAAR,CACE,oCAAoCL,aAAa,CAACM,IAAd,CAAmB,IAAnB,CADtC;AAGD;;AACD,SAAO1B,MAAM,CAAC2B,sBAAP,CACLxB,iBADK,EAELF,MAFK,EAGLH,QAAQ,CAACwB,MAAT,CAAgBnC,QAAhB,CAHK,EAILE,WAAW,CAACa,SAAD,CAJN,CAAP;AAMD,CAtCgC,CAAnC;AAyCA,OAAO,MAAM0B,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEhC;AAA1B,KAAyCgC,KAAzC,EAAP;AACD,CAFM;AAIPD,MAAM,CAACE,YAAP,GAAsB;AACpB/B,EAAAA,QAAQ,EAAE;AADU,CAAtB","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { isShader } from \"../../../skia\";\nimport type { IRuntimeEffect } from \"../../../skia\";\nimport type { Vector, AnimatedProps, TransformProps } from \"../../processors\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport { localMatrix } from \"../../processors\";\n\n// We need to use any here because hasOwnProperty doesn't work on JSI instances\nconst isVector = (obj: unknown): obj is Vector =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (obj as any).x !== undefined && (obj as any).y !== undefined;\n\ntype UniformValue = number | Vector | readonly number[];\n\ntype Uniform = UniformValue | readonly UniformValue[];\n\ninterface Uniforms {\n [name: string]: Uniform;\n}\n\nconst processValue = (value: UniformValue): number | readonly number[] => {\n if (isVector(value)) {\n return [value.x, value.y];\n }\n return value;\n};\n\nexport interface ShaderProps extends TransformProps {\n source: IRuntimeEffect;\n uniforms: Uniforms;\n opaque?: boolean;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<ShaderProps>(\n ({ uniforms, source, opaque, ...transform }, children) => {\n const processedUniforms = new Array(source.getUniformCount())\n .fill(0)\n .flatMap((_, i) => {\n const name = source.getUniformName(i);\n const value = uniforms[name];\n if (value === undefined) {\n throw new Error(`No value specified for uniform ${name}`);\n }\n if (Array.isArray(value)) {\n return value.flatMap(processValue);\n }\n return processValue(value as UniformValue);\n });\n const names = Object.keys(uniforms);\n if (names.length > source.getUniformCount()) {\n const usedUniforms = new Array(source.getUniformCount())\n .fill(0)\n .map((_, i) => source.getUniformName(i));\n const unusedUniform = names\n .map((name) => {\n if (usedUniforms.indexOf(name) === -1) {\n return name;\n }\n return null;\n })\n .filter((n) => n !== null);\n console.warn(\n \"Unused uniforms were provided: \" + unusedUniform.join(\", \")\n );\n }\n return source.makeShaderWithChildren(\n processedUniforms,\n opaque,\n children.filter(isShader),\n localMatrix(transform)\n );\n }\n);\n\nexport const Shader = (props: AnimatedProps<ShaderProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nShader.defaultProps = {\n uniforms: [],\n};\n"]}
1
+ {"version":3,"sources":["Shader.tsx"],"names":["React","isShader","createDeclaration","localMatrix","isVector","obj","x","undefined","y","processValue","value","onDeclare","children","uniforms","source","opaque","transform","processedUniforms","Array","getUniformCount","fill","flatMap","_","i","name","getUniformName","Error","isArray","names","Object","keys","length","usedUniforms","map","unusedUniform","indexOf","filter","n","console","warn","join","makeShaderWithChildren","Shader","props","defaultProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SAASC,QAAT,QAAyB,eAAzB;AAGA,SAASC,iBAAT,QAAkC,yBAAlC;AACA,SAASC,WAAT,QAA4B,kBAA5B;;AAEA,MAAMC,QAAQ,GAAIC,GAAD,IACf;AACA;AACCA,GAAD,CAAaC,CAAb,KAAmBC,SAAnB,IAAiCF,GAAD,CAAaG,CAAb,KAAmBD,SAHrD;;AAaA,MAAME,YAAY,GAAIC,KAAD,IAAqD;AACxE,MAAIN,QAAQ,CAACM,KAAD,CAAZ,EAAqB;AACnB,WAAO,CAACA,KAAK,CAACJ,CAAP,EAAUI,KAAK,CAACF,CAAhB,CAAP;AACD;;AACD,SAAOE,KAAP;AACD,CALD;;AAcA,MAAMC,SAAS,GAAGT,iBAAiB,CACjC,OAA6CU,QAA7C,KAA0D;AAAA,MAAzD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,MAAZ;AAAoBC,IAAAA,MAApB;AAA4B,OAAGC;AAA/B,GAAyD;AACxD,QAAMC,iBAAiB,GAAG,IAAIC,KAAJ,CAAUJ,MAAM,CAACK,eAAP,EAAV,EACvBC,IADuB,CAClB,CADkB,EAEvBC,OAFuB,CAEf,CAACC,CAAD,EAAIC,CAAJ,KAAU;AACjB,UAAMC,IAAI,GAAGV,MAAM,CAACW,cAAP,CAAsBF,CAAtB,CAAb;AACA,UAAMb,KAAK,GAAGG,QAAQ,CAACW,IAAD,CAAtB;;AACA,QAAId,KAAK,KAAKH,SAAd,EAAyB;AACvB,YAAM,IAAImB,KAAJ,CAAW,kCAAiCF,IAAK,EAAjD,CAAN;AACD;;AACD,QAAIN,KAAK,CAACS,OAAN,CAAcjB,KAAd,CAAJ,EAA0B;AACxB,aAAOA,KAAK,CAACW,OAAN,CAAcZ,YAAd,CAAP;AACD;;AACD,WAAOA,YAAY,CAACC,KAAD,CAAnB;AACD,GAZuB,CAA1B;AAaA,QAAMkB,KAAK,GAAGC,MAAM,CAACC,IAAP,CAAYjB,QAAZ,CAAd;;AACA,MAAIe,KAAK,CAACG,MAAN,GAAejB,MAAM,CAACK,eAAP,EAAnB,EAA6C;AAC3C,UAAMa,YAAY,GAAG,IAAId,KAAJ,CAAUJ,MAAM,CAACK,eAAP,EAAV,EAClBC,IADkB,CACb,CADa,EAElBa,GAFkB,CAEd,CAACX,CAAD,EAAIC,CAAJ,KAAUT,MAAM,CAACW,cAAP,CAAsBF,CAAtB,CAFI,CAArB;AAGA,UAAMW,aAAa,GAAGN,KAAK,CACxBK,GADmB,CACdT,IAAD,IAAU;AACb,UAAIQ,YAAY,CAACG,OAAb,CAAqBX,IAArB,MAA+B,CAAC,CAApC,EAAuC;AACrC,eAAOA,IAAP;AACD;;AACD,aAAO,IAAP;AACD,KANmB,EAOnBY,MAPmB,CAOXC,CAAD,IAAOA,CAAC,KAAK,IAPD,CAAtB;AAQAC,IAAAA,OAAO,CAACC,IAAR,CACE,oCAAoCL,aAAa,CAACM,IAAd,CAAmB,IAAnB,CADtC;AAGD;;AACD,SAAO1B,MAAM,CAAC2B,sBAAP,CACLxB,iBADK,EAELF,MAFK,EAGLH,QAAQ,CAACwB,MAAT,CAAgBnC,QAAhB,CAHK,EAILE,WAAW,CAACa,SAAD,CAJN,CAAP;AAMD,CAtCgC,CAAnC;AAyCA,OAAO,MAAM0B,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEhC;AAA1B,KAAyCgC,KAAzC,EAAP;AACD,CAFM;AAIPD,MAAM,CAACE,YAAP,GAAsB;AACpB/B,EAAAA,QAAQ,EAAE;AADU,CAAtB","sourcesContent":["import React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport { isShader } from \"../../../skia\";\nimport type { SkRuntimeEffect } from \"../../../skia\";\nimport type { Vector, AnimatedProps, TransformProps } from \"../../processors\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport { localMatrix } from \"../../processors\";\n\nconst isVector = (obj: unknown): obj is Vector =>\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (obj as any).x !== undefined && (obj as any).y !== undefined;\n\ntype UniformValue = number | Vector | readonly number[];\n\ntype Uniform = UniformValue | readonly UniformValue[];\n\ninterface Uniforms {\n [name: string]: Uniform;\n}\n\nconst processValue = (value: UniformValue): number | readonly number[] => {\n if (isVector(value)) {\n return [value.x, value.y];\n }\n return value;\n};\n\nexport interface ShaderProps extends TransformProps {\n source: SkRuntimeEffect;\n uniforms: Uniforms;\n opaque?: boolean;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<ShaderProps>(\n ({ uniforms, source, opaque, ...transform }, children) => {\n const processedUniforms = new Array(source.getUniformCount())\n .fill(0)\n .flatMap((_, i) => {\n const name = source.getUniformName(i);\n const value = uniforms[name];\n if (value === undefined) {\n throw new Error(`No value specified for uniform ${name}`);\n }\n if (Array.isArray(value)) {\n return value.flatMap(processValue);\n }\n return processValue(value as UniformValue);\n });\n const names = Object.keys(uniforms);\n if (names.length > source.getUniformCount()) {\n const usedUniforms = new Array(source.getUniformCount())\n .fill(0)\n .map((_, i) => source.getUniformName(i));\n const unusedUniform = names\n .map((name) => {\n if (usedUniforms.indexOf(name) === -1) {\n return name;\n }\n return null;\n })\n .filter((n) => n !== null);\n console.warn(\n \"Unused uniforms were provided: \" + unusedUniform.join(\", \")\n );\n }\n return source.makeShaderWithChildren(\n processedUniforms,\n opaque,\n children.filter(isShader),\n localMatrix(transform)\n );\n }\n);\n\nexport const Shader = (props: AnimatedProps<ShaderProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nShader.defaultProps = {\n uniforms: [],\n};\n"]}
@@ -2,7 +2,8 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import React from "react";
4
4
  import { createDrawing } from "../../nodes";
5
- import { processPath } from "../../processors";
5
+ import { processPath, enumKey } from "../../processors";
6
+ import { FillType } from "../../../skia";
6
7
  const onDraw = createDrawing((_ref, _ref2) => {
7
8
  let {
8
9
  canvas,
@@ -12,15 +13,21 @@ const onDraw = createDrawing((_ref, _ref2) => {
12
13
  start,
13
14
  end,
14
15
  stroke,
16
+ fillType,
15
17
  ...pathProps
16
18
  } = _ref2;
17
19
  const hasStartOffset = start !== 0;
18
20
  const hasEndOffset = end !== 1;
19
21
  const hasStrokeOptions = stroke !== undefined;
20
- const willMutatePath = hasStartOffset || hasEndOffset || hasStrokeOptions;
22
+ const hasFillType = !!fillType;
23
+ const willMutatePath = hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;
21
24
  const pristinePath = processPath(pathProps.path);
22
25
  const path = willMutatePath ? pristinePath.copy() : pristinePath;
23
26
 
27
+ if (hasFillType) {
28
+ path.setFillType(FillType[enumKey(fillType)]);
29
+ }
30
+
24
31
  if (hasStrokeOptions) {
25
32
  path.stroke(stroke);
26
33
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["Path.tsx"],"names":["React","createDrawing","processPath","onDraw","canvas","paint","start","end","stroke","pathProps","hasStartOffset","hasEndOffset","hasStrokeOptions","undefined","willMutatePath","pristinePath","path","copy","trim","drawPath","Path","props","defaultProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAOA,SAASC,aAAT,QAA8B,aAA9B;AACA,SAASC,WAAT,QAA4B,kBAA5B;AAeA,MAAMC,MAAM,GAAGF,aAAa,CAC1B,iBAA6D;AAAA,MAA5D;AAAEG,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA4D;AAAA,MAAzC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,GAAT;AAAcC,IAAAA,MAAd;AAAsB,OAAGC;AAAzB,GAAyC;AAC3D,QAAMC,cAAc,GAAGJ,KAAK,KAAK,CAAjC;AACA,QAAMK,YAAY,GAAGJ,GAAG,KAAK,CAA7B;AACA,QAAMK,gBAAgB,GAAGJ,MAAM,KAAKK,SAApC;AACA,QAAMC,cAAc,GAAGJ,cAAc,IAAIC,YAAlB,IAAkCC,gBAAzD;AACA,QAAMG,YAAY,GAAGb,WAAW,CAACO,SAAS,CAACO,IAAX,CAAhC;AACA,QAAMA,IAAI,GAAGF,cAAc,GAAGC,YAAY,CAACE,IAAb,EAAH,GAAyBF,YAApD;;AACA,MAAIH,gBAAJ,EAAsB;AACpBI,IAAAA,IAAI,CAACR,MAAL,CAAYA,MAAZ;AACD;;AACD,MAAIE,cAAc,IAAIC,YAAtB,EAAoC;AAClCK,IAAAA,IAAI,CAACE,IAAL,CAAUZ,KAAV,EAAiBC,GAAjB,EAAsB,KAAtB;AACD;;AACDH,EAAAA,MAAM,CAACe,QAAP,CAAgBH,IAAhB,EAAsBX,KAAtB;AACD,CAfyB,CAA5B;AAkBA,OAAO,MAAMe,IAAI,GAAIC,KAAD,IAAqC;AACvD,sBAAO;AAAW,IAAA,MAAM,EAAElB;AAAnB,KAA+BkB,KAA/B,EAAP;AACD,CAFM;AAIPD,IAAI,CAACE,YAAL,GAAoB;AAClBhB,EAAAA,KAAK,EAAE,CADW;AAElBC,EAAAA,GAAG,EAAE;AAFa,CAApB","sourcesContent":["import React from \"react\";\n\nimport type {\n CustomPaintProps,\n AnimatedProps,\n PathDef,\n} from \"../../processors\";\nimport { createDrawing } from \"../../nodes\";\nimport { processPath } from \"../../processors\";\n\ninterface StrokeOpts {\n width?: number;\n strokeMiterlimit?: number;\n precision?: number;\n}\n\nexport interface PathProps extends CustomPaintProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n}\n\nconst onDraw = createDrawing<PathProps>(\n ({ canvas, paint }, { start, end, stroke, ...pathProps }) => {\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const willMutatePath = hasStartOffset || hasEndOffset || hasStrokeOptions;\n const pristinePath = processPath(pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n canvas.drawPath(path, paint);\n }\n);\n\nexport const Path = (props: AnimatedProps<PathProps>) => {\n return <skDrawing onDraw={onDraw} {...props} />;\n};\n\nPath.defaultProps = {\n start: 0,\n end: 1,\n};\n"]}
1
+ {"version":3,"sources":["Path.tsx"],"names":["React","createDrawing","processPath","enumKey","FillType","onDraw","canvas","paint","start","end","stroke","fillType","pathProps","hasStartOffset","hasEndOffset","hasStrokeOptions","undefined","hasFillType","willMutatePath","pristinePath","path","copy","setFillType","trim","drawPath","Path","props","defaultProps"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAQA,SAASC,aAAT,QAA8B,aAA9B;AACA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,kBAArC;AACA,SAASC,QAAT,QAAyB,eAAzB;AAgBA,MAAMC,MAAM,GAAGJ,aAAa,CAC1B,iBAAuE;AAAA,MAAtE;AAAEK,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAsE;AAAA,MAAnD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,GAAT;AAAcC,IAAAA,MAAd;AAAsBC,IAAAA,QAAtB;AAAgC,OAAGC;AAAnC,GAAmD;AACrE,QAAMC,cAAc,GAAGL,KAAK,KAAK,CAAjC;AACA,QAAMM,YAAY,GAAGL,GAAG,KAAK,CAA7B;AACA,QAAMM,gBAAgB,GAAGL,MAAM,KAAKM,SAApC;AACA,QAAMC,WAAW,GAAG,CAAC,CAACN,QAAtB;AACA,QAAMO,cAAc,GAClBL,cAAc,IAAIC,YAAlB,IAAkCC,gBAAlC,IAAsDE,WADxD;AAEA,QAAME,YAAY,GAAGjB,WAAW,CAACU,SAAS,CAACQ,IAAX,CAAhC;AACA,QAAMA,IAAI,GAAGF,cAAc,GAAGC,YAAY,CAACE,IAAb,EAAH,GAAyBF,YAApD;;AACA,MAAIF,WAAJ,EAAiB;AACfG,IAAAA,IAAI,CAACE,WAAL,CAAiBlB,QAAQ,CAACD,OAAO,CAACQ,QAAD,CAAR,CAAzB;AACD;;AACD,MAAII,gBAAJ,EAAsB;AACpBK,IAAAA,IAAI,CAACV,MAAL,CAAYA,MAAZ;AACD;;AACD,MAAIG,cAAc,IAAIC,YAAtB,EAAoC;AAClCM,IAAAA,IAAI,CAACG,IAAL,CAAUf,KAAV,EAAiBC,GAAjB,EAAsB,KAAtB;AACD;;AACDH,EAAAA,MAAM,CAACkB,QAAP,CAAgBJ,IAAhB,EAAsBb,KAAtB;AACD,CApByB,CAA5B;AAuBA,OAAO,MAAMkB,IAAI,GAAIC,KAAD,IAAqC;AACvD,sBAAO;AAAW,IAAA,MAAM,EAAErB;AAAnB,KAA+BqB,KAA/B,EAAP;AACD,CAFM;AAIPD,IAAI,CAACE,YAAL,GAAoB;AAClBnB,EAAAA,KAAK,EAAE,CADW;AAElBC,EAAAA,GAAG,EAAE;AAFa,CAApB","sourcesContent":["import React from \"react\";\n\nimport type {\n CustomPaintProps,\n AnimatedProps,\n PathDef,\n SkEnum,\n} from \"../../processors\";\nimport { createDrawing } from \"../../nodes\";\nimport { processPath, enumKey } from \"../../processors\";\nimport { FillType } from \"../../../skia\";\n\ninterface StrokeOpts {\n width?: number;\n strokeMiterlimit?: number;\n precision?: number;\n}\n\nexport interface PathProps extends CustomPaintProps {\n path: PathDef;\n start: number;\n end: number;\n stroke?: StrokeOpts;\n fillType?: SkEnum<typeof FillType>;\n}\n\nconst onDraw = createDrawing<PathProps>(\n ({ canvas, paint }, { start, end, stroke, fillType, ...pathProps }) => {\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n canvas.drawPath(path, paint);\n }\n);\n\nexport const Path = (props: AnimatedProps<PathProps>) => {\n return <skDrawing onDraw={onDraw} {...props} />;\n};\n\nPath.defaultProps = {\n start: 0,\n end: 1,\n};\n"]}
@@ -1,7 +1,8 @@
1
1
  import { vec } from "./math/Vector";
2
2
 
3
- const isCircleScalarDef = def => // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- def.cx;
3
+ const isCircleScalarDef = def => // We have an issue to check property existence on JSI backed instances
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+ def.cx !== undefined;
5
6
 
6
7
  export const processCircle = def => {
7
8
  if (isCircleScalarDef(def)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["Circles.ts"],"names":["vec","isCircleScalarDef","def","cx","processCircle","c","cy","r"],"mappings":"AACA,SAASA,GAAT,QAAoB,eAApB;;AAeA,MAAMC,iBAAiB,GAAIC,GAAD,IACxB;AACCA,GAAD,CAAaC,EAFf;;AAGA,OAAO,MAAMC,aAAa,GAAIF,GAAD,IAAoB;AAC/C,MAAID,iBAAiB,CAACC,GAAD,CAArB,EAA4B;AAC1B,WAAO;AAAEG,MAAAA,CAAC,EAAEL,GAAG,CAACE,GAAG,CAACC,EAAL,EAASD,GAAG,CAACI,EAAb,CAAR;AAA0BC,MAAAA,CAAC,EAAEL,GAAG,CAACK;AAAjC,KAAP;AACD;;AACD,SAAOL,GAAP;AACD,CALM","sourcesContent":["import type { Vector } from \"./math/Vector\";\nimport { vec } from \"./math/Vector\";\n\ninterface PointCircleDef {\n c: Vector;\n r: number;\n}\n\ninterface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nconst isCircleScalarDef = (def: CircleDef): def is ScalarCircleDef =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (def as any).cx;\nexport const processCircle = (def: CircleDef) => {\n if (isCircleScalarDef(def)) {\n return { c: vec(def.cx, def.cy), r: def.r };\n }\n return def;\n};\n"]}
1
+ {"version":3,"sources":["Circles.ts"],"names":["vec","isCircleScalarDef","def","cx","undefined","processCircle","c","cy","r"],"mappings":"AACA,SAASA,GAAT,QAAoB,eAApB;;AAeA,MAAMC,iBAAiB,GAAIC,GAAD,IACxB;AACA;AACCA,GAAD,CAAaC,EAAb,KAAoBC,SAHtB;;AAIA,OAAO,MAAMC,aAAa,GAAIH,GAAD,IAAoB;AAC/C,MAAID,iBAAiB,CAACC,GAAD,CAArB,EAA4B;AAC1B,WAAO;AAAEI,MAAAA,CAAC,EAAEN,GAAG,CAACE,GAAG,CAACC,EAAL,EAASD,GAAG,CAACK,EAAb,CAAR;AAA0BC,MAAAA,CAAC,EAAEN,GAAG,CAACM;AAAjC,KAAP;AACD;;AACD,SAAON,GAAP;AACD,CALM","sourcesContent":["import type { Vector } from \"./math/Vector\";\nimport { vec } from \"./math/Vector\";\n\ninterface PointCircleDef {\n c: Vector;\n r: number;\n}\n\ninterface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nconst isCircleScalarDef = (def: CircleDef): def is ScalarCircleDef =>\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (def as any).cx !== undefined;\nexport const processCircle = (def: CircleDef) => {\n if (isCircleScalarDef(def)) {\n return { c: vec(def.cx, def.cy), r: def.r };\n }\n return def;\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Skia } from "../../skia/Skia";
2
- export const isFont = fontDef => // We use any here for safety (JSI instances don't have hasProperty working properly);
2
+ export const isFont = fontDef => // We have an issue to check property existence on JSI backed instances
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  fontDef.font !== undefined;
5
5
  export const processFont = (fontMgr, fontDef) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["Font.ts"],"names":["Skia","isFont","fontDef","font","undefined","processFont","fontMgr","selectedFont","familyName","size","typeface","matchFamilyStyle","Error","Font"],"mappings":"AACA,SAASA,IAAT,QAAqB,iBAArB;AAKA,OAAO,MAAMC,MAAM,GAAIC,OAAD,IACpB;AACA;AACCA,OAAD,CAAiBC,IAAjB,KAA0BC,SAHrB;AAKP,OAAO,MAAMC,WAAW,GAAG,CAACC,OAAD,EAAmBJ,OAAnB,KAAwC;AACjE,MAAIK,YAAJ;;AACA,MAAIN,MAAM,CAACC,OAAD,CAAV,EAAqB;AACnBK,IAAAA,YAAY,GAAGL,OAAO,CAACC,IAAvB;AACD,GAFD,MAEO;AACL,UAAM;AAAEK,MAAAA,UAAF;AAAcC,MAAAA;AAAd,QAAuBP,OAA7B;AACA,UAAMQ,QAAQ,GAAGJ,OAAO,CAACK,gBAAR,CAAyBH,UAAzB,CAAjB;;AACA,QAAIE,QAAQ,KAAK,IAAjB,EAAuB;AACrB,YAAM,IAAIE,KAAJ,CAAW,yBAAwBJ,UAAW,EAA9C,CAAN;AACD;;AACDD,IAAAA,YAAY,GAAGP,IAAI,CAACa,IAAL,CAAUH,QAAV,EAAoBD,IAApB,CAAf;AACD;;AACD,SAAOF,YAAP;AACD,CAbM","sourcesContent":["import type { SkFont } from \"../../skia\";\nimport { Skia } from \"../../skia/Skia\";\nimport type { FontMgr } from \"../../skia/FontMgr/FontMgr\";\n\nexport type FontDef = { font: SkFont } | { familyName: string; size: number };\n\nexport const isFont = (fontDef: FontDef): fontDef is { font: SkFont } =>\n // We use any here for safety (JSI instances don't have hasProperty working properly);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (fontDef as any).font !== undefined;\n\nexport const processFont = (fontMgr: FontMgr, fontDef: FontDef) => {\n let selectedFont: SkFont;\n if (isFont(fontDef)) {\n selectedFont = fontDef.font;\n } else {\n const { familyName, size } = fontDef;\n const typeface = fontMgr.matchFamilyStyle(familyName);\n if (typeface === null) {\n throw new Error(`No typeface found for ${familyName}`);\n }\n selectedFont = Skia.Font(typeface, size);\n }\n return selectedFont;\n};\n"]}
1
+ {"version":3,"sources":["Font.ts"],"names":["Skia","isFont","fontDef","font","undefined","processFont","fontMgr","selectedFont","familyName","size","typeface","matchFamilyStyle","Error","Font"],"mappings":"AACA,SAASA,IAAT,QAAqB,iBAArB;AAKA,OAAO,MAAMC,MAAM,GAAIC,OAAD,IACpB;AACA;AACCA,OAAD,CAAiBC,IAAjB,KAA0BC,SAHrB;AAKP,OAAO,MAAMC,WAAW,GAAG,CAACC,OAAD,EAAmBJ,OAAnB,KAAwC;AACjE,MAAIK,YAAJ;;AACA,MAAIN,MAAM,CAACC,OAAD,CAAV,EAAqB;AACnBK,IAAAA,YAAY,GAAGL,OAAO,CAACC,IAAvB;AACD,GAFD,MAEO;AACL,UAAM;AAAEK,MAAAA,UAAF;AAAcC,MAAAA;AAAd,QAAuBP,OAA7B;AACA,UAAMQ,QAAQ,GAAGJ,OAAO,CAACK,gBAAR,CAAyBH,UAAzB,CAAjB;;AACA,QAAIE,QAAQ,KAAK,IAAjB,EAAuB;AACrB,YAAM,IAAIE,KAAJ,CAAW,yBAAwBJ,UAAW,EAA9C,CAAN;AACD;;AACDD,IAAAA,YAAY,GAAGP,IAAI,CAACa,IAAL,CAAUH,QAAV,EAAoBD,IAApB,CAAf;AACD;;AACD,SAAOF,YAAP;AACD,CAbM","sourcesContent":["import type { SkFont } from \"../../skia\";\nimport { Skia } from \"../../skia/Skia\";\nimport type { FontMgr } from \"../../skia/FontMgr/FontMgr\";\n\nexport type FontDef = { font: SkFont } | { familyName: string; size: number };\n\nexport const isFont = (fontDef: FontDef): fontDef is { font: SkFont } =>\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (fontDef as any).font !== undefined;\n\nexport const processFont = (fontMgr: FontMgr, fontDef: FontDef) => {\n let selectedFont: SkFont;\n if (isFont(fontDef)) {\n selectedFont = fontDef.font;\n } else {\n const { familyName, size } = fontDef;\n const typeface = fontMgr.matchFamilyStyle(familyName);\n if (typeface === null) {\n throw new Error(`No typeface found for ${familyName}`);\n }\n selectedFont = Skia.Font(typeface, size);\n }\n return selectedFont;\n};\n"]}
@@ -10,7 +10,8 @@ export const processPaint = (paint, currentOpacity, _ref, children) => {
10
10
  strokeJoin,
11
11
  strokeCap,
12
12
  strokeMiter,
13
- opacity
13
+ opacity,
14
+ antiAlias
14
15
  } = _ref;
15
16
 
16
17
  if (paintRef && paintRef.current) {
@@ -54,6 +55,10 @@ export const processPaint = (paint, currentOpacity, _ref, children) => {
54
55
  paint.setAlphaf(opacity);
55
56
  }
56
57
 
58
+ if (antiAlias !== undefined) {
59
+ paint.setAntiAlias(antiAlias);
60
+ }
61
+
57
62
  children.forEach(child => {
58
63
  if (isShader(child)) {
59
64
  paint.setShader(child);
@@ -1 +1 @@
1
- {"version":3,"sources":["Paint.ts"],"names":["BlendMode","PaintStyle","StrokeJoin","StrokeCap","processColor","isShader","isMaskFilter","isColorFilter","isPathEffect","isImageFilter","Skia","enumKey","k","charAt","toUpperCase","slice","processPaint","paint","currentOpacity","children","paintRef","color","blendMode","style","strokeWidth","strokeJoin","strokeCap","strokeMiter","opacity","current","undefined","c","setShader","setColor","getColor","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setStrokeWidth","setAlphaf","forEach","child","setMaskFilter","setColorFilter","setPathEffect","filters","filter","length","setImageFilter","reverse","reduce","ImageFilter","MakeCompose"],"mappings":"AAEA,SACEA,SADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,SAJF,EAKEC,YALF,EAMEC,QANF,EAOEC,YAPF,EAQEC,aARF,EASEC,YATF,EAUEC,aAVF,EAWEC,IAXF,QAYO,YAZP;AAkCA,OAAO,MAAMC,OAAO,GAAsBC,CAAnB,I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":["import type { ReactNode, RefObject } from \"react\";\n\nimport {\n BlendMode,\n PaintStyle,\n StrokeJoin,\n StrokeCap,\n processColor,\n isShader,\n isMaskFilter,\n isColorFilter,\n isPathEffect,\n isImageFilter,\n Skia,\n} from \"../../skia\";\nimport type { SkPaint, Color, SkImageFilter } from \"../../skia\";\nimport type { DeclarationResult } from \"../nodes\";\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\n// TODO: rename to paint props?\nexport interface CustomPaintProps extends ChildrenProps {\n paint?: RefObject<SkPaint>;\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n}\n\nexport const enumKey = <K extends string>(k: K) =>\n (k.charAt(0).toUpperCase() + k.slice(1)) as Capitalize<K>;\n\nexport const processPaint = (\n paint: SkPaint,\n currentOpacity: number,\n {\n paint: paintRef,\n color,\n blendMode,\n style,\n strokeWidth,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n }: CustomPaintProps,\n children: DeclarationResult[]\n) => {\n if (paintRef && paintRef.current) {\n return paintRef.current;\n }\n if (color !== undefined) {\n const c = processColor(color, currentOpacity);\n paint.setShader(null);\n paint.setColor(c);\n } else {\n const c = processColor(paint.getColor(), currentOpacity);\n paint.setColor(c);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n children.forEach((child) => {\n if (isShader(child)) {\n paint.setShader(child);\n } else if (isMaskFilter(child)) {\n paint.setMaskFilter(child);\n } else if (isColorFilter(child)) {\n paint.setColorFilter(child);\n } else if (isPathEffect(child)) {\n paint.setPathEffect(child);\n }\n });\n const filters = children.filter(isImageFilter);\n if (filters.length > 0) {\n paint.setImageFilter(\n filters\n .reverse()\n .reduce<SkImageFilter | null>(Skia.ImageFilter.MakeCompose, null)\n );\n }\n return paint;\n};\n"]}
1
+ {"version":3,"sources":["Paint.ts"],"names":["BlendMode","PaintStyle","StrokeJoin","StrokeCap","processColor","isShader","isMaskFilter","isColorFilter","isPathEffect","isImageFilter","Skia","enumKey","k","charAt","toUpperCase","slice","processPaint","paint","currentOpacity","children","paintRef","color","blendMode","style","strokeWidth","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","current","undefined","c","setShader","setColor","getColor","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setStrokeWidth","setAlphaf","setAntiAlias","forEach","child","setMaskFilter","setColorFilter","setPathEffect","filters","filter","length","setImageFilter","reverse","reduce","ImageFilter","MakeCompose"],"mappings":"AAEA,SACEA,SADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,SAJF,EAKEC,YALF,EAMEC,QANF,EAOEC,YAPF,EAQEC,aARF,EASEC,YATF,EAUEC,aAVF,EAWEC,IAXF,QAYO,YAZP;AAmCA,OAAO,MAAMC,OAAO,GAAsBC,CAAnB,IACpBA,CAAC,CAACC,MAAF,CAAS,CAAT,EAAYC,WAAZ,KAA4BF,CAAC,CAACG,KAAF,CAAQ,CAAR,CADxB;AAGP,OAAO,MAAMC,YAAY,GAAG,CAC1BC,KAD0B,EAE1BC,cAF0B,QAe1BC,QAf0B,KAgBvB;AAAA,MAbH;AACEF,IAAAA,KAAK,EAAEG,QADT;AAEEC,IA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AN,CAAqBb,WAArB;AACD;;AACD,MAAIH,WAAW,KAAKO,SAApB,EAA+B;AAC7Bd,IAAAA,KAAK,CAACwB,cAAN,CAAqBjB,WAArB;AACD;;AACD,MAAII,OAAO,KAAKG,SAAhB,EAA2B;AACzBd,IAAAA,KAAK,CAACyB,SAAN,CAAgBd,OAAhB;AACD;;AACD,MAAIC,SAAS,KAAKE,SAAlB,EAA6B;AAC3Bd,IAAAA,KAAK,CAAC0B,YAAN,CAAmBd,SAAnB;AACD;;AACDV,EAAAA,QAAQ,CAACyB,OAAT,CAAkBC,KAAD,IAAW;AAC1B,QAAIxC,QAAQ,CAACwC,KAAD,CAAZ,EAAqB;AACnB5B,MAAAA,KAAK,CAACgB,SAAN,CAAgBY,KAAhB;AACD,KAFD,MAEO,IAAIvC,YAAY,CAACuC,KAAD,CAAhB,EAAyB;AAC9B5B,MAAAA,KAAK,CAAC6B,aAAN,CAAoBD,KAApB;AACD,KAFM,MAEA,IAAItC,aAAa,CAACsC,KAAD,CAAjB,EAA0B;AAC/B5B,MAAAA,KAAK,CAAC8B,cAAN,CAAqBF,KAArB;AACD,KAFM,MAEA,IAAIrC,YAAY,CAACqC,KAAD,CAAhB,EAAyB;AAC9B5B,MAAAA,KAAK,CAAC+B,aAAN,CAAoBH,KAApB;AACD;AACF,GAVD;AAWA,QAAMI,OAAO,GAAG9B,QAAQ,CAAC+B,MAAT,CAAgBzC,aAAhB,CAAhB;;AACA,MAAIwC,OAAO,CAACE,MAAR,GAAiB,CAArB,EAAwB;AACtBlC,IAAAA,KAAK,CAACmC,cAAN,CACEH,OAAO,CACJI,OADH,GAEGC,MAFH,CAEgC5C,IAAI,CAAC6C,WAAL,CAAiBC,WAFjD,EAE8D,IAF9D,CADF;AAKD;;AACD,SAAOvC,KAAP;AACD,CAxEM","sourcesContent":["import type { ReactNode, RefObject } from \"react\";\n\nimport {\n BlendMode,\n PaintStyle,\n StrokeJoin,\n StrokeCap,\n processColor,\n isShader,\n isMaskFilter,\n isColorFilter,\n isPathEffect,\n isImageFilter,\n Skia,\n} from \"../../skia\";\nimport type { SkPaint, Color, SkImageFilter } from \"../../skia\";\nimport type { DeclarationResult } from \"../nodes\";\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\n// TODO: rename to paint props?\nexport interface CustomPaintProps extends ChildrenProps {\n paint?: RefObject<SkPaint>;\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n}\n\nexport const enumKey = <K extends string>(k: K) =>\n (k.charAt(0).toUpperCase() + k.slice(1)) as Capitalize<K>;\n\nexport const processPaint = (\n paint: SkPaint,\n currentOpacity: number,\n {\n paint: paintRef,\n color,\n blendMode,\n style,\n strokeWidth,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n }: CustomPaintProps,\n children: DeclarationResult[]\n) => {\n if (paintRef && paintRef.current) {\n return paintRef.current;\n }\n if (color !== undefined) {\n const c = processColor(color, currentOpacity);\n paint.setShader(null);\n paint.setColor(c);\n } else {\n const c = processColor(paint.getColor(), currentOpacity);\n paint.setColor(c);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n children.forEach((child) => {\n if (isShader(child)) {\n paint.setShader(child);\n } else if (isMaskFilter(child)) {\n paint.setMaskFilter(child);\n } else if (isColorFilter(child)) {\n paint.setColorFilter(child);\n } else if (isPathEffect(child)) {\n paint.setPathEffect(child);\n }\n });\n const filters = children.filter(isImageFilter);\n if (filters.length > 0) {\n paint.setImageFilter(\n filters\n .reverse()\n .reduce<SkImageFilter | null>(Skia.ImageFilter.MakeCompose, null)\n );\n }\n return paint;\n};\n"]}
@@ -1,24 +1,10 @@
1
- // Here we use any because hasOwnProperty doesn't work on JSI instances not does the (key in obj) syntax
2
- // And using Object.keys for such use-case is incredibly slow
3
-
4
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { Skia } from "../../skia";
5
3
  import { vec } from "./math/Vector";
6
4
  import { processRadius } from "./Radius";
7
- export const point = (x, y) => ({
8
- x,
9
- y
10
- });
11
- export const rect = (x, y, width, height) => ({
12
- x,
13
- y,
14
- width,
15
- height
16
- });
17
- export const rrect = (r, rx, ry) => ({
18
- rect: r,
19
- rx,
20
- ry
21
- });
5
+ export const point = (x, y) => Skia.Point(x, y);
6
+ export const rect = (x, y, width, height) => Skia.XYWHRect(x, y, width, height);
7
+ export const rrect = (r, rx, ry) => Skia.RRectXY(r, rx, ry);
22
8
  export const bounds = rects => {
23
9
  const x = Math.min(...rects.map(r => r.x));
24
10
  const y = Math.min(...rects.map(r => r.y));
@@ -30,11 +16,13 @@ export const topLeft = r => isRRect(r) ? vec(r.rect.x, r.rect.y) : vec(r.x, r.y)
30
16
  export const topRight = r => isRRect(r) ? vec(r.rect.x + r.rect.width, r.rect.y) : vec(r.x + r.width, r.y);
31
17
  export const bottomLeft = r => isRRect(r) ? vec(r.rect.x, r.rect.y + r.rect.height) : vec(r.x, r.y + r.height);
32
18
  export const bottomRight = r => isRRect(r) ? vec(r.rect.x + r.rect.width, r.rect.y + r.rect.height) : vec(r.x + r.width, r.y + r.height);
33
- export const center = r => isRRect(r) ? vec(r.rect.x + r.rect.width / 2, r.rect.y + r.rect.height / 2) : vec(r.x + r.width / 2, r.y + r.height / 2);
19
+ export const center = r => isRRect(r) ? vec(r.rect.x + r.rect.width / 2, r.rect.y + r.rect.height / 2) : vec(r.x + r.width / 2, r.y + r.height / 2); // We have an issue to check property existence on JSI backed instances
20
+
21
+ const isRRectCtor = def => def.rect === undefined; // We have an issue to check property existence on JSI backed instances
22
+
34
23
 
35
- const isRRectCtor = def => def.rect === undefined;
24
+ const isRectCtor = def => def.rect === undefined; // We have an issue to check property existence on JSI backed instances
36
25
 
37
- const isRectCtor = def => def.rect === undefined;
38
26
 
39
27
  export const isRRect = def => def.rect !== undefined;
40
28
  export const processRect = def => {
@@ -1 +1 @@
1
- {"version":3,"sources":["Rects.ts"],"names":["vec","processRadius","point","x","y","rect","width","height","rrect","r","rx","ry","bounds","rects","Math","min","map","max","topLeft","isRRect","topRight","bottomLeft","bottomRight","center","isRRectCtor","def","undefined","isRectCtor","processRect","processRRect"],"mappings":"AAAA;AACA;;AACA;AAGA,SAASA,GAAT,QAAoB,eAApB;AAEA,SAASC,aAAT,QAA8B,UAA9B;AAEA,OAAO,MAAMC,KAAK,GAAG,CAACC,CAAD,EAAYC,CAAZ,MAA2B;AAAED,EAAAA,CAAF;AAAKC,EAAAA;AAAL,CAA3B,CAAd;AAEP,OAAO,MAAMC,IAAI,GAAG,CAACF,CAAD,EAAYC,CAAZ,EAAuBE,KAAvB,EAAsCC,MAAtC,MAA0D;AAC5EJ,EAAAA,CAD4E;AAE5EC,EAAAA,CAF4E;AAG5EE,EAAAA,KAH4E;AAI5EC,EAAAA;AAJ4E,CAA1D,CAAb;AAOP,OAAO,MAAMC,KAAK,GAAG,CAACC,CAAD,EAAYC,EAAZ,EAAwBC,EAAxB,MAAwC;AAC3DN,EAAAA,IAAI,EAAEI,CADqD;AAE3DC,EAAAA,EAF2D;AAG3DC,EAAAA;AAH2D,CAAxC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,GAAD,CAAapB,IAAb,KAAsBqB,SADxB;;AAEA,OAAO,MAAMP,OAAO,GAAIM,GAAD,IACpBA,GAAD,CAAapB,IAAb,KAAsBqB,SADjB;AAiBP,OAAO,MAAME,WAAW,GAAIH,GAAD,IAAkB;AAC3C,MAAIE,UAAU,CAACF,GAAD,CAAd,EAAqB;AACnB,WAAOpB,IAAI,CAACoB,GAAG,CAACtB,CAAL,EAAQsB,GAAG,CAACrB,CAAZ,EAAeqB,GAAG,CAACnB,KAAnB,EAA0BmB,GAAG,CAAClB,MAA9B,CAAX;AACD,GAFD,MAEO;AACL,WAAOkB,GAAG,CAACpB,IAAX;AACD;AACF,CANM;AAQP,OAAO,MAAMwB,YAAY,GAAIJ,GAAD,IAAmB;AAC7C,MAAID,WAAW,CAACC,GAAD,CAAf,EAAsB;AACpB,UAAMhB,CAAC,GAAGR,aAAa,CAACwB,GAAG,CAAChB,CAAL,CAAvB;AACA,WAAOD,KAAK,CAACH,IAAI,CAACoB,GAAG,CAACtB,CAAL,EAAQsB,GAAG,CAACrB,CAAZ,EAAeqB,GAAG,CAACnB,KAAnB,EAA0BmB,GAAG,CAAClB,MAA9B,CAAL,EAA4CE,CAAC,CAACN,CAA9C,EAAiDM,CAAC,CAACL,CAAnD,CAAZ;AACD,GAHD,MAGO;AACL,WAAOqB,GAAG,CAACpB,IAAX;AACD;AACF,CAPM","sourcesContent":["// Here we use any because hasOwnProperty doesn't work on JSI instances not does the (key in obj) syntax\n// And using Object.keys for such use-case is incredibly slow\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { SkRect, SkRRect } from \"../../skia\";\n\nimport { vec } from \"./math/Vector\";\nimport type { Radius } from \"./Radius\";\nimport { processRadius } from \"./Radius\";\n\nexport const point = (x: number, y: number) => ({ x, y });\n\nexport const rect = (x: number, y: number, width: number, height: number) => ({\n x,\n y,\n width,\n height,\n});\n\nexport const rrect = (r: SkRect, rx: number, ry: number) => ({\n rect: r,\n rx,\n ry,\n});\n\nexport const bounds = (rects: SkRect[]) => {\n const x = Math.min(...rects.map((r) => r.x));\n const y = Math.min(...rects.map((r) => r.y));\n const width = Math.max(...rects.map((r) => r.x + r.width));\n const height = Math.max(...rects.map((r) => r.y + r.height));\n return rect(x, y, width, height);\n};\n\nexport const topLeft = (r: SkRect | SkRRect) =>\n isRRect(r) ? vec(r.rect.x, r.rect.y) : vec(r.x, r.y);\nexport const topRight = (r: SkRect | SkRRect) =>\n isRRect(r) ? vec(r.rect.x + r.rect.width, r.rect.y) : vec(r.x + r.width, r.y);\nexport const bottomLeft = (r: SkRect | SkRRect) =>\n isRRect(r)\n ? vec(r.rect.x, r.rect.y + r.rect.height)\n : vec(r.x, r.y + r.height);\nexport const bottomRight = (r: SkRect | SkRRect) =>\n isRRect(r)\n ? vec(r.rect.x + r.rect.width, r.rect.y + r.rect.height)\n : vec(r.x + r.width, r.y + r.height);\nexport const center = (r: SkRect | SkRRect) =>\n isRRect(r)\n ? vec(r.rect.x + r.rect.width / 2, r.rect.y + r.rect.height / 2)\n : vec(r.x + r.width / 2, r.y + r.height / 2);\n\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\nexport const isRRect = (def: SkRect | SkRRect): def is SkRRect =>\n (def as any).rect !== undefined;\n\nexport interface RectCtor {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: SkRRect };\n\nexport const processRect = (def: RectDef) => {\n if (isRectCtor(def)) {\n return rect(def.x, def.y, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(def.r);\n return rrect(rect(def.x, def.y, def.width, def.height), r.x, r.y);\n } else {\n return def.rect;\n }\n};\n"]}
1
+ {"version":3,"sources":["Rects.ts"],"names":["Skia","vec","processRadius","point","x","y","Point","rect","width","height","XYWHRect","rrect","r","rx","ry","RRectXY","bounds","rects","Math","min","map","max","topLeft","isRRect","topRight","bottomLeft","bottomRight","center","isRRectCtor","def","undefined","isRectCtor","processRect","processRRect"],"mappings":"AAAA;AAEA,SAASA,IAAT,QAAqB,YAArB;AAEA,SAASC,GAAT,QAAoB,eAApB;AAEA,SAASC,aAAT,QAA8B,UAA9B;AAEA,OAAO,MAAMC,KAAK,GAAG,CAACC,CAAD,EAAYC,CAAZ,KAA0BL,IAAI,CAACM,KAAL,CAAWF,CAAX,EAAcC,CAAd,CAAxC;AAEP,OAAO,MAAME,IAAI,GAAG,CAACH,CAAD,EAAYC,CAAZ,EAAuBG,KAAvB,EAAsCC,MAAtC,KAClBT,IAAI,CAACU,QAAL,CAAcN,CAAd,EAAiBC,CAAjB,EAAoBG,KAApB,EAA2BC,MAA3B,CADK;AAGP,OAAO,MAAME,KAAK,GAAG,CAACC,CAAD,EAAYC,EAAZ,EAAwBC,EAAxB,KACnBd,IAAI,CAACe,OAAL,CAAaH,CAAb,EAAgBC,EAAhB,EAAoBC,EAApB,CADK;AAGP,OAAO,MAAME,MAAM,GAAIC,KAAD,IAAqB;AACzC,QAAMb,CAAC,GAAGc,IAAI,CAACC,GAAL,CAAS,GAAGF,KAAK,CAACG,GAAN,CAAWR,CAAD,IAAOA,CAAC,CAACR,CAAnB,CAAZ,CAAV;AACA,QAAMC,CAAC,GAAGa,IAAI,CAACC,GAAL,CAAS,GAAGF,KAAK,CAACG,GAAN,CAAWR,CAAD,IAAOA,CAAC,CAACP,CAAnB,CAAZ,CAAV;AACA,QAAMG,KAAK,GAAGU,IAAI,CAACG,GAAL,CAAS,GAAGJ,KAAK,CAACG,GAAN,CAAWR,CAAD,IAAOA,CAAC,CAACR,CAAF,GAAMQ,CAAC,CAACJ,KAAzB,CAAZ,CAAd;AACA,QAAMC,MAAM,GAAGS,IAAI,CAACG,GAAL,CAAS,GAAGJ,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AAsB;AACpB,UAAMjB,CAAC,GAAGV,aAAa,CAAC2B,GAAG,CAACjB,CAAL,CAAvB;AACA,WAAOD,KAAK,CAACJ,IAAI,CAACsB,GAAG,CAACzB,CAAL,EAAQyB,GAAG,CAACxB,CAAZ,EAAewB,GAAG,CAACrB,KAAnB,EAA0BqB,GAAG,CAACpB,MAA9B,CAAL,EAA4CG,CAAC,CAACR,CAA9C,EAAiDQ,CAAC,CAACP,CAAnD,CAAZ;AACD,GAHD,MAGO;AACL,WAAOwB,GAAG,CAACtB,IAAX;AACD;AACF,CAPM","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { SkRect, SkRRect } from \"../../skia\";\nimport { Skia } from \"../../skia\";\n\nimport { vec } from \"./math/Vector\";\nimport type { Radius } from \"./Radius\";\nimport { processRadius } from \"./Radius\";\n\nexport const point = (x: number, y: number) => Skia.Point(x, y);\n\nexport const rect = (x: number, y: number, width: number, height: number) =>\n Skia.XYWHRect(x, y, width, height);\n\nexport const rrect = (r: SkRect, rx: number, ry: number) =>\n Skia.RRectXY(r, rx, ry);\n\nexport const bounds = (rects: SkRect[]) => {\n const x = Math.min(...rects.map((r) => r.x));\n const y = Math.min(...rects.map((r) => r.y));\n const width = Math.max(...rects.map((r) => r.x + r.width));\n const height = Math.max(...rects.map((r) => r.y + r.height));\n return rect(x, y, width, height);\n};\n\nexport const topLeft = (r: SkRect | SkRRect) =>\n isRRect(r) ? vec(r.rect.x, r.rect.y) : vec(r.x, r.y);\nexport const topRight = (r: SkRect | SkRRect) =>\n isRRect(r) ? vec(r.rect.x + r.rect.width, r.rect.y) : vec(r.x + r.width, r.y);\nexport const bottomLeft = (r: SkRect | SkRRect) =>\n isRRect(r)\n ? vec(r.rect.x, r.rect.y + r.rect.height)\n : vec(r.x, r.y + r.height);\nexport const bottomRight = (r: SkRect | SkRRect) =>\n isRRect(r)\n ? vec(r.rect.x + r.rect.width, r.rect.y + r.rect.height)\n : vec(r.x + r.width, r.y + r.height);\nexport const center = (r: SkRect | SkRRect) =>\n isRRect(r)\n ? vec(r.rect.x + r.rect.width / 2, r.rect.y + r.rect.height / 2)\n : vec(r.x + r.width / 2, r.y + r.height / 2);\n\n// We have an issue to check property existence on JSI backed instances\nconst isRRectCtor = (def: RRectDef): def is RRectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nconst isRectCtor = (def: RectDef): def is RectCtor =>\n (def as any).rect === undefined;\n// We have an issue to check property existence on JSI backed instances\nexport const isRRect = (def: SkRect | SkRRect): def is SkRRect =>\n (def as any).rect !== undefined;\n\nexport interface RectCtor {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: SkRRect };\n\nexport const processRect = (def: RectDef) => {\n if (isRectCtor(def)) {\n return rect(def.x, def.y, def.width, def.height);\n } else {\n return def.rect;\n }\n};\n\nexport const processRRect = (def: RRectDef) => {\n if (isRRectCtor(def)) {\n const r = processRadius(def.r);\n return rrect(rect(def.x, def.y, def.width, def.height), r.x, r.y);\n } else {\n return def.rect;\n }\n};\n"]}