@shopify/react-native-skia 0.1.150 → 0.1.152

Sign up to get free protection for your applications and to get access to all the features.
Files changed (774) hide show
  1. package/android/CMakeLists.txt +4 -5
  2. package/android/cpp/jni/JniLoad.cpp +7 -5
  3. package/android/cpp/jni/JniSkiaManager.cpp +2 -15
  4. package/android/cpp/jni/include/JniSkiaBaseView.h +68 -0
  5. package/android/cpp/jni/include/JniSkiaDrawView.h +64 -47
  6. package/android/cpp/jni/include/JniSkiaManager.h +8 -10
  7. package/android/cpp/jni/include/JniSkiaPictureView.h +96 -0
  8. package/android/cpp/rnskia-android/{RNSkPlatformContextImpl.h → RNSkAndroidPlatformContext.h} +4 -4
  9. package/android/cpp/rnskia-android/RNSkAndroidView.h +100 -0
  10. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +91 -0
  11. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +39 -0
  12. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +15 -6
  13. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +5 -4
  14. package/android/src/main/java/com/shopify/reactnative/skia/PlatformContext.java +5 -11
  15. package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
  16. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +143 -0
  17. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +17 -145
  18. package/android/src/main/java/com/shopify/reactnative/skia/{RNSkiaViewManager.java → SkiaDrawViewManager.java} +4 -15
  19. package/android/src/main/java/com/shopify/reactnative/skia/SkiaManager.java +1 -10
  20. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +45 -0
  21. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureViewManager.java +64 -0
  22. package/cpp/jsi/JsiValueWrapper.h +11 -0
  23. package/cpp/rnskia/RNSkInfoParameter.h +4 -14
  24. package/cpp/rnskia/RNSkJsView.cpp +211 -0
  25. package/cpp/rnskia/RNSkJsView.h +115 -0
  26. package/cpp/rnskia/RNSkJsiViewApi.h +6 -6
  27. package/cpp/rnskia/RNSkManager.cpp +7 -7
  28. package/cpp/rnskia/RNSkManager.h +7 -7
  29. package/cpp/rnskia/RNSkPictureView.h +124 -0
  30. package/cpp/rnskia/RNSkView.h +287 -0
  31. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +38 -0
  32. package/ios/RNSkia-iOS/{RNSkDrawViewImpl.mm → RNSkMetalCanvasProvider.mm} +40 -23
  33. package/ios/RNSkia-iOS/{PlatformContext.h → RNSkiOSPlatformContext.h} +4 -4
  34. package/ios/RNSkia-iOS/{PlatformContext.mm → RNSkiOSPlatformContext.mm} +5 -5
  35. package/ios/RNSkia-iOS/RNSkiOSView.h +34 -0
  36. package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +19 -11
  37. package/ios/RNSkia-iOS/SkiaManager.mm +3 -3
  38. package/ios/RNSkia-iOS/SkiaPictureViewManager.h +8 -0
  39. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +51 -0
  40. package/ios/RNSkia-iOS/SkiaUIView.h +26 -0
  41. package/ios/RNSkia-iOS/{SkiaDrawView.mm → SkiaUIView.mm} +29 -23
  42. package/lib/commonjs/animation/decay/decay.js.map +1 -1
  43. package/lib/commonjs/animation/decay/index.js.map +1 -1
  44. package/lib/commonjs/animation/decay/runDecay.js.map +1 -1
  45. package/lib/commonjs/animation/decay/types.js.map +1 -1
  46. package/lib/commonjs/animation/functions/index.js.map +1 -1
  47. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  48. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -1
  49. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  50. package/lib/commonjs/animation/functions/interpolateVector.js.map +1 -1
  51. package/lib/commonjs/animation/index.js.map +1 -1
  52. package/lib/commonjs/animation/spring/Spring.js.map +1 -1
  53. package/lib/commonjs/animation/spring/functions/index.js.map +1 -1
  54. package/lib/commonjs/animation/spring/functions/spring.js.map +1 -1
  55. package/lib/commonjs/animation/spring/index.js.map +1 -1
  56. package/lib/commonjs/animation/spring/runSpring.js +1 -1
  57. package/lib/commonjs/animation/spring/runSpring.js.map +1 -1
  58. package/lib/commonjs/animation/spring/types.js.map +1 -1
  59. package/lib/commonjs/animation/spring/useSpring.js +1 -1
  60. package/lib/commonjs/animation/spring/useSpring.js.map +1 -1
  61. package/lib/commonjs/animation/timing/Easing.js.map +1 -1
  62. package/lib/commonjs/animation/timing/createTiming.js +2 -6
  63. package/lib/commonjs/animation/timing/createTiming.js.map +1 -1
  64. package/lib/commonjs/animation/timing/functions/bezier.js.map +1 -1
  65. package/lib/commonjs/animation/timing/functions/getResolvedParams.js +6 -10
  66. package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +1 -1
  67. package/lib/commonjs/animation/timing/functions/index.js.map +1 -1
  68. package/lib/commonjs/animation/timing/functions/timing.js.map +1 -1
  69. package/lib/commonjs/animation/timing/functions/types.js.map +1 -1
  70. package/lib/commonjs/animation/timing/index.js.map +1 -1
  71. package/lib/commonjs/animation/timing/runTiming.js.map +1 -1
  72. package/lib/commonjs/animation/timing/useLoop.js.map +1 -1
  73. package/lib/commonjs/animation/timing/useTiming.js +1 -3
  74. package/lib/commonjs/animation/timing/useTiming.js.map +1 -1
  75. package/lib/commonjs/animation/types.js.map +1 -1
  76. package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
  77. package/lib/commonjs/dom/nodes/GroupNode.js.map +1 -1
  78. package/lib/commonjs/dom/nodes/JsiSkDOM.js +1 -1
  79. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  80. package/lib/commonjs/dom/nodes/Node.js.map +1 -1
  81. package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
  82. package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
  83. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  84. package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
  85. package/lib/commonjs/dom/nodes/datatypes/Color.js.map +1 -1
  86. package/lib/commonjs/dom/nodes/datatypes/Enum.js.map +1 -1
  87. package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
  88. package/lib/commonjs/dom/nodes/datatypes/Gradient.js +2 -2
  89. package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
  90. package/lib/commonjs/dom/nodes/datatypes/Path.js.map +1 -1
  91. package/lib/commonjs/dom/nodes/datatypes/Radius.js.map +1 -1
  92. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  93. package/lib/commonjs/dom/nodes/datatypes/Transform.js.map +1 -1
  94. package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -1
  95. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
  96. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  97. package/lib/commonjs/dom/nodes/drawings/CircleNode.js.map +1 -1
  98. package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js.map +1 -1
  99. package/lib/commonjs/dom/nodes/drawings/DiffRectNode.js.map +1 -1
  100. package/lib/commonjs/dom/nodes/drawings/FillNode.js.map +1 -1
  101. package/lib/commonjs/dom/nodes/drawings/ImageNode.js.map +1 -1
  102. package/lib/commonjs/dom/nodes/drawings/ImageSVG.js.map +1 -1
  103. package/lib/commonjs/dom/nodes/drawings/LineNode.js.map +1 -1
  104. package/lib/commonjs/dom/nodes/drawings/OvalNode.js.map +1 -1
  105. package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -1
  106. package/lib/commonjs/dom/nodes/drawings/PathNode.js.map +1 -1
  107. package/lib/commonjs/dom/nodes/drawings/PictureNode.js.map +1 -1
  108. package/lib/commonjs/dom/nodes/drawings/PointsNode.js.map +1 -1
  109. package/lib/commonjs/dom/nodes/drawings/RRectNode.js.map +1 -1
  110. package/lib/commonjs/dom/nodes/drawings/RectNode.js.map +1 -1
  111. package/lib/commonjs/dom/nodes/drawings/Text.js.map +1 -1
  112. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -1
  113. package/lib/commonjs/dom/nodes/drawings/index.js.map +1 -1
  114. package/lib/commonjs/dom/nodes/index.js.map +1 -1
  115. package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
  116. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  117. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  118. package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
  119. package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
  120. package/lib/commonjs/dom/nodes/paint/Shaders.js +2 -4
  121. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  122. package/lib/commonjs/dom/nodes/paint/index.js.map +1 -1
  123. package/lib/commonjs/dom/types/ColorFilters.js.map +1 -1
  124. package/lib/commonjs/dom/types/Common.js.map +1 -1
  125. package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
  126. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  127. package/lib/commonjs/dom/types/ImageFilters.js.map +1 -1
  128. package/lib/commonjs/dom/types/MaskFilters.js.map +1 -1
  129. package/lib/commonjs/dom/types/Node.js.map +1 -1
  130. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  131. package/lib/commonjs/dom/types/PathEffects.js.map +1 -1
  132. package/lib/commonjs/dom/types/Shaders.js.map +1 -1
  133. package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
  134. package/lib/commonjs/dom/types/index.js.map +1 -1
  135. package/lib/commonjs/external/index.js.map +1 -1
  136. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  137. package/lib/commonjs/external/reanimated/useSharedValueEffect.js.map +1 -1
  138. package/lib/commonjs/index.js.map +1 -1
  139. package/lib/commonjs/mock/index.js +6 -10
  140. package/lib/commonjs/mock/index.js.map +1 -1
  141. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  142. package/lib/commonjs/renderer/Container.js.map +1 -1
  143. package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
  144. package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
  145. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  146. package/lib/commonjs/renderer/HostConfig.js +0 -2
  147. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  148. package/lib/commonjs/renderer/components/Blend.js.map +1 -1
  149. package/lib/commonjs/renderer/components/Drawing.js.map +1 -1
  150. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  151. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  152. package/lib/commonjs/renderer/components/Paint.js +1 -1
  153. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  154. package/lib/commonjs/renderer/components/Picture.js.map +1 -1
  155. package/lib/commonjs/renderer/components/backdrop/BackdropBlur.js +1 -1
  156. package/lib/commonjs/renderer/components/backdrop/BackdropBlur.js.map +1 -1
  157. package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  158. package/lib/commonjs/renderer/components/backdrop/index.js.map +1 -1
  159. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
  160. package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
  161. package/lib/commonjs/renderer/components/colorFilters/LinearToSRGBGamma.js.map +1 -1
  162. package/lib/commonjs/renderer/components/colorFilters/LumaColorFilter.js.map +1 -1
  163. package/lib/commonjs/renderer/components/colorFilters/Matrix.js.map +1 -1
  164. package/lib/commonjs/renderer/components/colorFilters/SRGBToLinearGamma.js.map +1 -1
  165. package/lib/commonjs/renderer/components/colorFilters/index.js.map +1 -1
  166. package/lib/commonjs/renderer/components/image/Image.js.map +1 -1
  167. package/lib/commonjs/renderer/components/image/ImageSVG.js.map +1 -1
  168. package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
  169. package/lib/commonjs/renderer/components/image/index.js.map +1 -1
  170. package/lib/commonjs/renderer/components/imageFilters/Blur.js.map +1 -1
  171. package/lib/commonjs/renderer/components/imageFilters/DisplacementMap.js.map +1 -1
  172. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  173. package/lib/commonjs/renderer/components/imageFilters/Offset.js.map +1 -1
  174. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -1
  175. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
  176. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  177. package/lib/commonjs/renderer/components/index.js.map +1 -1
  178. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  179. package/lib/commonjs/renderer/components/maskFilters/index.js.map +1 -1
  180. package/lib/commonjs/renderer/components/pathEffects/Corner.js.map +1 -1
  181. package/lib/commonjs/renderer/components/pathEffects/Dash.js.map +1 -1
  182. package/lib/commonjs/renderer/components/pathEffects/Discrete.js.map +1 -1
  183. package/lib/commonjs/renderer/components/pathEffects/Line2D.js.map +1 -1
  184. package/lib/commonjs/renderer/components/pathEffects/Path1D.js.map +1 -1
  185. package/lib/commonjs/renderer/components/pathEffects/Path2D.js.map +1 -1
  186. package/lib/commonjs/renderer/components/pathEffects/Sum.js.map +1 -1
  187. package/lib/commonjs/renderer/components/pathEffects/index.js.map +1 -1
  188. package/lib/commonjs/renderer/components/shaders/Color.js.map +1 -1
  189. package/lib/commonjs/renderer/components/shaders/FractalNoise.js.map +1 -1
  190. package/lib/commonjs/renderer/components/shaders/LinearGradient.js.map +1 -1
  191. package/lib/commonjs/renderer/components/shaders/RadialGradient.js.map +1 -1
  192. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  193. package/lib/commonjs/renderer/components/shaders/ShaderLib.js.map +1 -1
  194. package/lib/commonjs/renderer/components/shaders/SweepGradient.js.map +1 -1
  195. package/lib/commonjs/renderer/components/shaders/Turbulence.js.map +1 -1
  196. package/lib/commonjs/renderer/components/shaders/TwoPointConicalGradient.js.map +1 -1
  197. package/lib/commonjs/renderer/components/shaders/index.js.map +1 -1
  198. package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -1
  199. package/lib/commonjs/renderer/components/shapes/Circle.js.map +1 -1
  200. package/lib/commonjs/renderer/components/shapes/DiffRect.js.map +1 -1
  201. package/lib/commonjs/renderer/components/shapes/Fill.js.map +1 -1
  202. package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
  203. package/lib/commonjs/renderer/components/shapes/Line.js.map +1 -1
  204. package/lib/commonjs/renderer/components/shapes/Oval.js.map +1 -1
  205. package/lib/commonjs/renderer/components/shapes/Patch.js.map +1 -1
  206. package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
  207. package/lib/commonjs/renderer/components/shapes/Points.js.map +1 -1
  208. package/lib/commonjs/renderer/components/shapes/Rect.js.map +1 -1
  209. package/lib/commonjs/renderer/components/shapes/RoundedRect.js.map +1 -1
  210. package/lib/commonjs/renderer/components/shapes/Vertices.js.map +1 -1
  211. package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
  212. package/lib/commonjs/renderer/components/text/Glyphs.js.map +1 -1
  213. package/lib/commonjs/renderer/components/text/Text.js.map +1 -1
  214. package/lib/commonjs/renderer/components/text/TextBlob.js.map +1 -1
  215. package/lib/commonjs/renderer/components/text/TextPath.js.map +1 -1
  216. package/lib/commonjs/renderer/components/text/index.js.map +1 -1
  217. package/lib/commonjs/renderer/index.js.map +1 -1
  218. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  219. package/lib/commonjs/renderer/processors/Animations/index.js.map +1 -1
  220. package/lib/commonjs/renderer/processors/index.js.map +1 -1
  221. package/lib/commonjs/renderer/processors/math/Coordinates.js.map +1 -1
  222. package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
  223. package/lib/commonjs/renderer/processors/math/Transforms.js.map +1 -1
  224. package/lib/commonjs/renderer/processors/math/index.js.map +1 -1
  225. package/lib/commonjs/renderer/typeddash.js.map +1 -1
  226. package/lib/commonjs/renderer/useCanvas.js.map +1 -1
  227. package/lib/commonjs/renderer/useContextBridge.js.map +1 -1
  228. package/lib/commonjs/skia/NativeSetup.js.map +1 -1
  229. package/lib/commonjs/skia/Skia.js.map +1 -1
  230. package/lib/commonjs/skia/Skia.web.js.map +1 -1
  231. package/lib/commonjs/skia/core/Data.js.map +1 -1
  232. package/lib/commonjs/skia/core/Font.js.map +1 -1
  233. package/lib/commonjs/skia/core/Image.js.map +1 -1
  234. package/lib/commonjs/skia/core/Matrix.js.map +1 -1
  235. package/lib/commonjs/skia/core/Picture.js.map +1 -1
  236. package/lib/commonjs/skia/core/RRect.js.map +1 -1
  237. package/lib/commonjs/skia/core/Rect.js.map +1 -1
  238. package/lib/commonjs/skia/core/SVG.js.map +1 -1
  239. package/lib/commonjs/skia/core/Typeface.js.map +1 -1
  240. package/lib/commonjs/skia/core/Vector.js +1 -1
  241. package/lib/commonjs/skia/core/Vector.js.map +1 -1
  242. package/lib/commonjs/skia/core/index.js.map +1 -1
  243. package/lib/commonjs/skia/index.js.map +1 -1
  244. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  245. package/lib/commonjs/skia/types/Color.js.map +1 -1
  246. package/lib/commonjs/skia/types/ColorFilter/ColorFilter.js.map +1 -1
  247. package/lib/commonjs/skia/types/ColorFilter/ColorFilterFactory.js.map +1 -1
  248. package/lib/commonjs/skia/types/ColorFilter/index.js.map +1 -1
  249. package/lib/commonjs/skia/types/ContourMeasure.js.map +1 -1
  250. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  251. package/lib/commonjs/skia/types/Data/DataFactory.js.map +1 -1
  252. package/lib/commonjs/skia/types/Data/index.js.map +1 -1
  253. package/lib/commonjs/skia/types/Font/Font.js.map +1 -1
  254. package/lib/commonjs/skia/types/Font/index.js.map +1 -1
  255. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  256. package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
  257. package/lib/commonjs/skia/types/Image/index.js.map +1 -1
  258. package/lib/commonjs/skia/types/ImageFilter/ImageFilter.js.map +1 -1
  259. package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
  260. package/lib/commonjs/skia/types/ImageFilter/index.js.map +1 -1
  261. package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
  262. package/lib/commonjs/skia/types/MaskFilter.js.map +1 -1
  263. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  264. package/lib/commonjs/skia/types/Paint/BlendMode.js.map +1 -1
  265. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  266. package/lib/commonjs/skia/types/Paint/index.js.map +1 -1
  267. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  268. package/lib/commonjs/skia/types/Path/PathFactory.js.map +1 -1
  269. package/lib/commonjs/skia/types/Path/index.js.map +1 -1
  270. package/lib/commonjs/skia/types/PathEffect.js.map +1 -1
  271. package/lib/commonjs/skia/types/Picture/Picture.js.map +1 -1
  272. package/lib/commonjs/skia/types/Picture/PictureFactory.js.map +1 -1
  273. package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
  274. package/lib/commonjs/skia/types/Picture/index.js.map +1 -1
  275. package/lib/commonjs/skia/types/Point.js.map +1 -1
  276. package/lib/commonjs/skia/types/RRect.js.map +1 -1
  277. package/lib/commonjs/skia/types/RSXform.js.map +1 -1
  278. package/lib/commonjs/skia/types/Rect.js.map +1 -1
  279. package/lib/commonjs/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  280. package/lib/commonjs/skia/types/RuntimeEffect/RuntimeEffectFactory.js.map +1 -1
  281. package/lib/commonjs/skia/types/RuntimeEffect/index.js.map +1 -1
  282. package/lib/commonjs/skia/types/SVG/SVG.js.map +1 -1
  283. package/lib/commonjs/skia/types/SVG/SVGFactory.js.map +1 -1
  284. package/lib/commonjs/skia/types/SVG/index.js.map +1 -1
  285. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  286. package/lib/commonjs/skia/types/Shader/ShaderFactory.js.map +1 -1
  287. package/lib/commonjs/skia/types/Shader/index.js.map +1 -1
  288. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  289. package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
  290. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  291. package/lib/commonjs/skia/types/Surface/index.js.map +1 -1
  292. package/lib/commonjs/skia/types/TextBlob.js.map +1 -1
  293. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  294. package/lib/commonjs/skia/types/Typeface/TypefaceFactory.js.map +1 -1
  295. package/lib/commonjs/skia/types/Typeface/index.js.map +1 -1
  296. package/lib/commonjs/skia/types/Vertices/Vertices.js.map +1 -1
  297. package/lib/commonjs/skia/types/Vertices/index.js.map +1 -1
  298. package/lib/commonjs/skia/types/index.js.map +1 -1
  299. package/lib/commonjs/skia/web/Host.js +1 -1
  300. package/lib/commonjs/skia/web/Host.js.map +1 -1
  301. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  302. package/lib/commonjs/skia/web/JsiSkColor.js.map +1 -1
  303. package/lib/commonjs/skia/web/JsiSkColorFilter.js.map +1 -1
  304. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  305. package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
  306. package/lib/commonjs/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  307. package/lib/commonjs/skia/web/JsiSkData.js.map +1 -1
  308. package/lib/commonjs/skia/web/JsiSkDataFactory.js.map +1 -1
  309. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  310. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  311. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  312. package/lib/commonjs/skia/web/JsiSkImageFilter.js.map +1 -1
  313. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  314. package/lib/commonjs/skia/web/JsiSkMaskFilter.js.map +1 -1
  315. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  316. package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
  317. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  318. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  319. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  320. package/lib/commonjs/skia/web/JsiSkPathEffect.js.map +1 -1
  321. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  322. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  323. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  324. package/lib/commonjs/skia/web/JsiSkPictureFactory.js.map +1 -1
  325. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  326. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  327. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  328. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  329. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  330. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  331. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -1
  332. package/lib/commonjs/skia/web/JsiSkSVGFactory.js.map +1 -1
  333. package/lib/commonjs/skia/web/JsiSkShader.js.map +1 -1
  334. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  335. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  336. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  337. package/lib/commonjs/skia/web/JsiSkTextBlob.js.map +1 -1
  338. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  339. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  340. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  341. package/lib/commonjs/skia/web/JsiSkVertices.js.map +1 -1
  342. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
  343. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  344. package/lib/commonjs/skia/web/index.js.map +1 -1
  345. package/lib/commonjs/values/api.js.map +1 -1
  346. package/lib/commonjs/values/api.web.js.map +1 -1
  347. package/lib/commonjs/values/hooks/index.js.map +1 -1
  348. package/lib/commonjs/values/hooks/useClockValue.js.map +1 -1
  349. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  350. package/lib/commonjs/values/hooks/useValue.js.map +1 -1
  351. package/lib/commonjs/values/hooks/useValueEffect.js.map +1 -1
  352. package/lib/commonjs/values/index.js.map +1 -1
  353. package/lib/commonjs/values/selector.js.map +1 -1
  354. package/lib/commonjs/values/types.js.map +1 -1
  355. package/lib/commonjs/values/web/RNSkAnimation.js +2 -2
  356. package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -1
  357. package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -1
  358. package/lib/commonjs/values/web/RNSkComputedValue.js +1 -1
  359. package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
  360. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
  361. package/lib/commonjs/values/web/RNSkValue.js.map +1 -1
  362. package/lib/commonjs/values/web/api.js.map +1 -1
  363. package/lib/commonjs/values/web/index.js.map +1 -1
  364. package/lib/commonjs/views/SkiaBaseWebView.js +213 -0
  365. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -0
  366. package/lib/commonjs/views/SkiaPictureView.js +112 -0
  367. package/lib/commonjs/views/SkiaPictureView.js.map +1 -0
  368. package/lib/commonjs/views/SkiaPictureView.web.js +31 -0
  369. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -0
  370. package/lib/commonjs/views/SkiaView.js +2 -2
  371. package/lib/commonjs/views/SkiaView.js.map +1 -1
  372. package/lib/commonjs/views/SkiaView.web.js +14 -203
  373. package/lib/commonjs/views/SkiaView.web.js.map +1 -1
  374. package/lib/commonjs/views/api.js.map +1 -1
  375. package/lib/commonjs/views/index.js +13 -0
  376. package/lib/commonjs/views/index.js.map +1 -1
  377. package/lib/commonjs/views/types.js.map +1 -1
  378. package/lib/commonjs/views/useDrawCallback.js.map +1 -1
  379. package/lib/commonjs/views/useTouchHandler.js +6 -6
  380. package/lib/commonjs/views/useTouchHandler.js.map +1 -1
  381. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  382. package/lib/commonjs/web/WithSkiaWeb.js +1 -1
  383. package/lib/commonjs/web/WithSkiaWeb.js.map +1 -1
  384. package/lib/commonjs/web/index.js.map +1 -1
  385. package/lib/module/animation/decay/decay.js.map +1 -1
  386. package/lib/module/animation/decay/index.js.map +1 -1
  387. package/lib/module/animation/decay/runDecay.js.map +1 -1
  388. package/lib/module/animation/decay/types.js.map +1 -1
  389. package/lib/module/animation/functions/index.js.map +1 -1
  390. package/lib/module/animation/functions/interpolate.js.map +1 -1
  391. package/lib/module/animation/functions/interpolateColors.js.map +1 -1
  392. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  393. package/lib/module/animation/functions/interpolateVector.js.map +1 -1
  394. package/lib/module/animation/index.js.map +1 -1
  395. package/lib/module/animation/spring/Spring.js.map +1 -1
  396. package/lib/module/animation/spring/functions/index.js.map +1 -1
  397. package/lib/module/animation/spring/functions/spring.js.map +1 -1
  398. package/lib/module/animation/spring/index.js.map +1 -1
  399. package/lib/module/animation/spring/runSpring.js +1 -1
  400. package/lib/module/animation/spring/runSpring.js.map +1 -1
  401. package/lib/module/animation/spring/types.js.map +1 -1
  402. package/lib/module/animation/spring/useSpring.js +1 -1
  403. package/lib/module/animation/spring/useSpring.js.map +1 -1
  404. package/lib/module/animation/timing/Easing.js.map +1 -1
  405. package/lib/module/animation/timing/createTiming.js +2 -6
  406. package/lib/module/animation/timing/createTiming.js.map +1 -1
  407. package/lib/module/animation/timing/functions/bezier.js.map +1 -1
  408. package/lib/module/animation/timing/functions/getResolvedParams.js +6 -10
  409. package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -1
  410. package/lib/module/animation/timing/functions/index.js.map +1 -1
  411. package/lib/module/animation/timing/functions/timing.js.map +1 -1
  412. package/lib/module/animation/timing/functions/types.js.map +1 -1
  413. package/lib/module/animation/timing/index.js.map +1 -1
  414. package/lib/module/animation/timing/runTiming.js.map +1 -1
  415. package/lib/module/animation/timing/useLoop.js.map +1 -1
  416. package/lib/module/animation/timing/useTiming.js +1 -3
  417. package/lib/module/animation/timing/useTiming.js.map +1 -1
  418. package/lib/module/animation/types.js.map +1 -1
  419. package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
  420. package/lib/module/dom/nodes/GroupNode.js.map +1 -1
  421. package/lib/module/dom/nodes/JsiSkDOM.js +1 -1
  422. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  423. package/lib/module/dom/nodes/Node.js.map +1 -1
  424. package/lib/module/dom/nodes/PaintContext.js.map +1 -1
  425. package/lib/module/dom/nodes/PaintNode.js.map +1 -1
  426. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  427. package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
  428. package/lib/module/dom/nodes/datatypes/Color.js.map +1 -1
  429. package/lib/module/dom/nodes/datatypes/Enum.js.map +1 -1
  430. package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
  431. package/lib/module/dom/nodes/datatypes/Gradient.js +2 -2
  432. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  433. package/lib/module/dom/nodes/datatypes/Path.js.map +1 -1
  434. package/lib/module/dom/nodes/datatypes/Radius.js.map +1 -1
  435. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  436. package/lib/module/dom/nodes/datatypes/Transform.js.map +1 -1
  437. package/lib/module/dom/nodes/datatypes/index.js.map +1 -1
  438. package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
  439. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  440. package/lib/module/dom/nodes/drawings/CircleNode.js.map +1 -1
  441. package/lib/module/dom/nodes/drawings/CustomDrawingNode.js.map +1 -1
  442. package/lib/module/dom/nodes/drawings/DiffRectNode.js.map +1 -1
  443. package/lib/module/dom/nodes/drawings/FillNode.js.map +1 -1
  444. package/lib/module/dom/nodes/drawings/ImageNode.js.map +1 -1
  445. package/lib/module/dom/nodes/drawings/ImageSVG.js.map +1 -1
  446. package/lib/module/dom/nodes/drawings/LineNode.js.map +1 -1
  447. package/lib/module/dom/nodes/drawings/OvalNode.js.map +1 -1
  448. package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -1
  449. package/lib/module/dom/nodes/drawings/PathNode.js.map +1 -1
  450. package/lib/module/dom/nodes/drawings/PictureNode.js.map +1 -1
  451. package/lib/module/dom/nodes/drawings/PointsNode.js.map +1 -1
  452. package/lib/module/dom/nodes/drawings/RRectNode.js.map +1 -1
  453. package/lib/module/dom/nodes/drawings/RectNode.js.map +1 -1
  454. package/lib/module/dom/nodes/drawings/Text.js.map +1 -1
  455. package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -1
  456. package/lib/module/dom/nodes/drawings/index.js.map +1 -1
  457. package/lib/module/dom/nodes/index.js.map +1 -1
  458. package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
  459. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  460. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  461. package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
  462. package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
  463. package/lib/module/dom/nodes/paint/Shaders.js +2 -4
  464. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  465. package/lib/module/dom/nodes/paint/index.js.map +1 -1
  466. package/lib/module/dom/types/ColorFilters.js.map +1 -1
  467. package/lib/module/dom/types/Common.js.map +1 -1
  468. package/lib/module/dom/types/DrawingContext.js.map +1 -1
  469. package/lib/module/dom/types/Drawings.js.map +1 -1
  470. package/lib/module/dom/types/ImageFilters.js.map +1 -1
  471. package/lib/module/dom/types/MaskFilters.js.map +1 -1
  472. package/lib/module/dom/types/Node.js.map +1 -1
  473. package/lib/module/dom/types/NodeType.js.map +1 -1
  474. package/lib/module/dom/types/PathEffects.js.map +1 -1
  475. package/lib/module/dom/types/Shaders.js.map +1 -1
  476. package/lib/module/dom/types/SkDOM.js.map +1 -1
  477. package/lib/module/dom/types/index.js.map +1 -1
  478. package/lib/module/external/index.js.map +1 -1
  479. package/lib/module/external/reanimated/index.js.map +1 -1
  480. package/lib/module/external/reanimated/useSharedValueEffect.js.map +1 -1
  481. package/lib/module/index.js.map +1 -1
  482. package/lib/module/mock/index.js +6 -10
  483. package/lib/module/mock/index.js.map +1 -1
  484. package/lib/module/renderer/Canvas.js.map +1 -1
  485. package/lib/module/renderer/Container.js.map +1 -1
  486. package/lib/module/renderer/DependencyManager.js.map +1 -1
  487. package/lib/module/renderer/DrawingContext.js.map +1 -1
  488. package/lib/module/renderer/HostComponents.js.map +1 -1
  489. package/lib/module/renderer/HostConfig.js +0 -2
  490. package/lib/module/renderer/HostConfig.js.map +1 -1
  491. package/lib/module/renderer/components/Blend.js.map +1 -1
  492. package/lib/module/renderer/components/Drawing.js.map +1 -1
  493. package/lib/module/renderer/components/Group.js.map +1 -1
  494. package/lib/module/renderer/components/Mask.js.map +1 -1
  495. package/lib/module/renderer/components/Paint.js +1 -1
  496. package/lib/module/renderer/components/Paint.js.map +1 -1
  497. package/lib/module/renderer/components/Picture.js.map +1 -1
  498. package/lib/module/renderer/components/backdrop/BackdropBlur.js +1 -1
  499. package/lib/module/renderer/components/backdrop/BackdropBlur.js.map +1 -1
  500. package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  501. package/lib/module/renderer/components/backdrop/index.js.map +1 -1
  502. package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
  503. package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
  504. package/lib/module/renderer/components/colorFilters/LinearToSRGBGamma.js.map +1 -1
  505. package/lib/module/renderer/components/colorFilters/LumaColorFilter.js.map +1 -1
  506. package/lib/module/renderer/components/colorFilters/Matrix.js.map +1 -1
  507. package/lib/module/renderer/components/colorFilters/SRGBToLinearGamma.js.map +1 -1
  508. package/lib/module/renderer/components/colorFilters/index.js.map +1 -1
  509. package/lib/module/renderer/components/image/Image.js.map +1 -1
  510. package/lib/module/renderer/components/image/ImageSVG.js.map +1 -1
  511. package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
  512. package/lib/module/renderer/components/image/index.js.map +1 -1
  513. package/lib/module/renderer/components/imageFilters/Blur.js.map +1 -1
  514. package/lib/module/renderer/components/imageFilters/DisplacementMap.js.map +1 -1
  515. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  516. package/lib/module/renderer/components/imageFilters/Offset.js.map +1 -1
  517. package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -1
  518. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
  519. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  520. package/lib/module/renderer/components/index.js.map +1 -1
  521. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  522. package/lib/module/renderer/components/maskFilters/index.js.map +1 -1
  523. package/lib/module/renderer/components/pathEffects/Corner.js.map +1 -1
  524. package/lib/module/renderer/components/pathEffects/Dash.js.map +1 -1
  525. package/lib/module/renderer/components/pathEffects/Discrete.js.map +1 -1
  526. package/lib/module/renderer/components/pathEffects/Line2D.js.map +1 -1
  527. package/lib/module/renderer/components/pathEffects/Path1D.js.map +1 -1
  528. package/lib/module/renderer/components/pathEffects/Path2D.js.map +1 -1
  529. package/lib/module/renderer/components/pathEffects/Sum.js.map +1 -1
  530. package/lib/module/renderer/components/pathEffects/index.js.map +1 -1
  531. package/lib/module/renderer/components/shaders/Color.js.map +1 -1
  532. package/lib/module/renderer/components/shaders/FractalNoise.js.map +1 -1
  533. package/lib/module/renderer/components/shaders/LinearGradient.js.map +1 -1
  534. package/lib/module/renderer/components/shaders/RadialGradient.js.map +1 -1
  535. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  536. package/lib/module/renderer/components/shaders/ShaderLib.js.map +1 -1
  537. package/lib/module/renderer/components/shaders/SweepGradient.js.map +1 -1
  538. package/lib/module/renderer/components/shaders/Turbulence.js.map +1 -1
  539. package/lib/module/renderer/components/shaders/TwoPointConicalGradient.js.map +1 -1
  540. package/lib/module/renderer/components/shaders/index.js.map +1 -1
  541. package/lib/module/renderer/components/shapes/Box.js.map +1 -1
  542. package/lib/module/renderer/components/shapes/Circle.js.map +1 -1
  543. package/lib/module/renderer/components/shapes/DiffRect.js.map +1 -1
  544. package/lib/module/renderer/components/shapes/Fill.js.map +1 -1
  545. package/lib/module/renderer/components/shapes/FitBox.js.map +1 -1
  546. package/lib/module/renderer/components/shapes/Line.js.map +1 -1
  547. package/lib/module/renderer/components/shapes/Oval.js.map +1 -1
  548. package/lib/module/renderer/components/shapes/Patch.js.map +1 -1
  549. package/lib/module/renderer/components/shapes/Path.js.map +1 -1
  550. package/lib/module/renderer/components/shapes/Points.js.map +1 -1
  551. package/lib/module/renderer/components/shapes/Rect.js.map +1 -1
  552. package/lib/module/renderer/components/shapes/RoundedRect.js.map +1 -1
  553. package/lib/module/renderer/components/shapes/Vertices.js.map +1 -1
  554. package/lib/module/renderer/components/shapes/index.js.map +1 -1
  555. package/lib/module/renderer/components/text/Glyphs.js.map +1 -1
  556. package/lib/module/renderer/components/text/Text.js.map +1 -1
  557. package/lib/module/renderer/components/text/TextBlob.js.map +1 -1
  558. package/lib/module/renderer/components/text/TextPath.js.map +1 -1
  559. package/lib/module/renderer/components/text/index.js.map +1 -1
  560. package/lib/module/renderer/index.js.map +1 -1
  561. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  562. package/lib/module/renderer/processors/Animations/index.js.map +1 -1
  563. package/lib/module/renderer/processors/index.js.map +1 -1
  564. package/lib/module/renderer/processors/math/Coordinates.js.map +1 -1
  565. package/lib/module/renderer/processors/math/Math.js.map +1 -1
  566. package/lib/module/renderer/processors/math/Transforms.js.map +1 -1
  567. package/lib/module/renderer/processors/math/index.js.map +1 -1
  568. package/lib/module/renderer/typeddash.js.map +1 -1
  569. package/lib/module/renderer/useCanvas.js.map +1 -1
  570. package/lib/module/renderer/useContextBridge.js.map +1 -1
  571. package/lib/module/skia/NativeSetup.js.map +1 -1
  572. package/lib/module/skia/Skia.js.map +1 -1
  573. package/lib/module/skia/Skia.web.js.map +1 -1
  574. package/lib/module/skia/core/Data.js.map +1 -1
  575. package/lib/module/skia/core/Font.js.map +1 -1
  576. package/lib/module/skia/core/Image.js.map +1 -1
  577. package/lib/module/skia/core/Matrix.js.map +1 -1
  578. package/lib/module/skia/core/Picture.js.map +1 -1
  579. package/lib/module/skia/core/RRect.js.map +1 -1
  580. package/lib/module/skia/core/Rect.js.map +1 -1
  581. package/lib/module/skia/core/SVG.js.map +1 -1
  582. package/lib/module/skia/core/Typeface.js.map +1 -1
  583. package/lib/module/skia/core/Vector.js +1 -1
  584. package/lib/module/skia/core/Vector.js.map +1 -1
  585. package/lib/module/skia/core/index.js.map +1 -1
  586. package/lib/module/skia/index.js.map +1 -1
  587. package/lib/module/skia/types/Canvas.js.map +1 -1
  588. package/lib/module/skia/types/Color.js.map +1 -1
  589. package/lib/module/skia/types/ColorFilter/ColorFilter.js.map +1 -1
  590. package/lib/module/skia/types/ColorFilter/ColorFilterFactory.js.map +1 -1
  591. package/lib/module/skia/types/ColorFilter/index.js.map +1 -1
  592. package/lib/module/skia/types/ContourMeasure.js.map +1 -1
  593. package/lib/module/skia/types/Data/Data.js.map +1 -1
  594. package/lib/module/skia/types/Data/DataFactory.js.map +1 -1
  595. package/lib/module/skia/types/Data/index.js.map +1 -1
  596. package/lib/module/skia/types/Font/Font.js.map +1 -1
  597. package/lib/module/skia/types/Font/index.js.map +1 -1
  598. package/lib/module/skia/types/Image/Image.js.map +1 -1
  599. package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
  600. package/lib/module/skia/types/Image/index.js.map +1 -1
  601. package/lib/module/skia/types/ImageFilter/ImageFilter.js.map +1 -1
  602. package/lib/module/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
  603. package/lib/module/skia/types/ImageFilter/index.js.map +1 -1
  604. package/lib/module/skia/types/JsiInstance.js.map +1 -1
  605. package/lib/module/skia/types/MaskFilter.js.map +1 -1
  606. package/lib/module/skia/types/Matrix.js.map +1 -1
  607. package/lib/module/skia/types/Paint/BlendMode.js.map +1 -1
  608. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  609. package/lib/module/skia/types/Paint/index.js.map +1 -1
  610. package/lib/module/skia/types/Path/Path.js.map +1 -1
  611. package/lib/module/skia/types/Path/PathFactory.js.map +1 -1
  612. package/lib/module/skia/types/Path/index.js.map +1 -1
  613. package/lib/module/skia/types/PathEffect.js.map +1 -1
  614. package/lib/module/skia/types/Picture/Picture.js.map +1 -1
  615. package/lib/module/skia/types/Picture/PictureFactory.js.map +1 -1
  616. package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
  617. package/lib/module/skia/types/Picture/index.js.map +1 -1
  618. package/lib/module/skia/types/Point.js.map +1 -1
  619. package/lib/module/skia/types/RRect.js.map +1 -1
  620. package/lib/module/skia/types/RSXform.js.map +1 -1
  621. package/lib/module/skia/types/Rect.js.map +1 -1
  622. package/lib/module/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  623. package/lib/module/skia/types/RuntimeEffect/RuntimeEffectFactory.js.map +1 -1
  624. package/lib/module/skia/types/RuntimeEffect/index.js.map +1 -1
  625. package/lib/module/skia/types/SVG/SVG.js.map +1 -1
  626. package/lib/module/skia/types/SVG/SVGFactory.js.map +1 -1
  627. package/lib/module/skia/types/SVG/index.js.map +1 -1
  628. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  629. package/lib/module/skia/types/Shader/ShaderFactory.js.map +1 -1
  630. package/lib/module/skia/types/Shader/index.js.map +1 -1
  631. package/lib/module/skia/types/Skia.js.map +1 -1
  632. package/lib/module/skia/types/Surface/Surface.js.map +1 -1
  633. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  634. package/lib/module/skia/types/Surface/index.js.map +1 -1
  635. package/lib/module/skia/types/TextBlob.js.map +1 -1
  636. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  637. package/lib/module/skia/types/Typeface/TypefaceFactory.js.map +1 -1
  638. package/lib/module/skia/types/Typeface/index.js.map +1 -1
  639. package/lib/module/skia/types/Vertices/Vertices.js.map +1 -1
  640. package/lib/module/skia/types/Vertices/index.js.map +1 -1
  641. package/lib/module/skia/types/index.js.map +1 -1
  642. package/lib/module/skia/web/Host.js +1 -1
  643. package/lib/module/skia/web/Host.js.map +1 -1
  644. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  645. package/lib/module/skia/web/JsiSkColor.js.map +1 -1
  646. package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
  647. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  648. package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
  649. package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
  650. package/lib/module/skia/web/JsiSkData.js.map +1 -1
  651. package/lib/module/skia/web/JsiSkDataFactory.js.map +1 -1
  652. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  653. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  654. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  655. package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
  656. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  657. package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
  658. package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  659. package/lib/module/skia/web/JsiSkMatrix.js +1 -1
  660. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  661. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  662. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  663. package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
  664. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  665. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  666. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  667. package/lib/module/skia/web/JsiSkPictureFactory.js.map +1 -1
  668. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  669. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  670. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  671. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  672. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  673. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  674. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -1
  675. package/lib/module/skia/web/JsiSkSVGFactory.js.map +1 -1
  676. package/lib/module/skia/web/JsiSkShader.js.map +1 -1
  677. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  678. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  679. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  680. package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
  681. package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  682. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  683. package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  684. package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
  685. package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
  686. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  687. package/lib/module/skia/web/index.js.map +1 -1
  688. package/lib/module/values/api.js.map +1 -1
  689. package/lib/module/values/api.web.js.map +1 -1
  690. package/lib/module/values/hooks/index.js.map +1 -1
  691. package/lib/module/values/hooks/useClockValue.js.map +1 -1
  692. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  693. package/lib/module/values/hooks/useValue.js.map +1 -1
  694. package/lib/module/values/hooks/useValueEffect.js.map +1 -1
  695. package/lib/module/values/index.js.map +1 -1
  696. package/lib/module/values/selector.js.map +1 -1
  697. package/lib/module/values/types.js.map +1 -1
  698. package/lib/module/values/web/RNSkAnimation.js +2 -2
  699. package/lib/module/values/web/RNSkAnimation.js.map +1 -1
  700. package/lib/module/values/web/RNSkClockValue.js.map +1 -1
  701. package/lib/module/values/web/RNSkComputedValue.js +1 -1
  702. package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
  703. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
  704. package/lib/module/values/web/RNSkValue.js.map +1 -1
  705. package/lib/module/values/web/api.js.map +1 -1
  706. package/lib/module/values/web/index.js.map +1 -1
  707. package/lib/module/views/SkiaBaseWebView.js +198 -0
  708. package/lib/module/views/SkiaBaseWebView.js.map +1 -0
  709. package/lib/module/views/SkiaPictureView.js +94 -0
  710. package/lib/module/views/SkiaPictureView.js.map +1 -0
  711. package/lib/module/views/SkiaPictureView.web.js +19 -0
  712. package/lib/module/views/SkiaPictureView.web.js.map +1 -0
  713. package/lib/module/views/SkiaView.js +2 -2
  714. package/lib/module/views/SkiaView.js.map +1 -1
  715. package/lib/module/views/SkiaView.web.js +15 -201
  716. package/lib/module/views/SkiaView.web.js.map +1 -1
  717. package/lib/module/views/api.js.map +1 -1
  718. package/lib/module/views/index.js +1 -0
  719. package/lib/module/views/index.js.map +1 -1
  720. package/lib/module/views/types.js.map +1 -1
  721. package/lib/module/views/useDrawCallback.js.map +1 -1
  722. package/lib/module/views/useTouchHandler.js +6 -6
  723. package/lib/module/views/useTouchHandler.js.map +1 -1
  724. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  725. package/lib/module/web/WithSkiaWeb.js +1 -1
  726. package/lib/module/web/WithSkiaWeb.js.map +1 -1
  727. package/lib/module/web/index.js.map +1 -1
  728. package/lib/typescript/src/animation/decay/runDecay.d.ts +1 -1
  729. package/lib/typescript/src/animation/spring/runSpring.d.ts +1 -1
  730. package/lib/typescript/src/animation/spring/useSpring.d.ts +1 -1
  731. package/lib/typescript/src/animation/timing/createTiming.d.ts +1 -1
  732. package/lib/typescript/src/animation/timing/functions/getResolvedParams.d.ts +1 -1
  733. package/lib/typescript/src/animation/timing/runTiming.d.ts +1 -1
  734. package/lib/typescript/src/animation/timing/useLoop.d.ts +1 -1
  735. package/lib/typescript/src/animation/timing/useTiming.d.ts +1 -1
  736. package/lib/typescript/src/mock/index.d.ts +1 -1
  737. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  738. package/lib/typescript/src/renderer/HostConfig.d.ts +1 -1
  739. package/lib/typescript/src/renderer/components/Paint.d.ts +1 -1
  740. package/lib/typescript/src/renderer/components/backdrop/BackdropFilter.d.ts +1 -1
  741. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +4 -4
  742. package/lib/typescript/src/renderer/typeddash.d.ts +2 -2
  743. package/lib/typescript/src/skia/core/Font.d.ts +1 -1
  744. package/lib/typescript/src/skia/core/Vector.d.ts +2 -2
  745. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
  746. package/lib/typescript/src/skia/web/JsiSkVerticesFactory.d.ts +2 -2
  747. package/lib/typescript/src/views/SkiaBaseWebView.d.ts +58 -0
  748. package/lib/typescript/src/views/SkiaPictureView.d.ts +27 -0
  749. package/lib/typescript/src/views/SkiaPictureView.web.d.ts +7 -0
  750. package/lib/typescript/src/views/SkiaView.d.ts +4 -4
  751. package/lib/typescript/src/views/SkiaView.web.d.ts +6 -53
  752. package/lib/typescript/src/views/index.d.ts +1 -0
  753. package/lib/typescript/src/views/types.d.ts +7 -2
  754. package/lib/typescript/src/web/LoadSkiaWeb.d.ts +2 -2
  755. package/package.json +6 -6
  756. package/src/renderer/HostConfig.ts +3 -4
  757. package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
  758. package/src/renderer/processors/Animations/Animations.ts +11 -4
  759. package/src/renderer/typeddash.ts +3 -2
  760. package/src/values/web/RNSkComputedValue.ts +6 -1
  761. package/src/views/SkiaBaseWebView.tsx +177 -0
  762. package/src/views/SkiaPictureView.tsx +93 -0
  763. package/src/views/SkiaPictureView.web.tsx +23 -0
  764. package/src/views/SkiaView.tsx +6 -7
  765. package/src/views/SkiaView.web.tsx +18 -167
  766. package/src/views/index.ts +1 -0
  767. package/src/views/types.ts +9 -2
  768. package/android/cpp/jni/JniSkiaDrawView.cpp +0 -113
  769. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +0 -73
  770. package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +0 -48
  771. package/cpp/rnskia/RNSkDrawView.cpp +0 -315
  772. package/cpp/rnskia/RNSkDrawView.h +0 -226
  773. package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +0 -52
  774. package/ios/RNSkia-iOS/SkiaDrawView.h +0 -23
@@ -0,0 +1,26 @@
1
+ #pragma once
2
+
3
+ #import <memory>
4
+ #import <string>
5
+
6
+ #import <CoreFoundation/CoreFoundation.h>
7
+ #import <UIKit/UIKit.h>
8
+
9
+ #import <RNSkiOSView.h>
10
+ #import <RNSkManager.h>
11
+
12
+ class RNSkiOSJsView;
13
+
14
+ @interface SkiaUIView : UIView
15
+
16
+ - (instancetype)initWithManager: (RNSkia::RNSkManager*)manager
17
+ factory: (std::function<std::shared_ptr<RNSkBaseiOSView>(
18
+ std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
19
+
20
+ - (std::shared_ptr<RNSkBaseiOSView>) impl;
21
+
22
+ - (void) setDrawingMode:(std::string) mode;
23
+ - (void) setDebugMode:(bool) debugMode;
24
+ - (void) setNativeId:(size_t) nativeId;
25
+
26
+ @end
@@ -1,24 +1,26 @@
1
1
  #import <React/RCTBridge.h>
2
2
 
3
- #import <SkiaDrawView.h>
3
+ #import <SkiaUIView.h>
4
4
 
5
5
  #include <utility>
6
6
  #include <vector>
7
7
 
8
- #import <RNSkDrawViewImpl.h>
9
8
  #import <RNSkManager.h>
10
9
 
11
- @implementation SkiaDrawView {
12
- std::shared_ptr<RNSkDrawViewImpl> _impl;
10
+ @implementation SkiaUIView {
11
+ std::shared_ptr<RNSkBaseiOSView> _impl;
13
12
  RNSkia::RNSkManager* _manager;
14
13
  RNSkia::RNSkDrawingMode _drawingMode;
14
+ std::function<std::shared_ptr<RNSkBaseiOSView>(std::shared_ptr<RNSkia::RNSkPlatformContext>)> _factory;
15
15
  bool _debugMode;
16
16
  size_t _nativeId;
17
17
  }
18
18
 
19
19
  #pragma mark Initialization and destruction
20
20
 
21
- - (instancetype) initWithManager: (RNSkia::RNSkManager*)manager;
21
+ - (instancetype) initWithManager: (RNSkia::RNSkManager*)manager
22
+ factory: (std::function<std::shared_ptr<RNSkBaseiOSView>(
23
+ std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory
22
24
  {
23
25
  self = [super init];
24
26
  if (self) {
@@ -26,6 +28,7 @@
26
28
  _nativeId = 0;
27
29
  _debugMode = false;
28
30
  _drawingMode = RNSkia::RNSkDrawingMode::Default;
31
+ _factory = factory;
29
32
 
30
33
  // Listen to notifications about module invalidation
31
34
  [[NSNotificationCenter defaultCenter] addObserver:self
@@ -50,7 +53,7 @@
50
53
  [_impl->getLayer() removeFromSuperlayer];
51
54
 
52
55
  if(_nativeId != 0 && _manager != nullptr) {
53
- _manager->setSkiaDrawView(_nativeId, nullptr);
56
+ _manager->setSkiaView(_nativeId, nullptr);
54
57
  }
55
58
 
56
59
  _impl = nullptr;
@@ -58,20 +61,23 @@
58
61
  } else {
59
62
  // Create implementation view when the parent view is set
60
63
  if(_impl == nullptr && _manager != nullptr) {
61
- _impl = std::make_shared<RNSkDrawViewImpl>(_manager->getPlatformContext());
64
+ _impl = _factory(_manager->getPlatformContext());
65
+ if(_impl == nullptr) {
66
+ throw std::runtime_error("Expected Skia view implementation, got nullptr.");
67
+ }
62
68
  [self.layer addSublayer: _impl->getLayer()];
63
69
  if(_nativeId != 0) {
64
- _manager->setSkiaDrawView(_nativeId, _impl);
70
+ _manager->setSkiaView(_nativeId, _impl->getDrawView());
65
71
  }
66
- _impl->setDrawingMode(_drawingMode);
67
- _impl->setShowDebugOverlays(_debugMode);
72
+ _impl->getDrawView()->setDrawingMode(_drawingMode);
73
+ _impl->getDrawView()->setShowDebugOverlays(_debugMode);
68
74
  }
69
75
  }
70
76
  }
71
77
 
72
78
  - (void) dealloc {
73
79
  if(_manager != nullptr && _nativeId != 0) {
74
- _manager->unregisterSkiaDrawView(_nativeId);
80
+ _manager->unregisterSkiaView(_nativeId);
75
81
  }
76
82
 
77
83
  [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
@@ -94,14 +100,14 @@
94
100
  _drawingMode = mode.compare("continuous") == 0 ? RNSkia::RNSkDrawingMode::Continuous : RNSkia::RNSkDrawingMode::Default;
95
101
 
96
102
  if(_impl != nullptr) {
97
- _impl->setDrawingMode(_drawingMode);
103
+ _impl->getDrawView()->setDrawingMode(_drawingMode);
98
104
  }
99
105
  }
100
106
 
101
107
  -(void) setDebugMode:(bool) debugMode {
102
108
  _debugMode = debugMode;
103
109
  if(_impl != nullptr) {
104
- _impl->setShowDebugOverlays(debugMode);
110
+ _impl->getDrawView()->setShowDebugOverlays(debugMode);
105
111
  }
106
112
  }
107
113
 
@@ -109,13 +115,13 @@
109
115
  _nativeId = nativeId;
110
116
 
111
117
  if(_impl != nullptr) {
112
- _manager->registerSkiaDrawView(nativeId, _impl);
118
+ _manager->registerSkiaView(nativeId, _impl->getDrawView());
113
119
  }
114
120
  }
115
121
 
116
122
  #pragma mark External API
117
123
 
118
- - (std::shared_ptr<RNSkDrawViewImpl>) impl {
124
+ - (std::shared_ptr<RNSkBaseiOSView>) impl {
119
125
  return _impl;
120
126
  }
121
127
 
@@ -135,10 +141,10 @@
135
141
 
136
142
  - (void) handleTouches:(NSSet<UITouch*>*) touches withEvent:(UIEvent*) event {
137
143
  if (event.type == UIEventTypeTouches) {
138
- std::vector<RNSkia::RNSkTouchPoint> nextTouches;
144
+ std::vector<RNSkia::RNSkTouchInfo> nextTouches;
139
145
  for (UITouch *touch in touches) {
140
146
  auto position = [touch preciseLocationInView:self];
141
- RNSkia::RNSkTouchPoint nextTouch;
147
+ RNSkia::RNSkTouchInfo nextTouch;
142
148
  nextTouch.x = position.x;
143
149
  nextTouch.y = position.y;
144
150
  nextTouch.force = [touch force];
@@ -146,26 +152,26 @@
146
152
  auto phase = [touch phase];
147
153
  switch(phase) {
148
154
  case UITouchPhaseBegan:
149
- nextTouch.type = RNSkia::RNSkTouchType::Start;
155
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Start;
150
156
  break;
151
157
  case UITouchPhaseMoved:
152
- nextTouch.type = RNSkia::RNSkTouchType::Active;
158
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
153
159
  break;
154
160
  case UITouchPhaseEnded:
155
- nextTouch.type = RNSkia::RNSkTouchType::End;
161
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::End;
156
162
  break;
157
163
  case UITouchPhaseCancelled:
158
- nextTouch.type = RNSkia::RNSkTouchType::Cancelled;
164
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Cancelled;
159
165
  break;
160
166
  default:
161
- nextTouch.type = RNSkia::RNSkTouchType::Active;
167
+ nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
162
168
  break;
163
169
  }
164
170
 
165
171
  nextTouches.push_back(nextTouch);
166
172
  }
167
173
  if(_impl != nullptr) {
168
- _impl->updateTouchState(std::move(nextTouches));
174
+ _impl->getDrawView()->updateTouchState(nextTouches);
169
175
  }
170
176
  }
171
177
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["decay.ts"],"names":["VELOCITY_EPS","SLOPE_FACTOR","decay","now","state","config","lastTimestamp","startTimestamp","initialVelocity","current","velocity","nextState","deltaTime","Math","min","v","exp","deceleration","velocityFactor","clamp","finished","abs"],"mappings":";;;;;;AAEA,MAAMA,YAAY,GAAG,CAArB;AACA,MAAMC,YAAY,GAAG,GAAr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V,GAAqB,IAArB;AACD;AACF;;AACDT,EAAAA,SAAS,CAACS,QAAV,GAAqBP,IAAI,CAACQ,GAAL,CAASN,CAAT,IAAcf,YAAnC;AACA,SAAOW,SAAP;AACD,CA7BM","sourcesContent":["import type { DecayState, DefaultDecayConfig } from \"./types\";\n\nconst VELOCITY_EPS = 1;\nconst SLOPE_FACTOR = 0.1;\n\nexport const decay = (\n now: number,\n state: DecayState,\n config: DefaultDecayConfig\n): DecayState => {\n const { lastTimestamp, startTimestamp, initialVelocity, current, velocity } =\n state;\n const nextState = { ...state };\n const deltaTime = Math.min(now - lastTimestamp, 64);\n const v =\n velocity *\n Math.exp(\n -(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR\n );\n nextState.current = current + (v * config.velocityFactor * deltaTime) / 1000; // /1000 because time is in ms not in s\n nextState.velocity = v;\n nextState.lastTimestamp = now;\n\n if (config.clamp) {\n if (initialVelocity < 0 && nextState.current <= config.clamp[0]) {\n nextState.current = config.clamp[0];\n nextState.finished = true;\n } else if (initialVelocity > 0 && nextState.current >= config.clamp[1]) {\n nextState.current = config.clamp[1];\n nextState.finished = true;\n }\n }\n nextState.finished = Math.abs(v) < VELOCITY_EPS;\n return nextState;\n};\n"]}
1
+ {"version":3,"names":["VELOCITY_EPS","SLOPE_FACTOR","decay","now","state","config","lastTimestamp","startTimestamp","initialVelocity","current","velocity","nextState","deltaTime","Math","min","v","exp","deceleration","velocityFactor","clamp","finished","abs"],"sources":["decay.ts"],"sourcesContent":["import type { DecayState, DefaultDecayConfig } from \"./types\";\n\nconst VELOCITY_EPS = 1;\nconst SLOPE_FACTOR = 0.1;\n\nexport const decay = (\n now: number,\n state: DecayState,\n config: DefaultDecayConfig\n): DecayState => {\n const { lastTimestamp, startTimestamp, initialVelocity, current, velocity } =\n state;\n const nextState = { ...state };\n const deltaTime = Math.min(now - lastTimestamp, 64);\n const v =\n velocity *\n Math.exp(\n -(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR\n );\n nextState.current = current + (v * config.velocityFactor * deltaTime) / 1000; // /1000 because time is in ms not in s\n nextState.velocity = v;\n nextState.lastTimestamp = now;\n\n if (config.clamp) {\n if (initialVelocity < 0 && nextState.current <= config.clamp[0]) {\n nextState.current = config.clamp[0];\n nextState.finished = true;\n } else if (initialVelocity > 0 && nextState.current >= config.clamp[1]) {\n nextState.current = config.clamp[1];\n nextState.finished = true;\n }\n }\n nextState.finished = Math.abs(v) < VELOCITY_EPS;\n return nextState;\n};\n"],"mappings":";;;;;;AAEA,MAAMA,YAAY,GAAG,CAArB;AACA,MAAMC,YAAY,GAAG,GAArB;;AAEO,MAAMC,KAAK,GAAG,CACnBC,GADmB,EAEnBC,KAFmB,EAGnBC,MAHmB,KAIJ;EACf,MAAM;IAAEC,aAAF;IAAiBC,cAAjB;IAAiCC,eAAjC;IAAkDC,OAAlD;IAA2DC;EAA3D,IACJN,KADF;EAEA,MAAMO,SAAS,GAAG,EAAE,GAAGP;EAAL,CAAlB;EACA,MAAMQ,SAAS,GAAGC,IAAI,CAACC,GAAL,CAASX,GAAG,GAAGG,aAAf,EAA8B,EAA9B,CAAlB;EACA,MAAMS,CAAC,GACLL,QAAQ,GACRG,IAAI,CAACG,GAAL,CACE,EAAE,IAAIX,MAAM,CAACY,YAAb,KAA8Bd,GAAG,GAAGI,cAApC,IAAsDN,YADxD,CAFF;EAKAU,SAAS,CAACF,OAAV,GAAoBA,OAAO,GAAIM,CAAC,GAAGV,MAAM,CAACa,cAAX,GAA4BN,SAA7B,GAA0C,IAAxE,CAVe,CAU+D;;EAC9ED,SAAS,CAACD,QAAV,GAAqBK,CAArB;EACAJ,SAAS,CAACL,aAAV,GAA0BH,GAA1B;;EAEA,IAAIE,MAAM,CAACc,KAAX,EAAkB;IAChB,IAAIX,eAAe,GAAG,CAAlB,IAAuBG,SAAS,CAACF,OAAV,IAAqBJ,MAAM,CAACc,KAAP,CAAa,CAAb,CAAhD,EAAiE;MAC/DR,SAAS,CAACF,OAAV,GAAoBJ,MAAM,CAACc,KAAP,CAAa,CAAb,CAApB;MACAR,SAAS,CAACS,QAAV,GAAqB,IAArB;IACD,CAHD,MAGO,IAAIZ,eAAe,GAAG,CAAlB,IAAuBG,SAAS,CAACF,OAAV,IAAqBJ,MAAM,CAACc,KAAP,CAAa,CAAb,CAAhD,EAAiE;MACtER,SAAS,CAACF,OAAV,GAAoBJ,MAAM,CAACc,KAAP,CAAa,CAAb,CAApB;MACAR,SAAS,CAACS,QAAV,GAAqB,IAArB;IACD;EACF;;EACDT,SAAS,CAACS,QAAV,GAAqBP,IAAI,CAACQ,GAAL,CAASN,CAAT,IAAcf,YAAnC;EACA,OAAOW,SAAP;AACD,CA7BM"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { runDecay } from \"./runDecay\";\n"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { runDecay } from \"./runDecay\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["runDecay.ts"],"names":["runDecay","value","config","resolvedConfig","deceleration","velocityFactor","velocity","from","current","updateFunction","t","state","finished","lastTimestamp","startTimestamp","initialVelocity","animation","ValueApi","createAnimation"],"mappings":";;;;;;;AAAA;;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAG,CACtBC,KADsB,EAEtBC,MAFsB,KAGnB;AACH,QAAMC,cAAkC,GAAG;AACzCC,IAAAA,YAAY,EAAE,KAD2B;AAEzCC,IAAAA,cAAc,EAAE,CAFyB;AAGzCC,IAAAA,QAAQ,EAAE,CAH+B;AAIzCC,IAAAA,IAAI,EAAEN,KAAK,CAACO,OAJ6B;AAKzC,OAAGN;AALsC,GAA3C;;AAOA,QAAMO,cAAc,GAAG,CAACC,CAAD,EAAYC,KAAZ,KAA8C;AACnE,QAAI,CAACA,KAAL,EAAY;AACV,aAAO;AACLH,QAAAA,OAAO,EAAEL,cAAc,CAACI,IADnB;AAELK,QAAAA,QAAQ,EAAE,KAFL;AAGLC,QAAAA,aAAa,EAAEH,CAHV;AAILI,QAAAA,cAAc,EAAEJ,CAJX;AAKLK,QAAAA,eAAe,EAAEZ,cAAc,CAACG,QAL3B;AAMLA,QAAAA,QAAQ,EAAEH,cAAc,CAACG;AANpB,OAAP;AAQD;;AACD,WAAO,kBAAMI,CAAN,EAASC,KAAT,EAAgBR,cAAhB,CAAP;AACD,GAZD;;AAaAF,EAAAA,KAAK,CAACe,SAAN,GAAkBC,cAASC,eAAT,CAAyBT,cAAzB,CAAlB;AACA,SAAOR,KAAK,CAACe,SAAb;AACD,CA1BM","sourcesContent":["import { ValueApi } from \"../../values/api\";\nimport type { SkiaMutableValue } from \"../../values/types\";\n\nimport { decay } from \"./decay\";\nimport type { DecayConfig, DefaultDecayConfig, DecayState } from \"./types\";\n\n/**\n * Runs a decay animation from the current value to zero with the given decay\n * configuration.\n * @param value value to animate\n * @param config Configuration or default configuration\n * @returns Animation\n */\nexport const runDecay = (\n value: SkiaMutableValue<number>,\n config?: DecayConfig\n) => {\n const resolvedConfig: DefaultDecayConfig = {\n deceleration: 0.998,\n velocityFactor: 1,\n velocity: 0,\n from: value.current,\n ...config,\n };\n const updateFunction = (t: number, state: DecayState | undefined) => {\n if (!state) {\n return {\n current: resolvedConfig.from,\n finished: false,\n lastTimestamp: t,\n startTimestamp: t,\n initialVelocity: resolvedConfig.velocity,\n velocity: resolvedConfig.velocity,\n };\n }\n return decay(t, state, resolvedConfig);\n };\n value.animation = ValueApi.createAnimation(updateFunction);\n return value.animation;\n};\n"]}
1
+ {"version":3,"names":["runDecay","value","config","resolvedConfig","deceleration","velocityFactor","velocity","from","current","updateFunction","t","state","finished","lastTimestamp","startTimestamp","initialVelocity","decay","animation","ValueApi","createAnimation"],"sources":["runDecay.ts"],"sourcesContent":["import { ValueApi } from \"../../values/api\";\nimport type { SkiaMutableValue } from \"../../values/types\";\n\nimport { decay } from \"./decay\";\nimport type { DecayConfig, DefaultDecayConfig, DecayState } from \"./types\";\n\n/**\n * Runs a decay animation from the current value to zero with the given decay\n * configuration.\n * @param value value to animate\n * @param config Configuration or default configuration\n * @returns Animation\n */\nexport const runDecay = (\n value: SkiaMutableValue<number>,\n config?: DecayConfig\n) => {\n const resolvedConfig: DefaultDecayConfig = {\n deceleration: 0.998,\n velocityFactor: 1,\n velocity: 0,\n from: value.current,\n ...config,\n };\n const updateFunction = (t: number, state: DecayState | undefined) => {\n if (!state) {\n return {\n current: resolvedConfig.from,\n finished: false,\n lastTimestamp: t,\n startTimestamp: t,\n initialVelocity: resolvedConfig.velocity,\n velocity: resolvedConfig.velocity,\n };\n }\n return decay(t, state, resolvedConfig);\n };\n value.animation = ValueApi.createAnimation(updateFunction);\n return value.animation;\n};\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAG,CACtBC,KADsB,EAEtBC,MAFsB,KAGnB;EACH,MAAMC,cAAkC,GAAG;IACzCC,YAAY,EAAE,KAD2B;IAEzCC,cAAc,EAAE,CAFyB;IAGzCC,QAAQ,EAAE,CAH+B;IAIzCC,IAAI,EAAEN,KAAK,CAACO,OAJ6B;IAKzC,GAAGN;EALsC,CAA3C;;EAOA,MAAMO,cAAc,GAAG,CAACC,CAAD,EAAYC,KAAZ,KAA8C;IACnE,IAAI,CAACA,KAAL,EAAY;MACV,OAAO;QACLH,OAAO,EAAEL,cAAc,CAACI,IADnB;QAELK,QAAQ,EAAE,KAFL;QAGLC,aAAa,EAAEH,CAHV;QAILI,cAAc,EAAEJ,CAJX;QAKLK,eAAe,EAAEZ,cAAc,CAACG,QAL3B;QAMLA,QAAQ,EAAEH,cAAc,CAACG;MANpB,CAAP;IAQD;;IACD,OAAO,IAAAU,YAAA,EAAMN,CAAN,EAASC,KAAT,EAAgBR,cAAhB,CAAP;EACD,CAZD;;EAaAF,KAAK,CAACgB,SAAN,GAAkBC,aAAA,CAASC,eAAT,CAAyBV,cAAzB,CAAlB;EACA,OAAOR,KAAK,CAACgB,SAAb;AACD,CA1BM"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { AnimationState } from \"../../values/types\";\n\nexport interface DecayConfig {\n from?: number;\n deceleration?: number;\n velocityFactor?: number;\n clamp?: number[];\n velocity?: number;\n}\n\nexport interface DefaultDecayConfig {\n from: number;\n deceleration: number;\n velocityFactor: number;\n clamp?: number[];\n velocity: number;\n}\n\nexport interface DecayState extends AnimationState {\n lastTimestamp: number;\n startTimestamp: number;\n initialVelocity: number;\n velocity: number;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./interpolate\";\nexport * from \"./interpolateColors\";\nexport * from \"./interpolateVector\";\nexport * from \"./interpolatePaths\";\n"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./interpolate\";\nexport * from \"./interpolateColors\";\nexport * from \"./interpolateVector\";\nexport * from \"./interpolatePaths\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolate.ts"],"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"mappings":";;;;;;;;;AAAA;IACYA,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AA6BZ,SAASC,MAAT,CACEC,IADF,EAEEC,IAFF,EAGEC,GAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,CANF,EAOU;AACR,UAAQL,IAAR;AACE,SAAKF,WAAW,CAACQ,QAAjB;AACE,aAAOD,CAAP;;AACF,SAAKP,WAAW,CAACS,KAAjB;AACE,UAAIN,IAAI,GAAGC,GAAP,GAAaD,IAAI,GAAGE,cAAxB,EAAwC;AACtC,eAAOA,cAAP;AACD;;AACD,aAAOC,eAAP;;AACF,SAAKN,WAAW,CAACU,MAAjB;AACA;AACE,aAAON,GAAP;AAVJ;AAYD;;AAED,SAASO,aAAT,CAAuBC,KAAvB,EAA4D;AAC1D,SACEA,KAAK,KAAKZ,WAAW,CAACU,MAAtB,IACAE,KAAK,KAAKZ,WAAW,CAACS,KADtB,IAEAG,KAAK,KAAKZ,WAAW,CAACQ,QAHxB;AAKD,C,CAED;AACA;;;AACO,SAASK,4BAAT,CACLX,IADK,EAEwB;AAC7B;AACA,QAAMY,mBAAgD,GAAG;AACvDC,IAAAA,eAAe,EAAEf,WAAW,CAACU,MAD0B;AAEvDM,IAAAA,gBAAgB,EAAEhB,WAAW,CAACU;AAFyB,GAAzD;;AAKA,MAAI,CAACR,IAAL,EAAW;AACT,WAAOY,mBAAP;A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AAA,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACC,MAAM,GAAG,CAAV,CAAtC;AACD,KALD,MAKO;AACL,WAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAApB,EAA4B,EAAEC,CAA9B,EAAiC;AAC/B,YAAItB,CAAC,IAAImB,KAAK,CAACG,CAAD,CAAd,EAAmB;AACjBR,UAAAA,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACG,CAAC,GAAG,CAAL,CAAnC;AACAR,UAAAA,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACG,CAAD,CAApC;AACAR,UAAAA,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACE,CAAC,GAAG,CAAL,CAArC;AACAR,UAAAA,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACE,CAAD,CAAtC;AACA;AACD;AACF;AACF;AACF;;AAED,SAAOT,mBAAmB,CAACb,CAAD,EAAIc,aAAJ,EAAmBP,mBAAnB,CAA1B;AACD","sourcesContent":["/* eslint-disable max-len */\nexport enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"]}
1
+ {"version":3,"names":["Extrapolate","getVal","type","coef","val","leftEdgeOutput","rightEdgeOutput","x","IDENTITY","CLAMP","EXTEND","isExtrapolate","value","validateInterpolationOptions","extrapolationConfig","extrapolateLeft","extrapolateRight","Error","Object","assign","internalInterpolate","narrowedInput","leftEdgeInput","rightEdgeInput","progress","interpolate","input","output","length","i"],"sources":["interpolate.ts"],"sourcesContent":["/* eslint-disable max-len */\nexport enum Extrapolate {\n IDENTITY = \"identity\",\n CLAMP = \"clamp\",\n EXTEND = \"extend\",\n}\n\ninterface InterpolationNarrowedInput {\n leftEdgeInput: number;\n rightEdgeInput: number;\n leftEdgeOutput: number;\n rightEdgeOutput: number;\n}\n\nexport interface ExtrapolationConfig {\n extrapolateLeft?: Extrapolate | string;\n extrapolateRight?: Extrapolate | string;\n}\n\ninterface RequiredExtrapolationConfig {\n extrapolateLeft: Extrapolate;\n extrapolateRight: Extrapolate;\n}\n\nexport type ExtrapolationType =\n | ExtrapolationConfig\n | Extrapolate\n | string\n | undefined;\n\nfunction getVal(\n type: Extrapolate,\n coef: number,\n val: number,\n leftEdgeOutput: number,\n rightEdgeOutput: number,\n x: number\n): number {\n switch (type) {\n case Extrapolate.IDENTITY:\n return x;\n case Extrapolate.CLAMP:\n if (coef * val < coef * leftEdgeOutput) {\n return leftEdgeOutput;\n }\n return rightEdgeOutput;\n case Extrapolate.EXTEND:\n default:\n return val;\n }\n}\n\nfunction isExtrapolate(value: string): value is Extrapolate {\n return (\n value === Extrapolate.EXTEND ||\n value === Extrapolate.CLAMP ||\n value === Extrapolate.IDENTITY\n );\n}\n\n// validates extrapolations type\n// if type is correct, converts it to ExtrapolationConfig\nexport function validateInterpolationOptions(\n type: ExtrapolationType\n): RequiredExtrapolationConfig {\n // initialize extrapolationConfig with default extrapolation\n const extrapolationConfig: RequiredExtrapolationConfig = {\n extrapolateLeft: Extrapolate.EXTEND,\n extrapolateRight: Extrapolate.EXTEND,\n };\n\n if (!type) {\n return extrapolationConfig;\n }\n\n if (typeof type === \"string\") {\n if (!isExtrapolate(type)) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], \"clamp\")`\n );\n }\n extrapolationConfig.extrapolateLeft = type;\n extrapolationConfig.extrapolateRight = type;\n return extrapolationConfig;\n }\n\n // otherwise type is extrapolation config object\n if (\n (type.extrapolateLeft && !isExtrapolate(type.extrapolateLeft)) ||\n (type.extrapolateRight && !isExtrapolate(type.extrapolateRight))\n ) {\n throw new Error(\n `No supported value for \"interpolate\" \\nSupported values: [\"extend\", \"clamp\", \"identity\", Extrapolatation.CLAMP, Extrapolatation.EXTEND, Extrapolatation.IDENTITY]\\n Valid example:\n interpolate(value, [inputRange], [outputRange], {\n extrapolateLeft: Extrapolation.CLAMP,\n extrapolateRight: Extrapolation.IDENTITY\n }})`\n );\n }\n\n Object.assign(extrapolationConfig, type);\n return extrapolationConfig;\n}\n\nfunction internalInterpolate(\n x: number,\n narrowedInput: InterpolationNarrowedInput,\n extrapolationConfig: RequiredExtrapolationConfig\n) {\n const { leftEdgeInput, rightEdgeInput, leftEdgeOutput, rightEdgeOutput } =\n narrowedInput;\n if (rightEdgeInput - leftEdgeInput === 0) {\n return leftEdgeOutput;\n }\n const progress = (x - leftEdgeInput) / (rightEdgeInput - leftEdgeInput);\n const val = leftEdgeOutput + progress * (rightEdgeOutput - leftEdgeOutput);\n const coef = rightEdgeOutput >= leftEdgeOutput ? 1 : -1;\n\n if (coef * val < coef * leftEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateLeft,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n } else if (coef * val > coef * rightEdgeOutput) {\n return getVal(\n extrapolationConfig.extrapolateRight,\n coef,\n val,\n leftEdgeOutput,\n rightEdgeOutput,\n x\n );\n }\n\n return val;\n}\n\n// e.g. function interpolate(x, input, output, type = Extrapolatation.CLAMP)\nexport function interpolate(\n x: number,\n input: readonly number[],\n output: readonly number[],\n type?: ExtrapolationType\n): number {\n if (input.length < 2 || output.length < 2) {\n throw Error(\n \"Interpolation input and output should contain at least two values.\"\n );\n }\n\n const extrapolationConfig = validateInterpolationOptions(type);\n const { length } = input;\n const narrowedInput: InterpolationNarrowedInput = {\n leftEdgeInput: input[0],\n rightEdgeInput: input[1],\n leftEdgeOutput: output[0],\n rightEdgeOutput: output[1],\n };\n if (length > 2) {\n if (x > input[length - 1]) {\n narrowedInput.leftEdgeInput = input[length - 2];\n narrowedInput.rightEdgeInput = input[length - 1];\n narrowedInput.leftEdgeOutput = output[length - 2];\n narrowedInput.rightEdgeOutput = output[length - 1];\n } else {\n for (let i = 1; i < length; ++i) {\n if (x <= input[i]) {\n narrowedInput.leftEdgeInput = input[i - 1];\n narrowedInput.rightEdgeInput = input[i];\n narrowedInput.leftEdgeOutput = output[i - 1];\n narrowedInput.rightEdgeOutput = output[i];\n break;\n }\n }\n }\n }\n\n return internalInterpolate(x, narrowedInput, extrapolationConfig);\n}\n"],"mappings":";;;;;;;;;AAAA;IACYA,W;;;WAAAA,W;EAAAA,W;EAAAA,W;EAAAA,W;GAAAA,W,2BAAAA,W;;AA6BZ,SAASC,MAAT,CACEC,IADF,EAEEC,IAFF,EAGEC,GAHF,EAIEC,cAJF,EAKEC,eALF,EAMEC,CANF,EAOU;EACR,QAAQL,IAAR;IACE,KAAKF,WAAW,CAACQ,QAAjB;MACE,OAAOD,CAAP;;IACF,KAAKP,WAAW,CAACS,KAAjB;MACE,IAAIN,IAAI,GAAGC,GAAP,GAAaD,IAAI,GAAGE,cAAxB,EAAwC;QACtC,OAAOA,cAAP;MACD;;MACD,OAAOC,eAAP;;IACF,KAAKN,WAAW,CAACU,MAAjB;IACA;MACE,OAAON,GAAP;EAVJ;AAYD;;AAED,SAASO,aAAT,CAAuBC,KAAvB,EAA4D;EAC1D,OACEA,KAAK,KAAKZ,WAAW,CAACU,MAAtB,IACAE,KAAK,KAAKZ,WAAW,CAACS,KADtB,IAEAG,KAAK,KAAKZ,WAAW,CAACQ,QAHxB;AAKD,C,CAED;AACA;;;AACO,SAASK,4BAAT,CACLX,IADK,EAE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AAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACC,MAAM,GAAG,CAAV,CAArC;MACAP,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACC,MAAM,GAAG,CAAV,CAAtC;IACD,CALD,MAKO;MACL,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAApB,EAA4B,EAAEC,CAA9B,EAAiC;QAC/B,IAAItB,CAAC,IAAImB,KAAK,CAACG,CAAD,CAAd,EAAmB;UACjBR,aAAa,CAACC,aAAd,GAA8BI,KAAK,CAACG,CAAC,GAAG,CAAL,CAAnC;UACAR,aAAa,CAACE,cAAd,GAA+BG,KAAK,CAACG,CAAD,CAApC;UACAR,aAAa,CAAChB,cAAd,GAA+BsB,MAAM,CAACE,CAAC,GAAG,CAAL,CAArC;UACAR,aAAa,CAACf,eAAd,GAAgCqB,MAAM,CAACE,CAAD,CAAtC;UACA;QACD;MACF;IACF;EACF;;EAED,OAAOT,mBAAmB,CAACb,CAAD,EAAIc,aAAJ,EAAmBP,mBAAnB,CAA1B;AACD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolateColors.ts"],"names":["interpolateColorsRGB","value","inputRange","outputRange","r","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Skia","Color","mixColors","x","y","c1","c2"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,oBAAoB,GAAG,CAC3BC,KAD2B,EAE3BC,UAF2B,EAG3BC,WAH2B,KAIxB;AACH,QAAMC,CAAC,GAAG,8BACRH,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAMA,QAAMC,CAAC,GAAG,8BACRN,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;AAM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AD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAJsB,CAAjB,CAAP;AAMD,CATM","sourcesContent":["import { mix } from \"../../renderer/processors/math\";\nimport type { Color, SkColor } from \"../../skia\";\nimport { Skia } from \"../../skia\";\n\nimport { interpolate } from \"./interpolate\";\n\nconst interpolateColorsRGB = (\n value: number,\n inputRange: number[],\n outputRange: SkColor[]\n) => {\n const r = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[0]),\n \"clamp\"\n );\n const g = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[1]),\n \"clamp\"\n );\n const b = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[2]),\n \"clamp\"\n );\n const a = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[3]),\n \"clamp\"\n );\n return new Float32Array([r, g, b, a]);\n};\n\nexport const interpolateColors = (\n value: number,\n inputRange: number[],\n _outputRange: Color[]\n) => {\n const outputRange = _outputRange.map((cl) => Skia.Color(cl));\n return interpolateColorsRGB(value, inputRange, outputRange);\n};\n\nexport const mixColors = (value: number, x: Color, y: Color) => {\n const c1 = Skia.Color(x);\n const c2 = Skia.Color(y);\n return new Float32Array([\n mix(value, c1[0], c2[0]),\n mix(value, c1[1], c2[1]),\n mix(value, c1[2], c2[2]),\n mix(value, c1[3], c2[3]),\n ]);\n};\n"]}
1
+ {"version":3,"names":["interpolateColorsRGB","value","inputRange","outputRange","r","interpolate","map","c","g","b","a","Float32Array","interpolateColors","_outputRange","cl","Skia","Color","mixColors","x","y","c1","c2","mix"],"sources":["interpolateColors.ts"],"sourcesContent":["import { mix } from \"../../renderer/processors/math\";\nimport type { Color, SkColor } from \"../../skia\";\nimport { Skia } from \"../../skia\";\n\nimport { interpolate } from \"./interpolate\";\n\nconst interpolateColorsRGB = (\n value: number,\n inputRange: number[],\n outputRange: SkColor[]\n) => {\n const r = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[0]),\n \"clamp\"\n );\n const g = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[1]),\n \"clamp\"\n );\n const b = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[2]),\n \"clamp\"\n );\n const a = interpolate(\n value,\n inputRange,\n outputRange.map((c) => c[3]),\n \"clamp\"\n );\n return new Float32Array([r, g, b, a]);\n};\n\nexport const interpolateColors = (\n value: number,\n inputRange: number[],\n _outputRange: Color[]\n) => {\n const outputRange = _outputRange.map((cl) => Skia.Color(cl));\n return interpolateColorsRGB(value, inputRange, outputRange);\n};\n\nexport const mixColors = (value: number, x: Color, y: Color) => {\n const c1 = Skia.Color(x);\n const c2 = Skia.Color(y);\n return new Float32Array([\n mix(value, c1[0], c2[0]),\n mix(value, c1[1], c2[1]),\n mix(value, c1[2], c2[2]),\n mix(value, c1[3], c2[3]),\n ]);\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,oBAAoB,GAAG,CAC3BC,KAD2B,EAE3BC,UAF2B,EAG3BC,WAH2B,KAIxB;EACH,MAAMC,CAAC,GAAG,IAAAC,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,MAAMC,CAAC,GAAG,IAAAH,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,MAAME,CAAC,GAAG,IAAAJ,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,MAAMG,CAAC,GAAG,IAAAL,wBAAA,EACRJ,KADQ,EAERC,UAFQ,EAGRC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAC,CAAD,CAAxB,CAHQ,EAIR,OAJQ,CAAV;EAMA,OAAO,IAAII,YAAJ,CAAiB,CAACP,CAAD,EAAII,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CAAP;AACD,CA9BD;;AAgCO,MAAME,iBAAiB,GAAG,CAC/BX,KAD+B,EAE/BC,UAF+B,EAG/BW,YAH+B,KAI5B;EACH,MAAMV,WAAW,GAAGU,YAAY,CAACP,GAAb,CAAkBQ,EAAD,IAAQC,UAAA,CAAKC,KAAL,CAAWF,EAAX,CAAzB,CAApB;;EACA,OAAOd,oBAAoB,CAACC,KAAD,EAAQC,UAAR,EAAoBC,WAApB,CAA3B;AACD,CAPM;;;;AASA,MAAMc,SAAS,GAAG,CAAChB,KAAD,EAAgBiB,CAAhB,EAA0BC,CAA1B,KAAuC;EAC9D,MAAMC,EAAE,GAAGL,UAAA,CAAKC,KAAL,CAAWE,CAAX,CAAX;;EACA,MAAMG,EAAE,GAAGN,UAAA,CAAKC,KAAL,CAAWG,CAAX,CAAX;;EACA,OAAO,IAAIR,YAAJ,CAAiB,CACtB,IAAAW,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CADsB,EAEtB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAFsB,EAGtB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAHsB,EAItB,IAAAC,SAAA,EAAIrB,KAAJ,EAAWmB,EAAE,CAAC,CAAD,CAAb,EAAkBC,EAAE,CAAC,CAAD,CAApB,CAJsB,CAAjB,CAAP;AAMD,CATM"}
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolatePaths.ts"],"names":["lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrap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ACA,WAAW,CAACS,MAAZ,GAAqB,CAAtB,CAAlB;;AACF,WAAKL,yBAAYE,MAAjB;AACE,eAAOhB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACA,KAAK,CAACU,MAAN,GAAe,CAAhB,CAFI,EAGTV,KAAK,CAACA,KAAK,CAACU,MAAN,GAAe,CAAhB,CAHI,EAITT,WAAW,CAACD,KAAK,CAACU,MAAN,GAAe,CAAhB,CAJF,EAKTT,WAAW,CAACD,KAAK,CAACU,MAAN,GAAe,CAAhB,CALF,CAAX;;AAOF,WAAKL,yBAAYG,QAAjB;AACE,cAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;AAGF;AACE,wCAAgBN,aAAa,CAACQ,gBAA9B;AAhBJ;AAkBD;;AACD,MAAIC,CAAC,GAAG,CAAR;;AACA,SAAOA,CAAC,IAAIZ,KAAK,CAACU,MAAN,GAAe,CAA3B,EAA8BE,CAAC,EAA/B,EAAmC;AACjC,QAAIpB,KAAK,IAAIQ,KAAK,CAACY,CAAD,CAAd,IAAqBpB,KAAK,IAAIQ,KAAK,CAACY,CAAC,GAAG,CAAL,CAAvC,EAAgD;AAC9C;AACD;AACF;;AACD,SAAOrB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACY,CAAD,CAFI,EAGTZ,KAAK,CAACY,CAAC,GAAG,CAAL,CAHI,EAITX,WAAW,CAACW,CAAD,CAJF,EAKTX,WAAW,CAACW,CAAC,GAAG,CAAL,CALF,CAAX;AAOD,CArDM","sourcesContent":["import type { SkPath } from \"../../skia/types\";\nimport { exhaustiveCheck } from \"../../renderer/typeddash\";\n\nimport type { ExtrapolationType } from \"./interpolate\";\nimport { validateInterpolationOptions, Extrapolate } from \"./interpolate\";\n\nconst lerp = (\n value: number,\n from: number,\n to: number,\n p1: SkPath,\n p2: SkPath\n) => {\n const t = (value - from) / (to - from);\n return p2.interpolate(p1, t)!;\n};\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @param options - Extrapolation options\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n const extrapolation = validateInterpolationOptions(options);\n if (value < input[0]) {\n switch (extrapolation.extrapolateLeft) {\n case Extrapolate.CLAMP:\n return outputRange[0];\n case Extrapolate.EXTEND:\n return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateLeft);\n }\n } else if (value > input[input.length - 1]) {\n switch (extrapolation.extrapolateRight) {\n case Extrapolate.CLAMP:\n return outputRange[outputRange.length - 1];\n case Extrapolate.EXTEND:\n return lerp(\n value,\n input[input.length - 2],\n input[input.length - 1],\n outputRange[input.length - 2],\n outputRange[input.length - 1]\n );\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateRight);\n }\n }\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n }\n return lerp(\n value,\n input[i],\n input[i + 1],\n outputRange[i],\n outputRange[i + 1]\n );\n};\n"]}
1
+ {"version":3,"names":["lerp","value","from","to","p1","p2","t","interpolate","interpolatePaths","input","outputRange","options","extrapolation","validateInterpolationOptions","extrapolateLeft","Extrapolate","CLAMP","EXTEND","IDENTITY","Error","exhaustiveCheck","length","extrapolateRight","i"],"sources":["interpolatePaths.ts"],"sourcesContent":["import type { SkPath } from \"../../skia/types\";\nimport { exhaustiveCheck } from \"../../renderer/typeddash\";\n\nimport type { ExtrapolationType } from \"./interpolate\";\nimport { validateInterpolationOptions, Extrapolate } from \"./interpolate\";\n\nconst lerp = (\n value: number,\n from: number,\n to: number,\n p1: SkPath,\n p2: SkPath\n) => {\n const t = (value - from) / (to - from);\n return p2.interpolate(p1, t)!;\n};\n\n/**\n * Maps an input value within a range to an output path within a path range.\n * @param value - The input value.\n * @param inputRange - The range of the input value.\n * @param outputRange - The range of the output path.\n * @param options - Extrapolation options\n * @returns The output path.\n * @example <caption>Map a value between 0 and 1 to a path between two paths.</caption>\n * const path1 = new Path();\n * path1.moveTo(0, 0);\n * path1.lineTo(100, 0);\n * const path2 = new Path();\n * path2.moveTo(0, 0);\n * path2.lineTo(0, 100);\n * const path = interpolatePath(0.5, [0, 1], [path1, path2]);\n */\nexport const interpolatePaths = (\n value: number,\n input: number[],\n outputRange: SkPath[],\n options?: ExtrapolationType\n) => {\n const extrapolation = validateInterpolationOptions(options);\n if (value < input[0]) {\n switch (extrapolation.extrapolateLeft) {\n case Extrapolate.CLAMP:\n return outputRange[0];\n case Extrapolate.EXTEND:\n return lerp(value, input[0], input[1], outputRange[0], outputRange[1]);\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateLeft);\n }\n } else if (value > input[input.length - 1]) {\n switch (extrapolation.extrapolateRight) {\n case Extrapolate.CLAMP:\n return outputRange[outputRange.length - 1];\n case Extrapolate.EXTEND:\n return lerp(\n value,\n input[input.length - 2],\n input[input.length - 1],\n outputRange[input.length - 2],\n outputRange[input.length - 1]\n );\n case Extrapolate.IDENTITY:\n throw new Error(\n \"Identity is not a supported extrapolation type for interpolatePaths()\"\n );\n default:\n exhaustiveCheck(extrapolation.extrapolateRight);\n }\n }\n let i = 0;\n for (; i <= input.length - 1; i++) {\n if (value >= input[i] && value <= input[i + 1]) {\n break;\n }\n }\n return lerp(\n value,\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,CAAYC,KAAjB;QACE,OAAON,WAAW,CAACA,WAAW,CAACW,MAAZ,GAAqB,CAAtB,CAAlB;;MACF,KAAKN,wBAAA,CAAYE,MAAjB;QACE,OAAOjB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAFI,EAGTZ,KAAK,CAACA,KAAK,CAACY,MAAN,GAAe,CAAhB,CAHI,EAITX,WAAW,CAACD,KAAK,CAACY,MAAN,GAAe,CAAhB,CAJF,EAKTX,WAAW,CAACD,KAAK,CAACY,MAAN,GAAe,CAAhB,CALF,CAAX;;MAOF,KAAKN,wBAAA,CAAYG,QAAjB;QACE,MAAM,IAAIC,KAAJ,CACJ,uEADI,CAAN;;MAGF;QACE,IAAAC,0BAAA,EAAgBR,aAAa,CAACU,gBAA9B;IAhBJ;EAkBD;;EACD,IAAIC,CAAC,GAAG,CAAR;;EACA,OAAOA,CAAC,IAAId,KAAK,CAACY,MAAN,GAAe,CAA3B,EAA8BE,CAAC,EAA/B,EAAmC;IACjC,IAAItB,KAAK,IAAIQ,KAAK,CAACc,CAAD,CAAd,IAAqBtB,KAAK,IAAIQ,KAAK,CAACc,CAAC,GAAG,CAAL,CAAvC,EAAgD;MAC9C;IACD;EACF;;EACD,OAAOvB,IAAI,CACTC,KADS,EAETQ,KAAK,CAACc,CAAD,CAFI,EAGTd,KAAK,CAACc,CAAC,GAAG,CAAL,CAHI,EAITb,WAAW,CAACa,CAAD,CAJF,EAKTb,WAAW,CAACa,CAAC,GAAG,CAAL,CALF,CAAX;AAOD,CArDM"}
@@ -1 +1 @@
1
- {"version":3,"sources":["interpolateVector.ts"],"names":["interpolateVector","value","inputRange","outputRange","options","x","map","v","y","mixVector","from","to"],"mappings":";;;;;;;AAEA;;AAEO,MAAMA,iBAAiB,GAAG,CAC/BC,KAD+B,EAE/BC,UAF+B,EAG/BC,WAH+B,EAI/BC,OAJ+B,MAK3B;AACJC,EAAAA,CAAC,EAAE,8BACDJ,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACF,CAAzB,CAHC,EAIDD,OAJC,CADC;AAOJI,EAAAA,CAAC,EAAE,8BACDP,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACC,CAAzB,CAHC,EAIDJ,OAJC;AAPC,CAL2B,CAA1B;;;;AAoBA,MAAMK,SAAS,GAAG,CAACR,KAAD,EAAgBS,IAAhB,EAA8BC,EAA9B,KACvBX,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACS,IAAD,EAAOC,EAAP,CAAhB,CADZ","sourcesContent":["import type { Vector } from \"../../skia/types\";\n\nimport { interpolate } from \"./interpolate\";\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"]}
1
+ {"version":3,"names":["interpolateVector","value","inputRange","outputRange","options","x","interpolate","map","v","y","mixVector","from","to"],"sources":["interpolateVector.ts"],"sourcesContent":["import type { Vector } from \"../../skia/types\";\n\nimport { interpolate } from \"./interpolate\";\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"],"mappings":";;;;;;;AAEA;;AAEO,MAAMA,iBAAiB,GAAG,CAC/BC,KAD+B,EAE/BC,UAF+B,EAG/BC,WAH+B,EAI/BC,OAJ+B,MAK3B;EACJC,CAAC,EAAE,IAAAC,wBAAA,EACDL,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACI,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACH,CAAzB,CAHC,EAIDD,OAJC,CADC;EAOJK,CAAC,EAAE,IAAAH,wBAAA,EACDL,KADC,EAEDC,UAFC,EAGDC,WAAW,CAACI,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACC,CAAzB,CAHC,EAIDL,OAJC;AAPC,CAL2B,CAA1B;;;;AAoBA,MAAMM,SAAS,GAAG,CAACT,KAAD,EAAgBU,IAAhB,EAA8BC,EAA9B,KACvBZ,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACU,IAAD,EAAOC,EAAP,CAAhB,CADZ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./timing\";\nexport * from \"./spring\";\nexport * from \"./decay\";\nexport * from \"./functions\";\n"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./timing\";\nexport * from \"./spring\";\nexport * from \"./decay\";\nexport * from \"./functions\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["Spring.ts"],"names":["Config","Gentle","mass","stiffness","damping","velocity","Wobbly","WobblySlow","Stiff","Default","Spring","config"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA,MAAMA,MAAM,GAAG;AACbC,EAAAA,MAAM,EAAE;AACNC,IAAAA,IAAI,EAAE,CADA;AAENC,IAAAA,SAAS,EAAE,GAFL;AAGNC,IAAAA,OAAO,EAAE,EAHH;AAINC,IAAAA,QAAQ,EAAE;AAJJ,GADK;AAObC,EAAAA,MAAM,EAAE;AACNJ,IAAAA,IAAI,EAAE,CADA;AAENC,IAAAA,SAAS,EAAE,GAFL;AAGNC,IAAAA,OAAO,EAAE,EAHH;AAINC,IAAAA,QAAQ,EAAE;AAJJ,GAPK;AAabE,EAAAA,UAAU,EAAE;AACVL,IAAAA,IAAI,EAAE,CADI;AAEVC,IAAAA,SAAS,EAAE,GAFD;AAGVC,IAAAA,OAAO,EAAE,EAHC;AAIVC,IAAAA,QAAQ,EAAE;AAJA,GAbC;AAmBbG,EAAAA,KAAK,EAAE;AACLN,IAAAA,IAAI,EAAE,CADD;AAELC,IAAAA,SAAS,EAAE,GAFN;AAGLC,IAAAA,OAAO,EAAE,EAHJ;AAILC,IAAAA,QAAQ,EAAE;AAJL,GAnBM;AAyBbI,EAAAA,OAAO,EAAE;AACPP,IAAAA,IAAI,EAAE,CADC;AAEPC,IAAAA,SAAS,EAAE,GAFJ;AAGPC,IAAAA,OAAO,EAAE,EAHF;AAIPC,IAAAA,QAAQ,EAAE;AAJH;AAzBI,CAAf;AAiCO,MAAMK,MAAM,GAAG;AACpBV,EAAAA,MADoB;AAEpBC,EAAAA,MAAM,EAAE;AAAA,QAACU,MAAD,uEAAwB,EAAxB;AAAA,WAAgC,EACtC,GAAGX,MAAM,CAACC,MAD4B;AAEtC,SAAGU;AAFmC,KAAhC;AAAA,GAFY;AAMpBL,EAAAA,MAAM,EAAE;AAAA,QAACK,MAAD,uEAAwB,EAAxB;AAAA,WAAgC,EACtC,GAAGX,MAAM,CAACM,MAD4B;AAEtC,SAAGK;AAFmC,KAAhC;AAAA,GANY;AAUpBJ,EAAAA,UAAU,EAAE;AAAA,QAACI,MAAD,uEAAwB,EAAxB;AAAA,WAAgC,EAC1C,GAAGX,MAAM,CAACO,UADgC;AAE1C,SAAGI;AAFuC,KAAhC;AAAA,GAVQ;AAcpBH,EAAAA,KAAK,EAAE;AAAA,QAACG,MAAD,uEAAwB,EAAxB;AAAA,WAAgC,EACrC,GAAGX,MAAM,CAACQ,KAD2B;AAErC,SAAGG;AAFkC,KAAhC;AAAA,GAda;AAkBpBF,EAAAA,OAAO,EAAE;AAAA,QAACE,MAAD,uEAAwB,EAAxB;AAAA,WAAgC,EACvC,GAAGX,MAAM,CAACS,OAD6B;AAEvC,SAAGE;AAFoC,KAAhC;AAAA;AAlBW,CAAf","sourcesContent":["import type { SpringConfig } from \"./types\";\n\n/*\n Spring animation configurations\n*/\nconst Config = {\n Gentle: {\n mass: 1,\n stiffness: 170,\n damping: 19,\n velocity: 0,\n },\n Wobbly: {\n mass: 1,\n stiffness: 180,\n damping: 12,\n velocity: 0,\n },\n WobblySlow: {\n mass: 4,\n stiffness: 180,\n damping: 25,\n velocity: 0,\n },\n Stiff: {\n mass: 1,\n stiffness: 200,\n damping: 20,\n velocity: 0,\n },\n Default: {\n mass: 1,\n stiffness: 100,\n damping: 10,\n velocity: 0,\n },\n};\n\nexport const Spring = {\n Config,\n Gentle: (config: SpringConfig = {}) => ({\n ...Config.Gentle,\n ...config,\n }),\n Wobbly: (config: SpringConfig = {}) => ({\n ...Config.Wobbly,\n ...config,\n }),\n WobblySlow: (config: SpringConfig = {}) => ({\n ...Config.WobblySlow,\n ...config,\n }),\n Stiff: (config: SpringConfig = {}) => ({\n ...Config.Stiff,\n ...config,\n }),\n Default: (config: SpringConfig = {}) => ({\n ...Config.Default,\n ...config,\n }),\n};\n"]}
1
+ {"version":3,"names":["Config","Gentle","mass","stiffness","damping","velocity","Wobbly","WobblySlow","Stiff","Default","Spring","config"],"sources":["Spring.ts"],"sourcesContent":["import type { SpringConfig } from \"./types\";\n\n/*\n Spring animation configurations\n*/\nconst Config = {\n Gentle: {\n mass: 1,\n stiffness: 170,\n damping: 19,\n velocity: 0,\n },\n Wobbly: {\n mass: 1,\n stiffness: 180,\n damping: 12,\n velocity: 0,\n },\n WobblySlow: {\n mass: 4,\n stiffness: 180,\n damping: 25,\n velocity: 0,\n },\n Stiff: {\n mass: 1,\n stiffness: 200,\n damping: 20,\n velocity: 0,\n },\n Default: {\n mass: 1,\n stiffness: 100,\n damping: 10,\n velocity: 0,\n },\n};\n\nexport const Spring = {\n Config,\n Gentle: (config: SpringConfig = {}) => ({\n ...Config.Gentle,\n ...config,\n }),\n Wobbly: (config: SpringConfig = {}) => ({\n ...Config.Wobbly,\n ...config,\n }),\n WobblySlow: (config: SpringConfig = {}) => ({\n ...Config.WobblySlow,\n ...config,\n }),\n Stiff: (config: SpringConfig = {}) => ({\n ...Config.Stiff,\n ...config,\n }),\n Default: (config: SpringConfig = {}) => ({\n ...Config.Default,\n ...config,\n }),\n};\n"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA,MAAMA,MAAM,GAAG;EACbC,MAAM,EAAE;IACNC,IAAI,EAAE,CADA;IAENC,SAAS,EAAE,GAFL;IAGNC,OAAO,EAAE,EAHH;IAINC,QAAQ,EAAE;EAJJ,CADK;EAObC,MAAM,EAAE;IACNJ,IAAI,EAAE,CADA;IAENC,SAAS,EAAE,GAFL;IAGNC,OAAO,EAAE,EAHH;IAINC,QAAQ,EAAE;EAJJ,CAPK;EAabE,UAAU,EAAE;IACVL,IAAI,EAAE,CADI;IAEVC,SAAS,EAAE,GAFD;IAGVC,OAAO,EAAE,EAHC;IAIVC,QAAQ,EAAE;EAJA,CAbC;EAmBbG,KAAK,EAAE;IACLN,IAAI,EAAE,CADD;IAELC,SAAS,EAAE,GAFN;IAGLC,OAAO,EAAE,EAHJ;IAILC,QAAQ,EAAE;EAJL,CAnBM;EAyBbI,OAAO,EAAE;IACPP,IAAI,EAAE,CADC;IAEPC,SAAS,EAAE,GAFJ;IAGPC,OAAO,EAAE,EAHF;IAIPC,QAAQ,EAAE;EAJH;AAzBI,CAAf;AAiCO,MAAMK,MAAM,GAAG;EACpBV,MADoB;EAEpBC,MAAM,EAAE;IAAA,IAACU,MAAD,uEAAwB,EAAxB;IAAA,OAAgC,EACtC,GAAGX,MAAM,CAACC,MAD4B;MAEtC,GAAGU;IAFmC,CAAhC;EAAA,CAFY;EAMpBL,MAAM,EAAE;IAAA,IAACK,MAAD,uEAAwB,EAAxB;IAAA,OAAgC,EACtC,GAAGX,MAAM,CAACM,MAD4B;MAEtC,GAAGK;IAFmC,CAAhC;EAAA,CANY;EAUpBJ,UAAU,EAAE;IAAA,IAACI,MAAD,uEAAwB,EAAxB;IAAA,OAAgC,EAC1C,GAAGX,MAAM,CAACO,UADgC;MAE1C,GAAGI;IAFuC,CAAhC;EAAA,CAVQ;EAcpBH,KAAK,EAAE;IAAA,IAACG,MAAD,uEAAwB,EAAxB;IAAA,OAAgC,EACrC,GAAGX,MAAM,CAACQ,KAD2B;MAErC,GAAGG;IAFkC,CAAhC;EAAA,CAda;EAkBpBF,OAAO,EAAE;IAAA,IAACE,MAAD,uEAAwB,EAAxB;IAAA,OAAgC,EACvC,GAAGX,MAAM,CAACS,OAD6B;MAEvC,GAAGE;IAFoC,CAAhC;EAAA;AAlBW,CAAf"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { createSpringEasing } from \"./spring\";\n"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { createSpringEasing } from \"./spring\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["spring.ts"],"names":["createSpringEasing","params","config","mass","stiffness","damping","velocity","getSpringEasing","initialVelocity","state","w0","Math","sqrt","zeta","wd","a","b","update","t","duration","progress","exp","cos","sin","getDurationMs","frame","elapsed","rest","durationMs","easing"],"mappings":";;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAC7BC,MADgC,IAEf;AACjB,QAAMC,MAAM,GAAG;AACbC,IAAAA,IAAI,EAAE,CADO;AAEbC,IAAAA,SAAS,EAAE,GAFE;AAGbC,IAAAA,OAAO,EAAE,EAHI;AAIbC,IAAAA,QAAQ,EAAE,CAJG;AAKb,OAAGL;AALU,GAAf;AAOAC,EAAAA,MAAM,CAACI,QAAP,IAAmB,GAAnB;AACA,SAAOC,eAAe,CAACL,MAAD,CAAtB;AACD,CAZM;;;;AAcP,MAAMK,eAAe,GAAIL,MAAD,IAAoC;AAC1D,QAAM;AAAEE,IAAAA,SAAF;AAAaD,IAAAA,IAAb;AAAmBE,IAAAA,OAAnB;AAA4BC,IAAAA,QAAQ,EAAEE;AAAtC,MAA0DN,MAAhE,CAD0D,CAE1D;;AACA,QAAMO,KAAK,GAAG;AACZC,IAAAA,EAAE,EAAEC,IAAI,CAACC,IAAL,CAAUR,SAAS,GAAGD,IAAtB,CADQ;AAEZU,IAAAA,IAAI,EAAE,CAFM;AAGZC,IAAAA,EAAE,EAAE,CAHQ;AAIZC,IAAAA,CAAC,EAAE,CAJS;AAKZC,IAAAA,CAAC,EAAE;AALS,GAAd;AAOAP,EAAAA,KAAK,CAACI,IAAN,GAAaR,OAAO,IAAI,IAAIM,IAAI,CAACC,IAAL,CAAUR,SAAS,GAAGD,IAAtB,CAAR,CAApB;AACAM,EAAAA,KAAK,CAACK,EAAN,GACEL,KAAK,CAACI,IAAN,GAAa,CAAb,GAAiBJ,KAAK,CAACC,EAAN,GAAWC,IAAI,CAACC,IAAL,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AAI,CAAhB;AACA,QAAIC,OAAO,GAAG,CAAd;AACA,QAAIC,IAAI,GAAG,CAAX;;AACA,WAAO,IAAP,EAAa;AACXD,MAAAA,OAAO,IAAID,KAAX;;AACA,UAAIR,MAAM,CAACS,OAAD,CAAN,KAAoB,CAAxB,EAA2B;AACzBC,QAAAA,IAAI;;AACJ,YAAIA,IAAI,IAAI,CAAZ,EAAe;AACb;AACD;AACF,OALD,MAKO;AACLA,QAAAA,IAAI,GAAG,CAAP;AACD;AACF;;AACD,QAAIC,UAAU,GAAGF,OAAO,GAAGD,KAAV,GAAkB,IAAnC;AACA,WAAOG,UAAU,GAAG,IAApB;AACD,GAjBD;;AAmBA,QAAMA,UAAU,GAAGJ,aAAa,EAAhC;AAEA,SAAO;AACLK,IAAAA,MAAM,EAAGX,CAAD,IAAeD,MAAM,CAACC,CAAD,EAAIU,UAAJ,CADxB;AAELT,IAAAA,QAAQ,EAAES;AAFL,GAAP;AAID,CA7DD","sourcesContent":["import type { SpringConfig } from \"../types\";\nimport type { TimingConfig } from \"../../types\";\n\n/**\n * @description Returns a cached jsContext function for a spring with duration\n * @param mass The mass of the spring\n * @param stiffness The stiffness of the spring\n * @param damping Spring damping\n * @param velocity The initial velocity\n */\nexport const createSpringEasing = (\n params: Partial<SpringConfig>\n): TimingConfig => {\n const config = {\n mass: 1,\n stiffness: 100,\n damping: 10,\n velocity: 0,\n ...params,\n };\n config.velocity /= 100;\n return getSpringEasing(config);\n};\n\nconst getSpringEasing = (config: Required<SpringConfig>) => {\n const { stiffness, mass, damping, velocity: initialVelocity } = config;\n // Setup spring state\n const state = {\n w0: Math.sqrt(stiffness / mass),\n zeta: 0,\n wd: 0,\n a: 1,\n b: 0,\n };\n state.zeta = damping / (2 * Math.sqrt(stiffness * mass));\n state.wd =\n state.zeta < 1 ? state.w0 * Math.sqrt(1 - state.zeta * state.zeta) : 0;\n state.a = 1;\n state.b =\n state.zeta < 1\n ? (state.zeta * state.w0 + -initialVelocity) / state.wd\n : -initialVelocity + state.w0;\n\n const update = (t: number, duration?: number) => {\n let progress = duration ? (duration * t) / 1000 : t;\n if (state.zeta < 1) {\n progress =\n Math.exp(-progress * state.zeta * state.w0) *\n (state.a * Math.cos(state.wd * progress) +\n state.b * Math.sin(state.wd * progress));\n } else {\n progress =\n (state.a + state.b * progress) * Math.exp(-progress * state.w0);\n }\n if (t === 0 || t === 1) {\n return t;\n }\n return 1 - progress;\n };\n\n const getDurationMs = () => {\n var frame = 1 / 6;\n var elapsed = 0;\n var rest = 0;\n while (true) {\n elapsed += frame;\n if (update(elapsed) === 1) {\n rest++;\n if (rest >= 6) {\n break;\n }\n } else {\n rest = 0;\n }\n }\n var durationMs = elapsed * frame * 1000;\n return durationMs + 1000;\n };\n\n const durationMs = getDurationMs();\n\n return {\n easing: (t: number) => update(t, durationMs),\n duration: durationMs,\n };\n};\n"]}
1
+ {"version":3,"names":["createSpringEasing","params","config","mass","stiffness","damping","velocity","getSpringEasing","initialVelocity","state","w0","Math","sqrt","zeta","wd","a","b","update","t","duration","progress","exp","cos","sin","getDurationMs","frame","elapsed","rest","durationMs","easing"],"sources":["spring.ts"],"sourcesContent":["import type { SpringConfig } from \"../types\";\nimport type { TimingConfig } from \"../../types\";\n\n/**\n * @description Returns a cached jsContext function for a spring with duration\n * @param mass The mass of the spring\n * @param stiffness The stiffness of the spring\n * @param damping Spring damping\n * @param velocity The initial velocity\n */\nexport const createSpringEasing = (\n params: Partial<SpringConfig>\n): TimingConfig => {\n const config = {\n mass: 1,\n stiffness: 100,\n damping: 10,\n velocity: 0,\n ...params,\n };\n config.velocity /= 100;\n return getSpringEasing(config);\n};\n\nconst getSpringEasing = (config: Required<SpringConfig>) => {\n const { stiffness, mass, damping, velocity: initialVelocity } = config;\n // Setup spring state\n const state = {\n w0: Math.sqrt(stiffness / mass),\n zeta: 0,\n wd: 0,\n a: 1,\n b: 0,\n };\n state.zeta = damping / (2 * Math.sqrt(stiffness * mass));\n state.wd =\n state.zeta < 1 ? state.w0 * Math.sqrt(1 - state.zeta * state.zeta) : 0;\n state.a = 1;\n state.b =\n state.zeta < 1\n ? (state.zeta * state.w0 + -initialVelocity) / state.wd\n : -initialVelocity + state.w0;\n\n const update = (t: number, duration?: number) => {\n let progress = duration ? (duration * t) / 1000 : t;\n if (state.zeta < 1) {\n progress =\n Math.exp(-progress * state.zeta * state.w0) *\n (state.a * Math.cos(state.wd * progress) +\n state.b * Math.sin(state.wd * progress));\n } else {\n progress =\n (state.a + state.b * progress) * Math.exp(-progress * state.w0);\n }\n if (t === 0 || t === 1) {\n return t;\n }\n return 1 - progress;\n };\n\n const getDurationMs = () => {\n var frame = 1 / 6;\n var elapsed = 0;\n var rest = 0;\n while (true) {\n elapsed += frame;\n if (update(elapsed) === 1) {\n rest++;\n if (rest >= 6) {\n break;\n }\n } else {\n rest = 0;\n }\n }\n var durationMs = elapsed * frame * 1000;\n return durationMs + 1000;\n };\n\n const durationMs = getDurationMs();\n\n return {\n easing: (t: number) => update(t, durationMs),\n duration: durationMs,\n };\n};\n"],"mappings":";;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,kBAAkB,GAC7BC,MADgC,IAEf;EACjB,MAAMC,MAAM,GAAG;IACbC,IAAI,EAAE,CADO;IAEbC,SAAS,EAAE,GAFE;IAGbC,OAAO,EAAE,EAHI;IAIbC,QAAQ,EAAE,CAJG;IAKb,GAAGL;EALU,CAAf;EAOAC,MAAM,CAACI,QAAP,IAAmB,GAAnB;EACA,OAAOC,eAAe,CAACL,MAAD,CAAtB;AACD,CAZM;;;;AAcP,MAAMK,eAAe,GAAIL,MAAD,IAAoC;EAC1D,MAAM;IAAEE,SAAF;IAAaD,IAAb;IAAmBE,OAAnB;IAA4BC,QAAQ,EAAEE;EAAtC,IAA0DN,MAAhE,CAD0D,CAE1D;;EACA,MAAMO,KAAK,GAAG;IACZC,EAAE,EAAEC,IAAI,CAACC,IAAL,CAAUR,SAAS,GAAGD,IAAtB,CADQ;IAEZU,IAA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O,CAAN,GAAUI,QAArB,IAAiCT,IAAI,CAACU,GAAL,CAAS,CAACD,QAAD,GAAYX,KAAK,CAACC,EAA3B,CADnC;IAED;;IACD,IAAIQ,CAAC,KAAK,CAAN,IAAWA,CAAC,KAAK,CAArB,EAAwB;MACtB,OAAOA,CAAP;IACD;;IACD,OAAO,IAAIE,QAAX;EACD,CAfD;;EAiBA,MAAMI,aAAa,GAAG,MAAM;IAC1B,IAAIC,KAAK,GAAG,IAAI,CAAhB;IACA,IAAIC,OAAO,GAAG,CAAd;IACA,IAAIC,IAAI,GAAG,CAAX;;IACA,OAAO,IAAP,EAAa;MACXD,OAAO,IAAID,KAAX;;MACA,IAAIR,MAAM,CAACS,OAAD,CAAN,KAAoB,CAAxB,EAA2B;QACzBC,IAAI;;QACJ,IAAIA,IAAI,IAAI,CAAZ,EAAe;UACb;QACD;MACF,CALD,MAKO;QACLA,IAAI,GAAG,CAAP;MACD;IACF;;IACD,IAAIC,UAAU,GAAGF,OAAO,GAAGD,KAAV,GAAkB,IAAnC;IACA,OAAOG,UAAU,GAAG,IAApB;EACD,CAjBD;;EAmBA,MAAMA,UAAU,GAAGJ,aAAa,EAAhC;EAEA,OAAO;IACLK,MAAM,EAAGX,CAAD,IAAeD,MAAM,CAACC,CAAD,EAAIU,UAAJ,CADxB;IAELT,QAAQ,EAAES;EAFL,CAAP;AAID,CA7DD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["export { Spring } from \"./Spring\";\nexport { runSpring } from \"./runSpring\";\nexport { useSpring } from \"./useSpring\";\n"]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Spring } from \"./Spring\";\nexport { runSpring } from \"./runSpring\";\nexport { useSpring } from \"./useSpring\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA"}
@@ -25,7 +25,7 @@ var _spring = require("./functions/spring");
25
25
  * the animation.
26
26
  */
27
27
  const runSpring = (value, toOrParams, config, callback) => {
28
- return (0, _runTiming.runTiming)(value, toOrParams, (0, _spring.createSpringEasing)(config !== null && config !== void 0 ? config : _Spring.Spring.Config.Default), callback);
28
+ return (0, _runTiming.runTiming)(value, toOrParams, (0, _spring.createSpringEasing)(config ?? _Spring.Spring.Config.Default), callback);
29
29
  };
30
30
 
31
31
  exports.runSpring = runSpring;
@@ -1 +1 @@
1
- {"version":3,"sources":["runSpring.ts"],"names":["runSpring","value","toOrParams","config","callback","Spring","Config","Default"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;AAClB,SAAO,0BACLH,KADK,EAELC,UAFK,EAGL,gCAAmBC,MAAnB,aAAmBA,MAAnB,cAAmBA,MAAnB,GAA6BE,eAAOC,MAAP,CAAcC,OAA3C,CAHK,EAILH,QAJK,CAAP;AAMD,CAZM","sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n SpringConfig,\n AnimationCallback,\n} from \"../types\";\nimport { runTiming } from \"../timing/runTiming\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runSpring = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n return runTiming(\n value,\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n};\n"]}
1
+ {"version":3,"names":["runSpring","value","toOrParams","config","callback","runTiming","createSpringEasing","Spring","Config","Default"],"sources":["runSpring.ts"],"sourcesContent":["import type { SkiaMutableValue, SkiaAnimation } from \"../../values/types\";\nimport type {\n AnimationParams,\n SpringConfig,\n AnimationCallback,\n} from \"../types\";\nimport { runTiming } from \"../timing/runTiming\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creates a new animation on an existing value that will be driven by\n * an animation value. The value will be run from / to the value in\n * params and modified by the provided easing curve for the length of\n * the duration. When the value has reached its desired \"to\" value the\n * animation will be stopped.\n *\n * @param value The value to animate\n * @param toOrParams To value or Animation parameters\n * @param config Spring configuration\n * @returns an animation value that can be used to start/stop\n * the animation.\n */\nexport const runSpring = (\n value: SkiaMutableValue<number>,\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaAnimation => {\n return runTiming(\n value,\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n};\n"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,KADuB,EAEvBC,UAFuB,EAGvBC,MAHuB,EAIvBC,QAJuB,KAKL;EAClB,OAAO,IAAAC,oBAAA,EACLJ,KADK,EAELC,UAFK,EAGL,IAAAI,0BAAA,EAAmBH,MAAM,IAAII,cAAA,CAAOC,MAAP,CAAcC,OAA3C,CAHK,EAILL,QAJK,CAAP;AAMD,CAZM"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface SpringConfig {\n mass?: number;\n stiffness?: number;\n velocity?: number;\n damping?: number;\n}\n"],"mappings":""}
@@ -18,7 +18,7 @@ var _spring = require("./functions/spring");
18
18
  * @param config
19
19
  * @returns
20
20
  */
21
- const useSpring = (toOrParams, config, callback) => (0, _timing.useTiming)(toOrParams, (0, _spring.createSpringEasing)(config !== null && config !== void 0 ? config : _Spring.Spring.Config.Default), callback);
21
+ const useSpring = (toOrParams, config, callback) => (0, _timing.useTiming)(toOrParams, (0, _spring.createSpringEasing)(config ?? _Spring.Spring.Config.Default), callback);
22
22
 
23
23
  exports.useSpring = useSpring;
24
24
  //# sourceMappingURL=useSpring.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useSpring.ts"],"names":["useSpring","toOrParams","config","callback","Spring","Config","Default"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAKvB,uBACEF,UADF,EAEE,gCAAmBC,MAAnB,aAAmBA,MAAnB,cAAmBA,MAAnB,GAA6BE,eAAOC,MAAP,CAAcC,OAA3C,CAFF,EAGEH,QAHF,CALK","sourcesContent":["import type { SkiaValue } from \"../../values/types\";\nimport type {\n SpringConfig,\n AnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport { useTiming } from \"../timing\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creats a spring based animation value that will run whenever\n * the animation parameters change.\n * @param toOrParams\n * @param config\n * @returns\n */\nexport const useSpring = (\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaValue<number> =>\n useTiming(\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n"]}
1
+ {"version":3,"names":["useSpring","toOrParams","config","callback","useTiming","createSpringEasing","Spring","Config","Default"],"sources":["useSpring.ts"],"sourcesContent":["import type { SkiaValue } from \"../../values/types\";\nimport type {\n SpringConfig,\n AnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport { useTiming } from \"../timing\";\n\nimport { Spring } from \"./Spring\";\nimport { createSpringEasing } from \"./functions/spring\";\n\n/**\n * Creats a spring based animation value that will run whenever\n * the animation parameters change.\n * @param toOrParams\n * @param config\n * @returns\n */\nexport const useSpring = (\n toOrParams: number | AnimationParams,\n config?: SpringConfig,\n callback?: AnimationCallback\n): SkiaValue<number> =>\n useTiming(\n toOrParams,\n createSpringEasing(config ?? Spring.Config.Default),\n callback\n );\n"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,GAAG,CACvBC,UADuB,EAEvBC,MAFuB,EAGvBC,QAHuB,KAKvB,IAAAC,iBAAA,EACEH,UADF,EAEE,IAAAI,0BAAA,EAAmBH,MAAM,IAAII,cAAA,CAAOC,MAAP,CAAcC,OAA3C,CAFF,EAGEL,QAHF,CALK"}
@@ -1 +1 @@
1
- {"version":3,"sources":["Easing.ts"],"names":["Easing","step0","n","step1","linear","t","ease","bezier","quad","cubic","poly","sin","Math","cos","PI","circle","sqrt","exp","elastic","bounciness","p","back","s","bounce","t2_","t2","x1","y1","x2","y2","in","easing","out","inOut"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AAIO,MAAMA,MAAN,CAAa;AACN,SAALC,KAAK,CAACC,CAAD,EAAoB;AAC9B,WAAOA,CAAC,GAAG,CAAJ,GAAQ,CAAR,GAAY,CAAnB;AACD;;AAEW,SAALC,KAAK,CAACD,CAAD,EAAoB;AAC9B,WAAOA,CAAC,IAAI,CAAL,GAAS,CAAT,GAAa,CAApB;AACD;;AAEY,SAANE,MAAM,CAACC,CAAD,EAAoB;AAC/B,WAAOA,CAAP;AACD;;AAEU,SAAJC,IAAI,CAACD,CAAD,EAAoB;AAC7B,WAAOL,MAAM,CAACO,MAAP,CAAc,IAAd,EAAoB,CAApB,EAAuB,CAAvB,EAA0B,CAA1B,EAA6BF,CAA7B,CAAP;AACD;;AAEU,SAAJG,IAAI,CAACH,CAAD,EAA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,IAAI,IAAZ,EAAkB;AAChB,YAAMmB,GAAG,GAAGnB,CAAC,GAAG,MAAM,IAAtB;AACA,aAAO,SAASmB,GAAT,GAAeA,GAAf,GAAqB,IAA5B;AACD;;AAED,QAAInB,CAAC,GAAG,MAAM,IAAd,EAAoB;AAClB,YAAMmB,GAAG,GAAGnB,CAAC,GAAG,OAAO,IAAvB;AACA,aAAO,SAASmB,GAAT,GAAeA,GAAf,GAAqB,MAA5B;AACD;;AAED,UAAMC,EAAE,GAAGpB,CAAC,GAAG,QAAQ,IAAvB;AACA,WAAO,SAASoB,EAAT,GAAcA,EAAd,GAAmB,QAA1B;AACD;;AAEY,SAANlB,MAAM,CACXmB,EADW,EAEXC,EAFW,EAGXC,EAHW,EAIXC,EAJW,EAKY;AACvB,WAAO,uBAAOH,EAAP,EAAWC,EAAX,EAAeC,EAAf,EAAmBC,EAAnB,CAAP;AACD;;AAEQ,SAAFC,EAAE,CAACC,MAAD,EAAuD;AAC9D,WAAOA,MAAP;AACD;;AAES,SAAHC,GAAG,CAACD,MAAD,EAAuD;AAC/D,WAAQ1B,CAAD,IAAe,IAAI0B,MAAM,CAAC,IAAI1B,CAAL,CAAhC;AACD;;AAEW,SAAL4B,KAAK,CAACF,MAAD,EAAuD;AACjE,WAAQ1B,CAAD,IAAe;AACpB,UAAIA,CAAC,GAAG,GAAR,EAAa;AACX,eAAO0B,MAAM,CAAC1B,CAAC,GAAG,CAAL,CAAN,GAAgB,CAAvB;AACD;;AAED,aAAO,IAAI0B,MAAM,CAAC,CAAC,IAAI1B,CAAL,IAAU,CAAX,CAAN,GAAsB,CAAjC;AACD,KAND;AAOD;;AA/FiB","sourcesContent":["// eslint-disable-next-line max-len\n// Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/Easing.js\n\nimport { bezier } from \"./functions\";\n\nexport class Easing {\n static step0(n: number): number {\n return n > 0 ? 1 : 0;\n }\n\n static step1(n: number): number {\n return n >= 1 ? 1 : 0;\n }\n\n static linear(t: number): number {\n return t;\n }\n\n static ease(t: number): number {\n return Easing.bezier(0.42, 0, 1, 1)(t);\n }\n\n static quad(t: number): number {\n return t * t;\n }\n\n static cubic(t: number): number {\n return t * t * t;\n }\n\n static poly(n: number): (t: number) => number {\n return (t: number): number => t ** n;\n }\n\n static sin(t: number): number {\n return 1 - Math.cos((t * Math.PI) / 2);\n }\n\n static circle(t: number): number {\n return 1 - Math.sqrt(1 - t * t);\n }\n\n static exp(t: number): number {\n return 2 ** (10 * (t - 1));\n }\n\n static elastic(bounciness = 1): (t: number) => number {\n const p = bounciness * Math.PI;\n return (t): number =>\n 1 - Math.cos((t * Math.PI) / 2) ** 3 * Math.cos(t * p);\n }\n\n static back(s = 1.70158): (t: number) => number {\n return (t): number => t * t * ((s + 1) * t - s);\n }\n\n static bounce(t: number): number {\n if (t < 1 / 2.75) {\n return 7.5625 * t * t;\n }\n\n if (t < 2 / 2.75) {\n const t2_ = t - 1.5 / 2.75;\n return 7.5625 * t2_ * t2_ + 0.75;\n }\n\n if (t < 2.5 / 2.75) {\n const t2_ = t - 2.25 / 2.75;\n return 7.5625 * t2_ * t2_ + 0.9375;\n }\n\n const t2 = t - 2.625 / 2.75;\n return 7.5625 * t2 * t2 + 0.984375;\n }\n\n static bezier(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n ): (t: number) => number {\n return bezier(x1, y1, x2, y2);\n }\n\n static in(easing: (t: number) => number): (t: number) => number {\n return easing;\n }\n\n static out(easing: (t: number) => number): (t: number) => number {\n return (t): number => 1 - easing(1 - t);\n }\n\n static inOut(easing: (t: number) => number): (t: number) => number {\n return (t): number => {\n if (t < 0.5) {\n return easing(t * 2) / 2;\n }\n\n return 1 - easing((1 - t) * 2) / 2;\n };\n }\n}\n"]}
1
+ {"version":3,"names":["Easing","step0","n","step1","linear","t","ease","bezier","quad","cubic","poly","sin","Math","cos","PI","circle","sqrt","exp","elastic","bounciness","p","back","s","bounce","t2_","t2","x1","y1","x2","y2","in","easing","out","inOut"],"sources":["Easing.ts"],"sourcesContent":["// eslint-disable-next-line max-len\n// Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/Easing.js\n\nimport { bezier } from \"./functions\";\n\nexport class Easing {\n static step0(n: number): number {\n return n > 0 ? 1 : 0;\n }\n\n static step1(n: number): number {\n return n >= 1 ? 1 : 0;\n }\n\n static linear(t: number): number {\n return t;\n }\n\n static ease(t: number): number {\n return Easing.bezier(0.42, 0, 1, 1)(t);\n }\n\n static quad(t: number): number {\n return t * t;\n }\n\n static cubic(t: number): number {\n return t * t * t;\n }\n\n static poly(n: number): (t: number) => number {\n return (t: number): number => t ** n;\n }\n\n static sin(t: number): number {\n return 1 - Math.cos((t * Math.PI) / 2);\n }\n\n static circle(t: number): number {\n return 1 - Math.sqrt(1 - t * t);\n }\n\n static exp(t: number): number {\n return 2 ** (10 * (t - 1));\n }\n\n static elastic(bounciness = 1): (t: number) => number {\n const p = bounciness * Math.PI;\n return (t): number =>\n 1 - Math.cos((t * Math.PI) / 2) ** 3 * Math.cos(t * p);\n }\n\n static back(s = 1.70158): (t: number) => number {\n return (t): number => t * t * ((s + 1) * t - s);\n }\n\n static bounce(t: number): number {\n if (t < 1 / 2.75) {\n return 7.5625 * t * t;\n }\n\n if (t < 2 / 2.75) {\n const t2_ = t - 1.5 / 2.75;\n return 7.5625 * t2_ * t2_ + 0.75;\n }\n\n if (t < 2.5 / 2.75) {\n const t2_ = t - 2.25 / 2.75;\n return 7.5625 * t2_ * t2_ + 0.9375;\n }\n\n const t2 = t - 2.625 / 2.75;\n return 7.5625 * t2 * t2 + 0.984375;\n }\n\n static bezier(\n x1: number,\n y1: number,\n x2: number,\n y2: number\n ): (t: number) => number {\n return bezier(x1, y1, x2, y2);\n }\n\n static in(easing: (t: number) => number): (t: number) => number {\n return easing;\n }\n\n static out(easing: (t: number) => number): (t: number) => number {\n return (t): number => 1 - easing(1 - t);\n }\n\n static inOut(easing: (t: number) => number): (t: number) => number {\n return (t): number => {\n if (t < 0.5) {\n return easing(t * 2) / 2;\n }\n\n return 1 - easing((1 - t) * 2) / 2;\n };\n }\n}\n"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AAIO,MAAMA,MAAN,CAAa;EACN,OAALC,KAAK,CAACC,CAAD,EAAoB;IAC9B,OAAOA,CAAC,GAAG,CAAJ,GAAQ,CAAR,GAAY,CAAnB;EACD;;EAEW,OAALC,KAAK,CAACD,CAAD,EAAoB;IAC9B,OAAOA,CAAC,IAAI,CAAL,GAAS,CAAT,GAAa,CAApB;EACD;;EAEY,OAANE,MAAM,CAACC,CAAD,EAAoB;IAC/B,OAAOA,CAAP;EACD;;EAEU,OAAJC,IAAI,CAACD,CAAD,EAAoB;IAC7B,OAAOL,MAAM,CAACO,MAAP,CAAc,IAAd,EAAoB,CAApB,EAAuB,CAAvB,EAA0B,CAA1B,EAA6BF,CAA7B,CAAP;EACD;;EAEU,OAAJG,IAAI,CAACH,CAAD,EAAoB;IAC7B,OAAOA,CAAC,GAAGA,CAAX;EACD;;EAEW,OAALI,KAAK,CAACJ,CAAD,EAAoB;IAC9B,OAAOA,CAAC,GAAGA,CAAJ,GAAQA,CAAf;EACD;;EAEU,OAAJK,IAAI,CAACR,CAAD,EAAmC;IAC5C,OAAQG,CAAD,IAAuBA,CAAC,IAAIH,CAAnC;EACD;;EAES,OAAHS,GAAG,CAACN,CAAD,EAAoB;IAC5B,OAAO,IAAIO,IAAI,CAACC,GAAL,CAAUR,CAAC,GAAGO,IAAI,CAACE,EAAV,GAAgB,CAAzB,CAAX;EACD;;EAEY,OAANC,MAAM,CAACV,CAAD,EAAoB;IAC/B,OAAO,IAAIO,IAAI,CAACI,IAAL,CAAU,IAAIX,CAAC,GAAGA,CAAlB,CAAX;EACD;;EAES,OAAHY,GAAG,CAACZ,CAAD,EAAoB;IAC5B,OAAO,MAAM,MAAMA,CAAC,GAAG,CAAV,CAAN,CAAP;E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AAE,CAACC,MAAD,EAAuD;IAC9D,OAAOA,MAAP;EACD;;EAES,OAAHC,GAAG,CAACD,MAAD,EAAuD;IAC/D,OAAQ1B,CAAD,IAAe,IAAI0B,MAAM,CAAC,IAAI1B,CAAL,CAAhC;EACD;;EAEW,OAAL4B,KAAK,CAACF,MAAD,EAAuD;IACjE,OAAQ1B,CAAD,IAAe;MACpB,IAAIA,CAAC,GAAG,GAAR,EAAa;QACX,OAAO0B,MAAM,CAAC1B,CAAC,GAAG,CAAL,CAAN,GAAgB,CAAvB;MACD;;MAED,OAAO,IAAI0B,MAAM,CAAC,CAAC,IAAI1B,CAAL,IAAU,CAAX,CAAN,GAAsB,CAAjC;IACD,CAND;EAOD;;AA/FiB"}
@@ -24,19 +24,15 @@ var _functions = require("./functions");
24
24
  * the animation.
25
25
  */
26
26
  const createTiming = (params, value, callback) => {
27
- var _ref, _params$from;
28
-
29
27
  // Update from to be either the declared from value,
30
28
  // the current value of the value or zero
31
29
  const resolvedParams = { ...params,
32
- from: (_ref = (_params$from = params.from) !== null && _params$from !== void 0 ? _params$from : value === null || value === void 0 ? void 0 : value.current) !== null && _ref !== void 0 ? _ref : 0
30
+ from: params.from ?? (value === null || value === void 0 ? void 0 : value.current) ?? 0
33
31
  }; // Update function for the animation value
34
32
 
35
33
  const animationFunction = (t, state) => {
36
- var _params$loop, _params$yoyo;
37
-
38
34
  // Update the input value using the provided update function
39
- const nextState = (0, _functions.timing)(t, params.duration, params.easing, (_params$loop = params.loop) !== null && _params$loop !== void 0 ? _params$loop : false, (_params$yoyo = params.yoyo) !== null && _params$yoyo !== void 0 ? _params$yoyo : false, state !== null && state !== void 0 ? state : {
35
+ const nextState = (0, _functions.timing)(t, params.duration, params.easing, params.loop ?? false, params.yoyo ?? false, state ?? {
40
36
  current: params.from,
41
37
  finished: false
42
38
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["createTiming.ts"],"names":["createTiming","params","value","callback","resolvedParams","from","current","animationFunction","t","state","nextState","duration","easing","loop","yoyo","finished","to","ValueApi","createAnimation"],"mappings":";;;;;;;AAMA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAG,CAC1BC,MAD0B,EAE1BC,KAF0B,EAG1BC,QAH0B,KAIvB;AAAA;;AACH;AACA;AACA,QAAMC,cAAc,GAAG,EACrB,GAAGH,MADkB;AAErBI,IAAAA,IAAI,0BAAEJ,MAAM,CAACI,IAAT,uDAAiBH,KAAjB,aAAiBA,KAAjB,uBAAiBA,KAAK,CAAEI,OAAxB,uCAAmC;AAFlB,GAAvB,CAHG,CAQH;;AACA,QAAMC,iBAAiB,GAAG,CAACC,CAAD,EAAYC,KAAZ,KAAkD;AAAA;;AAC1E;AACA,UAAMC,SAAS,GAAG,uBAChBF,CADgB,EAEhBP,MAAM,CAACU,QAFS,EAGhBV,MAAM,CAACW,MAHS,kBAIhBX,MAAM,CAACY,IAJS,uDAID,KAJC,kBAKhBZ,MAAM,CAACa,IALS,uDAKD,KALC,EAMhBL,KANgB,aAMhBA,KANgB,cAMhBA,KANgB,GAMP;AAAEH,MAAAA,OAAO,EAAEL,MAAM,CAACI,IAAlB;AAAyBU,MAAAA,QAAQ,EAAE;AAAnC,KANO,CAAlB;AAQA,UAAMT,OAAO,GACXI,SAAS,CAACJ,OAAV,IAAqBF,cAAc,CAACY,EAAf,GAAoBZ,cAAc,CAACC,IAAxD,IACAD,cAAc,CAACC,IAFjB;;AAGA,QAAIF,QAAQ,IAAIO,SAAS,CAACK,QAAV,KAAuB,IAAvC,EAA6C;AAC3CZ,MAAAA,QAAQ,CAACG,OAAD,CAAR;AACD;;AACD,WAAO,EACL,GAAGI,SADE;AAELJ,MAAAA;AAFK,KAAP;AAID,GApBD,CATG,CA+BH;;;AACA,SAAOW,cAASC,eAAT,CAAyBX,iBAAzB,CAAP;AACD,CArCM","sourcesContent":["import type {\n TimingConfig,\n RequiredAnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport type { AnimationState, SkiaMutableValue } from \"../../values/types\";\nimport { ValueApi } from \"../../values/api\";\n\nimport { timing } from \"./functions\";\n\n/**\n * Creates an animation that is driven by a clock value.\n * The value will be run from / to the value in params and modified\n * by the provided easing curve for the length of the duration. When\n * the value has reached its desired \"to\" value the animation\n * will be stopped. If loop is set to true, the animation will continue\n * to run until stopped.\n *\n * @param params Animation parameters\n * @param config Spring or timing configuration\n * @param value Optional value that the animation will update\n * @params an animation value that can be used to start/stop\n * the animation.\n */\nexport const createTiming = (\n params: RequiredAnimationParams & Required<TimingConfig>,\n value?: SkiaMutableValue<number>,\n callback?: AnimationCallback\n) => {\n // Update from to be either the declared from value,\n // the current value of the value or zero\n const resolvedParams = {\n ...params,\n from: params.from ?? value?.current ?? 0,\n };\n\n // Update function for the animation value\n const animationFunction = (t: number, state: AnimationState | undefined) => {\n // Update the input value using the provided update function\n const nextState = timing(\n t,\n params.duration,\n params.easing,\n params.loop ?? false,\n params.yoyo ?? false,\n state ?? { current: params.from!, finished: false }\n );\n const current =\n nextState.current * (resolvedParams.to - resolvedParams.from!) +\n resolvedParams.from!;\n if (callback && nextState.finished === true) {\n callback(current);\n }\n return {\n ...nextState,\n current,\n };\n };\n\n // Create animation value\n return ValueApi.createAnimation(animationFunction);\n};\n"]}
1
+ {"version":3,"names":["createTiming","params","value","callback","resolvedParams","from","current","animationFunction","t","state","nextState","timing","duration","easing","loop","yoyo","finished","to","ValueApi","createAnimation"],"sources":["createTiming.ts"],"sourcesContent":["import type {\n TimingConfig,\n RequiredAnimationParams,\n AnimationCallback,\n} from \"../types\";\nimport type { AnimationState, SkiaMutableValue } from \"../../values/types\";\nimport { ValueApi } from \"../../values/api\";\n\nimport { timing } from \"./functions\";\n\n/**\n * Creates an animation that is driven by a clock value.\n * The value will be run from / to the value in params and modified\n * by the provided easing curve for the length of the duration. When\n * the value has reached its desired \"to\" value the animation\n * will be stopped. If loop is set to true, the animation will continue\n * to run until stopped.\n *\n * @param params Animation parameters\n * @param config Spring or timing configuration\n * @param value Optional value that the animation will update\n * @params an animation value that can be used to start/stop\n * the animation.\n */\nexport const createTiming = (\n params: RequiredAnimationParams & Required<TimingConfig>,\n value?: SkiaMutableValue<number>,\n callback?: AnimationCallback\n) => {\n // Update from to be either the declared from value,\n // the current value of the value or zero\n const resolvedParams = {\n ...params,\n from: params.from ?? value?.current ?? 0,\n };\n\n // Update function for the animation value\n const animationFunction = (t: number, state: AnimationState | undefined) => {\n // Update the input value using the provided update function\n const nextState = timing(\n t,\n params.duration,\n params.easing,\n params.loop ?? false,\n params.yoyo ?? false,\n state ?? { current: params.from!, finished: false }\n );\n const current =\n nextState.current * (resolvedParams.to - resolvedParams.from!) +\n resolvedParams.from!;\n if (callback && nextState.finished === true) {\n callback(current);\n }\n return {\n ...nextState,\n current,\n };\n };\n\n // Create animation value\n return ValueApi.createAnimation(animationFunction);\n};\n"],"mappings":";;;;;;;AAMA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,GAAG,CAC1BC,MAD0B,EAE1BC,KAF0B,EAG1BC,QAH0B,KAIvB;EACH;EACA;EACA,MAAMC,cAAc,GAAG,EACrB,GAAGH,MADkB;IAErBI,IAAI,EAAEJ,MAAM,CAACI,IAAP,KAAeH,KAAf,aAAeA,KAAf,uBAAeA,KAAK,CAAEI,OAAtB,KAAiC;EAFlB,CAAvB,CAHG,CAQH;;EACA,MAAMC,iBAAiB,GAAG,CAACC,CAAD,EAAYC,KAAZ,KAAkD;IAC1E;IACA,MAAMC,SAAS,GAAG,IAAAC,iBAAA,EAChBH,CADgB,EAEhBP,MAAM,CAACW,QAFS,EAGhBX,MAAM,CAACY,MAHS,EAIhBZ,MAAM,CAACa,IAAP,IAAe,KAJC,EAKhBb,MAAM,CAACc,IAAP,IAAe,KALC,EAMhBN,KAAK,IAAI;MAAEH,OAAO,EAAEL,MAAM,CAACI,IAAlB;MAAyBW,QAAQ,EAAE;IAAnC,CANO,CAAlB;IAQA,MAAMV,OAAO,GACXI,SAAS,CAACJ,OAAV,IAAqBF,cAAc,CAACa,EAAf,GAAoBb,cAAc,CAACC,IAAxD,IACAD,cAAc,CAACC,IAFjB;;IAGA,IAAIF,QAAQ,IAAIO,SAAS,CAACM,QAAV,KAAuB,IAAvC,EAA6C;MAC3Cb,QAAQ,CAACG,OAAD,CAAR;IACD;;IACD,OAAO,EACL,GAAGI,SADE;MAELJ;IAFK,CAAP;EAID,CApBD,CATG,CA+BH;;;EACA,OAAOY,aAAA,CAASC,eAAT,CAAyBZ,iBAAzB,CAAP;AACD,CArCM"}
@@ -1 +1 @@
1
- {"version":3,"sources":["bezier.ts"],"names":["NEWTON_ITERATIONS","NEWTON_MIN_SLOPE","SUBDIVISION_PRECISION","SUBDIVISION_MAX_ITERATIONS","kSplineTableSize","kSampleStepSize","float32ArraySupported","Float32Array","a","aA1","aA2","b","c","calcBezier","aT","getSlope","binarySubdivide","aX","_aA","_aB","mX1","mX2","currentX","currentT","i","aA","aB","Math","abs","newtonRaphsonIterate","_aGuessT","aGuessT","currentSlope","bezier","mY1","mY2","Error","sampleValues","Array","getTForX","intervalStart","currentSample","lastSample","dist","guessForT","initialSlope","x"],"mappings":";;;;;;AAAA;AACA;AAEA,MAAMA,iBAAiB,GAAG,CAA1B;AACA,MAAMC,gBAAgB,GAAG,KAAzB;AACA,MAAMC,qBAAqB,GAAG,SAA9B;AACA,MAAMC,0BAA0B,GAAG,EAAnC;AAEA,MAAMC,gBAAgB,GAAG,EAAzB;AACA,MAAMC,eAAe,GAAG,OAAOD,gBAAgB,GAAG,GAA1B,CAAxB;AAEA,MAAME,qBAAqB,GAAG,OAAOC,YAAP,KAAwB,UAAtD;;AAEA,SAASC,CAAT,CAAWC,GAAX,EAAwBC,GAAxB,EAA6C;AAC3C,SAAO,MAAM,MAAMA,GAAZ,GAAkB,MAAMD,GAA/B;AACD;;AAED,SAASE,CAAT,CAA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,SAAO,UAAUyB,CAAV,EAA6B;AAClC,QAAI1B,GAAG,KAAKc,GAAR,IAAeb,GAAG,KAAKc,GAA3B,EAAgC;AAC9B,aAAOW,CAAP,CAD8B,CACpB;AACX,KAHiC,CAKlC;;;AACA,QAAIA,CAAC,KAAK,CAAV,EAAa;AACX,aAAO,CAAP;AACD;;AAED,QAAIA,CAAC,KAAK,CAAV,EAAa;AACX,aAAO,CAAP;AACD;;AAED,WAAOjC,UAAU,CAAC0B,QAAQ,CAACO,CAAD,CAAT,EAAcZ,GAAd,EAAmBC,GAAnB,CAAjB;AACD,GAfD;AAgBD","sourcesContent":["// eslint-disable-next-line max-len\n// Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/bezier.js\n\nconst NEWTON_ITERATIONS = 4;\nconst NEWTON_MIN_SLOPE = 0.001;\nconst SUBDIVISION_PRECISION = 0.0000001;\nconst SUBDIVISION_MAX_ITERATIONS = 10;\n\nconst kSplineTableSize = 11;\nconst kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\n\nconst float32ArraySupported = typeof Float32Array === \"function\";\n\nfunction a(aA1: number, aA2: number): number {\n return 1.0 - 3.0 * aA2 + 3.0 * aA1;\n}\n\nfunction b(aA1: number, aA2: number): number {\n return 3.0 * aA2 - 6.0 * aA1;\n}\n\nfunction c(aA1: number): number {\n return 3.0 * aA1;\n}\n\n// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\nfunction calcBezier(aT: number, aA1: number, aA2: number): number {\n return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;\n}\n\n// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\nfunction getSlope(aT: number, aA1: number, aA2: number): number {\n return 3.0 * a(aA1, aA2) * aT * aT + 2.0 * b(aA1, aA2) * aT + c(aA1);\n}\n\nfunction binarySubdivide({\n aX,\n _aA,\n _aB,\n mX1,\n mX2,\n}: {\n aX: number;\n _aA: number;\n _aB: number;\n mX1: number;\n mX2: number;\n}): number {\n let currentX;\n let currentT;\n let i = 0;\n let aA = _aA;\n let aB = _aB;\n do {\n currentT = aA + (aB - aA) / 2.0;\n currentX = calcBezier(currentT, mX1, mX2) - aX;\n if (currentX > 0.0) {\n aB = currentT;\n } else {\n aA = currentT;\n }\n } while (\n Math.abs(currentX) > SUBDIVISION_PRECISION &&\n ++i < SUBDIVISION_MAX_ITERATIONS\n );\n\n return currentT;\n}\n\nfunction newtonRaphsonIterate(\n aX: number,\n _aGuessT: number,\n mX1: number,\n mX2: number\n): number {\n let aGuessT = _aGuessT;\n for (let i = 0; i < NEWTON_ITERATIONS; ++i) {\n const currentSlope = getSlope(aGuessT, mX1, mX2);\n if (currentSlope === 0.0) {\n return aGuessT;\n }\n\n const currentX = calcBezier(aGuessT, mX1, mX2) - aX;\n aGuessT -= currentX / currentSlope;\n }\n\n return aGuessT;\n}\n\nexport function bezier(\n mX1: number,\n mY1: number,\n mX2: number,\n mY2: number\n): (x: number) => number {\n if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {\n throw new Error(\"bezier x values must be in [0, 1] range\");\n }\n\n // Precompute samples table\n const sampleValues = float32ArraySupported\n ? new Float32Array(kSplineTableSize)\n : new Array(kSplineTableSize);\n if (mX1 !== mY1 || mX2 !== mY2) {\n for (let i = 0; i < kSplineTableSize; ++i) {\n sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\n }\n }\n\n function getTForX(aX: number): number {\n let intervalStart = 0.0;\n let currentSample = 1;\n const lastSample = kSplineTableSize - 1;\n\n for (\n ;\n currentSample !== lastSample && sampleValues[currentSample] <= aX;\n ++currentSample\n ) {\n intervalStart += kSampleStepSize;\n }\n\n --currentSample;\n\n // Interpolate to provide an initial guess for t\n const dist =\n (aX - sampleValues[currentSample]) /\n (sampleValues[currentSample + 1] - sampleValues[currentSample]);\n const guessForT = intervalStart + dist * kSampleStepSize;\n\n const initialSlope = getSlope(guessForT, mX1, mX2);\n if (initialSlope >= NEWTON_MIN_SLOPE) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\n }\n\n if (initialSlope === 0.0) {\n return guessForT;\n }\n\n return binarySubdivide({\n aX,\n _aA: intervalStart,\n _aB: intervalStart + kSampleStepSize,\n mX1,\n mX2,\n });\n }\n\n return function (x: number): number {\n if (mX1 === mY1 && mX2 === mY2) {\n return x; // linear\n }\n\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\n if (x === 0) {\n return 0;\n }\n\n if (x === 1) {\n return 1;\n }\n\n return calcBezier(getTForX(x), mY1, mY2);\n };\n}\n"]}
1
+ {"version":3,"names":["NEWTON_ITERATIONS","NEWTON_MIN_SLOPE","SUBDIVISION_PRECISION","SUBDIVISION_MAX_ITERATIONS","kSplineTableSize","kSampleStepSize","float32ArraySupported","Float32Array","a","aA1","aA2","b","c","calcBezier","aT","getSlope","binarySubdivide","aX","_aA","_aB","mX1","mX2","currentX","currentT","i","aA","aB","Math","abs","newtonRaphsonIterate","_aGuessT","aGuessT","currentSlope","bezier","mY1","mY2","Error","sampleValues","Array","getTForX","intervalStart","currentSample","lastSample","dist","guessForT","initialSlope","x"],"sources":["bezier.ts"],"sourcesContent":["// eslint-disable-next-line max-len\n// Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/bezier.js\n\nconst NEWTON_ITERATIONS = 4;\nconst NEWTON_MIN_SLOPE = 0.001;\nconst SUBDIVISION_PRECISION = 0.0000001;\nconst SUBDIVISION_MAX_ITERATIONS = 10;\n\nconst kSplineTableSize = 11;\nconst kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);\n\nconst float32ArraySupported = typeof Float32Array === \"function\";\n\nfunction a(aA1: number, aA2: number): number {\n return 1.0 - 3.0 * aA2 + 3.0 * aA1;\n}\n\nfunction b(aA1: number, aA2: number): number {\n return 3.0 * aA2 - 6.0 * aA1;\n}\n\nfunction c(aA1: number): number {\n return 3.0 * aA1;\n}\n\n// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\nfunction calcBezier(aT: number, aA1: number, aA2: number): number {\n return ((a(aA1, aA2) * aT + b(aA1, aA2)) * aT + c(aA1)) * aT;\n}\n\n// Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.\nfunction getSlope(aT: number, aA1: number, aA2: number): number {\n return 3.0 * a(aA1, aA2) * aT * aT + 2.0 * b(aA1, aA2) * aT + c(aA1);\n}\n\nfunction binarySubdivide({\n aX,\n _aA,\n _aB,\n mX1,\n mX2,\n}: {\n aX: number;\n _aA: number;\n _aB: number;\n mX1: number;\n mX2: number;\n}): number {\n let currentX;\n let currentT;\n let i = 0;\n let aA = _aA;\n let aB = _aB;\n do {\n currentT = aA + (aB - aA) / 2.0;\n currentX = calcBezier(currentT, mX1, mX2) - aX;\n if (currentX > 0.0) {\n aB = currentT;\n } else {\n aA = currentT;\n }\n } while (\n Math.abs(currentX) > SUBDIVISION_PRECISION &&\n ++i < SUBDIVISION_MAX_ITERATIONS\n );\n\n return currentT;\n}\n\nfunction newtonRaphsonIterate(\n aX: number,\n _aGuessT: number,\n mX1: number,\n mX2: number\n): number {\n let aGuessT = _aGuessT;\n for (let i = 0; i < NEWTON_ITERATIONS; ++i) {\n const currentSlope = getSlope(aGuessT, mX1, mX2);\n if (currentSlope === 0.0) {\n return aGuessT;\n }\n\n const currentX = calcBezier(aGuessT, mX1, mX2) - aX;\n aGuessT -= currentX / currentSlope;\n }\n\n return aGuessT;\n}\n\nexport function bezier(\n mX1: number,\n mY1: number,\n mX2: number,\n mY2: number\n): (x: number) => number {\n if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {\n throw new Error(\"bezier x values must be in [0, 1] range\");\n }\n\n // Precompute samples table\n const sampleValues = float32ArraySupported\n ? new Float32Array(kSplineTableSize)\n : new Array(kSplineTableSize);\n if (mX1 !== mY1 || mX2 !== mY2) {\n for (let i = 0; i < kSplineTableSize; ++i) {\n sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\n }\n }\n\n function getTForX(aX: number): number {\n let intervalStart = 0.0;\n let currentSample = 1;\n const lastSample = kSplineTableSize - 1;\n\n for (\n ;\n currentSample !== lastSample && sampleValues[currentSample] <= aX;\n ++currentSample\n ) {\n intervalStart += kSampleStepSize;\n }\n\n --currentSample;\n\n // Interpolate to provide an initial guess for t\n const dist =\n (aX - sampleValues[currentSample]) /\n (sampleValues[currentSample + 1] - sampleValues[currentSample]);\n const guessForT = intervalStart + dist * kSampleStepSize;\n\n const initialSlope = getSlope(guessForT, mX1, mX2);\n if (initialSlope >= NEWTON_MIN_SLOPE) {\n return newtonRaphsonIterate(aX, guessForT, mX1, mX2);\n }\n\n if (initialSlope === 0.0) {\n return guessForT;\n }\n\n return binarySubdivide({\n aX,\n _aA: intervalStart,\n _aB: intervalStart + kSampleStepSize,\n mX1,\n mX2,\n });\n }\n\n return function (x: number): number {\n if (mX1 === mY1 && mX2 === mY2) {\n return x; // linear\n }\n\n // Because JavaScript number are imprecise, we should guarantee the extremes are right.\n if (x === 0) {\n return 0;\n }\n\n if (x === 1) {\n return 1;\n }\n\n return calcBezier(getTForX(x), mY1, mY2);\n };\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEA,MAAMA,iBAAiB,GAAG,CAA1B;AACA,MAAMC,gBAAgB,GAAG,KAAzB;AACA,MAAMC,qBAAqB,GAAG,SAA9B;AACA,MAAMC,0BAA0B,GAAG,EAAnC;AAEA,MAAMC,gBAAgB,GAAG,EAAzB;AACA,MAAMC,eAAe,GAAG,OAAOD,gBAAgB,GAAG,GAA1B,CAAxB;AAEA,MAAME,qBAAqB,GAAG,OAAOC,YAAP,KAAwB,UAAtD;;AAEA,SAASC,CAAT,CAAWC,GAAX,EAAwBC,GAAxB,EAA6C;EAC3C,OAAO,MAAM,MAAMA,GAAZ,GAAkB,MAAMD,GAA/B;AACD;;AAED,SAASE,CAAT,CAAWF,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ACpB;IACX,CAHiC,CAKlC;;;IACA,IAAIA,CAAC,KAAK,CAAV,EAAa;MACX,OAAO,CAAP;IACD;;IAED,IAAIA,CAAC,KAAK,CAAV,EAAa;MACX,OAAO,CAAP;IACD;;IAED,OAAOjC,UAAU,CAAC0B,QAAQ,CAACO,CAAD,CAAT,EAAcZ,GAAd,EAAmBC,GAAnB,CAAjB;EACD,CAfD;AAgBD"}
@@ -27,13 +27,11 @@ const getResolvedParams = (toOrParams, config) => {
27
27
  if (typeof toOrParams === "number") {
28
28
  resolvedParameters.to = toOrParams;
29
29
  } else {
30
- var _toOrParams$from, _toOrParams$to, _toOrParams$loop, _toOrParams$yoyo;
31
-
32
30
  resolvedParameters = {
33
- from: (_toOrParams$from = toOrParams.from) !== null && _toOrParams$from !== void 0 ? _toOrParams$from : resolvedParameters.from,
34
- to: (_toOrParams$to = toOrParams.to) !== null && _toOrParams$to !== void 0 ? _toOrParams$to : resolvedParameters.to,
35
- loop: (_toOrParams$loop = toOrParams.loop) !== null && _toOrParams$loop !== void 0 ? _toOrParams$loop : resolvedParameters.loop,
36
- yoyo: (_toOrParams$yoyo = toOrParams.yoyo) !== null && _toOrParams$yoyo !== void 0 ? _toOrParams$yoyo : resolvedParameters.yoyo
31
+ from: toOrParams.from ?? resolvedParameters.from,
32
+ to: toOrParams.to ?? resolvedParameters.to,
33
+ loop: toOrParams.loop ?? resolvedParameters.loop,
34
+ yoyo: toOrParams.yoyo ?? resolvedParameters.yoyo
37
35
  };
38
36
  }
39
37
 
@@ -41,10 +39,8 @@ const getResolvedParams = (toOrParams, config) => {
41
39
  };
42
40
 
43
41
  if (config) {
44
- var _config$duration, _config$easing;
45
-
46
- resolvedConfig.duration = (_config$duration = config.duration) !== null && _config$duration !== void 0 ? _config$duration : DefaultTimingConfig.duration;
47
- resolvedConfig.easing = (_config$easing = config.easing) !== null && _config$easing !== void 0 ? _config$easing : DefaultTimingConfig.easing;
42
+ resolvedConfig.duration = config.duration ?? DefaultTimingConfig.duration;
43
+ resolvedConfig.easing = config.easing ?? DefaultTimingConfig.easing;
48
44
  }
49
45
 
50
46
  return { ...resolvedParameters,