@wardic/solid 0.0.0-stage → 1.0.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 (994) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -2
  3. package/THIRD_PARTY_NOTICES.md +145 -0
  4. package/dist/browser/animation-controls.js +150 -0
  5. package/dist/browser/animation-controls.js.map +1 -0
  6. package/dist/browser/animation-frame.js +29 -0
  7. package/dist/browser/animation-frame.js.map +1 -0
  8. package/dist/browser/appear.js +727 -0
  9. package/dist/browser/appear.js.map +1 -0
  10. package/dist/browser/arc.js +21 -0
  11. package/dist/browser/arc.js.map +1 -0
  12. package/dist/browser/bridge.js +69 -0
  13. package/dist/browser/bridge.js.map +1 -0
  14. package/dist/browser/complete.js +30 -0
  15. package/dist/browser/complete.js.map +1 -0
  16. package/dist/browser/config.js +2 -0
  17. package/dist/browser/config.js.map +1 -0
  18. package/dist/browser/create-animate.js +41 -0
  19. package/dist/browser/create-animate.js.map +1 -0
  20. package/dist/browser/create-ward.js +1001 -0
  21. package/dist/browser/create-ward.js.map +1 -0
  22. package/dist/browser/cycle-index.js +17 -0
  23. package/dist/browser/cycle-index.js.map +1 -0
  24. package/dist/browser/cycle.js +31 -0
  25. package/dist/browser/cycle.js.map +1 -0
  26. package/dist/browser/directive.js +80 -0
  27. package/dist/browser/directive.js.map +1 -0
  28. package/dist/browser/drag-constraints.js +76 -0
  29. package/dist/browser/drag-constraints.js.map +1 -0
  30. package/dist/browser/drag-controls.js +51 -0
  31. package/dist/browser/drag-controls.js.map +1 -0
  32. package/dist/browser/drag-samples.js +40 -0
  33. package/dist/browser/drag-samples.js.map +1 -0
  34. package/dist/browser/drag-sensor.js +35 -0
  35. package/dist/browser/drag-sensor.js.map +1 -0
  36. package/dist/browser/drag-track.js +817 -0
  37. package/dist/browser/drag-track.js.map +1 -0
  38. package/dist/browser/drag-transition.js +56 -0
  39. package/dist/browser/drag-transition.js.map +1 -0
  40. package/dist/browser/drag.js +44 -0
  41. package/dist/browser/drag.js.map +1 -0
  42. package/dist/browser/element-style.js +67 -0
  43. package/dist/browser/element-style.js.map +1 -0
  44. package/dist/browser/element.js +353 -0
  45. package/dist/browser/element.js.map +1 -0
  46. package/dist/browser/feature-section.js +17 -0
  47. package/dist/browser/feature-section.js.map +1 -0
  48. package/dist/browser/feature.js +261 -0
  49. package/dist/browser/feature.js.map +1 -0
  50. package/dist/browser/features/all.js +10 -0
  51. package/dist/browser/features/all.js.map +1 -0
  52. package/dist/browser/features/colors.js +33 -0
  53. package/dist/browser/features/colors.js.map +1 -0
  54. package/dist/browser/features/dom-animation.js +7 -0
  55. package/dist/browser/features/dom-animation.js.map +1 -0
  56. package/dist/browser/features/dom-max.js +4 -0
  57. package/dist/browser/features/dom-max.js.map +1 -0
  58. package/dist/browser/features/drag.js +28 -0
  59. package/dist/browser/features/drag.js.map +1 -0
  60. package/dist/browser/features/focus.js +18 -0
  61. package/dist/browser/features/focus.js.map +1 -0
  62. package/dist/browser/features/hover.js +18 -0
  63. package/dist/browser/features/hover.js.map +1 -0
  64. package/dist/browser/features/in-view.js +18 -0
  65. package/dist/browser/features/in-view.js.map +1 -0
  66. package/dist/browser/features/input.js +30 -0
  67. package/dist/browser/features/input.js.map +1 -0
  68. package/dist/browser/features/keys.js +19 -0
  69. package/dist/browser/features/keys.js.map +1 -0
  70. package/dist/browser/features/layout.js +33 -0
  71. package/dist/browser/features/layout.js.map +1 -0
  72. package/dist/browser/features/pan.js +18 -0
  73. package/dist/browser/features/pan.js.map +1 -0
  74. package/dist/browser/features/press.js +12 -0
  75. package/dist/browser/features/press.js.map +1 -0
  76. package/dist/browser/focus-sensor.js +23 -0
  77. package/dist/browser/focus-sensor.js.map +1 -0
  78. package/dist/browser/frame-time.js +40 -0
  79. package/dist/browser/frame-time.js.map +1 -0
  80. package/dist/browser/gesture-callbacks.js +172 -0
  81. package/dist/browser/gesture-callbacks.js.map +1 -0
  82. package/dist/browser/gesture-features.js +29 -0
  83. package/dist/browser/gesture-features.js.map +1 -0
  84. package/dist/browser/gesture-info.js +43 -0
  85. package/dist/browser/gesture-info.js.map +1 -0
  86. package/dist/browser/hover-sensor.js +29 -0
  87. package/dist/browser/hover-sensor.js.map +1 -0
  88. package/dist/browser/imperative.js +614 -0
  89. package/dist/browser/imperative.js.map +1 -0
  90. package/dist/browser/index.js +165 -0
  91. package/dist/browser/index.js.map +1 -0
  92. package/dist/browser/instant.js +51 -0
  93. package/dist/browser/instant.js.map +1 -0
  94. package/dist/browser/layout-group.js +27 -0
  95. package/dist/browser/layout-group.js.map +1 -0
  96. package/dist/browser/layout-member.js +362 -0
  97. package/dist/browser/layout-member.js.map +1 -0
  98. package/dist/browser/layout-projection.js +19 -0
  99. package/dist/browser/layout-projection.js.map +1 -0
  100. package/dist/browser/layout.js +91 -0
  101. package/dist/browser/layout.js.map +1 -0
  102. package/dist/browser/live-style.js +313 -0
  103. package/dist/browser/live-style.js.map +1 -0
  104. package/dist/browser/live-value.js +252 -0
  105. package/dist/browser/live-value.js.map +1 -0
  106. package/dist/browser/motion-props.js +172 -0
  107. package/dist/browser/motion-props.js.map +1 -0
  108. package/dist/browser/owner-scope.js +29 -0
  109. package/dist/browser/owner-scope.js.map +1 -0
  110. package/dist/browser/page-point.js +92 -0
  111. package/dist/browser/page-point.js.map +1 -0
  112. package/dist/browser/presence-controller.js +1324 -0
  113. package/dist/browser/presence-controller.js.map +1 -0
  114. package/dist/browser/presence-record.js +27 -0
  115. package/dist/browser/presence-record.js.map +1 -0
  116. package/dist/browser/presence.js +207 -0
  117. package/dist/browser/presence.js.map +1 -0
  118. package/dist/browser/press-sensor.js +30 -0
  119. package/dist/browser/press-sensor.js.map +1 -0
  120. package/dist/browser/press.js +24 -0
  121. package/dist/browser/press.js.map +1 -0
  122. package/dist/browser/provider.js +445 -0
  123. package/dist/browser/provider.js.map +1 -0
  124. package/dist/browser/reactivity.js +9 -0
  125. package/dist/browser/reactivity.js.map +1 -0
  126. package/dist/browser/reorder-input.js +46 -0
  127. package/dist/browser/reorder-input.js.map +1 -0
  128. package/dist/browser/reorder.js +543 -0
  129. package/dist/browser/reorder.js.map +1 -0
  130. package/dist/browser/retarget-legs.js +1019 -0
  131. package/dist/browser/retarget-legs.js.map +1 -0
  132. package/dist/browser/runtime.js +249 -0
  133. package/dist/browser/runtime.js.map +1 -0
  134. package/dist/browser/sensors.js +172 -0
  135. package/dist/browser/sensors.js.map +1 -0
  136. package/dist/browser/server-interpolators.js +20 -0
  137. package/dist/browser/server-interpolators.js.map +1 -0
  138. package/dist/browser/server.js +20 -0
  139. package/dist/browser/server.js.map +1 -0
  140. package/dist/browser/solid-reactivity.js +26 -0
  141. package/dist/browser/solid-reactivity.js.map +1 -0
  142. package/dist/browser/spine.js +2939 -0
  143. package/dist/browser/spine.js.map +1 -0
  144. package/dist/browser/stagger.js +13 -0
  145. package/dist/browser/stagger.js.map +1 -0
  146. package/dist/browser/unstable/v2/bridge.js +76 -0
  147. package/dist/browser/unstable/v2/bridge.js.map +1 -0
  148. package/dist/browser/unstable/v2/complete.js +29 -0
  149. package/dist/browser/unstable/v2/complete.js.map +1 -0
  150. package/dist/browser/unstable/v2/config-view.js +111 -0
  151. package/dist/browser/unstable/v2/config-view.js.map +1 -0
  152. package/dist/browser/unstable/v2/create-animate.js +102 -0
  153. package/dist/browser/unstable/v2/create-animate.js.map +1 -0
  154. package/dist/browser/unstable/v2/cycle.js +30 -0
  155. package/dist/browser/unstable/v2/cycle.js.map +1 -0
  156. package/dist/browser/unstable/v2/drag-sensor.js +34 -0
  157. package/dist/browser/unstable/v2/drag-sensor.js.map +1 -0
  158. package/dist/browser/unstable/v2/element.js +393 -0
  159. package/dist/browser/unstable/v2/element.js.map +1 -0
  160. package/dist/browser/unstable/v2/feature-section.js +27 -0
  161. package/dist/browser/unstable/v2/feature-section.js.map +1 -0
  162. package/dist/browser/unstable/v2/focus-sensor.js +23 -0
  163. package/dist/browser/unstable/v2/focus-sensor.js.map +1 -0
  164. package/dist/browser/unstable/v2/hover-sensor.js +28 -0
  165. package/dist/browser/unstable/v2/hover-sensor.js.map +1 -0
  166. package/dist/browser/unstable/v2/index.js +114 -0
  167. package/dist/browser/unstable/v2/index.js.map +1 -0
  168. package/dist/browser/unstable/v2/layout-projection.js +18 -0
  169. package/dist/browser/unstable/v2/layout-projection.js.map +1 -0
  170. package/dist/browser/unstable/v2/layout.js +71 -0
  171. package/dist/browser/unstable/v2/layout.js.map +1 -0
  172. package/dist/browser/unstable/v2/lifecycle.js +455 -0
  173. package/dist/browser/unstable/v2/lifecycle.js.map +1 -0
  174. package/dist/browser/unstable/v2/live-value.js +264 -0
  175. package/dist/browser/unstable/v2/live-value.js.map +1 -0
  176. package/dist/browser/unstable/v2/presence-handle.js +146 -0
  177. package/dist/browser/unstable/v2/presence-handle.js.map +1 -0
  178. package/dist/browser/unstable/v2/presence-hooks.js +142 -0
  179. package/dist/browser/unstable/v2/presence-hooks.js.map +1 -0
  180. package/dist/browser/unstable/v2/presence.js +124 -0
  181. package/dist/browser/unstable/v2/presence.js.map +1 -0
  182. package/dist/browser/unstable/v2/press-sensor.js +29 -0
  183. package/dist/browser/unstable/v2/press-sensor.js.map +1 -0
  184. package/dist/browser/unstable/v2/provider.js +457 -0
  185. package/dist/browser/unstable/v2/provider.js.map +1 -0
  186. package/dist/browser/unstable/v2/reorder.js +663 -0
  187. package/dist/browser/unstable/v2/reorder.js.map +1 -0
  188. package/dist/browser/unstable/v2/sensors.js +138 -0
  189. package/dist/browser/unstable/v2/sensors.js.map +1 -0
  190. package/dist/browser/unstable/v2/solid-reactivity.js +82 -0
  191. package/dist/browser/unstable/v2/solid-reactivity.js.map +1 -0
  192. package/dist/browser/unstable/v2/variant-node.js +395 -0
  193. package/dist/browser/unstable/v2/variant-node.js.map +1 -0
  194. package/dist/browser/unstable/v2/w.js +23 -0
  195. package/dist/browser/unstable/v2/w.js.map +1 -0
  196. package/dist/browser/unstable/v2/waiters.js +185 -0
  197. package/dist/browser/unstable/v2/waiters.js.map +1 -0
  198. package/dist/browser/unstable/v2/ward.js +1620 -0
  199. package/dist/browser/unstable/v2/ward.js.map +1 -0
  200. package/dist/browser/unstable/v2/wardic-config.js +40 -0
  201. package/dist/browser/unstable/v2/wardic-config.js.map +1 -0
  202. package/dist/browser/unstable/v2/wardic.js +16 -0
  203. package/dist/browser/unstable/v2/wardic.js.map +1 -0
  204. package/dist/browser/variant-node.js +308 -0
  205. package/dist/browser/variant-node.js.map +1 -0
  206. package/dist/browser/variant-target.js +224 -0
  207. package/dist/browser/variant-target.js.map +1 -0
  208. package/dist/browser/variant-tree.js +394 -0
  209. package/dist/browser/variant-tree.js.map +1 -0
  210. package/dist/browser/variants.js +43 -0
  211. package/dist/browser/variants.js.map +1 -0
  212. package/dist/browser/w.js +25 -0
  213. package/dist/browser/w.js.map +1 -0
  214. package/dist/browser/ward-keys.js +2 -0
  215. package/dist/browser/ward-keys.js.map +1 -0
  216. package/dist/browser/wardic-component.js +74 -0
  217. package/dist/browser/wardic-component.js.map +1 -0
  218. package/dist/browser/wardic-config-value.js +91 -0
  219. package/dist/browser/wardic-config-value.js.map +1 -0
  220. package/dist/browser/wardic-config.js +42 -0
  221. package/dist/browser/wardic-config.js.map +1 -0
  222. package/dist/browser/wardic.js +31 -0
  223. package/dist/browser/wardic.js.map +1 -0
  224. package/dist/server/animation-controls.js +150 -0
  225. package/dist/server/animation-controls.js.map +1 -0
  226. package/dist/server/animation-frame.js +29 -0
  227. package/dist/server/animation-frame.js.map +1 -0
  228. package/dist/server/appear.js +727 -0
  229. package/dist/server/appear.js.map +1 -0
  230. package/dist/server/arc.js +21 -0
  231. package/dist/server/arc.js.map +1 -0
  232. package/dist/server/bridge.js +69 -0
  233. package/dist/server/bridge.js.map +1 -0
  234. package/dist/server/complete.js +30 -0
  235. package/dist/server/complete.js.map +1 -0
  236. package/dist/server/config.js +2 -0
  237. package/dist/server/config.js.map +1 -0
  238. package/dist/server/create-animate.js +41 -0
  239. package/dist/server/create-animate.js.map +1 -0
  240. package/dist/server/create-ward.js +1001 -0
  241. package/dist/server/create-ward.js.map +1 -0
  242. package/dist/server/cycle-index.js +17 -0
  243. package/dist/server/cycle-index.js.map +1 -0
  244. package/dist/server/cycle.js +31 -0
  245. package/dist/server/cycle.js.map +1 -0
  246. package/dist/server/directive.js +80 -0
  247. package/dist/server/directive.js.map +1 -0
  248. package/dist/server/drag-constraints.js +76 -0
  249. package/dist/server/drag-constraints.js.map +1 -0
  250. package/dist/server/drag-controls.js +51 -0
  251. package/dist/server/drag-controls.js.map +1 -0
  252. package/dist/server/drag-samples.js +40 -0
  253. package/dist/server/drag-samples.js.map +1 -0
  254. package/dist/server/drag-sensor.js +35 -0
  255. package/dist/server/drag-sensor.js.map +1 -0
  256. package/dist/server/drag-track.js +817 -0
  257. package/dist/server/drag-track.js.map +1 -0
  258. package/dist/server/drag-transition.js +56 -0
  259. package/dist/server/drag-transition.js.map +1 -0
  260. package/dist/server/drag.js +44 -0
  261. package/dist/server/drag.js.map +1 -0
  262. package/dist/server/element-style.js +67 -0
  263. package/dist/server/element-style.js.map +1 -0
  264. package/dist/server/element.js +353 -0
  265. package/dist/server/element.js.map +1 -0
  266. package/dist/server/feature-section.js +17 -0
  267. package/dist/server/feature-section.js.map +1 -0
  268. package/dist/server/feature.js +261 -0
  269. package/dist/server/feature.js.map +1 -0
  270. package/dist/server/features/all.js +10 -0
  271. package/dist/server/features/all.js.map +1 -0
  272. package/dist/server/features/colors.js +33 -0
  273. package/dist/server/features/colors.js.map +1 -0
  274. package/dist/server/features/dom-animation.js +7 -0
  275. package/dist/server/features/dom-animation.js.map +1 -0
  276. package/dist/server/features/dom-max.js +4 -0
  277. package/dist/server/features/dom-max.js.map +1 -0
  278. package/dist/server/features/drag.js +28 -0
  279. package/dist/server/features/drag.js.map +1 -0
  280. package/dist/server/features/focus.js +18 -0
  281. package/dist/server/features/focus.js.map +1 -0
  282. package/dist/server/features/hover.js +18 -0
  283. package/dist/server/features/hover.js.map +1 -0
  284. package/dist/server/features/in-view.js +18 -0
  285. package/dist/server/features/in-view.js.map +1 -0
  286. package/dist/server/features/input.js +30 -0
  287. package/dist/server/features/input.js.map +1 -0
  288. package/dist/server/features/keys.js +19 -0
  289. package/dist/server/features/keys.js.map +1 -0
  290. package/dist/server/features/layout.js +33 -0
  291. package/dist/server/features/layout.js.map +1 -0
  292. package/dist/server/features/pan.js +18 -0
  293. package/dist/server/features/pan.js.map +1 -0
  294. package/dist/server/features/press.js +12 -0
  295. package/dist/server/features/press.js.map +1 -0
  296. package/dist/server/focus-sensor.js +23 -0
  297. package/dist/server/focus-sensor.js.map +1 -0
  298. package/dist/server/frame-time.js +40 -0
  299. package/dist/server/frame-time.js.map +1 -0
  300. package/dist/server/gesture-callbacks.js +172 -0
  301. package/dist/server/gesture-callbacks.js.map +1 -0
  302. package/dist/server/gesture-features.js +29 -0
  303. package/dist/server/gesture-features.js.map +1 -0
  304. package/dist/server/gesture-info.js +43 -0
  305. package/dist/server/gesture-info.js.map +1 -0
  306. package/dist/server/hover-sensor.js +29 -0
  307. package/dist/server/hover-sensor.js.map +1 -0
  308. package/dist/server/imperative.js +614 -0
  309. package/dist/server/imperative.js.map +1 -0
  310. package/dist/server/index.js +165 -0
  311. package/dist/server/index.js.map +1 -0
  312. package/dist/server/instant.js +51 -0
  313. package/dist/server/instant.js.map +1 -0
  314. package/dist/server/layout-group.js +27 -0
  315. package/dist/server/layout-group.js.map +1 -0
  316. package/dist/server/layout-member.js +362 -0
  317. package/dist/server/layout-member.js.map +1 -0
  318. package/dist/server/layout-projection.js +19 -0
  319. package/dist/server/layout-projection.js.map +1 -0
  320. package/dist/server/layout.js +90 -0
  321. package/dist/server/layout.js.map +1 -0
  322. package/dist/server/live-style.js +313 -0
  323. package/dist/server/live-style.js.map +1 -0
  324. package/dist/server/live-value.js +252 -0
  325. package/dist/server/live-value.js.map +1 -0
  326. package/dist/server/motion-props.js +172 -0
  327. package/dist/server/motion-props.js.map +1 -0
  328. package/dist/server/owner-scope.js +29 -0
  329. package/dist/server/owner-scope.js.map +1 -0
  330. package/dist/server/page-point.js +92 -0
  331. package/dist/server/page-point.js.map +1 -0
  332. package/dist/server/presence-controller.js +1324 -0
  333. package/dist/server/presence-controller.js.map +1 -0
  334. package/dist/server/presence-record.js +27 -0
  335. package/dist/server/presence-record.js.map +1 -0
  336. package/dist/server/presence.js +207 -0
  337. package/dist/server/presence.js.map +1 -0
  338. package/dist/server/press-sensor.js +30 -0
  339. package/dist/server/press-sensor.js.map +1 -0
  340. package/dist/server/press.js +24 -0
  341. package/dist/server/press.js.map +1 -0
  342. package/dist/server/provider.js +439 -0
  343. package/dist/server/provider.js.map +1 -0
  344. package/dist/server/reactivity.js +9 -0
  345. package/dist/server/reactivity.js.map +1 -0
  346. package/dist/server/reorder-input.js +46 -0
  347. package/dist/server/reorder-input.js.map +1 -0
  348. package/dist/server/reorder.js +543 -0
  349. package/dist/server/reorder.js.map +1 -0
  350. package/dist/server/retarget-legs.js +1019 -0
  351. package/dist/server/retarget-legs.js.map +1 -0
  352. package/dist/server/runtime.js +249 -0
  353. package/dist/server/runtime.js.map +1 -0
  354. package/dist/server/sensors.js +172 -0
  355. package/dist/server/sensors.js.map +1 -0
  356. package/dist/server/server-interpolators.js +20 -0
  357. package/dist/server/server-interpolators.js.map +1 -0
  358. package/dist/server/server.js +20 -0
  359. package/dist/server/server.js.map +1 -0
  360. package/dist/server/solid-reactivity.js +26 -0
  361. package/dist/server/solid-reactivity.js.map +1 -0
  362. package/dist/server/spine.js +2939 -0
  363. package/dist/server/spine.js.map +1 -0
  364. package/dist/server/stagger.js +13 -0
  365. package/dist/server/stagger.js.map +1 -0
  366. package/dist/server/unstable/v2/bridge.js +76 -0
  367. package/dist/server/unstable/v2/bridge.js.map +1 -0
  368. package/dist/server/unstable/v2/complete.js +29 -0
  369. package/dist/server/unstable/v2/complete.js.map +1 -0
  370. package/dist/server/unstable/v2/config-view.js +111 -0
  371. package/dist/server/unstable/v2/config-view.js.map +1 -0
  372. package/dist/server/unstable/v2/create-animate.js +102 -0
  373. package/dist/server/unstable/v2/create-animate.js.map +1 -0
  374. package/dist/server/unstable/v2/cycle.js +30 -0
  375. package/dist/server/unstable/v2/cycle.js.map +1 -0
  376. package/dist/server/unstable/v2/drag-sensor.js +34 -0
  377. package/dist/server/unstable/v2/drag-sensor.js.map +1 -0
  378. package/dist/server/unstable/v2/element.js +402 -0
  379. package/dist/server/unstable/v2/element.js.map +1 -0
  380. package/dist/server/unstable/v2/feature-section.js +27 -0
  381. package/dist/server/unstable/v2/feature-section.js.map +1 -0
  382. package/dist/server/unstable/v2/focus-sensor.js +23 -0
  383. package/dist/server/unstable/v2/focus-sensor.js.map +1 -0
  384. package/dist/server/unstable/v2/hover-sensor.js +28 -0
  385. package/dist/server/unstable/v2/hover-sensor.js.map +1 -0
  386. package/dist/server/unstable/v2/index.js +114 -0
  387. package/dist/server/unstable/v2/index.js.map +1 -0
  388. package/dist/server/unstable/v2/layout-projection.js +18 -0
  389. package/dist/server/unstable/v2/layout-projection.js.map +1 -0
  390. package/dist/server/unstable/v2/layout.js +88 -0
  391. package/dist/server/unstable/v2/layout.js.map +1 -0
  392. package/dist/server/unstable/v2/lifecycle.js +455 -0
  393. package/dist/server/unstable/v2/lifecycle.js.map +1 -0
  394. package/dist/server/unstable/v2/live-value.js +264 -0
  395. package/dist/server/unstable/v2/live-value.js.map +1 -0
  396. package/dist/server/unstable/v2/presence-handle.js +146 -0
  397. package/dist/server/unstable/v2/presence-handle.js.map +1 -0
  398. package/dist/server/unstable/v2/presence-hooks.js +142 -0
  399. package/dist/server/unstable/v2/presence-hooks.js.map +1 -0
  400. package/dist/server/unstable/v2/presence.js +142 -0
  401. package/dist/server/unstable/v2/presence.js.map +1 -0
  402. package/dist/server/unstable/v2/press-sensor.js +29 -0
  403. package/dist/server/unstable/v2/press-sensor.js.map +1 -0
  404. package/dist/server/unstable/v2/provider.js +475 -0
  405. package/dist/server/unstable/v2/provider.js.map +1 -0
  406. package/dist/server/unstable/v2/reorder.js +733 -0
  407. package/dist/server/unstable/v2/reorder.js.map +1 -0
  408. package/dist/server/unstable/v2/sensors.js +138 -0
  409. package/dist/server/unstable/v2/sensors.js.map +1 -0
  410. package/dist/server/unstable/v2/solid-reactivity.js +82 -0
  411. package/dist/server/unstable/v2/solid-reactivity.js.map +1 -0
  412. package/dist/server/unstable/v2/variant-node.js +395 -0
  413. package/dist/server/unstable/v2/variant-node.js.map +1 -0
  414. package/dist/server/unstable/v2/w.js +23 -0
  415. package/dist/server/unstable/v2/w.js.map +1 -0
  416. package/dist/server/unstable/v2/waiters.js +185 -0
  417. package/dist/server/unstable/v2/waiters.js.map +1 -0
  418. package/dist/server/unstable/v2/ward.js +1653 -0
  419. package/dist/server/unstable/v2/ward.js.map +1 -0
  420. package/dist/server/unstable/v2/wardic-config.js +49 -0
  421. package/dist/server/unstable/v2/wardic-config.js.map +1 -0
  422. package/dist/server/unstable/v2/wardic.js +16 -0
  423. package/dist/server/unstable/v2/wardic.js.map +1 -0
  424. package/dist/server/variant-node.js +308 -0
  425. package/dist/server/variant-node.js.map +1 -0
  426. package/dist/server/variant-target.js +224 -0
  427. package/dist/server/variant-target.js.map +1 -0
  428. package/dist/server/variant-tree.js +394 -0
  429. package/dist/server/variant-tree.js.map +1 -0
  430. package/dist/server/variants.js +43 -0
  431. package/dist/server/variants.js.map +1 -0
  432. package/dist/server/w.js +25 -0
  433. package/dist/server/w.js.map +1 -0
  434. package/dist/server/ward-keys.js +2 -0
  435. package/dist/server/ward-keys.js.map +1 -0
  436. package/dist/server/wardic-component.js +74 -0
  437. package/dist/server/wardic-component.js.map +1 -0
  438. package/dist/server/wardic-config-value.js +91 -0
  439. package/dist/server/wardic-config-value.js.map +1 -0
  440. package/dist/server/wardic-config.js +42 -0
  441. package/dist/server/wardic-config.js.map +1 -0
  442. package/dist/server/wardic.js +31 -0
  443. package/dist/server/wardic.js.map +1 -0
  444. package/dist/solid/animation-controls.d.ts +104 -0
  445. package/dist/solid/animation-controls.d.ts.map +1 -0
  446. package/dist/solid/animation-controls.js +129 -0
  447. package/dist/solid/animation-controls.js.map +1 -0
  448. package/dist/solid/animation-frame.d.ts +11 -0
  449. package/dist/solid/animation-frame.d.ts.map +1 -0
  450. package/dist/solid/animation-frame.js +31 -0
  451. package/dist/solid/animation-frame.js.map +1 -0
  452. package/dist/solid/appear.d.ts +205 -0
  453. package/dist/solid/appear.d.ts.map +1 -0
  454. package/dist/solid/appear.js +519 -0
  455. package/dist/solid/appear.js.map +1 -0
  456. package/dist/solid/arc.d.ts +25 -0
  457. package/dist/solid/arc.d.ts.map +1 -0
  458. package/dist/solid/arc.js +21 -0
  459. package/dist/solid/arc.js.map +1 -0
  460. package/dist/solid/bridge.d.ts +53 -0
  461. package/dist/solid/bridge.d.ts.map +1 -0
  462. package/dist/solid/bridge.js +66 -0
  463. package/dist/solid/bridge.js.map +1 -0
  464. package/dist/solid/complete.d.ts +31 -0
  465. package/dist/solid/complete.d.ts.map +1 -0
  466. package/dist/solid/complete.js +27 -0
  467. package/dist/solid/complete.js.map +1 -0
  468. package/dist/solid/config.d.ts +693 -0
  469. package/dist/solid/config.d.ts.map +1 -0
  470. package/dist/solid/config.js +2 -0
  471. package/dist/solid/config.js.map +1 -0
  472. package/dist/solid/create-animate.d.ts +17 -0
  473. package/dist/solid/create-animate.d.ts.map +1 -0
  474. package/dist/solid/create-animate.js +42 -0
  475. package/dist/solid/create-animate.js.map +1 -0
  476. package/dist/solid/create-ward.d.ts +278 -0
  477. package/dist/solid/create-ward.d.ts.map +1 -0
  478. package/dist/solid/create-ward.jsx +874 -0
  479. package/dist/solid/create-ward.jsx.map +1 -0
  480. package/dist/solid/cycle-index.d.ts +7 -0
  481. package/dist/solid/cycle-index.d.ts.map +1 -0
  482. package/dist/solid/cycle-index.js +17 -0
  483. package/dist/solid/cycle-index.js.map +1 -0
  484. package/dist/solid/cycle.d.ts +21 -0
  485. package/dist/solid/cycle.d.ts.map +1 -0
  486. package/dist/solid/cycle.js +31 -0
  487. package/dist/solid/cycle.js.map +1 -0
  488. package/dist/solid/directive.d.ts +21 -0
  489. package/dist/solid/directive.d.ts.map +1 -0
  490. package/dist/solid/directive.js +76 -0
  491. package/dist/solid/directive.js.map +1 -0
  492. package/dist/solid/drag-constraints.d.ts +46 -0
  493. package/dist/solid/drag-constraints.d.ts.map +1 -0
  494. package/dist/solid/drag-constraints.js +49 -0
  495. package/dist/solid/drag-constraints.js.map +1 -0
  496. package/dist/solid/drag-controls.d.ts +50 -0
  497. package/dist/solid/drag-controls.d.ts.map +1 -0
  498. package/dist/solid/drag-controls.js +51 -0
  499. package/dist/solid/drag-controls.js.map +1 -0
  500. package/dist/solid/drag-samples.d.ts +34 -0
  501. package/dist/solid/drag-samples.d.ts.map +1 -0
  502. package/dist/solid/drag-samples.js +28 -0
  503. package/dist/solid/drag-samples.js.map +1 -0
  504. package/dist/solid/drag-sensor.d.ts +23 -0
  505. package/dist/solid/drag-sensor.d.ts.map +1 -0
  506. package/dist/solid/drag-sensor.js +33 -0
  507. package/dist/solid/drag-sensor.js.map +1 -0
  508. package/dist/solid/drag-track.d.ts +227 -0
  509. package/dist/solid/drag-track.d.ts.map +1 -0
  510. package/dist/solid/drag-track.js +631 -0
  511. package/dist/solid/drag-track.js.map +1 -0
  512. package/dist/solid/drag-transition.d.ts +20 -0
  513. package/dist/solid/drag-transition.d.ts.map +1 -0
  514. package/dist/solid/drag-transition.js +31 -0
  515. package/dist/solid/drag-transition.js.map +1 -0
  516. package/dist/solid/drag.d.ts +23 -0
  517. package/dist/solid/drag.d.ts.map +1 -0
  518. package/dist/solid/drag.js +44 -0
  519. package/dist/solid/drag.js.map +1 -0
  520. package/dist/solid/element-style.d.ts +60 -0
  521. package/dist/solid/element-style.d.ts.map +1 -0
  522. package/dist/solid/element-style.js +50 -0
  523. package/dist/solid/element-style.js.map +1 -0
  524. package/dist/solid/element.d.ts +73 -0
  525. package/dist/solid/element.d.ts.map +1 -0
  526. package/dist/solid/element.jsx +326 -0
  527. package/dist/solid/element.jsx.map +1 -0
  528. package/dist/solid/feature-section.d.ts +18 -0
  529. package/dist/solid/feature-section.d.ts.map +1 -0
  530. package/dist/solid/feature-section.js +13 -0
  531. package/dist/solid/feature-section.js.map +1 -0
  532. package/dist/solid/feature.d.ts +114 -0
  533. package/dist/solid/feature.d.ts.map +1 -0
  534. package/dist/solid/feature.js +248 -0
  535. package/dist/solid/feature.js.map +1 -0
  536. package/dist/solid/features/all.d.ts +10 -0
  537. package/dist/solid/features/all.d.ts.map +1 -0
  538. package/dist/solid/features/all.js +10 -0
  539. package/dist/solid/features/all.js.map +1 -0
  540. package/dist/solid/features/colors.d.ts +12 -0
  541. package/dist/solid/features/colors.d.ts.map +1 -0
  542. package/dist/solid/features/colors.js +34 -0
  543. package/dist/solid/features/colors.js.map +1 -0
  544. package/dist/solid/features/dom-animation.d.ts +11 -0
  545. package/dist/solid/features/dom-animation.d.ts.map +1 -0
  546. package/dist/solid/features/dom-animation.js +7 -0
  547. package/dist/solid/features/dom-animation.js.map +1 -0
  548. package/dist/solid/features/dom-max.d.ts +10 -0
  549. package/dist/solid/features/dom-max.d.ts.map +1 -0
  550. package/dist/solid/features/dom-max.js +4 -0
  551. package/dist/solid/features/dom-max.js.map +1 -0
  552. package/dist/solid/features/drag.d.ts +5 -0
  553. package/dist/solid/features/drag.d.ts.map +1 -0
  554. package/dist/solid/features/drag.js +28 -0
  555. package/dist/solid/features/drag.js.map +1 -0
  556. package/dist/solid/features/focus.d.ts +5 -0
  557. package/dist/solid/features/focus.d.ts.map +1 -0
  558. package/dist/solid/features/focus.js +16 -0
  559. package/dist/solid/features/focus.js.map +1 -0
  560. package/dist/solid/features/hover.d.ts +5 -0
  561. package/dist/solid/features/hover.d.ts.map +1 -0
  562. package/dist/solid/features/hover.js +16 -0
  563. package/dist/solid/features/hover.js.map +1 -0
  564. package/dist/solid/features/in-view.d.ts +5 -0
  565. package/dist/solid/features/in-view.d.ts.map +1 -0
  566. package/dist/solid/features/in-view.js +16 -0
  567. package/dist/solid/features/in-view.js.map +1 -0
  568. package/dist/solid/features/input.d.ts +26 -0
  569. package/dist/solid/features/input.d.ts.map +1 -0
  570. package/dist/solid/features/input.js +31 -0
  571. package/dist/solid/features/input.js.map +1 -0
  572. package/dist/solid/features/keys.d.ts +70 -0
  573. package/dist/solid/features/keys.d.ts.map +1 -0
  574. package/dist/solid/features/keys.js +26 -0
  575. package/dist/solid/features/keys.js.map +1 -0
  576. package/dist/solid/features/layout.d.ts +32 -0
  577. package/dist/solid/features/layout.d.ts.map +1 -0
  578. package/dist/solid/features/layout.js +34 -0
  579. package/dist/solid/features/layout.js.map +1 -0
  580. package/dist/solid/features/pan.d.ts +5 -0
  581. package/dist/solid/features/pan.d.ts.map +1 -0
  582. package/dist/solid/features/pan.js +16 -0
  583. package/dist/solid/features/pan.js.map +1 -0
  584. package/dist/solid/features/press.d.ts +11 -0
  585. package/dist/solid/features/press.d.ts.map +1 -0
  586. package/dist/solid/features/press.js +10 -0
  587. package/dist/solid/features/press.js.map +1 -0
  588. package/dist/solid/focus-sensor.d.ts +19 -0
  589. package/dist/solid/focus-sensor.d.ts.map +1 -0
  590. package/dist/solid/focus-sensor.js +23 -0
  591. package/dist/solid/focus-sensor.js.map +1 -0
  592. package/dist/solid/frame-time.d.ts +21 -0
  593. package/dist/solid/frame-time.d.ts.map +1 -0
  594. package/dist/solid/frame-time.js +41 -0
  595. package/dist/solid/frame-time.js.map +1 -0
  596. package/dist/solid/gesture-callbacks.d.ts +53 -0
  597. package/dist/solid/gesture-callbacks.d.ts.map +1 -0
  598. package/dist/solid/gesture-callbacks.js +184 -0
  599. package/dist/solid/gesture-callbacks.js.map +1 -0
  600. package/dist/solid/gesture-features.d.ts +28 -0
  601. package/dist/solid/gesture-features.d.ts.map +1 -0
  602. package/dist/solid/gesture-features.js +29 -0
  603. package/dist/solid/gesture-features.js.map +1 -0
  604. package/dist/solid/gesture-info.d.ts +59 -0
  605. package/dist/solid/gesture-info.d.ts.map +1 -0
  606. package/dist/solid/gesture-info.js +23 -0
  607. package/dist/solid/gesture-info.js.map +1 -0
  608. package/dist/solid/hover-sensor.d.ts +19 -0
  609. package/dist/solid/hover-sensor.d.ts.map +1 -0
  610. package/dist/solid/hover-sensor.js +23 -0
  611. package/dist/solid/hover-sensor.js.map +1 -0
  612. package/dist/solid/imperative.d.ts +195 -0
  613. package/dist/solid/imperative.d.ts.map +1 -0
  614. package/dist/solid/imperative.js +536 -0
  615. package/dist/solid/imperative.js.map +1 -0
  616. package/dist/solid/index.d.ts +180 -0
  617. package/dist/solid/index.d.ts.map +1 -0
  618. package/dist/solid/index.js +165 -0
  619. package/dist/solid/index.js.map +1 -0
  620. package/dist/solid/instant.d.ts +44 -0
  621. package/dist/solid/instant.d.ts.map +1 -0
  622. package/dist/solid/instant.js +49 -0
  623. package/dist/solid/instant.js.map +1 -0
  624. package/dist/solid/layout-group.d.ts +14 -0
  625. package/dist/solid/layout-group.d.ts.map +1 -0
  626. package/dist/solid/layout-group.js +27 -0
  627. package/dist/solid/layout-group.js.map +1 -0
  628. package/dist/solid/layout-member.d.ts +117 -0
  629. package/dist/solid/layout-member.d.ts.map +1 -0
  630. package/dist/solid/layout-member.js +164 -0
  631. package/dist/solid/layout-member.js.map +1 -0
  632. package/dist/solid/layout-projection.d.ts +22 -0
  633. package/dist/solid/layout-projection.d.ts.map +1 -0
  634. package/dist/solid/layout-projection.js +19 -0
  635. package/dist/solid/layout-projection.js.map +1 -0
  636. package/dist/solid/layout.d.ts +76 -0
  637. package/dist/solid/layout.d.ts.map +1 -0
  638. package/dist/solid/layout.jsx +80 -0
  639. package/dist/solid/layout.jsx.map +1 -0
  640. package/dist/solid/live-style.d.ts +147 -0
  641. package/dist/solid/live-style.d.ts.map +1 -0
  642. package/dist/solid/live-style.js +304 -0
  643. package/dist/solid/live-style.js.map +1 -0
  644. package/dist/solid/live-value.d.ts +144 -0
  645. package/dist/solid/live-value.d.ts.map +1 -0
  646. package/dist/solid/live-value.js +223 -0
  647. package/dist/solid/live-value.js.map +1 -0
  648. package/dist/solid/motion-props.d.ts +75 -0
  649. package/dist/solid/motion-props.d.ts.map +1 -0
  650. package/dist/solid/motion-props.js +314 -0
  651. package/dist/solid/motion-props.js.map +1 -0
  652. package/dist/solid/owner-scope.d.ts +16 -0
  653. package/dist/solid/owner-scope.d.ts.map +1 -0
  654. package/dist/solid/owner-scope.js +31 -0
  655. package/dist/solid/owner-scope.js.map +1 -0
  656. package/dist/solid/page-point.d.ts +35 -0
  657. package/dist/solid/page-point.d.ts.map +1 -0
  658. package/dist/solid/page-point.js +87 -0
  659. package/dist/solid/page-point.js.map +1 -0
  660. package/dist/solid/presence-controller.d.ts +122 -0
  661. package/dist/solid/presence-controller.d.ts.map +1 -0
  662. package/dist/solid/presence-controller.js +1207 -0
  663. package/dist/solid/presence-controller.js.map +1 -0
  664. package/dist/solid/presence-record.d.ts +167 -0
  665. package/dist/solid/presence-record.d.ts.map +1 -0
  666. package/dist/solid/presence-record.js +26 -0
  667. package/dist/solid/presence-record.js.map +1 -0
  668. package/dist/solid/presence.d.ts +95 -0
  669. package/dist/solid/presence.d.ts.map +1 -0
  670. package/dist/solid/presence.jsx +195 -0
  671. package/dist/solid/presence.jsx.map +1 -0
  672. package/dist/solid/press-sensor.d.ts +20 -0
  673. package/dist/solid/press-sensor.d.ts.map +1 -0
  674. package/dist/solid/press-sensor.js +24 -0
  675. package/dist/solid/press-sensor.js.map +1 -0
  676. package/dist/solid/press.d.ts +24 -0
  677. package/dist/solid/press.d.ts.map +1 -0
  678. package/dist/solid/press.js +19 -0
  679. package/dist/solid/press.js.map +1 -0
  680. package/dist/solid/provider.d.ts +263 -0
  681. package/dist/solid/provider.d.ts.map +1 -0
  682. package/dist/solid/provider.jsx +411 -0
  683. package/dist/solid/provider.jsx.map +1 -0
  684. package/dist/solid/reactivity.d.ts +27 -0
  685. package/dist/solid/reactivity.d.ts.map +1 -0
  686. package/dist/solid/reactivity.js +9 -0
  687. package/dist/solid/reactivity.js.map +1 -0
  688. package/dist/solid/reorder-input.d.ts +22 -0
  689. package/dist/solid/reorder-input.d.ts.map +1 -0
  690. package/dist/solid/reorder-input.js +45 -0
  691. package/dist/solid/reorder-input.js.map +1 -0
  692. package/dist/solid/reorder.d.ts +241 -0
  693. package/dist/solid/reorder.d.ts.map +1 -0
  694. package/dist/solid/reorder.jsx +427 -0
  695. package/dist/solid/reorder.jsx.map +1 -0
  696. package/dist/solid/retarget-legs.d.ts +189 -0
  697. package/dist/solid/retarget-legs.d.ts.map +1 -0
  698. package/dist/solid/retarget-legs.js +825 -0
  699. package/dist/solid/retarget-legs.js.map +1 -0
  700. package/dist/solid/runtime.d.ts +179 -0
  701. package/dist/solid/runtime.d.ts.map +1 -0
  702. package/dist/solid/runtime.js +237 -0
  703. package/dist/solid/runtime.js.map +1 -0
  704. package/dist/solid/sensors.d.ts +95 -0
  705. package/dist/solid/sensors.d.ts.map +1 -0
  706. package/dist/solid/sensors.js +154 -0
  707. package/dist/solid/sensors.js.map +1 -0
  708. package/dist/solid/server-interpolators.d.ts +13 -0
  709. package/dist/solid/server-interpolators.d.ts.map +1 -0
  710. package/dist/solid/server-interpolators.js +20 -0
  711. package/dist/solid/server-interpolators.js.map +1 -0
  712. package/dist/solid/server.d.ts +9 -0
  713. package/dist/solid/server.d.ts.map +1 -0
  714. package/dist/solid/server.js +20 -0
  715. package/dist/solid/server.js.map +1 -0
  716. package/dist/solid/solid-reactivity.d.ts +3 -0
  717. package/dist/solid/solid-reactivity.d.ts.map +1 -0
  718. package/dist/solid/solid-reactivity.js +19 -0
  719. package/dist/solid/solid-reactivity.js.map +1 -0
  720. package/dist/solid/spine.d.ts +597 -0
  721. package/dist/solid/spine.d.ts.map +1 -0
  722. package/dist/solid/spine.js +2761 -0
  723. package/dist/solid/spine.js.map +1 -0
  724. package/dist/solid/stagger.d.ts +29 -0
  725. package/dist/solid/stagger.d.ts.map +1 -0
  726. package/dist/solid/stagger.js +13 -0
  727. package/dist/solid/stagger.js.map +1 -0
  728. package/dist/solid/unstable/v2/bridge.d.ts +33 -0
  729. package/dist/solid/unstable/v2/bridge.d.ts.map +1 -0
  730. package/dist/solid/unstable/v2/bridge.js +76 -0
  731. package/dist/solid/unstable/v2/bridge.js.map +1 -0
  732. package/dist/solid/unstable/v2/complete.d.ts +21 -0
  733. package/dist/solid/unstable/v2/complete.d.ts.map +1 -0
  734. package/dist/solid/unstable/v2/complete.js +27 -0
  735. package/dist/solid/unstable/v2/complete.js.map +1 -0
  736. package/dist/solid/unstable/v2/config-view.d.ts +49 -0
  737. package/dist/solid/unstable/v2/config-view.d.ts.map +1 -0
  738. package/dist/solid/unstable/v2/config-view.js +114 -0
  739. package/dist/solid/unstable/v2/config-view.js.map +1 -0
  740. package/dist/solid/unstable/v2/create-animate.d.ts +31 -0
  741. package/dist/solid/unstable/v2/create-animate.d.ts.map +1 -0
  742. package/dist/solid/unstable/v2/create-animate.js +102 -0
  743. package/dist/solid/unstable/v2/create-animate.js.map +1 -0
  744. package/dist/solid/unstable/v2/cycle.d.ts +20 -0
  745. package/dist/solid/unstable/v2/cycle.d.ts.map +1 -0
  746. package/dist/solid/unstable/v2/cycle.js +30 -0
  747. package/dist/solid/unstable/v2/cycle.js.map +1 -0
  748. package/dist/solid/unstable/v2/drag-sensor.d.ts +23 -0
  749. package/dist/solid/unstable/v2/drag-sensor.d.ts.map +1 -0
  750. package/dist/solid/unstable/v2/drag-sensor.js +32 -0
  751. package/dist/solid/unstable/v2/drag-sensor.js.map +1 -0
  752. package/dist/solid/unstable/v2/element.d.ts +178 -0
  753. package/dist/solid/unstable/v2/element.d.ts.map +1 -0
  754. package/dist/solid/unstable/v2/element.jsx +325 -0
  755. package/dist/solid/unstable/v2/element.jsx.map +1 -0
  756. package/dist/solid/unstable/v2/feature-section.d.ts +12 -0
  757. package/dist/solid/unstable/v2/feature-section.d.ts.map +1 -0
  758. package/dist/solid/unstable/v2/feature-section.js +23 -0
  759. package/dist/solid/unstable/v2/feature-section.js.map +1 -0
  760. package/dist/solid/unstable/v2/focus-sensor.d.ts +13 -0
  761. package/dist/solid/unstable/v2/focus-sensor.d.ts.map +1 -0
  762. package/dist/solid/unstable/v2/focus-sensor.js +23 -0
  763. package/dist/solid/unstable/v2/focus-sensor.js.map +1 -0
  764. package/dist/solid/unstable/v2/hover-sensor.d.ts +12 -0
  765. package/dist/solid/unstable/v2/hover-sensor.d.ts.map +1 -0
  766. package/dist/solid/unstable/v2/hover-sensor.js +22 -0
  767. package/dist/solid/unstable/v2/hover-sensor.js.map +1 -0
  768. package/dist/solid/unstable/v2/index.d.ts +131 -0
  769. package/dist/solid/unstable/v2/index.d.ts.map +1 -0
  770. package/dist/solid/unstable/v2/index.js +114 -0
  771. package/dist/solid/unstable/v2/index.js.map +1 -0
  772. package/dist/solid/unstable/v2/layout-projection.d.ts +21 -0
  773. package/dist/solid/unstable/v2/layout-projection.d.ts.map +1 -0
  774. package/dist/solid/unstable/v2/layout-projection.js +18 -0
  775. package/dist/solid/unstable/v2/layout-projection.js.map +1 -0
  776. package/dist/solid/unstable/v2/layout.d.ts +47 -0
  777. package/dist/solid/unstable/v2/layout.d.ts.map +1 -0
  778. package/dist/solid/unstable/v2/layout.jsx +62 -0
  779. package/dist/solid/unstable/v2/layout.jsx.map +1 -0
  780. package/dist/solid/unstable/v2/lifecycle.d.ts +267 -0
  781. package/dist/solid/unstable/v2/lifecycle.d.ts.map +1 -0
  782. package/dist/solid/unstable/v2/lifecycle.js +457 -0
  783. package/dist/solid/unstable/v2/lifecycle.js.map +1 -0
  784. package/dist/solid/unstable/v2/live-value.d.ts +146 -0
  785. package/dist/solid/unstable/v2/live-value.d.ts.map +1 -0
  786. package/dist/solid/unstable/v2/live-value.js +235 -0
  787. package/dist/solid/unstable/v2/live-value.js.map +1 -0
  788. package/dist/solid/unstable/v2/presence-handle.d.ts +55 -0
  789. package/dist/solid/unstable/v2/presence-handle.d.ts.map +1 -0
  790. package/dist/solid/unstable/v2/presence-handle.js +119 -0
  791. package/dist/solid/unstable/v2/presence-handle.js.map +1 -0
  792. package/dist/solid/unstable/v2/presence-hooks.d.ts +51 -0
  793. package/dist/solid/unstable/v2/presence-hooks.d.ts.map +1 -0
  794. package/dist/solid/unstable/v2/presence-hooks.js +115 -0
  795. package/dist/solid/unstable/v2/presence-hooks.js.map +1 -0
  796. package/dist/solid/unstable/v2/presence.d.ts +89 -0
  797. package/dist/solid/unstable/v2/presence.d.ts.map +1 -0
  798. package/dist/solid/unstable/v2/presence.jsx +107 -0
  799. package/dist/solid/unstable/v2/presence.jsx.map +1 -0
  800. package/dist/solid/unstable/v2/press-sensor.d.ts +13 -0
  801. package/dist/solid/unstable/v2/press-sensor.d.ts.map +1 -0
  802. package/dist/solid/unstable/v2/press-sensor.js +23 -0
  803. package/dist/solid/unstable/v2/press-sensor.js.map +1 -0
  804. package/dist/solid/unstable/v2/provider.d.ts +239 -0
  805. package/dist/solid/unstable/v2/provider.d.ts.map +1 -0
  806. package/dist/solid/unstable/v2/provider.jsx +423 -0
  807. package/dist/solid/unstable/v2/provider.jsx.map +1 -0
  808. package/dist/solid/unstable/v2/reorder.d.ts +292 -0
  809. package/dist/solid/unstable/v2/reorder.d.ts.map +1 -0
  810. package/dist/solid/unstable/v2/reorder.jsx +525 -0
  811. package/dist/solid/unstable/v2/reorder.jsx.map +1 -0
  812. package/dist/solid/unstable/v2/sensors.d.ts +91 -0
  813. package/dist/solid/unstable/v2/sensors.d.ts.map +1 -0
  814. package/dist/solid/unstable/v2/sensors.js +124 -0
  815. package/dist/solid/unstable/v2/sensors.js.map +1 -0
  816. package/dist/solid/unstable/v2/solid-reactivity.d.ts +61 -0
  817. package/dist/solid/unstable/v2/solid-reactivity.d.ts.map +1 -0
  818. package/dist/solid/unstable/v2/solid-reactivity.js +62 -0
  819. package/dist/solid/unstable/v2/solid-reactivity.js.map +1 -0
  820. package/dist/solid/unstable/v2/variant-node.d.ts +51 -0
  821. package/dist/solid/unstable/v2/variant-node.d.ts.map +1 -0
  822. package/dist/solid/unstable/v2/variant-node.js +336 -0
  823. package/dist/solid/unstable/v2/variant-node.js.map +1 -0
  824. package/dist/solid/unstable/v2/w.d.ts +42 -0
  825. package/dist/solid/unstable/v2/w.d.ts.map +1 -0
  826. package/dist/solid/unstable/v2/w.jsx +22 -0
  827. package/dist/solid/unstable/v2/w.jsx.map +1 -0
  828. package/dist/solid/unstable/v2/waiters.d.ts +72 -0
  829. package/dist/solid/unstable/v2/waiters.d.ts.map +1 -0
  830. package/dist/solid/unstable/v2/waiters.js +175 -0
  831. package/dist/solid/unstable/v2/waiters.js.map +1 -0
  832. package/dist/solid/unstable/v2/ward.d.ts +393 -0
  833. package/dist/solid/unstable/v2/ward.d.ts.map +1 -0
  834. package/dist/solid/unstable/v2/ward.jsx +1475 -0
  835. package/dist/solid/unstable/v2/ward.jsx.map +1 -0
  836. package/dist/solid/unstable/v2/wardic-config.d.ts +68 -0
  837. package/dist/solid/unstable/v2/wardic-config.d.ts.map +1 -0
  838. package/dist/solid/unstable/v2/wardic-config.jsx +28 -0
  839. package/dist/solid/unstable/v2/wardic-config.jsx.map +1 -0
  840. package/dist/solid/unstable/v2/wardic.d.ts +28 -0
  841. package/dist/solid/unstable/v2/wardic.d.ts.map +1 -0
  842. package/dist/solid/unstable/v2/wardic.jsx +16 -0
  843. package/dist/solid/unstable/v2/wardic.jsx.map +1 -0
  844. package/dist/solid/variant-node.d.ts +32 -0
  845. package/dist/solid/variant-node.d.ts.map +1 -0
  846. package/dist/solid/variant-node.js +257 -0
  847. package/dist/solid/variant-node.js.map +1 -0
  848. package/dist/solid/variant-target.d.ts +102 -0
  849. package/dist/solid/variant-target.d.ts.map +1 -0
  850. package/dist/solid/variant-target.js +180 -0
  851. package/dist/solid/variant-target.js.map +1 -0
  852. package/dist/solid/variant-tree.d.ts +349 -0
  853. package/dist/solid/variant-tree.d.ts.map +1 -0
  854. package/dist/solid/variant-tree.js +358 -0
  855. package/dist/solid/variant-tree.js.map +1 -0
  856. package/dist/solid/variants.d.ts +21 -0
  857. package/dist/solid/variants.d.ts.map +1 -0
  858. package/dist/solid/variants.js +43 -0
  859. package/dist/solid/variants.js.map +1 -0
  860. package/dist/solid/w.d.ts +42 -0
  861. package/dist/solid/w.d.ts.map +1 -0
  862. package/dist/solid/w.jsx +23 -0
  863. package/dist/solid/w.jsx.map +1 -0
  864. package/dist/solid/ward-keys.d.ts +236 -0
  865. package/dist/solid/ward-keys.d.ts.map +1 -0
  866. package/dist/solid/ward-keys.js +2 -0
  867. package/dist/solid/ward-keys.js.map +1 -0
  868. package/dist/solid/wardic-component.d.ts +50 -0
  869. package/dist/solid/wardic-component.d.ts.map +1 -0
  870. package/dist/solid/wardic-component.js +74 -0
  871. package/dist/solid/wardic-component.js.map +1 -0
  872. package/dist/solid/wardic-config-value.d.ts +87 -0
  873. package/dist/solid/wardic-config-value.d.ts.map +1 -0
  874. package/dist/solid/wardic-config-value.js +106 -0
  875. package/dist/solid/wardic-config-value.js.map +1 -0
  876. package/dist/solid/wardic-config.d.ts +69 -0
  877. package/dist/solid/wardic-config.d.ts.map +1 -0
  878. package/dist/solid/wardic-config.jsx +30 -0
  879. package/dist/solid/wardic-config.jsx.map +1 -0
  880. package/dist/solid/wardic.d.ts +45 -0
  881. package/dist/solid/wardic.d.ts.map +1 -0
  882. package/dist/solid/wardic.jsx +31 -0
  883. package/dist/solid/wardic.jsx.map +1 -0
  884. package/package.json +98 -4
  885. package/src/animation-controls.ts +204 -0
  886. package/src/animation-frame.ts +32 -0
  887. package/src/appear.ts +804 -0
  888. package/src/arc.ts +34 -0
  889. package/src/bridge.ts +98 -0
  890. package/src/complete.ts +45 -0
  891. package/src/config.ts +805 -0
  892. package/src/create-animate.ts +41 -0
  893. package/src/create-ward.tsx +1271 -0
  894. package/src/cycle-index.ts +18 -0
  895. package/src/cycle.ts +34 -0
  896. package/src/directive.ts +87 -0
  897. package/src/drag-constraints.ts +103 -0
  898. package/src/drag-controls.ts +94 -0
  899. package/src/drag-samples.ts +54 -0
  900. package/src/drag-sensor.ts +46 -0
  901. package/src/drag-track.ts +937 -0
  902. package/src/drag-transition.ts +43 -0
  903. package/src/drag.ts +58 -0
  904. package/src/element-style.ts +112 -0
  905. package/src/element.tsx +400 -0
  906. package/src/feature-section.ts +33 -0
  907. package/src/feature.ts +342 -0
  908. package/src/features/all.ts +18 -0
  909. package/src/features/colors.ts +36 -0
  910. package/src/features/dom-animation.ts +15 -0
  911. package/src/features/dom-max.ts +11 -0
  912. package/src/features/drag.ts +30 -0
  913. package/src/features/focus.ts +17 -0
  914. package/src/features/hover.ts +17 -0
  915. package/src/features/in-view.ts +17 -0
  916. package/src/features/input.ts +42 -0
  917. package/src/features/keys.ts +89 -0
  918. package/src/features/layout.ts +54 -0
  919. package/src/features/pan.ts +17 -0
  920. package/src/features/press.ts +17 -0
  921. package/src/focus-sensor.ts +32 -0
  922. package/src/frame-time.ts +45 -0
  923. package/src/gesture-callbacks.ts +212 -0
  924. package/src/gesture-features.ts +35 -0
  925. package/src/gesture-info.ts +81 -0
  926. package/src/hover-sensor.ts +32 -0
  927. package/src/imperative.ts +782 -0
  928. package/src/index.ts +334 -0
  929. package/src/instant.ts +90 -0
  930. package/src/layout-group.ts +32 -0
  931. package/src/layout-member.ts +300 -0
  932. package/src/layout-projection.ts +28 -0
  933. package/src/layout.tsx +127 -0
  934. package/src/live-style.ts +449 -0
  935. package/src/live-value.ts +378 -0
  936. package/src/motion-props.ts +325 -0
  937. package/src/owner-scope.ts +31 -0
  938. package/src/page-point.ts +98 -0
  939. package/src/presence-controller.ts +1483 -0
  940. package/src/presence-record.ts +189 -0
  941. package/src/presence.tsx +269 -0
  942. package/src/press-sensor.ts +33 -0
  943. package/src/press.ts +40 -0
  944. package/src/provider.tsx +526 -0
  945. package/src/reactivity.ts +29 -0
  946. package/src/reorder-input.ts +53 -0
  947. package/src/reorder.tsx +703 -0
  948. package/src/retarget-legs.ts +1048 -0
  949. package/src/runtime.ts +388 -0
  950. package/src/sensors.ts +189 -0
  951. package/src/server-interpolators.ts +33 -0
  952. package/src/server.ts +21 -0
  953. package/src/solid-reactivity.ts +21 -0
  954. package/src/spine.ts +3385 -0
  955. package/src/stagger.ts +31 -0
  956. package/src/unstable/v2/bridge.ts +79 -0
  957. package/src/unstable/v2/complete.ts +47 -0
  958. package/src/unstable/v2/config-view.ts +156 -0
  959. package/src/unstable/v2/create-animate.ts +123 -0
  960. package/src/unstable/v2/cycle.ts +33 -0
  961. package/src/unstable/v2/drag-sensor.ts +44 -0
  962. package/src/unstable/v2/element.tsx +478 -0
  963. package/src/unstable/v2/feature-section.ts +32 -0
  964. package/src/unstable/v2/focus-sensor.ts +31 -0
  965. package/src/unstable/v2/hover-sensor.ts +30 -0
  966. package/src/unstable/v2/index.ts +270 -0
  967. package/src/unstable/v2/layout-projection.ts +27 -0
  968. package/src/unstable/v2/layout.tsx +89 -0
  969. package/src/unstable/v2/lifecycle.ts +612 -0
  970. package/src/unstable/v2/live-value.ts +414 -0
  971. package/src/unstable/v2/presence-handle.ts +159 -0
  972. package/src/unstable/v2/presence-hooks.ts +157 -0
  973. package/src/unstable/v2/presence.tsx +174 -0
  974. package/src/unstable/v2/press-sensor.ts +31 -0
  975. package/src/unstable/v2/provider.tsx +524 -0
  976. package/src/unstable/v2/reorder.tsx +880 -0
  977. package/src/unstable/v2/sensors.ts +169 -0
  978. package/src/unstable/v2/solid-reactivity.ts +69 -0
  979. package/src/unstable/v2/variant-node.ts +446 -0
  980. package/src/unstable/v2/w.tsx +49 -0
  981. package/src/unstable/v2/waiters.ts +212 -0
  982. package/src/unstable/v2/ward.tsx +2068 -0
  983. package/src/unstable/v2/wardic-config.tsx +84 -0
  984. package/src/unstable/v2/wardic.tsx +41 -0
  985. package/src/variant-node.ts +368 -0
  986. package/src/variant-target.ts +234 -0
  987. package/src/variant-tree.ts +638 -0
  988. package/src/variants.ts +47 -0
  989. package/src/w.tsx +59 -0
  990. package/src/ward-keys.ts +343 -0
  991. package/src/wardic-component.ts +96 -0
  992. package/src/wardic-config-value.ts +150 -0
  993. package/src/wardic-config.tsx +78 -0
  994. package/src/wardic.tsx +59 -0
@@ -0,0 +1,1048 @@
1
+ /**
2
+ * A Retarget's legs as one pure builder (#48, ADR-0044 decision 8): which machines a Retarget
3
+ * runs, each from where and on which transition, with nothing of the element's (its gate, its
4
+ * Snapshot, its fibers). The spine runs each leg into its sinks; a server render samples a mount's
5
+ * legs into an Appear animation's rule, so the two can't drift.
6
+ *
7
+ * - **Which transition** (ADR-0051, #357): a key runs on the transition it resolves to (#301), as
8
+ * Motion's: with none defined there, on its Environment's Default transition for it ({@link runOf}).
9
+ * - **A tween** runs every key, numbers and strings, in one `animateValues` leg; with a key's
10
+ * Keyframes among them (#429, ADR-0058), or `times` or an `ease` per Interval, in one
11
+ * `keyframesValues` leg.
12
+ * - **A spring** runs the numbers in one `springValues` leg, carrying velocity, and the strings in
13
+ * one `springBlend` leg on the same spring (ADR-0024, D5). It takes two stops: Keyframes of more
14
+ * are Motion's error, and land on their last stop.
15
+ * - **Keyframes of two stops** run as a target does, from their first stop ({@link keyframesFrom}).
16
+ * - **A Measured pair** (#430, `@wardic/dom/MeasuredPair`) runs in a leg of its own, between its ends
17
+ * in px, measured at the end of the task, and lands on its target as given.
18
+ * - **Reduced motion** (ADR-0029): when it applies, the positional keys snap in a leg of their own,
19
+ * after the delay their transition gives, to where their leg would have ended.
20
+ * - **A return to a moving Live value** (#130, ADR-0043 decision 6) runs a leg of its own per key,
21
+ * a tween easing toward it, a spring chasing it.
22
+ *
23
+ * The legs come in the order the spine starts them: the snap, the follows, then the rest. A leg's
24
+ * machine is built when it's called, inside the leg's own fiber, so a transition core rejects
25
+ * fails that leg alone (#66).
26
+ */
27
+ import type * as Arc from "@wardic/core/Arc"
28
+ import * as DefaultTransition from "@wardic/core/DefaultTransition"
29
+ import * as Easing from "@wardic/core/Easing"
30
+ import type * as Frame from "@wardic/core/Frame"
31
+ import * as Inertia from "@wardic/core/Inertia"
32
+ import type * as InterpolatorRegistry from "@wardic/core/InterpolatorRegistry"
33
+ import * as Machine from "@wardic/core/Machine"
34
+ import * as ReducedMotion from "@wardic/core/ReducedMotion"
35
+ import * as Spring from "@wardic/core/Spring"
36
+ import * as Values from "@wardic/core/Values"
37
+ import * as MeasuredPair from "@wardic/dom/MeasuredPair"
38
+ import type * as Style from "@wardic/dom/Style"
39
+ import * as Arr from "effect/Array"
40
+ import * as Bool from "effect/Boolean"
41
+ import * as Effect from "effect/Effect"
42
+ import { identity, type LazyArg } from "effect/Function"
43
+ import * as Match from "effect/Match"
44
+ import * as Option from "effect/Option"
45
+ import * as Predicate from "effect/Predicate"
46
+ import * as Rec from "effect/Record"
47
+ import * as UndefinedOr from "effect/UndefinedOr"
48
+ import type { WardicTransition } from "./config.ts"
49
+
50
+ /** A Retarget's returns that follow a moving Live value (#130, ADR-0043 decision 6). */
51
+ export interface Follows {
52
+ /** The keys among the animated ones whose return follows its Live value. */
53
+ readonly keysOf: (rest: Values.Values) => ReadonlyArray<string>
54
+ /** Where a following key's Live value is now, read each step. */
55
+ readonly targetOf: (key: string, start: number) => () => number
56
+ }
57
+
58
+ /** A leg that snaps the positional keys (ADR-0029). */
59
+ export interface Snap {
60
+ readonly _tag: "Snap"
61
+ /** The keys it snaps: a spring starts each of them at rest after. */
62
+ readonly keys: ReadonlyArray<string>
63
+ /** Each key it snaps, with the target the Retarget gave it (#325). */
64
+ readonly to: Values.Values
65
+ readonly machine: () => Machine.Machine<Frame.Frame<Values.Values>>
66
+ }
67
+
68
+ /** A leg that follows one key's moving Live value (#130). */
69
+ export interface Follow {
70
+ readonly _tag: "Follow"
71
+ readonly key: string
72
+ /** Its key, with where its Live value was at the Retarget (#325). */
73
+ readonly to: Values.Values
74
+ readonly machine: () => Machine.Machine<Frame.Frame<number> & { readonly velocity?: number }>
75
+ }
76
+
77
+ /** A leg over the numeric keys, carrying their velocities: a spring's. */
78
+ export interface Numbers {
79
+ readonly _tag: "Numbers"
80
+ /** Each key it animates, with its target (#325). */
81
+ readonly to: Values.Values
82
+ readonly machine: () => Machine.Machine<Frame.MultiPhysics>
83
+ }
84
+
85
+ /** A leg over values through the Interpolators: a tween's keys, or a spring's strings. */
86
+ export interface Blend {
87
+ readonly _tag: "Blend"
88
+ /** Each key it animates, with its target (#325). */
89
+ readonly to: Values.Values
90
+ readonly machine: () => Effect.Effect<Machine.Machine<Frame.Frame<Values.Values>>, never, InterpolatorRegistry.InterpolatorRegistry>
91
+ }
92
+
93
+ /** One leg of a Retarget. */
94
+ export type Leg = Snap | Follow | Numbers | Blend
95
+
96
+ /**
97
+ * Each key's velocity now (#464): read only for a key a spring or a follow starts, so a tween's
98
+ * Retarget reads none. A spring takes its transition's own `velocity` over it, as Motion's
99
+ * `{ velocity: value.getVelocity(), ...valueTransition }`.
100
+ */
101
+ export type Velocities = (key: string) => number
102
+
103
+ /** No velocity: every key at rest. */
104
+ export const NO_VELOCITY: Velocities = () => 0
105
+
106
+ /** Each key's velocity from a record of them, 0 for one it doesn't have. */
107
+ export const velocitiesOf = (record: Readonly<Record<string, number>>): Velocities => (key) => {
108
+ const velocity = record[key]
109
+ if (Predicate.isUndefined(velocity)) return 0
110
+ return velocity
111
+ }
112
+
113
+ /**
114
+ * The fields no machine reads: the orchestration's (ADR-0007), the variant tree's, and a Path
115
+ * (#438), which {@link legsOf} takes out to `x` and `y`'s leg. Neither defines a transition.
116
+ */
117
+ const ORCHESTRATION = ["staggerChildren", "delayChildren", "from", "staggerDirection", "when", "path"] as const
118
+
119
+ /** A transition as a machine takes it: without the orchestration's fields (#243) or its Path (#438), each arm. */
120
+ export type MotionTransition = WardicTransition extends infer T ? (T extends unknown ? Omit<T, (typeof ORCHESTRATION)[number]> : never) : never
121
+
122
+ /** Each transition without its orchestration, by the transition: one object each, so core's decode cache hits (#66). */
123
+ // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
124
+ const MOTIONS = new WeakMap<WardicTransition, MotionTransition>()
125
+
126
+ /**
127
+ * A transition as its machines take it: without the orchestration's fields (#243). A stagger's
128
+ * `from` (`"last"`, `"center"`) is the variant tree's, and a spring decodes `from` as its starting
129
+ * position, so it failed every leg; the rest of those fields a machine ignores. The same transition,
130
+ * one with none of them.
131
+ */
132
+ export const motionOf = (transition: WardicTransition | undefined): MotionTransition | undefined =>
133
+ UndefinedOr.map(transition, (t): MotionTransition =>
134
+ Bool.match(Arr.some(ORCHESTRATION, (key) => Object.hasOwn(t, key)), {
135
+ onFalse: () => t as MotionTransition,
136
+ onTrue: () =>
137
+ Option.getOrElse(Option.fromUndefinedOr(MOTIONS.get(t)), () => {
138
+ const motion = Rec.filter(t as Record<string, unknown>, (_, key) => Bool.not(Arr.contains(ORCHESTRATION, key))) as MotionTransition
139
+ MOTIONS.set(t, motion)
140
+ return motion
141
+ }),
142
+ }))
143
+
144
+ // --- Per-value transitions (#301, Motion's `getValueTransition`) ---------------------------
145
+
146
+ /**
147
+ * A transition's entries (#301): its own fields, and each value's entry (`default` and `layout`
148
+ * among them). Each entry is resolved at its first need and kept, so its keys run on the same object
149
+ * at every Retarget (#66's decode cache keys on it).
150
+ */
151
+ interface Entries {
152
+ readonly own: WardicTransition
153
+ readonly byKey: Readonly<Record<string, WardicTransition>>
154
+ /** Whether any entry is a value's, not `default` or `layout`: else every value runs on one transition. */
155
+ readonly byValue: boolean
156
+ readonly resolved: Map<string, WardicTransition>
157
+ }
158
+
159
+ /** A transition with no entry: what nearly every transition is. */
160
+ const NONE: unique symbol = Symbol("wardic.noEntries")
161
+
162
+ /** Each transition's entries, worked out once per object (#301). */
163
+ // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
164
+ const ENTRIES = new WeakMap<object, Entries | typeof NONE>()
165
+
166
+ /** The entries that aren't a value's. */
167
+ const NOT_VALUES: ReadonlySet<string> = new Set(["default", "layout"])
168
+
169
+ /**
170
+ * Whether a field is an entry (#301): a transition, under a value's name, `default` or `layout`. No
171
+ * option of a transition's own is a plain object: an easing is a function, `times` an array.
172
+ */
173
+ const isEntry = (value: unknown): boolean => Predicate.isObject(value)
174
+
175
+ /**
176
+ * A transition's entries (#301), or `undefined` for one with none: worked out once per transition
177
+ * object, so an element whose transitions have none pays a lookup per Retarget.
178
+ */
179
+ export const entriesOf = (given: WardicTransition | undefined): Entries | undefined => {
180
+ if (Predicate.isUndefined(given)) return undefined
181
+ const known = ENTRIES.get(given)
182
+ if (known === NONE) return undefined
183
+ if (Predicate.isNotUndefined(known)) return known
184
+ const fields = given as Readonly<Record<string, unknown>>
185
+ const keys = Arr.filter(Rec.keys(fields), (key) => isEntry(fields[key]))
186
+ if (keys.length === 0) {
187
+ ENTRIES.set(given, NONE)
188
+ return undefined
189
+ }
190
+ const made: Entries = {
191
+ own: Rec.filter(fields, (value) => Bool.not(isEntry(value))) as WardicTransition,
192
+ byKey: Rec.fromEntries(Arr.map(keys, (key) => [key, fields[key] as WardicTransition] as const)),
193
+ byValue: Arr.some(keys, (key) => Bool.not(NOT_VALUES.has(key))),
194
+ resolved: new Map(),
195
+ }
196
+ ENTRIES.set(given, made)
197
+ return made
198
+ }
199
+
200
+ /**
201
+ * The transition `key` runs on (#301, Motion's `getValueTransition`): its entry, else `default`, else
202
+ * the transition's own fields; an entry with `inherit: true` laid over the own fields, its own winning.
203
+ * The reduced-motion opt-out is the whole transition's, as the orchestration is: an entry without
204
+ * its own takes the top level's.
205
+ */
206
+ const forKey = (entries: Entries, key: string): WardicTransition => {
207
+ if (Object.hasOwn(entries.byKey, key)) return entryNamed(entries, key)
208
+ if (Object.hasOwn(entries.byKey, "default")) return entryNamed(entries, "default")
209
+ return entries.own
210
+ }
211
+
212
+ /** The entry `name` resolved, once: every key on it runs on the one object, so they share a leg. */
213
+ const entryNamed = (entries: Entries, name: string): WardicTransition => {
214
+ const kept = entries.resolved.get(name)
215
+ if (Predicate.isNotUndefined(kept)) return kept
216
+ const made = resolvedEntry(entries.own, entries.byKey[name] as WardicTransition)
217
+ entries.resolved.set(name, made)
218
+ return made
219
+ }
220
+
221
+ /**
222
+ * An entry as its key runs on it (#301): over the own fields with `inherit`, else with their
223
+ * reduced-motion opt-out and their `skipAnimations` alone (#468: Motion skips every value of a
224
+ * transition that says so).
225
+ */
226
+ const resolvedEntry = (own: WardicTransition, entry: WardicTransition): WardicTransition => {
227
+ const { inherit, ...rest } = entry as WardicTransition & { readonly inherit?: boolean }
228
+ if (inherit === true) return { ...own, ...rest } as WardicTransition
229
+ let made = rest as WardicTransition
230
+ if (Bool.and(Predicate.isNotUndefined(own.respectReducedMotion), Predicate.isUndefined(rest.respectReducedMotion))) made = { ...made, respectReducedMotion: own.respectReducedMotion } as WardicTransition
231
+ if (own.skipAnimations === true) made = { ...made, skipAnimations: true } as WardicTransition
232
+ return made
233
+ }
234
+
235
+ /**
236
+ * The transition `key` runs on in `given` (#301): its entry, else `default`, else `given`'s own
237
+ * fields. `given` itself when it has no entry.
238
+ */
239
+ export const transitionForKey = (given: WardicTransition | undefined, key: string): WardicTransition | undefined => {
240
+ const entries = entriesOf(given)
241
+ if (Predicate.isUndefined(entries)) return given
242
+ return forKey(entries, key)
243
+ }
244
+
245
+ /**
246
+ * `given` held back by `extra` more seconds (ADR-0007's stagger, #290's exit delays): its own `delay`,
247
+ * and each entry's (#301), so a key on its entry waits as the rest do. An `inherit` entry with no
248
+ * `delay` of its own takes the own fields' as they are.
249
+ */
250
+ export const delayedBy = (given: WardicTransition | undefined, extra: number): WardicTransition | undefined => {
251
+ if (extra === 0) return given
252
+ const own = { ...given, delay: delayIn(given) + extra } as WardicTransition
253
+ const entries = entriesOf(given)
254
+ if (Predicate.isUndefined(entries)) return own
255
+ return {
256
+ ...own,
257
+ ...Rec.map(entries.byKey, (entry) => {
258
+ const fields = entry as WardicTransition & { readonly inherit?: boolean }
259
+ if (Bool.and(fields.inherit === true, Predicate.isUndefined(fields.delay))) return entry
260
+ return { ...entry, delay: delayIn(entry) + extra }
261
+ }),
262
+ } as WardicTransition
263
+ }
264
+
265
+ /** A transition's `delay`, 0 without one. */
266
+ const delayIn = (transition: WardicTransition | undefined): number =>
267
+ UndefinedOr.match(transition, { onUndefined: () => 0, onDefined: (t) => UndefinedOr.match(t.delay, { onUndefined: () => 0, onDefined: identity }) })
268
+
269
+ // --- A transition as its legs run it (ADR-0051, #357) -----------------------------------------
270
+
271
+ /**
272
+ * A transition as its legs run it: a spring or a tween, Motion's fields filled in (ADR-0051), with
273
+ * its reduced-motion opt-out.
274
+ */
275
+ export type Run = (DefaultTransition.Transition | DefaultTransition.KeyframesTransition | InertiaRun) & { readonly respectReducedMotion?: boolean; readonly skipAnimations?: boolean }
276
+
277
+ /** An inertia as its legs run it (#435): core's options, `timeConstant` in seconds, with the transition's `velocity` and `delay`. */
278
+ export type InertiaRun = Machine.InertiaValuesOptions & { readonly type: "inertia" }
279
+
280
+ /** Each key's stops past its first two (#429): the Keyframes a tween runs through `keyframesValues`. */
281
+ export type StopsByKey = Readonly<Record<string, ReadonlyArray<number | string>>>
282
+
283
+ /**
284
+ * Whether `key` has Keyframes of more than two stops among `stops`: never a Measured pair (#430). They
285
+ * run through their stops, switching where types mix, as Motion's measures two stops only (#460).
286
+ */
287
+ export const hasManyStops = (stops: StopsByKey | undefined, key: string): boolean => {
288
+ if (Predicate.isUndefined(stops)) return false
289
+ return Object.hasOwn(stops, key)
290
+ }
291
+
292
+ /** Where a Retarget's keys start, and each one's stops, its Keyframes resolved ({@link keyframesFrom}). */
293
+ export interface KeyframesStart {
294
+ readonly from: Values.Values
295
+ readonly stops: StopsByKey | undefined
296
+ }
297
+
298
+ /**
299
+ * Where a target's keys start with its **Keyframes** resolved (#429, Motion's): a first `null` stop is
300
+ * where the key is (`from`), each later one the stop before (`fillWildcards`), and an explicit first
301
+ * stop is where it starts, jumped to. `stops` holds the keys with more than two: a key with two runs
302
+ * as a target does, from its first, so a spring takes it with the key's velocity, as Motion's.
303
+ *
304
+ * @param from each key's start
305
+ * @param to each key's target, its Keyframes' last stop
306
+ * @param keyframes each Keyframes key's stops; only the keys `to` has are read
307
+ */
308
+ export const keyframesFrom = (from: Values.Values, to: Values.Values, keyframes: Readonly<Record<string, Style.Stops>>): KeyframesStart => {
309
+ const started: Record<string, number | string> = { ...from }
310
+ let many: Record<string, ReadonlyArray<number | string>> | undefined
311
+ Arr.forEach(Rec.keys(keyframes), (key) => {
312
+ if (Bool.not(Object.hasOwn(to, key))) return
313
+ const filled = filledStops(UndefinedOr.getOrThrow(keyframes[key]), UndefinedOr.getOrThrow(from[key]))
314
+ started[key] = UndefinedOr.getOrThrow(filled[0])
315
+ if (filled.length < 3) return
316
+ if (Predicate.isUndefined(many)) many = {}
317
+ many[key] = filled
318
+ })
319
+ return { from: started, stops: many }
320
+ }
321
+
322
+ /**
323
+ * Stops with each `null` filled (#429, Motion's `fillWildcards`): the first with `start`, a later one
324
+ * with the stop before. A sequence's function Segment fills its own from 0 (#433).
325
+ */
326
+ export const filledStops = (stops: Style.Stops, start: number | string): ReadonlyArray<number | string> => {
327
+ let before = start
328
+ return Arr.map(stops, (stop) => {
329
+ if (Predicate.isNotNull(stop)) before = stop
330
+ return before
331
+ })
332
+ }
333
+
334
+ /**
335
+ * Why Keyframes of more than two stops can't run on a spring (#429): Motion's development error
336
+ * ("Only two keyframes currently supported with spring and inertia animations"), naming each key, its
337
+ * stops and the fix.
338
+ */
339
+ const springStopsError = (stops: StopsByKey, kind = "a spring"): Error =>
340
+ new Error(
341
+ `wardic: ${Arr.map(Rec.toEntries(stops), ([key, list]) => `"${key}" has ${list.length} keyframes`).join(", ")}, and ${kind} takes two, as Motion's does (#429). ` +
342
+ `Run them on a tween: transition: { ${Arr.map(Rec.keys(stops), (key) => `${JSON.stringify(key)}: { type: "tween" }`).join(", ")} }.`,
343
+ )
344
+
345
+ /** Each tween's answer to {@link keyframedOptions}, by its options: one object each, as {@link RUNS}' (#452). */
346
+ // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
347
+ const KEYFRAMED = new WeakMap<object, boolean>()
348
+
349
+ /**
350
+ * Whether a tween's options need `keyframesValues` (#429): `times`, or an `ease` per Interval, which
351
+ * `animateValues` doesn't take. Worked out once per options object (#452): every tween Retarget asks.
352
+ */
353
+ const keyframedOptions = (options: Machine.KeyframesOptions): boolean => {
354
+ const known = KEYFRAMED.get(options)
355
+ if (Predicate.isNotUndefined(known)) return known
356
+ const keyframed = Bool.or(Predicate.isNotUndefined(options.times), Bool.and(Arr.isArray(options.ease), Bool.not(Easing.isBezier(options.ease as Easing.Definition))))
357
+ KEYFRAMED.set(options, keyframed)
358
+ return keyframed
359
+ }
360
+
361
+ /**
362
+ * The spring fields: one of them, with no `type`, makes a transition a spring, a value's or a layout
363
+ * animation's (ADR-0009 *Amendment (#171)*, ADR-0051); a time-based spring's `bounce` and
364
+ * `visualDuration` among them (#359), where a `duration` alone is a tween's.
365
+ */
366
+ export const SPRING_FIELDS = ["stiffness", "damping", "mass", "velocity", "restDelta", "restSpeed", "bounce", "visualDuration"] as const
367
+
368
+ /** A spring's physics fields: one of them wins over its time (#359, Motion's `physicsKeys`). */
369
+ const PHYSICS_FIELDS = ["stiffness", "damping", "mass"] as const
370
+
371
+ /** A time-based spring's fields (#359): with no physics field, core solves its physics from them. */
372
+ const TIME_FIELDS = ["duration", "bounce", "visualDuration"] as const
373
+
374
+ /**
375
+ * The fields that don't define a transition, beside the orchestration's ({@link motionOf}): Motion's
376
+ * `isTransitionDefined` (at 16c6122) skips `delay`; Wardic's reduced-motion opt-out, `skipAnimations`
377
+ * (#468) and a target's `inherit` aren't a transition's either. `repeat` and its fields do define one, a tween (ADR-0051).
378
+ */
379
+ const NOT_DEFINING: ReadonlySet<string> = new Set(["delay", "respectReducedMotion", "skipAnimations", "inherit"])
380
+
381
+ /** Motion's spring defaults (`springDefaults`): what a spring transition leaves out (ADR-0051). */
382
+ const MOTION_SPRING = { stiffness: 100, damping: 10, mass: 1 } as const
383
+
384
+
385
+ /** A transition that defines nothing: its keys run on their Default transitions. */
386
+ const NOT_DEFINED: unique symbol = Symbol("wardic.notDefined")
387
+
388
+ /** Each transition as its legs run it, by the transition: one object each, so core's decode cache hits (#66). */
389
+ // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
390
+ const RUNS = new WeakMap<object, Run | typeof NOT_DEFINED>()
391
+
392
+ /** A field a transition gives: set, and not an entry (#301). */
393
+ const isGiven = (value: unknown): boolean => Bool.and(Predicate.isNotUndefined(value), Bool.not(isEntry(value)))
394
+
395
+ /** Whether a field defines a transition. */
396
+ const isDefining = (key: string): boolean => Bool.not(NOT_DEFINING.has(key))
397
+
398
+ /** Whether a transition gives any of `keys`. */
399
+ const givesAny = (fields: Readonly<Record<string, unknown>>, keys: ReadonlyArray<string>): boolean => Arr.some(keys, (key) => Object.hasOwn(fields, key))
400
+
401
+ /** Whether a transition's fields make it a spring: `type: "spring"`, or no `type` and a spring field. */
402
+ const isSpring = (fields: Readonly<Record<string, unknown>>): boolean =>
403
+ Bool.or(fields.type === "spring", Bool.and(Predicate.isUndefined(fields.type), givesAny(fields, SPRING_FIELDS)))
404
+
405
+ /**
406
+ * Whether a spring transition is set by time (#359): a time field and no physics field. Its physics
407
+ * are core's to solve, so it takes none of Motion's defaults, which would win over its time.
408
+ */
409
+ const isTimed = (fields: Readonly<Record<string, unknown>>): boolean => Bool.and(givesAny(fields, TIME_FIELDS), Bool.not(givesAny(fields, PHYSICS_FIELDS)))
410
+
411
+ /** {@link runOf}'s work, once a transition: its given fields, and what they make. */
412
+ const madeRun = (given: WardicTransition): Run | typeof NOT_DEFINED => {
413
+ const fields = Rec.filter(UndefinedOr.getOrThrow(motionOf(given)) as Readonly<Record<string, unknown>>, isGiven)
414
+ if (Bool.not(Arr.some(Rec.keys(fields), isDefining))) return NOT_DEFINED
415
+ // An inertia (#435): its fields as given, Motion's `timeConstant` in milliseconds as core's seconds.
416
+ if (fields.type === "inertia") {
417
+ return { ...fields, ...UndefinedOr.match(fields.timeConstant as number | undefined, { onUndefined: () => ({}), onDefined: (ms) => ({ timeConstant: ms / 1000 }) }) } as Run
418
+ }
419
+ return Bool.match(isSpring(fields), {
420
+ onTrue: (): Run =>
421
+ Bool.match(isTimed(fields), {
422
+ onTrue: (): Run => ({ ...fields, type: "spring" }) as Run,
423
+ onFalse: (): Run => ({ ...MOTION_SPRING, ...fields, type: "spring" }) as Run,
424
+ }),
425
+ onFalse: (): Run => ({ ease: Easing.easeOut, ...fields, type: "tween" }) as Run,
426
+ })
427
+ }
428
+
429
+ /**
430
+ * A transition as its legs run it (ADR-0051, #357), or `undefined` when it isn't defined: none, or
431
+ * one with only orchestration, `delay` and the reduced-motion opt-out (Motion's
432
+ * `isTransitionDefined`). A defined one:
433
+ * - is a spring when it says so, or gives no `type` and a spring field ({@link SPRING_FIELDS});
434
+ * anything else is a tween, as a layout animation's is (ADR-0009 *Amendment (#171)*): `{ duration:
435
+ * 0.5 }` a 0.5 s tween, as Motion's, where `{ stiffness: 300 }` stays a spring;
436
+ * - takes Motion's fields for those it leaves out: a spring's 100 / 10 / 1, a tween's `easeOut`
437
+ * (a tween's 0.3 s is core's too). A spring set by time, a `duration`, `bounce` or
438
+ * `visualDuration` and no stiffness, damping or mass (#359), takes no physics: core solves them.
439
+ *
440
+ * Worked out once per transition object. A field set to `undefined` gives nothing.
441
+ */
442
+ export const runOf = (given: WardicTransition | undefined): Run | undefined => {
443
+ if (Predicate.isUndefined(given)) return undefined
444
+ let run = RUNS.get(given)
445
+ if (Predicate.isUndefined(run)) {
446
+ run = madeRun(given)
447
+ RUNS.set(given, run)
448
+ }
449
+ if (run === NOT_DEFINED) return undefined
450
+ return run
451
+ }
452
+
453
+ /** No keys: a Retarget with no following return. */
454
+ const NO_KEYS: ReadonlyArray<string> = []
455
+
456
+ /** Whether a value map has any key. */
457
+ const hasKeys: Predicate.Predicate<Values.Values> = Predicate.not(Rec.isEmptyRecord)
458
+
459
+ /**
460
+ * A Retarget's legs, in the order the spine starts them. Positional, as the spine calls it once a
461
+ * Retarget per element (#69's PR 2: what a Retarget allocates shows in `bench:solid`'s bytes).
462
+ *
463
+ * @param from each key's start
464
+ * @param to each key's target
465
+ * @param given the transition the legs run on, any stagger delay folded in (ADR-0007); its orchestration
466
+ * fields are left out ({@link motionOf})
467
+ * @param reducedMotion whether reduced motion is on (the provider's, ADR-0029); a transition can still opt out
468
+ * @param skipped whether its animations are skipped (#468, a `WardicConfig`'s `skipAnimations`): every key
469
+ * lands at its end on the first tick; a transition's `skipAnimations: true` does the same for its keys
470
+ * @param positionalKeys which keys are positional: the Environment's (ADR-0036)
471
+ * @param defaults what a key with no transition defined runs on: the Environment's (ADR-0051)
472
+ * @param velocities each key's velocity now (#464): a spring starts from it, unless its transition gives one
473
+ * @param follow the returns that follow a moving Live value (#130), given only when the Retarget returns a key
474
+ * @param stops each key's Keyframes of more than two stops (#429, {@link keyframesFrom}), `from` at their first
475
+ * @param measured each key's Measured pair (#430), measured at the end of the task
476
+ * @param current where every key is now: a Path's axis the target leaves out starts there (#438)
477
+ * @param rests where a Path's axis the target leaves out comes to rest, when a Path in flight was taking
478
+ * it somewhere (#574): it ends there; else where it starts
479
+ */
480
+ /** A Path's two axes (#438). */
481
+ const AXES = ["x", "y"] as const
482
+
483
+ /**
484
+ * A Retarget's keys with both of a Path's axes (#438): a Path couples `x` and `y`, so with either one
485
+ * retargeted, the other goes along it too, to its own target in `target`, though that hasn't changed
486
+ * and a Retarget otherwise keeps an unchanged key's Leg (#325). Without a Path, or neither axis, the
487
+ * keys as they are.
488
+ */
489
+ export const withPathAxes = (fresh: Values.Values, target: Values.Values, transition: WardicTransition | undefined): Values.Values => {
490
+ if (Predicate.isUndefined(UndefinedOr.map(transition, (t) => t.path))) return fresh
491
+ if (Bool.not(Arr.some(AXES, (key) => Object.hasOwn(fresh, key)))) return fresh
492
+ const missing = Arr.filter(AXES, (key) => Bool.and(Bool.not(Object.hasOwn(fresh, key)), Object.hasOwn(target, key)))
493
+ if (missing.length === 0) return fresh
494
+ return { ...fresh, ...Rec.fromEntries(Arr.map(missing, (key) => [key, UndefinedOr.getOrThrow(target[key])] as const)) }
495
+ }
496
+
497
+ /** `key`'s number: from `values`, else from `current`, else its identity, 0; `undefined` for a string. */
498
+ const axisOf = (key: string, values: Values.Values, current: Values.Values | undefined): number | undefined => {
499
+ const given = values[key]
500
+ if (Predicate.isNumber(given)) return given
501
+ if (Predicate.isNotUndefined(given)) return undefined
502
+ const now = UndefinedOr.map(current, (all) => all[key])
503
+ if (Predicate.isNumber(now)) return now
504
+ if (Predicate.isNotUndefined(now)) return undefined
505
+ return 0
506
+ }
507
+
508
+ /**
509
+ * `x` and `y` along a Path (#438, Motion's `path`): one progress, 0 to 1, on the transition `x` runs
510
+ * on, from rest, as Motion's `{ velocity: 0, ...getValueTransition(transition, "x") }`; a spring's over
511
+ * 1000, as a layout animation's, so its rest thresholds read as at that distance (#344). Its frames
512
+ * write both axes, and the path's turn (`pathRotation`) when it has one; its last, the targets and no turn.
513
+ */
514
+ const pathLegOf = (at: (t: number) => Arc.PathPoint, end: Values.Values, transition: Run): Blend => ({
515
+ _tag: "Blend",
516
+ to: end,
517
+ machine: () =>
518
+ Effect.succeed(
519
+ Machine.make({
520
+ settles: Bool.or(transition.type === "spring", Number.isFinite(UndefinedOr.match((transition as Machine.Modifiers).repeat, { onUndefined: () => 0, onDefined: identity }))),
521
+ span: { name: "wardic.path", attributes: { rotates: Object.hasOwn(end, "pathRotation") } },
522
+ start: () => {
523
+ const progress = progressOf(transition)
524
+ const turns = Object.hasOwn(end, "pathRotation")
525
+ return (dt): Frame.Frame<Values.Values> => {
526
+ const frame = progress(dt)
527
+ if (frame.done) return { value: end, done: true }
528
+ const point = at(frame.value)
529
+ if (turns) return { value: { x: point.x, y: point.y, pathRotation: UndefinedOr.match(point.rotate, { onUndefined: () => 0, onDefined: identity }) }, done: false }
530
+ return { value: { x: point.x, y: point.y }, done: false }
531
+ }
532
+ },
533
+ }),
534
+ ),
535
+ })
536
+
537
+ /** A Path's progress, 0 to 1, on `transition`: a spring's from rest over 1000 (#438), a tween's as a Measured pair's. */
538
+ const progressOf = (transition: Run): ((dt: number) => Frame.Frame<number>) => {
539
+ if (transition.type === "spring") {
540
+ const spring = Machine.springValues({ progress: 1000 }, { ...(transition as Machine.SpringOptions), velocity: 0 }, { from: { progress: 0 } }).start()
541
+ return (dt) => {
542
+ const frame = spring(dt)
543
+ return { value: UndefinedOr.getOrThrow(frame.value.progress) / 1000, done: frame.done }
544
+ }
545
+ }
546
+ return Machine.keyframes([0, 1], transition as Machine.KeyframesOptions).start()
547
+ }
548
+
549
+ /**
550
+ * A Retarget's Path (#438): when its transition has one and its target has `x` or `y`, their leg along
551
+ * it, from where they are (an axis it leaves out from where it is now, `current`), on the transition `x`
552
+ * runs on; and the target without them. An axis it leaves out ends where it rests (#574): where the Path
553
+ * in flight was taking it, in `rests`, so a toss caught mid-air curves back to its line; else back where
554
+ * it starts, as Motion's `yTo = yRaw ?? yFrom`. `undefined` when there's none to take: no
555
+ * Path or no axis, reduced motion snapping them, a Skipped animation, an inertia, an axis that isn't a
556
+ * number. Keyframes' ends are their first and last stops.
557
+ */
558
+ const pathOf = (
559
+ from: Values.Values,
560
+ to: Values.Values,
561
+ given: WardicTransition | undefined,
562
+ reducedMotion: boolean,
563
+ skipped: boolean,
564
+ defaults: DefaultTransition.DefaultTransition["Service"],
565
+ stops: StopsByKey | undefined,
566
+ current: Values.Values | undefined,
567
+ rests: Values.Values | undefined,
568
+ ): { readonly leg: Blend; readonly rest: Values.Values } | undefined => {
569
+ // Every element's Retarget asks, nearly always with no `path` (#460): guards, nothing built.
570
+ if (Predicate.isUndefined(given)) return undefined
571
+ const path = given.path
572
+ if (Predicate.isUndefined(path)) return undefined
573
+ if (Bool.not(Arr.some(AXES, (key) => Object.hasOwn(to, key)))) return undefined
574
+ if (Bool.or(skipped, UndefinedOr.map(given, (t) => t.skipAnimations) === true)) return undefined
575
+ // `x`'s transition, as a key's: its own entry (#301), else the transition's, else its Default (ADR-0051).
576
+ const runsOn = UndefinedOr.match(entriesOf(given), { onUndefined: () => given, onDefined: (entries) => forKey(entries, "x") })
577
+ const run = UndefinedOr.match(runOf(runsOn), { onUndefined: () => carried(defaultFor(defaults, "x", to, stops), runsOn), onDefined: identity })
578
+ if (run.type === "inertia") return undefined
579
+ // Reduced motion snaps the positional keys, the axes among them (ADR-0029), unless it opts out.
580
+ if (Bool.and(reducedMotion, run.respectReducedMotion !== false)) return undefined
581
+ const startX = axisOf("x", from, current)
582
+ if (Predicate.isUndefined(startX)) return undefined
583
+ const startY = axisOf("y", from, current)
584
+ if (Predicate.isUndefined(startY)) return undefined
585
+ // An axis the target leaves out ends where it rests (#574), else where it starts.
586
+ const resting: Values.Values = { x: startX, y: startY, ...rests }
587
+ const endX = axisOf("x", to, resting)
588
+ if (Predicate.isUndefined(endX)) return undefined
589
+ const endY = axisOf("y", to, resting)
590
+ if (Predicate.isUndefined(endY)) return undefined
591
+ const at = path({ x: startX, y: startY }, { x: endX, y: endY })
592
+ // A path that turns the element says so at its start, as Motion's `interpolate(0).rotate`.
593
+ const end: Values.Values = Bool.match(Predicate.isUndefined(at(0).rotate), {
594
+ onTrue: () => ({ x: endX, y: endY }),
595
+ onFalse: () => ({ x: endX, y: endY, pathRotation: 0 }),
596
+ })
597
+ return { leg: pathLegOf(at, end, run), rest: Rec.filter(to, (_, key) => Bool.not(Arr.contains(AXES, key as "x"))) }
598
+ }
599
+
600
+ export const legsOf = (
601
+ from: Values.Values,
602
+ to: Values.Values,
603
+ given: WardicTransition | undefined,
604
+ reducedMotion: boolean,
605
+ skipped: boolean,
606
+ positionalKeys: ReducedMotion.PositionalKeys["Service"],
607
+ defaults: DefaultTransition.DefaultTransition["Service"],
608
+ velocities: Velocities,
609
+ follow?: Follows | undefined,
610
+ stops?: StopsByKey | undefined,
611
+ measured?: MeasuredPairs | undefined,
612
+ current?: Values.Values | undefined,
613
+ rests?: Values.Values | undefined,
614
+ ): ReadonlyArray<Leg> => {
615
+ // A Path (#438): `x` and `y` along it, on a leg of their own, and every other key as before.
616
+ const pathed = pathOf(from, to, given, reducedMotion, skipped, defaults, stops, current, rests)
617
+ if (Predicate.isNotUndefined(pathed)) {
618
+ return Arr.prepend(legsOf(from, pathed.rest, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured), pathed.leg)
619
+ }
620
+ // Each key on its own transition (#301): with entries, the keys go by the transition each runs on.
621
+ const entries = entriesOf(given)
622
+ if (Predicate.isUndefined(entries)) return legsOn(from, to, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured)
623
+ // With no value's entry (`layout` and `default` alone), every key runs on one transition.
624
+ if (Bool.not(entries.byValue)) return legsOn(from, to, forKey(entries, "default"), reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured)
625
+ const byTransition = new Map<WardicTransition, Record<string, number | string>>()
626
+ Arr.forEach(Rec.keys(to), (key) => {
627
+ const runsOn = forKey(entries, key)
628
+ const keys = byTransition.get(runsOn)
629
+ if (Predicate.isNotUndefined(keys)) {
630
+ keys[key] = to[key] as number | string
631
+ return
632
+ }
633
+ byTransition.set(runsOn, { [key]: to[key] as number | string })
634
+ })
635
+ return Arr.flatMap(Arr.fromIterable(byTransition), ([runsOn, keys]) => legsOn(from, keys, runsOn, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured))
636
+ }
637
+
638
+ /** No legs: a Retarget with no key. */
639
+ const NO_LEGS: ReadonlyArray<Leg> = []
640
+
641
+ /** Each key's Measured pair (#430), by its key. */
642
+ export type MeasuredPairs = Readonly<Record<string, MeasuredPair.Requested>>
643
+
644
+ /** Whether any key of `values` is a Measured pair (#430): per Retarget, so nothing made. */
645
+ const anyMeasured = (values: Values.Values, measured: MeasuredPairs | undefined): boolean => {
646
+ if (Predicate.isUndefined(measured)) return false
647
+ return Rec.some(values, (_, key) => Object.hasOwn(measured, key))
648
+ }
649
+
650
+ /**
651
+ * Measured pairs' leg (#430): their ends in px, read at its first step, which comes a tick after the
652
+ * end-of-task batch that measures them. A tween runs a 0 → 1 progress (`keyframes`' options, so
653
+ * `times`, an `ease` per Interval and the Modifiers apply), a spring the px. Its last frame writes each
654
+ * target as given (`"auto"`, `"50%"`), as Motion's `finalKeyframe`, or each start as given when a turned
655
+ * `repeat` ends it there. A pair its batch couldn't read switches, as a Discrete pair does.
656
+ */
657
+ const measuredLegOf = (pairs: MeasuredPairs, transition: Run): Blend => {
658
+ const to = Rec.map(pairs, (pair) => pair.to)
659
+ return { _tag: "Blend", to, machine: () => Effect.succeed(measuredMachine(pairs, to, transition)) }
660
+ }
661
+
662
+ /** {@link measuredLegOf}'s machine: its step made at the first step, once the pairs are measured. */
663
+ const measuredMachine = (pairs: MeasuredPairs, to: Values.Values, transition: Run): Machine.Machine<Frame.Frame<Values.Values>> =>
664
+ Machine.make({
665
+ settles: Bool.or(transition.type === "spring", Number.isFinite(UndefinedOr.match((transition as Machine.Modifiers).repeat, { onUndefined: () => 0, onDefined: identity }))),
666
+ span: { name: "wardic.measured", attributes: { keys: Rec.keys(pairs).length } },
667
+ start: () => {
668
+ let step: ((dt: number) => Frame.Frame<Values.Values>) | undefined
669
+ return (dt) => {
670
+ if (Predicate.isUndefined(step)) step = measuredStep(pairs, to, transition)
671
+ return step(dt)
672
+ }
673
+ },
674
+ })
675
+
676
+ /** {@link measuredMachine}'s step, its pairs measured, or a switch when its batch couldn't read one. Per frame: one Frame a step. */
677
+ const measuredStep = (pairs: MeasuredPairs, to: Values.Values, transition: Run): ((dt: number) => Frame.Frame<Values.Values>) => {
678
+ const all = Option.all(Rec.map(pairs, MeasuredPair.measured))
679
+ if (Option.isNone(all)) return () => ({ value: to, done: true })
680
+ const fromPx = Rec.map(all.value, (pair) => pair.fromPx)
681
+ const toPx = Rec.map(all.value, (pair) => pair.toPx)
682
+ if (transition.type === "spring") {
683
+ const spring = Machine.springValues(toPx, transition as Machine.SpringOptions, { from: fromPx }).start()
684
+ return (dt) => {
685
+ const frame = spring(dt)
686
+ if (frame.done) return { value: to, done: true }
687
+ return { value: frame.value, done: false }
688
+ }
689
+ }
690
+ const options = transition as Machine.KeyframesOptions
691
+ const progress = Machine.keyframes([0, 1], options).start()
692
+ // A turned `repeat` can end it at its start (`ReducedMotion.endOf`): the starts as given then.
693
+ const end = Bool.match(ReducedMotion.endOf(false, true, options), { onTrue: () => to, onFalse: () => Rec.map(pairs, (pair) => pair.from) })
694
+ return (dt) => {
695
+ const frame = progress(dt)
696
+ if (frame.done) return { value: end, done: true }
697
+ return { value: Rec.map(fromPx, (start, key) => start + (UndefinedOr.getOrThrow(toPx[key]) - start) * frame.value), done: false }
698
+ }
699
+ }
700
+
701
+ /** No numbers: a spring whose transition gives every key its velocity (#464). */
702
+ const NO_NUMBERS: Record<string, number> = {}
703
+
704
+ /** No values: the failed leg of Keyframes on a spring draws none (#429). */
705
+ const NO_VALUES: Values.Values = {}
706
+
707
+ /** Whether `key` has Keyframes of more than two stops in `stops` (#429): none without any. */
708
+ const hasStops = (stops: StopsByKey | undefined, key: string): boolean => {
709
+ if (Predicate.isUndefined(stops)) return false
710
+ return Object.hasOwn(stops, key)
711
+ }
712
+
713
+ /** Whether any key of `values` has Keyframes of more than two stops (#429): per Retarget, so nothing made. */
714
+ const anyKeyframed = (values: Values.Values, stops: StopsByKey | undefined): boolean => {
715
+ if (Predicate.isUndefined(stops)) return false
716
+ return Rec.some(values, (_, key) => Object.hasOwn(stops, key))
717
+ }
718
+
719
+ /** Each key's stops (#429): its Keyframes', or its start and target. */
720
+ const stopsFor = (from: Values.Values, to: Values.Values, stops: StopsByKey | undefined): StopsByKey =>
721
+ Rec.map(to, (target, key): ReadonlyArray<number | string> => {
722
+ if (hasStops(stops, key)) return (stops as StopsByKey)[key] as ReadonlyArray<number | string>
723
+ return [UndefinedOr.getOrThrow(from[key]), target]
724
+ })
725
+
726
+ /**
727
+ * {@link legsOf} on one transition: as it runs, or, when it defines none, each key on its Default
728
+ * transition (ADR-0051), the keys that share one on one leg's worth.
729
+ */
730
+ const legsOn = (
731
+ from: Values.Values,
732
+ to: Values.Values,
733
+ given: WardicTransition | undefined,
734
+ reducedMotion: boolean,
735
+ skipped: boolean,
736
+ positionalKeys: ReducedMotion.PositionalKeys["Service"],
737
+ defaults: DefaultTransition.DefaultTransition["Service"],
738
+ velocities: Velocities,
739
+ follow: Follows | undefined,
740
+ stops: StopsByKey | undefined,
741
+ measured: MeasuredPairs | undefined,
742
+ ): ReadonlyArray<Leg> => {
743
+ const run = runOf(given)
744
+ if (Predicate.isNotUndefined(run)) {
745
+ if (run.type === "inertia") return inertiaLegsOn(from, to, run as Run & InertiaRun, given, reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured)
746
+ return legsWith(from, to, run, reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured)
747
+ }
748
+ const keys = Rec.keys(to)
749
+ if (keys.length === 0) return NO_LEGS
750
+ // Nearly always one Default transition for every key (a fade, a move): no grouping.
751
+ const first = defaultFor(defaults, UndefinedOr.getOrThrow(keys[0]), to, stops)
752
+ if (Arr.every(keys, (key) => defaultFor(defaults, key, to, stops) === first)) {
753
+ return legsWith(from, to, carried(first, given), reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured)
754
+ }
755
+ const byDefault = new Map<DefaultTransition.Transition | DefaultTransition.KeyframesTransition, Record<string, number | string>>()
756
+ Arr.forEach(keys, (key) => {
757
+ const runsOn = defaultFor(defaults, key, to, stops)
758
+ const grouped = byDefault.get(runsOn)
759
+ if (Predicate.isNotUndefined(grouped)) {
760
+ grouped[key] = to[key] as number | string
761
+ return
762
+ }
763
+ byDefault.set(runsOn, { [key]: to[key] as number | string })
764
+ })
765
+ return Arr.flatMap(Arr.fromIterable(byDefault), ([runsOn, grouped]) => legsWith(from, grouped, carried(runsOn, given), reducedMotion, skipped, positionalKeys, velocities, follow, stops, measured))
766
+ }
767
+
768
+ /**
769
+ * The Default transition `key` runs on (ADR-0051): its Environment's for it, toward its target, or,
770
+ * through Keyframes of more than two stops, its Environment's keyframes one (#429, Motion's).
771
+ */
772
+ const defaultFor = (
773
+ defaults: DefaultTransition.DefaultTransition["Service"],
774
+ key: string,
775
+ to: Values.Values,
776
+ stops: StopsByKey | undefined,
777
+ ): DefaultTransition.Transition | DefaultTransition.KeyframesTransition => {
778
+ if (hasStops(stops, key)) return defaults.keyframes
779
+ return defaults.transitionFor(key, to[key] as number | string)
780
+ }
781
+
782
+ /**
783
+ * A Default transition with what the transition that defines none still says: its `delay` (a
784
+ * stagger's among it, ADR-0007), its reduced-motion opt-out and its `skipAnimations` (#468). The
785
+ * Default transition itself when it says none, as nearly every element's (it has no transition).
786
+ */
787
+ const carried = (runsOn: DefaultTransition.Transition | DefaultTransition.KeyframesTransition, given: WardicTransition | undefined): Run => {
788
+ if (Predicate.isUndefined(given)) return runsOn
789
+ const { delay, respectReducedMotion, skipAnimations } = given
790
+ // Per Retarget (#460): statements.
791
+ if (Predicate.isUndefined(delay) && Predicate.isUndefined(respectReducedMotion) && Predicate.isUndefined(skipAnimations)) return runsOn
792
+ return { ...runsOn, ...Rec.filter({ delay, respectReducedMotion, skipAnimations }, Predicate.isNotUndefined) } as Run
793
+ }
794
+
795
+ /** The keys reduced motion snaps (ADR-0029), when it applies; else none, every key animating. */
796
+ const reducedSplitOf = (to: Values.Values, applies: boolean, positionalKeys: ReducedMotion.PositionalKeys["Service"]): ReducedMotion.Split => {
797
+ if (applies) return ReducedMotion.split(to, positionalKeys)
798
+ return { positional: {}, rest: to }
799
+ }
800
+
801
+ /** {@link legsOf} on one transition as it runs. */
802
+ const legsWith = (
803
+ from: Values.Values,
804
+ to: Values.Values,
805
+ transition: Run,
806
+ reducedMotion: boolean,
807
+ skipped: boolean,
808
+ positionalKeys: ReducedMotion.PositionalKeys["Service"],
809
+ velocities: Velocities,
810
+ follow: Follows | undefined,
811
+ stops: StopsByKey | undefined,
812
+ measured: MeasuredPairs | undefined,
813
+ ): ReadonlyArray<Leg> => {
814
+ // A **Skipped animation** (#468, Motion's `skipAnimations`): every key lands where its leg would end,
815
+ // on its first tick, with no delay and whatever reduced motion says. Keyframes land on their last
816
+ // stop, a turned `repeat` where it ends, a Measured pair on its target as given, and a return to a
817
+ // moving Live value on where it is now, its follower taking over once it lands.
818
+ // Per Retarget (#460, compose once): statements.
819
+ if (skipped || transition.skipAnimations === true) return [snapLeg(from, to, Rec.map(to, (target, key) => endOfLeg(from, target, key, transition, velocities)), NO_DELAY)]
820
+ // An inertia's numbers (#435): its other keys went to their Default transitions ({@link inertiaLegsOn}).
821
+ if (transition.type === "inertia") return inertiaLegsWith(from, to, transition as InertiaRun, reducedMotion, positionalKeys, velocities, stops)
822
+ const useTween = transition.type === "tween"
823
+ // Reduced motion (ADR-0029): the positional keys snap to where their leg would end, holding
824
+ // through the delay it would hold, and the rest animate as they would. A transition opts out with
825
+ // `respectReducedMotion: false`.
826
+ const respects = transition.respectReducedMotion !== false
827
+ const { positional, rest } = reducedSplitOf(to, respects && reducedMotion, positionalKeys)
828
+ const snapping = hasKeys(positional)
829
+ let followingKeys = NO_KEYS
830
+ if (Predicate.isNotUndefined(follow)) followingKeys = follow.keysOf(rest)
831
+ const following = followingKeys.length > 0
832
+ let fixed = rest
833
+ if (following) fixed = Rec.filter(rest, (_, key) => !Arr.contains(followingKeys, key))
834
+ // Built a leg at a time, once a Retarget (#69's PR 2: a Retarget is per element, so no spreads).
835
+ const legs: Array<Leg> = []
836
+ // Measured pairs (#430): a leg of their own, between their ends in px, on this transition.
837
+ const measuring = anyMeasured(fixed, measured)
838
+ if (measuring) {
839
+ const kept = fixed
840
+ const pairs = Rec.filter(measured as MeasuredPairs, (_, key) => Object.hasOwn(kept, key))
841
+ legs.push(measuredLegOf(pairs, transition))
842
+ fixed = Rec.filter(kept, (_, key) => !Object.hasOwn(pairs, key))
843
+ }
844
+ if (useTween) {
845
+ // Its options as they are: a missing `duration` is core's 0.3 s, and the rest still apply (#107).
846
+ const options = transition as Machine.KeyframesOptions
847
+ // A tween's snap lands where the tween would end: `repeat` and `reverse` can end it at `from`, a
848
+ // Keyframes key's first stop (#429). Its delay alone is read: an `ease` per Interval isn't a tween's.
849
+ if (snapping) {
850
+ legs.push(snapLeg(from, positional, Rec.map(positional, (to, key) => ReducedMotion.endOf(UndefinedOr.getOrThrow(from[key]), to, options)), () => Machine.resolveTween(Rec.filter({ delay: options.delay }, Predicate.isNotUndefined)).delay))
851
+ }
852
+ // A following return eases toward where its Live value is each frame, so it lands on it.
853
+ if (following) Arr.forEach(followingKeys, (key) => {
854
+ const start = from[key] as number
855
+ const target = UndefinedOr.getOrThrow(follow).targetOf(key, start)
856
+ legs.push({
857
+ _tag: "Follow",
858
+ key,
859
+ to: { [key]: UndefinedOr.getOrThrow(rest[key]) },
860
+ machine: () =>
861
+ Machine.map(Machine.animate(0, 1, options as Machine.AnimateOptions), (progress) => ({
862
+ value: start + (target() - start) * progress.value,
863
+ done: progress.done,
864
+ })),
865
+ })
866
+ })
867
+ // With every key snapped, following or measured, there's nothing left to tween.
868
+ if ((!snapping && !following && !measuring) || hasKeys(fixed)) {
869
+ // A key's Keyframes, or `times` or an `ease` per Interval, run every key through `keyframesValues`
870
+ // (#429), on one run, a target as its two stops.
871
+ if (anyKeyframed(fixed, stops) || keyframedOptions(options)) {
872
+ legs.push({ _tag: "Blend", to: fixed, machine: () => Machine.keyframesValues(stopsFor(from, fixed, stops), options) })
873
+ return legs
874
+ }
875
+ legs.push({ _tag: "Blend", to: fixed, machine: () => Machine.animateValues(Values.pick(from, fixed), fixed, options as Machine.AnimateOptions) })
876
+ }
877
+ return legs
878
+ }
879
+ // Spring (default): numeric keys via springValues (velocity-carrying Retarget); any string/colour
880
+ // keys via springBlend, the same spring on a 0→100 progress (ADR-0024, D5).
881
+ const springOpts = transition as Machine.SpringOptions
882
+ // Keyframes of more than two stops on a spring (#429): Motion's error, a leg that fails as it's
883
+ // built, and each such key snapped to its last stop.
884
+ if (anyKeyframed(fixed, stops)) {
885
+ const kept = fixed
886
+ const many = Rec.filter(stops as StopsByKey, (_, key) => Object.hasOwn(kept, key))
887
+ const ends = Rec.filter(kept, (_, key) => Object.hasOwn(many, key))
888
+ legs.push(snapLeg(from, ends, ends, () => Spring.resolve(springOpts).delay))
889
+ legs.push({ _tag: "Blend", to: NO_VALUES, machine: () => Effect.die(springStopsError(many)) })
890
+ fixed = Rec.filter(kept, (_, key) => !Object.hasOwn(many, key))
891
+ }
892
+ const { numbers: numeric, strings } = Values.split(fixed)
893
+ // A spring settles at its target: the snap lands there.
894
+ if (snapping) legs.push(snapLeg(from, positional, positional, () => Spring.resolve(springOpts).delay))
895
+ // A following return chases its Live value, read each step, and settles at rest on it.
896
+ if (following) Arr.forEach(followingKeys, (key) => {
897
+ const start = from[key] as number
898
+ let velocity = springOpts.velocity
899
+ if (Predicate.isUndefined(velocity)) velocity = velocities(key)
900
+ const chase = Machine.chase(UndefinedOr.getOrThrow(follow).targetOf(key, start), { ...springOpts, from: start, velocity })
901
+ legs.push({ _tag: "Follow", key, to: { [key]: UndefinedOr.getOrThrow(rest[key]) }, machine: () => settling(chase) })
902
+ })
903
+ if (hasKeys(numeric)) {
904
+ const fromNumeric: Record<string, number> = Rec.map(numeric, (_, key) => from[key] as number)
905
+ // Each key's own velocity, read now; none when the transition gives one, which every key then starts with.
906
+ let fromVelocity: Record<string, number> = NO_NUMBERS
907
+ if (Predicate.isUndefined(springOpts.velocity)) fromVelocity = Rec.map(numeric, (_, key) => velocities(key))
908
+ legs.push({ _tag: "Numbers", to: numeric, machine: () => Machine.springValues(numeric, springOpts, { from: fromNumeric, velocity: fromVelocity }) })
909
+ }
910
+ if (hasKeys(strings)) {
911
+ const fromStrings: Values.Values = Rec.map(strings, (_, key) => UndefinedOr.getOrThrow(from[key]))
912
+ legs.push({ _tag: "Blend", to: strings, machine: () => Machine.springBlend(fromStrings, strings, springOpts) })
913
+ }
914
+ return legs
915
+ }
916
+
917
+ /** What a leg's machine can be run through: the same Frames, stepped another way. */
918
+ export type MachineMap = <F extends Frame.Frame<unknown>>(machine: Machine.Machine<F>) => Machine.Machine<F>
919
+
920
+ /**
921
+ * `leg` with its machine run through `f`: started partway ({@link startingAt}), or through an
922
+ * **Imperative animation**'s Playhead (#433, `Playback.drive`).
923
+ */
924
+ export const mapMachine = (leg: Leg, f: MachineMap): Leg => mapMachineMatch({ leg, f })
925
+
926
+ /** {@link mapMachine}'s cases, built once at module load: it runs per element at hydration (#69's PR 2). */
927
+ const mapMachineMatch: (input: { readonly leg: Leg; readonly f: MachineMap }) => Leg = Match.type<{ readonly leg: Leg; readonly f: MachineMap }>().pipe(
928
+ Match.when({ leg: { _tag: "Blend" } }, ({ leg, f }): Leg => ({ ...leg, machine: () => Effect.map(leg.machine(), f) })),
929
+ Match.orElse(({ leg, f }): Leg => {
930
+ const plain = leg as Exclude<Leg, Blend>
931
+ return { ...plain, machine: () => f(plain.machine() as Machine.Machine<Frame.Frame<unknown>>) } as Leg
932
+ }),
933
+ )
934
+
935
+ /**
936
+ * `leg`, started `at()` seconds in (`Machine.startAt`): a Handoff's first legs, which pick up an
937
+ * Appear animation where its CSS has got (#48, ADR-0044 decision 6).
938
+ */
939
+ export const startingAt = (leg: Leg, at: LazyArg<number>): Leg => mapMachine(leg, Machine.startAt(at))
940
+
941
+ /**
942
+ * Where `key`'s leg would end (#468): an inertia's where its glide rests (#435, `Inertia.restOf`), from
943
+ * its velocity, whatever its target; any other's at its target, or where a turned `repeat` ends.
944
+ */
945
+ const endOfLeg = (from: Values.Values, target: number | string, key: string, transition: Run, velocities: Velocities): number | string => {
946
+ const start = UndefinedOr.getOrThrow(from[key])
947
+ if (transition.type !== "inertia") return ReducedMotion.endOf(start, target, transition as Machine.Modifiers)
948
+ return Inertia.restOf(start as number, inertiaVelocityOf(transition as InertiaRun, velocities, key), transition as InertiaRun)
949
+ }
950
+
951
+ /** A key's velocity under an inertia (#435): the transition's `velocity`, else its own (#464). */
952
+ const inertiaVelocityOf = (run: InertiaRun, velocities: Velocities, key: string): number =>
953
+ UndefinedOr.match(run.velocity, { onUndefined: () => velocities(key), onDefined: identity })
954
+
955
+ /**
956
+ * {@link legsOf} on an inertia (#435, Q2): the numbers glide on it ({@link inertiaLegsWith}); every
957
+ * other key, and a return following a moving Live value, runs on its Default transition, as if the
958
+ * transition defined none for it, its `delay`, reduced-motion opt-out and `skipAnimations` kept.
959
+ */
960
+ const inertiaLegsOn = (
961
+ from: Values.Values,
962
+ to: Values.Values,
963
+ run: Run & InertiaRun,
964
+ given: WardicTransition | undefined,
965
+ reducedMotion: boolean,
966
+ skipped: boolean,
967
+ positionalKeys: ReducedMotion.PositionalKeys["Service"],
968
+ defaults: DefaultTransition.DefaultTransition["Service"],
969
+ velocities: Velocities,
970
+ follow: Follows | undefined,
971
+ stops: StopsByKey | undefined,
972
+ measured: MeasuredPairs | undefined,
973
+ ): ReadonlyArray<Leg> => {
974
+ let followingKeys = NO_KEYS
975
+ if (Predicate.isNotUndefined(follow)) followingKeys = follow.keysOf(to)
976
+ const glides = (target: number | string, key: string): boolean =>
977
+ Bool.and(Bool.and(Predicate.isNumber(target), Predicate.isNumber(from[key])), Bool.not(Arr.contains(followingKeys, key)))
978
+ const numbers = Rec.filter(to, glides)
979
+ const rest = Rec.filter(to, (target, key) => Bool.not(glides(target, key)))
980
+ const legs: Array<Leg> = []
981
+ if (hasKeys(numbers)) Arr.forEach(legsWith(from, numbers, run, reducedMotion, skipped, positionalKeys, velocities, undefined, stops, undefined), (leg) => legs.push(leg))
982
+ if (hasKeys(rest)) Arr.forEach(legsOn(from, rest, definingNone(given), reducedMotion, skipped, positionalKeys, defaults, velocities, follow, stops, measured), (leg) => legs.push(leg))
983
+ return legs
984
+ }
985
+
986
+ /** A transition's fields that define none: its `delay`, reduced-motion opt-out and `skipAnimations`, on a Default transition. */
987
+ const definingNone = (given: WardicTransition | undefined): WardicTransition | undefined =>
988
+ UndefinedOr.map(given, ({ delay, respectReducedMotion, skipAnimations }) => Rec.filter({ delay, respectReducedMotion, skipAnimations }, Predicate.isNotUndefined) as WardicTransition)
989
+
990
+ /**
991
+ * An inertia's legs over numbers (#435): each glides from where it is at its velocity, on
992
+ * `Machine.inertiaValues`, whatever its target. Under reduced motion its positional keys land where
993
+ * their glides rest, after its delay (ADR-0029); Keyframes of more than two stops fail, as a spring's
994
+ * (#429, Motion's two-keyframe invariant), each such key landing on its last stop.
995
+ */
996
+ const inertiaLegsWith = (
997
+ from: Values.Values,
998
+ to: Values.Values,
999
+ run: InertiaRun,
1000
+ reducedMotion: boolean,
1001
+ positionalKeys: ReducedMotion.PositionalKeys["Service"],
1002
+ velocities: Velocities,
1003
+ stops: StopsByKey | undefined,
1004
+ ): ReadonlyArray<Leg> => {
1005
+ const legs: Array<Leg> = []
1006
+ const delay = (): number => UndefinedOr.match(run.delay, { onUndefined: () => 0, onDefined: identity })
1007
+ let fixed = to
1008
+ if (anyKeyframed(fixed, stops)) {
1009
+ const kept = fixed
1010
+ const many = Rec.filter(stops as StopsByKey, (_, key) => Object.hasOwn(kept, key))
1011
+ const ends = Rec.filter(kept, (_, key) => Object.hasOwn(many, key))
1012
+ legs.push(snapLeg(from, ends, ends, delay))
1013
+ legs.push({ _tag: "Blend", to: NO_VALUES, machine: () => Effect.die(springStopsError(many, "an inertia")) })
1014
+ fixed = Rec.filter(kept, (_, key) => !Object.hasOwn(many, key))
1015
+ }
1016
+ if (Bool.and(reducedMotion, (run as Run).respectReducedMotion !== false)) {
1017
+ const { positional, rest } = ReducedMotion.split(fixed, positionalKeys)
1018
+ if (hasKeys(positional)) {
1019
+ legs.push(snapLeg(from, positional, Rec.map(positional, (_, key) => Inertia.restOf(from[key] as number, inertiaVelocityOf(run, velocities, key), run)), delay))
1020
+ }
1021
+ fixed = rest
1022
+ }
1023
+ if (hasKeys(fixed)) {
1024
+ const starts: Record<string, number> = Rec.map(fixed, (_, key) => from[key] as number)
1025
+ // Each key's own velocity, read now (#464); none when the transition gives one, which every key then starts with.
1026
+ const own: Record<string, number> = Bool.match(Predicate.isUndefined(run.velocity), {
1027
+ onTrue: () => Rec.map(fixed, (_, key) => velocities(key)),
1028
+ onFalse: () => NO_NUMBERS,
1029
+ })
1030
+ legs.push({ _tag: "Numbers", to: fixed, machine: () => Machine.inertiaValues(starts, run, { velocity: own }) })
1031
+ }
1032
+ return legs
1033
+ }
1034
+
1035
+ /** No delay: a Skipped animation's snap (#468). */
1036
+ const NO_DELAY = (): number => 0
1037
+
1038
+ /** The snap's leg: the positional keys, from where they are to `to`, after `delay()`. */
1039
+ const snapLeg = (from: Values.Values, positional: Values.Values, to: Values.Values, delay: () => number): Snap => ({
1040
+ _tag: "Snap",
1041
+ keys: Rec.keys(positional),
1042
+ to: positional,
1043
+ machine: () => ReducedMotion.snap(Values.pick(from, positional), to, { delay: delay() }),
1044
+ })
1045
+
1046
+ /** `chase`, ending at its first Frame at rest on its target: a return to a moving Live value (#130). */
1047
+ const settling = <F extends Frame.Frame<unknown>>(chase: Machine.Machine<F>): Machine.Machine<F> =>
1048
+ Machine.make({ start: chase.start, settles: true, span: chase.span })