@shopify/react-native-skia 0.1.124 → 0.1.127

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. package/android/CMakeLists.txt +3 -0
  2. package/android/build.gradle +1 -1
  3. package/cpp/api/JsiSkApi.h +3 -1
  4. package/cpp/api/JsiSkCanvas.h +1 -1
  5. package/cpp/api/JsiSkColor.h +41 -7
  6. package/cpp/api/JsiSkColorFilterFactory.h +2 -1
  7. package/cpp/api/JsiSkImageFilter.h +0 -2
  8. package/cpp/api/JsiSkImageFilterFactory.h +37 -17
  9. package/cpp/api/JsiSkMatrix.h +44 -2
  10. package/cpp/api/JsiSkPaint.h +4 -7
  11. package/cpp/api/JsiSkRuntimeEffect.h +7 -0
  12. package/cpp/api/JsiSkRuntimeEffectFactory.h +3 -2
  13. package/cpp/api/JsiSkRuntimeShaderBuilder.h +70 -0
  14. package/cpp/api/JsiSkShaderFactory.h +2 -2
  15. package/cpp/api/JsiSkVertices.h +1 -1
  16. package/cpp/api/third_party/CSSColorParser.cpp +194 -0
  17. package/cpp/api/third_party/CSSColorParser.h +1 -191
  18. package/cpp/jsi/JsiSimpleValueWrapper.h +108 -0
  19. package/cpp/rnskia/values/RNSkReadonlyValue.h +13 -12
  20. package/ios/RNSkia-iOS/PlatformContext.h +30 -4
  21. package/ios/RNSkia-iOS/SkiaDrawView.mm +9 -12
  22. package/lib/commonjs/{values/animation → animation}/decay/decay.js +0 -0
  23. package/lib/commonjs/{values/animation → animation}/decay/decay.js.map +0 -0
  24. package/lib/commonjs/{values/animation → animation}/decay/index.js +0 -0
  25. package/lib/commonjs/{values/animation → animation}/decay/index.js.map +0 -0
  26. package/lib/commonjs/{values/animation → animation}/decay/runDecay.js +1 -1
  27. package/lib/commonjs/animation/decay/runDecay.js.map +1 -0
  28. package/lib/commonjs/{values/animation → animation}/decay/types.js +0 -0
  29. package/lib/commonjs/{values/animation → animation}/decay/types.js.map +0 -0
  30. package/lib/commonjs/{values/animation → animation}/functions/index.js +0 -0
  31. package/lib/commonjs/{values/animation → animation}/functions/index.js.map +0 -0
  32. package/lib/commonjs/animation/functions/interpolate.js +141 -0
  33. package/lib/commonjs/animation/functions/interpolate.js.map +1 -0
  34. package/lib/commonjs/animation/functions/interpolateColors.js +39 -0
  35. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -0
  36. package/lib/commonjs/{values/animation → animation}/index.js +0 -0
  37. package/lib/commonjs/{values/animation → animation}/index.js.map +0 -0
  38. package/lib/commonjs/{values/animation → animation}/spring/Spring.js +0 -0
  39. package/lib/commonjs/{values/animation → animation}/spring/Spring.js.map +0 -0
  40. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js +0 -0
  41. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js.map +0 -0
  42. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js +0 -0
  43. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  44. package/lib/commonjs/{values/animation → animation}/spring/index.js +0 -0
  45. package/lib/commonjs/{values/animation → animation}/spring/index.js.map +0 -0
  46. package/lib/commonjs/{values/animation → animation}/spring/runSpring.js +0 -0
  47. package/lib/commonjs/animation/spring/runSpring.js.map +1 -0
  48. package/lib/commonjs/{values/animation → animation}/spring/types.js +0 -0
  49. package/lib/commonjs/{values/animation → animation}/spring/types.js.map +0 -0
  50. package/lib/commonjs/{values/animation → animation}/spring/useSpring.js +0 -0
  51. package/lib/commonjs/animation/spring/useSpring.js.map +1 -0
  52. package/lib/commonjs/{values/animation → animation}/timing/Easing.js +0 -0
  53. package/lib/commonjs/{values/animation → animation}/timing/Easing.js.map +0 -0
  54. package/lib/commonjs/{values/animation → animation}/timing/createTiming.js +1 -1
  55. package/lib/commonjs/animation/timing/createTiming.js.map +1 -0
  56. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js +0 -0
  57. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  58. package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js +0 -0
  59. package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js.map +0 -0
  60. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js +0 -0
  61. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js.map +0 -0
  62. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js +0 -0
  63. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  64. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js +0 -0
  65. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js.map +0 -0
  66. package/lib/commonjs/{values/animation → animation}/timing/index.js +0 -0
  67. package/lib/commonjs/{values/animation → animation}/timing/index.js.map +0 -0
  68. package/lib/commonjs/{values/animation → animation}/timing/runTiming.js +0 -0
  69. package/lib/commonjs/animation/timing/runTiming.js.map +1 -0
  70. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js +0 -0
  71. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js.map +0 -0
  72. package/lib/commonjs/{values/animation → animation}/timing/useTiming.js +1 -1
  73. package/lib/commonjs/animation/timing/useTiming.js.map +1 -0
  74. package/lib/commonjs/{values/animation → animation}/types.js +0 -0
  75. package/lib/commonjs/{values/animation → animation}/types.js.map +0 -0
  76. package/lib/commonjs/index.js +13 -0
  77. package/lib/commonjs/index.js.map +1 -1
  78. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
  79. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +4 -2
  80. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  81. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +37 -0
  82. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  83. package/lib/commonjs/renderer/components/imageFilters/index.js +13 -0
  84. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  85. package/lib/commonjs/renderer/components/shaders/Gradient.js +1 -1
  86. package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
  87. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  88. package/lib/commonjs/renderer/processors/Rects.js +5 -15
  89. package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
  90. package/lib/commonjs/renderer/processors/math/Matrix3.js +42 -63
  91. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  92. package/lib/commonjs/renderer/processors/math/Vector.js +4 -5
  93. package/lib/commonjs/renderer/processors/math/Vector.js.map +1 -1
  94. package/lib/commonjs/skia/Color.js +14 -38
  95. package/lib/commonjs/skia/Color.js.map +1 -1
  96. package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  97. package/lib/commonjs/skia/Matrix.js.map +1 -1
  98. package/lib/commonjs/skia/Shader/useShader.js +4 -1
  99. package/lib/commonjs/skia/Shader/useShader.js.map +1 -1
  100. package/lib/commonjs/skia/Skia.js +3 -45
  101. package/lib/commonjs/skia/Skia.js.map +1 -1
  102. package/lib/commonjs/skia/SkiaApi.js +4 -0
  103. package/lib/commonjs/skia/SkiaApi.js.map +1 -0
  104. package/lib/commonjs/values/api.js +4 -6
  105. package/lib/commonjs/values/api.js.map +1 -1
  106. package/lib/commonjs/values/api.web.js +18 -0
  107. package/lib/commonjs/values/api.web.js.map +1 -0
  108. package/lib/commonjs/values/index.js +0 -13
  109. package/lib/commonjs/values/index.js.map +1 -1
  110. package/lib/commonjs/values/web/RNSkAnimation.js +46 -0
  111. package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -0
  112. package/lib/commonjs/values/web/RNSkClockValue.js +75 -0
  113. package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -0
  114. package/lib/commonjs/values/web/RNSkDerivedValue.js +51 -0
  115. package/lib/commonjs/values/web/RNSkDerivedValue.js.map +1 -0
  116. package/lib/commonjs/values/web/RNSkReadonlyValue.js +45 -0
  117. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -0
  118. package/lib/commonjs/values/web/RNSkValue.js +73 -0
  119. package/lib/commonjs/values/web/RNSkValue.js.map +1 -0
  120. package/lib/commonjs/values/web/api.js +31 -0
  121. package/lib/commonjs/values/web/api.js.map +1 -0
  122. package/lib/commonjs/values/web/index.js +19 -0
  123. package/lib/commonjs/values/web/index.js.map +1 -0
  124. package/lib/commonjs/views/SkiaView.js +13 -10
  125. package/lib/commonjs/views/SkiaView.js.map +1 -1
  126. package/lib/commonjs/views/api.js +11 -0
  127. package/lib/commonjs/views/api.js.map +1 -0
  128. package/lib/commonjs/views/types.js.map +1 -1
  129. package/lib/module/{values/animation → animation}/decay/decay.js +0 -0
  130. package/lib/module/{values/animation → animation}/decay/decay.js.map +0 -0
  131. package/lib/module/{values/animation → animation}/decay/index.js +0 -0
  132. package/lib/module/{values/animation → animation}/decay/index.js.map +0 -0
  133. package/lib/module/{values/animation → animation}/decay/runDecay.js +1 -1
  134. package/lib/module/animation/decay/runDecay.js.map +1 -0
  135. package/lib/module/{values/animation → animation}/decay/types.js +0 -0
  136. package/lib/module/{values/animation → animation}/decay/types.js.map +0 -0
  137. package/lib/module/{values/animation → animation}/functions/index.js +0 -0
  138. package/lib/module/{values/animation → animation}/functions/index.js.map +0 -0
  139. package/lib/module/animation/functions/interpolate.js +132 -0
  140. package/lib/module/animation/functions/interpolate.js.map +1 -0
  141. package/lib/module/animation/functions/interpolateColors.js +23 -0
  142. package/lib/module/animation/functions/interpolateColors.js.map +1 -0
  143. package/lib/module/{values/animation → animation}/index.js +0 -0
  144. package/lib/module/{values/animation → animation}/index.js.map +0 -0
  145. package/lib/module/{values/animation → animation}/spring/Spring.js +0 -0
  146. package/lib/module/{values/animation → animation}/spring/Spring.js.map +0 -0
  147. package/lib/module/{values/animation → animation}/spring/functions/index.js +0 -0
  148. package/lib/module/{values/animation → animation}/spring/functions/index.js.map +0 -0
  149. package/lib/module/{values/animation → animation}/spring/functions/spring.js +0 -0
  150. package/lib/module/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  151. package/lib/module/{values/animation → animation}/spring/index.js +0 -0
  152. package/lib/module/{values/animation → animation}/spring/index.js.map +0 -0
  153. package/lib/module/{values/animation → animation}/spring/runSpring.js +0 -0
  154. package/lib/module/animation/spring/runSpring.js.map +1 -0
  155. package/lib/module/{values/animation → animation}/spring/types.js +0 -0
  156. package/lib/module/{values/animation → animation}/spring/types.js.map +0 -0
  157. package/lib/module/{values/animation → animation}/spring/useSpring.js +0 -0
  158. package/lib/module/animation/spring/useSpring.js.map +1 -0
  159. package/lib/module/{values/animation → animation}/timing/Easing.js +0 -0
  160. package/lib/module/{values/animation → animation}/timing/Easing.js.map +0 -0
  161. package/lib/module/{values/animation → animation}/timing/createTiming.js +1 -1
  162. package/lib/module/animation/timing/createTiming.js.map +1 -0
  163. package/lib/module/{values/animation → animation}/timing/functions/bezier.js +0 -0
  164. package/lib/module/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  165. package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js +0 -0
  166. package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js.map +0 -0
  167. package/lib/module/{values/animation → animation}/timing/functions/index.js +0 -0
  168. package/lib/module/{values/animation → animation}/timing/functions/index.js.map +0 -0
  169. package/lib/module/{values/animation → animation}/timing/functions/timing.js +0 -0
  170. package/lib/module/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  171. package/lib/module/{values/animation → animation}/timing/functions/types.js +0 -0
  172. package/lib/module/{values/animation → animation}/timing/functions/types.js.map +0 -0
  173. package/lib/module/{values/animation → animation}/timing/index.js +0 -0
  174. package/lib/module/{values/animation → animation}/timing/index.js.map +0 -0
  175. package/lib/module/{values/animation → animation}/timing/runTiming.js +0 -0
  176. package/lib/module/animation/timing/runTiming.js.map +1 -0
  177. package/lib/module/{values/animation → animation}/timing/useLoop.js +0 -0
  178. package/lib/module/{values/animation → animation}/timing/useLoop.js.map +0 -0
  179. package/lib/module/{values/animation → animation}/timing/useTiming.js +1 -1
  180. package/lib/module/animation/timing/useTiming.js.map +1 -0
  181. package/lib/module/{values/animation → animation}/types.js +0 -0
  182. package/lib/module/{values/animation → animation}/types.js.map +0 -0
  183. package/lib/module/index.js +1 -0
  184. package/lib/module/index.js.map +1 -1
  185. package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
  186. package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -2
  187. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  188. package/lib/module/renderer/components/imageFilters/RuntimeShader.js +19 -0
  189. package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  190. package/lib/module/renderer/components/imageFilters/index.js +1 -0
  191. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  192. package/lib/module/renderer/components/shaders/Gradient.js +2 -2
  193. package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
  194. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  195. package/lib/module/renderer/processors/Rects.js +4 -15
  196. package/lib/module/renderer/processors/Rects.js.map +1 -1
  197. package/lib/module/renderer/processors/math/Matrix3.js +52 -72
  198. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  199. package/lib/module/renderer/processors/math/Vector.js +3 -5
  200. package/lib/module/renderer/processors/math/Vector.js.map +1 -1
  201. package/lib/module/skia/Color.js +9 -25
  202. package/lib/module/skia/Color.js.map +1 -1
  203. package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  204. package/lib/module/skia/Matrix.js.map +1 -1
  205. package/lib/module/skia/Shader/useShader.js +4 -1
  206. package/lib/module/skia/Shader/useShader.js.map +1 -1
  207. package/lib/module/skia/Skia.js +2 -46
  208. package/lib/module/skia/Skia.js.map +1 -1
  209. package/lib/module/skia/SkiaApi.js +2 -0
  210. package/lib/module/skia/SkiaApi.js.map +1 -0
  211. package/lib/module/values/api.js +4 -6
  212. package/lib/module/values/api.js.map +1 -1
  213. package/lib/module/values/api.web.js +7 -0
  214. package/lib/module/values/api.web.js.map +1 -0
  215. package/lib/module/values/index.js +0 -1
  216. package/lib/module/values/index.js.map +1 -1
  217. package/lib/module/values/web/RNSkAnimation.js +36 -0
  218. package/lib/module/values/web/RNSkAnimation.js.map +1 -0
  219. package/lib/module/values/web/RNSkClockValue.js +65 -0
  220. package/lib/module/values/web/RNSkClockValue.js.map +1 -0
  221. package/lib/module/values/web/RNSkDerivedValue.js +41 -0
  222. package/lib/module/values/web/RNSkDerivedValue.js.map +1 -0
  223. package/lib/module/values/web/RNSkReadonlyValue.js +36 -0
  224. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -0
  225. package/lib/module/values/web/RNSkValue.js +63 -0
  226. package/lib/module/values/web/RNSkValue.js.map +1 -0
  227. package/lib/module/values/web/api.js +19 -0
  228. package/lib/module/values/web/api.js.map +1 -0
  229. package/lib/module/values/web/index.js +2 -0
  230. package/lib/module/values/web/index.js.map +1 -0
  231. package/lib/module/views/SkiaView.js +1 -3
  232. package/lib/module/views/SkiaView.js.map +1 -1
  233. package/lib/module/views/api.js +4 -0
  234. package/lib/module/views/api.js.map +1 -0
  235. package/lib/module/views/types.js.map +1 -1
  236. package/lib/typescript/src/{values/animation → animation}/decay/decay.d.ts +0 -0
  237. package/lib/typescript/src/{values/animation → animation}/decay/index.d.ts +0 -0
  238. package/lib/typescript/src/{values/animation → animation}/decay/runDecay.d.ts +2 -2
  239. package/lib/typescript/src/{values/animation → animation}/decay/types.d.ts +1 -1
  240. package/lib/typescript/src/{values/animation → animation}/functions/index.d.ts +0 -0
  241. package/lib/typescript/src/animation/functions/interpolate.d.ts +11 -0
  242. package/lib/typescript/src/animation/functions/interpolateColors.d.ts +3 -0
  243. package/lib/typescript/src/{values/animation → animation}/index.d.ts +0 -0
  244. package/lib/typescript/src/{values/animation → animation}/spring/Spring.d.ts +0 -0
  245. package/lib/typescript/src/{values/animation → animation}/spring/functions/index.d.ts +0 -0
  246. package/lib/typescript/src/{values/animation → animation}/spring/functions/spring.d.ts +0 -0
  247. package/lib/typescript/src/{values/animation → animation}/spring/index.d.ts +0 -0
  248. package/lib/typescript/src/{values/animation → animation}/spring/runSpring.d.ts +1 -1
  249. package/lib/typescript/src/{values/animation → animation}/spring/types.d.ts +0 -0
  250. package/lib/typescript/src/{values/animation → animation}/spring/useSpring.d.ts +1 -1
  251. package/lib/typescript/src/{values/animation → animation}/timing/Easing.d.ts +0 -0
  252. package/lib/typescript/src/{values/animation → animation}/timing/createTiming.d.ts +2 -2
  253. package/lib/typescript/src/{values/animation → animation}/timing/functions/bezier.d.ts +0 -0
  254. package/lib/typescript/src/{values/animation → animation}/timing/functions/getResolvedParams.d.ts +0 -0
  255. package/lib/typescript/src/{values/animation → animation}/timing/functions/index.d.ts +0 -0
  256. package/lib/typescript/src/{values/animation → animation}/timing/functions/timing.d.ts +1 -1
  257. package/lib/typescript/src/{values/animation → animation}/timing/functions/types.d.ts +0 -0
  258. package/lib/typescript/src/{values/animation → animation}/timing/index.d.ts +0 -0
  259. package/lib/typescript/src/{values/animation → animation}/timing/runTiming.d.ts +1 -1
  260. package/lib/typescript/src/{values/animation → animation}/timing/useLoop.d.ts +0 -0
  261. package/lib/typescript/src/{values/animation → animation}/timing/useTiming.d.ts +1 -1
  262. package/lib/typescript/src/{values/animation → animation}/types.d.ts +0 -0
  263. package/lib/typescript/src/index.d.ts +1 -0
  264. package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +1 -1
  265. package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +7 -0
  266. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -0
  267. package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +1 -1
  268. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
  269. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -4
  270. package/lib/typescript/src/renderer/processors/Rects.d.ts +9 -41
  271. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -5
  272. package/lib/typescript/src/renderer/processors/math/Vector.d.ts +5 -17
  273. package/lib/typescript/src/skia/Color.d.ts +8 -9
  274. package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +16 -0
  275. package/lib/typescript/src/skia/Matrix.d.ts +7 -1
  276. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +2 -1
  277. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffectFactory.d.ts +2 -2
  278. package/lib/typescript/src/skia/Shader/useShader.d.ts +1 -1
  279. package/lib/typescript/src/skia/Skia.d.ts +28 -95
  280. package/lib/typescript/src/skia/SkiaApi.d.ts +71 -0
  281. package/lib/typescript/src/skia/Surface/Surface.d.ts +1 -1
  282. package/lib/typescript/src/skia/Surface/SurfaceFactory.d.ts +2 -2
  283. package/lib/typescript/src/values/api.d.ts +2 -25
  284. package/lib/typescript/src/values/api.web.d.ts +2 -0
  285. package/lib/typescript/src/values/index.d.ts +0 -1
  286. package/lib/typescript/src/values/types.d.ts +24 -1
  287. package/lib/typescript/src/values/web/RNSkAnimation.d.ts +9 -0
  288. package/lib/typescript/src/values/web/RNSkClockValue.d.ts +13 -0
  289. package/lib/typescript/src/values/web/RNSkDerivedValue.d.ts +9 -0
  290. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +11 -0
  291. package/lib/typescript/src/values/web/RNSkValue.d.ts +14 -0
  292. package/lib/typescript/src/values/web/api.d.ts +2 -0
  293. package/lib/typescript/src/values/web/index.d.ts +1 -0
  294. package/lib/typescript/src/views/SkiaView.d.ts +3 -36
  295. package/lib/typescript/src/views/api.d.ts +5 -0
  296. package/lib/typescript/src/views/types.d.ts +32 -0
  297. package/package.json +2 -2
  298. package/src/{values/animation → animation}/decay/decay.ts +0 -0
  299. package/src/{values/animation → animation}/decay/index.ts +0 -0
  300. package/src/{values/animation → animation}/decay/runDecay.ts +2 -2
  301. package/src/{values/animation → animation}/decay/types.ts +1 -1
  302. package/src/{values/animation → animation}/functions/index.ts +0 -0
  303. package/src/animation/functions/interpolate.ts +182 -0
  304. package/src/animation/functions/interpolateColors.ts +58 -0
  305. package/src/{values/animation → animation}/index.ts +0 -0
  306. package/src/{values/animation → animation}/spring/Spring.ts +0 -0
  307. package/src/{values/animation → animation}/spring/functions/index.ts +0 -0
  308. package/src/{values/animation → animation}/spring/functions/spring.ts +0 -0
  309. package/src/{values/animation → animation}/spring/index.ts +0 -0
  310. package/src/{values/animation → animation}/spring/runSpring.ts +1 -1
  311. package/src/{values/animation → animation}/spring/types.ts +0 -0
  312. package/src/{values/animation → animation}/spring/useSpring.ts +1 -1
  313. package/src/{values/animation → animation}/timing/Easing.ts +0 -0
  314. package/src/{values/animation → animation}/timing/createTiming.ts +2 -2
  315. package/src/{values/animation → animation}/timing/functions/__tests__/timing.spec.ts +0 -0
  316. package/src/{values/animation → animation}/timing/functions/bezier.ts +0 -0
  317. package/src/{values/animation → animation}/timing/functions/getResolvedParams.ts +0 -0
  318. package/src/{values/animation → animation}/timing/functions/index.ts +0 -0
  319. package/src/{values/animation → animation}/timing/functions/timing.ts +1 -1
  320. package/src/{values/animation → animation}/timing/functions/types.ts +0 -0
  321. package/src/{values/animation → animation}/timing/index.ts +0 -0
  322. package/src/{values/animation → animation}/timing/runTiming.ts +1 -1
  323. package/src/{values/animation → animation}/timing/useLoop.ts +0 -0
  324. package/src/{values/animation → animation}/timing/useTiming.ts +2 -2
  325. package/src/{values/animation → animation}/types.ts +0 -0
  326. package/src/index.ts +1 -0
  327. package/src/renderer/components/colorFilters/BlendColor.tsx +1 -1
  328. package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -2
  329. package/src/renderer/components/imageFilters/RuntimeShader.tsx +23 -0
  330. package/src/renderer/components/imageFilters/index.ts +1 -0
  331. package/src/renderer/components/shaders/Gradient.ts +2 -4
  332. package/src/renderer/components/shaders/Shader.tsx +2 -2
  333. package/src/renderer/processors/Rects.ts +6 -12
  334. package/src/renderer/processors/math/Matrix3.ts +24 -105
  335. package/src/renderer/processors/math/Vector.ts +3 -2
  336. package/src/skia/Color.ts +13 -27
  337. package/src/skia/ImageFilter/ImageFilterFactory.ts +20 -0
  338. package/src/skia/Matrix.ts +8 -1
  339. package/src/skia/RuntimeEffect/RuntimeEffect.ts +3 -1
  340. package/src/skia/RuntimeEffect/RuntimeEffectFactory.ts +2 -2
  341. package/src/skia/Shader/useShader.ts +4 -1
  342. package/src/skia/Skia.ts +4 -126
  343. package/src/skia/SkiaApi.ts +86 -0
  344. package/src/skia/Surface/Surface.ts +1 -1
  345. package/src/skia/Surface/SurfaceFactory.ts +2 -2
  346. package/src/values/api.ts +3 -42
  347. package/src/values/api.web.ts +5 -0
  348. package/src/values/index.ts +0 -1
  349. package/src/values/types.ts +30 -1
  350. package/src/values/web/RNSkAnimation.ts +33 -0
  351. package/src/values/web/RNSkClockValue.ts +58 -0
  352. package/src/values/web/RNSkDerivedValue.ts +38 -0
  353. package/src/values/web/RNSkReadonlyValue.ts +32 -0
  354. package/src/values/web/RNSkValue.ts +57 -0
  355. package/src/values/web/__tests__/RNSkAnimation.spec.ts +21 -0
  356. package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +15 -0
  357. package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +8 -0
  358. package/src/values/web/__tests__/RNSkValue.spec.ts +11 -0
  359. package/src/values/web/api.ts +33 -0
  360. package/src/values/web/index.ts +1 -0
  361. package/src/views/SkiaView.tsx +3 -49
  362. package/src/views/api.ts +7 -0
  363. package/src/views/types.ts +40 -0
  364. package/lib/commonjs/values/animation/decay/runDecay.js.map +0 -1
  365. package/lib/commonjs/values/animation/functions/interpolate.js +0 -139
  366. package/lib/commonjs/values/animation/functions/interpolate.js.map +0 -1
  367. package/lib/commonjs/values/animation/functions/interpolateColors.js +0 -47
  368. package/lib/commonjs/values/animation/functions/interpolateColors.js.map +0 -1
  369. package/lib/commonjs/values/animation/spring/runSpring.js.map +0 -1
  370. package/lib/commonjs/values/animation/spring/useSpring.js.map +0 -1
  371. package/lib/commonjs/values/animation/timing/createTiming.js.map +0 -1
  372. package/lib/commonjs/values/animation/timing/runTiming.js.map +0 -1
  373. package/lib/commonjs/values/animation/timing/useTiming.js.map +0 -1
  374. package/lib/module/values/animation/decay/runDecay.js.map +0 -1
  375. package/lib/module/values/animation/functions/interpolate.js +0 -132
  376. package/lib/module/values/animation/functions/interpolate.js.map +0 -1
  377. package/lib/module/values/animation/functions/interpolateColors.js +0 -32
  378. package/lib/module/values/animation/functions/interpolateColors.js.map +0 -1
  379. package/lib/module/values/animation/spring/runSpring.js.map +0 -1
  380. package/lib/module/values/animation/spring/useSpring.js.map +0 -1
  381. package/lib/module/values/animation/timing/createTiming.js.map +0 -1
  382. package/lib/module/values/animation/timing/runTiming.js.map +0 -1
  383. package/lib/module/values/animation/timing/useTiming.js.map +0 -1
  384. package/lib/typescript/scripts/install-npm.d.ts +0 -1
  385. package/lib/typescript/src/values/animation/functions/interpolate.d.ts +0 -7
  386. package/lib/typescript/src/values/animation/functions/interpolateColors.d.ts +0 -3
  387. package/src/values/animation/functions/interpolate.ts +0 -169
  388. package/src/values/animation/functions/interpolateColors.ts +0 -62
@@ -1 +1 @@
1
- {"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":"AAQA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type { SkShader } from \"../Shader/Shader\";\nimport type { SkRect } from \"../Rect\";\nimport type { BlendMode } from \"../Paint/BlendMode\";\n\nimport type { SkImageFilter, TileMode } from \"./ImageFilter\";\n\nexport enum ColorChannel {\n R,\n G,\n B,\n A,\n}\n\nexport interface ImageFilterFactory {\n /**\n * Offsets the input image\n *\n * @param dx - Offset along the X axis\n * @param dy - Offset along the X axis\n * @param input - if null, it will use the dynamic source image\n */\n MakeOffset(\n dx: number,\n dy: number,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Spatially displace pixel values of the filtered image\n *\n * @param channelX - Color channel to be used along the X axis\n * @param channelY - Color channel to be used along the Y axis\n * @param scale - Scale factor to be used in the displacement\n * @param in1 - Source image filter to use for the displacement\n * @param input - if null, it will use the dynamic source image\n */\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Transforms a shader into an impage filter\n *\n * @param shader - The Shader to be transformed\n * @param input - if null, it will use the dynamic source image\n */\n MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;\n /**\n * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode\n * is used when the blur kernel goes outside the input image.\n *\n * @param sigmaX - The Gaussian sigma value for blurring along the X axis.\n * @param sigmaY - The Gaussian sigma value for blurring along the Y axis.\n * @param mode\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that applies the color filter to the input filter results.\n * @param cf\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeColorFilter(\n cf: SkColorFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are\n * treated as the source bitmap passed to 'outer'.\n * If either param is null, the other param will be returned.\n * @param outer\n * @param inner - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeCompose(\n outer: SkImageFilter | null,\n inner: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that draws a drop shadow under the input content.\n * This filter produces an image that includes the inputs' content.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadow: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except\n * that the resulting image does not include the input content.\n * This allows the shadow and input to be composed by a filter DAG in a more flexible manner.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadowOnly: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that erodes each input pixel's channel values to the minimum channel value\n * within the given radii along the x and y axes.\n * @param radiusX The distance to erode along the x axis to either side of each pixel.\n * @param radiusY The distance to erode along the y axis to either side of each pixel.\n * @param input The image filter that is eroded, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeErode: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that dilates each input pixel's channel values to the max value within the\n * given radii along the x and y axes.\n * @param radiusX The distance to dilate along the x axis to either side of each pixel.\n * @param radiusY The distance to dilate along the y axis to either side of each pixel.\n * @param input The image filter that is dilated, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeDilate: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * This filter takes an SkBlendMode and uses it to composite the two filters together.\n * @param mode The blend mode that defines the compositing operation\n * @param background The Dst pixels used in blending, if null the source bitmap is used.\n * @param foreground The Src pixels used in blending, if null the source bitmap is used.\n * @cropRect Optional rectangle to crop input and output.\n */\n MakeBlend: (\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n}\n"]}
1
+ {"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":"AASA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type { SkShader } from \"../Shader/Shader\";\nimport type { SkRect } from \"../Rect\";\nimport type { BlendMode } from \"../Paint/BlendMode\";\nimport type { SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nimport type { SkImageFilter, TileMode } from \"./ImageFilter\";\n\nexport enum ColorChannel {\n R,\n G,\n B,\n A,\n}\n\nexport interface ImageFilterFactory {\n /**\n * Offsets the input image\n *\n * @param dx - Offset along the X axis\n * @param dy - Offset along the X axis\n * @param input - if null, it will use the dynamic source image\n */\n MakeOffset(\n dx: number,\n dy: number,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Spatially displace pixel values of the filtered image\n *\n * @param channelX - Color channel to be used along the X axis\n * @param channelY - Color channel to be used along the Y axis\n * @param scale - Scale factor to be used in the displacement\n * @param in1 - Source image filter to use for the displacement\n * @param input - if null, it will use the dynamic source image\n */\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Transforms a shader into an impage filter\n *\n * @param shader - The Shader to be transformed\n * @param input - if null, it will use the dynamic source image\n */\n MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;\n /**\n * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode\n * is used when the blur kernel goes outside the input image.\n *\n * @param sigmaX - The Gaussian sigma value for blurring along the X axis.\n * @param sigmaY - The Gaussian sigma value for blurring along the Y axis.\n * @param mode\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that applies the color filter to the input filter results.\n * @param cf\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeColorFilter(\n cf: SkColorFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are\n * treated as the source bitmap passed to 'outer'.\n * If either param is null, the other param will be returned.\n * @param outer\n * @param inner - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeCompose(\n outer: SkImageFilter | null,\n inner: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that draws a drop shadow under the input content.\n * This filter produces an image that includes the inputs' content.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadow: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except\n * that the resulting image does not include the input content.\n * This allows the shadow and input to be composed by a filter DAG in a more flexible manner.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadowOnly: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that erodes each input pixel's channel values to the minimum channel value\n * within the given radii along the x and y axes.\n * @param radiusX The distance to erode along the x axis to either side of each pixel.\n * @param radiusY The distance to erode along the y axis to either side of each pixel.\n * @param input The image filter that is eroded, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeErode: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that dilates each input pixel's channel values to the max value within the\n * given radii along the x and y axes.\n * @param radiusX The distance to dilate along the x axis to either side of each pixel.\n * @param radiusY The distance to dilate along the y axis to either side of each pixel.\n * @param input The image filter that is dilated, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeDilate: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * This filter takes an SkBlendMode and uses it to composite the two filters together.\n * @param mode The blend mode that defines the compositing operation\n * @param background The Dst pixels used in blending, if null the source bitmap is used.\n * @param foreground The Src pixels used in blending, if null the source bitmap is used.\n * @cropRect Optional rectangle to crop input and output.\n */\n MakeBlend: (\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that fills the output with the per-pixel evaluation of the SkShader produced\n * by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate\n * system, so it will automatically be affected by SkCanvas' transform.\n *\n * @param builder The builder used to produce the runtime shader, that will in turn\n * fill the result image\n * @param childShaderName The name of the child shader defined in the builder that will be\n * bound to the input param (or the source image if the input param\n * is null). If null the builder can have exactly one child shader,\n * which automatically binds the input param.\n * @param input The image filter that will be provided as input to the runtime\n * shader. If null the implicit source image is used instead\n */\n MakeRuntimeShader: (\n builder: SkRuntimeShaderBuilder,\n childShaderName: string | null,\n input: SkImageFilter | null\n ) => SkImageFilter;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex"],"mappings":"AAAA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["export enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n persp2 = 8,\n}\n\nexport interface SkMatrix {\n 0: number;\n 1: number;\n 2: number;\n 3: number;\n 4: number;\n 5: number;\n 6: number;\n 7: number;\n 8: number;\n}\n"]}
1
+ {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex"],"mappings":"AACA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n persp2 = 8,\n}\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n 0: number;\n 1: number;\n 2: number;\n 3: number;\n 4: number;\n 5: number;\n 6: number;\n 7: number;\n 8: number;\n\n preConcat: (matrix: SkMatrix) => void;\n preTranslate: (x: number, y: number) => void;\n preScale: (x: number, y: number) => void;\n preSkew: (x: number, y: number) => void;\n preRotate: (theta: number) => void;\n}\n"]}
@@ -1,4 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
  import { Skia } from "../Skia";
3
- export const useShader = sksl => useMemo(() => Skia.RuntimeEffect.Make(sksl), [sksl]);
3
+ export const useShader = sksl => useMemo(() => {
4
+ console.warn("Use shader will be deprecated.");
5
+ return Skia.RuntimeEffect.Make(sksl);
6
+ }, [sksl]);
4
7
  //# sourceMappingURL=useShader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useShader.ts"],"names":["useMemo","Skia","useShader","sksl","RuntimeEffect","Make"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAEA,OAAO,MAAMC,SAAS,GAAIC,IAAD,IACvBH,OAAO,CAAC,MAAMC,IAAI,CAACG,aAAL,CAAmBC,IAAnB,CAAwBF,IAAxB,CAAP,EAAsC,CAACA,IAAD,CAAtC,CADF","sourcesContent":["import { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\n\nexport const useShader = (sksl: string) =>\n useMemo(() => Skia.RuntimeEffect.Make(sksl), [sksl]);\n"]}
1
+ {"version":3,"sources":["useShader.ts"],"names":["useMemo","Skia","useShader","sksl","console","warn","RuntimeEffect","Make"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAEA,OAAO,MAAMC,SAAS,GAAIC,IAAD,IACvBH,OAAO,CAAC,MAAM;AACZI,EAAAA,OAAO,CAACC,IAAR,CAAa,gCAAb;AACA,SAAOJ,IAAI,CAACK,aAAL,CAAmBC,IAAnB,CAAwBJ,IAAxB,CAAP;AACD,CAHM,EAGJ,CAACA,IAAD,CAHI,CADF","sourcesContent":["import { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\n\nexport const useShader = (sksl: string) =>\n useMemo(() => {\n console.warn(\"Use shader will be deprecated.\");\n return Skia.RuntimeEffect.Make(sksl);\n }, [sksl]);\n"]}
@@ -1,48 +1,6 @@
1
- import { Platform, processColor } from "react-native";
2
1
  /*global SkiaApi*/
3
-
4
2
  import "./NativeSetup";
5
3
 
6
- /*
7
- * Parse CSS colors
8
- */
9
- const SkiaColor = cl => {
10
- if (typeof cl === "number") {
11
- return cl;
12
- }
13
-
14
- const color = Skia.parseColorString(cl);
15
-
16
- if (color !== undefined) {
17
- return color;
18
- } else {
19
- // If the color is not recognized, we fallback to React Native
20
- let rnColor = processColor(cl); // 1. Neither Skia or RN could parse the color
21
-
22
- if (typeof rnColor !== "number") {
23
- console.warn("Skia couldn't parse the following color " + cl);
24
- return BLACK; // 2. The color is recognized by RN but not by Skia
25
- } else {
26
- console.warn("Skia couldn't parse the following color " + cl + ". The color parsing was delegated to React Native. Please file on issue with that color."); // On android we need to move the alpha byte to the start of the structure
27
-
28
- if (Platform.OS === "android") {
29
- rnColor = rnColor >>> 0;
30
- const a = rnColor >> 24 & 0xff;
31
- const r = rnColor >> 16 & 0xff;
32
- const g = rnColor >> 8 & 0xff;
33
- const b = rnColor & 0xff;
34
- rnColor = (a << 24 | r << 16 | g << 8 | b) >>> 0;
35
- }
36
-
37
- return rnColor;
38
- }
39
- }
40
- };
41
- /**
42
- * Declares the interface for the native Skia API
43
- */
44
-
45
-
46
4
  /**
47
5
  * Declares the implemented API with overrides.
48
6
  */
@@ -64,15 +22,14 @@ export const Skia = {
64
22
  Point: SkiaApi.Point,
65
23
  XYWHRect: SkiaApi.XYWHRect,
66
24
  RRectXY: SkiaApi.RRectXY,
25
+ RuntimeShaderBuilder: SkiaApi.RuntimeShaderBuilder,
67
26
  Paint: SkiaApi.Paint,
68
27
  PictureRecorder: SkiaApi.PictureRecorder,
69
28
  Picture: SkiaApi.Picture,
70
29
  Path: SkiaApi.Path,
71
30
  ColorFilter: SkiaApi.ColorFilter,
72
31
  ContourMeasureIter: SkiaApi.ContourMeasureIter,
73
- // Here are constructors for data types which are represented as typed arrays in CanvasKit
74
- Color: SkiaColor,
75
- parseColorString: SkiaApi.parseColorString,
32
+ Color: SkiaApi.Color,
76
33
  RSXform: SkiaApi.RSXform,
77
34
  // For the following methods the factory symmetry is broken to be comptatible with CanvasKit
78
35
  MakeSurface: SkiaApi.Surface.Make,
@@ -80,5 +37,4 @@ export const Skia = {
80
37
  MakeImage: SkiaApi.Image.MakeImage,
81
38
  MakeVertices: SkiaApi.MakeVertices
82
39
  };
83
- const BLACK = Skia.parseColorString("black");
84
40
  //# sourceMappingURL=Skia.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Skia.ts"],"names":["Platform","processColor","SkiaColor","cl","color","Skia","parseColorString","undefined","rnColor","console","warn","BLACK","OS","a","r","g","b","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,YAAnB,QAAuC,cAAvC;AAEA;;AAsBA,OAAO,eAAP;;AAOA;AACA;AACA;AACA,MAAMC,SAAS,GAAIC,EAAD,IAAe;AAC/B,MAAI,OAAOA,EAAP,KAAc,QAAlB,EAA4B;AAC1B,WAAOA,EAAP;AACD;;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,gBAAL,CAAsBH,EAAtB,CAAd;;AACA,MAAIC,KAAK,KAAKG,SAAd,EAAyB;AACvB,WAAOH,KAAP;AACD,GAFD,MAEO;AACL;AACA,QAAII,OAAO,GAAGP,YAAY,CAACE,EAAD,CAA1B,CAFK,CAGL;;AACA,QAAI,OAAOK,OAAP,KAAmB,QAAvB,EAAiC;AAC/BC,MAAAA,OAAO,CAACC,IAAR,CAAa,6CAA6CP,EAA1D;AACA,aAAOQ,KAAP,CAF+B,CAG/B;AACD,KAJD,MAIO;AACLF,MAAAA,OAAO,CAACC,IAAR,CACE,6CACEP,EADF,GAEE,0FAHJ,EADK,CAML;;AACA,UAAIH,QAAQ,CAACY,EAAT,KAAgB,SAApB,EAA+B;AAC7BJ,QAAAA,OAAO,GAAGA,OAAO,KAAK,CAAtB;AACA,cAAMK,CAAC,GAAIL,OAAO,IAAI,EAAZ,GAAkB,IAA5B;AACA,cAAMM,CAAC,GAAIN,OAAO,IAAI,EAAZ,GAAkB,IAA5B;AACA,cAAMO,CAAC,GAAIP,OAAO,IAAI,CAAZ,GAAiB,IAA3B;AACA,cAAMQ,CAAC,GAAGR,OAAO,GAAG,IAApB;AACAA,QAAAA,OAAO,GAAG,CAAEK,CAAC,IAAI,EAAN,GAAaC,CAAC,IAAI,EAAlB,GAAyBC,CAAC,IAAI,CAA9B,GAAmCC,CAApC,MAA2C,CAArD;AACD;;AACD,aAAOR,OAAP;AACD;AACF;AACF,CAjCD;AAmCA;AACA;AACA;;;AA2DA;AACA;AACA;AACA,OAAO,MAAMH,IAAI,GAAG;AAClB;AACAY,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;AAKlBC,EAAAA,MAAM,EAAEH,OAAO,CAACG,MALE;AAMlBC,EAAAA,WAAW,EAAEJ,OAAO,CAACI,WANH;AAOlBC,EAAAA,UAAU,EAAEL,OAAO,CAACK,UAPF;AAQlBC,EAAAA,IAAI,EAAEN,OAAO,CAACM,IARI;AASlBC,EAAAA,GAAG,EAAEP,OAAO,CAACO,GATK;AAUlBC,EAAAA,OAAO,EAAER,OAAO,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,KAAK,EAAEf,OAAO,CAACe,KAlBG;AAmBlBC,EAAAA,eAAe,EAAEhB,OAAO,CAACgB,eAnBP;AAoBlBC,EAAAA,OAAO,EAAEjB,OAAO,CAACiB,OApBC;AAqBlBC,EAAAA,IAAI,EAAElB,OAAO,CAACkB,IArBI;AAsBlBC,EAAAA,WAAW,EAAEnB,OAAO,CAACmB,WAtBH;AAuBlBC,EAAAA,kBAAkB,EAAEpB,OAAO,CAACoB,kBAvBV;AAwBlB;AACAC,EAAAA,KAAK,EAAErC,SAzBW;AA0BlBI,EAAAA,gBAAgB,EAAEY,OAAO,CAACZ,gBA1BR;AA2BlBkC,EAAAA,OAAO,EAAEtB,OAAO,CAACsB,OA3BC;AA4BlB;AACAC,EAAAA,WAAW,EAAEvB,OAAO,CAACwB,OAAR,CAAgBC,IA7BX;AA8BlBC,EAAAA,oBAAoB,EAAE1B,OAAO,CAAC2B,KAAR,CAAcD,oBA9BlB;AA+BlBE,EAAAA,SAAS,EAAE5B,OAAO,CAAC2B,KAAR,CAAcC,SA/BP;AAgClBC,EAAAA,YAAY,EAAE7B,OAAO,CAAC6B;AAhCJ,CAAb;AAmCP,MAAMpC,KAAK,GAAGN,IAAI,CAACC,gBAAL,CAAsB,OAAtB,CAAd","sourcesContent":["import { Platform, processColor } from \"react-native\";\n\n/*global SkiaApi*/\nimport type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\n\n/*\n * Parse CSS colors\n */\nconst SkiaColor = (cl: Color) => {\n if (typeof cl === \"number\") {\n return cl;\n }\n const color = Skia.parseColorString(cl);\n if (color !== undefined) {\n return color;\n } else {\n // If the color is not recognized, we fallback to React Native\n let rnColor = processColor(cl);\n // 1. Neither Skia or RN could parse the color\n if (typeof rnColor !== \"number\") {\n console.warn(\"Skia couldn't parse the following color \" + cl);\n return BLACK;\n // 2. The color is recognized by RN but not by Skia\n } else {\n console.warn(\n \"Skia couldn't parse the following color \" +\n cl +\n \". The color parsing was delegated to React Native. Please file on issue with that color.\"\n );\n // On android we need to move the alpha byte to the start of the structure\n if (Platform.OS === \"android\") {\n rnColor = rnColor >>> 0;\n const a = (rnColor >> 24) & 0xff;\n const r = (rnColor >> 16) & 0xff;\n const g = (rnColor >> 8) & 0xff;\n const b = rnColor & 0xff;\n rnColor = ((a << 24) | (r << 16) | (g << 8) | b) >>> 0;\n }\n return rnColor;\n }\n }\n};\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n parseColorString: (color: string) => SkColor | undefined;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: Skia;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n // Here are constructors for data types which are represented as typed arrays in CanvasKit\n Color: SkiaColor,\n parseColorString: SkiaApi.parseColorString,\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n\nconst BLACK = Skia.parseColorString(\"black\")!;\n"]}
1
+ {"version":3,"sources":["Skia.ts"],"names":["Skia","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","RuntimeShaderBuilder","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA;AACA,OAAO,eAAP;;AAUA;AACA;AACA;AACA,OAAO,MAAMA,IAAI,GAAG;AAClB;AACAC,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;AAKlBC,EAAAA,MAAM,EAAEH,OAAO,CAACG,MALE;AAMlBC,EAAAA,WAAW,EAAEJ,OAAO,CAACI,WANH;AAOlBC,EAAAA,UAAU,EAAEL,OAAO,CAACK,UAPF;AAQlBC,EAAAA,IAAI,EAAEN,OAAO,CAACM,IARI;AASlBC,EAAAA,GAAG,EAAEP,OAAO,CAACO,GATK;AAUlBC,EAAAA,OAAO,EAAER,OAAO,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,oBAAoB,EAAEf,OAAO,CAACe,oBAlBZ;AAmBlBC,EAAAA,KAAK,EAAEhB,OAAO,CAACgB,KAnBG;AAoBlBC,EAAAA,eAAe,EAAEjB,OAAO,CAACiB,eApBP;AAqBlBC,EAAAA,OAAO,EAAElB,OAAO,CAACkB,OArBC;AAsBlBC,EAAAA,IAAI,EAAEnB,OAAO,CAACmB,IAtBI;AAuBlBC,EAAAA,WAAW,EAAEpB,OAAO,CAACoB,WAvBH;AAwBlBC,EAAAA,kBAAkB,EAAErB,OAAO,CAACqB,kBAxBV;AAyBlBC,EAAAA,KAAK,EAAEtB,OAAO,CAACsB,KAzBG;AA0BlBC,EAAAA,OAAO,EAAEvB,OAAO,CAACuB,OA1BC;AA2BlB;AACAC,EAAAA,WAAW,EAAExB,OAAO,CAACyB,OAAR,CAAgBC,IA5BX;AA6BlBC,EAAAA,oBAAoB,EAAE3B,OAAO,CAAC4B,KAAR,CAAcD,oBA7BlB;AA8BlBE,EAAAA,SAAS,EAAE7B,OAAO,CAAC4B,KAAR,CAAcC,SA9BP;AA+BlBC,EAAAA,YAAY,EAAE9B,OAAO,CAAC8B;AA/BJ,CAAb","sourcesContent":["/*global SkiaApi*/\nimport \"./NativeSetup\";\nimport type { SkiaApi as SkSkiaApi } from \"./SkiaApi\";\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: SkSkiaApi;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n RuntimeShaderBuilder: SkiaApi.RuntimeShaderBuilder,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n Color: SkiaApi.Color,\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import "./NativeSetup";
2
+ //# sourceMappingURL=SkiaApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["SkiaApi.ts"],"names":[],"mappings":"AAqBA,OAAO,eAAP","sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type {\n SkRuntimeShaderBuilder,\n SkRuntimeEffect,\n} from \"./RuntimeEffect/RuntimeEffect\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface SkiaApi {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n parseColorString: (color: string) => SkColor | undefined;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"]}
@@ -1,9 +1,7 @@
1
- export const ValueApi = {
2
- createValue: global.SkiaValueApi.createValue,
3
- createDerivedValue: global.SkiaValueApi.createDerivedValue,
4
- createClockValue: global.SkiaValueApi.createClockValue,
5
- createAnimation: global.SkiaValueApi.createAnimation
6
- };
1
+ const {
2
+ SkiaValueApi
3
+ } = global;
4
+ export const ValueApi = SkiaValueApi;
7
5
  export const {
8
6
  createValue,
9
7
  createDerivedValue
@@ -1 +1 @@
1
- {"version":3,"sources":["api.ts"],"names":["ValueApi","createValue","global","SkiaValueApi","createDerivedValue","createClockValue","createAnimation"],"mappings":"AAyCA,OAAO,MAAMA,QAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAEC,MAAM,CAACC,YAAP,CAAoBF,WADI;AAErCG,EAAAA,kBAAkB,EAAEF,MAAM,CAACC,YAAP,CAAoBC,kBAFH;AAGrCC,EAAAA,gBAAgB,EAAEH,MAAM,CAACC,YAAP,CAAoBE,gBAHD;AAIrCC,EAAAA,eAAe,EAAEJ,MAAM,CAACC,YAAP,CAAoBG;AAJA,CAAhC;AAOP,OAAO,MAAM;AAAEL,EAAAA,WAAF;AAAeG,EAAAA;AAAf,IAAsCJ,QAA5C","sourcesContent":["import type {\n SkiaAnimation,\n AnimationState,\n SkiaReadonlyValue,\n SkiaClockValue,\n SkiaValue,\n} from \"./types\";\n\nexport interface ISkiaValueApi {\n /**\n * Creates a new value that holds the initial value and that\n * can be changed.\n */\n createValue: <T>(initialValue: T) => SkiaValue<T>;\n /**\n * Creates a derived value. This is a calculated value that returns the result of\n * a function that is called with the values of the dependencies.\n */\n createDerivedValue: <R>(\n cb: () => R,\n values: Array<SkiaReadonlyValue<unknown>>\n ) => SkiaReadonlyValue<R>;\n /**\n * Creates a clock value where the value is the number of milliseconds elapsed\n * since the clock was created\n */\n createClockValue: () => SkiaClockValue;\n /**\n * Creates an animation that is driven from a clock and updated every frame.\n * @param cb Callback to calculate next value from time.\n * @returns An animation object that can control a value.\n */\n createAnimation: <S extends AnimationState = AnimationState>(\n cb: (t: number, state: S | undefined) => S\n ) => SkiaAnimation;\n}\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nexport const ValueApi: ISkiaValueApi = {\n createValue: global.SkiaValueApi.createValue,\n createDerivedValue: global.SkiaValueApi.createDerivedValue,\n createClockValue: global.SkiaValueApi.createClockValue,\n createAnimation: global.SkiaValueApi.createAnimation,\n};\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
1
+ {"version":3,"sources":["api.ts"],"names":["SkiaValueApi","global","ValueApi","createValue","createDerivedValue"],"mappings":"AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,MAAzB;AACA,OAAO,MAAMC,QAAQ,GAAGF,YAAjB;AAEP,OAAO,MAAM;AAAEG,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCF,QAA5C","sourcesContent":["import type { ISkiaValueApi } from \"./types\";\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nconst { SkiaValueApi } = global;\nexport const ValueApi = SkiaValueApi;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
@@ -0,0 +1,7 @@
1
+ import { ValueApi as ValueApiWeb } from "./web";
2
+ export const ValueApi = ValueApiWeb;
3
+ export const {
4
+ createValue,
5
+ createDerivedValue
6
+ } = ValueApi;
7
+ //# sourceMappingURL=api.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["api.web.ts"],"names":["ValueApi","ValueApiWeb","createValue","createDerivedValue"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,WAArB,QAAwC,OAAxC;AAEA,OAAO,MAAMD,QAAQ,GAAGC,WAAjB;AAEP,OAAO,MAAM;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCH,QAA5C","sourcesContent":["import { ValueApi as ValueApiWeb } from \"./web\";\n\nexport const ValueApi = ValueApiWeb;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
@@ -1,5 +1,4 @@
1
1
  export * from "./types";
2
2
  export * from "./hooks";
3
- export * from "./animation";
4
3
  export * from "./api";
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,aAAd;AACA,cAAc,OAAd","sourcesContent":["export * from \"./types\";\nexport * from \"./hooks\";\nexport * from \"./animation\";\nexport * from \"./api\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,OAAd","sourcesContent":["export * from \"./types\";\nexport * from \"./hooks\";\nexport * from \"./api\";\n"]}
@@ -0,0 +1,36 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { RNSkClockValue } from "./RNSkClockValue";
4
+ export class RNSkAnimation extends RNSkClockValue {
5
+ constructor(callback, raf) {
6
+ super(raf);
7
+
8
+ _defineProperty(this, "_callback", void 0);
9
+
10
+ _defineProperty(this, "_animationState", undefined);
11
+
12
+ this._callback = callback;
13
+ }
14
+
15
+ cancel() {
16
+ this.stop();
17
+ }
18
+
19
+ update(nextValue) {
20
+ var _this$_animationState2, _this$_animationState3;
21
+
22
+ if (this._callback) {
23
+ var _this$_animationState;
24
+
25
+ this._animationState = this._callback(nextValue, this._animationState);
26
+
27
+ if ((_this$_animationState = this._animationState) !== null && _this$_animationState !== void 0 && _this$_animationState.finished) {
28
+ this.stop();
29
+ }
30
+ }
31
+
32
+ super.update((_this$_animationState2 = (_this$_animationState3 = this._animationState) === null || _this$_animationState3 === void 0 ? void 0 : _this$_animationState3.current) !== null && _this$_animationState2 !== void 0 ? _this$_animationState2 : nextValue);
33
+ }
34
+
35
+ }
36
+ //# sourceMappingURL=RNSkAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkAnimation.ts"],"names":["RNSkClockValue","RNSkAnimation","constructor","callback","raf","undefined","_callback","cancel","stop","update","nextValue","_animationState","finished","current"],"mappings":";;AAEA,SAASA,cAAT,QAA+B,kBAA/B;AAEA,OAAO,MAAMC,aAAN,SACGD,cADH,CAGP;AACEE,EAAAA,WAAW,CACTC,QADS,EAETC,GAFS,EAGT;AACA,UAAMA,GAAN;;AADA;;AAAA,6CAMuCC,SANvC;;AAEA,SAAKC,SAAL,GAAiBH,QAAjB;AACD;;AAKMI,EAAAA,MAAM,GAAG;AACd,SAAKC,IAAL;AACD;;AAESC,EAAAA,MAAM,CAACC,SAAD,EAA0B;AAAA;;AACxC,QAAI,KAAKJ,SAAT,EAAoB;AAAA;;AAClB,WAAKK,eAAL,GAAuB,KAAKL,SAAL,CAAeI,SAAf,EAA0B,KAAKC,eAA/B,CAAvB;;AACA,mCAAI,KAAKA,eAAT,kDAAI,sBAAsBC,QAA1B,EAAoC;AAClC,aAAKJ,IAAL;AACD;AACF;;AACD,UAAMC,MAAN,qDAAa,KAAKE,eAAlB,2DAAa,uBAAsBE,OAAnC,2EAA8CH,SAA9C;AACD;;AAxBH","sourcesContent":["import type { AnimationState, SkiaAnimation } from \"../types\";\n\nimport { RNSkClockValue } from \"./RNSkClockValue\";\n\nexport class RNSkAnimation<S extends AnimationState = AnimationState>\n extends RNSkClockValue\n implements SkiaAnimation\n{\n constructor(\n callback: (t: number, state: S | undefined) => S,\n raf: (callback: (time: number) => void) => number\n ) {\n super(raf);\n this._callback = callback;\n }\n\n private _callback: (t: number, state: S | undefined) => S;\n private _animationState: S | undefined = undefined;\n\n public cancel() {\n this.stop();\n }\n\n protected update(nextValue: number): void {\n if (this._callback) {\n this._animationState = this._callback(nextValue, this._animationState);\n if (this._animationState?.finished) {\n this.stop();\n }\n }\n super.update(this._animationState?.current ?? nextValue);\n }\n}\n"]}
@@ -0,0 +1,65 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
4
+ var RNSkClockState;
5
+
6
+ (function (RNSkClockState) {
7
+ RNSkClockState[RNSkClockState["NotStarted"] = 0] = "NotStarted";
8
+ RNSkClockState[RNSkClockState["Running"] = 1] = "Running";
9
+ RNSkClockState[RNSkClockState["Stopped"] = 2] = "Stopped";
10
+ })(RNSkClockState || (RNSkClockState = {}));
11
+
12
+ export class RNSkClockValue extends RNSkReadonlyValue {
13
+ constructor(raf) {
14
+ super(0);
15
+
16
+ _defineProperty(this, "_raf", void 0);
17
+
18
+ _defineProperty(this, "_start", void 0);
19
+
20
+ _defineProperty(this, "_stop", void 0);
21
+
22
+ _defineProperty(this, "_state", RNSkClockState.NotStarted);
23
+
24
+ _defineProperty(this, "notifyUpdate", _ => {
25
+ if (this._state === RNSkClockState.Running) {
26
+ const now = Date.now();
27
+ const deltaFromStart = now - this._start;
28
+ this.tick(deltaFromStart);
29
+
30
+ this._raf(this.notifyUpdate);
31
+ }
32
+ });
33
+
34
+ this._raf = raf;
35
+ this.update(0);
36
+ }
37
+
38
+ tick(value) {
39
+ this.update(value);
40
+ }
41
+
42
+ start() {
43
+ if (this._state === RNSkClockState.NotStarted) {
44
+ this._start = Date.now();
45
+ this._stop = this._start;
46
+ } // Subtract pause time from start
47
+
48
+
49
+ const timeSinceStop = Date.now() - this._stop;
50
+
51
+ this._start += timeSinceStop;
52
+ this._state = RNSkClockState.Running;
53
+
54
+ this._raf(this.notifyUpdate);
55
+ }
56
+
57
+ stop() {
58
+ if (this._state === RNSkClockState.Running) {
59
+ this._state = RNSkClockState.Stopped;
60
+ this._stop = Date.now();
61
+ }
62
+ }
63
+
64
+ }
65
+ //# sourceMappingURL=RNSkClockValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkClockValue.ts"],"names":["RNSkReadonlyValue","RNSkClockState","RNSkClockValue","constructor","raf","NotStarted","_","_state","Running","now","Date","deltaFromStart","_start","tick","_raf","notifyUpdate","update","value","start","_stop","timeSinceStop","stop","Stopped"],"mappings":";;AAEA,SAASA,iBAAT,QAAkC,qBAAlC;IAEKC,c;;WAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;GAAAA,c,KAAAA,c;;AAML,OAAO,MAAMC,cAAN,SACGF,iBADH,CAGP;AACEG,EAAAA,WAAW,CAACC,GAAD,EAAoD;AAC7D,UAAM,CAAN;;AAD6D;;AAAA;;AAAA;;AAAA,oCAS9BH,cAAc,CAACI,UATe;;AAAA,0CAWvCC,CAAD,IAAe;AACpC,UAAI,KAAKC,MAAL,KAAgBN,cAAc,CAACO,OAAnC,EAA4C;AAC1C,cAAMC,GAAG,GAAGC,IAAI,CAACD,GAAL,EAAZ;AACA,cAAME,cAAc,GAAGF,GAAG,GAAG,KAAKG,MAAlC;AACA,aAAKC,IAAL,CAAUF,cAAV;;AACA,aAAKG,IAAL,CAAU,KAAKC,YAAf;AACD;AACF,KAlB8D;;AAE7D,SAAKD,IAAL,GAAYV,GAAZ;AACA,SAAKY,MAAL,CAAY,CAAZ;AACD;;AAgBSH,EAAAA,IAAI,CAACI,KAAD,EAAgB;AAC5B,SAAKD,MAAL,CAAYC,KAAZ;AACD;;AAEMC,EAAAA,KAAK,GAAG;AACb,QAAI,KAAKX,MAAL,KAAgBN,cAAc,CAACI,UAAnC,EAA+C;AAC7C,WAAKO,MAAL,GAAcF,IAAI,CAACD,GAAL,EAAd;AACA,WAAKU,KAAL,GAAa,KAAKP,MAAlB;AACD,KAJY,CAKb;;;AACA,UAAMQ,aAAa,GAAGV,IAAI,CAACD,GAAL,KAAa,KAAKU,KAAxC;;AACA,SAAKP,MAAL,IAAgBQ,aAAhB;AAEA,SAAKb,MAAL,GAAcN,cAAc,CAACO,OAA7B;;AACA,SAAKM,IAAL,CAAU,KAAKC,YAAf;AACD;;AAEMM,EAAAA,IAAI,GAAG;AACZ,QAAI,KAAKd,MAAL,KAAgBN,cAAc,CAACO,OAAnC,EAA4C;AAC1C,WAAKD,MAAL,GAAcN,cAAc,CAACqB,OAA7B;AACA,WAAKH,KAAL,GAAaT,IAAI,CAACD,GAAL,EAAb;AACD;AACF;;AA3CH","sourcesContent":["import type { SkiaClockValue } from \"../types\";\n\nimport { RNSkReadonlyValue } from \"./RNSkReadonlyValue\";\n\nenum RNSkClockState {\n NotStarted = 0,\n Running = 1,\n Stopped = 2,\n}\n\nexport class RNSkClockValue\n extends RNSkReadonlyValue<number>\n implements SkiaClockValue\n{\n constructor(raf: (callback: (time: number) => void) => number) {\n super(0);\n this._raf = raf;\n this.update(0);\n }\n\n private _raf: (callback: (time: number) => void) => number;\n private _start: number | undefined;\n private _stop: number | undefined;\n private _state: RNSkClockState = RNSkClockState.NotStarted;\n\n private notifyUpdate = (_: number) => {\n if (this._state === RNSkClockState.Running) {\n const now = Date.now();\n const deltaFromStart = now - this._start!;\n this.tick(deltaFromStart);\n this._raf(this.notifyUpdate);\n }\n };\n\n protected tick(value: number) {\n this.update(value);\n }\n\n public start() {\n if (this._state === RNSkClockState.NotStarted) {\n this._start = Date.now();\n this._stop = this._start;\n }\n // Subtract pause time from start\n const timeSinceStop = Date.now() - this._stop!;\n this._start! += timeSinceStop;\n\n this._state = RNSkClockState.Running;\n this._raf(this.notifyUpdate);\n }\n\n public stop() {\n if (this._state === RNSkClockState.Running) {\n this._state = RNSkClockState.Stopped;\n this._stop = Date.now();\n }\n }\n}\n"]}
@@ -0,0 +1,41 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
4
+ export class RNSkDerivedValue extends RNSkReadonlyValue {
5
+ constructor(callback, dependencies) {
6
+ // Initialize dependencies - we can't call this yet, since
7
+ // super if not called and it requires a start value to be set.
8
+ const unsubscribers = [];
9
+ const notifyUpdateRef = {
10
+ current: undefined
11
+ };
12
+ dependencies.forEach(dep => {
13
+ if ("__typename__" in dep && "addListener" in dep) {
14
+ unsubscribers.push(dep.addListener(() => {
15
+ var _notifyUpdateRef$curr;
16
+
17
+ return (_notifyUpdateRef$curr = notifyUpdateRef.current) === null || _notifyUpdateRef$curr === void 0 ? void 0 : _notifyUpdateRef$curr.call(notifyUpdateRef);
18
+ }));
19
+ }
20
+ });
21
+ super(callback());
22
+
23
+ _defineProperty(this, "_callback", void 0);
24
+
25
+ _defineProperty(this, "_unsubscribers", void 0);
26
+
27
+ this._unsubscribers = unsubscribers;
28
+ notifyUpdateRef.current = this.dependecyUpdated.bind(this);
29
+ this._callback = callback;
30
+ }
31
+
32
+ dependecyUpdated() {
33
+ this.update(this._callback());
34
+ }
35
+
36
+ unsubscribe() {
37
+ this._unsubscribers.forEach(unsubscribe => unsubscribe());
38
+ }
39
+
40
+ }
41
+ //# sourceMappingURL=RNSkDerivedValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkDerivedValue.ts"],"names":["RNSkReadonlyValue","RNSkDerivedValue","constructor","callback","dependencies","unsubscribers","notifyUpdateRef","current","undefined","forEach","dep","push","addListener","_unsubscribers","dependecyUpdated","bind","_callback","update","unsubscribe"],"mappings":";;AAEA,SAASA,iBAAT,QAAkC,qBAAlC;AAEA,OAAO,MAAMC,gBAAN,SAAkCD,iBAAlC,CAAuD;AAC5DE,EAAAA,WAAW,CAACC,QAAD,EAAoBC,YAApB,EAAkD;AAC3D;AACA;AACA,UAAMC,aAAgC,GAAG,EAAzC;AACA,UAAMC,eAAsD,GAAG;AAC7DC,MAAAA,OAAO,EAAEC;AADoD,KAA/D;AAGAJ,IAAAA,YAAY,CAACK,OAAb,CAAsBC,GAAD,IAAS;AAC5B,UAAI,kBAAkBA,GAAlB,IAAyB,iBAAiBA,GAA9C,EAAmD;AACjDL,QAAAA,aAAa,CAACM,IAAd,CACGD,GAAD,CAAoCE,WAApC,CAAgD;AAAA;;AAAA,0CAC9CN,eAAe,CAACC,OAD8B,0DAC9C,2BAAAD,eAAe,CAD+B;AAAA,SAAhD,CADF;AAKD;AACF,KARD;AASA,UAAMH,QAAQ,EAAd;;AAhB2D;;AAAA;;AAiB3D,SAAKU,cAAL,GAAsBR,aAAtB;AACAC,IAAAA,eAAe,CAACC,OAAhB,GAA0B,KAAKO,gBAAL,CAAsBC,IAAtB,CAA2B,IAA3B,CAA1B;AACA,SAAKC,SAAL,GAAiBb,QAAjB;AACD;;AAEOW,EAAAA,gBAAgB,GAAG;AACzB,SAAKG,MAAL,CAAY,KAAKD,SAAL,EAAZ;AACD;;AAKME,EAAAA,WAAW,GAAG;AACnB,SAAKL,cAAL,CAAoBJ,OAApB,CAA6BS,WAAD,IAAiBA,WAAW,EAAxD;AACD;;AAhC2D","sourcesContent":["import type { DependencyList } from \"react\";\n\nimport { RNSkReadonlyValue } from \"./RNSkReadonlyValue\";\n\nexport class RNSkDerivedValue<T> extends RNSkReadonlyValue<T> {\n constructor(callback: () => T, dependencies: DependencyList) {\n // Initialize dependencies - we can't call this yet, since\n // super if not called and it requires a start value to be set.\n const unsubscribers: Array<() => void> = [];\n const notifyUpdateRef: { current: (() => void) | undefined } = {\n current: undefined,\n };\n dependencies.forEach((dep) => {\n if (\"__typename__\" in dep && \"addListener\" in dep) {\n unsubscribers.push(\n (dep as RNSkReadonlyValue<unknown>).addListener(() =>\n notifyUpdateRef.current?.()\n )\n );\n }\n });\n super(callback());\n this._unsubscribers = unsubscribers;\n notifyUpdateRef.current = this.dependecyUpdated.bind(this);\n this._callback = callback;\n }\n\n private dependecyUpdated() {\n this.update(this._callback());\n }\n\n private _callback: () => T;\n private _unsubscribers: Array<() => void>;\n\n public unsubscribe() {\n this._unsubscribers.forEach((unsubscribe) => unsubscribe());\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ export class RNSkReadonlyValue {
4
+ constructor(value) {
5
+ _defineProperty(this, "_current", void 0);
6
+
7
+ _defineProperty(this, "_listeners", []);
8
+
9
+ _defineProperty(this, "__typename__", "RNSkValue");
10
+
11
+ this._current = value;
12
+ }
13
+
14
+ notifyListeners() {
15
+ this._listeners.forEach(cb => cb(this._current));
16
+ }
17
+
18
+ update(nextValue) {
19
+ this._current = nextValue;
20
+ this.notifyListeners();
21
+ }
22
+
23
+ get current() {
24
+ return this._current;
25
+ }
26
+
27
+ addListener(cb) {
28
+ this._listeners.push(cb);
29
+
30
+ return () => {
31
+ this._listeners.splice(this._listeners.indexOf(cb), 1);
32
+ };
33
+ }
34
+
35
+ }
36
+ //# sourceMappingURL=RNSkReadonlyValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkReadonlyValue.ts"],"names":["RNSkReadonlyValue","constructor","value","_current","notifyListeners","_listeners","forEach","cb","update","nextValue","current","addListener","push","splice","indexOf"],"mappings":";;AAEA,OAAO,MAAMA,iBAAN,CAA2D;AAChEC,EAAAA,WAAW,CAACC,KAAD,EAAW;AAAA;;AAAA,wCAK0B,EAL1B;;AAAA,0CAgBS,WAhBT;;AACpB,SAAKC,QAAL,GAAgBD,KAAhB;AACD;;AAKOE,EAAAA,eAAe,GAAS;AAC9B,SAAKC,UAAL,CAAgBC,OAAhB,CAAyBC,EAAD,IAAQA,EAAE,CAAC,KAAKJ,QAAN,CAAlC;AACD;;AAESK,EAAAA,MAAM,CAACC,SAAD,EAAqB;AACnC,SAAKN,QAAL,GAAgBM,SAAhB;AACA,SAAKL,eAAL;AACD;;AAIiB,MAAPM,OAAO,GAAM;AACtB,WAAO,KAAKP,QAAZ;AACD;;AAEMQ,EAAAA,WAAW,CAACJ,EAAD,EAAyB;AACzC,SAAKF,UAAL,CAAgBO,IAAhB,CAAqBL,EAArB;;AACA,WAAO,MAAM;AACX,WAAKF,UAAL,CAAgBQ,MAAhB,CAAuB,KAAKR,UAAL,CAAgBS,OAAhB,CAAwBP,EAAxB,CAAvB,EAAoD,CAApD;AACD,KAFD;AAGD;;AA5B+D","sourcesContent":["import type { SkiaReadonlyValue } from \"../types\";\n\nexport class RNSkReadonlyValue<T> implements SkiaReadonlyValue<T> {\n constructor(value: T) {\n this._current = value;\n }\n\n private _current: T;\n private _listeners: Array<(value: T) => void> = [];\n\n private notifyListeners(): void {\n this._listeners.forEach((cb) => cb(this._current));\n }\n\n protected update(nextValue: T): void {\n this._current = nextValue;\n this.notifyListeners();\n }\n\n public readonly __typename__ = \"RNSkValue\";\n\n public get current(): T {\n return this._current;\n }\n\n public addListener(cb: (value: T) => void) {\n this._listeners.push(cb);\n return () => {\n this._listeners.splice(this._listeners.indexOf(cb), 1);\n };\n }\n}\n"]}
@@ -0,0 +1,63 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
4
+ export class RNSkValue extends RNSkReadonlyValue {
5
+ constructor(value) {
6
+ super(value);
7
+
8
+ _defineProperty(this, "_unsubscribe", void 0);
9
+
10
+ _defineProperty(this, "_animation", void 0);
11
+
12
+ this._unsubscribe = undefined;
13
+ }
14
+
15
+ set current(value) {
16
+ this.update(value);
17
+ }
18
+
19
+ get current() {
20
+ return super.current;
21
+ }
22
+
23
+ unsubscribe() {
24
+ if (this._unsubscribe) {
25
+ this._unsubscribe();
26
+
27
+ this._unsubscribe = undefined;
28
+ }
29
+
30
+ if (this._animation) {
31
+ this._animation.cancel();
32
+
33
+ this._animation = undefined;
34
+ }
35
+ }
36
+
37
+ subscribe(animation) {
38
+ this.unsubscribe();
39
+
40
+ if (animation) {
41
+ this._animation = animation;
42
+ this._unsubscribe = animation.addListener( // eslint-disable-next-line @typescript-eslint/ban-ts-comment
43
+ // @ts-ignore
44
+ this.animationDidUpdate.bind(this));
45
+
46
+ this._animation.start();
47
+ }
48
+ }
49
+
50
+ animationDidUpdate(value) {
51
+ this.update(value);
52
+ }
53
+
54
+ get animation() {
55
+ return this._animation;
56
+ }
57
+
58
+ set animation(v) {
59
+ this.subscribe(v);
60
+ }
61
+
62
+ }
63
+ //# sourceMappingURL=RNSkValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkValue.ts"],"names":["RNSkReadonlyValue","RNSkValue","constructor","value","_unsubscribe","undefined","current","update","unsubscribe","_animation","cancel","subscribe","animation","addListener","animationDidUpdate","bind","start","v"],"mappings":";;AAEA,SAASA,iBAAT,QAAkC,qBAAlC;AAEA,OAAO,MAAMC,SAAN,SAA2BD,iBAA3B,CAAwE;AAC7EE,EAAAA,WAAW,CAACC,KAAD,EAAW;AACpB,UAAMA,KAAN;;AADoB;;AAAA;;AAEpB,SAAKC,YAAL,GAAoBC,SAApB;AACD;;AAEiB,MAAPC,OAAO,CAACH,KAAD,EAAW;AAC3B,SAAKI,MAAL,CAAYJ,KAAZ;AACD;;AAEiB,MAAPG,OAAO,GAAM;AACtB,WAAO,MAAMA,OAAb;AACD;;AAIOE,EAAAA,WAAW,GAAG;AACpB,QAAI,KAAKJ,YAAT,EAAuB;AACrB,WAAKA,YAAL;;AACA,WAAKA,YAAL,GAAoBC,SAApB;AACD;;AACD,QAAI,KAAKI,UAAT,EAAqB;AACnB,WAAKA,UAAL,CAAgBC,MAAhB;;AACA,WAAKD,UAAL,GAAkBJ,SAAlB;AACD;AACF;;AAEOM,EAAAA,SAAS,CAACC,SAAD,EAAuC;AACtD,SAAKJ,WAAL;;AACA,QAAII,SAAJ,EAAe;AACb,WAAKH,UAAL,GAAkBG,SAAlB;AACA,WAAKR,YAAL,GAAoBQ,SAAS,CAACC,WAAV,EAClB;AACA;AACA,WAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,IAA7B,CAHkB,CAApB;;AAKA,WAAKN,UAAL,CAAgBO,KAAhB;AACD;AACF;;AAEOF,EAAAA,kBAAkB,CAACX,KAAD,EAAW;AACnC,SAAKI,MAAL,CAAYJ,KAAZ;AACD;;AAGmB,MAATS,SAAS,GAA8B;AAChD,WAAO,KAAKH,UAAZ;AACD;;AAEmB,MAATG,SAAS,CAACK,CAAD,EAA+B;AACjD,SAAKN,SAAL,CAAeM,CAAf;AACD;;AAnD4E","sourcesContent":["import type { SkiaAnimation, SkiaValue } from \"../types\";\n\nimport { RNSkReadonlyValue } from \"./RNSkReadonlyValue\";\n\nexport class RNSkValue<T> extends RNSkReadonlyValue<T> implements SkiaValue<T> {\n constructor(value: T) {\n super(value);\n this._unsubscribe = undefined;\n }\n\n public set current(value: T) {\n this.update(value);\n }\n\n public get current(): T {\n return super.current;\n }\n\n private _unsubscribe: (() => void) | undefined;\n\n private unsubscribe() {\n if (this._unsubscribe) {\n this._unsubscribe();\n this._unsubscribe = undefined;\n }\n if (this._animation) {\n this._animation.cancel();\n this._animation = undefined;\n }\n }\n\n private subscribe(animation: SkiaAnimation | undefined) {\n this.unsubscribe();\n if (animation) {\n this._animation = animation;\n this._unsubscribe = animation.addListener(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.animationDidUpdate.bind(this)\n );\n this._animation.start();\n }\n }\n\n private animationDidUpdate(value: T) {\n this.update(value);\n }\n\n private _animation: SkiaAnimation | undefined;\n public get animation(): SkiaAnimation | undefined {\n return this._animation;\n }\n\n public set animation(v: SkiaAnimation | undefined) {\n this.subscribe(v);\n }\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { RNSkAnimation } from "./RNSkAnimation";
2
+ import { RNSkClockValue } from "./RNSkClockValue";
3
+ import { RNSkDerivedValue } from "./RNSkDerivedValue";
4
+ import { RNSkValue } from "./RNSkValue";
5
+ export const ValueApi = {
6
+ createValue: function (initialValue) {
7
+ return new RNSkValue(initialValue);
8
+ },
9
+ createDerivedValue: function (cb, values) {
10
+ return new RNSkDerivedValue(cb, values);
11
+ },
12
+ createClockValue: function () {
13
+ return new RNSkClockValue(requestAnimationFrame);
14
+ },
15
+ createAnimation: function (cb) {
16
+ return new RNSkAnimation(cb, requestAnimationFrame);
17
+ }
18
+ };
19
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["api.ts"],"names":["RNSkAnimation","RNSkClockValue","RNSkDerivedValue","RNSkValue","ValueApi","createValue","initialValue","createDerivedValue","cb","values","createClockValue","requestAnimationFrame","createAnimation"],"mappings":"AASA,SAASA,aAAT,QAA8B,iBAA9B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,OAAO,MAAMC,QAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAE,UAAaC,YAAb,EAA4C;AACvD,WAAO,IAAIH,SAAJ,CAAcG,YAAd,CAAP;AACD,GAHoC;AAIrCC,EAAAA,kBAAkB,EAAE,UAClBC,EADkB,EAElBC,MAFkB,EAGI;AACtB,WAAO,IAAIP,gBAAJ,CAAqBM,EAArB,EAAyBC,MAAzB,CAAP;AACD,GAToC;AAUrCC,EAAAA,gBAAgB,EAAE,YAA4B;AAC5C,WAAO,IAAIT,cAAJ,CAAmBU,qBAAnB,CAAP;AACD,GAZoC;AAarCC,EAAAA,eAAe,EAAE,UACfJ,EADe,EAEA;AACf,WAAO,IAAIR,aAAJ,CAAkBQ,EAAlB,EAAsBG,qBAAtB,CAAP;AACD;AAjBoC,CAAhC","sourcesContent":["import type {\n ISkiaValueApi,\n SkiaValue,\n SkiaReadonlyValue,\n SkiaClockValue,\n AnimationState,\n SkiaAnimation,\n} from \"../types\";\n\nimport { RNSkAnimation } from \"./RNSkAnimation\";\nimport { RNSkClockValue } from \"./RNSkClockValue\";\nimport { RNSkDerivedValue } from \"./RNSkDerivedValue\";\nimport { RNSkValue } from \"./RNSkValue\";\n\nexport const ValueApi: ISkiaValueApi = {\n createValue: function <T>(initialValue: T): SkiaValue<T> {\n return new RNSkValue(initialValue);\n },\n createDerivedValue: function <R>(\n cb: () => R,\n values: SkiaReadonlyValue<unknown>[]\n ): SkiaReadonlyValue<R> {\n return new RNSkDerivedValue(cb, values);\n },\n createClockValue: function (): SkiaClockValue {\n return new RNSkClockValue(requestAnimationFrame);\n },\n createAnimation: function <S extends AnimationState = AnimationState>(\n cb: (t: number, state: S | undefined) => S\n ): SkiaAnimation {\n return new RNSkAnimation(cb, requestAnimationFrame);\n },\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAd","sourcesContent":["export * from \"./api\";\n"]}
@@ -4,11 +4,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4
4
 
5
5
  import React from "react";
6
6
  import { requireNativeComponent } from "react-native";
7
+ import { SkiaViewApi } from "./api";
7
8
  let SkiaViewNativeId = 1000;
8
9
  const NativeSkiaView = requireNativeComponent("ReactNativeSkiaView");
9
- const {
10
- SkiaViewApi
11
- } = global;
12
10
  export class SkiaView extends React.Component {
13
11
  constructor(props) {
14
12
  super(props);
@@ -1 +1 @@
1
- {"version":3,"sources":["SkiaView.tsx"],"names":["React","requireNativeComponent","SkiaViewNativeId","NativeSkiaView","SkiaViewApi","global","SkiaView","Component","constructor","props","_nativeId","onDraw","assertDrawCallbacksEnabled","setDrawCallback","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","invalidateSkiaView","setDrawMode","mode","registerValues","values","registerValuesInView","render","debug","viewProps","Error"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,sBAAT,QAAuC,cAAvC;AAWA,IAAIC,gBAAgB,GAAG,IAAvB;AAEA,MAAMC,cAAc,GAAGF,sBAAsB,CAC3C,qBAD2C,CAA7C;AAoBA,MAAM;AAAEG,EAAAA;AAAF,IAAkBC,MAAxB;AA0BA,OAAO,MAAMC,QAAN,SAAuBN,KAAK,CAACO,SAA7B,CAAsD;AAC3DC,EAAAA,WAAW,CAACC,KAAD,EAAuB;AAChC,UAAMA,KAAN;;AADgC;;AAEhC,SAAKC,SAAL,GAAiBR,gBAAgB,EAAjC;AACA,UAAM;AAAES,MAAAA;AAAF,QAAaF,KAAnB;;AACA,QAAIE,MAAJ,EAAY;AACVC,MAAAA,0BAA0B;AAC1BR,MAAAA,WAAW,CAACS,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;;AAIkB,MAARG,QAAQ,GAAG;AACpB,WAAO,KAAKJ,SAAZ;AACD;;AAEDK,EAAAA,kBAAkB,CAACC,SAAD,EAA2B;AAC3C,UAAM;AAAEL,MAAAA;AAAF,QAAa,KAAKF,KAAxB;;AACA,QAAIE,MAAM,KAAKK,SAAS,CAACL,MAAzB,EAAiC;AAC/BC,MAAAA,0BAA0B;AAC1BR,MAAAA,WAAW,CAACS,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACSM,EAAAA,iBAAiB,CAACC,IAAD,EAAgB;AACtCN,IAAAA,0BAA0B;AAC1B,WAAOR,WAAW,CAACa,iBAAZ,CAA8B,KAAKP,SAAnC,EAA8CQ,IAA9C,CAAP;AACD;AAED;AACF;AACA;;;AACSC,EAAAA,MAAM,GAAG;AACdP,IAAAA,0BAA0B;AAC1BR,IAAAA,WAAW,CAACgB,kBAAZ,CAA+B,KAAKV,SAApC;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACSW,EAAAA,WAAW,CAACC,IAAD,EAAiB;AACjCV,IAAAA,0BAA0B;AAC1BR,IAAAA,WAAW,CAACiB,WAAZ,CAAwB,KAAKX,SAA7B,EAAwCY,IAAxC;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSC,EAAAA,cAAc,CAACC,MAAD,EAAuC;AAC1DZ,IAAAA,0BAA0B;AAC1B,WAAOR,WAAW,CAACqB,oBAAZ,CAAiC,KAAKf,SAAtC,EAAiDc,MAAjD,CAAP;AACD;;AAEDE,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEJ,MAAAA,IAAF;AAAQK,MAAAA,KAAK,GAAG,KAAhB;AAAuB,SAAGC;AAA1B,QAAwC,KAAKnB,KAAnD;AACA,wBACE,oBAAC,cAAD;AACE,MAAA,WAAW,EAAE,KADf;AAEE,MAAA,QAAQ,EAAG,GAAE,KAAKC,SAAU,EAF9B;AAGE,MAAA,IAAI,EAAEY,IAHR;AAIE,MAAA,KAAK,EAAEK;AAJT,OAKMC,SALN,EADF;AASD;;AA9E0D;;AAiF7D,MAAMhB,0BAA0B,GAAG,MAAM;AACvC,MACER,WAAW,KAAK,IAAhB,IACAA,WAAW,CAACS,eAAZ,IAA+B,IAD/B,IAEAT,WAAW,CAACgB,kBAAZ,IAAkC,IAHpC,EAIE;AACA,UAAMS,KAAK,CAAC,0BAAD,CAAX;AACD;AACF,CARD","sourcesContent":["import React from \"react\";\nimport type { ViewProps } from \"react-native\";\nimport { requireNativeComponent } from \"react-native\";\n\nimport type { SkImage, SkRect } from \"../skia\";\nimport type { SkiaReadonlyValue } from \"../values\";\n\nimport type {\n DrawMode,\n RNSkiaDrawCallback,\n NativeSkiaViewProps,\n} from \"./types\";\n\nlet SkiaViewNativeId = 1000;\n\nconst NativeSkiaView = requireNativeComponent<NativeSkiaViewProps>(\n \"ReactNativeSkiaView\"\n);\n\ndeclare global {\n var SkiaViewApi: {\n invalidateSkiaView: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n setDrawCallback: (\n nativeId: number,\n callback: RNSkiaDrawCallback | undefined\n ) => void;\n setDrawMode: (nativeId: number, mode: DrawMode) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaReadonlyValue<unknown>[]\n ) => () => void;\n };\n}\n\nconst { SkiaViewApi } = global;\n\nexport interface SkiaViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n\nexport class SkiaView extends React.Component<SkiaViewProps> {\n constructor(props: SkiaViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId++;\n const { onDraw } = props;\n if (onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaViewProps) {\n const { onDraw } = this.props;\n if (onDraw !== prevProps.onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertDrawCallbacksEnabled();\n SkiaViewApi.invalidateSkiaView(this._nativeId);\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawMode(this._nativeId, mode);\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(values: SkiaReadonlyValue<unknown>[]) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.registerValuesInView(this._nativeId, values);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertDrawCallbacksEnabled = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setDrawCallback == null ||\n SkiaViewApi.invalidateSkiaView == null\n ) {\n throw Error(\"Skia Api is not enabled.\");\n }\n};\n"]}
1
+ {"version":3,"sources":["SkiaView.tsx"],"names":["React","requireNativeComponent","SkiaViewApi","SkiaViewNativeId","NativeSkiaView","SkiaView","Component","constructor","props","_nativeId","onDraw","assertDrawCallbacksEnabled","setDrawCallback","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","invalidateSkiaView","setDrawMode","mode","registerValues","values","registerValuesInView","render","debug","viewProps","Error"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,sBAAT,QAAuC,cAAvC;AAKA,SAASC,WAAT,QAA4B,OAA5B;AAGA,IAAIC,gBAAgB,GAAG,IAAvB;AAEA,MAAMC,cAAc,GAAGH,sBAAsB,CAC3C,qBAD2C,CAA7C;AAIA,OAAO,MAAMI,QAAN,SAAuBL,KAAK,CAACM,SAA7B,CAAsD;AAC3DC,EAAAA,WAAW,CAACC,KAAD,EAAuB;AAChC,UAAMA,KAAN;;AADgC;;AAEhC,SAAKC,SAAL,GAAiBN,gBAAgB,EAAjC;AACA,UAAM;AAAEO,MAAAA;AAAF,QAAaF,KAAnB;;AACA,QAAIE,MAAJ,EAAY;AACVC,MAAAA,0BAA0B;AAC1BT,MAAAA,WAAW,CAACU,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;;AAIkB,MAARG,QAAQ,GAAG;AACpB,WAAO,KAAKJ,SAAZ;AACD;;AAEDK,EAAAA,kBAAkB,CAACC,SAAD,EAA2B;AAC3C,UAAM;AAAEL,MAAAA;AAAF,QAAa,KAAKF,KAAxB;;AACA,QAAIE,MAAM,KAAKK,SAAS,CAACL,MAAzB,EAAiC;AAC/BC,MAAAA,0BAA0B;AAC1BT,MAAAA,WAAW,CAACU,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACSM,EAAAA,iBAAiB,CAACC,IAAD,EAAgB;AACtCN,IAAAA,0BAA0B;AAC1B,WAAOT,WAAW,CAACc,iBAAZ,CAA8B,KAAKP,SAAnC,EAA8CQ,IAA9C,CAAP;AACD;AAED;AACF;AACA;;;AACSC,EAAAA,MAAM,GAAG;AACdP,IAAAA,0BAA0B;AAC1BT,IAAAA,WAAW,CAACiB,kBAAZ,CAA+B,KAAKV,SAApC;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACSW,EAAAA,WAAW,CAACC,IAAD,EAAiB;AACjCV,IAAAA,0BAA0B;AAC1BT,IAAAA,WAAW,CAACkB,WAAZ,CAAwB,KAAKX,SAA7B,EAAwCY,IAAxC;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSC,EAAAA,cAAc,CAACC,MAAD,EAAuC;AAC1DZ,IAAAA,0BAA0B;AAC1B,WAAOT,WAAW,CAACsB,oBAAZ,CAAiC,KAAKf,SAAtC,EAAiDc,MAAjD,CAAP;AACD;;AAEDE,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEJ,MAAAA,IAAF;AAAQK,MAAAA,KAAK,GAAG,KAAhB;AAAuB,SAAGC;AAA1B,QAAwC,KAAKnB,KAAnD;AACA,wBACE,oBAAC,cAAD;AACE,MAAA,WAAW,EAAE,KADf;AAEE,MAAA,QAAQ,EAAG,GAAE,KAAKC,SAAU,EAF9B;AAGE,MAAA,IAAI,EAAEY,IAHR;AAIE,MAAA,KAAK,EAAEK;AAJT,OAKMC,SALN,EADF;AASD;;AA9E0D;;AAiF7D,MAAMhB,0BAA0B,GAAG,MAAM;AACvC,MACET,WAAW,KAAK,IAAhB,IACAA,WAAW,CAACU,eAAZ,IAA+B,IAD/B,IAEAV,WAAW,CAACiB,kBAAZ,IAAkC,IAHpC,EAIE;AACA,UAAMS,KAAK,CAAC,0BAAD,CAAX;AACD;AACF,CARD","sourcesContent":["import React from \"react\";\nimport { requireNativeComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia\";\nimport type { SkiaReadonlyValue } from \"../values\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { DrawMode, NativeSkiaViewProps, SkiaViewProps } from \"./types\";\n\nlet SkiaViewNativeId = 1000;\n\nconst NativeSkiaView = requireNativeComponent<NativeSkiaViewProps>(\n \"ReactNativeSkiaView\"\n);\n\nexport class SkiaView extends React.Component<SkiaViewProps> {\n constructor(props: SkiaViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId++;\n const { onDraw } = props;\n if (onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaViewProps) {\n const { onDraw } = this.props;\n if (onDraw !== prevProps.onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertDrawCallbacksEnabled();\n SkiaViewApi.invalidateSkiaView(this._nativeId);\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawMode(this._nativeId, mode);\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(values: SkiaReadonlyValue<unknown>[]) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.registerValuesInView(this._nativeId, values);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertDrawCallbacksEnabled = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setDrawCallback == null ||\n SkiaViewApi.invalidateSkiaView == null\n ) {\n throw Error(\"Skia Api is not enabled.\");\n }\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export const {
2
+ SkiaViewApi
3
+ } = global;
4
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["api.ts"],"names":["SkiaViewApi","global"],"mappings":"AAMA,OAAO,MAAM;AAAEA,EAAAA;AAAF,IAAkBC,MAAxB","sourcesContent":["import type { ISkiaViewApi } from \"./types\";\n\ndeclare global {\n var SkiaViewApi: ISkiaViewApi;\n}\n\nexport const { SkiaViewApi } = global;\n"]}