@rafaelaugusto/jolt 0.1.0-beta.9 → 0.1.0-rc.2

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 (576) hide show
  1. package/README.md +167 -21
  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 +27 -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 +4 -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-scroll-delegate.d.ts +4 -0
  67. package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
  68. package/dist/driver/ios-scroll-delegate.js +26 -0
  69. package/dist/driver/ios-scroll-delegate.js.map +1 -0
  70. package/dist/driver/ios.d.ts.map +1 -1
  71. package/dist/driver/ios.js +9 -0
  72. package/dist/driver/ios.js.map +1 -1
  73. package/dist/easing.d.ts +3 -1
  74. package/dist/easing.d.ts.map +1 -1
  75. package/dist/easing.js +18 -1
  76. package/dist/easing.js.map +1 -1
  77. package/dist/engine.d.ts +31 -2
  78. package/dist/engine.d.ts.map +1 -1
  79. package/dist/engine.js +194 -42
  80. package/dist/engine.js.map +1 -1
  81. package/dist/gesture-native.d.ts +28 -0
  82. package/dist/gesture-native.d.ts.map +1 -0
  83. package/dist/gesture-native.js +61 -0
  84. package/dist/gesture-native.js.map +1 -0
  85. package/dist/gestures/index.d.ts +69 -0
  86. package/dist/gestures/index.d.ts.map +1 -0
  87. package/dist/gestures/index.js +262 -0
  88. package/dist/gestures/index.js.map +1 -0
  89. package/dist/glass/index.d.ts +55 -0
  90. package/dist/glass/index.d.ts.map +1 -0
  91. package/dist/glass/index.js +205 -0
  92. package/dist/glass/index.js.map +1 -0
  93. package/dist/gradient-binding.d.ts +38 -0
  94. package/dist/gradient-binding.d.ts.map +1 -0
  95. package/dist/gradient-binding.js +128 -0
  96. package/dist/gradient-binding.js.map +1 -0
  97. package/dist/gradient.d.ts +105 -0
  98. package/dist/gradient.d.ts.map +1 -0
  99. package/dist/gradient.js +514 -0
  100. package/dist/gradient.js.map +1 -0
  101. package/dist/gravity.d.ts +13 -0
  102. package/dist/gravity.d.ts.map +1 -0
  103. package/dist/gravity.js +84 -0
  104. package/dist/gravity.js.map +1 -0
  105. package/dist/haptics.d.ts.map +1 -1
  106. package/dist/haptics.js +101 -28
  107. package/dist/haptics.js.map +1 -1
  108. package/dist/image-effect.d.ts +1 -0
  109. package/dist/image-effect.d.ts.map +1 -1
  110. package/dist/image-effect.js +10 -2
  111. package/dist/image-effect.js.map +1 -1
  112. package/dist/index.d.ts +19 -7
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.js +10 -4
  115. package/dist/index.js.map +1 -1
  116. package/dist/inspector/index.d.ts +86 -0
  117. package/dist/inspector/index.d.ts.map +1 -0
  118. package/dist/inspector/index.js +419 -0
  119. package/dist/inspector/index.js.map +1 -0
  120. package/dist/inspector/plot.d.ts +4 -0
  121. package/dist/inspector/plot.d.ts.map +1 -0
  122. package/dist/inspector/plot.js +23 -0
  123. package/dist/inspector/plot.js.map +1 -0
  124. package/dist/inspector/probe.d.ts +19 -0
  125. package/dist/inspector/probe.d.ts.map +1 -0
  126. package/dist/inspector/probe.js +37 -0
  127. package/dist/inspector/probe.js.map +1 -0
  128. package/dist/inspector/tuning.d.ts +19 -0
  129. package/dist/inspector/tuning.d.ts.map +1 -0
  130. package/dist/inspector/tuning.js +37 -0
  131. package/dist/inspector/tuning.js.map +1 -0
  132. package/dist/interactive-navigation/index.d.ts +44 -0
  133. package/dist/interactive-navigation/index.d.ts.map +1 -0
  134. package/dist/interactive-navigation/index.js +350 -0
  135. package/dist/interactive-navigation/index.js.map +1 -0
  136. package/dist/keyboard.d.ts +24 -0
  137. package/dist/keyboard.d.ts.map +1 -1
  138. package/dist/keyboard.js +199 -6
  139. package/dist/keyboard.js.map +1 -1
  140. package/dist/live-spring-driver.d.ts +52 -0
  141. package/dist/live-spring-driver.d.ts.map +1 -0
  142. package/dist/live-spring-driver.js +104 -0
  143. package/dist/live-spring-driver.js.map +1 -0
  144. package/dist/mixer.d.ts +55 -0
  145. package/dist/mixer.d.ts.map +1 -0
  146. package/dist/mixer.js +286 -0
  147. package/dist/mixer.js.map +1 -0
  148. package/dist/motion-scope.d.ts +8 -2
  149. package/dist/motion-scope.d.ts.map +1 -1
  150. package/dist/motion-scope.js +24 -3
  151. package/dist/motion-scope.js.map +1 -1
  152. package/dist/motion-states.d.ts +19 -7
  153. package/dist/motion-states.d.ts.map +1 -1
  154. package/dist/motion-states.js +116 -26
  155. package/dist/motion-states.js.map +1 -1
  156. package/dist/motion-value.d.ts +227 -0
  157. package/dist/motion-value.d.ts.map +1 -0
  158. package/dist/motion-value.js +1074 -0
  159. package/dist/motion-value.js.map +1 -0
  160. package/dist/native/index.d.ts +10 -0
  161. package/dist/native/index.d.ts.map +1 -0
  162. package/dist/native/index.js +6 -0
  163. package/dist/native/index.js.map +1 -0
  164. package/dist/native-properties.d.ts +28 -0
  165. package/dist/native-properties.d.ts.map +1 -0
  166. package/dist/native-properties.js +154 -0
  167. package/dist/native-properties.js.map +1 -0
  168. package/dist/native-property-driver.d.ts +19 -0
  169. package/dist/native-property-driver.d.ts.map +1 -0
  170. package/dist/native-property-driver.js +69 -0
  171. package/dist/native-property-driver.js.map +1 -0
  172. package/dist/native-property.d.ts +37 -0
  173. package/dist/native-property.d.ts.map +1 -0
  174. package/dist/native-property.js +285 -0
  175. package/dist/native-property.js.map +1 -0
  176. package/dist/particles.d.ts +5 -2
  177. package/dist/particles.d.ts.map +1 -1
  178. package/dist/particles.js +16 -10
  179. package/dist/particles.js.map +1 -1
  180. package/dist/path.d.ts.map +1 -1
  181. package/dist/path.js +2 -2
  182. package/dist/path.js.map +1 -1
  183. package/dist/physics/index.d.ts +139 -0
  184. package/dist/physics/index.d.ts.map +1 -0
  185. package/dist/physics/index.js +316 -0
  186. package/dist/physics/index.js.map +1 -0
  187. package/dist/physics/native.d.ts +54 -0
  188. package/dist/physics/native.d.ts.map +1 -0
  189. package/dist/physics/native.js +64 -0
  190. package/dist/physics/native.js.map +1 -0
  191. package/dist/playback-group.d.ts.map +1 -1
  192. package/dist/playback-group.js +17 -1
  193. package/dist/playback-group.js.map +1 -1
  194. package/dist/playback.d.ts +15 -0
  195. package/dist/playback.d.ts.map +1 -1
  196. package/dist/playback.js +23 -0
  197. package/dist/playback.js.map +1 -1
  198. package/dist/predictive-back/index.d.ts +45 -0
  199. package/dist/predictive-back/index.d.ts.map +1 -0
  200. package/dist/predictive-back/index.js +220 -0
  201. package/dist/predictive-back/index.js.map +1 -0
  202. package/dist/predictive-back/presentation.d.ts +4 -0
  203. package/dist/predictive-back/presentation.d.ts.map +1 -0
  204. package/dist/predictive-back/presentation.js +3 -0
  205. package/dist/predictive-back/presentation.js.map +1 -0
  206. package/dist/press.d.ts.map +1 -1
  207. package/dist/press.js +11 -2
  208. package/dist/press.js.map +1 -1
  209. package/dist/reorder/handle.d.ts +6 -0
  210. package/dist/reorder/handle.d.ts.map +1 -0
  211. package/dist/reorder/handle.js +10 -0
  212. package/dist/reorder/handle.js.map +1 -0
  213. package/dist/reorder/index.d.ts +10 -0
  214. package/dist/reorder/index.d.ts.map +1 -0
  215. package/dist/reorder/index.js +233 -0
  216. package/dist/reorder/index.js.map +1 -0
  217. package/dist/reorder/list-view.d.ts +5 -0
  218. package/dist/reorder/list-view.d.ts.map +1 -0
  219. package/dist/reorder/list-view.js +238 -0
  220. package/dist/reorder/list-view.js.map +1 -0
  221. package/dist/reorder/model.d.ts +6 -0
  222. package/dist/reorder/model.d.ts.map +1 -0
  223. package/dist/reorder/model.js +30 -0
  224. package/dist/reorder/model.js.map +1 -0
  225. package/dist/reorder/surface.d.ts +6 -0
  226. package/dist/reorder/surface.d.ts.map +1 -0
  227. package/dist/reorder/surface.js +10 -0
  228. package/dist/reorder/surface.js.map +1 -0
  229. package/dist/reorder/types.d.ts +92 -0
  230. package/dist/reorder/types.d.ts.map +1 -0
  231. package/dist/reorder/types.js +2 -0
  232. package/dist/reorder/types.js.map +1 -0
  233. package/dist/sampling.d.ts +35 -0
  234. package/dist/sampling.d.ts.map +1 -0
  235. package/dist/sampling.js +123 -0
  236. package/dist/sampling.js.map +1 -0
  237. package/dist/scene-appearance.d.ts +14 -0
  238. package/dist/scene-appearance.d.ts.map +1 -0
  239. package/dist/scene-appearance.js +68 -0
  240. package/dist/scene-appearance.js.map +1 -0
  241. package/dist/scene-camera.d.ts +5 -0
  242. package/dist/scene-camera.d.ts.map +1 -0
  243. package/dist/scene-camera.js +23 -0
  244. package/dist/scene-camera.js.map +1 -0
  245. package/dist/scene-shader.d.ts +18 -0
  246. package/dist/scene-shader.d.ts.map +1 -0
  247. package/dist/scene-shader.js +76 -0
  248. package/dist/scene-shader.js.map +1 -0
  249. package/dist/scroll-header/geometry.d.ts +18 -0
  250. package/dist/scroll-header/geometry.d.ts.map +1 -0
  251. package/dist/scroll-header/geometry.js +46 -0
  252. package/dist/scroll-header/geometry.js.map +1 -0
  253. package/dist/scroll-header/index.d.ts +48 -0
  254. package/dist/scroll-header/index.d.ts.map +1 -0
  255. package/dist/scroll-header/index.js +399 -0
  256. package/dist/scroll-header/index.js.map +1 -0
  257. package/dist/scroll-header/native.d.ts +28 -0
  258. package/dist/scroll-header/native.d.ts.map +1 -0
  259. package/dist/scroll-header/native.js +43 -0
  260. package/dist/scroll-header/native.js.map +1 -0
  261. package/dist/sensors/index.d.ts +69 -0
  262. package/dist/sensors/index.d.ts.map +1 -0
  263. package/dist/sensors/index.js +149 -0
  264. package/dist/sensors/index.js.map +1 -0
  265. package/dist/sensors/native.d.ts +20 -0
  266. package/dist/sensors/native.d.ts.map +1 -0
  267. package/dist/sensors/native.js +48 -0
  268. package/dist/sensors/native.js.map +1 -0
  269. package/dist/sequence.d.ts +24 -0
  270. package/dist/sequence.d.ts.map +1 -1
  271. package/dist/sequence.js +181 -19
  272. package/dist/sequence.js.map +1 -1
  273. package/dist/shapes/android.d.ts +3 -0
  274. package/dist/shapes/android.d.ts.map +1 -0
  275. package/dist/shapes/android.js +51 -0
  276. package/dist/shapes/android.js.map +1 -0
  277. package/dist/shapes/index.d.ts +6 -0
  278. package/dist/shapes/index.d.ts.map +1 -0
  279. package/dist/shapes/index.js +238 -0
  280. package/dist/shapes/index.js.map +1 -0
  281. package/dist/shapes/ios.d.ts +3 -0
  282. package/dist/shapes/ios.d.ts.map +1 -0
  283. package/dist/shapes/ios.js +164 -0
  284. package/dist/shapes/ios.js.map +1 -0
  285. package/dist/shapes/native.d.ts +18 -0
  286. package/dist/shapes/native.d.ts.map +1 -0
  287. package/dist/shapes/native.js +10 -0
  288. package/dist/shapes/native.js.map +1 -0
  289. package/dist/shapes/path.d.ts +10 -0
  290. package/dist/shapes/path.d.ts.map +1 -0
  291. package/dist/shapes/path.js +106 -0
  292. package/dist/shapes/path.js.map +1 -0
  293. package/dist/shapes/types.d.ts +55 -0
  294. package/dist/shapes/types.d.ts.map +1 -0
  295. package/dist/shapes/types.js +11 -0
  296. package/dist/shapes/types.js.map +1 -0
  297. package/dist/shared-layout/index.d.ts +40 -0
  298. package/dist/shared-layout/index.d.ts.map +1 -0
  299. package/dist/shared-layout/index.js +267 -0
  300. package/dist/shared-layout/index.js.map +1 -0
  301. package/dist/shared-layout/native.d.ts +15 -0
  302. package/dist/shared-layout/native.d.ts.map +1 -0
  303. package/dist/shared-layout/native.js +79 -0
  304. package/dist/shared-layout/native.js.map +1 -0
  305. package/dist/shared-layout/timing.d.ts +9 -0
  306. package/dist/shared-layout/timing.d.ts.map +1 -0
  307. package/dist/shared-layout/timing.js +68 -0
  308. package/dist/shared-layout/timing.js.map +1 -0
  309. package/dist/shared-navigation/entry.d.ts +51 -0
  310. package/dist/shared-navigation/entry.d.ts.map +1 -0
  311. package/dist/shared-navigation/entry.js +619 -0
  312. package/dist/shared-navigation/entry.js.map +1 -0
  313. package/dist/shared-navigation/index.d.ts +58 -0
  314. package/dist/shared-navigation/index.d.ts.map +1 -0
  315. package/dist/shared-navigation/index.js +318 -0
  316. package/dist/shared-navigation/index.js.map +1 -0
  317. package/dist/shared-navigation/return-signal.d.ts +16 -0
  318. package/dist/shared-navigation/return-signal.d.ts.map +1 -0
  319. package/dist/shared-navigation/return-signal.js +35 -0
  320. package/dist/shared-navigation/return-signal.js.map +1 -0
  321. package/dist/shared-navigation/return-target.d.ts +32 -0
  322. package/dist/shared-navigation/return-target.d.ts.map +1 -0
  323. package/dist/shared-navigation/return-target.js +168 -0
  324. package/dist/shared-navigation/return-target.js.map +1 -0
  325. package/dist/shared-navigation/scope.d.ts +4 -0
  326. package/dist/shared-navigation/scope.d.ts.map +1 -0
  327. package/dist/shared-navigation/scope.js +2 -0
  328. package/dist/shared-navigation/scope.js.map +1 -0
  329. package/dist/shared-navigation/targets.d.ts +6 -0
  330. package/dist/shared-navigation/targets.d.ts.map +1 -0
  331. package/dist/shared-navigation/targets.js +36 -0
  332. package/dist/shared-navigation/targets.js.map +1 -0
  333. package/dist/size-layout.d.ts +19 -0
  334. package/dist/size-layout.d.ts.map +1 -0
  335. package/dist/size-layout.js +216 -0
  336. package/dist/size-layout.js.map +1 -0
  337. package/dist/size.d.ts +19 -0
  338. package/dist/size.d.ts.map +1 -0
  339. package/dist/size.js +251 -0
  340. package/dist/size.js.map +1 -0
  341. package/dist/spring.d.ts +2 -0
  342. package/dist/spring.d.ts.map +1 -1
  343. package/dist/spring.js +11 -0
  344. package/dist/spring.js.map +1 -1
  345. package/dist/svg-path.d.ts +18 -0
  346. package/dist/svg-path.d.ts.map +1 -1
  347. package/dist/svg-path.js +3 -2
  348. package/dist/svg-path.js.map +1 -1
  349. package/dist/testing/clock.d.ts +40 -0
  350. package/dist/testing/clock.d.ts.map +1 -0
  351. package/dist/testing/clock.js +116 -0
  352. package/dist/testing/clock.js.map +1 -0
  353. package/dist/testing/handoff-recorder.d.ts +8 -0
  354. package/dist/testing/handoff-recorder.d.ts.map +1 -0
  355. package/dist/testing/handoff-recorder.js +77 -0
  356. package/dist/testing/handoff-recorder.js.map +1 -0
  357. package/dist/testing/index.d.ts +5 -0
  358. package/dist/testing/index.d.ts.map +1 -0
  359. package/dist/testing/index.js +5 -0
  360. package/dist/testing/index.js.map +1 -0
  361. package/dist/testing/native.d.ts +46 -0
  362. package/dist/testing/native.d.ts.map +1 -0
  363. package/dist/testing/native.js +313 -0
  364. package/dist/testing/native.js.map +1 -0
  365. package/dist/testing/presentation.d.ts +11 -0
  366. package/dist/testing/presentation.d.ts.map +1 -0
  367. package/dist/testing/presentation.js +45 -0
  368. package/dist/testing/presentation.js.map +1 -0
  369. package/dist/testing/replay.d.ts +39 -0
  370. package/dist/testing/replay.d.ts.map +1 -0
  371. package/dist/testing/replay.js +99 -0
  372. package/dist/testing/replay.js.map +1 -0
  373. package/dist/testing/scroll-handoff-native.d.ts +10 -0
  374. package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
  375. package/dist/testing/scroll-handoff-native.js +151 -0
  376. package/dist/testing/scroll-handoff-native.js.map +1 -0
  377. package/dist/testing/scroll-handoff.d.ts +25 -0
  378. package/dist/testing/scroll-handoff.d.ts.map +1 -0
  379. package/dist/testing/scroll-handoff.js +127 -0
  380. package/dist/testing/scroll-handoff.js.map +1 -0
  381. package/dist/testing/sensors.d.ts +13 -0
  382. package/dist/testing/sensors.d.ts.map +1 -0
  383. package/dist/testing/sensors.js +26 -0
  384. package/dist/testing/sensors.js.map +1 -0
  385. package/dist/testing/trace.d.ts +101 -0
  386. package/dist/testing/trace.d.ts.map +1 -0
  387. package/dist/testing/trace.js +263 -0
  388. package/dist/testing/trace.js.map +1 -0
  389. package/dist/timed-animation.d.ts +38 -0
  390. package/dist/timed-animation.d.ts.map +1 -0
  391. package/dist/timed-animation.js +177 -0
  392. package/dist/timed-animation.js.map +1 -0
  393. package/dist/track.d.ts +3 -0
  394. package/dist/track.d.ts.map +1 -1
  395. package/dist/track.js +281 -40
  396. package/dist/track.js.map +1 -1
  397. package/dist/transition.d.ts +54 -2
  398. package/dist/transition.d.ts.map +1 -1
  399. package/dist/transition.js +128 -8
  400. package/dist/transition.js.map +1 -1
  401. package/dist/types.d.ts +10 -1
  402. package/dist/types.d.ts.map +1 -1
  403. package/dist/value-observers.d.ts +22 -0
  404. package/dist/value-observers.d.ts.map +1 -0
  405. package/dist/value-observers.js +122 -0
  406. package/dist/value-observers.js.map +1 -0
  407. package/dist/value-track.d.ts +13 -0
  408. package/dist/value-track.d.ts.map +1 -0
  409. package/dist/value-track.js +59 -0
  410. package/dist/value-track.js.map +1 -0
  411. package/dist/vue/index.d.ts +33 -3
  412. package/dist/vue/index.d.ts.map +1 -1
  413. package/dist/vue/index.js +118 -3
  414. package/dist/vue/index.js.map +1 -1
  415. package/dist/zoomable.d.ts +1 -1
  416. package/dist/zoomable.d.ts.map +1 -1
  417. package/package.json +68 -3
  418. package/platforms/android/include.gradle +10 -0
  419. package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
  420. package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +158 -0
  421. package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +221 -0
  422. package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
  423. package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
  424. package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
  425. package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
  426. package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
  427. package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
  428. package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
  429. package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
  430. package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
  431. package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
  432. package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
  433. package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
  434. package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
  435. package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
  436. package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
  437. package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
  438. package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
  439. package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
  440. package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
  441. package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
  442. package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
  443. package/platforms/android/proguard-rules.pro +20 -0
  444. package/platforms/ios/build.xcconfig +1 -1
  445. package/platforms/ios/src/JoltBlur.h +14 -0
  446. package/platforms/ios/src/JoltBlur.m +86 -0
  447. package/platforms/ios/src/JoltCircleMath.h +191 -0
  448. package/platforms/ios/src/JoltCircleWorld.h +18 -0
  449. package/platforms/ios/src/JoltCircleWorld.m +218 -0
  450. package/platforms/ios/src/JoltGestureSession.h +23 -0
  451. package/platforms/ios/src/JoltGestureSession.m +251 -0
  452. package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
  453. package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
  454. package/platforms/ios/src/JoltLiveSpring.h +29 -0
  455. package/platforms/ios/src/JoltLiveSpring.m +243 -0
  456. package/platforms/ios/src/JoltMotionProbe.h +9 -0
  457. package/platforms/ios/src/JoltMotionProbe.m +72 -0
  458. package/platforms/ios/src/JoltReorderSession.h +15 -0
  459. package/platforms/ios/src/JoltReorderSession.m +205 -0
  460. package/platforms/ios/src/JoltScrollHeader.h +13 -0
  461. package/platforms/ios/src/JoltScrollHeader.m +101 -0
  462. package/platforms/ios/src/JoltSensorMath.h +39 -0
  463. package/platforms/ios/src/JoltSensorSource.h +13 -0
  464. package/platforms/ios/src/JoltSensorSource.m +201 -0
  465. package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
  466. package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
  467. package/platforms/ios/src/JoltSpringState.h +35 -0
  468. package/platforms/ios/src/module.modulemap +10 -0
  469. package/src/android-plugin.d.ts +464 -0
  470. package/src/animate.ts +129 -15
  471. package/src/blur/index.ts +195 -0
  472. package/src/blur/native.ts +70 -0
  473. package/src/blur/types.ts +32 -0
  474. package/src/bottom-sheet/geometry.ts +84 -0
  475. package/src/bottom-sheet/index.ts +536 -0
  476. package/src/bottom-sheet/native.ts +214 -0
  477. package/src/config.ts +39 -1
  478. package/src/decay.ts +9 -0
  479. package/src/drag.ts +67 -21
  480. package/src/driver/android-gradient.ts +116 -0
  481. package/src/driver/android-particles.ts +118 -0
  482. package/src/driver/android.ts +31 -1
  483. package/src/driver/frame.ts +10 -0
  484. package/src/driver/index.ts +4 -0
  485. package/src/driver/ios-gradient.ts +136 -0
  486. package/src/driver/ios-scroll-delegate.ts +23 -0
  487. package/src/driver/ios.ts +10 -0
  488. package/src/easing.ts +21 -1
  489. package/src/engine.ts +209 -60
  490. package/src/gesture-native.ts +139 -0
  491. package/src/gestures/index.ts +365 -0
  492. package/src/glass/index.ts +218 -0
  493. package/src/gradient-binding.ts +158 -0
  494. package/src/gradient.ts +663 -0
  495. package/src/gravity.ts +107 -0
  496. package/src/haptics.ts +106 -28
  497. package/src/image-effect.ts +10 -2
  498. package/src/index.ts +56 -7
  499. package/src/inspector/index.ts +523 -0
  500. package/src/inspector/plot.ts +27 -0
  501. package/src/inspector/probe.ts +50 -0
  502. package/src/inspector/tuning.ts +51 -0
  503. package/src/interactive-navigation/index.ts +427 -0
  504. package/src/ios-plugin.d.ts +280 -0
  505. package/src/keyboard.ts +231 -7
  506. package/src/live-spring-driver.ts +181 -0
  507. package/src/mixer.ts +312 -0
  508. package/src/motion-scope.ts +39 -6
  509. package/src/motion-states.ts +149 -42
  510. package/src/motion-value.ts +1289 -0
  511. package/src/native/index.ts +30 -0
  512. package/src/native-properties.ts +188 -0
  513. package/src/native-property-driver.ts +123 -0
  514. package/src/native-property.ts +366 -0
  515. package/src/particles.ts +18 -17
  516. package/src/path.ts +2 -1
  517. package/src/physics/index.ts +476 -0
  518. package/src/physics/native.ts +121 -0
  519. package/src/playback-group.ts +17 -1
  520. package/src/playback.ts +41 -0
  521. package/src/predictive-back/index.ts +280 -0
  522. package/src/predictive-back/presentation.ts +6 -0
  523. package/src/press.ts +10 -2
  524. package/src/reorder/handle.ts +9 -0
  525. package/src/reorder/index.ts +243 -0
  526. package/src/reorder/list-view.ts +262 -0
  527. package/src/reorder/model.ts +47 -0
  528. package/src/reorder/surface.ts +10 -0
  529. package/src/reorder/types.ts +87 -0
  530. package/src/sampling.ts +173 -0
  531. package/src/scene-appearance.ts +92 -0
  532. package/src/scene-camera.ts +30 -0
  533. package/src/scene-shader.ts +139 -0
  534. package/src/scroll-header/geometry.ts +88 -0
  535. package/src/scroll-header/index.ts +530 -0
  536. package/src/scroll-header/native.ts +89 -0
  537. package/src/sensors/index.ts +246 -0
  538. package/src/sensors/native.ts +72 -0
  539. package/src/sequence.ts +209 -20
  540. package/src/shapes/android.ts +63 -0
  541. package/src/shapes/index.ts +267 -0
  542. package/src/shapes/ios.ts +194 -0
  543. package/src/shapes/native.ts +27 -0
  544. package/src/shapes/path.ts +127 -0
  545. package/src/shapes/types.ts +63 -0
  546. package/src/shared-layout/index.ts +343 -0
  547. package/src/shared-layout/native.ts +138 -0
  548. package/src/shared-layout/timing.ts +87 -0
  549. package/src/shared-navigation/entry.ts +695 -0
  550. package/src/shared-navigation/index.ts +414 -0
  551. package/src/shared-navigation/return-signal.ts +41 -0
  552. package/src/shared-navigation/return-target.ts +197 -0
  553. package/src/shared-navigation/scope.ts +3 -0
  554. package/src/shared-navigation/targets.ts +38 -0
  555. package/src/size-layout.ts +237 -0
  556. package/src/size.ts +302 -0
  557. package/src/spring.ts +18 -0
  558. package/src/svg-path.ts +8 -3
  559. package/src/testing/clock.ts +128 -0
  560. package/src/testing/handoff-recorder.ts +98 -0
  561. package/src/testing/index.ts +4 -0
  562. package/src/testing/native.ts +386 -0
  563. package/src/testing/presentation.ts +46 -0
  564. package/src/testing/replay.ts +149 -0
  565. package/src/testing/scroll-handoff-native.ts +201 -0
  566. package/src/testing/scroll-handoff.ts +140 -0
  567. package/src/testing/sensors.ts +41 -0
  568. package/src/testing/trace.ts +340 -0
  569. package/src/timed-animation.ts +192 -0
  570. package/src/track.ts +334 -38
  571. package/src/transition.ts +197 -9
  572. package/src/types.ts +11 -1
  573. package/src/value-observers.ts +147 -0
  574. package/src/value-track.ts +71 -0
  575. package/src/vue/index.ts +147 -1
  576. package/src/zoomable.ts +1 -1
@@ -0,0 +1,1074 @@
1
+ import { Application, Color, ScrollView, } from '@nativescript/core';
2
+ import { toViews } from './animate.js';
3
+ import { colorMixer, isColorProperty, parseColor, validateColorTarget, } from './color.js';
4
+ import { onReducedMotion, reducedMotion, timeScale } from './config.js';
5
+ import { springPhysics } from './spring.js';
6
+ import { mixFor } from './mixer.js';
7
+ import { liveSpringDriver, syncLiveSprings, } from './live-spring-driver.js';
8
+ import { clampDecoration, isDecorationProperty, validateDecorationTarget, } from './decoration.js';
9
+ import { getDriver } from './driver/index.js';
10
+ import { setBase, stopBase, ViewAnimation } from './engine.js';
11
+ import { linear } from './easing.js';
12
+ import { isProperty } from './properties.js';
13
+ import { createTrack, instantTrack } from './track.js';
14
+ import { resolveTransition, springs, } from './transition.js';
15
+ import { playbackSource } from './playback.js';
16
+ import { TimedAnimation } from './timed-animation.js';
17
+ import { valueTrack } from './value-track.js';
18
+ import { ValueObservers, } from './value-observers.js';
19
+ const bound = new WeakMap();
20
+ class Derived {
21
+ source;
22
+ read;
23
+ color;
24
+ mappings;
25
+ constructor(source, read, color, mappings = []) {
26
+ this.source = source;
27
+ this.read = read;
28
+ this.color = color;
29
+ this.mappings = mappings;
30
+ }
31
+ get root() {
32
+ return this.source ?? this;
33
+ }
34
+ get() {
35
+ const value = this.read(this.root.raw());
36
+ return this.color ? new Color(value) : value;
37
+ }
38
+ subscribe(listener, options) {
39
+ const release = this.root.retainConsumer();
40
+ try {
41
+ const stop = this.root.observers.subscribe(this.read, this.color, listener, options);
42
+ return () => {
43
+ stop();
44
+ release();
45
+ };
46
+ }
47
+ catch (error) {
48
+ release();
49
+ throw error;
50
+ }
51
+ }
52
+ to(input, output, options) {
53
+ if (this.color)
54
+ throw new TypeError('A color cannot be mapped again.');
55
+ const map = mapping(input, output, options);
56
+ if (this.root instanceof SpringRoot && map.color)
57
+ throw new TypeError('Live spring bindings currently support numeric transforms and opacity.');
58
+ const read = this.read;
59
+ return new Derived(this.root, (value) => map.read(read(value)), map.color, map.color
60
+ ? []
61
+ : [
62
+ ...this.mappings,
63
+ {
64
+ input: [...map.input],
65
+ output: [...map.numbers],
66
+ clamp: options?.clamp !== false,
67
+ },
68
+ ]);
69
+ }
70
+ }
71
+ class Root extends Derived {
72
+ consumers = 0;
73
+ demandListeners = new Set();
74
+ get demanded() {
75
+ return this.consumers > 0;
76
+ }
77
+ retainConsumer() {
78
+ this.consumers++;
79
+ try {
80
+ this.demandChanged();
81
+ }
82
+ catch (error) {
83
+ this.consumers--;
84
+ this.demandChanged();
85
+ throw error;
86
+ }
87
+ let ended = false;
88
+ return () => {
89
+ if (ended)
90
+ return;
91
+ ended = true;
92
+ this.consumers--;
93
+ this.demandChanged();
94
+ };
95
+ }
96
+ demandChanged() {
97
+ for (const listener of [...this.demandListeners])
98
+ listener(this.demanded);
99
+ }
100
+ bindings = new Set();
101
+ listeners = new Set();
102
+ observers = new ValueObservers((time) => this.raw(time), () => this.running);
103
+ rests = new Map();
104
+ runs = new Map();
105
+ presentation;
106
+ cancelPresentation;
107
+ constructor(initial) {
108
+ super(undefined, (value) => value, false);
109
+ if (!Number.isFinite(initial))
110
+ throw new RangeError(`A motion value starts from a finite number, got ${initial}.`);
111
+ this.rests.set('', initial);
112
+ }
113
+ raw(time = getDriver().now()) {
114
+ let result = 0;
115
+ for (const key of new Set([...this.rests.keys(), ...this.runs.keys()]))
116
+ result += this.part(key, time);
117
+ return result;
118
+ }
119
+ /** Drag input owns only the base; bounds and snap points stay in base units. */
120
+ base() {
121
+ return this.part('');
122
+ }
123
+ part(key, time = getDriver().now()) {
124
+ const run = this.runs.get(key);
125
+ return run
126
+ ? run.base + run.span * run.track.valueAt(this.runTime(run, time))
127
+ : (this.rests.get(key) ?? 0);
128
+ }
129
+ runTime(run, time = getDriver().now()) {
130
+ return run.clock?.time() ?? time - run.startedAt;
131
+ }
132
+ /** Internal development snapshot; reading it installs no observers. */
133
+ inspect() {
134
+ return {
135
+ velocity: [...this.runs.keys()].reduce((sum, key) => sum + this.velocity(key), 0),
136
+ resources: this.bindings.size + this.listeners.size + this.observers.size + this.runs.size,
137
+ };
138
+ }
139
+ velocity(key) {
140
+ const run = this.runs.get(key);
141
+ if (!run || run.animation.paused)
142
+ return 0;
143
+ return run.span * run.track.velocityAt(this.runTime(run));
144
+ }
145
+ animate(target, transition = {}) {
146
+ const options = typeof transition === 'string' ? springOf(transition) : transition;
147
+ const key = options.layer === undefined ? '' : layerName(options.layer);
148
+ const from = this.part(key);
149
+ const frames = (typeof target === 'number' ? [null, target] : [...target]).map((frame) => (frame === null ? from : frame));
150
+ if (frames.length < 2)
151
+ frames.unshift(from);
152
+ if (frames.some((frame) => typeof frame !== 'number' || !Number.isFinite(frame)))
153
+ throw new RangeError(`Invalid motion value keyframes: ${JSON.stringify(target)}.`);
154
+ const resolved = resolveTransition(options, 'x', frames.length);
155
+ const base = Math.min(...frames);
156
+ const span = Math.max(...frames) - base;
157
+ const velocity = this.velocity(key);
158
+ if (resolved.curve.type === 'gravity') {
159
+ // Acceleration and velocity belong to the value's units, not normalized progress.
160
+ const track = createTrack('x', frames, resolved, velocity);
161
+ this.halt(key);
162
+ return track.end === 0 ? this.jump(track.to, key) : this.start(track, 0, 1, key);
163
+ }
164
+ if (span === 0) {
165
+ this.halt(key);
166
+ return this.jump(frames.at(-1), key);
167
+ }
168
+ // Sampled in the value's own range so springs settle relative to the distance.
169
+ const track = createTrack('opacity', frames.map((frame) => (frame - base) / span), resolved, velocity / span);
170
+ this.halt(key);
171
+ return track.end === 0
172
+ ? this.jump(base + span * track.to, key)
173
+ : this.start(track, base, span, key);
174
+ }
175
+ /** Plays a track sampled in the value's own units, such as a drag release. */
176
+ playTrack(track) {
177
+ this.halt('');
178
+ return track.end === 0 ? this.jump(track.to, '') : this.start(track, 0, 1, '');
179
+ }
180
+ jump(value, key) {
181
+ this.rests.set(key, value);
182
+ this.sync();
183
+ const animation = new TimedAnimation(0, 0, () => { }, () => { });
184
+ animation.start();
185
+ return animation;
186
+ }
187
+ start(track, base, span, key) {
188
+ const driver = getDriver();
189
+ const animation = new TimedAnimation(track.end, track.arrival, () => this.sync(), (completed) => {
190
+ if (this.runs.get(key)?.animation !== animation)
191
+ return;
192
+ const held = base + span * track.valueAt(animation.time);
193
+ this.runs.delete(key);
194
+ if (!completed && key !== '')
195
+ this.rests.delete(key);
196
+ else
197
+ this.rests.set(key, completed ? base + span * track.to : held);
198
+ this.sync();
199
+ });
200
+ const run = {
201
+ track,
202
+ base,
203
+ span,
204
+ animation,
205
+ startedAt: driver.now(),
206
+ clock: { time: () => animation.time },
207
+ };
208
+ this.runs.set(key, run);
209
+ this.sync();
210
+ animation.start();
211
+ return animation;
212
+ }
213
+ set(value) {
214
+ if (!Number.isFinite(value))
215
+ throw new RangeError(`A motion value takes a finite number, got ${value}.`);
216
+ for (const key of [...this.runs.keys()])
217
+ this.halt(key);
218
+ this.rests.clear();
219
+ this.rests.set('', value);
220
+ this.sync();
221
+ }
222
+ setBase(value) {
223
+ if (!Number.isFinite(value))
224
+ throw new RangeError('A motion value takes a finite number.');
225
+ this.halt('');
226
+ this.rests.set('', value);
227
+ this.sync();
228
+ }
229
+ stopBase() {
230
+ this.stopChannel('');
231
+ }
232
+ stop(layer) {
233
+ if (layer !== undefined)
234
+ return this.stopChannel(layerName(layer));
235
+ if (!this.runs.size && this.rests.size === 1)
236
+ return;
237
+ const value = this.raw();
238
+ for (const key of [...this.runs.keys()])
239
+ this.halt(key);
240
+ this.rests.clear();
241
+ this.rests.set('', value);
242
+ this.sync();
243
+ }
244
+ stopChannel(key) {
245
+ if (!this.runs.has(key) && (key === '' || !this.rests.has(key)))
246
+ return;
247
+ const held = this.part(key);
248
+ this.halt(key);
249
+ if (key === '')
250
+ this.rests.set(key, held);
251
+ else
252
+ this.rests.delete(key);
253
+ this.sync();
254
+ }
255
+ sync() {
256
+ this.cancelPresentation?.();
257
+ this.cancelPresentation = undefined;
258
+ const now = getDriver().now();
259
+ let rest = 0;
260
+ for (const [key, value] of this.rests)
261
+ if (!this.runs.has(key))
262
+ rest += value;
263
+ const runs = [...this.runs.values()].filter((run) => !run.animation.paused);
264
+ for (const [key, run] of this.runs)
265
+ if (run.animation.paused)
266
+ rest += this.part(key, now);
267
+ if (!runs.length)
268
+ this.presentation = undefined;
269
+ else if (runs.length === 1) {
270
+ const run = runs[0];
271
+ this.presentation = { ...run, base: run.base + rest };
272
+ }
273
+ else {
274
+ const { track, windowed } = valueTrack(runs.map((run) => ({
275
+ track: run.track,
276
+ base: run.base,
277
+ span: run.span,
278
+ elapsed: this.runTime(run, now),
279
+ })), rest);
280
+ const driver = getDriver();
281
+ const clock = driver.clock?.(track.end);
282
+ this.presentation = { track, base: 0, span: 1, startedAt: now, clock };
283
+ const cancelWindow = windowed
284
+ ? driver.after(track.end, () => this.sync())
285
+ : undefined;
286
+ this.cancelPresentation = () => {
287
+ cancelWindow?.();
288
+ clock?.cancel();
289
+ };
290
+ }
291
+ this.changed();
292
+ }
293
+ changed() {
294
+ for (const binding of this.bindings)
295
+ binding.sync();
296
+ for (const listener of [...this.listeners])
297
+ listener();
298
+ this.observers.changed(this.running);
299
+ }
300
+ /** The plan that plays this value's run, mapped, on one bound property. */
301
+ plan(binding) {
302
+ const run = this.presentation;
303
+ const { property, read } = binding;
304
+ const write = (value) => isDecorationProperty(property)
305
+ ? clampDecoration(property, read(value))
306
+ : read(value);
307
+ if (!run) {
308
+ const value = write(this.raw());
309
+ return {
310
+ property,
311
+ keyframes: [],
312
+ transition: still,
313
+ track: () => instantTrack(property, value),
314
+ };
315
+ }
316
+ const { track, base, span } = run;
317
+ const at = (progress) => write(base + span * progress);
318
+ const transition = {
319
+ curve: {
320
+ type: 'tween',
321
+ duration: track.duration,
322
+ ease: [linear],
323
+ times: undefined,
324
+ },
325
+ delay: track.delay,
326
+ repeat: track.repeat,
327
+ reverse: track.reverse,
328
+ };
329
+ const mapped = () => {
330
+ if (reducedMotion() && property !== 'opacity' && !isColorProperty(property))
331
+ return instantTrack(property, at(track.to));
332
+ return {
333
+ property,
334
+ delay: track.delay,
335
+ duration: track.duration,
336
+ repeat: track.repeat,
337
+ reverse: track.reverse,
338
+ times: track.times,
339
+ values: track.values.map(at),
340
+ to: at(track.to),
341
+ end: track.end,
342
+ arrival: track.arrival,
343
+ valueAt: (elapsed) => at(track.valueAt(elapsed)),
344
+ velocityAt: isColorProperty(property)
345
+ ? () => 0
346
+ : (elapsed) => (at(track.valueAt(elapsed + 0.5)) - at(track.valueAt(elapsed - 0.5))) *
347
+ 1000,
348
+ };
349
+ };
350
+ return { property, keyframes: [], transition, track: mapped };
351
+ }
352
+ /** Capture the current native presentation clock, even if a later command replaces it. */
353
+ captureTime() {
354
+ const run = this.presentation;
355
+ return run ? () => this.runTime(run) : () => 0;
356
+ }
357
+ elapsed() {
358
+ return this.presentation ? this.runTime(this.presentation) : 0;
359
+ }
360
+ get paused() {
361
+ return this.runs.size > 0 && !this.running;
362
+ }
363
+ get running() {
364
+ return [...this.runs.values()].some((run) => !run.animation.paused);
365
+ }
366
+ halt(key) {
367
+ const run = this.runs.get(key);
368
+ if (!run)
369
+ return;
370
+ this.runs.delete(key);
371
+ run.animation.stop();
372
+ }
373
+ }
374
+ class SpringRoot extends Root {
375
+ input;
376
+ releaseDemand;
377
+ externalActive = false;
378
+ demandChanged() {
379
+ const active = this.demanded && !this.ended && !this.held && !this.background;
380
+ if (active && !this.releaseDemand) {
381
+ // A source status callback may synchronously suspend or dispose this follower.
382
+ this.releaseDemand = () => { };
383
+ let release;
384
+ try {
385
+ release = this.input.root.retainConsumer();
386
+ }
387
+ catch (error) {
388
+ this.releaseDemand = undefined;
389
+ throw error;
390
+ }
391
+ this.releaseDemand = release;
392
+ if (!this.demanded || this.ended || this.held || this.background) {
393
+ this.releaseDemand = undefined;
394
+ release();
395
+ }
396
+ }
397
+ else if (!active && this.releaseDemand) {
398
+ const release = this.releaseDemand;
399
+ this.releaseDemand = undefined;
400
+ release();
401
+ }
402
+ super.demandChanged();
403
+ }
404
+ node;
405
+ releaseSource = () => { };
406
+ releaseReduced = () => { };
407
+ ended = false;
408
+ held = false;
409
+ background = false;
410
+ suspend = () => {
411
+ this.background = true;
412
+ this.updatePause();
413
+ };
414
+ resume = () => {
415
+ this.background = false;
416
+ this.updatePause();
417
+ };
418
+ constructor(input, options) {
419
+ const source = input;
420
+ const initial = options.initial ?? source.get();
421
+ const instant = options.duration === 0;
422
+ const params = springPhysics(instant ? { ...options, duration: undefined } : options);
423
+ const speed = timeScale();
424
+ const physics = {
425
+ stiffness: params.stiffness * speed * speed,
426
+ damping: params.damping * speed,
427
+ mass: params.mass,
428
+ restDelta: options.restDelta ?? 0.001,
429
+ restSpeed: options.restSpeed ?? 0.01,
430
+ };
431
+ for (const [key, value] of Object.entries(physics))
432
+ if (!Number.isFinite(value) || (key === 'damping' ? value < 0 : value <= 0))
433
+ throw new RangeError(`Invalid springValue ${key}: ${value}.`);
434
+ if (options.duration !== undefined &&
435
+ (!Number.isFinite(options.duration) || options.duration < 0))
436
+ throw new RangeError('springValue duration must be finite and nonnegative.');
437
+ if (options.bounce !== undefined && !Number.isFinite(options.bounce))
438
+ throw new RangeError('springValue bounce must be finite.');
439
+ super(initial);
440
+ this.input = input;
441
+ this.node = liveSpringDriver().create(initial, physics, instant || reducedMotion());
442
+ const root = source.root;
443
+ try {
444
+ let update;
445
+ if (root instanceof SpringRoot) {
446
+ if (root.disposed)
447
+ throw new Error('Cannot follow a disposed spring value.');
448
+ this.node.follow(root.node, source.mappings);
449
+ update = () => this.notify();
450
+ }
451
+ else {
452
+ const playback = valuePlayback(source);
453
+ update = () => {
454
+ if (!root.running) {
455
+ this.node.update({
456
+ value: source.get(),
457
+ running: false,
458
+ elapsed: 0,
459
+ duration: 0,
460
+ delay: 0,
461
+ repeat: 0,
462
+ reverse: false,
463
+ to: 0,
464
+ times: [],
465
+ values: [],
466
+ });
467
+ this.notify();
468
+ return;
469
+ }
470
+ const { track, elapsed, running, value } = playback.snapshot();
471
+ this.node.update({
472
+ value,
473
+ elapsed,
474
+ running,
475
+ duration: track.duration,
476
+ delay: track.delay,
477
+ repeat: Number.isFinite(track.repeat) ? track.repeat : -1,
478
+ reverse: track.reverse,
479
+ to: track.to,
480
+ times: track.times,
481
+ values: track.values,
482
+ });
483
+ this.notify();
484
+ };
485
+ }
486
+ root.listeners.add(update);
487
+ this.releaseSource = () => {
488
+ root.listeners.delete(update);
489
+ };
490
+ this.releaseReduced = onReducedMotion((reduced) => {
491
+ this.node.reduced(instant || reduced);
492
+ this.notify();
493
+ });
494
+ Application.on(Application.suspendEvent, this.suspend);
495
+ Application.on(Application.resumeEvent, this.resume);
496
+ update();
497
+ }
498
+ catch (error) {
499
+ this.dispose();
500
+ throw error;
501
+ }
502
+ }
503
+ raw() {
504
+ return this.node?.position() ?? super.raw();
505
+ }
506
+ get running() {
507
+ return (!this.ended &&
508
+ !this.held &&
509
+ !this.background &&
510
+ (this.externalActive || (this.node?.moving() ?? false)));
511
+ }
512
+ get moving() {
513
+ return this.running;
514
+ }
515
+ get disposed() {
516
+ return this.ended;
517
+ }
518
+ get paused() {
519
+ return this.held;
520
+ }
521
+ pause() {
522
+ if (!this.ended) {
523
+ this.held = true;
524
+ this.updatePause();
525
+ }
526
+ }
527
+ play() {
528
+ if (!this.ended) {
529
+ this.held = false;
530
+ this.updatePause();
531
+ }
532
+ }
533
+ updatePause() {
534
+ this.node.paused(this.held || this.background);
535
+ this.demandChanged();
536
+ this.notify();
537
+ }
538
+ getVelocity() {
539
+ return this.ended ? 0 : this.node.velocity();
540
+ }
541
+ plan() {
542
+ throw new TypeError('A live spring cannot be sampled as a fixed track. Bind it to transforms or opacity.');
543
+ }
544
+ notify() {
545
+ this.observers.changed(this.running);
546
+ for (const listener of [...this.listeners])
547
+ listener();
548
+ }
549
+ dispose() {
550
+ if (this.ended)
551
+ return;
552
+ this.ended = true;
553
+ this.demandChanged();
554
+ this.releaseSource();
555
+ this.releaseReduced();
556
+ Application.off(Application.suspendEvent, this.suspend);
557
+ Application.off(Application.resumeEvent, this.resume);
558
+ for (const binding of [...this.bindings])
559
+ release(binding);
560
+ this.node.dispose();
561
+ this.observers.clear();
562
+ for (const listener of [...this.listeners])
563
+ listener();
564
+ this.listeners.clear();
565
+ }
566
+ }
567
+ /** Follow changing targets without rebuilding sampled animation tracks. Dispose with the owning scope. */
568
+ export function springValue(source, options = {}) {
569
+ if (!(source instanceof Derived) || source.color)
570
+ throw new TypeError('springValue() needs a numeric Jolt motion value.');
571
+ if (!options || typeof options !== 'object')
572
+ throw new TypeError('springValue() options must be an object.');
573
+ return new SpringRoot(source, options);
574
+ }
575
+ /** Internal boundary notification for values driven directly by native input. */
576
+ export function liveValueInput(value) {
577
+ if (!(value instanceof Derived) || !(value.root instanceof SpringRoot))
578
+ throw new TypeError('Native input requires a live value.');
579
+ const root = value.root;
580
+ return {
581
+ node: root.node,
582
+ changed: () => root.notify(),
583
+ active(value) {
584
+ root.externalActive = value;
585
+ root.notify();
586
+ },
587
+ demand(listener) {
588
+ root.demandListeners.add(listener);
589
+ listener(root.demanded);
590
+ return () => {
591
+ root.demandListeners.delete(listener);
592
+ };
593
+ },
594
+ };
595
+ }
596
+ function layerName(name) {
597
+ if (typeof name !== 'string' || !name.length)
598
+ throw new TypeError('A layer is named by a nonempty string.');
599
+ return name;
600
+ }
601
+ const still = {
602
+ curve: { type: 'tween', duration: 0, ease: [linear], times: undefined },
603
+ delay: 0,
604
+ repeat: 0,
605
+ reverse: false,
606
+ };
607
+ /**
608
+ * A number that animates natively and drives the view properties bound to it.
609
+ *
610
+ * ```ts
611
+ * const progress = motionValue(0)
612
+ * bind(sheet, { y: progress.to([0, 1], [600, 0]) })
613
+ * animate(progress, 1, 'snappy')
614
+ * ```
615
+ */
616
+ export function motionValue(initial = 0) {
617
+ return new Root(initial);
618
+ }
619
+ export function isMotionValue(target) {
620
+ return target instanceof Root && !(target instanceof SpringRoot);
621
+ }
622
+ export function asRoot(value) {
623
+ return value;
624
+ }
625
+ /**
626
+ * Lets motion values drive a view's properties. The view takes their current values
627
+ * at once and follows every change on the same native clock. Returns a cleanup function.
628
+ *
629
+ * ```ts
630
+ * const release = bind(backdrop, { opacity: progress.to([0, 1], [0, 0.4]) })
631
+ * ```
632
+ */
633
+ export function bind(target, bindings) {
634
+ if (!bindings || typeof bindings !== 'object' || Array.isArray(bindings))
635
+ throw new TypeError('bind() takes an object of motion values.');
636
+ const views = toViews(target);
637
+ const entries = [];
638
+ for (const [key, source] of Object.entries(bindings)) {
639
+ if (source === undefined)
640
+ continue;
641
+ if (!(source instanceof Derived))
642
+ throw new TypeError(`"${key}" needs a motion value, got ${String(source)}.`);
643
+ const properties = key === 'scale' ? ['scaleX', 'scaleY'] : isProperty(key) ? [key] : [];
644
+ if (!properties.length)
645
+ throw new Error(`Can't bind "${key}".`);
646
+ for (const property of properties) {
647
+ if (source.root instanceof SpringRoot) {
648
+ if (source.root.disposed)
649
+ throw new Error('Cannot bind a disposed spring value.');
650
+ if (isColorProperty(property) || isDecorationProperty(property))
651
+ throw new TypeError('Live spring bindings currently support numeric transforms and opacity.');
652
+ }
653
+ if (isColorProperty(property) !== source.color)
654
+ throw new TypeError(source.color
655
+ ? `"${key}" takes numbers; map the value to numbers.`
656
+ : `"${key}" is a color; map the value to colors with to(input, colors).`);
657
+ entries.push([property, source]);
658
+ }
659
+ }
660
+ for (const view of views)
661
+ for (const [property] of entries)
662
+ if (isColorProperty(property))
663
+ validateColorTarget(view, property);
664
+ else if (isDecorationProperty(property))
665
+ validateDecorationTarget(view, property);
666
+ const made = [];
667
+ try {
668
+ for (const view of views)
669
+ for (const [property, source] of entries)
670
+ made.push(attach(view, property, source));
671
+ }
672
+ catch (error) {
673
+ for (const cleanup of made.reverse())
674
+ cleanup();
675
+ throw error;
676
+ }
677
+ return () => made.forEach((release) => release());
678
+ }
679
+ function attach(view, property, source) {
680
+ const existing = bound.get(view)?.get(property);
681
+ if (existing)
682
+ release(existing);
683
+ const root = source.root;
684
+ if (root instanceof SpringRoot)
685
+ return attachSpring(view, property, source, root);
686
+ const binding = {
687
+ view,
688
+ property,
689
+ root,
690
+ source,
691
+ read: source.read,
692
+ sync() {
693
+ if (!view.isLoaded || !view.nativeViewProtected)
694
+ return;
695
+ if (!root.running) {
696
+ // A value at rest writes straight through, so scroll offsets cost one write per event.
697
+ binding.animation?.stop();
698
+ binding.animation = undefined;
699
+ stopBase(view, [property]);
700
+ const value = source.read(root.raw());
701
+ setBase(view, property, isDecorationProperty(property) ? clampDecoration(property, value) : value);
702
+ if (isColorProperty(property) || isDecorationProperty(property))
703
+ getDriver().sync?.(view);
704
+ return;
705
+ }
706
+ const animation = new ViewAnimation(view, [root.plan(binding)]);
707
+ // Native keyframe setup can take time, especially for a composite track on Android.
708
+ // Catch up after construction so each binding joins the source's current phase.
709
+ const elapsed = root.elapsed();
710
+ if (root.paused)
711
+ animation.pause();
712
+ if ((elapsed > 1 || root.paused) && animation.duration > 0)
713
+ animation.seekTime(elapsed);
714
+ binding.animation = animation;
715
+ },
716
+ };
717
+ let properties = bound.get(view);
718
+ if (!properties)
719
+ bound.set(view, (properties = new Map()));
720
+ properties.set(property, binding);
721
+ root.bindings.add(binding);
722
+ view.on('loaded', binding.sync);
723
+ try {
724
+ binding.sync();
725
+ }
726
+ catch (error) {
727
+ release(binding);
728
+ throw error;
729
+ }
730
+ return () => {
731
+ if (root.bindings.has(binding)) {
732
+ release(binding);
733
+ binding.animation?.stop();
734
+ }
735
+ };
736
+ }
737
+ function attachSpring(view, property, source, root) {
738
+ let native;
739
+ let releaseMix;
740
+ let releaseDemand;
741
+ const detach = () => {
742
+ if (!native)
743
+ return;
744
+ native.cancel();
745
+ releaseMix?.();
746
+ releaseMix = undefined;
747
+ native = undefined;
748
+ releaseDemand?.();
749
+ releaseDemand = undefined;
750
+ syncLiveSprings(view);
751
+ };
752
+ const binding = {
753
+ view,
754
+ property,
755
+ root,
756
+ source,
757
+ read: source.read,
758
+ sync() {
759
+ if (!view.isLoaded || !view.nativeViewProtected || root.disposed)
760
+ return;
761
+ detach();
762
+ stopBase(view, [property]);
763
+ native = root.node.bind(view, property, source.mappings);
764
+ const handle = native;
765
+ const retained = root.retainConsumer();
766
+ if (native !== handle || root.disposed) {
767
+ retained();
768
+ return;
769
+ }
770
+ releaseDemand = retained;
771
+ releaseMix = mixFor(view, property).attachLive({
772
+ read: () => handle.value(),
773
+ layers: (layers) => handle.layers(layers),
774
+ });
775
+ syncLiveSprings(view);
776
+ },
777
+ cleanup() {
778
+ view.off('unloaded', detach);
779
+ detach();
780
+ },
781
+ };
782
+ let properties = bound.get(view);
783
+ if (!properties)
784
+ bound.set(view, (properties = new Map()));
785
+ properties.set(property, binding);
786
+ root.bindings.add(binding);
787
+ view.on('loaded', binding.sync);
788
+ view.on('unloaded', detach);
789
+ try {
790
+ binding.sync();
791
+ }
792
+ catch (error) {
793
+ release(binding);
794
+ throw error;
795
+ }
796
+ return () => {
797
+ if (root.bindings.has(binding))
798
+ release(binding);
799
+ };
800
+ }
801
+ /** A read-only value on an existing finite animation's clock. No second animation or timer. */
802
+ export function playbackProgress(animation) {
803
+ const source = playbackSource(animation);
804
+ if (!Number.isFinite(source.read().duration))
805
+ throw new RangeError('Progress requires a finite animation.');
806
+ const root = new PlaybackValue(source);
807
+ return new Derived(root, (value) => value, false);
808
+ }
809
+ class PlaybackValue extends Root {
810
+ playback;
811
+ constructor(playback) {
812
+ super(0);
813
+ this.playback = playback;
814
+ const source = playback;
815
+ const off = source.subscribe(() => {
816
+ this.changed();
817
+ if (source.read().settled)
818
+ off();
819
+ });
820
+ if (source.read().settled)
821
+ off();
822
+ this.observers.changed(this.running);
823
+ }
824
+ raw() {
825
+ const state = this.playback.read();
826
+ return (state.position ??
827
+ (state.completed
828
+ ? 1
829
+ : state.duration > 0
830
+ ? Math.max(0, Math.min(1, state.time / state.duration))
831
+ : 0));
832
+ }
833
+ get running() {
834
+ const state = this.playback.read();
835
+ return state.ready && !state.settled && !state.paused && state.duration > 0;
836
+ }
837
+ get paused() {
838
+ return this.playback.read().paused;
839
+ }
840
+ captureTime() {
841
+ return () => this.playback.read().time;
842
+ }
843
+ elapsed() {
844
+ return this.playback.read().time;
845
+ }
846
+ plan(binding) {
847
+ const state = this.playback.read();
848
+ if (!state.ready || state.settled || state.duration === 0)
849
+ return {
850
+ property: binding.property,
851
+ keyframes: [],
852
+ transition: still,
853
+ track: () => instantTrack(binding.property, binding.read(this.raw())),
854
+ };
855
+ // Bypass timeScale: the source duration is already in platform playback milliseconds.
856
+ const duration = state.duration;
857
+ const at = (ms) => binding.read(Math.max(0, Math.min(1, ms / duration)));
858
+ const track = {
859
+ property: binding.property,
860
+ delay: 0,
861
+ duration,
862
+ repeat: 0,
863
+ reverse: false,
864
+ times: [0, 1],
865
+ values: [at(0), at(duration)],
866
+ to: at(duration),
867
+ end: duration,
868
+ arrival: duration,
869
+ valueAt: at,
870
+ velocityAt: (ms) => (at(ms + 0.5) - at(ms - 0.5)) * 1000,
871
+ };
872
+ // Piecewise/color derivations need intermediate samples, not only the two endpoints.
873
+ const steps = Math.max(1, Math.min(6000, Math.ceil((duration * 60) / 1000)));
874
+ const times = Array.from({ length: steps + 1 }, (_, i) => i / steps);
875
+ return {
876
+ property: binding.property,
877
+ keyframes: [],
878
+ transition: still,
879
+ track: () => reducedMotion() &&
880
+ binding.property !== 'opacity' &&
881
+ !isColorProperty(binding.property)
882
+ ? instantTrack(binding.property, at(duration))
883
+ : { ...track, times, values: times.map((time) => at(time * duration)) },
884
+ };
885
+ }
886
+ }
887
+ /** Internal compound-binding bridge. One raw snapshot per root keeps sibling mappings coherent. */
888
+ export function valueSource(source, color) {
889
+ if (!(source instanceof Derived) || source.color !== color)
890
+ throw new TypeError(`Gradient component needs a ${color ? 'color' : 'numeric'} Jolt value.`);
891
+ const { root, read } = source;
892
+ return {
893
+ identity: root,
894
+ read,
895
+ snapshot() {
896
+ return {
897
+ track: root.plan({ property: 'opacity', read: (value) => value })
898
+ .track(),
899
+ elapsed: root.elapsed(),
900
+ time: root.captureTime(),
901
+ running: root.running,
902
+ value: root.raw(),
903
+ };
904
+ },
905
+ subscribe(listener) {
906
+ root.listeners.add(listener);
907
+ return () => {
908
+ root.listeners.delete(listener);
909
+ };
910
+ },
911
+ };
912
+ }
913
+ /** Treat values as opaque identities in declarative option comparisons. */
914
+ export function isDerived(value) {
915
+ return value instanceof Derived;
916
+ }
917
+ /** Internal native-adapter bridge. Mappings are sampled at boundaries, never per frame. */
918
+ export function valuePlayback(source) {
919
+ if (!(source instanceof Derived) || source.color)
920
+ throw new TypeError('A native binding needs a numeric Jolt value.');
921
+ const { root, read } = source;
922
+ return {
923
+ snapshot() {
924
+ return {
925
+ track: root.plan({ property: 'opacity', read }).track(),
926
+ elapsed: root.elapsed(),
927
+ paused: root.paused,
928
+ running: root.running,
929
+ value: read(root.raw()),
930
+ };
931
+ },
932
+ subscribe(listener) {
933
+ root.listeners.add(listener);
934
+ return () => {
935
+ root.listeners.delete(listener);
936
+ };
937
+ },
938
+ };
939
+ }
940
+ function release(binding) {
941
+ binding.root.bindings.delete(binding);
942
+ binding.view.off('loaded', binding.sync);
943
+ const properties = bound.get(binding.view);
944
+ if (properties?.get(binding.property) === binding)
945
+ properties.delete(binding.property);
946
+ binding.cleanup?.();
947
+ }
948
+ /** A regular animation on a bound property takes it over; the value keeps its other bindings. */
949
+ export function detachBindings(view, properties) {
950
+ const map = bound.get(view);
951
+ if (!map)
952
+ return;
953
+ for (const property of properties) {
954
+ const binding = map.get(property);
955
+ if (binding)
956
+ release(binding);
957
+ }
958
+ }
959
+ /** Read existing binding topology without subscribing or constructing new tracks. */
960
+ export function inspectViewBindings(view) {
961
+ const describe = (source, depth = 0) => ({
962
+ identity: source.root,
963
+ kind: source.root instanceof SpringRoot ? 'live spring' : 'motion value',
964
+ value: source.root.raw(),
965
+ mappings: source.mappings.map((mapping) => ({
966
+ ...mapping,
967
+ input: [...mapping.input],
968
+ output: [...mapping.output],
969
+ })),
970
+ input: source.root instanceof SpringRoot && depth < 8
971
+ ? describe(source.root.input, depth + 1)
972
+ : undefined,
973
+ });
974
+ return [...(bound.get(view)?.values() ?? [])].map((binding) => ({
975
+ property: binding.property,
976
+ source: describe(binding.source ?? binding.root),
977
+ value: binding.read(binding.root.raw()),
978
+ }));
979
+ }
980
+ function mapping(input, output, options = {}) {
981
+ if (!Array.isArray(input) || !Array.isArray(output) || input.length < 2)
982
+ throw new RangeError('to() needs at least two input and output values.');
983
+ if (input.length !== output.length)
984
+ throw new RangeError(`to() has ${input.length} inputs but ${output.length} outputs; give one output per input.`);
985
+ if (input.some((value) => !Number.isFinite(value)))
986
+ throw new RangeError('to() inputs must all be finite numbers.');
987
+ const descending = input[input.length - 1] < input[0];
988
+ if (input.some((value, i) => i > 0 && (descending ? value > input[i - 1] : value < input[i - 1])))
989
+ throw new RangeError('to() inputs must be monotonic (ascending or descending); ranges cannot change direction.');
990
+ // Normalize pairs together, without changing caller-owned arrays or duplicate-stop rules.
991
+ if (descending) {
992
+ input = [...input].reverse();
993
+ output = [...output].reverse();
994
+ }
995
+ const color = typeof output[0] !== 'number';
996
+ const numbers = color ? output.map((value) => parseColor(value)) : output;
997
+ if (!color &&
998
+ numbers.some((value) => typeof value !== 'number' || !Number.isFinite(value)))
999
+ throw new RangeError('to() outputs must all be finite numbers, or all colors.');
1000
+ const mixers = color
1001
+ ? numbers.slice(1).map((value, i) => colorMixer(numbers[i], value))
1002
+ : undefined;
1003
+ const clamp = color || options.clamp !== false;
1004
+ const last = input.length - 1;
1005
+ const read = (value) => {
1006
+ if (clamp && value <= input[0])
1007
+ return numbers[0];
1008
+ if (clamp && value >= input[last])
1009
+ return numbers[last];
1010
+ let i = 0;
1011
+ while (i < last - 1 && value > input[i + 1])
1012
+ i++;
1013
+ const span = input[i + 1] - input[i];
1014
+ const t = span > 0 ? (value - input[i]) / span : value < input[i] ? 0 : 1;
1015
+ if (mixers)
1016
+ return mixers[i](Math.min(1, Math.max(0, t)));
1017
+ return numbers[i] + (numbers[i + 1] - numbers[i]) * t;
1018
+ };
1019
+ return { read, color, input, numbers };
1020
+ }
1021
+ function springOf(name) {
1022
+ if (!Object.hasOwn(springs, name))
1023
+ throw new Error(`Unknown spring "${name}".`);
1024
+ return springs[name];
1025
+ }
1026
+ /**
1027
+ * The scroll offset of a ScrollView, in DIPs, as a value that bindings follow.
1028
+ *
1029
+ * ```ts
1030
+ * const offset = scrollValue(scroll)
1031
+ * bind(header, { y: offset.to([0, 120], [0, -60]), opacity: offset.to([0, 80], [1, 0]) })
1032
+ * ```
1033
+ */
1034
+ export function scrollValue(scrollView, options = {}) {
1035
+ const axis = options.axis ?? 'y';
1036
+ if (axis !== 'x' && axis !== 'y')
1037
+ throw new TypeError('Scroll axis must be "x" or "y".');
1038
+ const root = new Root(0);
1039
+ let source;
1040
+ const read = () => {
1041
+ if (!source)
1042
+ return;
1043
+ const offset = axis === 'x' ? source.horizontalOffset : source.verticalOffset;
1044
+ if (Number.isFinite(offset) && offset !== root.raw())
1045
+ root.set(offset);
1046
+ };
1047
+ const onScroll = (event) => {
1048
+ const { scrollX, scrollY } = event;
1049
+ const offset = axis === 'x' ? scrollX : scrollY;
1050
+ if (Number.isFinite(offset) && offset !== root.raw())
1051
+ root.set(offset);
1052
+ };
1053
+ const detach = () => {
1054
+ source?.off(ScrollView.scrollEvent, onScroll);
1055
+ source?.off('loaded', read);
1056
+ source = undefined;
1057
+ };
1058
+ const ref = (target) => {
1059
+ const next = target === null ? undefined : toViews(target)[0];
1060
+ if (next === source)
1061
+ return;
1062
+ if (next !== undefined && !(next instanceof ScrollView))
1063
+ throw new TypeError('scrollValue() follows a NativeScript ScrollView.');
1064
+ detach();
1065
+ source = next;
1066
+ source?.on(ScrollView.scrollEvent, onScroll);
1067
+ source?.on('loaded', read);
1068
+ read();
1069
+ };
1070
+ if (scrollView)
1071
+ ref(scrollView);
1072
+ return Object.assign(root, { ref, dispose: detach });
1073
+ }
1074
+ //# sourceMappingURL=motion-value.js.map