@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,937 @@
1
+ /**
2
+ * The binding-orchestrated drag track (ADR-0004 response half), Solid-free (#209): each binding
3
+ * runs it through `driveDragTrack`, handing it a `watch` for its element's watch Scope, a `fork` for
4
+ * its responses and a `setDragging` for its `dragging` signal. The Solid 1 binding's `runDragTrack`
5
+ * (`drag.ts`) wraps it.
6
+ *
7
+ * DESIGN (locked via grilling, subtask 22c): on a drag-enabled element `x`/`y`
8
+ * are DIRECT-SET by the pointer (1:1, NOT sprung) while the spring spine keeps
9
+ * driving every OTHER key + `whileDrag`. Ownership of `x`/`y` is DYNAMIC: the
10
+ * drag owns them while held AND during the release tail; once the release
11
+ * settles, ownership returns to the spring (so a later `animate.x`/`y` or a
12
+ * layout/Reorder FLIP can take over from the rested position). A Retarget that
13
+ * changes `x` or `y` during the release takes them over sooner (#340, ADR-0016
14
+ * *Amendment (#340)*), as a newer animation of Motion's value does: the release
15
+ * stops where it is, tells no end, and the spring goes on from there, at the
16
+ * release's velocity ({@link DragTrack.takeRelease}).
17
+ *
18
+ * This module is the RESPONSE half (binding orchestration). Core ships the
19
+ * RECOGNITION (`drag()`, kept to its axis and holding its **Drag claim**), the
20
+ * constraint (`Drag.constrain`) and the inertia PRIMITIVE (`inertia`, `inertiaVec`); the
21
+ * constraints on the element's x/y, the release driver, the gate writes, and the
22
+ * snapshot sync are response concerns and live here (ADR-0004, ADR-0016 *Amendment (#140)*).
23
+ *
24
+ * STRUCTURE (ADR-0032, ADR-0055 *Amendment (#379)*): input is handled inside its event, by two
25
+ * watches in the element's watch Scope, with no fiber of the track's own at rest:
26
+ * - the drag's samples (`DragRecognizer.watchDrag`): a gesture's bookkeeping, then the direct-set,
27
+ * or at the "end" the release;
28
+ * - bare pointer-downs from the Primary pointer ("grabs", `InputFeed.watch`), which stop a
29
+ * running release, so a re-grab mid-release stops the tail where it is, and the ends of its
30
+ * presses, which let a projection node's release go on after a press that didn't drag.
31
+ * Each response is an Effect, run by `fork` on the provider runtime: its fiber starts at once and
32
+ * runs to its end inside the event (stopping a release interrupts a parked fiber in the caller's
33
+ * stack), and a release it starts, in a `FiberHandle`, is forked from it, keeping the runtime's
34
+ * scheduler, so it is on the Frame loop before its task ends. The next sample or grab interrupts it,
35
+ * which removes it from the loop at once. A response that fails is reported, and the next event's
36
+ * runs (ADR-0055 *Amendment (#379)*, Q4).
37
+ *
38
+ * **Drag controls** (#431, Motion's `useDragControls`) given to the element start its drag from a
39
+ * pointer pressed elsewhere: the track hands it to the element's pointer feed
40
+ * (`InputSource.adoptPointer`), whose adopted down the recognizer starts from as from a press on the
41
+ * element, and its grab stops a running release. `snapToCursor` moves the element's centre under the
42
+ * pointer there and then; `distanceThreshold` is that gesture's threshold. Their `stop` ends the drag
43
+ * as a release would; `cancel` ends it where it is, with no release and no `onDragEnd`. With
44
+ * `listen: false` (Motion's `dragListener={false}`) the element's own presses neither drag it nor stop
45
+ * its release. The track subscribes to the controls while its watch Scope is open, so an element an
46
+ * `<AnimatePresence>` is taking out (disposed) starts none, as Motion's doesn't.
47
+ *
48
+ * The samples subscribe before the grabs, so one event's samples reach the track
49
+ * before its grab: a Stale gesture's "end" (ADR-0019, rule B) starts its release and
50
+ * the grab of the same down stops it before its first frame, on every Environment.
51
+ * The track's state is a plain `MutableRef`: each response runs to completion, and a
52
+ * release is stopped before the next response changes the state.
53
+ */
54
+ import * as Drag from "@wardic/core/Drag"
55
+ import type * as FrameLoop from "@wardic/core/FrameLoop"
56
+ import * as Inertia from "@wardic/core/Inertia"
57
+ import * as InputFeed from "@wardic/core/InputFeed"
58
+ import * as InputSource from "@wardic/core/InputSource"
59
+ import type * as Point from "@wardic/core/Point"
60
+ import * as DragRecognizer from "@wardic/core/DragRecognizer"
61
+ import type * as Values from "@wardic/core/Values"
62
+ import * as Machine from "@wardic/core/Machine"
63
+ import * as Microtask from "@wardic/core/Microtask"
64
+ import * as Probe from "@wardic/core/Probe"
65
+ import type * as FlushGate from "@wardic/dom/FlushGate"
66
+ import type * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
67
+ import * as Report from "@wardic/dom/Report"
68
+ import * as Bool from "effect/Boolean"
69
+ import * as Cause from "effect/Cause"
70
+ import * as Deferred from "effect/Deferred"
71
+ import * as Effect from "effect/Effect"
72
+ import * as Exit from "effect/Exit"
73
+ import * as FiberHandle from "effect/FiberHandle"
74
+ import { constFalse, constUndefined, constVoid, identity } from "effect/Function"
75
+ import * as Match from "effect/Match"
76
+ import * as MutableRef from "effect/MutableRef"
77
+ import * as Option from "effect/Option"
78
+ import * as Predicate from "effect/Predicate"
79
+ import type * as Scope from "effect/Scope"
80
+ import * as Stream from "effect/Stream"
81
+ import * as UndefinedOr from "effect/UndefinedOr"
82
+ import type { DragContainer } from "./drag-constraints.ts"
83
+ import type { WardicServices } from "./runtime.ts"
84
+ import type { WardicTransformPoint } from "./config.ts"
85
+ import { subscribeDragControls, type WardicDragControls } from "./drag-controls.ts"
86
+ import { DEFAULT_DRAG_ELASTIC, dragTransitionOf, elasticOf } from "./drag-transition.ts"
87
+ import { pointMapOptionOf } from "./wardic-config-value.ts"
88
+
89
+
90
+ /**
91
+ * The element's values as its drag reads and writes them: `values` and `velocities` by key, when `x`
92
+ * and `y` last moved, and the clock's time. The drag goes on from where the element is, and leaves it
93
+ * where the drag left it, its speed with it.
94
+ */
95
+ // The spine's mutable Snapshot, the same object `runSpine` holds: each key's last value, a number or a
96
+ // string (ADR-0024).
97
+ export interface DragSnapshot {
98
+ values: Values.Values
99
+ velocities: Record<string, number>
100
+ /** When the drag last moved `x` and `y`: their velocity holds 30 ms from then. */
101
+ drawnAt: Record<string, number>
102
+ /** The time now, on the element's provider's Clock. */
103
+ readonly now: () => number
104
+ }
105
+
106
+ /** A drag's config, read once as it starts: the `drag` props of a Wardic element. */
107
+ export interface DragTrackConfig {
108
+ /** `true` = free; `"x"`/`"y"` = axis-locked. */
109
+ readonly axis: boolean | "x" | "y"
110
+ /**
111
+ * `true`: the drag takes no **Drag claim** and is never refused, so a draggable ancestor can
112
+ * drag with it (Motion's `dragPropagation`). Default `false`.
113
+ */
114
+ readonly propagation?: boolean | undefined
115
+ /**
116
+ * Optional numeric constraints (per axis) on the element's x/y, whichever gesture moved it there
117
+ * (Motion's): the drag keeps it within them, and a Fling springs back
118
+ * to an edge it would cross. A projection node's x/y is its drag offset.
119
+ */
120
+ readonly constraints?: Drag.Bounds | undefined
121
+ /** Rubber-band resistance past `constraints`: 0 a hard clamp. Default {@link DEFAULT_DRAG_ELASTIC}. */
122
+ readonly elastic?: number | undefined
123
+ /** Fling on release (default true); `false` releases with no velocity. */
124
+ readonly momentum?: boolean | undefined
125
+ /** Spring back to the origin on release: both edges at 0. */
126
+ readonly snapToOrigin?: boolean | undefined
127
+ /**
128
+ * Motion's `dragDirectionLock`: each gesture starts once it passes 10 px on one
129
+ * axis, and drags, claims and releases on that axis alone (`DragRecognizer.drag`'s `lock`).
130
+ */
131
+ readonly directionLock?: boolean | undefined
132
+ /** What the release runs on: the element's drag transition, resolved ({@link dragTransitionOf}). */
133
+ readonly transition: ProjectionSystem.DragTransition
134
+ /**
135
+ * Motion's `dragListener`: `false`, the element's own presses start no drag and stop no
136
+ * release; only its **Drag controls**' starts do. Default `true`.
137
+ */
138
+ readonly listen?: boolean | undefined
139
+ }
140
+
141
+ /** What the track's watches and responses run with: the provider's services and the gestures' input (#511). */
142
+ export type TrackServices = WardicServices | InputSource.InputSource
143
+
144
+ /** Options for {@link driveDragTrack}. */
145
+ export interface DragTrackOptions {
146
+ /**
147
+ * Runs the track in the element's watch Scope: its watches subscribed now, with no
148
+ * fiber, until the element goes and the Scope closes, which stops a running release. A throw from a
149
+ * watch's fold goes to the `onDefect` it's given (#209: each binding's Solid owns the Scope).
150
+ */
151
+ readonly watch: (track: (onDefect: InputFeed.OnDefect) => Effect.Effect<void, never, Scope.Scope | TrackServices>) => void
152
+ /**
153
+ * Runs a response forked on the provider runtime: its fiber starts at once and runs to its
154
+ * end inside the event. A release it forks keeps the runtime's scheduler, a host's if it gave one,
155
+ * not a `runSync`'s sync one, which would resume
156
+ * the release's yields on a microtask.
157
+ */
158
+ readonly fork: (response: Effect.Effect<void, never, TrackServices>) => void
159
+ /** The provider-owned flush gate; the drag writes `x`/`y` into `id`. */
160
+ readonly gate: FlushGate.Shape
161
+ /** The element's gate id (shared with the spine, so writes merge). */
162
+ readonly id: string
163
+ /** The live element the drag recognizer attaches to. */
164
+ readonly element: HTMLElement
165
+ /** The spine's Snapshot object (shared — see {@link DragSnapshot}). */
166
+ readonly snapshot: DragSnapshot
167
+ /** Merge a value-map into the presence snapshot (mirrors the spine's recordFrame). */
168
+ readonly recordFrame: (value: Values.Values) => void
169
+ /** Flip the reactive `dragging` signal the spine reads for `whileDrag` + key stripping. */
170
+ readonly setDragging: (dragging: boolean) => void
171
+ /** The static drag config (read once at setup). */
172
+ readonly config: DragTrackConfig
173
+ /**
174
+ * When the element is a projection node, the drag feeds the projection
175
+ * instead of writing raw `x`/`y`, which stay the element's own, drawn on top:
176
+ * grab → `dragStart`, each sample → `dragMove(offset)`, release →
177
+ * `dragEnd(velocity)` (its Release offset — the free tail is skipped), a press →
178
+ * `stopRelease`, a press that ends with no drag → `resumeRelease`. Absent ⇒ free drag.
179
+ */
180
+ readonly projection?: ProjectionSystem.DragHandle | undefined
181
+ /**
182
+ * The gesture's axis, read at each gesture's "start" and held until its "end"
183
+ * (`true` = free), in place of `config.axis`: the axis it moves on and claims
184
+ * (internal: a `<Reorder>` item, whose group decides the axis per gesture, D5).
185
+ */
186
+ readonly axisAt?: (() => boolean | "x" | "y") | undefined
187
+ /**
188
+ * Each sample, after its projection write: after `dragMove` for "start" and
189
+ * "move", after `dragEnd` for "end", so a reader of the handle's `dragOffset()`
190
+ * sees this sample (internal: a `<Reorder>` item's group).
191
+ */
192
+ readonly onSample?: ((sample: Drag.Sample) => void) | undefined
193
+ /**
194
+ * The release came to rest on its own (Motion's `onDragTransitionEnd`): its Fling or its
195
+ * spring back finished, or it was dropped where it rests. Told after the gate's flush of the rest
196
+ * value. Not for one a grab stopped. A free drag's only: a layout node's release is its Release
197
+ * offset, which the projection tells.
198
+ */
199
+ readonly onReleaseEnd?: (() => void) | undefined
200
+ /**
201
+ * Whether its animations are skipped (its nearest `WardicConfig`'s `skipAnimations`), read at
202
+ * each release: a skipped one lands at once where it would come to rest. Omitted, never.
203
+ */
204
+ readonly skipAnimations?: (() => boolean) | undefined
205
+ /**
206
+ * An element constraint (Motion's `dragConstraints={ref}`): the container whose box
207
+ * the element's must stay inside, in place of `config.constraints`. It's measured at each drag's
208
+ * start, and again when the element or the container resizes; a resize that changes the bounds
209
+ * moves an element at rest (or releasing, which it stops) to keep its place within them (Motion's
210
+ * `scalePositionWithinConstraints`). A container not there at a drag's start leaves it unconstrained.
211
+ */
212
+ readonly container?: DragContainer | undefined
213
+ /**
214
+ * The **Drag controls** given to the element (Motion's `dragControls`): the track subscribes to
215
+ * them while its watch Scope is open.
216
+ */
217
+ readonly controls?: WardicDragControls | undefined
218
+ /**
219
+ * Where the drag's points are (its nearest `WardicConfig`'s `transformPagePoint`): read at
220
+ * each down, and applied to its every point and to the box its snap to the cursor measures.
221
+ * Omitted, as they are.
222
+ */
223
+ readonly mapPoint?: (() => WardicTransformPoint | undefined) | undefined
224
+ }
225
+
226
+ /** A point mapping now (#443): the config's, else the point as it is. */
227
+ const mapPointOf = (mapPoint: DragTrackOptions["mapPoint"]): WardicTransformPoint =>
228
+ UndefinedOr.match(UndefinedOr.match(mapPoint, { onUndefined: constUndefined, onDefined: (read) => read() }), { onUndefined: () => identity, onDefined: identity })
229
+
230
+ /** A drag config's axis as core's: `true` (free) is `"xy"`. */
231
+ const toDragAxis = (axis: boolean | "x" | "y"): Drag.Axis =>
232
+ Match.value(axis).pipe(
233
+ Match.when("x", () => "x" as const),
234
+ Match.when("y", () => "y" as const),
235
+ Match.orElse(() => "xy" as const),
236
+ )
237
+
238
+ /**
239
+ * The track's state: `base` is the rebase point, `position` the live absolute position,
240
+ * `held` whether a gesture is on (from its "start" to its "end"), `axis` the axes it
241
+ * moves on, read at its "start", `bounds` the constraints: the config's, or an element
242
+ * constraint's as last measured (#273), and whether a release runs, or a grab stopped one (#279).
243
+ */
244
+ interface DragTrackState {
245
+ readonly base: Point.Point
246
+ readonly position: Point.Point
247
+ readonly held: boolean
248
+ readonly axis: Drag.Axis
249
+ readonly bounds: Drag.Bounds | undefined
250
+ /** A free drag's release runs (#279): set at its start, cleared at its rest. */
251
+ readonly releasing: boolean
252
+ /** A grab stopped that release (#279): a press that ends with no drag starts it again, from rest. */
253
+ readonly stopped: boolean
254
+ /**
255
+ * A layout node's snap to the cursor at its controls' start (#431): its drag offset, the projection's
256
+ * drag begun there, until the gesture starts from it or the press ends with none.
257
+ */
258
+ readonly snapped: Point.Point | undefined
259
+ }
260
+
261
+ /** The track's one cell, written by its handlers and by its release's sink, never at once. */
262
+ type TrackState = MutableRef.MutableRef<DragTrackState>
263
+
264
+ const ORIGIN: Point.Point = { x: 0, y: 0 }
265
+
266
+ /**
267
+ * A projection node's release velocity (ADR-0016, *Amendment (velocity family)*, decision 2):
268
+ * the "end" sample's, the pointer's over its last 100 ms (ADR-0004, *Amendment (#139)*); at
269
+ * rest with `dragMomentum={false}`.
270
+ */
271
+ const releaseVelocity = (config: DragTrackConfig, velocity: Point.Point): Point.Point =>
272
+ Bool.match(config.momentum === false, {
273
+ onTrue: () => ORIGIN,
274
+ onFalse: () => velocity,
275
+ })
276
+
277
+ /**
278
+ * Where the drag puts the element: `p`, kept within the constraints on each axis the gesture moves,
279
+ * pulled back past an edge by `dragElastic` (Motion's `applyConstraints`). They bound the element's
280
+ * x/y, whichever gesture moved it there (ADR-0016, *Amendment (#140)*); an axis it doesn't move stays
281
+ * where it is. Per pointer event: statement `if`s.
282
+ */
283
+ const constrainedTo = (p: Point.Point, axis: Drag.Axis, bounds: Drag.Bounds | undefined, config: DragTrackConfig): Point.Point => {
284
+ if (Predicate.isUndefined(bounds)) return p
285
+ const elastic = elasticOf(config.elastic)
286
+ let x = p.x
287
+ let y = p.y
288
+ if (axis !== "y") x = Drag.constrain(p.x, bounds.x, elastic)
289
+ if (axis !== "x") y = Drag.constrain(p.y, bounds.y, elastic)
290
+ return { x, y }
291
+ }
292
+
293
+ /** Both edges at the origin: what `dragSnapToOrigin` releases toward (Motion's `{ min: 0, max: 0 }`). */
294
+ const AT_ORIGIN: Drag.Bounds = { x: { min: 0, max: 0 }, y: { min: 0, max: 0 } }
295
+ const NO_EDGES: Drag.Bounds = {}
296
+
297
+ /** The edges a release springs back to: both at the origin with `snapToOrigin`, else the constraints. */
298
+ const edgesOf = (config: DragTrackConfig, bounds: Drag.Bounds | undefined): Drag.Bounds =>
299
+ Bool.match(config.snapToOrigin === true, {
300
+ onTrue: () => AT_ORIGIN,
301
+ onFalse: () => UndefinedOr.match(bounds, { onUndefined: () => NO_EDGES, onDefined: identity }),
302
+ })
303
+
304
+ /** Whether `v` sits within `range`, or there's none: a hard clamp leaves it where it is. */
305
+ const within = (v: number, range: Drag.AxisRange | undefined): boolean => Drag.constrain(v, range, 0) === v
306
+
307
+ /**
308
+ * Whether a release with `velocity` from `position` rests where it was dropped: no speed, no
309
+ * `modifyTarget` to move it, and within its edges on each axis it moves. Motion's inertia is done on
310
+ * its first frame then; Wardic commits it at once.
311
+ */
312
+ const restsWhereDropped = (position: Point.Point, velocity: Point.Point, axis: Drag.Axis, edges: Drag.Bounds, transition: ProjectionSystem.DragTransition): boolean =>
313
+ Bool.every([
314
+ velocity.x === 0,
315
+ velocity.y === 0,
316
+ Predicate.isUndefined(transition.modifyTarget),
317
+ Bool.or(axis === "y", within(position.x, edges.x)),
318
+ Bool.or(axis === "x", within(position.y, edges.y)),
319
+ ])
320
+ /**
321
+ * Read the current rested `x`/`y` off the snapshot (defaulting to 0, as for a string
322
+ * translate the drag can't continue from). Captured at a drag's "start" so a drag (or a
323
+ * re-grab mid-release) continues from where the element currently sits instead of
324
+ * snapping to origin.
325
+ */
326
+ const snapshotPos = (snapshot: DragSnapshot): Point.Point => {
327
+ const { x, y } = snapshot.values
328
+ return { x: numberOrZero(x), y: numberOrZero(y) }
329
+ }
330
+
331
+ /** A value that's a number, else 0. Built once, at module load. */
332
+ const numberOrZero: (value: unknown) => number = Match.type<unknown>().pipe(
333
+ Match.when(Match.number, (n) => n),
334
+ Match.orElse(() => 0),
335
+ )
336
+
337
+ /**
338
+ * Direct-set `x`/`y` onto the element + the shared snapshot for one drag frame.
339
+ * The drag is the SOLE owner of `x`/`y` while dragging, so it sets them on the
340
+ * snapshot with zeroed velocities (the spring never fights them — the spine
341
+ * strips the translate keys from its target while `dragging()` is true).
342
+ */
343
+ const directSet = (opts: DragTrackOptions, p: Point.Point): void => {
344
+ // Projection node (ADR-0016): feed the live pointer offset to the projection, whose
345
+ // target moves the node; its own x/y are its animations', drawn on top (#363), so
346
+ // the drag leaves them be. `base` stays 0 and `position` is the pure pointer offset,
347
+ // which IS the dragDelta.
348
+ if (Predicate.isNotUndefined(opts.projection)) {
349
+ opts.projection.dragMove({ x: p.x, y: p.y })
350
+ return
351
+ }
352
+ opts.gate.write(opts.id, { x: p.x, y: p.y })
353
+ opts.snapshot.values.x = p.x
354
+ opts.snapshot.values.y = p.y
355
+ opts.snapshot.velocities.x = 0
356
+ opts.snapshot.velocities.y = 0
357
+ // Moved now (#464): its release's velocity holds from here.
358
+ const now = opts.snapshot.now()
359
+ opts.snapshot.drawnAt.x = now
360
+ opts.snapshot.drawnAt.y = now
361
+ opts.recordFrame({ x: p.x, y: p.y })
362
+ }
363
+
364
+ /**
365
+ * A gesture's bookkeeping, run as each sample arrives, before its response: "start"
366
+ * marks the gesture held; "end" clears it and, for a projection node (ADR-0016), starts its
367
+ * Release offset at the sample's velocity (`dragEnd`) and hands back `dragging`. The "end" is
368
+ * reported after its response, once the release runs, as Motion's `onDragEnd` comes after its
369
+ * release starts: a target for `x`/`y` the app sets there takes it over (#340).
370
+ */
371
+ const settleGesture = (sample: Drag.Sample, state: TrackState, opts: DragTrackOptions): void =>
372
+ Match.value(sample.phase).pipe(
373
+ Match.when("start", () => {
374
+ MutableRef.update(state, (st) => ({ ...st, held: true }))
375
+ }),
376
+ Match.when("move", constVoid),
377
+ Match.when("end", () => {
378
+ MutableRef.update(state, (st) => ({ ...st, held: false }))
379
+ UndefinedOr.match(opts.projection, {
380
+ onUndefined: constVoid,
381
+ onDefined: (projection) => {
382
+ projection.dragEnd(releaseVelocity(opts.config, sample.velocity))
383
+ opts.setDragging(false)
384
+ },
385
+ })
386
+ }),
387
+ Match.exhaustive,
388
+ )
389
+
390
+ /** A down from the Primary pointer: a grab, which stops a running release where it is. */
391
+ const isGrab: Predicate.Predicate<InputSource.PointerLikeEvent> = Predicate.and(
392
+ (e: InputSource.PointerLikeEvent) => e.type === "down",
393
+ InputSource.isPrimaryPointer,
394
+ )
395
+
396
+ /** A down the element adopted from its **Drag controls** (#431). */
397
+ const isAdopted: Predicate.Predicate<InputSource.PointerLikeEvent> = (e) => e.adopted === true
398
+
399
+ /**
400
+ * A layout node's snap to the cursor ended with no drag (#431): its drag ended at rest, back to its
401
+ * slot. Whether there was one. A module's, not a track's (#507): a track given no Drag controls never
402
+ * snaps, and makes nothing for it.
403
+ */
404
+ const unsnap = (state: TrackState, projection: ProjectionSystem.DragHandle): boolean => {
405
+ if (Predicate.isUndefined(MutableRef.get(state).snapped)) return false
406
+ MutableRef.update(state, (s) => ({ ...s, snapped: undefined }))
407
+ projection.dragEnd(ORIGIN)
408
+ return true
409
+ }
410
+
411
+ /**
412
+ * Snap the element's centre under `down`'s point (#431, Motion's `snapToCursor`), on the axes it drags,
413
+ * measured from its box now: a plain element's x/y moved by the difference, a layout node's projection
414
+ * drag begun at it. A module's (#507), as {@link unsnap} is.
415
+ */
416
+ const snapTo = (opts: DragTrackOptions, state: TrackState, down: InputSource.PointerLikeEvent): void => {
417
+ const box = opts.element.getBoundingClientRect()
418
+ const axis = UndefinedOr.match(opts.axisAt, { onUndefined: () => toDragAxis(opts.config.axis), onDefined: (at) => toDragAxis(at()) })
419
+ // The pointer and the box's centre, each mapped as the drag's points are (#443, Motion's).
420
+ const map = mapPointOf(opts.mapPoint)
421
+ const cursor = map({ x: down.x, y: down.y })
422
+ const centre = map({ x: box.left + box.width / 2, y: box.top + box.height / 2 })
423
+ const by = onAxes({ x: cursor.x - centre.x, y: cursor.y - centre.y }, axis)
424
+ UndefinedOr.match(opts.projection, {
425
+ onUndefined: () => {
426
+ const from = snapshotPos(opts.snapshot)
427
+ const to = { x: from.x + by.x, y: from.y + by.y }
428
+ MutableRef.update(state, (s) => ({ ...s, position: to }))
429
+ directSet(opts, to)
430
+ },
431
+ onDefined: (projection) => {
432
+ const was = MutableRef.get(state).snapped
433
+ const at = UndefinedOr.match(was, { onUndefined: () => by, onDefined: (prev) => ({ x: prev.x + by.x, y: prev.y + by.y }) })
434
+ if (Predicate.isUndefined(was)) projection.dragStart()
435
+ projection.dragMove(at)
436
+ MutableRef.update(state, (s) => ({ ...s, snapped: at }))
437
+ },
438
+ })
439
+ }
440
+
441
+ /**
442
+ * The end of a Primary pointer's press: its up, its cancel, or a move with no button pressed
443
+ * (its release was lost, ADR-0019). A press with no drag lets a projection node's stopped
444
+ * release go on; any other unpressed move (a hover) finds none stopped.
445
+ */
446
+ const isPressEnd: Predicate.Predicate<InputSource.PointerLikeEvent> = Predicate.and(
447
+ (e: InputSource.PointerLikeEvent) =>
448
+ Bool.some([e.type === "up", e.type === "cancel", Bool.and(e.type === "move", Bool.not(e.pressed))]),
449
+ InputSource.isPrimaryPointer,
450
+ )
451
+
452
+ /** Hand `sample` to `onSample`, when there is one (a `<Reorder>` item's group). */
453
+ const reportSample = (opts: DragTrackOptions, sample: Drag.Sample): void =>
454
+ UndefinedOr.match(opts.onSample, { onUndefined: constVoid, onDefined: (onSample) => onSample(sample) })
455
+
456
+ /**
457
+ * Where a drag starts from (ADR-0004, ADR-0016): wherever a plain element rests (the snapshot's
458
+ * x/y); a projection node's slot, the origin, since its drag offset moves its projection target
459
+ * from its slot, and its own x/y are drawn on top of that (#363), or where a snap to the cursor put
460
+ * it (#431).
461
+ */
462
+ const startOf = (opts: DragTrackOptions, st: DragTrackState): Point.Point =>
463
+ UndefinedOr.match(opts.projection, {
464
+ onUndefined: () => snapshotPos(opts.snapshot),
465
+ onDefined: () => UndefinedOr.match(st.snapped, { onUndefined: () => ORIGIN, onDefined: identity }),
466
+ })
467
+
468
+ /**
469
+ * Follow the pointer for a "start" or "move" sample: absolute position = base + drag
470
+ * offset, kept within the constraints. A "start" rebases to where the drag starts from
471
+ * ({@link startOf}); for a projection node, the origin, and the "start" begins the
472
+ * projection's drag first, so `dragStart` runs before the first `dragMove`, unless a snap to the
473
+ * cursor began it (#431).
474
+ */
475
+ const follow = (sample: Drag.Sample, state: TrackState, opts: DragTrackOptions): void => {
476
+ const st = MutableRef.get(state)
477
+ const starts = sample.phase === "start"
478
+ const base = Bool.match(starts, { onTrue: () => startOf(opts, st), onFalse: () => st.base })
479
+ // The axes the gesture moves on, as the recognizer read them at its start: a `<Reorder>` item's
480
+ // group decides them per gesture (D5), a direction lock at its lock (#273).
481
+ const axis = Bool.match(starts, { onTrue: () => sample.axis, onFalse: () => st.axis })
482
+ const p = constrainedTo({ x: base.x + sample.offset.x, y: base.y + sample.offset.y }, axis, st.bounds, opts.config)
483
+ MutableRef.set(state, { ...st, base, position: p, axis, snapped: undefined })
484
+ opts.setDragging(true)
485
+ if (Bool.and(starts, Predicate.isUndefined(st.snapped))) UndefinedOr.match(opts.projection, { onUndefined: constVoid, onDefined: (projection) => projection.dragStart() })
486
+ directSet(opts, p)
487
+ reportSample(opts, sample)
488
+ }
489
+
490
+ /**
491
+ * The release driver (ADR-0004 binding orchestration; ADR-0016, *Amendment (#140)*), Motion's: an
492
+ * inertia on the drag transition on each axis the gesture moved, from the release position and
493
+ * velocity (none with `momentum: false`), toward its edges: both at the origin with `snapToOrigin`,
494
+ * else the constraints. A Fling glides on and springs back to an edge it would cross, or starts past.
495
+ * One that rests where it was dropped (no velocity, within its edges) commits the exact release
496
+ * position once (so the element rests at the pointer-up point, not the last move), and hands `x`/`y`
497
+ * back at the end of the release's task.
498
+ *
499
+ * Each release frame taps `gate.write` + snapshot sync + recordFrame, and the track's
500
+ * state, so a re-grab mid-tail rebases from where the tail reached. On completion
501
+ * `setDragging(false)` hands ownership of `x`/`y` back to the spring. The inertia runs on the
502
+ * Frame loop (ADR-0027); interrupting the release removes its run from the loop at once,
503
+ * before the next handler touches the state.
504
+ *
505
+ * A release that dies, on a drag transition core rejects (#66, ADR-0025 *Amendment (#66)*) or a
506
+ * throw in its frames, fails alone: reported, the element rests where it was dropped, and the track
507
+ * goes on to the next drag.
508
+ *
509
+ * Its velocity stays on the Snapshot, each frame's, from the release's own at its start; and once
510
+ * `taken` is done (#340, {@link DragTrack.takeRelease}), it stops where it is and tells no end: a
511
+ * Retarget has `x`/`y`, from that position and velocity.
512
+ */
513
+ const release = (
514
+ opts: DragTrackOptions,
515
+ state: TrackState,
516
+ position: Point.Point,
517
+ velocity: Point.Point,
518
+ taken: Deferred.Deferred<void>,
519
+ ): Effect.Effect<void, never, FrameLoop.FrameLoop> => {
520
+ const cfg = opts.config
521
+
522
+ // A run's sink on the Frame loop is a plain call (ADR-0027, decision 8). One a takeover beat to
523
+ // the loop writes nothing: the fiber's interruption comes through the scheduler (#340).
524
+ const tapFrame = (p: Point.Point, v: Point.Point): undefined => {
525
+ if (Bool.not(MutableRef.get(state).releasing)) return undefined
526
+ MutableRef.update(state, (s) => ({ ...s, position: p }))
527
+ directSet(opts, p)
528
+ keepVelocity(opts, v)
529
+ return undefined
530
+ }
531
+
532
+ // At rest, the drag hands back, then its release's end is told (#273) after the gate's next flush,
533
+ // with the rest value on the element, as Motion's comes with it set: only here, so a release a
534
+ // grab interrupted tells nothing.
535
+ const done = Effect.sync(() => {
536
+ MutableRef.update(state, (s) => ({ ...s, releasing: false }))
537
+ opts.setDragging(false)
538
+ UndefinedOr.map(opts.onReleaseEnd, (ended) => opts.gate.afterFlush(ended))
539
+ })
540
+ const { axis, bounds } = MutableRef.get(state)
541
+ const edges = edgesOf(cfg, bounds)
542
+ const v = releaseVelocity(cfg, velocity)
543
+ const transition = cfg.transition
544
+ // Before its first frame, a takeover starts from the release's velocity, on the axes it runs on.
545
+ keepVelocity(opts, onAxes(v, axis))
546
+
547
+ // The position now; the hand-back at the end of the release's task, once every other
548
+ // consumer of the same event has handled it: a press that ends with the drag (`whileTap`)
549
+ // then finds `x`/`y` still the drag's, so a key the drag moved stays where it was dropped.
550
+ // A takeover ends the release at once, its end untold (#340).
551
+ const untilTaken = (run: Effect.Effect<void, never, FrameLoop.FrameLoop>) => Effect.raceFirst(run, Deferred.await(taken))
552
+ if (restsWhereDropped(position, v, axis, edges, transition)) {
553
+ return untilTaken(
554
+ Effect.sync(() => {
555
+ if (MutableRef.get(state).releasing) directSet(opts, position)
556
+ }).pipe(Effect.andThen(Microtask.next), Effect.andThen(done)),
557
+ )
558
+ }
559
+ // Skipped (#468): it lands at once where its inertia would come to rest, on each axis it runs on,
560
+ // with no velocity. Motion's skipped release goes to its keyframes' last, the drag's origin; Wardic's
561
+ // lands where the release would. Its end is told as a release's at rest.
562
+ if (UndefinedOr.match(opts.skipAnimations, { onUndefined: constFalse, onDefined: (skips) => skips() })) {
563
+ return untilTaken(
564
+ Effect.sync(() => {
565
+ keepVelocity(opts, ORIGIN)
566
+ if (MutableRef.get(state).releasing) directSet(opts, restOfRelease(position, v, axis, edges, transition))
567
+ }).pipe(
568
+ Effect.catchDefect((defect) => Report.failure("wardic.drag: a release failed", Cause.die(defect)).pipe(Effect.andThen(Effect.sync(() => tapFrame(position, ORIGIN))))),
569
+ Effect.andThen(Microtask.next),
570
+ Effect.andThen(done),
571
+ ),
572
+ )
573
+ }
574
+ // Only the axes the gesture moved run (Motion's `shouldDrag`): the other stays where it is.
575
+ return untilTaken(
576
+ Match.value(axis).pipe(
577
+ Match.when("x", () =>
578
+ Machine.inertia(position.x, v.x, { ...transition, ...edges.x }).pipe(
579
+ Machine.run((frame) => tapFrame({ x: frame.value, y: position.y }, { x: frame.velocity, y: 0 })),
580
+ )),
581
+ Match.when("y", () =>
582
+ Machine.inertia(position.y, v.y, { ...transition, ...edges.y }).pipe(
583
+ Machine.run((frame) => tapFrame({ x: position.x, y: frame.value }, { x: 0, y: frame.velocity })),
584
+ )),
585
+ Match.orElse(() => Machine.inertiaVec(position, v, { ...transition, ...edges }).pipe(Machine.run((frame) => tapFrame(frame.value, frame.velocity)))),
586
+ Effect.catchDefect((defect) =>
587
+ Report.failure("wardic.drag: a release failed", Cause.die(defect)).pipe(Effect.andThen(Effect.sync(() => tapFrame(position, ORIGIN))))),
588
+ Effect.andThen(done),
589
+ ),
590
+ )
591
+ }
592
+
593
+ /**
594
+ * Where a release from `position` at `v` comes to rest (#468): each axis it runs on where its inertia
595
+ * would ({@link Inertia.restOf}), the other where it is.
596
+ */
597
+ const restOfRelease = (position: Point.Point, v: Point.Point, axis: Drag.Axis, edges: Drag.Bounds, transition: ProjectionSystem.DragTransition): Point.Point =>
598
+ Match.value(axis).pipe(
599
+ Match.when("x", () => ({ x: Inertia.restOf(position.x, v.x, { ...transition, ...edges.x }), y: position.y })),
600
+ Match.when("y", () => ({ x: position.x, y: Inertia.restOf(position.y, v.y, { ...transition, ...edges.y }) })),
601
+ Match.orElse(() => ({ x: Inertia.restOf(position.x, v.x, { ...transition, ...edges.x }), y: Inertia.restOf(position.y, v.y, { ...transition, ...edges.y }) })),
602
+ )
603
+
604
+ /** `v` on the axes a release runs on, 0 on the other. */
605
+ const onAxes = (v: Point.Point, axis: Drag.Axis): Point.Point =>
606
+ Match.value(axis).pipe(
607
+ Match.when("x", () => ({ x: v.x, y: 0 })),
608
+ Match.when("y", () => ({ x: 0, y: v.y })),
609
+ Match.orElse(() => v),
610
+ )
611
+
612
+ /** Whether `retargeted` names an axis a release on `axis` runs on (#340). */
613
+ const onReleaseAxis = (axis: Drag.Axis, retargeted: { readonly x: boolean; readonly y: boolean }): boolean =>
614
+ Match.value(axis).pipe(
615
+ Match.when("x", () => retargeted.x),
616
+ Match.when("y", () => retargeted.y),
617
+ Match.orElse(() => Bool.or(retargeted.x, retargeted.y)),
618
+ )
619
+
620
+ /** A release's velocity on the Snapshot, after its direct-set zeroed it (#340). */
621
+ const keepVelocity = (opts: DragTrackOptions, v: Point.Point): void => {
622
+ opts.snapshot.velocities.x = v.x
623
+ opts.snapshot.velocities.y = v.y
624
+ const now = opts.snapshot.now()
625
+ opts.snapshot.drawnAt.x = now
626
+ opts.snapshot.drawnAt.y = now
627
+ }
628
+
629
+ /** A running drag track, for the spine's Retargets (#340). */
630
+ export interface DragTrack {
631
+ /**
632
+ * Take `x`/`y` from a free drag's running release (#340) for a Retarget that gives `retargeted`
633
+ * new targets, as a newer animation of Motion's value stops the one running: the release stops
634
+ * where it is and tells no end, and `dragging` is handed back at the end of the task (not in the
635
+ * caller's Retarget, which reads it). `false`, and nothing done, when no release runs, a gesture
636
+ * is on, or none of `retargeted` is an axis the release runs on (Motion's runs one per axis).
637
+ */
638
+ readonly takeRelease: (retargeted: { readonly x: boolean; readonly y: boolean }) => boolean
639
+ }
640
+
641
+ /**
642
+ * Run the drag track for one element. Recognize `drag(element)` on its axis (read at
643
+ * each gesture's start for a `<Reorder>` item) with its **Drag claim** (none with
644
+ * `propagation`), then consume it, kept within its constraints, and the element's bare
645
+ * pointer-down grabs, each in place as it arrives (ADR-0032; the module doc). A drag
646
+ * refused its claim emits nothing, so a draggable ancestor of the element that claimed
647
+ * neither follows the pointer nor turns `whileDrag` on; its grab still stops its running
648
+ * release (ADR-0019, *Amendment (#29)*). The track runs in the element's watch Scope
649
+ * (`opts.watch`, #379), with no fiber at rest: closing it stops the watches (dropping the
650
+ * shared feed's count) and any in-flight release. A response that fails, or a release, is
651
+ * reported, and the track goes on.
652
+ *
653
+ * The drag config is read ONCE at setup (the caller passes a static
654
+ * {@link DragTrackConfig} — drag config is a document, not reactive); only the
655
+ * `dragging` signal the spine reads is reactive.
656
+ */
657
+ export const driveDragTrack = (opts: DragTrackOptions): DragTrack => {
658
+ const { config, element } = opts
659
+ const state: TrackState = MutableRef.make<DragTrackState>({
660
+ base: ORIGIN,
661
+ position: ORIGIN,
662
+ held: false,
663
+ axis: "xy",
664
+ bounds: config.constraints,
665
+ releasing: false,
666
+ stopped: false,
667
+ snapped: undefined,
668
+ })
669
+ // The running release's takeover (#340): done by `takeRelease`, from outside the track's responses.
670
+ let taken: Deferred.Deferred<void> = Deferred.makeUnsafe<void>()
671
+
672
+ opts.watch((onDefect) =>
673
+ Effect.gen(function* () {
674
+ // The running release, if any: the next sample or grab interrupts it.
675
+ const releasing = yield* FiberHandle.make<void>()
676
+ const probe = yield* Probe.Probe
677
+
678
+ // --- An element constraint (#273, ADR-0047) ------------------------------------------------
679
+ // Measured at each drag's start, and when the element or its container resizes: the observers'
680
+ // fiber, one container at a time, from the first time the container is there.
681
+ const watching = yield* FiberHandle.make<void>()
682
+ let watched: Element | undefined = undefined
683
+ let warned = false
684
+ const setBounds = (bounds: Drag.Bounds | undefined): void => {
685
+ MutableRef.update(state, (st) => ({ ...st, bounds }))
686
+ }
687
+ /** The bounds measured against `container`'s `box`; none, reported, if measuring throws (an app's `onMeasureDragConstraints`). */
688
+ const measured = (container: DragContainer, box: Element): Effect.Effect<Drag.Bounds | undefined> =>
689
+ Effect.sync((): Drag.Bounds | undefined => container.bounds(box)).pipe(
690
+ Effect.catchDefect((defect) => Report.failure("wardic.drag: measuring dragConstraints failed", Cause.die(defect)).pipe(Effect.as(undefined))),
691
+ )
692
+ /**
693
+ * A resize of the element or its container: the bounds measured again. The first measure only
694
+ * records them; a later one that changed them moves an element at rest, or releasing (stopped),
695
+ * to keep its place within them (Motion's `scalePositionWithinConstraints`). A held drag, or a
696
+ * layout node (back on its slot at rest), only takes the new bounds.
697
+ */
698
+ const resized = (container: DragContainer, box: Element): Effect.Effect<void> =>
699
+ measured(container, box).pipe(
700
+ Effect.flatMap((next) => {
701
+ const st = MutableRef.get(state)
702
+ if (Bool.or(Predicate.isUndefined(next), Predicate.isUndefined(st.bounds))) return Effect.sync(() => setBounds(next))
703
+ const from = st.bounds as Drag.Bounds
704
+ const to = next as Drag.Bounds
705
+ if (Drag.sameBounds(from, to)) return Effect.void
706
+ if (Bool.or(st.held, Predicate.isNotUndefined(opts.projection))) return Effect.sync(() => setBounds(to))
707
+ return FiberHandle.clear(releasing).pipe(
708
+ Effect.andThen(Effect.sync(() => {
709
+ const kept = Drag.keepPlace(snapshotPos(opts.snapshot), toDragAxis(config.axis), from, to)
710
+ MutableRef.update(state, (s) => ({ ...s, bounds: to, position: kept }))
711
+ directSet(opts, kept)
712
+ opts.setDragging(false)
713
+ })),
714
+ )
715
+ }),
716
+ )
717
+ /** Watch the element and `box` for resizes, from now on: once per container. */
718
+ const watchResizes = (container: DragContainer, box: Element): Effect.Effect<void> =>
719
+ Effect.suspend(() => {
720
+ if (watched === box) return Effect.void
721
+ watched = box
722
+ return FiberHandle.run(
723
+ watching,
724
+ Stream.runForEach(Stream.merge(probe.observeResize(element), probe.observeResize(box)), () => resized(container, box)),
725
+ ).pipe(Effect.asVoid)
726
+ })
727
+ /** At a drag's start: the bounds measured against the container, which is watched from then on; none if it isn't there. */
728
+ const measureAtStart: Effect.Effect<void> = UndefinedOr.match(opts.container, {
729
+ onUndefined: () => Effect.void,
730
+ onDefined: (container) =>
731
+ Effect.suspend(() =>
732
+ UndefinedOr.match(container.element(), {
733
+ onUndefined: () =>
734
+ Effect.sync(() => setBounds(undefined)).pipe(
735
+ Effect.andThen(Bool.match(warned, {
736
+ onTrue: () => Effect.void,
737
+ onFalse: () => {
738
+ warned = true
739
+ return Effect.logWarning("wardic.drag: dragConstraints' container isn't there at a drag's start, so it drags unconstrained")
740
+ },
741
+ })),
742
+ ),
743
+ onDefined: (box) => measured(container, box).pipe(Effect.tap((bounds) => Effect.sync(() => setBounds(bounds))), Effect.andThen(watchResizes(container, box))),
744
+ })
745
+ ),
746
+ })
747
+ // A container already there is watched from the start: its first delivery records the bounds.
748
+ // Forked, so its fiber runs on the runtime's scheduler, not this setup's `runSync`'s.
749
+ UndefinedOr.match(opts.container, {
750
+ onUndefined: constVoid,
751
+ onDefined: (container) => UndefinedOr.match(container.element(), { onUndefined: constVoid, onDefined: (box) => opts.fork(watchResizes(container, box)) }),
752
+ })
753
+
754
+ const input = yield* InputSource.InputSource
755
+
756
+ // The gesture's axis, read by the recognizer at each start: a `<Reorder>` item's group
757
+ // decides it per gesture (D5). Then the numeric shaping (Probe-free, ADR-0004).
758
+ const axisAt = opts.axisAt
759
+ const axis: Drag.Axis | (() => Drag.Axis) = UndefinedOr.match(axisAt, {
760
+ onUndefined: () => toDragAxis(config.axis),
761
+ onDefined: (at) => () => toDragAxis(at()),
762
+ })
763
+ const { propagation = false } = config
764
+ const listens = config.listen !== false
765
+
766
+ // --- Drag controls (#431), only for an element given them (#507) ----------------------------
767
+ const controlled = Predicate.isNotUndefined(opts.controls)
768
+ // The threshold of the gesture an adopted down claims: its controls' `distanceThreshold`, set for
769
+ // the length of the start that adopts it. Any other down's is the recognizer's own, and a track
770
+ // with no controls has none to set.
771
+ let adoptedThreshold: number | undefined = undefined
772
+ let threshold: ((down: InputSource.PointerLikeEvent) => Option.Option<number>) | undefined
773
+ if (controlled) {
774
+ threshold = (down) => {
775
+ if (down.adopted === true) return Option.fromUndefinedOr(adoptedThreshold)
776
+ return Option.none()
777
+ }
778
+ }
779
+
780
+ /** A free drag's release from `position` with `velocity`, run in `releasing` (#279: recorded as running). */
781
+ const startRelease = (position: Point.Point, velocity: Point.Point): Effect.Effect<void, never, FrameLoop.FrameLoop> =>
782
+ Effect.sync(() => {
783
+ MutableRef.update(state, (s) => ({ ...s, releasing: true, stopped: false }))
784
+ taken = Deferred.makeUnsafe<void>()
785
+ return taken
786
+ }).pipe(
787
+ Effect.flatMap((ended) => FiberHandle.run(releasing, release(opts, state, position, velocity, ended))),
788
+ Effect.asVoid,
789
+ )
790
+
791
+ // A free drag's "end" starts its release; a projection node's Release offset already
792
+ // began in `settleGesture`, so its drag track skips the tail (ADR-0016, Q3c).
793
+ const releaseFrom = (sample: Drag.Sample): Effect.Effect<void, never, FrameLoop.FrameLoop> =>
794
+ UndefinedOr.match(opts.projection, {
795
+ onDefined: () => Effect.void,
796
+ onUndefined: () => {
797
+ const { axis, base, bounds } = MutableRef.get(state)
798
+ const position = constrainedTo({ x: base.x + sample.offset.x, y: base.y + sample.offset.y }, axis, bounds, config)
799
+ return startRelease(position, sample.velocity)
800
+ },
801
+ })
802
+
803
+ // Each sample: its bookkeeping, then its response. A "start" or "move" stops a running
804
+ // release first, as each new event did under `switchMap`.
805
+ const onSample = (sample: Drag.Sample): Effect.Effect<void, never, FrameLoop.FrameLoop> =>
806
+ Effect.suspend(() => {
807
+ settleGesture(sample, state, opts)
808
+ return Match.value(sample.phase).pipe(
809
+ // A start measures an element constraint first (#273), so it follows within this drag's bounds.
810
+ Match.when("start", () =>
811
+ FiberHandle.clear(releasing).pipe(Effect.andThen(measureAtStart), Effect.andThen(Effect.sync(() => follow(sample, state, opts))))),
812
+ Match.when("move", () =>
813
+ FiberHandle.clear(releasing).pipe(Effect.andThen(Effect.sync(() => follow(sample, state, opts))))),
814
+ // A cancelled end (#431) stays where it is: no release, `x`/`y` handed back.
815
+ Match.when("end", () =>
816
+ Bool.match(sample.cancelled === true, {
817
+ onTrue: () => Effect.sync(() => UndefinedOr.match(opts.projection, { onUndefined: () => opts.setDragging(false), onDefined: constVoid })),
818
+ onFalse: () => releaseFrom(sample),
819
+ }).pipe(Effect.andThen(Effect.sync(() => reportSample(opts, sample))))),
820
+ Match.exhaustive,
821
+ )
822
+ })
823
+
824
+ // A grab stops a running release where it is. With no gesture held, the stopped
825
+ // release (or the one a same-down "end" just started) hands `x`/`y` back to the
826
+ // spring; a drag that follows takes them again at its "start", where it rebases (a
827
+ // new down from a pointer whose release was lost also ends the old gesture, a Stale
828
+ // gesture, ADR-0019). A projection node's Release offset stops where it is too, and a
829
+ // drag that follows starts from there; a press that ends with no drag lets it go on,
830
+ // from rest (Motion's `stopAnimation` at the press and `resumeAnimation`, ADR-0016,
831
+ // *Amendment (velocity family)*). The InputSource is a Shared source, so this shares
832
+ // the recognizer's single listener-set (CONTEXT.md Shared source contract).
833
+ const onGrab: Effect.Effect<void> = FiberHandle.clear(releasing).pipe(
834
+ Effect.andThen(Effect.sync(() => {
835
+ // A free drag's release this grab stopped, to start again if the press ends with no drag (#279).
836
+ MutableRef.update(state, (s) => ({ ...s, stopped: s.releasing, releasing: false }))
837
+ UndefinedOr.match(opts.projection, { onUndefined: constVoid, onDefined: (projection) => projection.stopRelease() })
838
+ if (!MutableRef.get(state).held) opts.setDragging(false)
839
+ })),
840
+ )
841
+ /**
842
+ * A free drag's release a grab stopped, started again from rest where it stopped, toward its edges
843
+ * (#279, Motion's `resumeAnimation`): only with `snapToOrigin` or constraints, which give it
844
+ * somewhere to go. Motion's starts one at any press that ends with no drag, so a click at rest on
845
+ * a constrained element tells `onDragTransitionEnd`; this only starts the one the grab stopped, as
846
+ * a layout node's `resumeRelease` does.
847
+ */
848
+ const resumeFree: Effect.Effect<void, never, FrameLoop.FrameLoop> = Effect.suspend(() => {
849
+ const st = MutableRef.get(state)
850
+ if (Bool.not(st.stopped)) return Effect.void
851
+ MutableRef.update(state, (s) => ({ ...s, stopped: false }))
852
+ if (Bool.and(config.snapToOrigin !== true, Predicate.isUndefined(st.bounds))) return Effect.void
853
+ return startRelease(st.position, ORIGIN)
854
+ })
855
+ // The samples subscribe first, so a drag's own up has ended its gesture by now: only a
856
+ // press that never dragged finds no gesture held.
857
+ // A layout node a snap to the cursor moved (#431) goes back to its slot instead.
858
+ const onPressEnd: Effect.Effect<void, never, FrameLoop.FrameLoop> = Effect.suspend(() => {
859
+ if (MutableRef.get(state).held) return Effect.void
860
+ return UndefinedOr.match(opts.projection, {
861
+ onUndefined: () => resumeFree,
862
+ onDefined: (projection) =>
863
+ Effect.sync(() => {
864
+ if (unsnap(state, projection)) return
865
+ projection.resumeRelease()
866
+ }),
867
+ })
868
+ })
869
+
870
+ /**
871
+ * A response, run inside its event (`opts.fork`): one that fails is reported, and the next
872
+ * event's runs (ADR-0055 *Amendment (#379)*, Q4). A release reports its own (#66).
873
+ */
874
+ const respond = (response: Effect.Effect<void, never, FrameLoop.FrameLoop>): void =>
875
+ opts.fork(response.pipe(Effect.catchCause((cause) => Report.failure("wardic.drag: a response failed", cause))))
876
+
877
+ // Subscribed in this order, so the samples hear an event before the grabs. The constraints
878
+ // bound the element's x/y, so they're applied where the gesture's offset meets its base, in
879
+ // `follow` and at the release (ADR-0016, *Amendment (#140)*).
880
+ const drag = yield* DragRecognizer.watchDrag(element, { axis, claim: Bool.not(propagation), lock: config.directionLock === true, listen: listens, adoptable: controlled, threshold, mapPoint: UndefinedOr.map(opts.mapPoint, pointMapOptionOf) }, {
881
+ on: (sample) => respond(onSample(sample)),
882
+ onDefect,
883
+ })
884
+ // A down grabs when the drag listens to it (#431): with `listen: false`, only an adopted one.
885
+ const grabs = Bool.match(listens, { onTrue: () => isGrab, onFalse: () => Predicate.and(isGrab, isAdopted) })
886
+ // The adoptable feed with controls (#507), so a grab hears an adopted down; the plain one without.
887
+ const pointerFeed = Bool.match(controlled, { onTrue: () => InputSource.adoptablePointerOf(input, element), onFalse: () => input.pointer(element) })
888
+ yield* InputFeed.watch(pointerFeed, {
889
+ on: (event) => {
890
+ if (grabs(event)) return respond(onGrab)
891
+ if (isPressEnd(event)) respond(onPressEnd)
892
+ },
893
+ onDefect,
894
+ })
895
+
896
+ // Its controls, subscribed until the Scope closes (#431). A start adopts the pointer, whose down
897
+ // the recognizer claims and the grabs stop a release at, inside the call; then the snap.
898
+ if (Predicate.isNotUndefined(opts.controls)) {
899
+ /** A layout node's snap that no gesture took, ended once its controls end the drag. */
900
+ const unsnapped = (): void => UndefinedOr.match(opts.projection, { onUndefined: constVoid, onDefined: (projection) => void unsnap(state, projection) })
901
+ const unsubscribe = subscribeDragControls(opts.controls, {
902
+ start: (event, options) => {
903
+ adoptedThreshold = options.distanceThreshold
904
+ const down = input.adoptPointer(element, event)
905
+ adoptedThreshold = undefined
906
+ if (Option.isNone(down)) return
907
+ if (options.snapToCursor === true) snapTo(opts, state, down.value)
908
+ },
909
+ stop: () => {
910
+ drag.stop()
911
+ unsnapped()
912
+ },
913
+ cancel: () => {
914
+ drag.cancel()
915
+ unsnapped()
916
+ },
917
+ })
918
+ yield* Effect.addFinalizer(() => Effect.sync(unsubscribe))
919
+ }
920
+ }),
921
+ )
922
+
923
+ return {
924
+ takeRelease: (retargeted) => {
925
+ const st = MutableRef.get(state)
926
+ if (Bool.or(st.held, Bool.not(st.releasing))) return false
927
+ if (Bool.not(onReleaseAxis(st.axis, retargeted))) return false
928
+ MutableRef.update(state, (s) => ({ ...s, releasing: false }))
929
+ Deferred.doneUnsafe(taken, Exit.void)
930
+ // A gesture begun since, in this task, keeps `dragging`.
931
+ queueMicrotask(() => {
932
+ if (Bool.not(MutableRef.get(state).held)) opts.setDragging(false)
933
+ })
934
+ return true
935
+ },
936
+ }
937
+ }