@rafaelaugusto/jolt 0.1.0-beta.8 → 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (582) hide show
  1. package/README.md +136 -15
  2. package/dist/animate.d.ts +25 -4
  3. package/dist/animate.d.ts.map +1 -1
  4. package/dist/animate.js +67 -26
  5. package/dist/animate.js.map +1 -1
  6. package/dist/blur/index.d.ts +6 -0
  7. package/dist/blur/index.d.ts.map +1 -0
  8. package/dist/blur/index.js +196 -0
  9. package/dist/blur/index.js.map +1 -0
  10. package/dist/blur/native.d.ts +17 -0
  11. package/dist/blur/native.d.ts.map +1 -0
  12. package/dist/blur/native.js +44 -0
  13. package/dist/blur/native.js.map +1 -0
  14. package/dist/blur/types.d.ts +32 -0
  15. package/dist/blur/types.d.ts.map +1 -0
  16. package/dist/blur/types.js +2 -0
  17. package/dist/blur/types.js.map +1 -0
  18. package/dist/bottom-sheet/geometry.d.ts +18 -0
  19. package/dist/bottom-sheet/geometry.d.ts.map +1 -0
  20. package/dist/bottom-sheet/geometry.js +51 -0
  21. package/dist/bottom-sheet/geometry.js.map +1 -0
  22. package/dist/bottom-sheet/index.d.ts +56 -0
  23. package/dist/bottom-sheet/index.d.ts.map +1 -0
  24. package/dist/bottom-sheet/index.js +462 -0
  25. package/dist/bottom-sheet/index.js.map +1 -0
  26. package/dist/bottom-sheet/native.d.ts +11 -0
  27. package/dist/bottom-sheet/native.d.ts.map +1 -0
  28. package/dist/bottom-sheet/native.js +173 -0
  29. package/dist/bottom-sheet/native.js.map +1 -0
  30. package/dist/config.d.ts +9 -0
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/config.js +40 -1
  33. package/dist/config.js.map +1 -1
  34. package/dist/decay.d.ts +1 -0
  35. package/dist/decay.d.ts.map +1 -1
  36. package/dist/decay.js +7 -0
  37. package/dist/decay.js.map +1 -1
  38. package/dist/drag-physics.d.ts +6 -1
  39. package/dist/drag-physics.d.ts.map +1 -1
  40. package/dist/drag.d.ts +17 -3
  41. package/dist/drag.d.ts.map +1 -1
  42. package/dist/drag.js +34 -11
  43. package/dist/drag.js.map +1 -1
  44. package/dist/driver/android-gradient.d.ts +5 -0
  45. package/dist/driver/android-gradient.d.ts.map +1 -0
  46. package/dist/driver/android-gradient.js +99 -0
  47. package/dist/driver/android-gradient.js.map +1 -0
  48. package/dist/driver/android-particles.d.ts +6 -0
  49. package/dist/driver/android-particles.d.ts.map +1 -0
  50. package/dist/driver/android-particles.js +93 -0
  51. package/dist/driver/android-particles.js.map +1 -0
  52. package/dist/driver/android.d.ts.map +1 -1
  53. package/dist/driver/android.js +67 -1
  54. package/dist/driver/android.js.map +1 -1
  55. package/dist/driver/frame.d.ts +3 -0
  56. package/dist/driver/frame.d.ts.map +1 -0
  57. package/dist/driver/frame.js +7 -0
  58. package/dist/driver/frame.js.map +1 -0
  59. package/dist/driver/index.d.ts +14 -0
  60. package/dist/driver/index.d.ts.map +1 -1
  61. package/dist/driver/index.js.map +1 -1
  62. package/dist/driver/ios-gradient.d.ts +5 -0
  63. package/dist/driver/ios-gradient.d.ts.map +1 -0
  64. package/dist/driver/ios-gradient.js +131 -0
  65. package/dist/driver/ios-gradient.js.map +1 -0
  66. package/dist/driver/ios-layout.d.ts +9 -0
  67. package/dist/driver/ios-layout.d.ts.map +1 -0
  68. package/dist/driver/ios-layout.js +52 -0
  69. package/dist/driver/ios-layout.js.map +1 -0
  70. package/dist/driver/ios-scroll-delegate.d.ts +4 -0
  71. package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
  72. package/dist/driver/ios-scroll-delegate.js +26 -0
  73. package/dist/driver/ios-scroll-delegate.js.map +1 -0
  74. package/dist/driver/ios.d.ts.map +1 -1
  75. package/dist/driver/ios.js +57 -1
  76. package/dist/driver/ios.js.map +1 -1
  77. package/dist/easing.d.ts +3 -1
  78. package/dist/easing.d.ts.map +1 -1
  79. package/dist/easing.js +18 -1
  80. package/dist/easing.js.map +1 -1
  81. package/dist/engine.d.ts +35 -2
  82. package/dist/engine.d.ts.map +1 -1
  83. package/dist/engine.js +211 -42
  84. package/dist/engine.js.map +1 -1
  85. package/dist/gesture-native.d.ts +28 -0
  86. package/dist/gesture-native.d.ts.map +1 -0
  87. package/dist/gesture-native.js +61 -0
  88. package/dist/gesture-native.js.map +1 -0
  89. package/dist/gestures/index.d.ts +69 -0
  90. package/dist/gestures/index.d.ts.map +1 -0
  91. package/dist/gestures/index.js +262 -0
  92. package/dist/gestures/index.js.map +1 -0
  93. package/dist/glass/index.d.ts +55 -0
  94. package/dist/glass/index.d.ts.map +1 -0
  95. package/dist/glass/index.js +205 -0
  96. package/dist/glass/index.js.map +1 -0
  97. package/dist/gradient-binding.d.ts +38 -0
  98. package/dist/gradient-binding.d.ts.map +1 -0
  99. package/dist/gradient-binding.js +128 -0
  100. package/dist/gradient-binding.js.map +1 -0
  101. package/dist/gradient.d.ts +105 -0
  102. package/dist/gradient.d.ts.map +1 -0
  103. package/dist/gradient.js +514 -0
  104. package/dist/gradient.js.map +1 -0
  105. package/dist/gravity.d.ts +13 -0
  106. package/dist/gravity.d.ts.map +1 -0
  107. package/dist/gravity.js +84 -0
  108. package/dist/gravity.js.map +1 -0
  109. package/dist/haptics.d.ts.map +1 -1
  110. package/dist/haptics.js +101 -28
  111. package/dist/haptics.js.map +1 -1
  112. package/dist/image-effect.d.ts +1 -0
  113. package/dist/image-effect.d.ts.map +1 -1
  114. package/dist/image-effect.js +10 -2
  115. package/dist/image-effect.js.map +1 -1
  116. package/dist/index.d.ts +21 -7
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +11 -4
  119. package/dist/index.js.map +1 -1
  120. package/dist/inspector/index.d.ts +86 -0
  121. package/dist/inspector/index.d.ts.map +1 -0
  122. package/dist/inspector/index.js +419 -0
  123. package/dist/inspector/index.js.map +1 -0
  124. package/dist/inspector/plot.d.ts +4 -0
  125. package/dist/inspector/plot.d.ts.map +1 -0
  126. package/dist/inspector/plot.js +23 -0
  127. package/dist/inspector/plot.js.map +1 -0
  128. package/dist/inspector/probe.d.ts +19 -0
  129. package/dist/inspector/probe.d.ts.map +1 -0
  130. package/dist/inspector/probe.js +37 -0
  131. package/dist/inspector/probe.js.map +1 -0
  132. package/dist/inspector/tuning.d.ts +19 -0
  133. package/dist/inspector/tuning.d.ts.map +1 -0
  134. package/dist/inspector/tuning.js +37 -0
  135. package/dist/inspector/tuning.js.map +1 -0
  136. package/dist/interactive-navigation/index.d.ts +44 -0
  137. package/dist/interactive-navigation/index.d.ts.map +1 -0
  138. package/dist/interactive-navigation/index.js +314 -0
  139. package/dist/interactive-navigation/index.js.map +1 -0
  140. package/dist/keyboard.d.ts +24 -0
  141. package/dist/keyboard.d.ts.map +1 -1
  142. package/dist/keyboard.js +199 -6
  143. package/dist/keyboard.js.map +1 -1
  144. package/dist/layout.d.ts +13 -0
  145. package/dist/layout.d.ts.map +1 -0
  146. package/dist/layout.js +348 -0
  147. package/dist/layout.js.map +1 -0
  148. package/dist/live-spring-driver.d.ts +52 -0
  149. package/dist/live-spring-driver.d.ts.map +1 -0
  150. package/dist/live-spring-driver.js +104 -0
  151. package/dist/live-spring-driver.js.map +1 -0
  152. package/dist/mixer.d.ts +55 -0
  153. package/dist/mixer.d.ts.map +1 -0
  154. package/dist/mixer.js +278 -0
  155. package/dist/mixer.js.map +1 -0
  156. package/dist/motion-scope.d.ts +10 -2
  157. package/dist/motion-scope.d.ts.map +1 -1
  158. package/dist/motion-scope.js +30 -3
  159. package/dist/motion-scope.js.map +1 -1
  160. package/dist/motion-states.d.ts +19 -7
  161. package/dist/motion-states.d.ts.map +1 -1
  162. package/dist/motion-states.js +116 -26
  163. package/dist/motion-states.js.map +1 -1
  164. package/dist/motion-value.d.ts +227 -0
  165. package/dist/motion-value.d.ts.map +1 -0
  166. package/dist/motion-value.js +1074 -0
  167. package/dist/motion-value.js.map +1 -0
  168. package/dist/native/index.d.ts +10 -0
  169. package/dist/native/index.d.ts.map +1 -0
  170. package/dist/native/index.js +6 -0
  171. package/dist/native/index.js.map +1 -0
  172. package/dist/native-properties.d.ts +28 -0
  173. package/dist/native-properties.d.ts.map +1 -0
  174. package/dist/native-properties.js +154 -0
  175. package/dist/native-properties.js.map +1 -0
  176. package/dist/native-property-driver.d.ts +19 -0
  177. package/dist/native-property-driver.d.ts.map +1 -0
  178. package/dist/native-property-driver.js +69 -0
  179. package/dist/native-property-driver.js.map +1 -0
  180. package/dist/native-property.d.ts +37 -0
  181. package/dist/native-property.d.ts.map +1 -0
  182. package/dist/native-property.js +285 -0
  183. package/dist/native-property.js.map +1 -0
  184. package/dist/particles.d.ts +5 -2
  185. package/dist/particles.d.ts.map +1 -1
  186. package/dist/particles.js +16 -10
  187. package/dist/particles.js.map +1 -1
  188. package/dist/path.d.ts.map +1 -1
  189. package/dist/path.js +2 -2
  190. package/dist/path.js.map +1 -1
  191. package/dist/physics/index.d.ts +116 -0
  192. package/dist/physics/index.d.ts.map +1 -0
  193. package/dist/physics/index.js +306 -0
  194. package/dist/physics/index.js.map +1 -0
  195. package/dist/physics/native.d.ts +53 -0
  196. package/dist/physics/native.d.ts.map +1 -0
  197. package/dist/physics/native.js +58 -0
  198. package/dist/physics/native.js.map +1 -0
  199. package/dist/playback-group.d.ts.map +1 -1
  200. package/dist/playback-group.js +17 -1
  201. package/dist/playback-group.js.map +1 -1
  202. package/dist/playback.d.ts +15 -0
  203. package/dist/playback.d.ts.map +1 -1
  204. package/dist/playback.js +23 -0
  205. package/dist/playback.js.map +1 -1
  206. package/dist/predictive-back/index.d.ts +45 -0
  207. package/dist/predictive-back/index.d.ts.map +1 -0
  208. package/dist/predictive-back/index.js +220 -0
  209. package/dist/predictive-back/index.js.map +1 -0
  210. package/dist/predictive-back/presentation.d.ts +4 -0
  211. package/dist/predictive-back/presentation.d.ts.map +1 -0
  212. package/dist/predictive-back/presentation.js +3 -0
  213. package/dist/predictive-back/presentation.js.map +1 -0
  214. package/dist/reorder/handle.d.ts +6 -0
  215. package/dist/reorder/handle.d.ts.map +1 -0
  216. package/dist/reorder/handle.js +10 -0
  217. package/dist/reorder/handle.js.map +1 -0
  218. package/dist/reorder/index.d.ts +10 -0
  219. package/dist/reorder/index.d.ts.map +1 -0
  220. package/dist/reorder/index.js +233 -0
  221. package/dist/reorder/index.js.map +1 -0
  222. package/dist/reorder/list-view.d.ts +5 -0
  223. package/dist/reorder/list-view.d.ts.map +1 -0
  224. package/dist/reorder/list-view.js +238 -0
  225. package/dist/reorder/list-view.js.map +1 -0
  226. package/dist/reorder/model.d.ts +6 -0
  227. package/dist/reorder/model.d.ts.map +1 -0
  228. package/dist/reorder/model.js +30 -0
  229. package/dist/reorder/model.js.map +1 -0
  230. package/dist/reorder/surface.d.ts +6 -0
  231. package/dist/reorder/surface.d.ts.map +1 -0
  232. package/dist/reorder/surface.js +10 -0
  233. package/dist/reorder/surface.js.map +1 -0
  234. package/dist/reorder/types.d.ts +92 -0
  235. package/dist/reorder/types.d.ts.map +1 -0
  236. package/dist/reorder/types.js +2 -0
  237. package/dist/reorder/types.js.map +1 -0
  238. package/dist/sampling.d.ts +35 -0
  239. package/dist/sampling.d.ts.map +1 -0
  240. package/dist/sampling.js +123 -0
  241. package/dist/sampling.js.map +1 -0
  242. package/dist/scene-appearance.d.ts +14 -0
  243. package/dist/scene-appearance.d.ts.map +1 -0
  244. package/dist/scene-appearance.js +68 -0
  245. package/dist/scene-appearance.js.map +1 -0
  246. package/dist/scene-camera.d.ts +5 -0
  247. package/dist/scene-camera.d.ts.map +1 -0
  248. package/dist/scene-camera.js +23 -0
  249. package/dist/scene-camera.js.map +1 -0
  250. package/dist/scene-shader.d.ts +18 -0
  251. package/dist/scene-shader.d.ts.map +1 -0
  252. package/dist/scene-shader.js +76 -0
  253. package/dist/scene-shader.js.map +1 -0
  254. package/dist/scroll-header/geometry.d.ts +18 -0
  255. package/dist/scroll-header/geometry.d.ts.map +1 -0
  256. package/dist/scroll-header/geometry.js +46 -0
  257. package/dist/scroll-header/geometry.js.map +1 -0
  258. package/dist/scroll-header/index.d.ts +48 -0
  259. package/dist/scroll-header/index.d.ts.map +1 -0
  260. package/dist/scroll-header/index.js +373 -0
  261. package/dist/scroll-header/index.js.map +1 -0
  262. package/dist/scroll-header/native.d.ts +28 -0
  263. package/dist/scroll-header/native.d.ts.map +1 -0
  264. package/dist/scroll-header/native.js +43 -0
  265. package/dist/scroll-header/native.js.map +1 -0
  266. package/dist/sensors/index.d.ts +69 -0
  267. package/dist/sensors/index.d.ts.map +1 -0
  268. package/dist/sensors/index.js +149 -0
  269. package/dist/sensors/index.js.map +1 -0
  270. package/dist/sensors/native.d.ts +20 -0
  271. package/dist/sensors/native.d.ts.map +1 -0
  272. package/dist/sensors/native.js +48 -0
  273. package/dist/sensors/native.js.map +1 -0
  274. package/dist/sequence.d.ts +24 -0
  275. package/dist/sequence.d.ts.map +1 -1
  276. package/dist/sequence.js +181 -19
  277. package/dist/sequence.js.map +1 -1
  278. package/dist/shapes/android.d.ts +3 -0
  279. package/dist/shapes/android.d.ts.map +1 -0
  280. package/dist/shapes/android.js +51 -0
  281. package/dist/shapes/android.js.map +1 -0
  282. package/dist/shapes/index.d.ts +6 -0
  283. package/dist/shapes/index.d.ts.map +1 -0
  284. package/dist/shapes/index.js +238 -0
  285. package/dist/shapes/index.js.map +1 -0
  286. package/dist/shapes/ios.d.ts +3 -0
  287. package/dist/shapes/ios.d.ts.map +1 -0
  288. package/dist/shapes/ios.js +164 -0
  289. package/dist/shapes/ios.js.map +1 -0
  290. package/dist/shapes/native.d.ts +18 -0
  291. package/dist/shapes/native.d.ts.map +1 -0
  292. package/dist/shapes/native.js +10 -0
  293. package/dist/shapes/native.js.map +1 -0
  294. package/dist/shapes/path.d.ts +10 -0
  295. package/dist/shapes/path.d.ts.map +1 -0
  296. package/dist/shapes/path.js +106 -0
  297. package/dist/shapes/path.js.map +1 -0
  298. package/dist/shapes/types.d.ts +55 -0
  299. package/dist/shapes/types.d.ts.map +1 -0
  300. package/dist/shapes/types.js +11 -0
  301. package/dist/shapes/types.js.map +1 -0
  302. package/dist/shared-layout/index.d.ts +40 -0
  303. package/dist/shared-layout/index.d.ts.map +1 -0
  304. package/dist/shared-layout/index.js +267 -0
  305. package/dist/shared-layout/index.js.map +1 -0
  306. package/dist/shared-layout/native.d.ts +15 -0
  307. package/dist/shared-layout/native.d.ts.map +1 -0
  308. package/dist/shared-layout/native.js +79 -0
  309. package/dist/shared-layout/native.js.map +1 -0
  310. package/dist/shared-layout/timing.d.ts +9 -0
  311. package/dist/shared-layout/timing.d.ts.map +1 -0
  312. package/dist/shared-layout/timing.js +68 -0
  313. package/dist/shared-layout/timing.js.map +1 -0
  314. package/dist/shared-navigation/entry.d.ts +51 -0
  315. package/dist/shared-navigation/entry.d.ts.map +1 -0
  316. package/dist/shared-navigation/entry.js +619 -0
  317. package/dist/shared-navigation/entry.js.map +1 -0
  318. package/dist/shared-navigation/index.d.ts +58 -0
  319. package/dist/shared-navigation/index.d.ts.map +1 -0
  320. package/dist/shared-navigation/index.js +318 -0
  321. package/dist/shared-navigation/index.js.map +1 -0
  322. package/dist/shared-navigation/return-signal.d.ts +16 -0
  323. package/dist/shared-navigation/return-signal.d.ts.map +1 -0
  324. package/dist/shared-navigation/return-signal.js +35 -0
  325. package/dist/shared-navigation/return-signal.js.map +1 -0
  326. package/dist/shared-navigation/return-target.d.ts +32 -0
  327. package/dist/shared-navigation/return-target.d.ts.map +1 -0
  328. package/dist/shared-navigation/return-target.js +168 -0
  329. package/dist/shared-navigation/return-target.js.map +1 -0
  330. package/dist/shared-navigation/scope.d.ts +4 -0
  331. package/dist/shared-navigation/scope.d.ts.map +1 -0
  332. package/dist/shared-navigation/scope.js +2 -0
  333. package/dist/shared-navigation/scope.js.map +1 -0
  334. package/dist/shared-navigation/targets.d.ts +6 -0
  335. package/dist/shared-navigation/targets.d.ts.map +1 -0
  336. package/dist/shared-navigation/targets.js +36 -0
  337. package/dist/shared-navigation/targets.js.map +1 -0
  338. package/dist/size-layout.d.ts +19 -0
  339. package/dist/size-layout.d.ts.map +1 -0
  340. package/dist/size-layout.js +216 -0
  341. package/dist/size-layout.js.map +1 -0
  342. package/dist/size.d.ts +19 -0
  343. package/dist/size.d.ts.map +1 -0
  344. package/dist/size.js +251 -0
  345. package/dist/size.js.map +1 -0
  346. package/dist/spring.d.ts +2 -0
  347. package/dist/spring.d.ts.map +1 -1
  348. package/dist/spring.js +11 -0
  349. package/dist/spring.js.map +1 -1
  350. package/dist/svg-path.d.ts +18 -0
  351. package/dist/svg-path.d.ts.map +1 -1
  352. package/dist/svg-path.js +3 -2
  353. package/dist/svg-path.js.map +1 -1
  354. package/dist/testing/clock.d.ts +40 -0
  355. package/dist/testing/clock.d.ts.map +1 -0
  356. package/dist/testing/clock.js +116 -0
  357. package/dist/testing/clock.js.map +1 -0
  358. package/dist/testing/handoff-recorder.d.ts +8 -0
  359. package/dist/testing/handoff-recorder.d.ts.map +1 -0
  360. package/dist/testing/handoff-recorder.js +77 -0
  361. package/dist/testing/handoff-recorder.js.map +1 -0
  362. package/dist/testing/index.d.ts +5 -0
  363. package/dist/testing/index.d.ts.map +1 -0
  364. package/dist/testing/index.js +5 -0
  365. package/dist/testing/index.js.map +1 -0
  366. package/dist/testing/native.d.ts +46 -0
  367. package/dist/testing/native.d.ts.map +1 -0
  368. package/dist/testing/native.js +313 -0
  369. package/dist/testing/native.js.map +1 -0
  370. package/dist/testing/presentation.d.ts +11 -0
  371. package/dist/testing/presentation.d.ts.map +1 -0
  372. package/dist/testing/presentation.js +45 -0
  373. package/dist/testing/presentation.js.map +1 -0
  374. package/dist/testing/replay.d.ts +39 -0
  375. package/dist/testing/replay.d.ts.map +1 -0
  376. package/dist/testing/replay.js +99 -0
  377. package/dist/testing/replay.js.map +1 -0
  378. package/dist/testing/scroll-handoff-native.d.ts +10 -0
  379. package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
  380. package/dist/testing/scroll-handoff-native.js +151 -0
  381. package/dist/testing/scroll-handoff-native.js.map +1 -0
  382. package/dist/testing/scroll-handoff.d.ts +25 -0
  383. package/dist/testing/scroll-handoff.d.ts.map +1 -0
  384. package/dist/testing/scroll-handoff.js +127 -0
  385. package/dist/testing/scroll-handoff.js.map +1 -0
  386. package/dist/testing/sensors.d.ts +13 -0
  387. package/dist/testing/sensors.d.ts.map +1 -0
  388. package/dist/testing/sensors.js +26 -0
  389. package/dist/testing/sensors.js.map +1 -0
  390. package/dist/testing/trace.d.ts +101 -0
  391. package/dist/testing/trace.d.ts.map +1 -0
  392. package/dist/testing/trace.js +263 -0
  393. package/dist/testing/trace.js.map +1 -0
  394. package/dist/timed-animation.d.ts +38 -0
  395. package/dist/timed-animation.d.ts.map +1 -0
  396. package/dist/timed-animation.js +177 -0
  397. package/dist/timed-animation.js.map +1 -0
  398. package/dist/track.d.ts +3 -0
  399. package/dist/track.d.ts.map +1 -1
  400. package/dist/track.js +281 -40
  401. package/dist/track.js.map +1 -1
  402. package/dist/transition.d.ts +54 -2
  403. package/dist/transition.d.ts.map +1 -1
  404. package/dist/transition.js +128 -8
  405. package/dist/transition.js.map +1 -1
  406. package/dist/types.d.ts +10 -1
  407. package/dist/types.d.ts.map +1 -1
  408. package/dist/value-observers.d.ts +22 -0
  409. package/dist/value-observers.d.ts.map +1 -0
  410. package/dist/value-observers.js +122 -0
  411. package/dist/value-observers.js.map +1 -0
  412. package/dist/value-track.d.ts +13 -0
  413. package/dist/value-track.d.ts.map +1 -0
  414. package/dist/value-track.js +59 -0
  415. package/dist/value-track.js.map +1 -0
  416. package/dist/vue/index.d.ts +33 -3
  417. package/dist/vue/index.d.ts.map +1 -1
  418. package/dist/vue/index.js +118 -3
  419. package/dist/vue/index.js.map +1 -1
  420. package/dist/zoomable.d.ts +1 -1
  421. package/dist/zoomable.d.ts.map +1 -1
  422. package/package.json +68 -3
  423. package/platforms/android/include.gradle +10 -0
  424. package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
  425. package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +151 -0
  426. package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +210 -0
  427. package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
  428. package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
  429. package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
  430. package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
  431. package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
  432. package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
  433. package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
  434. package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
  435. package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
  436. package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
  437. package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
  438. package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
  439. package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
  440. package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
  441. package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
  442. package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
  443. package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
  444. package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
  445. package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
  446. package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
  447. package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
  448. package/platforms/android/proguard-rules.pro +20 -0
  449. package/platforms/ios/build.xcconfig +1 -1
  450. package/platforms/ios/src/JoltBlur.h +14 -0
  451. package/platforms/ios/src/JoltBlur.m +86 -0
  452. package/platforms/ios/src/JoltCircleMath.h +183 -0
  453. package/platforms/ios/src/JoltCircleWorld.h +17 -0
  454. package/platforms/ios/src/JoltCircleWorld.m +203 -0
  455. package/platforms/ios/src/JoltGestureSession.h +23 -0
  456. package/platforms/ios/src/JoltGestureSession.m +251 -0
  457. package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
  458. package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
  459. package/platforms/ios/src/JoltLiveSpring.h +29 -0
  460. package/platforms/ios/src/JoltLiveSpring.m +243 -0
  461. package/platforms/ios/src/JoltMotionProbe.h +9 -0
  462. package/platforms/ios/src/JoltMotionProbe.m +72 -0
  463. package/platforms/ios/src/JoltReorderSession.h +15 -0
  464. package/platforms/ios/src/JoltReorderSession.m +205 -0
  465. package/platforms/ios/src/JoltScrollHeader.h +13 -0
  466. package/platforms/ios/src/JoltScrollHeader.m +93 -0
  467. package/platforms/ios/src/JoltSensorMath.h +39 -0
  468. package/platforms/ios/src/JoltSensorSource.h +13 -0
  469. package/platforms/ios/src/JoltSensorSource.m +201 -0
  470. package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
  471. package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
  472. package/platforms/ios/src/JoltSpringState.h +35 -0
  473. package/platforms/ios/src/module.modulemap +10 -0
  474. package/src/android-plugin.d.ts +463 -0
  475. package/src/animate.ts +129 -15
  476. package/src/blur/index.ts +195 -0
  477. package/src/blur/native.ts +70 -0
  478. package/src/blur/types.ts +32 -0
  479. package/src/bottom-sheet/geometry.ts +84 -0
  480. package/src/bottom-sheet/index.ts +536 -0
  481. package/src/bottom-sheet/native.ts +214 -0
  482. package/src/config.ts +39 -1
  483. package/src/decay.ts +9 -0
  484. package/src/drag.ts +67 -21
  485. package/src/driver/android-gradient.ts +116 -0
  486. package/src/driver/android-particles.ts +118 -0
  487. package/src/driver/android.ts +69 -1
  488. package/src/driver/frame.ts +10 -0
  489. package/src/driver/index.ts +15 -0
  490. package/src/driver/ios-gradient.ts +136 -0
  491. package/src/driver/ios-layout.ts +63 -0
  492. package/src/driver/ios-scroll-delegate.ts +23 -0
  493. package/src/driver/ios.ts +70 -17
  494. package/src/easing.ts +21 -1
  495. package/src/engine.ts +226 -59
  496. package/src/gesture-native.ts +139 -0
  497. package/src/gestures/index.ts +365 -0
  498. package/src/glass/index.ts +218 -0
  499. package/src/gradient-binding.ts +158 -0
  500. package/src/gradient.ts +663 -0
  501. package/src/gravity.ts +107 -0
  502. package/src/haptics.ts +106 -28
  503. package/src/image-effect.ts +10 -2
  504. package/src/index.ts +59 -7
  505. package/src/inspector/index.ts +523 -0
  506. package/src/inspector/plot.ts +27 -0
  507. package/src/inspector/probe.ts +50 -0
  508. package/src/inspector/tuning.ts +51 -0
  509. package/src/interactive-navigation/index.ts +398 -0
  510. package/src/ios-plugin.d.ts +279 -0
  511. package/src/keyboard.ts +231 -7
  512. package/src/layout.ts +408 -0
  513. package/src/live-spring-driver.ts +181 -0
  514. package/src/mixer.ts +306 -0
  515. package/src/motion-scope.ts +53 -6
  516. package/src/motion-states.ts +149 -42
  517. package/src/motion-value.ts +1289 -0
  518. package/src/native/index.ts +30 -0
  519. package/src/native-properties.ts +188 -0
  520. package/src/native-property-driver.ts +123 -0
  521. package/src/native-property.ts +366 -0
  522. package/src/particles.ts +18 -17
  523. package/src/path.ts +2 -1
  524. package/src/physics/index.ts +443 -0
  525. package/src/physics/native.ts +110 -0
  526. package/src/playback-group.ts +17 -1
  527. package/src/playback.ts +41 -0
  528. package/src/predictive-back/index.ts +280 -0
  529. package/src/predictive-back/presentation.ts +6 -0
  530. package/src/reorder/handle.ts +9 -0
  531. package/src/reorder/index.ts +243 -0
  532. package/src/reorder/list-view.ts +262 -0
  533. package/src/reorder/model.ts +47 -0
  534. package/src/reorder/surface.ts +10 -0
  535. package/src/reorder/types.ts +87 -0
  536. package/src/sampling.ts +173 -0
  537. package/src/scene-appearance.ts +92 -0
  538. package/src/scene-camera.ts +30 -0
  539. package/src/scene-shader.ts +139 -0
  540. package/src/scroll-header/geometry.ts +88 -0
  541. package/src/scroll-header/index.ts +504 -0
  542. package/src/scroll-header/native.ts +89 -0
  543. package/src/sensors/index.ts +246 -0
  544. package/src/sensors/native.ts +72 -0
  545. package/src/sequence.ts +209 -20
  546. package/src/shapes/android.ts +63 -0
  547. package/src/shapes/index.ts +267 -0
  548. package/src/shapes/ios.ts +194 -0
  549. package/src/shapes/native.ts +27 -0
  550. package/src/shapes/path.ts +127 -0
  551. package/src/shapes/types.ts +63 -0
  552. package/src/shared-layout/index.ts +343 -0
  553. package/src/shared-layout/native.ts +138 -0
  554. package/src/shared-layout/timing.ts +87 -0
  555. package/src/shared-navigation/entry.ts +695 -0
  556. package/src/shared-navigation/index.ts +414 -0
  557. package/src/shared-navigation/return-signal.ts +41 -0
  558. package/src/shared-navigation/return-target.ts +197 -0
  559. package/src/shared-navigation/scope.ts +3 -0
  560. package/src/shared-navigation/targets.ts +38 -0
  561. package/src/size-layout.ts +237 -0
  562. package/src/size.ts +302 -0
  563. package/src/spring.ts +18 -0
  564. package/src/svg-path.ts +8 -3
  565. package/src/testing/clock.ts +128 -0
  566. package/src/testing/handoff-recorder.ts +98 -0
  567. package/src/testing/index.ts +4 -0
  568. package/src/testing/native.ts +386 -0
  569. package/src/testing/presentation.ts +46 -0
  570. package/src/testing/replay.ts +149 -0
  571. package/src/testing/scroll-handoff-native.ts +201 -0
  572. package/src/testing/scroll-handoff.ts +140 -0
  573. package/src/testing/sensors.ts +41 -0
  574. package/src/testing/trace.ts +340 -0
  575. package/src/timed-animation.ts +192 -0
  576. package/src/track.ts +334 -38
  577. package/src/transition.ts +197 -9
  578. package/src/types.ts +11 -1
  579. package/src/value-observers.ts +147 -0
  580. package/src/value-track.ts +71 -0
  581. package/src/vue/index.ts +147 -1
  582. package/src/zoomable.ts +1 -1
@@ -0,0 +1,237 @@
1
+ import { GridLayout, StackLayout, Utils, View, unsetValue } from '@nativescript/core'
2
+
3
+ export type SizeAxis = 'width' | 'height'
4
+ export type SizeValue = number | 'auto'
5
+ export type SizeValues = Partial<Record<SizeAxis, SizeValue>>
6
+ export type SizePixels = Record<SizeAxis, number>
7
+
8
+ type MeasuredView = View & {
9
+ _currentWidthMeasureSpec?: number
10
+ _currentHeightMeasureSpec?: number
11
+ _oldLeft?: number
12
+ _oldTop?: number
13
+ _oldRight?: number
14
+ _oldBottom?: number
15
+ }
16
+ const overlays = new WeakMap<View, Map<SizeAxis, object>>()
17
+
18
+ /** One live tree: speculative measurement never lays out or duplicates its views. */
19
+ export function sizeLayout(
20
+ view: View,
21
+ axes: readonly SizeAxis[],
22
+ replacing: readonly SizeAxis[] = [],
23
+ read: () => SizePixels = () => view.getActualSize(),
24
+ ) {
25
+ const parent = view.parent
26
+ if (
27
+ view.isLoaded &&
28
+ !(parent instanceof StackLayout) &&
29
+ !(parent instanceof GridLayout)
30
+ )
31
+ throw new TypeError('animateSize needs a child of StackLayout or GridLayout.')
32
+ const style = view.style as unknown as Record<string, unknown>
33
+ for (const axis of axes) {
34
+ const initial = view[axis]
35
+ if (
36
+ typeof initial === 'object' &&
37
+ initial !== null &&
38
+ (initial.unit === 'dip' || initial.unit === 'px')
39
+ )
40
+ dimension(initial.value, `initial ${axis}`)
41
+ else dimension(initial, `initial ${axis}`)
42
+ const key = `keyframe:${axis}`
43
+ if (
44
+ !replacing.includes(axis) &&
45
+ style[key] !== unsetValue &&
46
+ style[key] !== undefined
47
+ )
48
+ throw new Error(`animateSize cannot own ${axis} during a CSS keyframe animation.`)
49
+ }
50
+ let writing = false
51
+ let disposed = false
52
+ let claimed = false
53
+ const identity = {}
54
+ const claim = () => {
55
+ if (claimed || disposed) return
56
+ claimed = true
57
+ const current = overlays.get(view) ?? new Map<SizeAxis, object>()
58
+ for (const axis of axes) current.set(axis, identity)
59
+ overlays.set(view, current)
60
+ }
61
+ const owns = (axis: SizeAxis) => overlays.get(view)?.get(axis) === identity
62
+ let releaseHooks = () => {}
63
+ const write = (values: SizeValues) => {
64
+ if (disposed) return
65
+ claim()
66
+ writing = true
67
+ try {
68
+ for (const axis of axes)
69
+ if (owns(axis) && values[axis] !== undefined)
70
+ style[`keyframe:${axis}`] = bounded(view, axis, values[axis]!)
71
+ } finally {
72
+ writing = false
73
+ }
74
+ }
75
+ const clear = () => {
76
+ writing = true
77
+ try {
78
+ for (const axis of axes) if (owns(axis)) style[`keyframe:${axis}`] = unsetValue
79
+ } finally {
80
+ writing = false
81
+ }
82
+ }
83
+ const root = () => {
84
+ let node = view as MeasuredView
85
+ while (node.parent instanceof View && node.parent.typeName !== 'Page')
86
+ node = node.parent as MeasuredView
87
+ return node
88
+ }
89
+ const specs = (node: MeasuredView) => {
90
+ // Core's last layout allocation excludes transforms; UIView.frame does not.
91
+ const cached = [node._oldLeft, node._oldTop, node._oldRight, node._oldBottom]
92
+ const bounds =
93
+ cached.every((value) => Number.isFinite(value)) &&
94
+ cached[2]! > cached[0]! &&
95
+ cached[3]! > cached[1]!
96
+ ? { left: cached[0]!, top: cached[1]!, right: cached[2]!, bottom: cached[3]! }
97
+ : node._getCurrentLayoutBounds()
98
+ const layout = Utils.layout
99
+ return {
100
+ bounds,
101
+ width:
102
+ node._currentWidthMeasureSpec ??
103
+ layout.makeMeasureSpec(Math.max(0, bounds.right - bounds.left), layout.EXACTLY),
104
+ height:
105
+ node._currentHeightMeasureSpec ??
106
+ layout.makeMeasureSpec(Math.max(0, bounds.bottom - bounds.top), layout.EXACTLY),
107
+ }
108
+ }
109
+ const measure = () => {
110
+ const node = root()
111
+ const spec = specs(node)
112
+ view.requestLayout()
113
+ node.measure(spec.width, spec.height)
114
+ return { node, ...spec }
115
+ }
116
+ return {
117
+ read,
118
+ write,
119
+ ready() {
120
+ const { bounds } = specs(root())
121
+ return bounds.right > bounds.left && bounds.bottom > bounds.top
122
+ },
123
+ measure(destination: SizeValues): SizePixels {
124
+ const held = Object.fromEntries(
125
+ axes.map((axis) => [axis, style[`keyframe:${axis}`]]),
126
+ )
127
+ try {
128
+ write(destination)
129
+ measure()
130
+ const dip = Utils.layout.toDeviceIndependentPixels
131
+ return {
132
+ width: dip(view.getMeasuredWidth()),
133
+ height: dip(view.getMeasuredHeight()),
134
+ }
135
+ } finally {
136
+ writing = true
137
+ try {
138
+ for (const axis of axes)
139
+ if (!disposed && owns(axis)) style[`keyframe:${axis}`] = held[axis]
140
+ } finally {
141
+ writing = false
142
+ }
143
+ }
144
+ },
145
+ /** Flush the restored/current declarations before any draw can see probe measurements. */
146
+ layout() {
147
+ const { node, bounds } = measure()
148
+ node.layout(bounds.left, bounds.top, bounds.right, bounds.bottom)
149
+ },
150
+ commit(values?: SizeValues) {
151
+ writing = true
152
+ try {
153
+ if (values)
154
+ for (const axis of axes)
155
+ if (owns(axis) && values[axis] !== undefined)
156
+ view[axis] = bounded(view, axis, values[axis]!)
157
+ } finally {
158
+ writing = false
159
+ clear()
160
+ }
161
+ },
162
+ watch(takeover: () => void) {
163
+ claim()
164
+ const undo: (() => void)[] = []
165
+ releaseHooks = () =>
166
+ undo
167
+ .splice(0)
168
+ .reverse()
169
+ .forEach((off) => off())
170
+ // A local/CSS write hidden under the animation override still takes ownership.
171
+ for (const axis of axes)
172
+ for (const name of [axis, `css:${axis}`, `keyframe:${axis}`]) {
173
+ const own = Object.getOwnPropertyDescriptor(style, name)
174
+ let source: object | null = style
175
+ let descriptor: PropertyDescriptor | undefined
176
+ while (source && !descriptor) {
177
+ descriptor = Object.getOwnPropertyDescriptor(source, name)
178
+ source = Object.getPrototypeOf(source)
179
+ }
180
+ if (!descriptor?.set || !descriptor.get || own?.configurable === false)
181
+ throw new Error(`animateSize cannot observe ownership of ${name}.`)
182
+ const original = descriptor
183
+ const set = function (this: object, value: unknown) {
184
+ if (!writing) takeover()
185
+ original.set!.call(this, value)
186
+ }
187
+ Object.defineProperty(style, name, {
188
+ configurable: true,
189
+ get: original.get,
190
+ set,
191
+ })
192
+ undo.push(() => {
193
+ if (Object.getOwnPropertyDescriptor(style, name)?.set !== set) return
194
+ if (own) Object.defineProperty(style, name, own)
195
+ else delete style[name]
196
+ })
197
+ }
198
+ },
199
+ dispose() {
200
+ disposed = true
201
+ releaseHooks()
202
+ clear()
203
+ const current = overlays.get(view)
204
+ for (const axis of axes) if (owns(axis)) current!.delete(axis)
205
+ if (!current?.size) overlays.delete(view)
206
+ },
207
+ }
208
+ }
209
+
210
+ function bounded(view: View, axis: SizeAxis, value: SizeValue): SizeValue {
211
+ if (value === 'auto') return value
212
+ const minimum = axis === 'width' ? view.minWidth : view.minHeight
213
+ const maximum = axis === 'width' ? view.maxWidth : view.maxHeight
214
+ const dip = Utils.layout.toDeviceIndependentPixels
215
+ const min =
216
+ typeof minimum === 'number'
217
+ ? minimum
218
+ : dip((axis === 'width' ? view.effectiveMinWidth : view.effectiveMinHeight) ?? 0)
219
+ const max =
220
+ typeof maximum === 'number'
221
+ ? maximum
222
+ : dip(
223
+ (axis === 'width' ? view.effectiveMaxWidth : view.effectiveMaxHeight) ??
224
+ Infinity,
225
+ )
226
+ return Math.min(max, Math.max(0, min, value))
227
+ }
228
+
229
+ export function dimension(value: unknown, label: string): asserts value is SizeValue {
230
+ if (
231
+ value !== 'auto' &&
232
+ (typeof value !== 'number' || !Number.isFinite(value) || value < 0)
233
+ )
234
+ throw new RangeError(
235
+ `animateSize ${label} must be a nonnegative finite DIP number or "auto"; percentages and unit objects are unsupported.`,
236
+ )
237
+ }
package/src/size.ts ADDED
@@ -0,0 +1,302 @@
1
+ import { Application } from '@nativescript/core'
2
+ import type { View } from '@nativescript/core'
3
+ import { toView } from './animate.js'
4
+ import { onReducedMotion, reducedMotion } from './config.js'
5
+ import { getDriver } from './driver/index.js'
6
+ import type { Animation } from './engine.js'
7
+ import { createClock, type PlaybackClock } from './playback.js'
8
+ import { createTrack, type Track } from './track.js'
9
+ import {
10
+ resolveTransition,
11
+ springs,
12
+ type Spring,
13
+ type SpringName,
14
+ type Tween,
15
+ } from './transition.js'
16
+ import {
17
+ dimension,
18
+ sizeLayout,
19
+ type SizeAxis,
20
+ type SizePixels,
21
+ type SizeValues,
22
+ } from './size-layout.js'
23
+ import type { Target } from './types.js'
24
+
25
+ export type SizeDimensions = SizeValues
26
+ export type SizeOptions =
27
+ | Omit<Spring, 'repeat' | 'repeatType' | 'repeatDelay'>
28
+ | Omit<Tween, 'repeat' | 'repeatType' | 'repeatDelay' | 'times' | 'easeTrack'>
29
+ export interface SizeAnimation extends Animation {
30
+ pause(): void
31
+ play(): void
32
+ readonly paused: boolean
33
+ /** Hold the current size; restore:true releases the temporary size back to the original declaration. */
34
+ stop(options?: { restore?: boolean }): void
35
+ }
36
+ const owners = new WeakMap<
37
+ View,
38
+ { animation: SizeAnimation; axes: readonly SizeAxis[] }
39
+ >()
40
+
41
+ /** Animate the actual layout box, including intrinsic auto sizes. Layout runs in JS on the UI thread. */
42
+ export function animateSize(
43
+ target: Target,
44
+ dimensions: SizeDimensions,
45
+ options?: SizeOptions | SpringName,
46
+ ): SizeAnimation
47
+ export function animateSize(
48
+ target: Target,
49
+ dimensions: SizeDimensions,
50
+ change: () => void,
51
+ options?: SizeOptions | SpringName,
52
+ ): SizeAnimation
53
+ export function animateSize(
54
+ target: Target,
55
+ dimensions: SizeDimensions,
56
+ changeOrOptions?: (() => void) | SizeOptions | SpringName,
57
+ options?: SizeOptions | SpringName,
58
+ ): SizeAnimation {
59
+ const view = toView(target)
60
+ if (!dimensions || typeof dimensions !== 'object' || Array.isArray(dimensions))
61
+ throw new TypeError('animateSize takes a width/height object.')
62
+ const axes = Object.keys(dimensions) as SizeAxis[]
63
+ if (!axes.length || axes.some((axis) => axis !== 'width' && axis !== 'height'))
64
+ throw new TypeError('animateSize needs width and/or height.')
65
+ for (const axis of axes) dimension(dimensions[axis], axis)
66
+ const destination = { ...dimensions }
67
+ const change = typeof changeOrOptions === 'function' ? changeOrOptions : undefined
68
+ if (change?.constructor.name === 'AsyncFunction')
69
+ throw new TypeError('animateSize changes must be synchronous.')
70
+ const transition = normalize(
71
+ change ? options : (changeOrOptions as SizeOptions | SpringName | undefined),
72
+ )
73
+ // Solve before ownership changes, including custom easing/physical-spring validation.
74
+ const validation = createTrack('x', [0, 100], transition, 0)
75
+ if (!Number.isFinite(validation.end) || !validation.values.every(Number.isFinite))
76
+ throw new RangeError('animateSize needs a finite curve with finite samples.')
77
+ const previous = owners.get(view)
78
+ const driver = getDriver()
79
+ const layout = sizeLayout(view, axes, previous?.axes, () => {
80
+ const frame = driver.layoutFrame?.(view)
81
+ return frame ? { width: frame.width, height: frame.height } : view.getActualSize()
82
+ })
83
+ // Release the previous overlay only after every caller-supplied input was validated.
84
+ const start = layout.read()
85
+ previous?.animation.stop({ restore: true })
86
+ let resolve!: (value: boolean) => void
87
+ let reject!: (error: unknown) => void
88
+ const finished = new Promise<boolean>((done, fail) => {
89
+ resolve = done
90
+ reject = fail
91
+ })
92
+ let settled = false
93
+ let paused = false
94
+ let initialized = false
95
+ let cancelFrame: (() => void) | undefined
96
+ let unwatch: (() => void) | undefined
97
+ let clock: PlaybackClock | undefined
98
+ let tracks = new Map<SizeAxis, Track>()
99
+ let endpoint: SizePixels | undefined
100
+ const cleanup = () => {
101
+ cancelFrame?.()
102
+ cancelFrame = undefined
103
+ clock?.cancel()
104
+ clock = undefined
105
+ unwatch?.()
106
+ layout.dispose()
107
+ view.off('unloaded', unloaded)
108
+ Application.off(Application.suspendEvent, unloaded)
109
+ if (owners.get(view)?.animation === animation) owners.delete(view)
110
+ }
111
+ const finish = (success: boolean, error?: unknown) => {
112
+ if (settled) return
113
+ settled = true
114
+ cleanup()
115
+ if (error !== undefined) reject(error)
116
+ else resolve(success)
117
+ }
118
+ const complete = () => {
119
+ layout.commit(destination)
120
+ layout.layout()
121
+ finish(true)
122
+ }
123
+ const stop = (restore = false) => {
124
+ if (settled) return
125
+ layout.commit(restore ? undefined : layout.read())
126
+ finish(false)
127
+ view.requestLayout()
128
+ }
129
+ function unloaded() {
130
+ stop(true)
131
+ }
132
+ const schedule = () => {
133
+ if (!cancelFrame && !settled && !paused) cancelFrame = driver.frame(tick)
134
+ }
135
+ function tick() {
136
+ cancelFrame = undefined
137
+ if (settled || paused) return
138
+ try {
139
+ if (!view.isLoaded || view.visibility === 'collapse' || !view.nativeViewProtected) {
140
+ stop(true)
141
+ return
142
+ }
143
+ const next = layout.measure(destination)
144
+ if (settled) return
145
+ if (axes.some((axis) => !Number.isFinite(next[axis]) || next[axis] < 0))
146
+ throw new Error('animateSize measured an invalid native size.')
147
+ if (reducedMotion()) {
148
+ complete()
149
+ return
150
+ }
151
+ if (
152
+ !initialized &&
153
+ axes.every((axis) => Math.abs(next[axis] - start[axis]) < 0.5)
154
+ ) {
155
+ complete()
156
+ return
157
+ }
158
+ const elapsed = clock?.time() ?? 0
159
+ if (
160
+ !endpoint ||
161
+ axes.some((axis) => Math.abs(next[axis] - endpoint![axis]) > 0.5)
162
+ ) {
163
+ const from = initialized ? layout.read() : start
164
+ const fresh = new Map<SizeAxis, Track>()
165
+ for (const axis of axes)
166
+ fresh.set(
167
+ axis,
168
+ createTrack(
169
+ 'x',
170
+ [from[axis], next[axis]],
171
+ initialized ? { ...transition, delay: 0 } : transition,
172
+ tracks.get(axis)?.velocityAt(elapsed) ?? 0,
173
+ ),
174
+ )
175
+ tracks = fresh
176
+ endpoint = next
177
+ clock?.cancel()
178
+ const end = Math.max(...[...tracks.values()].map((track) => track.end))
179
+ clock = driver.clock?.(end) ?? createClock(() => driver.now())
180
+ initialized = true
181
+ }
182
+ const time = clock!.time()
183
+ if ([...tracks.values()].every((track) => time >= track.end)) {
184
+ complete()
185
+ return
186
+ }
187
+ const values: SizeValues = {}
188
+ for (const [axis, track] of tracks) values[axis] = Math.max(0, track.valueAt(time))
189
+ layout.write(values)
190
+ layout.layout()
191
+ if (settled) return
192
+ schedule()
193
+ } catch (error) {
194
+ layout.commit()
195
+ view.requestLayout()
196
+ finish(false, error)
197
+ }
198
+ }
199
+ const animation: SizeAnimation = {
200
+ finished,
201
+ then: (done, fail) => finished.then(done, fail),
202
+ get paused() {
203
+ return paused
204
+ },
205
+ stop: (options) => stop(options?.restore === true),
206
+ pause() {
207
+ if (settled || paused) return
208
+ paused = true
209
+ clock?.pause()
210
+ cancelFrame?.()
211
+ cancelFrame = undefined
212
+ },
213
+ play() {
214
+ if (settled || !paused) return
215
+ paused = false
216
+ clock?.play()
217
+ schedule()
218
+ },
219
+ }
220
+ owners.set(view, { animation, axes })
221
+ try {
222
+ layout.watch(() => stop(true))
223
+ layout.write(start)
224
+ view.on('unloaded', unloaded)
225
+ Application.on(Application.suspendEvent, unloaded)
226
+ unwatch = onReducedMotion((reduced) => {
227
+ if (reduced && !settled) {
228
+ try {
229
+ complete()
230
+ } catch (error) {
231
+ finish(false, error)
232
+ }
233
+ }
234
+ })
235
+ const result: unknown = change?.()
236
+ if (result && typeof (result as PromiseLike<unknown>).then === 'function')
237
+ throw new TypeError('animateSize changes must be synchronous.')
238
+ if (!view.isLoaded || view.visibility === 'collapse' || !layout.ready()) {
239
+ layout.commit(destination)
240
+ finish(false)
241
+ } else schedule()
242
+ } catch (error) {
243
+ stop(true)
244
+ throw error
245
+ }
246
+ return animation
247
+ }
248
+
249
+ function normalize(input?: SizeOptions | SpringName) {
250
+ if (typeof input === 'string') {
251
+ if (!Object.hasOwn(springs, input))
252
+ throw new TypeError(`Unknown size spring "${input}".`)
253
+ input = springs[input]
254
+ }
255
+ if (
256
+ input !== undefined &&
257
+ (!input || typeof input !== 'object' || Array.isArray(input))
258
+ )
259
+ throw new TypeError('Invalid animateSize options.')
260
+ const allowed = new Set([
261
+ 'type',
262
+ 'duration',
263
+ 'ease',
264
+ 'stiffness',
265
+ 'damping',
266
+ 'mass',
267
+ 'bounce',
268
+ 'velocity',
269
+ 'delay',
270
+ ])
271
+ for (const [key, value] of Object.entries(input ?? {})) {
272
+ if (!allowed.has(key))
273
+ throw new TypeError(
274
+ `Unsupported animateSize option "${key}"; repeat and seek are not supported.`,
275
+ )
276
+ if (value === undefined) continue
277
+ if (
278
+ key !== 'type' &&
279
+ key !== 'ease' &&
280
+ (typeof value !== 'number' || !Number.isFinite(value))
281
+ )
282
+ throw new RangeError(`animateSize ${key} must be finite.`)
283
+ if (key === 'type' && value !== 'spring' && value !== 'tween')
284
+ throw new TypeError('Invalid size transition type.')
285
+ if (typeof value === 'number') {
286
+ if (['duration', 'delay', 'damping'].includes(key) && value < 0)
287
+ throw new RangeError(`${key} must be nonnegative.`)
288
+ if (['mass', 'stiffness'].includes(key) && value <= 0)
289
+ throw new RangeError(`${key} must be positive.`)
290
+ if (key === 'bounce' && (value < -1 || value > 1))
291
+ throw new RangeError('bounce must be between -1 and 1.')
292
+ }
293
+ }
294
+ const resolved = resolveTransition(input ?? {}, 'x', 2)
295
+ if (
296
+ resolved.curve.type === 'spring' &&
297
+ input?.duration === 0 &&
298
+ !('stiffness' in input || 'damping' in input || 'mass' in input)
299
+ )
300
+ throw new RangeError('Use a zero-duration tween for immediate sizing.')
301
+ return resolved
302
+ }
package/src/spring.ts CHANGED
@@ -18,6 +18,8 @@ export interface SpringMotion {
18
18
  position(time: number): number
19
19
  /** Units per second. */
20
20
  velocity(time: number): number
21
+ /** Conservative linear interpolation error, including the final settlement snap. */
22
+ interpolationError(start: number, end: number): number
21
23
  }
22
24
 
23
25
  const MAX_DURATION = 10_000
@@ -54,14 +56,24 @@ export function solveSpring(
54
56
  const zeta = damping / (2 * Math.sqrt(stiffness * mass))
55
57
 
56
58
  let displacement: (t: number) => number
59
+ let accelerationBound: (start: number, end: number) => number
57
60
  if (Math.abs(zeta - 1) < 1e-6) {
58
61
  const b = velocity + w0 * x0
59
62
  displacement = (t) => Math.exp(-w0 * t) * (x0 + b * t)
63
+ accelerationBound = (a, end) =>
64
+ Math.exp(-w0 * a) *
65
+ (Math.abs(w0 * w0 * (x0 + b * a) - 2 * w0 * b) +
66
+ w0 * w0 * Math.abs(b) * Math.min(end - a, 1 / (Math.E * w0)))
60
67
  } else if (zeta < 1) {
61
68
  const wd = w0 * Math.sqrt(1 - zeta * zeta)
62
69
  const b = (velocity + zeta * w0 * x0) / wd
63
70
  displacement = (t) =>
64
71
  Math.exp(-zeta * w0 * t) * (x0 * Math.cos(wd * t) + b * Math.sin(wd * t))
72
+ const alpha = zeta * w0,
73
+ q = alpha * alpha - wd * wd
74
+ const amplitude = Math.hypot(q * x0 - 2 * alpha * wd * b, q * b + 2 * alpha * wd * x0)
75
+ accelerationBound = (a, end) =>
76
+ amplitude * Math.max(Math.exp(-alpha * a), Math.exp(-alpha * end))
65
77
  } else {
66
78
  const s = w0 * Math.sqrt(zeta * zeta - 1)
67
79
  const r1 = -zeta * w0 + s
@@ -69,6 +81,9 @@ export function solveSpring(
69
81
  const c1 = (velocity - r2 * x0) / (r1 - r2)
70
82
  const c2 = x0 - c1
71
83
  displacement = (t) => c1 * Math.exp(r1 * t) + c2 * Math.exp(r2 * t)
84
+ accelerationBound = (a, end) =>
85
+ Math.abs(c1 * r1 * r1) * Math.max(Math.exp(r1 * a), Math.exp(r1 * end)) +
86
+ Math.abs(c2 * r2 * r2) * Math.max(Math.exp(r2 * a), Math.exp(r2 * end))
72
87
  }
73
88
 
74
89
  const position = (time: number) => to + displacement(time / 1000)
@@ -91,5 +106,8 @@ export function solveSpring(
91
106
  duration,
92
107
  position: (time) => (time >= duration ? to : position(time)),
93
108
  velocity: (time) => (time >= duration ? 0 : speed(time)),
109
+ interpolationError: (start, end) =>
110
+ (accelerationBound(start / 1000, end / 1000) * ((end - start) / 1000) ** 2) / 8 +
111
+ (end >= duration ? Math.abs(displacement(duration / 1000)) : 0),
94
112
  }
95
113
  }
package/src/svg-path.ts CHANGED
@@ -6,7 +6,11 @@ export interface PathPoint {
6
6
  export interface PathPose extends PathPoint {
7
7
  rotate: number
8
8
  }
9
- type Segment = { point(t: number): PathPoint; tangent(t: number): PathPoint }
9
+ type Segment = {
10
+ point(t: number): PathPoint
11
+ tangent(t: number): PathPoint
12
+ angle?: number
13
+ }
10
14
  type Vertex = PathPoint & {
11
15
  segment: number
12
16
  t: number
@@ -34,7 +38,7 @@ const checked = (p: PathPoint) => {
34
38
  const unwrap = (angle: number, reference: number) =>
35
39
  angle + 360 * Math.round((reference - angle) / 360)
36
40
 
37
- class Scanner {
41
+ export class Scanner {
38
42
  index = 0
39
43
  private hasNumber = false
40
44
  constructor(readonly text: string) {}
@@ -89,7 +93,7 @@ function bezier(points: readonly PathPoint[]): Segment {
89
93
  }
90
94
 
91
95
  /** Endpoint-to-center conversion: https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter */
92
- function arc(
96
+ export function arc(
93
97
  a: PathPoint,
94
98
  b: PathPoint,
95
99
  rx: number,
@@ -130,6 +134,7 @@ function arc(
130
134
  if (![cx, cy, rx, ry, start, delta].every(Number.isFinite))
131
135
  throw new RangeError('Path arc exceeds finite geometry limits.')
132
136
  return {
137
+ angle: delta,
133
138
  point(t) {
134
139
  if (t === 0) return a
135
140
  if (t === 1) return b