@shopify/react-native-skia 0.1.123 → 0.1.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/android/CMakeLists.txt +3 -0
  2. package/android/build.gradle +1 -1
  3. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +5 -5
  4. package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +4 -4
  5. package/cpp/api/JsiSkApi.h +3 -1
  6. package/cpp/api/JsiSkCanvas.h +1 -1
  7. package/cpp/api/JsiSkColor.h +41 -7
  8. package/cpp/api/JsiSkColorFilterFactory.h +2 -1
  9. package/cpp/api/JsiSkImageFilter.h +0 -2
  10. package/cpp/api/JsiSkImageFilterFactory.h +37 -17
  11. package/cpp/api/JsiSkMatrix.h +44 -2
  12. package/cpp/api/JsiSkPaint.h +4 -7
  13. package/cpp/api/JsiSkRuntimeEffect.h +7 -0
  14. package/cpp/api/JsiSkRuntimeEffectFactory.h +3 -2
  15. package/cpp/api/JsiSkRuntimeShaderBuilder.h +70 -0
  16. package/cpp/api/JsiSkShaderFactory.h +2 -2
  17. package/cpp/api/JsiSkVertices.h +1 -1
  18. package/cpp/api/third_party/CSSColorParser.cpp +194 -0
  19. package/cpp/api/third_party/CSSColorParser.h +1 -191
  20. package/cpp/jsi/JsiSimpleValueWrapper.h +108 -0
  21. package/cpp/rnskia/RNSkAnimation.h +0 -2
  22. package/cpp/rnskia/RNSkDrawView.cpp +10 -13
  23. package/cpp/rnskia/RNSkDrawView.h +2 -2
  24. package/cpp/rnskia/RNSkValueApi.h +6 -2
  25. package/cpp/rnskia/values/RNSkClockValue.h +2 -2
  26. package/cpp/rnskia/values/RNSkDerivedValue.h +12 -5
  27. package/cpp/rnskia/values/RNSkReadonlyValue.h +14 -12
  28. package/cpp/rnskia/values/RNSkValue.h +8 -3
  29. package/ios/RNSkia-iOS/PlatformContext.h +30 -4
  30. package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +4 -4
  31. package/ios/RNSkia-iOS/SkiaDrawView.mm +9 -13
  32. package/lib/commonjs/{values/animation → animation}/decay/decay.js +0 -0
  33. package/lib/commonjs/{values/animation → animation}/decay/decay.js.map +0 -0
  34. package/lib/commonjs/{values/animation → animation}/decay/index.js +0 -0
  35. package/lib/commonjs/{values/animation → animation}/decay/index.js.map +0 -0
  36. package/lib/commonjs/{values/animation → animation}/decay/runDecay.js +1 -1
  37. package/lib/commonjs/animation/decay/runDecay.js.map +1 -0
  38. package/lib/commonjs/{values/animation → animation}/decay/types.js +0 -0
  39. package/lib/commonjs/{values/animation → animation}/decay/types.js.map +0 -0
  40. package/lib/commonjs/{values/animation → animation}/functions/index.js +0 -0
  41. package/lib/commonjs/{values/animation → animation}/functions/index.js.map +0 -0
  42. package/lib/commonjs/animation/functions/interpolate.js +141 -0
  43. package/lib/commonjs/animation/functions/interpolate.js.map +1 -0
  44. package/lib/commonjs/animation/functions/interpolateColors.js +39 -0
  45. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -0
  46. package/lib/commonjs/{values/animation → animation}/index.js +0 -0
  47. package/lib/commonjs/{values/animation → animation}/index.js.map +0 -0
  48. package/lib/commonjs/{values/animation → animation}/spring/Spring.js +0 -0
  49. package/lib/commonjs/{values/animation → animation}/spring/Spring.js.map +0 -0
  50. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js +0 -0
  51. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js.map +0 -0
  52. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js +0 -0
  53. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  54. package/lib/commonjs/{values/animation → animation}/spring/index.js +0 -0
  55. package/lib/commonjs/{values/animation → animation}/spring/index.js.map +0 -0
  56. package/lib/commonjs/{values/animation → animation}/spring/runSpring.js +0 -0
  57. package/lib/commonjs/animation/spring/runSpring.js.map +1 -0
  58. package/lib/commonjs/{values/animation → animation}/spring/types.js +0 -0
  59. package/lib/commonjs/{values/animation → animation}/spring/types.js.map +0 -0
  60. package/lib/commonjs/{values/animation → animation}/spring/useSpring.js +0 -0
  61. package/lib/commonjs/animation/spring/useSpring.js.map +1 -0
  62. package/lib/commonjs/{values/animation → animation}/timing/Easing.js +0 -0
  63. package/lib/commonjs/{values/animation → animation}/timing/Easing.js.map +0 -0
  64. package/lib/commonjs/{values/animation → animation}/timing/createTiming.js +1 -1
  65. package/lib/commonjs/animation/timing/createTiming.js.map +1 -0
  66. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js +0 -0
  67. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  68. package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
  69. package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +1 -0
  70. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js +0 -0
  71. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js.map +0 -0
  72. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js +0 -0
  73. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  74. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js +0 -0
  75. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js.map +0 -0
  76. package/lib/commonjs/{values/animation → animation}/timing/index.js +0 -0
  77. package/lib/commonjs/{values/animation → animation}/timing/index.js.map +0 -0
  78. package/lib/commonjs/{values/animation → animation}/timing/runTiming.js +0 -0
  79. package/lib/commonjs/animation/timing/runTiming.js.map +1 -0
  80. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js +0 -0
  81. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js.map +0 -0
  82. package/lib/commonjs/{values/animation → animation}/timing/useTiming.js +1 -1
  83. package/lib/commonjs/animation/timing/useTiming.js.map +1 -0
  84. package/lib/commonjs/{values/animation → animation}/types.js +0 -0
  85. package/lib/commonjs/{values/animation → animation}/types.js.map +0 -0
  86. package/lib/commonjs/index.js +13 -0
  87. package/lib/commonjs/index.js.map +1 -1
  88. package/lib/commonjs/renderer/Canvas.js +14 -5
  89. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  90. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
  91. package/lib/commonjs/renderer/components/colorFilters/Lerp.js +1 -1
  92. package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
  93. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +4 -2
  94. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  95. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +37 -0
  96. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  97. package/lib/commonjs/renderer/components/imageFilters/index.js +13 -0
  98. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  99. package/lib/commonjs/renderer/components/shaders/Gradient.js +1 -1
  100. package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
  101. package/lib/commonjs/renderer/components/shaders/Shader.js +2 -2
  102. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  103. package/lib/commonjs/renderer/processors/Circles.js +3 -2
  104. package/lib/commonjs/renderer/processors/Circles.js.map +1 -1
  105. package/lib/commonjs/renderer/processors/Font.js +1 -1
  106. package/lib/commonjs/renderer/processors/Font.js.map +1 -1
  107. package/lib/commonjs/renderer/processors/Rects.js +11 -21
  108. package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
  109. package/lib/commonjs/renderer/processors/math/Matrix3.js +42 -63
  110. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  111. package/lib/commonjs/renderer/processors/math/Vector.js +4 -5
  112. package/lib/commonjs/renderer/processors/math/Vector.js.map +1 -1
  113. package/lib/commonjs/skia/Color.js +14 -38
  114. package/lib/commonjs/skia/Color.js.map +1 -1
  115. package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  116. package/lib/commonjs/skia/Matrix.js.map +1 -1
  117. package/lib/commonjs/skia/Shader/useShader.js +4 -1
  118. package/lib/commonjs/skia/Shader/useShader.js.map +1 -1
  119. package/lib/commonjs/skia/Skia.js +3 -45
  120. package/lib/commonjs/skia/Skia.js.map +1 -1
  121. package/lib/commonjs/skia/SkiaApi.js +4 -0
  122. package/lib/commonjs/skia/SkiaApi.js.map +1 -0
  123. package/lib/commonjs/values/api.js +4 -6
  124. package/lib/commonjs/values/api.js.map +1 -1
  125. package/lib/commonjs/values/api.web.js +18 -0
  126. package/lib/commonjs/values/api.web.js.map +1 -0
  127. package/lib/commonjs/values/index.js +0 -13
  128. package/lib/commonjs/values/index.js.map +1 -1
  129. package/lib/commonjs/values/web/RNSkAnimation.js +46 -0
  130. package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -0
  131. package/lib/commonjs/values/web/RNSkClockValue.js +75 -0
  132. package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -0
  133. package/lib/commonjs/values/web/RNSkDerivedValue.js +51 -0
  134. package/lib/commonjs/values/web/RNSkDerivedValue.js.map +1 -0
  135. package/lib/commonjs/values/web/RNSkReadonlyValue.js +45 -0
  136. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -0
  137. package/lib/commonjs/values/web/RNSkValue.js +73 -0
  138. package/lib/commonjs/values/web/RNSkValue.js.map +1 -0
  139. package/lib/commonjs/values/web/api.js +31 -0
  140. package/lib/commonjs/values/web/api.js.map +1 -0
  141. package/lib/commonjs/values/web/index.js +19 -0
  142. package/lib/commonjs/values/web/index.js.map +1 -0
  143. package/lib/commonjs/views/SkiaView.js +13 -10
  144. package/lib/commonjs/views/SkiaView.js.map +1 -1
  145. package/lib/commonjs/views/api.js +11 -0
  146. package/lib/commonjs/views/api.js.map +1 -0
  147. package/lib/commonjs/views/types.js.map +1 -1
  148. package/lib/module/{values/animation → animation}/decay/decay.js +0 -0
  149. package/lib/module/{values/animation → animation}/decay/decay.js.map +0 -0
  150. package/lib/module/{values/animation → animation}/decay/index.js +0 -0
  151. package/lib/module/{values/animation → animation}/decay/index.js.map +0 -0
  152. package/lib/module/{values/animation → animation}/decay/runDecay.js +1 -1
  153. package/lib/module/animation/decay/runDecay.js.map +1 -0
  154. package/lib/module/{values/animation → animation}/decay/types.js +0 -0
  155. package/lib/module/{values/animation → animation}/decay/types.js.map +0 -0
  156. package/lib/module/{values/animation → animation}/functions/index.js +0 -0
  157. package/lib/module/{values/animation → animation}/functions/index.js.map +0 -0
  158. package/lib/module/animation/functions/interpolate.js +132 -0
  159. package/lib/module/animation/functions/interpolate.js.map +1 -0
  160. package/lib/module/animation/functions/interpolateColors.js +23 -0
  161. package/lib/module/animation/functions/interpolateColors.js.map +1 -0
  162. package/lib/module/{values/animation → animation}/index.js +0 -0
  163. package/lib/module/{values/animation → animation}/index.js.map +0 -0
  164. package/lib/module/{values/animation → animation}/spring/Spring.js +0 -0
  165. package/lib/module/{values/animation → animation}/spring/Spring.js.map +0 -0
  166. package/lib/module/{values/animation → animation}/spring/functions/index.js +0 -0
  167. package/lib/module/{values/animation → animation}/spring/functions/index.js.map +0 -0
  168. package/lib/module/{values/animation → animation}/spring/functions/spring.js +0 -0
  169. package/lib/module/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  170. package/lib/module/{values/animation → animation}/spring/index.js +0 -0
  171. package/lib/module/{values/animation → animation}/spring/index.js.map +0 -0
  172. package/lib/module/{values/animation → animation}/spring/runSpring.js +0 -0
  173. package/lib/module/animation/spring/runSpring.js.map +1 -0
  174. package/lib/module/{values/animation → animation}/spring/types.js +0 -0
  175. package/lib/module/{values/animation → animation}/spring/types.js.map +0 -0
  176. package/lib/module/{values/animation → animation}/spring/useSpring.js +0 -0
  177. package/lib/module/animation/spring/useSpring.js.map +1 -0
  178. package/lib/module/{values/animation → animation}/timing/Easing.js +0 -0
  179. package/lib/module/{values/animation → animation}/timing/Easing.js.map +0 -0
  180. package/lib/module/{values/animation → animation}/timing/createTiming.js +1 -1
  181. package/lib/module/animation/timing/createTiming.js.map +1 -0
  182. package/lib/module/{values/animation → animation}/timing/functions/bezier.js +0 -0
  183. package/lib/module/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  184. package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
  185. package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -0
  186. package/lib/module/{values/animation → animation}/timing/functions/index.js +0 -0
  187. package/lib/module/{values/animation → animation}/timing/functions/index.js.map +0 -0
  188. package/lib/module/{values/animation → animation}/timing/functions/timing.js +0 -0
  189. package/lib/module/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  190. package/lib/module/{values/animation → animation}/timing/functions/types.js +0 -0
  191. package/lib/module/{values/animation → animation}/timing/functions/types.js.map +0 -0
  192. package/lib/module/{values/animation → animation}/timing/index.js +0 -0
  193. package/lib/module/{values/animation → animation}/timing/index.js.map +0 -0
  194. package/lib/module/{values/animation → animation}/timing/runTiming.js +0 -0
  195. package/lib/module/animation/timing/runTiming.js.map +1 -0
  196. package/lib/module/{values/animation → animation}/timing/useLoop.js +0 -0
  197. package/lib/module/{values/animation → animation}/timing/useLoop.js.map +0 -0
  198. package/lib/module/{values/animation → animation}/timing/useTiming.js +1 -1
  199. package/lib/module/animation/timing/useTiming.js.map +1 -0
  200. package/lib/module/{values/animation → animation}/types.js +0 -0
  201. package/lib/module/{values/animation → animation}/types.js.map +0 -0
  202. package/lib/module/index.js +1 -0
  203. package/lib/module/index.js.map +1 -1
  204. package/lib/module/renderer/Canvas.js +10 -4
  205. package/lib/module/renderer/Canvas.js.map +1 -1
  206. package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
  207. package/lib/module/renderer/components/colorFilters/Lerp.js +1 -1
  208. package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
  209. package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -2
  210. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  211. package/lib/module/renderer/components/imageFilters/RuntimeShader.js +19 -0
  212. package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  213. package/lib/module/renderer/components/imageFilters/index.js +1 -0
  214. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  215. package/lib/module/renderer/components/shaders/Gradient.js +2 -2
  216. package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
  217. package/lib/module/renderer/components/shaders/Shader.js +3 -2
  218. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  219. package/lib/module/renderer/processors/Circles.js +3 -2
  220. package/lib/module/renderer/processors/Circles.js.map +1 -1
  221. package/lib/module/renderer/processors/Font.js +1 -1
  222. package/lib/module/renderer/processors/Font.js.map +1 -1
  223. package/lib/module/renderer/processors/Rects.js +9 -21
  224. package/lib/module/renderer/processors/Rects.js.map +1 -1
  225. package/lib/module/renderer/processors/math/Matrix3.js +52 -72
  226. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  227. package/lib/module/renderer/processors/math/Vector.js +3 -5
  228. package/lib/module/renderer/processors/math/Vector.js.map +1 -1
  229. package/lib/module/skia/Color.js +9 -25
  230. package/lib/module/skia/Color.js.map +1 -1
  231. package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  232. package/lib/module/skia/Matrix.js.map +1 -1
  233. package/lib/module/skia/Shader/useShader.js +4 -1
  234. package/lib/module/skia/Shader/useShader.js.map +1 -1
  235. package/lib/module/skia/Skia.js +2 -46
  236. package/lib/module/skia/Skia.js.map +1 -1
  237. package/lib/module/skia/SkiaApi.js +2 -0
  238. package/lib/module/skia/SkiaApi.js.map +1 -0
  239. package/lib/module/values/api.js +4 -6
  240. package/lib/module/values/api.js.map +1 -1
  241. package/lib/module/values/api.web.js +7 -0
  242. package/lib/module/values/api.web.js.map +1 -0
  243. package/lib/module/values/index.js +0 -1
  244. package/lib/module/values/index.js.map +1 -1
  245. package/lib/module/values/web/RNSkAnimation.js +36 -0
  246. package/lib/module/values/web/RNSkAnimation.js.map +1 -0
  247. package/lib/module/values/web/RNSkClockValue.js +65 -0
  248. package/lib/module/values/web/RNSkClockValue.js.map +1 -0
  249. package/lib/module/values/web/RNSkDerivedValue.js +41 -0
  250. package/lib/module/values/web/RNSkDerivedValue.js.map +1 -0
  251. package/lib/module/values/web/RNSkReadonlyValue.js +36 -0
  252. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -0
  253. package/lib/module/values/web/RNSkValue.js +63 -0
  254. package/lib/module/values/web/RNSkValue.js.map +1 -0
  255. package/lib/module/values/web/api.js +19 -0
  256. package/lib/module/values/web/api.js.map +1 -0
  257. package/lib/module/values/web/index.js +2 -0
  258. package/lib/module/values/web/index.js.map +1 -0
  259. package/lib/module/views/SkiaView.js +1 -3
  260. package/lib/module/views/SkiaView.js.map +1 -1
  261. package/lib/module/views/api.js +4 -0
  262. package/lib/module/views/api.js.map +1 -0
  263. package/lib/module/views/types.js.map +1 -1
  264. package/lib/typescript/src/{values/animation → animation}/decay/decay.d.ts +0 -0
  265. package/lib/typescript/src/{values/animation → animation}/decay/index.d.ts +0 -0
  266. package/lib/typescript/src/{values/animation → animation}/decay/runDecay.d.ts +2 -2
  267. package/lib/typescript/src/{values/animation → animation}/decay/types.d.ts +1 -1
  268. package/lib/typescript/src/{values/animation → animation}/functions/index.d.ts +0 -0
  269. package/lib/typescript/src/animation/functions/interpolate.d.ts +11 -0
  270. package/lib/typescript/src/animation/functions/interpolateColors.d.ts +3 -0
  271. package/lib/typescript/src/{values/animation → animation}/index.d.ts +0 -0
  272. package/lib/typescript/src/{values/animation → animation}/spring/Spring.d.ts +0 -0
  273. package/lib/typescript/src/{values/animation → animation}/spring/functions/index.d.ts +0 -0
  274. package/lib/typescript/src/{values/animation → animation}/spring/functions/spring.d.ts +0 -0
  275. package/lib/typescript/src/{values/animation → animation}/spring/index.d.ts +0 -0
  276. package/lib/typescript/src/{values/animation → animation}/spring/runSpring.d.ts +1 -1
  277. package/lib/typescript/src/{values/animation → animation}/spring/types.d.ts +0 -0
  278. package/lib/typescript/src/{values/animation → animation}/spring/useSpring.d.ts +1 -1
  279. package/lib/typescript/src/{values/animation → animation}/timing/Easing.d.ts +0 -0
  280. package/lib/typescript/src/{values/animation → animation}/timing/createTiming.d.ts +2 -2
  281. package/lib/typescript/src/{values/animation → animation}/timing/functions/bezier.d.ts +0 -0
  282. package/lib/typescript/src/{values/animation → animation}/timing/functions/getResolvedParams.d.ts +0 -0
  283. package/lib/typescript/src/{values/animation → animation}/timing/functions/index.d.ts +0 -0
  284. package/lib/typescript/src/{values/animation → animation}/timing/functions/timing.d.ts +1 -1
  285. package/lib/typescript/src/{values/animation → animation}/timing/functions/types.d.ts +0 -0
  286. package/lib/typescript/src/{values/animation → animation}/timing/index.d.ts +0 -0
  287. package/lib/typescript/src/{values/animation → animation}/timing/runTiming.d.ts +1 -1
  288. package/lib/typescript/src/{values/animation → animation}/timing/useLoop.d.ts +0 -0
  289. package/lib/typescript/src/{values/animation → animation}/timing/useTiming.d.ts +1 -1
  290. package/lib/typescript/src/{values/animation → animation}/types.d.ts +5 -5
  291. package/lib/typescript/src/index.d.ts +1 -0
  292. package/lib/typescript/src/renderer/Canvas.d.ts +6 -0
  293. package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +1 -1
  294. package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +7 -0
  295. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -0
  296. package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +1 -1
  297. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
  298. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -4
  299. package/lib/typescript/src/renderer/processors/Rects.d.ts +9 -41
  300. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -5
  301. package/lib/typescript/src/renderer/processors/math/Vector.d.ts +5 -17
  302. package/lib/typescript/src/skia/Color.d.ts +8 -9
  303. package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +16 -0
  304. package/lib/typescript/src/skia/Matrix.d.ts +7 -1
  305. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +2 -1
  306. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffectFactory.d.ts +2 -2
  307. package/lib/typescript/src/skia/Shader/useShader.d.ts +1 -1
  308. package/lib/typescript/src/skia/Skia.d.ts +28 -95
  309. package/lib/typescript/src/skia/SkiaApi.d.ts +71 -0
  310. package/lib/typescript/src/skia/Surface/Surface.d.ts +1 -1
  311. package/lib/typescript/src/skia/Surface/SurfaceFactory.d.ts +2 -2
  312. package/lib/typescript/src/values/api.d.ts +2 -25
  313. package/lib/typescript/src/values/api.web.d.ts +2 -0
  314. package/lib/typescript/src/values/index.d.ts +0 -1
  315. package/lib/typescript/src/values/types.d.ts +24 -1
  316. package/lib/typescript/src/values/web/RNSkAnimation.d.ts +9 -0
  317. package/lib/typescript/src/values/web/RNSkClockValue.d.ts +13 -0
  318. package/lib/typescript/src/values/web/RNSkDerivedValue.d.ts +9 -0
  319. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +11 -0
  320. package/lib/typescript/src/values/web/RNSkValue.d.ts +14 -0
  321. package/lib/typescript/src/values/web/api.d.ts +2 -0
  322. package/lib/typescript/src/values/web/index.d.ts +1 -0
  323. package/lib/typescript/src/views/SkiaView.d.ts +3 -36
  324. package/lib/typescript/src/views/api.d.ts +5 -0
  325. package/lib/typescript/src/views/types.d.ts +32 -0
  326. package/package.json +2 -2
  327. package/src/{values/animation → animation}/decay/decay.ts +0 -0
  328. package/src/{values/animation → animation}/decay/index.ts +0 -0
  329. package/src/{values/animation → animation}/decay/runDecay.ts +2 -2
  330. package/src/{values/animation → animation}/decay/types.ts +1 -1
  331. package/src/{values/animation → animation}/functions/index.ts +0 -0
  332. package/src/animation/functions/interpolate.ts +182 -0
  333. package/src/animation/functions/interpolateColors.ts +58 -0
  334. package/src/{values/animation → animation}/index.ts +0 -0
  335. package/src/{values/animation → animation}/spring/Spring.ts +0 -0
  336. package/src/{values/animation → animation}/spring/functions/index.ts +0 -0
  337. package/src/{values/animation → animation}/spring/functions/spring.ts +0 -0
  338. package/src/{values/animation → animation}/spring/index.ts +0 -0
  339. package/src/{values/animation → animation}/spring/runSpring.ts +1 -1
  340. package/src/{values/animation → animation}/spring/types.ts +0 -0
  341. package/src/{values/animation → animation}/spring/useSpring.ts +1 -1
  342. package/src/{values/animation → animation}/timing/Easing.ts +0 -0
  343. package/src/{values/animation → animation}/timing/createTiming.ts +2 -2
  344. package/src/{values/animation → animation}/timing/functions/__tests__/timing.spec.ts +0 -0
  345. package/src/{values/animation → animation}/timing/functions/bezier.ts +0 -0
  346. package/src/{values/animation → animation}/timing/functions/getResolvedParams.ts +2 -2
  347. package/src/{values/animation → animation}/timing/functions/index.ts +0 -0
  348. package/src/{values/animation → animation}/timing/functions/timing.ts +1 -1
  349. package/src/{values/animation → animation}/timing/functions/types.ts +0 -0
  350. package/src/{values/animation → animation}/timing/index.ts +0 -0
  351. package/src/{values/animation → animation}/timing/runTiming.ts +1 -1
  352. package/src/{values/animation → animation}/timing/useLoop.ts +0 -0
  353. package/src/{values/animation → animation}/timing/useTiming.ts +2 -2
  354. package/src/{values/animation → animation}/types.ts +5 -5
  355. package/src/index.ts +1 -0
  356. package/src/renderer/Canvas.tsx +11 -4
  357. package/src/renderer/components/colorFilters/BlendColor.tsx +1 -1
  358. package/src/renderer/components/colorFilters/Lerp.tsx +1 -1
  359. package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -2
  360. package/src/renderer/components/imageFilters/RuntimeShader.tsx +23 -0
  361. package/src/renderer/components/imageFilters/index.ts +1 -0
  362. package/src/renderer/components/shaders/Gradient.ts +2 -4
  363. package/src/renderer/components/shaders/Shader.tsx +3 -3
  364. package/src/renderer/processors/Circles.ts +2 -1
  365. package/src/renderer/processors/Font.ts +1 -1
  366. package/src/renderer/processors/Rects.ts +9 -14
  367. package/src/renderer/processors/math/Matrix3.ts +24 -105
  368. package/src/renderer/processors/math/Vector.ts +3 -2
  369. package/src/skia/Color.ts +13 -27
  370. package/src/skia/ImageFilter/ImageFilterFactory.ts +20 -0
  371. package/src/skia/Matrix.ts +8 -1
  372. package/src/skia/RuntimeEffect/RuntimeEffect.ts +3 -1
  373. package/src/skia/RuntimeEffect/RuntimeEffectFactory.ts +2 -2
  374. package/src/skia/Shader/useShader.ts +4 -1
  375. package/src/skia/Skia.ts +4 -126
  376. package/src/skia/SkiaApi.ts +86 -0
  377. package/src/skia/Surface/Surface.ts +1 -1
  378. package/src/skia/Surface/SurfaceFactory.ts +2 -2
  379. package/src/values/api.ts +3 -42
  380. package/src/values/api.web.ts +5 -0
  381. package/src/values/index.ts +0 -1
  382. package/src/values/types.ts +30 -1
  383. package/src/values/web/RNSkAnimation.ts +33 -0
  384. package/src/values/web/RNSkClockValue.ts +58 -0
  385. package/src/values/web/RNSkDerivedValue.ts +38 -0
  386. package/src/values/web/RNSkReadonlyValue.ts +32 -0
  387. package/src/values/web/RNSkValue.ts +57 -0
  388. package/src/values/web/__tests__/RNSkAnimation.spec.ts +21 -0
  389. package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +15 -0
  390. package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +8 -0
  391. package/src/values/web/__tests__/RNSkValue.spec.ts +11 -0
  392. package/src/values/web/api.ts +33 -0
  393. package/src/values/web/index.ts +1 -0
  394. package/src/views/SkiaView.tsx +3 -49
  395. package/src/views/api.ts +7 -0
  396. package/src/views/types.ts +40 -0
  397. package/lib/commonjs/values/animation/decay/runDecay.js.map +0 -1
  398. package/lib/commonjs/values/animation/functions/interpolate.js +0 -139
  399. package/lib/commonjs/values/animation/functions/interpolate.js.map +0 -1
  400. package/lib/commonjs/values/animation/functions/interpolateColors.js +0 -47
  401. package/lib/commonjs/values/animation/functions/interpolateColors.js.map +0 -1
  402. package/lib/commonjs/values/animation/spring/runSpring.js.map +0 -1
  403. package/lib/commonjs/values/animation/spring/useSpring.js.map +0 -1
  404. package/lib/commonjs/values/animation/timing/createTiming.js.map +0 -1
  405. package/lib/commonjs/values/animation/timing/functions/getResolvedParams.js.map +0 -1
  406. package/lib/commonjs/values/animation/timing/runTiming.js.map +0 -1
  407. package/lib/commonjs/values/animation/timing/useTiming.js.map +0 -1
  408. package/lib/module/values/animation/decay/runDecay.js.map +0 -1
  409. package/lib/module/values/animation/functions/interpolate.js +0 -132
  410. package/lib/module/values/animation/functions/interpolate.js.map +0 -1
  411. package/lib/module/values/animation/functions/interpolateColors.js +0 -32
  412. package/lib/module/values/animation/functions/interpolateColors.js.map +0 -1
  413. package/lib/module/values/animation/spring/runSpring.js.map +0 -1
  414. package/lib/module/values/animation/spring/useSpring.js.map +0 -1
  415. package/lib/module/values/animation/timing/createTiming.js.map +0 -1
  416. package/lib/module/values/animation/timing/functions/getResolvedParams.js.map +0 -1
  417. package/lib/module/values/animation/timing/runTiming.js.map +0 -1
  418. package/lib/module/values/animation/timing/useTiming.js.map +0 -1
  419. package/lib/typescript/scripts/install-npm.d.ts +0 -1
  420. package/lib/typescript/src/values/animation/functions/interpolate.d.ts +0 -7
  421. package/lib/typescript/src/values/animation/functions/interpolateColors.d.ts +0 -3
  422. package/src/values/animation/functions/interpolate.ts +0 -169
  423. package/src/values/animation/functions/interpolateColors.ts +0 -62
@@ -1,9 +1,8 @@
1
- export declare type SkColor = number;
2
- export declare type Color = string | number;
3
- export declare const alphaf: (c: number) => number;
4
- export declare const red: (c: number) => number;
5
- export declare const green: (c: number) => number;
6
- export declare const blue: (c: number) => number;
7
- export declare const rgbaColor: (r: number, g: number, b: number, af: number) => number;
8
- export declare const processColor: (cl: Color, currentOpacity: number) => number;
9
- export declare const processColorAsUnitArray: (cl: Color, currentOpacity: number) => readonly [number, number, number, number];
1
+ export declare type SkColor = Float32Array;
2
+ export declare type Color = string | Float32Array | number;
3
+ export declare const RED = 0;
4
+ export declare const GREEN = 1;
5
+ export declare const BLUE = 2;
6
+ export declare const ALPHA = 3;
7
+ export declare const rgbaColor: (r: number, g: number, b: number, a: number) => Float32Array;
8
+ export declare const processColor: (cl: Color, currentOpacity: number) => Float32Array;
@@ -3,6 +3,7 @@ import type { SkColorFilter } from "../ColorFilter/ColorFilter";
3
3
  import type { SkShader } from "../Shader/Shader";
4
4
  import type { SkRect } from "../Rect";
5
5
  import type { BlendMode } from "../Paint/BlendMode";
6
+ import type { SkRuntimeShaderBuilder } from "../RuntimeEffect";
6
7
  import type { SkImageFilter, TileMode } from "./ImageFilter";
7
8
  export declare enum ColorChannel {
8
9
  R = 0,
@@ -111,4 +112,19 @@ export interface ImageFilterFactory {
111
112
  * @cropRect Optional rectangle to crop input and output.
112
113
  */
113
114
  MakeBlend: (mode: BlendMode, background: SkImageFilter, foreground: SkImageFilter | null, cropRect?: SkRect) => SkImageFilter;
115
+ /**
116
+ * Create a filter that fills the output with the per-pixel evaluation of the SkShader produced
117
+ * by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate
118
+ * system, so it will automatically be affected by SkCanvas' transform.
119
+ *
120
+ * @param builder The builder used to produce the runtime shader, that will in turn
121
+ * fill the result image
122
+ * @param childShaderName The name of the child shader defined in the builder that will be
123
+ * bound to the input param (or the source image if the input param
124
+ * is null). If null the builder can have exactly one child shader,
125
+ * which automatically binds the input param.
126
+ * @param input The image filter that will be provided as input to the runtime
127
+ * shader. If null the implicit source image is used instead
128
+ */
129
+ MakeRuntimeShader: (builder: SkRuntimeShaderBuilder, childShaderName: string | null, input: SkImageFilter | null) => SkImageFilter;
114
130
  }
@@ -1,3 +1,4 @@
1
+ import type { SkJSIInstance } from "./JsiInstance";
1
2
  export declare enum MatrixIndex {
2
3
  ScaleX = 0,
3
4
  SkewX = 1,
@@ -9,7 +10,7 @@ export declare enum MatrixIndex {
9
10
  Persp1 = 7,
10
11
  persp2 = 8
11
12
  }
12
- export interface SkMatrix {
13
+ export interface SkMatrix extends SkJSIInstance<"Matrix"> {
13
14
  0: number;
14
15
  1: number;
15
16
  2: number;
@@ -19,4 +20,9 @@ export interface SkMatrix {
19
20
  6: number;
20
21
  7: number;
21
22
  8: number;
23
+ preConcat: (matrix: SkMatrix) => void;
24
+ preTranslate: (x: number, y: number) => void;
25
+ preScale: (x: number, y: number) => void;
26
+ preSkew: (x: number, y: number) => void;
27
+ preRotate: (theta: number) => void;
22
28
  }
@@ -8,7 +8,8 @@ export interface SkSLUniform {
8
8
  slot: number;
9
9
  isInteger: boolean;
10
10
  }
11
- export interface IRuntimeEffect extends SkJSIInstance<"RuntimeEffect"> {
11
+ export declare type SkRuntimeShaderBuilder = SkJSIInstance<"RuntimeShaderBuilder">;
12
+ export interface SkRuntimeEffect extends SkJSIInstance<"RuntimeEffect"> {
12
13
  /**
13
14
  * Returns a shader executed using the given uniform data.
14
15
  * @param uniforms
@@ -1,4 +1,4 @@
1
- import type { IRuntimeEffect } from "./RuntimeEffect";
1
+ import type { SkRuntimeEffect } from "./RuntimeEffect";
2
2
  export interface RuntimeEffectFactory {
3
3
  /**
4
4
  * Compiles a RuntimeEffect from the given shader code.
@@ -6,5 +6,5 @@ export interface RuntimeEffectFactory {
6
6
  * @param callback - will be called with any compilation error. If not provided, errors will
7
7
  * be printed to console.log().
8
8
  */
9
- Make: (sksl: string) => IRuntimeEffect | null;
9
+ Make: (sksl: string) => SkRuntimeEffect | null;
10
10
  }
@@ -1 +1 @@
1
- export declare const useShader: (sksl: string) => import("..").IRuntimeEffect | null;
1
+ export declare const useShader: (sksl: string) => import("..").SkRuntimeEffect | null;
@@ -1,108 +1,41 @@
1
- import type { ImageFilterFactory } from "./ImageFilter";
2
- import type { PathFactory } from "./Path";
3
- import type { ColorFilterFactory } from "./ColorFilter";
4
- import type { SkFont } from "./Font";
5
- import type { SkTypeface, TypefaceFactory } from "./Typeface";
6
- import type { ImageFactory } from "./Image";
7
- import type { MaskFilterFactory } from "./MaskFilter";
8
- import type { SkPaint } from "./Paint";
9
- import type { SkRect } from "./Rect";
10
- import type { SkRRect } from "./RRect";
11
- import type { RuntimeEffectFactory } from "./RuntimeEffect";
12
- import type { ShaderFactory } from "./Shader";
13
- import type { SkMatrix } from "./Matrix";
14
- import type { PathEffectFactory } from "./PathEffect";
15
- import type { SkPoint } from "./Point";
16
- import type { SkVertices, VertexMode } from "./Vertices/Vertices";
17
- import type { DataFactory } from "./Data";
18
- import type { SVGFactory } from "./SVG";
19
- import type { TextBlobFactory } from "./TextBlob";
20
- import type { FontMgrFactory } from "./FontMgr/FontMgrFactory";
21
- import type { SurfaceFactory } from "./Surface";
22
1
  import "./NativeSetup";
23
- import type { SkRSXform } from "./RSXform";
24
- import type { SkPath } from "./Path/Path";
25
- import type { SkContourMeasureIter } from "./ContourMeasure";
26
- import type { PictureFactory, SkPictureRecorder } from "./Picture";
27
- import type { Color, SkColor } from "./Color";
28
- /**
29
- * Declares the interface for the native Skia API
30
- */
31
- export interface Skia {
32
- Point: (x: number, y: number) => SkPoint;
33
- XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;
34
- RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;
35
- RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
36
- Color: (color: Color) => SkColor;
37
- parseColorString: (color: string) => SkColor | undefined;
38
- ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
39
- Paint: () => SkPaint;
40
- PictureRecorder: () => SkPictureRecorder;
41
- Picture: PictureFactory;
42
- Path: PathFactory;
43
- Matrix: () => SkMatrix;
44
- ColorFilter: ColorFilterFactory;
45
- Font: (typeface?: SkTypeface, size?: number) => SkFont;
46
- Typeface: TypefaceFactory;
47
- MaskFilter: MaskFilterFactory;
48
- RuntimeEffect: RuntimeEffectFactory;
49
- ImageFilter: ImageFilterFactory;
50
- Shader: ShaderFactory;
51
- PathEffect: PathEffectFactory;
52
- /**
53
- * Returns an Vertices based on the given positions and optional parameters.
54
- * See SkVertices.h (especially the Builder) for more details.
55
- * @param mode
56
- * @param positions
57
- * @param textureCoordinates
58
- * @param colors - either a list of int colors or a flattened color array.
59
- * @param indices
60
- * @param isVolatile
61
- */
62
- MakeVertices(mode: VertexMode, positions: SkPoint[], textureCoordinates?: SkPoint[] | null, colors?: SkColor[], indices?: number[] | null, isVolatile?: boolean): SkVertices;
63
- Data: DataFactory;
64
- Image: ImageFactory;
65
- SVG: SVGFactory;
66
- FontMgr: FontMgrFactory;
67
- TextBlob: TextBlobFactory;
68
- Surface: SurfaceFactory;
69
- }
2
+ import type { SkiaApi as SkSkiaApi } from "./SkiaApi";
70
3
  /**
71
4
  * Declares the SkiaApi as an available object in the global scope
72
5
  */
73
6
  declare global {
74
- var SkiaApi: Skia;
7
+ var SkiaApi: SkSkiaApi;
75
8
  }
76
9
  /**
77
10
  * Declares the implemented API with overrides.
78
11
  */
79
12
  export declare const Skia: {
80
- Typeface: TypefaceFactory;
81
- MaskFilter: MaskFilterFactory;
82
- RuntimeEffect: RuntimeEffectFactory;
83
- Shader: ShaderFactory;
84
- ImageFilter: ImageFilterFactory;
85
- PathEffect: PathEffectFactory;
86
- Data: DataFactory;
87
- SVG: SVGFactory;
88
- FontMgr: FontMgrFactory;
89
- TextBlob: TextBlobFactory;
90
- Matrix: () => SkMatrix;
91
- Font: (typeface?: SkTypeface | undefined, size?: number | undefined) => SkFont;
92
- Point: (x: number, y: number) => SkPoint;
93
- XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;
94
- RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;
95
- Paint: () => SkPaint;
96
- PictureRecorder: () => SkPictureRecorder;
97
- Picture: PictureFactory;
98
- Path: PathFactory;
99
- ColorFilter: ColorFilterFactory;
100
- ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
101
- Color: (cl: Color) => number;
102
- parseColorString: (color: string) => SkColor | undefined;
103
- RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
104
- MakeSurface: (width: number, height: number) => import("./Surface").ISurface | null;
13
+ Typeface: import("./Typeface").TypefaceFactory;
14
+ MaskFilter: import("./MaskFilter").MaskFilterFactory;
15
+ RuntimeEffect: import("./RuntimeEffect").RuntimeEffectFactory;
16
+ Shader: import("./Shader").ShaderFactory;
17
+ ImageFilter: import("./ImageFilter").ImageFilterFactory;
18
+ PathEffect: import("./PathEffect").PathEffectFactory;
19
+ Data: import("./Data").DataFactory;
20
+ SVG: import("./SVG").SVGFactory;
21
+ FontMgr: import("./FontMgr").FontMgrFactory;
22
+ TextBlob: import("./TextBlob").TextBlobFactory;
23
+ Matrix: () => import("./Matrix").SkMatrix;
24
+ Font: (typeface?: import("./Typeface").SkTypeface | undefined, size?: number | undefined) => import("./Font").SkFont;
25
+ Point: (x: number, y: number) => import("./Point").SkPoint;
26
+ XYWHRect: (x: number, y: number, width: number, height: number) => import("./Rect").SkRect;
27
+ RRectXY: (rect: import("./Rect").SkRect, rx: number, ry: number) => import("./RRect").SkRRect;
28
+ RuntimeShaderBuilder: (rt: import("./RuntimeEffect").SkRuntimeEffect) => import("./RuntimeEffect").SkRuntimeShaderBuilder;
29
+ Paint: () => import("./Paint").SkPaint;
30
+ PictureRecorder: () => import("./Picture").SkPictureRecorder;
31
+ Picture: import("./Picture").PictureFactory;
32
+ Path: import("./Path").PathFactory;
33
+ ColorFilter: import("./ColorFilter").ColorFilterFactory;
34
+ ContourMeasureIter: (path: import("./Path").SkPath, forceClosed: boolean, resScale: number) => import("./ContourMeasure").SkContourMeasureIter;
35
+ Color: (color: import("./Color").Color) => Float32Array;
36
+ RSXform: (scos: number, ssin: number, tx: number, ty: number) => import("./RSXform").SkRSXform;
37
+ MakeSurface: (width: number, height: number) => import("./Surface").SkSurface | null;
105
38
  MakeImageFromEncoded: (encoded: import("./Data").Data) => import("./Image").SkImage | null;
106
39
  MakeImage: (info: import("./Image").ImageInfo, data: import("./Data").Data, bytesPerRow: number) => import("./Image").SkImage | null;
107
- MakeVertices: (mode: VertexMode, positions: SkPoint[], textureCoordinates?: SkPoint[] | null | undefined, colors?: number[] | undefined, indices?: number[] | null | undefined, isVolatile?: boolean | undefined) => SkVertices;
40
+ MakeVertices: (mode: import("./Vertices").VertexMode, positions: import("./Point").SkPoint[], textureCoordinates?: import("./Point").SkPoint[] | null | undefined, colors?: Float32Array[] | undefined, indices?: number[] | null | undefined, isVolatile?: boolean | undefined) => import("./Vertices").SkVertices;
108
41
  };
@@ -0,0 +1,71 @@
1
+ import type { ImageFilterFactory } from "./ImageFilter";
2
+ import type { PathFactory } from "./Path";
3
+ import type { ColorFilterFactory } from "./ColorFilter";
4
+ import type { SkFont } from "./Font";
5
+ import type { SkTypeface, TypefaceFactory } from "./Typeface";
6
+ import type { ImageFactory } from "./Image";
7
+ import type { MaskFilterFactory } from "./MaskFilter";
8
+ import type { SkPaint } from "./Paint";
9
+ import type { SkRect } from "./Rect";
10
+ import type { SkRRect } from "./RRect";
11
+ import type { RuntimeEffectFactory } from "./RuntimeEffect";
12
+ import type { ShaderFactory } from "./Shader";
13
+ import type { SkMatrix } from "./Matrix";
14
+ import type { PathEffectFactory } from "./PathEffect";
15
+ import type { SkPoint } from "./Point";
16
+ import type { SkVertices, VertexMode } from "./Vertices/Vertices";
17
+ import type { DataFactory } from "./Data";
18
+ import type { SVGFactory } from "./SVG";
19
+ import type { TextBlobFactory } from "./TextBlob";
20
+ import type { FontMgrFactory } from "./FontMgr/FontMgrFactory";
21
+ import type { SurfaceFactory } from "./Surface";
22
+ import "./NativeSetup";
23
+ import type { SkRSXform } from "./RSXform";
24
+ import type { SkPath } from "./Path/Path";
25
+ import type { SkContourMeasureIter } from "./ContourMeasure";
26
+ import type { PictureFactory, SkPictureRecorder } from "./Picture";
27
+ import type { Color, SkColor } from "./Color";
28
+ import type { SkRuntimeShaderBuilder, SkRuntimeEffect } from "./RuntimeEffect/RuntimeEffect";
29
+ /**
30
+ * Declares the interface for the native Skia API
31
+ */
32
+ export interface SkiaApi {
33
+ Point: (x: number, y: number) => SkPoint;
34
+ XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;
35
+ RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;
36
+ RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;
37
+ RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
38
+ Color: (color: Color) => SkColor;
39
+ parseColorString: (color: string) => SkColor | undefined;
40
+ ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
41
+ Paint: () => SkPaint;
42
+ PictureRecorder: () => SkPictureRecorder;
43
+ Picture: PictureFactory;
44
+ Path: PathFactory;
45
+ Matrix: () => SkMatrix;
46
+ ColorFilter: ColorFilterFactory;
47
+ Font: (typeface?: SkTypeface, size?: number) => SkFont;
48
+ Typeface: TypefaceFactory;
49
+ MaskFilter: MaskFilterFactory;
50
+ RuntimeEffect: RuntimeEffectFactory;
51
+ ImageFilter: ImageFilterFactory;
52
+ Shader: ShaderFactory;
53
+ PathEffect: PathEffectFactory;
54
+ /**
55
+ * Returns an Vertices based on the given positions and optional parameters.
56
+ * See SkVertices.h (especially the Builder) for more details.
57
+ * @param mode
58
+ * @param positions
59
+ * @param textureCoordinates
60
+ * @param colors - either a list of int colors or a flattened color array.
61
+ * @param indices
62
+ * @param isVolatile
63
+ */
64
+ MakeVertices(mode: VertexMode, positions: SkPoint[], textureCoordinates?: SkPoint[] | null, colors?: SkColor[], indices?: number[] | null, isVolatile?: boolean): SkVertices;
65
+ Data: DataFactory;
66
+ Image: ImageFactory;
67
+ SVG: SVGFactory;
68
+ FontMgr: FontMgrFactory;
69
+ TextBlob: TextBlobFactory;
70
+ Surface: SurfaceFactory;
71
+ }
@@ -2,7 +2,7 @@ import type { SkImage } from "../Image";
2
2
  import type { SkCanvas } from "../Canvas";
3
3
  import type { SkJSIInstance } from "../JsiInstance";
4
4
  import type { SkRect } from "../Rect";
5
- export interface ISurface extends SkJSIInstance<"Surface"> {
5
+ export interface SkSurface extends SkJSIInstance<"Surface"> {
6
6
  /** Returns Canvas that draws into the surface. Subsequent calls return the
7
7
  same Canvas. Canvas returned is managed and owned by Surface, and is
8
8
  deleted when Surface is deleted.
@@ -1,4 +1,4 @@
1
- import type { ISurface } from "./Surface";
1
+ import type { SkSurface } from "./Surface";
2
2
  export interface SurfaceFactory {
3
3
  /**
4
4
  * Returns a CPU backed surface with the given dimensions, an SRGB colorspace, Unpremul
@@ -7,5 +7,5 @@ export interface SurfaceFactory {
7
7
  * @param width - number of pixels of the width of the drawable area.
8
8
  * @param height - number of pixels of the height of the drawable area.
9
9
  */
10
- Make: (width: number, height: number) => ISurface | null;
10
+ Make: (width: number, height: number) => SkSurface | null;
11
11
  }
@@ -1,29 +1,6 @@
1
- import type { SkiaAnimation, AnimationState, SkiaReadonlyValue, SkiaClockValue, SkiaValue } from "./types";
2
- export interface ISkiaValueApi {
3
- /**
4
- * Creates a new value that holds the initial value and that
5
- * can be changed.
6
- */
7
- createValue: <T>(initialValue: T) => SkiaValue<T>;
8
- /**
9
- * Creates a derived value. This is a calculated value that returns the result of
10
- * a function that is called with the values of the dependencies.
11
- */
12
- createDerivedValue: <R>(cb: () => R, values: Array<SkiaReadonlyValue<unknown>>) => SkiaReadonlyValue<R>;
13
- /**
14
- * Creates a clock value where the value is the number of milliseconds elapsed
15
- * since the clock was created
16
- */
17
- createClockValue: () => SkiaClockValue;
18
- /**
19
- * Creates an animation that is driven from a clock and updated every frame.
20
- * @param cb Callback to calculate next value from time.
21
- * @returns An animation object that can control a value.
22
- */
23
- createAnimation: <S extends AnimationState = AnimationState>(cb: (t: number, state: S | undefined) => S) => SkiaAnimation;
24
- }
1
+ import type { ISkiaValueApi } from "./types";
25
2
  declare global {
26
3
  var SkiaValueApi: ISkiaValueApi;
27
4
  }
28
5
  export declare const ValueApi: ISkiaValueApi;
29
- export declare const createValue: <T>(initialValue: T) => SkiaValue<T>, createDerivedValue: <R>(cb: () => R, values: Array<SkiaReadonlyValue<unknown>>) => SkiaReadonlyValue<R>;
6
+ export declare const createValue: <T>(initialValue: T) => import("./types").SkiaValue<T>, createDerivedValue: <R>(cb: () => R, values: import("./types").SkiaReadonlyValue<unknown>[]) => import("./types").SkiaReadonlyValue<R>;
@@ -0,0 +1,2 @@
1
+ export declare const ValueApi: import("./types").ISkiaValueApi;
2
+ export declare const createValue: <T>(initialValue: T) => import("./types").SkiaValue<T>, createDerivedValue: <R>(cb: () => R, values: import("./types").SkiaReadonlyValue<unknown>[]) => import("./types").SkiaReadonlyValue<R>;
@@ -1,4 +1,3 @@
1
1
  export * from "./types";
2
2
  export * from "./hooks";
3
- export * from "./animation";
4
3
  export * from "./api";
@@ -27,10 +27,33 @@ export interface SkiaClockValue extends SkiaReadonlyValue<number> {
27
27
  start: () => void;
28
28
  stop: () => void;
29
29
  }
30
- export interface SkiaAnimation {
30
+ export interface SkiaAnimation extends SkiaClockValue {
31
31
  cancel: () => void;
32
32
  }
33
33
  export interface AnimationState {
34
34
  current: number;
35
35
  finished: boolean;
36
36
  }
37
+ export interface ISkiaValueApi {
38
+ /**
39
+ * Creates a new value that holds the initial value and that
40
+ * can be changed.
41
+ */
42
+ createValue: <T>(initialValue: T) => SkiaValue<T>;
43
+ /**
44
+ * Creates a derived value. This is a calculated value that returns the result of
45
+ * a function that is called with the values of the dependencies.
46
+ */
47
+ createDerivedValue: <R>(cb: () => R, values: Array<SkiaReadonlyValue<unknown>>) => SkiaReadonlyValue<R>;
48
+ /**
49
+ * Creates a clock value where the value is the number of milliseconds elapsed
50
+ * since the clock was created
51
+ */
52
+ createClockValue: () => SkiaClockValue;
53
+ /**
54
+ * Creates an animation that is driven from a clock and updated every frame.
55
+ * @param cb Callback to calculate next value from time.
56
+ * @returns An animation object that can control a value.
57
+ */
58
+ createAnimation: <S extends AnimationState = AnimationState>(cb: (t: number, state: S | undefined) => S) => SkiaAnimation;
59
+ }
@@ -0,0 +1,9 @@
1
+ import type { AnimationState, SkiaAnimation } from "../types";
2
+ import { RNSkClockValue } from "./RNSkClockValue";
3
+ export declare class RNSkAnimation<S extends AnimationState = AnimationState> extends RNSkClockValue implements SkiaAnimation {
4
+ constructor(callback: (t: number, state: S | undefined) => S, raf: (callback: (time: number) => void) => number);
5
+ private _callback;
6
+ private _animationState;
7
+ cancel(): void;
8
+ protected update(nextValue: number): void;
9
+ }
@@ -0,0 +1,13 @@
1
+ import type { SkiaClockValue } from "../types";
2
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
3
+ export declare class RNSkClockValue extends RNSkReadonlyValue<number> implements SkiaClockValue {
4
+ constructor(raf: (callback: (time: number) => void) => number);
5
+ private _raf;
6
+ private _start;
7
+ private _stop;
8
+ private _state;
9
+ private notifyUpdate;
10
+ protected tick(value: number): void;
11
+ start(): void;
12
+ stop(): void;
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { DependencyList } from "react";
2
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
3
+ export declare class RNSkDerivedValue<T> extends RNSkReadonlyValue<T> {
4
+ constructor(callback: () => T, dependencies: DependencyList);
5
+ private dependecyUpdated;
6
+ private _callback;
7
+ private _unsubscribers;
8
+ unsubscribe(): void;
9
+ }
@@ -0,0 +1,11 @@
1
+ import type { SkiaReadonlyValue } from "../types";
2
+ export declare class RNSkReadonlyValue<T> implements SkiaReadonlyValue<T> {
3
+ constructor(value: T);
4
+ private _current;
5
+ private _listeners;
6
+ private notifyListeners;
7
+ protected update(nextValue: T): void;
8
+ readonly __typename__ = "RNSkValue";
9
+ get current(): T;
10
+ addListener(cb: (value: T) => void): () => void;
11
+ }
@@ -0,0 +1,14 @@
1
+ import type { SkiaAnimation, SkiaValue } from "../types";
2
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
3
+ export declare class RNSkValue<T> extends RNSkReadonlyValue<T> implements SkiaValue<T> {
4
+ constructor(value: T);
5
+ set current(value: T);
6
+ get current(): T;
7
+ private _unsubscribe;
8
+ private unsubscribe;
9
+ private subscribe;
10
+ private animationDidUpdate;
11
+ private _animation;
12
+ get animation(): SkiaAnimation | undefined;
13
+ set animation(v: SkiaAnimation | undefined);
14
+ }
@@ -0,0 +1,2 @@
1
+ import type { ISkiaValueApi } from "../types";
2
+ export declare const ValueApi: ISkiaValueApi;
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -1,40 +1,7 @@
1
1
  import React from "react";
2
- import type { ViewProps } from "react-native";
3
- import type { SkImage, SkRect } from "../skia";
2
+ import type { SkRect } from "../skia";
4
3
  import type { SkiaReadonlyValue } from "../values";
5
- import type { DrawMode, RNSkiaDrawCallback } from "./types";
6
- declare global {
7
- var SkiaViewApi: {
8
- invalidateSkiaView: (nativeId: number) => void;
9
- makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
10
- setDrawCallback: (nativeId: number, callback: RNSkiaDrawCallback | undefined) => void;
11
- setDrawMode: (nativeId: number, mode: DrawMode) => void;
12
- registerValuesInView: (nativeId: number, values: SkiaReadonlyValue<unknown>[]) => () => void;
13
- };
14
- }
15
- export interface SkiaViewProps extends ViewProps {
16
- /**
17
- * Sets the drawing mode for the skia view. There are two drawing
18
- * modes, "continuous" and "default", where the continuous mode will
19
- * continuously redraw the view, and the default mode will only
20
- * redraw when any of the regular react properties are changed like
21
- * sizes and margins.
22
- */
23
- mode?: DrawMode;
24
- /**
25
- * When set to true the view will display information about the
26
- * average time it takes to render.
27
- */
28
- debug?: boolean;
29
- /**
30
- * Draw callback. Will be called whenever the view is invalidated and
31
- * needs to redraw. This is either caused by a change in a react
32
- * property, a touch event, or a call to redraw. If the view is in
33
- * continuous mode the callback will be called 60 frames per second
34
- * by the native view.
35
- */
36
- onDraw?: RNSkiaDrawCallback;
37
- }
4
+ import type { DrawMode, SkiaViewProps } from "./types";
38
5
  export declare class SkiaView extends React.Component<SkiaViewProps> {
39
6
  constructor(props: SkiaViewProps);
40
7
  private _nativeId;
@@ -45,7 +12,7 @@ export declare class SkiaView extends React.Component<SkiaViewProps> {
45
12
  * @param rect Rect to use as bounds. Optional.
46
13
  * @returns An Image object.
47
14
  */
48
- makeImageSnapshot(rect?: SkRect): SkImage;
15
+ makeImageSnapshot(rect?: SkRect): import("../skia").SkImage;
49
16
  /**
50
17
  * Sends a redraw request to the native SkiaView.
51
18
  */
@@ -0,0 +1,5 @@
1
+ import type { ISkiaViewApi } from "./types";
2
+ declare global {
3
+ var SkiaViewApi: ISkiaViewApi;
4
+ }
5
+ export declare const SkiaViewApi: ISkiaViewApi;
@@ -1,5 +1,7 @@
1
1
  import type { ViewProps } from "react-native";
2
+ import type { SkImage, SkRect } from "../skia";
2
3
  import type { SkCanvas } from "../skia/Canvas";
4
+ import type { SkiaReadonlyValue } from "../values";
3
5
  export declare type DrawMode = "continuous" | "default";
4
6
  export declare type NativeSkiaViewProps = ViewProps & {
5
7
  mode?: DrawMode;
@@ -42,3 +44,33 @@ export interface ValueListener {
42
44
  addListener: (callback: () => void) => number;
43
45
  removeListener: (id: number) => void;
44
46
  }
47
+ export interface ISkiaViewApi {
48
+ invalidateSkiaView: (nativeId: number) => void;
49
+ makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
50
+ setDrawCallback: (nativeId: number, callback: RNSkiaDrawCallback | undefined) => void;
51
+ setDrawMode: (nativeId: number, mode: DrawMode) => void;
52
+ registerValuesInView: (nativeId: number, values: SkiaReadonlyValue<unknown>[]) => () => void;
53
+ }
54
+ export interface SkiaViewProps extends ViewProps {
55
+ /**
56
+ * Sets the drawing mode for the skia view. There are two drawing
57
+ * modes, "continuous" and "default", where the continuous mode will
58
+ * continuously redraw the view, and the default mode will only
59
+ * redraw when any of the regular react properties are changed like
60
+ * sizes and margins.
61
+ */
62
+ mode?: DrawMode;
63
+ /**
64
+ * When set to true the view will display information about the
65
+ * average time it takes to render.
66
+ */
67
+ debug?: boolean;
68
+ /**
69
+ * Draw callback. Will be called whenever the view is invalidated and
70
+ * needs to redraw. This is either caused by a change in a react
71
+ * property, a touch event, or a call to redraw. If the view is in
72
+ * continuous mode the callback will be called 60 frames per second
73
+ * by the native view.
74
+ */
75
+ onDraw?: RNSkiaDrawCallback;
76
+ }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "React Native Skia",
7
- "version": "0.1.123",
7
+ "version": "0.1.126",
8
8
  "description": "High-performance React Native Graphics using Skia",
9
9
  "main": "lib/module/index.js",
10
10
  "files": [
@@ -76,7 +76,7 @@
76
76
  "react-native": "0.66.2",
77
77
  "react-native-builder-bob": "^0.18.2",
78
78
  "ts-jest": "^27.0.7",
79
- "typescript": "^4.6.2"
79
+ "typescript": "^4.6.4"
80
80
  },
81
81
  "dependencies": {
82
82
  "react-reconciler": "^0.26.2"
@@ -1,5 +1,5 @@
1
- import { ValueApi } from "../../api";
2
- import type { SkiaValue } from "../../types";
1
+ import { ValueApi } from "../../values/api";
2
+ import type { SkiaValue } from "../../values/types";
3
3
 
4
4
  import { decay } from "./decay";
5
5
  import type { DecayConfig, DefaultDecayConfig, DecayState } from "./types";
@@ -1,4 +1,4 @@
1
- import type { AnimationState } from "../../types";
1
+ import type { AnimationState } from "../../values/types";
2
2
 
3
3
  export interface DecayConfig {
4
4
  from?: number;