@wardic/solid 0.0.0-stage → 1.0.0-rc.10

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 (1156) 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 +744 -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/batch-appear-here.js +29 -0
  13. package/dist/browser/batch-appear-here.js.map +1 -0
  14. package/dist/browser/batch-gestures.js +174 -0
  15. package/dist/browser/batch-gestures.js.map +1 -0
  16. package/dist/browser/batch-handoff.js +72 -0
  17. package/dist/browser/batch-handoff.js.map +1 -0
  18. package/dist/browser/batch-reorder-group.js +345 -0
  19. package/dist/browser/batch-reorder-group.js.map +1 -0
  20. package/dist/browser/batch-reorder-places.js +207 -0
  21. package/dist/browser/batch-reorder-places.js.map +1 -0
  22. package/dist/browser/batch-reorder.js +641 -0
  23. package/dist/browser/batch-reorder.js.map +1 -0
  24. package/dist/browser/batch.js +2512 -0
  25. package/dist/browser/batch.js.map +1 -0
  26. package/dist/browser/bridge.js +69 -0
  27. package/dist/browser/bridge.js.map +1 -0
  28. package/dist/browser/complete.js +30 -0
  29. package/dist/browser/complete.js.map +1 -0
  30. package/dist/browser/config.js +2 -0
  31. package/dist/browser/config.js.map +1 -0
  32. package/dist/browser/create-animate.js +41 -0
  33. package/dist/browser/create-animate.js.map +1 -0
  34. package/dist/browser/create-batch.js +120 -0
  35. package/dist/browser/create-batch.js.map +1 -0
  36. package/dist/browser/create-ward.js +1003 -0
  37. package/dist/browser/create-ward.js.map +1 -0
  38. package/dist/browser/cycle-index.js +17 -0
  39. package/dist/browser/cycle-index.js.map +1 -0
  40. package/dist/browser/cycle.js +31 -0
  41. package/dist/browser/cycle.js.map +1 -0
  42. package/dist/browser/directive.js +80 -0
  43. package/dist/browser/directive.js.map +1 -0
  44. package/dist/browser/drag-constraints.js +76 -0
  45. package/dist/browser/drag-constraints.js.map +1 -0
  46. package/dist/browser/drag-controls.js +51 -0
  47. package/dist/browser/drag-controls.js.map +1 -0
  48. package/dist/browser/drag-samples.js +40 -0
  49. package/dist/browser/drag-samples.js.map +1 -0
  50. package/dist/browser/drag-sensor.js +35 -0
  51. package/dist/browser/drag-sensor.js.map +1 -0
  52. package/dist/browser/drag-track.js +827 -0
  53. package/dist/browser/drag-track.js.map +1 -0
  54. package/dist/browser/drag-transition.js +56 -0
  55. package/dist/browser/drag-transition.js.map +1 -0
  56. package/dist/browser/drag.js +44 -0
  57. package/dist/browser/drag.js.map +1 -0
  58. package/dist/browser/element-style.js +67 -0
  59. package/dist/browser/element-style.js.map +1 -0
  60. package/dist/browser/element.js +353 -0
  61. package/dist/browser/element.js.map +1 -0
  62. package/dist/browser/feature-section.js +17 -0
  63. package/dist/browser/feature-section.js.map +1 -0
  64. package/dist/browser/feature.js +271 -0
  65. package/dist/browser/feature.js.map +1 -0
  66. package/dist/browser/features/all.js +10 -0
  67. package/dist/browser/features/all.js.map +1 -0
  68. package/dist/browser/features/colors.js +33 -0
  69. package/dist/browser/features/colors.js.map +1 -0
  70. package/dist/browser/features/dom-animation.js +7 -0
  71. package/dist/browser/features/dom-animation.js.map +1 -0
  72. package/dist/browser/features/dom-max.js +4 -0
  73. package/dist/browser/features/dom-max.js.map +1 -0
  74. package/dist/browser/features/drag.js +28 -0
  75. package/dist/browser/features/drag.js.map +1 -0
  76. package/dist/browser/features/focus.js +18 -0
  77. package/dist/browser/features/focus.js.map +1 -0
  78. package/dist/browser/features/hover.js +18 -0
  79. package/dist/browser/features/hover.js.map +1 -0
  80. package/dist/browser/features/in-view.js +18 -0
  81. package/dist/browser/features/in-view.js.map +1 -0
  82. package/dist/browser/features/input.js +27 -0
  83. package/dist/browser/features/input.js.map +1 -0
  84. package/dist/browser/features/keys.js +19 -0
  85. package/dist/browser/features/keys.js.map +1 -0
  86. package/dist/browser/features/layout.js +33 -0
  87. package/dist/browser/features/layout.js.map +1 -0
  88. package/dist/browser/features/pan.js +18 -0
  89. package/dist/browser/features/pan.js.map +1 -0
  90. package/dist/browser/features/press.js +12 -0
  91. package/dist/browser/features/press.js.map +1 -0
  92. package/dist/browser/features/scroll.js +21 -0
  93. package/dist/browser/features/scroll.js.map +1 -0
  94. package/dist/browser/focus-sensor.js +23 -0
  95. package/dist/browser/focus-sensor.js.map +1 -0
  96. package/dist/browser/frame-time.js +40 -0
  97. package/dist/browser/frame-time.js.map +1 -0
  98. package/dist/browser/gesture-callbacks.js +172 -0
  99. package/dist/browser/gesture-callbacks.js.map +1 -0
  100. package/dist/browser/gesture-features.js +29 -0
  101. package/dist/browser/gesture-features.js.map +1 -0
  102. package/dist/browser/gesture-info.js +43 -0
  103. package/dist/browser/gesture-info.js.map +1 -0
  104. package/dist/browser/hover-sensor.js +29 -0
  105. package/dist/browser/hover-sensor.js.map +1 -0
  106. package/dist/browser/imperative.js +709 -0
  107. package/dist/browser/imperative.js.map +1 -0
  108. package/dist/browser/index.js +168 -0
  109. package/dist/browser/index.js.map +1 -0
  110. package/dist/browser/instant.js +51 -0
  111. package/dist/browser/instant.js.map +1 -0
  112. package/dist/browser/layout-group.js +27 -0
  113. package/dist/browser/layout-group.js.map +1 -0
  114. package/dist/browser/layout-member.js +374 -0
  115. package/dist/browser/layout-member.js.map +1 -0
  116. package/dist/browser/layout-projection.js +19 -0
  117. package/dist/browser/layout-projection.js.map +1 -0
  118. package/dist/browser/layout.js +91 -0
  119. package/dist/browser/layout.js.map +1 -0
  120. package/dist/browser/lazy-batch-gestures.js +64 -0
  121. package/dist/browser/lazy-batch-gestures.js.map +1 -0
  122. package/dist/browser/live-scroll.js +115 -0
  123. package/dist/browser/live-scroll.js.map +1 -0
  124. package/dist/browser/live-style.js +314 -0
  125. package/dist/browser/live-style.js.map +1 -0
  126. package/dist/browser/live-value.js +166 -0
  127. package/dist/browser/live-value.js.map +1 -0
  128. package/dist/browser/member-hold.js +181 -0
  129. package/dist/browser/member-hold.js.map +1 -0
  130. package/dist/browser/motion-props.js +172 -0
  131. package/dist/browser/motion-props.js.map +1 -0
  132. package/dist/browser/owner-scope.js +29 -0
  133. package/dist/browser/owner-scope.js.map +1 -0
  134. package/dist/browser/page-point.js +92 -0
  135. package/dist/browser/page-point.js.map +1 -0
  136. package/dist/browser/presence-controller.js +1450 -0
  137. package/dist/browser/presence-controller.js.map +1 -0
  138. package/dist/browser/presence-record.js +27 -0
  139. package/dist/browser/presence-record.js.map +1 -0
  140. package/dist/browser/presence.js +207 -0
  141. package/dist/browser/presence.js.map +1 -0
  142. package/dist/browser/press-sensor.js +30 -0
  143. package/dist/browser/press-sensor.js.map +1 -0
  144. package/dist/browser/press.js +24 -0
  145. package/dist/browser/press.js.map +1 -0
  146. package/dist/browser/provider.js +445 -0
  147. package/dist/browser/provider.js.map +1 -0
  148. package/dist/browser/reactivity.js +9 -0
  149. package/dist/browser/reactivity.js.map +1 -0
  150. package/dist/browser/reorder-input.js +117 -0
  151. package/dist/browser/reorder-input.js.map +1 -0
  152. package/dist/browser/reorder-values.js +20 -0
  153. package/dist/browser/reorder-values.js.map +1 -0
  154. package/dist/browser/reorder.js +554 -0
  155. package/dist/browser/reorder.js.map +1 -0
  156. package/dist/browser/retarget-legs.js +1022 -0
  157. package/dist/browser/retarget-legs.js.map +1 -0
  158. package/dist/browser/runtime.js +267 -0
  159. package/dist/browser/runtime.js.map +1 -0
  160. package/dist/browser/sensors.js +172 -0
  161. package/dist/browser/sensors.js.map +1 -0
  162. package/dist/browser/server-interpolators.js +20 -0
  163. package/dist/browser/server-interpolators.js.map +1 -0
  164. package/dist/browser/server.js +20 -0
  165. package/dist/browser/server.js.map +1 -0
  166. package/dist/browser/solid-reactivity.js +26 -0
  167. package/dist/browser/solid-reactivity.js.map +1 -0
  168. package/dist/browser/spine.js +3044 -0
  169. package/dist/browser/spine.js.map +1 -0
  170. package/dist/browser/stagger.js +13 -0
  171. package/dist/browser/stagger.js.map +1 -0
  172. package/dist/browser/unstable/v2/batch-appear-here.js +28 -0
  173. package/dist/browser/unstable/v2/batch-appear-here.js.map +1 -0
  174. package/dist/browser/unstable/v2/batch-reorder-group.js +267 -0
  175. package/dist/browser/unstable/v2/batch-reorder-group.js.map +1 -0
  176. package/dist/browser/unstable/v2/bridge.js +76 -0
  177. package/dist/browser/unstable/v2/bridge.js.map +1 -0
  178. package/dist/browser/unstable/v2/complete.js +29 -0
  179. package/dist/browser/unstable/v2/complete.js.map +1 -0
  180. package/dist/browser/unstable/v2/config-view.js +111 -0
  181. package/dist/browser/unstable/v2/config-view.js.map +1 -0
  182. package/dist/browser/unstable/v2/create-animate.js +67 -0
  183. package/dist/browser/unstable/v2/create-animate.js.map +1 -0
  184. package/dist/browser/unstable/v2/create-batch.js +144 -0
  185. package/dist/browser/unstable/v2/create-batch.js.map +1 -0
  186. package/dist/browser/unstable/v2/cycle.js +30 -0
  187. package/dist/browser/unstable/v2/cycle.js.map +1 -0
  188. package/dist/browser/unstable/v2/drag-sensor.js +34 -0
  189. package/dist/browser/unstable/v2/drag-sensor.js.map +1 -0
  190. package/dist/browser/unstable/v2/element.js +393 -0
  191. package/dist/browser/unstable/v2/element.js.map +1 -0
  192. package/dist/browser/unstable/v2/feature-section.js +27 -0
  193. package/dist/browser/unstable/v2/feature-section.js.map +1 -0
  194. package/dist/browser/unstable/v2/flights.js +57 -0
  195. package/dist/browser/unstable/v2/flights.js.map +1 -0
  196. package/dist/browser/unstable/v2/focus-sensor.js +23 -0
  197. package/dist/browser/unstable/v2/focus-sensor.js.map +1 -0
  198. package/dist/browser/unstable/v2/hover-sensor.js +28 -0
  199. package/dist/browser/unstable/v2/hover-sensor.js.map +1 -0
  200. package/dist/browser/unstable/v2/index.js +117 -0
  201. package/dist/browser/unstable/v2/index.js.map +1 -0
  202. package/dist/browser/unstable/v2/layout-projection.js +18 -0
  203. package/dist/browser/unstable/v2/layout-projection.js.map +1 -0
  204. package/dist/browser/unstable/v2/layout.js +71 -0
  205. package/dist/browser/unstable/v2/layout.js.map +1 -0
  206. package/dist/browser/unstable/v2/lifecycle.js +455 -0
  207. package/dist/browser/unstable/v2/lifecycle.js.map +1 -0
  208. package/dist/browser/unstable/v2/live-scroll.js +128 -0
  209. package/dist/browser/unstable/v2/live-scroll.js.map +1 -0
  210. package/dist/browser/unstable/v2/live-value.js +166 -0
  211. package/dist/browser/unstable/v2/live-value.js.map +1 -0
  212. package/dist/browser/unstable/v2/presence-handle.js +146 -0
  213. package/dist/browser/unstable/v2/presence-handle.js.map +1 -0
  214. package/dist/browser/unstable/v2/presence-hooks.js +142 -0
  215. package/dist/browser/unstable/v2/presence-hooks.js.map +1 -0
  216. package/dist/browser/unstable/v2/presence.js +124 -0
  217. package/dist/browser/unstable/v2/presence.js.map +1 -0
  218. package/dist/browser/unstable/v2/press-sensor.js +29 -0
  219. package/dist/browser/unstable/v2/press-sensor.js.map +1 -0
  220. package/dist/browser/unstable/v2/provider.js +463 -0
  221. package/dist/browser/unstable/v2/provider.js.map +1 -0
  222. package/dist/browser/unstable/v2/reorder.js +671 -0
  223. package/dist/browser/unstable/v2/reorder.js.map +1 -0
  224. package/dist/browser/unstable/v2/sensors.js +138 -0
  225. package/dist/browser/unstable/v2/sensors.js.map +1 -0
  226. package/dist/browser/unstable/v2/solid-reactivity.js +82 -0
  227. package/dist/browser/unstable/v2/solid-reactivity.js.map +1 -0
  228. package/dist/browser/unstable/v2/variant-node.js +395 -0
  229. package/dist/browser/unstable/v2/variant-node.js.map +1 -0
  230. package/dist/browser/unstable/v2/w.js +23 -0
  231. package/dist/browser/unstable/v2/w.js.map +1 -0
  232. package/dist/browser/unstable/v2/waiters.js +185 -0
  233. package/dist/browser/unstable/v2/waiters.js.map +1 -0
  234. package/dist/browser/unstable/v2/ward.js +1629 -0
  235. package/dist/browser/unstable/v2/ward.js.map +1 -0
  236. package/dist/browser/unstable/v2/wardic-config.js +40 -0
  237. package/dist/browser/unstable/v2/wardic-config.js.map +1 -0
  238. package/dist/browser/unstable/v2/wardic.js +16 -0
  239. package/dist/browser/unstable/v2/wardic.js.map +1 -0
  240. package/dist/browser/variant-node.js +308 -0
  241. package/dist/browser/variant-node.js.map +1 -0
  242. package/dist/browser/variant-target.js +229 -0
  243. package/dist/browser/variant-target.js.map +1 -0
  244. package/dist/browser/variant-tree.js +394 -0
  245. package/dist/browser/variant-tree.js.map +1 -0
  246. package/dist/browser/variants.js +43 -0
  247. package/dist/browser/variants.js.map +1 -0
  248. package/dist/browser/w.js +25 -0
  249. package/dist/browser/w.js.map +1 -0
  250. package/dist/browser/ward-keys.js +2 -0
  251. package/dist/browser/ward-keys.js.map +1 -0
  252. package/dist/browser/wardic-component.js +74 -0
  253. package/dist/browser/wardic-component.js.map +1 -0
  254. package/dist/browser/wardic-config-value.js +91 -0
  255. package/dist/browser/wardic-config-value.js.map +1 -0
  256. package/dist/browser/wardic-config.js +42 -0
  257. package/dist/browser/wardic-config.js.map +1 -0
  258. package/dist/browser/wardic.js +31 -0
  259. package/dist/browser/wardic.js.map +1 -0
  260. package/dist/server/animation-controls.js +150 -0
  261. package/dist/server/animation-controls.js.map +1 -0
  262. package/dist/server/animation-frame.js +29 -0
  263. package/dist/server/animation-frame.js.map +1 -0
  264. package/dist/server/appear.js +744 -0
  265. package/dist/server/appear.js.map +1 -0
  266. package/dist/server/arc.js +21 -0
  267. package/dist/server/arc.js.map +1 -0
  268. package/dist/server/batch-appear-here.js +29 -0
  269. package/dist/server/batch-appear-here.js.map +1 -0
  270. package/dist/server/batch-gestures.js +174 -0
  271. package/dist/server/batch-gestures.js.map +1 -0
  272. package/dist/server/batch-handoff.js +72 -0
  273. package/dist/server/batch-handoff.js.map +1 -0
  274. package/dist/server/batch-reorder-group.js +341 -0
  275. package/dist/server/batch-reorder-group.js.map +1 -0
  276. package/dist/server/batch-reorder-places.js +207 -0
  277. package/dist/server/batch-reorder-places.js.map +1 -0
  278. package/dist/server/batch-reorder.js +641 -0
  279. package/dist/server/batch-reorder.js.map +1 -0
  280. package/dist/server/batch.js +2512 -0
  281. package/dist/server/batch.js.map +1 -0
  282. package/dist/server/bridge.js +69 -0
  283. package/dist/server/bridge.js.map +1 -0
  284. package/dist/server/complete.js +30 -0
  285. package/dist/server/complete.js.map +1 -0
  286. package/dist/server/config.js +2 -0
  287. package/dist/server/config.js.map +1 -0
  288. package/dist/server/create-animate.js +41 -0
  289. package/dist/server/create-animate.js.map +1 -0
  290. package/dist/server/create-batch.js +120 -0
  291. package/dist/server/create-batch.js.map +1 -0
  292. package/dist/server/create-ward.js +1003 -0
  293. package/dist/server/create-ward.js.map +1 -0
  294. package/dist/server/cycle-index.js +17 -0
  295. package/dist/server/cycle-index.js.map +1 -0
  296. package/dist/server/cycle.js +31 -0
  297. package/dist/server/cycle.js.map +1 -0
  298. package/dist/server/directive.js +80 -0
  299. package/dist/server/directive.js.map +1 -0
  300. package/dist/server/drag-constraints.js +76 -0
  301. package/dist/server/drag-constraints.js.map +1 -0
  302. package/dist/server/drag-controls.js +51 -0
  303. package/dist/server/drag-controls.js.map +1 -0
  304. package/dist/server/drag-samples.js +40 -0
  305. package/dist/server/drag-samples.js.map +1 -0
  306. package/dist/server/drag-sensor.js +35 -0
  307. package/dist/server/drag-sensor.js.map +1 -0
  308. package/dist/server/drag-track.js +827 -0
  309. package/dist/server/drag-track.js.map +1 -0
  310. package/dist/server/drag-transition.js +56 -0
  311. package/dist/server/drag-transition.js.map +1 -0
  312. package/dist/server/drag.js +44 -0
  313. package/dist/server/drag.js.map +1 -0
  314. package/dist/server/element-style.js +67 -0
  315. package/dist/server/element-style.js.map +1 -0
  316. package/dist/server/element.js +353 -0
  317. package/dist/server/element.js.map +1 -0
  318. package/dist/server/feature-section.js +17 -0
  319. package/dist/server/feature-section.js.map +1 -0
  320. package/dist/server/feature.js +271 -0
  321. package/dist/server/feature.js.map +1 -0
  322. package/dist/server/features/all.js +10 -0
  323. package/dist/server/features/all.js.map +1 -0
  324. package/dist/server/features/colors.js +33 -0
  325. package/dist/server/features/colors.js.map +1 -0
  326. package/dist/server/features/dom-animation.js +7 -0
  327. package/dist/server/features/dom-animation.js.map +1 -0
  328. package/dist/server/features/dom-max.js +4 -0
  329. package/dist/server/features/dom-max.js.map +1 -0
  330. package/dist/server/features/drag.js +28 -0
  331. package/dist/server/features/drag.js.map +1 -0
  332. package/dist/server/features/focus.js +18 -0
  333. package/dist/server/features/focus.js.map +1 -0
  334. package/dist/server/features/hover.js +18 -0
  335. package/dist/server/features/hover.js.map +1 -0
  336. package/dist/server/features/in-view.js +18 -0
  337. package/dist/server/features/in-view.js.map +1 -0
  338. package/dist/server/features/input.js +27 -0
  339. package/dist/server/features/input.js.map +1 -0
  340. package/dist/server/features/keys.js +19 -0
  341. package/dist/server/features/keys.js.map +1 -0
  342. package/dist/server/features/layout.js +33 -0
  343. package/dist/server/features/layout.js.map +1 -0
  344. package/dist/server/features/pan.js +18 -0
  345. package/dist/server/features/pan.js.map +1 -0
  346. package/dist/server/features/press.js +12 -0
  347. package/dist/server/features/press.js.map +1 -0
  348. package/dist/server/features/scroll.js +21 -0
  349. package/dist/server/features/scroll.js.map +1 -0
  350. package/dist/server/focus-sensor.js +23 -0
  351. package/dist/server/focus-sensor.js.map +1 -0
  352. package/dist/server/frame-time.js +40 -0
  353. package/dist/server/frame-time.js.map +1 -0
  354. package/dist/server/gesture-callbacks.js +172 -0
  355. package/dist/server/gesture-callbacks.js.map +1 -0
  356. package/dist/server/gesture-features.js +29 -0
  357. package/dist/server/gesture-features.js.map +1 -0
  358. package/dist/server/gesture-info.js +43 -0
  359. package/dist/server/gesture-info.js.map +1 -0
  360. package/dist/server/hover-sensor.js +29 -0
  361. package/dist/server/hover-sensor.js.map +1 -0
  362. package/dist/server/imperative.js +709 -0
  363. package/dist/server/imperative.js.map +1 -0
  364. package/dist/server/index.js +168 -0
  365. package/dist/server/index.js.map +1 -0
  366. package/dist/server/instant.js +51 -0
  367. package/dist/server/instant.js.map +1 -0
  368. package/dist/server/layout-group.js +27 -0
  369. package/dist/server/layout-group.js.map +1 -0
  370. package/dist/server/layout-member.js +374 -0
  371. package/dist/server/layout-member.js.map +1 -0
  372. package/dist/server/layout-projection.js +19 -0
  373. package/dist/server/layout-projection.js.map +1 -0
  374. package/dist/server/layout.js +90 -0
  375. package/dist/server/layout.js.map +1 -0
  376. package/dist/server/lazy-batch-gestures.js +64 -0
  377. package/dist/server/lazy-batch-gestures.js.map +1 -0
  378. package/dist/server/live-scroll.js +115 -0
  379. package/dist/server/live-scroll.js.map +1 -0
  380. package/dist/server/live-style.js +314 -0
  381. package/dist/server/live-style.js.map +1 -0
  382. package/dist/server/live-value.js +166 -0
  383. package/dist/server/live-value.js.map +1 -0
  384. package/dist/server/member-hold.js +181 -0
  385. package/dist/server/member-hold.js.map +1 -0
  386. package/dist/server/motion-props.js +172 -0
  387. package/dist/server/motion-props.js.map +1 -0
  388. package/dist/server/owner-scope.js +29 -0
  389. package/dist/server/owner-scope.js.map +1 -0
  390. package/dist/server/page-point.js +92 -0
  391. package/dist/server/page-point.js.map +1 -0
  392. package/dist/server/presence-controller.js +1450 -0
  393. package/dist/server/presence-controller.js.map +1 -0
  394. package/dist/server/presence-record.js +27 -0
  395. package/dist/server/presence-record.js.map +1 -0
  396. package/dist/server/presence.js +207 -0
  397. package/dist/server/presence.js.map +1 -0
  398. package/dist/server/press-sensor.js +30 -0
  399. package/dist/server/press-sensor.js.map +1 -0
  400. package/dist/server/press.js +24 -0
  401. package/dist/server/press.js.map +1 -0
  402. package/dist/server/provider.js +439 -0
  403. package/dist/server/provider.js.map +1 -0
  404. package/dist/server/reactivity.js +9 -0
  405. package/dist/server/reactivity.js.map +1 -0
  406. package/dist/server/reorder-input.js +117 -0
  407. package/dist/server/reorder-input.js.map +1 -0
  408. package/dist/server/reorder-values.js +20 -0
  409. package/dist/server/reorder-values.js.map +1 -0
  410. package/dist/server/reorder.js +554 -0
  411. package/dist/server/reorder.js.map +1 -0
  412. package/dist/server/retarget-legs.js +1022 -0
  413. package/dist/server/retarget-legs.js.map +1 -0
  414. package/dist/server/runtime.js +267 -0
  415. package/dist/server/runtime.js.map +1 -0
  416. package/dist/server/sensors.js +172 -0
  417. package/dist/server/sensors.js.map +1 -0
  418. package/dist/server/server-interpolators.js +20 -0
  419. package/dist/server/server-interpolators.js.map +1 -0
  420. package/dist/server/server.js +20 -0
  421. package/dist/server/server.js.map +1 -0
  422. package/dist/server/solid-reactivity.js +26 -0
  423. package/dist/server/solid-reactivity.js.map +1 -0
  424. package/dist/server/spine.js +3044 -0
  425. package/dist/server/spine.js.map +1 -0
  426. package/dist/server/stagger.js +13 -0
  427. package/dist/server/stagger.js.map +1 -0
  428. package/dist/server/unstable/v2/batch-appear-here.js +28 -0
  429. package/dist/server/unstable/v2/batch-appear-here.js.map +1 -0
  430. package/dist/server/unstable/v2/batch-reorder-group.js +378 -0
  431. package/dist/server/unstable/v2/batch-reorder-group.js.map +1 -0
  432. package/dist/server/unstable/v2/bridge.js +76 -0
  433. package/dist/server/unstable/v2/bridge.js.map +1 -0
  434. package/dist/server/unstable/v2/complete.js +29 -0
  435. package/dist/server/unstable/v2/complete.js.map +1 -0
  436. package/dist/server/unstable/v2/config-view.js +111 -0
  437. package/dist/server/unstable/v2/config-view.js.map +1 -0
  438. package/dist/server/unstable/v2/create-animate.js +67 -0
  439. package/dist/server/unstable/v2/create-animate.js.map +1 -0
  440. package/dist/server/unstable/v2/create-batch.js +144 -0
  441. package/dist/server/unstable/v2/create-batch.js.map +1 -0
  442. package/dist/server/unstable/v2/cycle.js +30 -0
  443. package/dist/server/unstable/v2/cycle.js.map +1 -0
  444. package/dist/server/unstable/v2/drag-sensor.js +34 -0
  445. package/dist/server/unstable/v2/drag-sensor.js.map +1 -0
  446. package/dist/server/unstable/v2/element.js +402 -0
  447. package/dist/server/unstable/v2/element.js.map +1 -0
  448. package/dist/server/unstable/v2/feature-section.js +27 -0
  449. package/dist/server/unstable/v2/feature-section.js.map +1 -0
  450. package/dist/server/unstable/v2/flights.js +57 -0
  451. package/dist/server/unstable/v2/flights.js.map +1 -0
  452. package/dist/server/unstable/v2/focus-sensor.js +23 -0
  453. package/dist/server/unstable/v2/focus-sensor.js.map +1 -0
  454. package/dist/server/unstable/v2/hover-sensor.js +28 -0
  455. package/dist/server/unstable/v2/hover-sensor.js.map +1 -0
  456. package/dist/server/unstable/v2/index.js +117 -0
  457. package/dist/server/unstable/v2/index.js.map +1 -0
  458. package/dist/server/unstable/v2/layout-projection.js +18 -0
  459. package/dist/server/unstable/v2/layout-projection.js.map +1 -0
  460. package/dist/server/unstable/v2/layout.js +88 -0
  461. package/dist/server/unstable/v2/layout.js.map +1 -0
  462. package/dist/server/unstable/v2/lifecycle.js +455 -0
  463. package/dist/server/unstable/v2/lifecycle.js.map +1 -0
  464. package/dist/server/unstable/v2/live-scroll.js +128 -0
  465. package/dist/server/unstable/v2/live-scroll.js.map +1 -0
  466. package/dist/server/unstable/v2/live-value.js +166 -0
  467. package/dist/server/unstable/v2/live-value.js.map +1 -0
  468. package/dist/server/unstable/v2/presence-handle.js +146 -0
  469. package/dist/server/unstable/v2/presence-handle.js.map +1 -0
  470. package/dist/server/unstable/v2/presence-hooks.js +142 -0
  471. package/dist/server/unstable/v2/presence-hooks.js.map +1 -0
  472. package/dist/server/unstable/v2/presence.js +142 -0
  473. package/dist/server/unstable/v2/presence.js.map +1 -0
  474. package/dist/server/unstable/v2/press-sensor.js +29 -0
  475. package/dist/server/unstable/v2/press-sensor.js.map +1 -0
  476. package/dist/server/unstable/v2/provider.js +481 -0
  477. package/dist/server/unstable/v2/provider.js.map +1 -0
  478. package/dist/server/unstable/v2/reorder.js +741 -0
  479. package/dist/server/unstable/v2/reorder.js.map +1 -0
  480. package/dist/server/unstable/v2/sensors.js +138 -0
  481. package/dist/server/unstable/v2/sensors.js.map +1 -0
  482. package/dist/server/unstable/v2/solid-reactivity.js +82 -0
  483. package/dist/server/unstable/v2/solid-reactivity.js.map +1 -0
  484. package/dist/server/unstable/v2/variant-node.js +395 -0
  485. package/dist/server/unstable/v2/variant-node.js.map +1 -0
  486. package/dist/server/unstable/v2/w.js +23 -0
  487. package/dist/server/unstable/v2/w.js.map +1 -0
  488. package/dist/server/unstable/v2/waiters.js +185 -0
  489. package/dist/server/unstable/v2/waiters.js.map +1 -0
  490. package/dist/server/unstable/v2/ward.js +1662 -0
  491. package/dist/server/unstable/v2/ward.js.map +1 -0
  492. package/dist/server/unstable/v2/wardic-config.js +49 -0
  493. package/dist/server/unstable/v2/wardic-config.js.map +1 -0
  494. package/dist/server/unstable/v2/wardic.js +16 -0
  495. package/dist/server/unstable/v2/wardic.js.map +1 -0
  496. package/dist/server/variant-node.js +308 -0
  497. package/dist/server/variant-node.js.map +1 -0
  498. package/dist/server/variant-target.js +229 -0
  499. package/dist/server/variant-target.js.map +1 -0
  500. package/dist/server/variant-tree.js +394 -0
  501. package/dist/server/variant-tree.js.map +1 -0
  502. package/dist/server/variants.js +43 -0
  503. package/dist/server/variants.js.map +1 -0
  504. package/dist/server/w.js +25 -0
  505. package/dist/server/w.js.map +1 -0
  506. package/dist/server/ward-keys.js +2 -0
  507. package/dist/server/ward-keys.js.map +1 -0
  508. package/dist/server/wardic-component.js +74 -0
  509. package/dist/server/wardic-component.js.map +1 -0
  510. package/dist/server/wardic-config-value.js +91 -0
  511. package/dist/server/wardic-config-value.js.map +1 -0
  512. package/dist/server/wardic-config.js +42 -0
  513. package/dist/server/wardic-config.js.map +1 -0
  514. package/dist/server/wardic.js +31 -0
  515. package/dist/server/wardic.js.map +1 -0
  516. package/dist/solid/animation-controls.d.ts +103 -0
  517. package/dist/solid/animation-controls.d.ts.map +1 -0
  518. package/dist/solid/animation-controls.js +129 -0
  519. package/dist/solid/animation-controls.js.map +1 -0
  520. package/dist/solid/animation-frame.d.ts +11 -0
  521. package/dist/solid/animation-frame.d.ts.map +1 -0
  522. package/dist/solid/animation-frame.js +31 -0
  523. package/dist/solid/animation-frame.js.map +1 -0
  524. package/dist/solid/appear.d.ts +219 -0
  525. package/dist/solid/appear.d.ts.map +1 -0
  526. package/dist/solid/appear.js +530 -0
  527. package/dist/solid/appear.js.map +1 -0
  528. package/dist/solid/arc.d.ts +25 -0
  529. package/dist/solid/arc.d.ts.map +1 -0
  530. package/dist/solid/arc.js +21 -0
  531. package/dist/solid/arc.js.map +1 -0
  532. package/dist/solid/batch-appear-here.d.ts +9 -0
  533. package/dist/solid/batch-appear-here.d.ts.map +1 -0
  534. package/dist/solid/batch-appear-here.jsx +25 -0
  535. package/dist/solid/batch-appear-here.jsx.map +1 -0
  536. package/dist/solid/batch-gestures.d.ts +22 -0
  537. package/dist/solid/batch-gestures.d.ts.map +1 -0
  538. package/dist/solid/batch-gestures.js +138 -0
  539. package/dist/solid/batch-gestures.js.map +1 -0
  540. package/dist/solid/batch-handoff.d.ts +25 -0
  541. package/dist/solid/batch-handoff.d.ts.map +1 -0
  542. package/dist/solid/batch-handoff.js +75 -0
  543. package/dist/solid/batch-handoff.js.map +1 -0
  544. package/dist/solid/batch-reorder-group.d.ts +118 -0
  545. package/dist/solid/batch-reorder-group.d.ts.map +1 -0
  546. package/dist/solid/batch-reorder-group.jsx +271 -0
  547. package/dist/solid/batch-reorder-group.jsx.map +1 -0
  548. package/dist/solid/batch-reorder-places.d.ts +115 -0
  549. package/dist/solid/batch-reorder-places.d.ts.map +1 -0
  550. package/dist/solid/batch-reorder-places.js +139 -0
  551. package/dist/solid/batch-reorder-places.js.map +1 -0
  552. package/dist/solid/batch-reorder.d.ts +115 -0
  553. package/dist/solid/batch-reorder.d.ts.map +1 -0
  554. package/dist/solid/batch-reorder.js +579 -0
  555. package/dist/solid/batch-reorder.js.map +1 -0
  556. package/dist/solid/batch.d.ts +512 -0
  557. package/dist/solid/batch.d.ts.map +1 -0
  558. package/dist/solid/batch.js +2485 -0
  559. package/dist/solid/batch.js.map +1 -0
  560. package/dist/solid/bridge.d.ts +53 -0
  561. package/dist/solid/bridge.d.ts.map +1 -0
  562. package/dist/solid/bridge.jsx +66 -0
  563. package/dist/solid/bridge.jsx.map +1 -0
  564. package/dist/solid/complete.d.ts +31 -0
  565. package/dist/solid/complete.d.ts.map +1 -0
  566. package/dist/solid/complete.jsx +27 -0
  567. package/dist/solid/complete.jsx.map +1 -0
  568. package/dist/solid/config.d.ts +697 -0
  569. package/dist/solid/config.d.ts.map +1 -0
  570. package/dist/solid/config.js +2 -0
  571. package/dist/solid/config.js.map +1 -0
  572. package/dist/solid/create-animate.d.ts +17 -0
  573. package/dist/solid/create-animate.d.ts.map +1 -0
  574. package/dist/solid/create-animate.jsx +42 -0
  575. package/dist/solid/create-animate.jsx.map +1 -0
  576. package/dist/solid/create-batch.d.ts +94 -0
  577. package/dist/solid/create-batch.d.ts.map +1 -0
  578. package/dist/solid/create-batch.jsx +109 -0
  579. package/dist/solid/create-batch.jsx.map +1 -0
  580. package/dist/solid/create-ward.d.ts +278 -0
  581. package/dist/solid/create-ward.d.ts.map +1 -0
  582. package/dist/solid/create-ward.jsx +876 -0
  583. package/dist/solid/create-ward.jsx.map +1 -0
  584. package/dist/solid/cycle-index.d.ts +7 -0
  585. package/dist/solid/cycle-index.d.ts.map +1 -0
  586. package/dist/solid/cycle-index.js +17 -0
  587. package/dist/solid/cycle-index.js.map +1 -0
  588. package/dist/solid/cycle.d.ts +21 -0
  589. package/dist/solid/cycle.d.ts.map +1 -0
  590. package/dist/solid/cycle.js +31 -0
  591. package/dist/solid/cycle.js.map +1 -0
  592. package/dist/solid/directive.d.ts +21 -0
  593. package/dist/solid/directive.d.ts.map +1 -0
  594. package/dist/solid/directive.jsx +76 -0
  595. package/dist/solid/directive.jsx.map +1 -0
  596. package/dist/solid/drag-constraints.d.ts +46 -0
  597. package/dist/solid/drag-constraints.d.ts.map +1 -0
  598. package/dist/solid/drag-constraints.js +49 -0
  599. package/dist/solid/drag-constraints.js.map +1 -0
  600. package/dist/solid/drag-controls.d.ts +50 -0
  601. package/dist/solid/drag-controls.d.ts.map +1 -0
  602. package/dist/solid/drag-controls.js +51 -0
  603. package/dist/solid/drag-controls.js.map +1 -0
  604. package/dist/solid/drag-samples.d.ts +34 -0
  605. package/dist/solid/drag-samples.d.ts.map +1 -0
  606. package/dist/solid/drag-samples.js +28 -0
  607. package/dist/solid/drag-samples.js.map +1 -0
  608. package/dist/solid/drag-sensor.d.ts +23 -0
  609. package/dist/solid/drag-sensor.d.ts.map +1 -0
  610. package/dist/solid/drag-sensor.jsx +33 -0
  611. package/dist/solid/drag-sensor.jsx.map +1 -0
  612. package/dist/solid/drag-track.d.ts +233 -0
  613. package/dist/solid/drag-track.d.ts.map +1 -0
  614. package/dist/solid/drag-track.js +642 -0
  615. package/dist/solid/drag-track.js.map +1 -0
  616. package/dist/solid/drag-transition.d.ts +20 -0
  617. package/dist/solid/drag-transition.d.ts.map +1 -0
  618. package/dist/solid/drag-transition.js +31 -0
  619. package/dist/solid/drag-transition.js.map +1 -0
  620. package/dist/solid/drag.d.ts +23 -0
  621. package/dist/solid/drag.d.ts.map +1 -0
  622. package/dist/solid/drag.jsx +44 -0
  623. package/dist/solid/drag.jsx.map +1 -0
  624. package/dist/solid/element-style.d.ts +60 -0
  625. package/dist/solid/element-style.d.ts.map +1 -0
  626. package/dist/solid/element-style.js +50 -0
  627. package/dist/solid/element-style.js.map +1 -0
  628. package/dist/solid/element.d.ts +73 -0
  629. package/dist/solid/element.d.ts.map +1 -0
  630. package/dist/solid/element.jsx +326 -0
  631. package/dist/solid/element.jsx.map +1 -0
  632. package/dist/solid/feature-section.d.ts +18 -0
  633. package/dist/solid/feature-section.d.ts.map +1 -0
  634. package/dist/solid/feature-section.js +13 -0
  635. package/dist/solid/feature-section.js.map +1 -0
  636. package/dist/solid/feature.d.ts +119 -0
  637. package/dist/solid/feature.d.ts.map +1 -0
  638. package/dist/solid/feature.js +258 -0
  639. package/dist/solid/feature.js.map +1 -0
  640. package/dist/solid/features/all.d.ts +10 -0
  641. package/dist/solid/features/all.d.ts.map +1 -0
  642. package/dist/solid/features/all.js +10 -0
  643. package/dist/solid/features/all.js.map +1 -0
  644. package/dist/solid/features/colors.d.ts +12 -0
  645. package/dist/solid/features/colors.d.ts.map +1 -0
  646. package/dist/solid/features/colors.js +34 -0
  647. package/dist/solid/features/colors.js.map +1 -0
  648. package/dist/solid/features/dom-animation.d.ts +11 -0
  649. package/dist/solid/features/dom-animation.d.ts.map +1 -0
  650. package/dist/solid/features/dom-animation.js +7 -0
  651. package/dist/solid/features/dom-animation.js.map +1 -0
  652. package/dist/solid/features/dom-max.d.ts +10 -0
  653. package/dist/solid/features/dom-max.d.ts.map +1 -0
  654. package/dist/solid/features/dom-max.js +4 -0
  655. package/dist/solid/features/dom-max.js.map +1 -0
  656. package/dist/solid/features/drag.d.ts +5 -0
  657. package/dist/solid/features/drag.d.ts.map +1 -0
  658. package/dist/solid/features/drag.js +28 -0
  659. package/dist/solid/features/drag.js.map +1 -0
  660. package/dist/solid/features/focus.d.ts +5 -0
  661. package/dist/solid/features/focus.d.ts.map +1 -0
  662. package/dist/solid/features/focus.js +16 -0
  663. package/dist/solid/features/focus.js.map +1 -0
  664. package/dist/solid/features/hover.d.ts +5 -0
  665. package/dist/solid/features/hover.d.ts.map +1 -0
  666. package/dist/solid/features/hover.js +16 -0
  667. package/dist/solid/features/hover.js.map +1 -0
  668. package/dist/solid/features/in-view.d.ts +5 -0
  669. package/dist/solid/features/in-view.d.ts.map +1 -0
  670. package/dist/solid/features/in-view.js +16 -0
  671. package/dist/solid/features/in-view.js.map +1 -0
  672. package/dist/solid/features/input.d.ts +26 -0
  673. package/dist/solid/features/input.d.ts.map +1 -0
  674. package/dist/solid/features/input.js +27 -0
  675. package/dist/solid/features/input.js.map +1 -0
  676. package/dist/solid/features/keys.d.ts +70 -0
  677. package/dist/solid/features/keys.d.ts.map +1 -0
  678. package/dist/solid/features/keys.js +26 -0
  679. package/dist/solid/features/keys.js.map +1 -0
  680. package/dist/solid/features/layout.d.ts +32 -0
  681. package/dist/solid/features/layout.d.ts.map +1 -0
  682. package/dist/solid/features/layout.js +34 -0
  683. package/dist/solid/features/layout.js.map +1 -0
  684. package/dist/solid/features/pan.d.ts +5 -0
  685. package/dist/solid/features/pan.d.ts.map +1 -0
  686. package/dist/solid/features/pan.js +16 -0
  687. package/dist/solid/features/pan.js.map +1 -0
  688. package/dist/solid/features/press.d.ts +11 -0
  689. package/dist/solid/features/press.d.ts.map +1 -0
  690. package/dist/solid/features/press.js +10 -0
  691. package/dist/solid/features/press.js.map +1 -0
  692. package/dist/solid/features/scroll.d.ts +16 -0
  693. package/dist/solid/features/scroll.d.ts.map +1 -0
  694. package/dist/solid/features/scroll.js +21 -0
  695. package/dist/solid/features/scroll.js.map +1 -0
  696. package/dist/solid/focus-sensor.d.ts +19 -0
  697. package/dist/solid/focus-sensor.d.ts.map +1 -0
  698. package/dist/solid/focus-sensor.jsx +23 -0
  699. package/dist/solid/focus-sensor.jsx.map +1 -0
  700. package/dist/solid/frame-time.d.ts +21 -0
  701. package/dist/solid/frame-time.d.ts.map +1 -0
  702. package/dist/solid/frame-time.js +41 -0
  703. package/dist/solid/frame-time.js.map +1 -0
  704. package/dist/solid/gesture-callbacks.d.ts +53 -0
  705. package/dist/solid/gesture-callbacks.d.ts.map +1 -0
  706. package/dist/solid/gesture-callbacks.js +184 -0
  707. package/dist/solid/gesture-callbacks.js.map +1 -0
  708. package/dist/solid/gesture-features.d.ts +28 -0
  709. package/dist/solid/gesture-features.d.ts.map +1 -0
  710. package/dist/solid/gesture-features.js +29 -0
  711. package/dist/solid/gesture-features.js.map +1 -0
  712. package/dist/solid/gesture-info.d.ts +59 -0
  713. package/dist/solid/gesture-info.d.ts.map +1 -0
  714. package/dist/solid/gesture-info.js +23 -0
  715. package/dist/solid/gesture-info.js.map +1 -0
  716. package/dist/solid/hover-sensor.d.ts +19 -0
  717. package/dist/solid/hover-sensor.d.ts.map +1 -0
  718. package/dist/solid/hover-sensor.jsx +23 -0
  719. package/dist/solid/hover-sensor.jsx.map +1 -0
  720. package/dist/solid/imperative.d.ts +203 -0
  721. package/dist/solid/imperative.d.ts.map +1 -0
  722. package/dist/solid/imperative.js +623 -0
  723. package/dist/solid/imperative.js.map +1 -0
  724. package/dist/solid/index.d.ts +184 -0
  725. package/dist/solid/index.d.ts.map +1 -0
  726. package/dist/solid/index.jsx +168 -0
  727. package/dist/solid/index.jsx.map +1 -0
  728. package/dist/solid/instant.d.ts +44 -0
  729. package/dist/solid/instant.d.ts.map +1 -0
  730. package/dist/solid/instant.js +49 -0
  731. package/dist/solid/instant.js.map +1 -0
  732. package/dist/solid/layout-group.d.ts +14 -0
  733. package/dist/solid/layout-group.d.ts.map +1 -0
  734. package/dist/solid/layout-group.js +27 -0
  735. package/dist/solid/layout-group.js.map +1 -0
  736. package/dist/solid/layout-member.d.ts +127 -0
  737. package/dist/solid/layout-member.d.ts.map +1 -0
  738. package/dist/solid/layout-member.js +178 -0
  739. package/dist/solid/layout-member.js.map +1 -0
  740. package/dist/solid/layout-projection.d.ts +22 -0
  741. package/dist/solid/layout-projection.d.ts.map +1 -0
  742. package/dist/solid/layout-projection.jsx +19 -0
  743. package/dist/solid/layout-projection.jsx.map +1 -0
  744. package/dist/solid/layout.d.ts +76 -0
  745. package/dist/solid/layout.d.ts.map +1 -0
  746. package/dist/solid/layout.jsx +80 -0
  747. package/dist/solid/layout.jsx.map +1 -0
  748. package/dist/solid/lazy-batch-gestures.d.ts +13 -0
  749. package/dist/solid/lazy-batch-gestures.d.ts.map +1 -0
  750. package/dist/solid/lazy-batch-gestures.js +70 -0
  751. package/dist/solid/lazy-batch-gestures.js.map +1 -0
  752. package/dist/solid/live-scroll.d.ts +47 -0
  753. package/dist/solid/live-scroll.d.ts.map +1 -0
  754. package/dist/solid/live-scroll.jsx +84 -0
  755. package/dist/solid/live-scroll.jsx.map +1 -0
  756. package/dist/solid/live-style.d.ts +148 -0
  757. package/dist/solid/live-style.d.ts.map +1 -0
  758. package/dist/solid/live-style.js +305 -0
  759. package/dist/solid/live-style.js.map +1 -0
  760. package/dist/solid/live-value.d.ts +103 -0
  761. package/dist/solid/live-value.d.ts.map +1 -0
  762. package/dist/solid/live-value.jsx +169 -0
  763. package/dist/solid/live-value.jsx.map +1 -0
  764. package/dist/solid/member-hold.d.ts +47 -0
  765. package/dist/solid/member-hold.d.ts.map +1 -0
  766. package/dist/solid/member-hold.js +189 -0
  767. package/dist/solid/member-hold.js.map +1 -0
  768. package/dist/solid/motion-props.d.ts +75 -0
  769. package/dist/solid/motion-props.d.ts.map +1 -0
  770. package/dist/solid/motion-props.js +314 -0
  771. package/dist/solid/motion-props.js.map +1 -0
  772. package/dist/solid/owner-scope.d.ts +16 -0
  773. package/dist/solid/owner-scope.d.ts.map +1 -0
  774. package/dist/solid/owner-scope.js +31 -0
  775. package/dist/solid/owner-scope.js.map +1 -0
  776. package/dist/solid/page-point.d.ts +35 -0
  777. package/dist/solid/page-point.d.ts.map +1 -0
  778. package/dist/solid/page-point.js +87 -0
  779. package/dist/solid/page-point.js.map +1 -0
  780. package/dist/solid/presence-controller.d.ts +122 -0
  781. package/dist/solid/presence-controller.d.ts.map +1 -0
  782. package/dist/solid/presence-controller.js +1336 -0
  783. package/dist/solid/presence-controller.js.map +1 -0
  784. package/dist/solid/presence-record.d.ts +173 -0
  785. package/dist/solid/presence-record.d.ts.map +1 -0
  786. package/dist/solid/presence-record.js +26 -0
  787. package/dist/solid/presence-record.js.map +1 -0
  788. package/dist/solid/presence.d.ts +95 -0
  789. package/dist/solid/presence.d.ts.map +1 -0
  790. package/dist/solid/presence.jsx +195 -0
  791. package/dist/solid/presence.jsx.map +1 -0
  792. package/dist/solid/press-sensor.d.ts +20 -0
  793. package/dist/solid/press-sensor.d.ts.map +1 -0
  794. package/dist/solid/press-sensor.jsx +24 -0
  795. package/dist/solid/press-sensor.jsx.map +1 -0
  796. package/dist/solid/press.d.ts +24 -0
  797. package/dist/solid/press.d.ts.map +1 -0
  798. package/dist/solid/press.js +19 -0
  799. package/dist/solid/press.js.map +1 -0
  800. package/dist/solid/provider.d.ts +263 -0
  801. package/dist/solid/provider.d.ts.map +1 -0
  802. package/dist/solid/provider.jsx +411 -0
  803. package/dist/solid/provider.jsx.map +1 -0
  804. package/dist/solid/reactivity.d.ts +27 -0
  805. package/dist/solid/reactivity.d.ts.map +1 -0
  806. package/dist/solid/reactivity.js +9 -0
  807. package/dist/solid/reactivity.js.map +1 -0
  808. package/dist/solid/reorder-input.d.ts +43 -0
  809. package/dist/solid/reorder-input.d.ts.map +1 -0
  810. package/dist/solid/reorder-input.js +113 -0
  811. package/dist/solid/reorder-input.js.map +1 -0
  812. package/dist/solid/reorder-values.d.ts +6 -0
  813. package/dist/solid/reorder-values.d.ts.map +1 -0
  814. package/dist/solid/reorder-values.js +21 -0
  815. package/dist/solid/reorder-values.js.map +1 -0
  816. package/dist/solid/reorder.d.ts +245 -0
  817. package/dist/solid/reorder.d.ts.map +1 -0
  818. package/dist/solid/reorder.jsx +437 -0
  819. package/dist/solid/reorder.jsx.map +1 -0
  820. package/dist/solid/retarget-legs.d.ts +189 -0
  821. package/dist/solid/retarget-legs.d.ts.map +1 -0
  822. package/dist/solid/retarget-legs.js +826 -0
  823. package/dist/solid/retarget-legs.js.map +1 -0
  824. package/dist/solid/runtime.d.ts +179 -0
  825. package/dist/solid/runtime.d.ts.map +1 -0
  826. package/dist/solid/runtime.js +255 -0
  827. package/dist/solid/runtime.js.map +1 -0
  828. package/dist/solid/sensors.d.ts +95 -0
  829. package/dist/solid/sensors.d.ts.map +1 -0
  830. package/dist/solid/sensors.jsx +154 -0
  831. package/dist/solid/sensors.jsx.map +1 -0
  832. package/dist/solid/server-interpolators.d.ts +13 -0
  833. package/dist/solid/server-interpolators.d.ts.map +1 -0
  834. package/dist/solid/server-interpolators.js +20 -0
  835. package/dist/solid/server-interpolators.js.map +1 -0
  836. package/dist/solid/server.d.ts +9 -0
  837. package/dist/solid/server.d.ts.map +1 -0
  838. package/dist/solid/server.js +20 -0
  839. package/dist/solid/server.js.map +1 -0
  840. package/dist/solid/solid-reactivity.d.ts +3 -0
  841. package/dist/solid/solid-reactivity.d.ts.map +1 -0
  842. package/dist/solid/solid-reactivity.js +19 -0
  843. package/dist/solid/solid-reactivity.js.map +1 -0
  844. package/dist/solid/spine.d.ts +613 -0
  845. package/dist/solid/spine.d.ts.map +1 -0
  846. package/dist/solid/spine.js +2887 -0
  847. package/dist/solid/spine.js.map +1 -0
  848. package/dist/solid/stagger.d.ts +29 -0
  849. package/dist/solid/stagger.d.ts.map +1 -0
  850. package/dist/solid/stagger.js +13 -0
  851. package/dist/solid/stagger.js.map +1 -0
  852. package/dist/solid/unstable/v2/batch-appear-here.d.ts +9 -0
  853. package/dist/solid/unstable/v2/batch-appear-here.d.ts.map +1 -0
  854. package/dist/solid/unstable/v2/batch-appear-here.jsx +24 -0
  855. package/dist/solid/unstable/v2/batch-appear-here.jsx.map +1 -0
  856. package/dist/solid/unstable/v2/batch-reorder-group.d.ts +119 -0
  857. package/dist/solid/unstable/v2/batch-reorder-group.d.ts.map +1 -0
  858. package/dist/solid/unstable/v2/batch-reorder-group.jsx +211 -0
  859. package/dist/solid/unstable/v2/batch-reorder-group.jsx.map +1 -0
  860. package/dist/solid/unstable/v2/bridge.d.ts +34 -0
  861. package/dist/solid/unstable/v2/bridge.d.ts.map +1 -0
  862. package/dist/solid/unstable/v2/bridge.jsx +76 -0
  863. package/dist/solid/unstable/v2/bridge.jsx.map +1 -0
  864. package/dist/solid/unstable/v2/complete.d.ts +21 -0
  865. package/dist/solid/unstable/v2/complete.d.ts.map +1 -0
  866. package/dist/solid/unstable/v2/complete.jsx +27 -0
  867. package/dist/solid/unstable/v2/complete.jsx.map +1 -0
  868. package/dist/solid/unstable/v2/config-view.d.ts +49 -0
  869. package/dist/solid/unstable/v2/config-view.d.ts.map +1 -0
  870. package/dist/solid/unstable/v2/config-view.js +114 -0
  871. package/dist/solid/unstable/v2/config-view.js.map +1 -0
  872. package/dist/solid/unstable/v2/create-animate.d.ts +31 -0
  873. package/dist/solid/unstable/v2/create-animate.d.ts.map +1 -0
  874. package/dist/solid/unstable/v2/create-animate.jsx +58 -0
  875. package/dist/solid/unstable/v2/create-animate.jsx.map +1 -0
  876. package/dist/solid/unstable/v2/create-batch.d.ts +106 -0
  877. package/dist/solid/unstable/v2/create-batch.d.ts.map +1 -0
  878. package/dist/solid/unstable/v2/create-batch.jsx +135 -0
  879. package/dist/solid/unstable/v2/create-batch.jsx.map +1 -0
  880. package/dist/solid/unstable/v2/cycle.d.ts +20 -0
  881. package/dist/solid/unstable/v2/cycle.d.ts.map +1 -0
  882. package/dist/solid/unstable/v2/cycle.js +30 -0
  883. package/dist/solid/unstable/v2/cycle.js.map +1 -0
  884. package/dist/solid/unstable/v2/drag-sensor.d.ts +23 -0
  885. package/dist/solid/unstable/v2/drag-sensor.d.ts.map +1 -0
  886. package/dist/solid/unstable/v2/drag-sensor.jsx +32 -0
  887. package/dist/solid/unstable/v2/drag-sensor.jsx.map +1 -0
  888. package/dist/solid/unstable/v2/element.d.ts +178 -0
  889. package/dist/solid/unstable/v2/element.d.ts.map +1 -0
  890. package/dist/solid/unstable/v2/element.jsx +325 -0
  891. package/dist/solid/unstable/v2/element.jsx.map +1 -0
  892. package/dist/solid/unstable/v2/feature-section.d.ts +12 -0
  893. package/dist/solid/unstable/v2/feature-section.d.ts.map +1 -0
  894. package/dist/solid/unstable/v2/feature-section.js +23 -0
  895. package/dist/solid/unstable/v2/feature-section.js.map +1 -0
  896. package/dist/solid/unstable/v2/flights.d.ts +10 -0
  897. package/dist/solid/unstable/v2/flights.d.ts.map +1 -0
  898. package/dist/solid/unstable/v2/flights.js +63 -0
  899. package/dist/solid/unstable/v2/flights.js.map +1 -0
  900. package/dist/solid/unstable/v2/focus-sensor.d.ts +13 -0
  901. package/dist/solid/unstable/v2/focus-sensor.d.ts.map +1 -0
  902. package/dist/solid/unstable/v2/focus-sensor.jsx +23 -0
  903. package/dist/solid/unstable/v2/focus-sensor.jsx.map +1 -0
  904. package/dist/solid/unstable/v2/hover-sensor.d.ts +12 -0
  905. package/dist/solid/unstable/v2/hover-sensor.d.ts.map +1 -0
  906. package/dist/solid/unstable/v2/hover-sensor.jsx +22 -0
  907. package/dist/solid/unstable/v2/hover-sensor.jsx.map +1 -0
  908. package/dist/solid/unstable/v2/index.d.ts +134 -0
  909. package/dist/solid/unstable/v2/index.d.ts.map +1 -0
  910. package/dist/solid/unstable/v2/index.jsx +117 -0
  911. package/dist/solid/unstable/v2/index.jsx.map +1 -0
  912. package/dist/solid/unstable/v2/layout-projection.d.ts +21 -0
  913. package/dist/solid/unstable/v2/layout-projection.d.ts.map +1 -0
  914. package/dist/solid/unstable/v2/layout-projection.jsx +18 -0
  915. package/dist/solid/unstable/v2/layout-projection.jsx.map +1 -0
  916. package/dist/solid/unstable/v2/layout.d.ts +47 -0
  917. package/dist/solid/unstable/v2/layout.d.ts.map +1 -0
  918. package/dist/solid/unstable/v2/layout.jsx +62 -0
  919. package/dist/solid/unstable/v2/layout.jsx.map +1 -0
  920. package/dist/solid/unstable/v2/lifecycle.d.ts +267 -0
  921. package/dist/solid/unstable/v2/lifecycle.d.ts.map +1 -0
  922. package/dist/solid/unstable/v2/lifecycle.js +457 -0
  923. package/dist/solid/unstable/v2/lifecycle.js.map +1 -0
  924. package/dist/solid/unstable/v2/live-scroll.d.ts +47 -0
  925. package/dist/solid/unstable/v2/live-scroll.d.ts.map +1 -0
  926. package/dist/solid/unstable/v2/live-scroll.jsx +94 -0
  927. package/dist/solid/unstable/v2/live-scroll.jsx.map +1 -0
  928. package/dist/solid/unstable/v2/live-value.d.ts +105 -0
  929. package/dist/solid/unstable/v2/live-value.d.ts.map +1 -0
  930. package/dist/solid/unstable/v2/live-value.jsx +171 -0
  931. package/dist/solid/unstable/v2/live-value.jsx.map +1 -0
  932. package/dist/solid/unstable/v2/presence-handle.d.ts +55 -0
  933. package/dist/solid/unstable/v2/presence-handle.d.ts.map +1 -0
  934. package/dist/solid/unstable/v2/presence-handle.js +119 -0
  935. package/dist/solid/unstable/v2/presence-handle.js.map +1 -0
  936. package/dist/solid/unstable/v2/presence-hooks.d.ts +51 -0
  937. package/dist/solid/unstable/v2/presence-hooks.d.ts.map +1 -0
  938. package/dist/solid/unstable/v2/presence-hooks.jsx +115 -0
  939. package/dist/solid/unstable/v2/presence-hooks.jsx.map +1 -0
  940. package/dist/solid/unstable/v2/presence.d.ts +89 -0
  941. package/dist/solid/unstable/v2/presence.d.ts.map +1 -0
  942. package/dist/solid/unstable/v2/presence.jsx +107 -0
  943. package/dist/solid/unstable/v2/presence.jsx.map +1 -0
  944. package/dist/solid/unstable/v2/press-sensor.d.ts +13 -0
  945. package/dist/solid/unstable/v2/press-sensor.d.ts.map +1 -0
  946. package/dist/solid/unstable/v2/press-sensor.jsx +23 -0
  947. package/dist/solid/unstable/v2/press-sensor.jsx.map +1 -0
  948. package/dist/solid/unstable/v2/provider.d.ts +239 -0
  949. package/dist/solid/unstable/v2/provider.d.ts.map +1 -0
  950. package/dist/solid/unstable/v2/provider.jsx +430 -0
  951. package/dist/solid/unstable/v2/provider.jsx.map +1 -0
  952. package/dist/solid/unstable/v2/reorder.d.ts +296 -0
  953. package/dist/solid/unstable/v2/reorder.d.ts.map +1 -0
  954. package/dist/solid/unstable/v2/reorder.jsx +531 -0
  955. package/dist/solid/unstable/v2/reorder.jsx.map +1 -0
  956. package/dist/solid/unstable/v2/sensors.d.ts +91 -0
  957. package/dist/solid/unstable/v2/sensors.d.ts.map +1 -0
  958. package/dist/solid/unstable/v2/sensors.jsx +124 -0
  959. package/dist/solid/unstable/v2/sensors.jsx.map +1 -0
  960. package/dist/solid/unstable/v2/solid-reactivity.d.ts +61 -0
  961. package/dist/solid/unstable/v2/solid-reactivity.d.ts.map +1 -0
  962. package/dist/solid/unstable/v2/solid-reactivity.js +62 -0
  963. package/dist/solid/unstable/v2/solid-reactivity.js.map +1 -0
  964. package/dist/solid/unstable/v2/variant-node.d.ts +51 -0
  965. package/dist/solid/unstable/v2/variant-node.d.ts.map +1 -0
  966. package/dist/solid/unstable/v2/variant-node.js +336 -0
  967. package/dist/solid/unstable/v2/variant-node.js.map +1 -0
  968. package/dist/solid/unstable/v2/w.d.ts +42 -0
  969. package/dist/solid/unstable/v2/w.d.ts.map +1 -0
  970. package/dist/solid/unstable/v2/w.jsx +22 -0
  971. package/dist/solid/unstable/v2/w.jsx.map +1 -0
  972. package/dist/solid/unstable/v2/waiters.d.ts +72 -0
  973. package/dist/solid/unstable/v2/waiters.d.ts.map +1 -0
  974. package/dist/solid/unstable/v2/waiters.js +175 -0
  975. package/dist/solid/unstable/v2/waiters.js.map +1 -0
  976. package/dist/solid/unstable/v2/ward.d.ts +393 -0
  977. package/dist/solid/unstable/v2/ward.d.ts.map +1 -0
  978. package/dist/solid/unstable/v2/ward.jsx +1484 -0
  979. package/dist/solid/unstable/v2/ward.jsx.map +1 -0
  980. package/dist/solid/unstable/v2/wardic-config.d.ts +68 -0
  981. package/dist/solid/unstable/v2/wardic-config.d.ts.map +1 -0
  982. package/dist/solid/unstable/v2/wardic-config.jsx +28 -0
  983. package/dist/solid/unstable/v2/wardic-config.jsx.map +1 -0
  984. package/dist/solid/unstable/v2/wardic.d.ts +28 -0
  985. package/dist/solid/unstable/v2/wardic.d.ts.map +1 -0
  986. package/dist/solid/unstable/v2/wardic.jsx +16 -0
  987. package/dist/solid/unstable/v2/wardic.jsx.map +1 -0
  988. package/dist/solid/variant-node.d.ts +32 -0
  989. package/dist/solid/variant-node.d.ts.map +1 -0
  990. package/dist/solid/variant-node.js +257 -0
  991. package/dist/solid/variant-node.js.map +1 -0
  992. package/dist/solid/variant-target.d.ts +104 -0
  993. package/dist/solid/variant-target.d.ts.map +1 -0
  994. package/dist/solid/variant-target.js +182 -0
  995. package/dist/solid/variant-target.js.map +1 -0
  996. package/dist/solid/variant-tree.d.ts +349 -0
  997. package/dist/solid/variant-tree.d.ts.map +1 -0
  998. package/dist/solid/variant-tree.js +358 -0
  999. package/dist/solid/variant-tree.js.map +1 -0
  1000. package/dist/solid/variants.d.ts +21 -0
  1001. package/dist/solid/variants.d.ts.map +1 -0
  1002. package/dist/solid/variants.js +43 -0
  1003. package/dist/solid/variants.js.map +1 -0
  1004. package/dist/solid/w.d.ts +42 -0
  1005. package/dist/solid/w.d.ts.map +1 -0
  1006. package/dist/solid/w.jsx +23 -0
  1007. package/dist/solid/w.jsx.map +1 -0
  1008. package/dist/solid/ward-keys.d.ts +236 -0
  1009. package/dist/solid/ward-keys.d.ts.map +1 -0
  1010. package/dist/solid/ward-keys.js +2 -0
  1011. package/dist/solid/ward-keys.js.map +1 -0
  1012. package/dist/solid/wardic-component.d.ts +50 -0
  1013. package/dist/solid/wardic-component.d.ts.map +1 -0
  1014. package/dist/solid/wardic-component.js +74 -0
  1015. package/dist/solid/wardic-component.js.map +1 -0
  1016. package/dist/solid/wardic-config-value.d.ts +87 -0
  1017. package/dist/solid/wardic-config-value.d.ts.map +1 -0
  1018. package/dist/solid/wardic-config-value.js +106 -0
  1019. package/dist/solid/wardic-config-value.js.map +1 -0
  1020. package/dist/solid/wardic-config.d.ts +69 -0
  1021. package/dist/solid/wardic-config.d.ts.map +1 -0
  1022. package/dist/solid/wardic-config.jsx +30 -0
  1023. package/dist/solid/wardic-config.jsx.map +1 -0
  1024. package/dist/solid/wardic.d.ts +45 -0
  1025. package/dist/solid/wardic.d.ts.map +1 -0
  1026. package/dist/solid/wardic.jsx +31 -0
  1027. package/dist/solid/wardic.jsx.map +1 -0
  1028. package/package.json +98 -4
  1029. package/src/animation-controls.ts +206 -0
  1030. package/src/animation-frame.ts +32 -0
  1031. package/src/appear.ts +824 -0
  1032. package/src/arc.ts +34 -0
  1033. package/src/batch-appear-here.tsx +25 -0
  1034. package/src/batch-gestures.ts +159 -0
  1035. package/src/batch-handoff.ts +87 -0
  1036. package/src/batch-reorder-group.tsx +497 -0
  1037. package/src/batch-reorder-places.ts +257 -0
  1038. package/src/batch-reorder.ts +764 -0
  1039. package/src/batch.ts +3078 -0
  1040. package/src/bridge.tsx +99 -0
  1041. package/src/complete.tsx +45 -0
  1042. package/src/config.ts +810 -0
  1043. package/src/create-animate.tsx +41 -0
  1044. package/src/create-batch.tsx +219 -0
  1045. package/src/create-ward.tsx +1274 -0
  1046. package/src/cycle-index.ts +18 -0
  1047. package/src/cycle.ts +34 -0
  1048. package/src/directive.tsx +87 -0
  1049. package/src/drag-constraints.ts +103 -0
  1050. package/src/drag-controls.ts +94 -0
  1051. package/src/drag-samples.ts +54 -0
  1052. package/src/drag-sensor.tsx +46 -0
  1053. package/src/drag-track.ts +955 -0
  1054. package/src/drag-transition.ts +43 -0
  1055. package/src/drag.tsx +58 -0
  1056. package/src/element-style.ts +112 -0
  1057. package/src/element.tsx +400 -0
  1058. package/src/feature-section.ts +33 -0
  1059. package/src/feature.ts +359 -0
  1060. package/src/features/all.ts +18 -0
  1061. package/src/features/colors.ts +36 -0
  1062. package/src/features/dom-animation.ts +15 -0
  1063. package/src/features/dom-max.ts +11 -0
  1064. package/src/features/drag.ts +30 -0
  1065. package/src/features/focus.ts +17 -0
  1066. package/src/features/hover.ts +17 -0
  1067. package/src/features/in-view.ts +17 -0
  1068. package/src/features/input.ts +34 -0
  1069. package/src/features/keys.ts +89 -0
  1070. package/src/features/layout.ts +54 -0
  1071. package/src/features/pan.ts +17 -0
  1072. package/src/features/press.ts +17 -0
  1073. package/src/features/scroll.ts +21 -0
  1074. package/src/focus-sensor.tsx +32 -0
  1075. package/src/frame-time.ts +45 -0
  1076. package/src/gesture-callbacks.ts +212 -0
  1077. package/src/gesture-features.ts +35 -0
  1078. package/src/gesture-info.ts +81 -0
  1079. package/src/hover-sensor.tsx +32 -0
  1080. package/src/imperative.ts +894 -0
  1081. package/src/index.tsx +358 -0
  1082. package/src/instant.ts +90 -0
  1083. package/src/layout-group.ts +32 -0
  1084. package/src/layout-member.ts +319 -0
  1085. package/src/layout-projection.tsx +28 -0
  1086. package/src/layout.tsx +127 -0
  1087. package/src/lazy-batch-gestures.ts +78 -0
  1088. package/src/live-scroll.tsx +125 -0
  1089. package/src/live-style.ts +450 -0
  1090. package/src/live-value.tsx +284 -0
  1091. package/src/member-hold.ts +222 -0
  1092. package/src/motion-props.ts +325 -0
  1093. package/src/owner-scope.ts +31 -0
  1094. package/src/page-point.ts +98 -0
  1095. package/src/presence-controller.ts +1616 -0
  1096. package/src/presence-record.ts +196 -0
  1097. package/src/presence.tsx +269 -0
  1098. package/src/press-sensor.tsx +33 -0
  1099. package/src/press.ts +40 -0
  1100. package/src/provider.tsx +526 -0
  1101. package/src/reactivity.ts +29 -0
  1102. package/src/reorder-input.ts +140 -0
  1103. package/src/reorder-values.ts +20 -0
  1104. package/src/reorder.tsx +716 -0
  1105. package/src/retarget-legs.ts +1049 -0
  1106. package/src/runtime.ts +410 -0
  1107. package/src/sensors.tsx +189 -0
  1108. package/src/server-interpolators.ts +33 -0
  1109. package/src/server.ts +21 -0
  1110. package/src/solid-reactivity.ts +21 -0
  1111. package/src/spine.ts +3508 -0
  1112. package/src/stagger.ts +31 -0
  1113. package/src/unstable/v2/batch-appear-here.tsx +24 -0
  1114. package/src/unstable/v2/batch-reorder-group.tsx +385 -0
  1115. package/src/unstable/v2/bridge.tsx +80 -0
  1116. package/src/unstable/v2/complete.tsx +47 -0
  1117. package/src/unstable/v2/config-view.ts +156 -0
  1118. package/src/unstable/v2/create-animate.tsx +85 -0
  1119. package/src/unstable/v2/create-batch.tsx +265 -0
  1120. package/src/unstable/v2/cycle.ts +33 -0
  1121. package/src/unstable/v2/drag-sensor.tsx +44 -0
  1122. package/src/unstable/v2/element.tsx +478 -0
  1123. package/src/unstable/v2/feature-section.ts +32 -0
  1124. package/src/unstable/v2/flights.ts +65 -0
  1125. package/src/unstable/v2/focus-sensor.tsx +31 -0
  1126. package/src/unstable/v2/hover-sensor.tsx +30 -0
  1127. package/src/unstable/v2/index.tsx +297 -0
  1128. package/src/unstable/v2/layout-projection.tsx +27 -0
  1129. package/src/unstable/v2/layout.tsx +89 -0
  1130. package/src/unstable/v2/lifecycle.ts +612 -0
  1131. package/src/unstable/v2/live-scroll.tsx +137 -0
  1132. package/src/unstable/v2/live-value.tsx +309 -0
  1133. package/src/unstable/v2/presence-handle.ts +159 -0
  1134. package/src/unstable/v2/presence-hooks.tsx +157 -0
  1135. package/src/unstable/v2/presence.tsx +174 -0
  1136. package/src/unstable/v2/press-sensor.tsx +31 -0
  1137. package/src/unstable/v2/provider.tsx +530 -0
  1138. package/src/unstable/v2/reorder.tsx +888 -0
  1139. package/src/unstable/v2/sensors.tsx +169 -0
  1140. package/src/unstable/v2/solid-reactivity.ts +69 -0
  1141. package/src/unstable/v2/variant-node.ts +446 -0
  1142. package/src/unstable/v2/w.tsx +49 -0
  1143. package/src/unstable/v2/waiters.ts +212 -0
  1144. package/src/unstable/v2/ward.tsx +2078 -0
  1145. package/src/unstable/v2/wardic-config.tsx +84 -0
  1146. package/src/unstable/v2/wardic.tsx +41 -0
  1147. package/src/variant-node.ts +368 -0
  1148. package/src/variant-target.ts +240 -0
  1149. package/src/variant-tree.ts +638 -0
  1150. package/src/variants.ts +47 -0
  1151. package/src/w.tsx +59 -0
  1152. package/src/ward-keys.ts +343 -0
  1153. package/src/wardic-component.ts +96 -0
  1154. package/src/wardic-config-value.ts +150 -0
  1155. package/src/wardic-config.tsx +78 -0
  1156. package/src/wardic.tsx +59 -0
@@ -0,0 +1,2078 @@
1
+ /**
2
+ * `ward(config)`: a **Ward** on Solid 2 (`@wardic/solid/unstable/v2`, #209, ADR-0045). It puts one
3
+ * element's motion on the Solid 1 binding's spine (`../../spine.ts`): the same Override stack,
4
+ * Retarget, Base values and flush gate (ADR-0005, ADR-0022, ADR-0034), wired into Solid 2.
5
+ *
6
+ * A ward is a ref that carries its props:
7
+ *
8
+ * ```tsx
9
+ * const card = ward({ animate: () => ({ x: open() ? 100 : 0 }) }) // in the component's body
10
+ * <div {...card} /> // its Starting style in server HTML
11
+ * <div ref={ward({ animate: { opacity: 1 } })} /> // client-only: no Starting style
12
+ * ```
13
+ *
14
+ * - **It's made once per element, then spread**: in a component's body, a `<For>` callback, a root.
15
+ * Solid 2 runs a spread's expression again on every run of the element's props, so
16
+ * `{...ward(config)}` makes a new ward for the same element each time: the second one to mount
17
+ * it throws, naming the fix. A `ref`'s expression is run with the element's, so
18
+ * `ref={ward(config)}` is fine inline.
19
+ * - **Its props are its own keys.** `ref` (the ward), `style` (a getter) and the Starting style's
20
+ * attributes are enumerable, so a spread applies them; `Provider`, `read` and `atom` aren't.
21
+ * Solid 2's `merge` reads a function source through a memo, calling it with its previous value,
22
+ * so a ward called with anything but an element returns itself.
23
+ * - **Its config is read once, each key through an accessor where it changes** (or getters, as a
24
+ * component's props are): `ward({ animate: () => ({ … }) })`. A whole config as one accessor,
25
+ * `ward(() => ({ … }))`, throws, naming that form.
26
+ * - **It mounts in an effect.** Every primitive is made at setup, under the ward's owner. The ref,
27
+ * called during render, sets the element; an effect's apply mounts it (registers it with the
28
+ * gate, builds its spine) and Retargets on each change of its target or of its `when` gate.
29
+ * Solid 2's apply has no owner, so what a mount makes (a Live value's watch) is made under the
30
+ * ward's.
31
+ * - **Its target is compared by value** (`sameResolution`), as the Solid 1 binding's is (#470): a
32
+ * `style` or `transition` change in its config doesn't Retarget, as Motion's doesn't; a new variant
33
+ * name does, and so does a gesture layer that sets something turning on or off.
34
+ * - **Given to a component** (#349, ADR-0046 *Amendment (#349)*): a Wardic component's `wardRef`
35
+ * takes a ward, and drives its element with a ward of its own for each element, its *driving
36
+ * ward*: on this one's config, variant node and lifecycle, under the component's presence and with
37
+ * its tag. This one follows its driver (`read`, `atom`, a `next`'s gestures) while its element is
38
+ * mounted, one at a time, and is never mounted itself. `ward(config, { parent })` names its
39
+ * variant parent when it's made outside the tree. A ward on two elements on the page at once,
40
+ * given or spread, throws.
41
+ * - **Presence and layout** (PR 2 of #209): under an `<AnimatePresence>` the mount registers its exit
42
+ * record, kept current from its config's `exit`; a `layout`, `layoutId`, `layoutScroll` or
43
+ * `layoutRoot` element registers one projection node (`layout-member.ts`), re-measured when its
44
+ * `layoutDependency` changes. A layout node's Starting style is drawn through its projection at
45
+ * rest, as its first commit draws it (#245).
46
+ *
47
+ * @module
48
+ */
49
+ import type * as Drag from "@wardic/core/Drag"
50
+ import type * as InputFeed from "@wardic/core/InputFeed"
51
+ import { tapPropagates } from "../../press.ts"
52
+ import * as Report from "@wardic/dom/Report"
53
+ import * as Renderer from "@wardic/core/Renderer"
54
+ import type * as Values from "@wardic/core/Values"
55
+ import * as DomRenderer from "@wardic/dom/DomRenderer"
56
+ import type * as ProjectionSystem from "@wardic/dom/ProjectionSystem"
57
+ import * as Style from "@wardic/dom/Style"
58
+ import * as Svg from "@wardic/dom/Svg"
59
+ import * as Arr from "effect/Array"
60
+ import * as Bool from "effect/Boolean"
61
+ import type * as Context from "effect/Context"
62
+ import * as Cause from "effect/Cause"
63
+ import * as Effect from "effect/Effect"
64
+ import * as Scope from "effect/Scope"
65
+ import { constFalse, constTrue, constUndefined, constVoid, identity, pipe } from "effect/Function"
66
+ import * as Option from "effect/Option"
67
+ import * as Predicate from "effect/Predicate"
68
+ import * as UndefinedOr from "effect/UndefinedOr"
69
+ import * as Atom from "effect/reactivity/Atom"
70
+ import { isServer, type JSX, useHead } from "@solidjs/web"
71
+ import {
72
+ type Accessor,
73
+ createEffect,
74
+ createMemo,
75
+ createSignal,
76
+ createUniqueId,
77
+ DEV,
78
+ getOwner,
79
+ isHydrating,
80
+ type Owner,
81
+ onCleanup,
82
+ runWithOwner,
83
+ type Signal,
84
+ untrack,
85
+ } from "solid-js"
86
+ import type { WardConfig as SharedWardConfig, WardicValues } from "../../config.ts"
87
+ import { MOTION_PROPS_V2, type SolidOneCallback } from "../../motion-props.ts"
88
+ import * as OwnerScope from "../../owner-scope.ts"
89
+
90
+
91
+
92
+
93
+
94
+ import { GESTURE_WORDS, serviceIn } from "../../gesture-features.ts"
95
+ import { inViewOptionsOf } from "../../gesture-callbacks.ts"
96
+ import { projectionIn, type WardicServices } from "../../runtime.ts"
97
+ import type { WardCheckedConfig, WardKey, WardValueOf } from "../../ward-keys.ts"
98
+ import { createElementStyle } from "../../element-style.ts"
99
+ import { createLiveStyle, type LiveSource, readLive, serverRegistryOf, split } from "../../live-style.ts"
100
+ import { dragTransitionOf } from "../../drag-transition.ts"
101
+ import { layoutOptionsOf, registrationOf, wantsLayoutNode } from "../../layout-member.ts"
102
+ import { useLayoutGroupId } from "./layout.tsx"
103
+ import { registerAnimatable } from "../../imperative.ts"
104
+ import { type ControlsChange, controlledConfigOf, controlledElement, isAnimationControls, subscribe, uncontrolledOf, type WardicAnimationControls } from "../../animation-controls.ts"
105
+ import { settingOf, type WardicConfigValue } from "../../wardic-config-value.ts"
106
+ import { type PresenceSeed, presenceBlocksInitial, presenceHold, presenceSeedOf } from "../../presence-record.ts"
107
+ import { handoffOf, setsAnimation } from "../../appear.ts"
108
+ import {
109
+ appearEntryOf,
110
+ applyDragDefaults,
111
+ dragAxisOf,
112
+ dragDefaultsOf,
113
+ claimForDrag,
114
+ draggingWithWillChange,
115
+ drawnAtRest,
116
+ followTemplate,
117
+ heldTransformFor,
118
+ registeredValuesOf,
119
+ type ElementSpine,
120
+ type ElementSpineOptions,
121
+ flagStartingStyle,
122
+ isLayoutNode,
123
+ makeElementSpine,
124
+ makeReuse,
125
+ exitConfigOf,
126
+ exitTargetOf,
127
+ presenceTreeOf,
128
+ NO_EXIT_CONFIG,
129
+ madeWith,
130
+ presenceRecordOf,
131
+ recordFrameOf,
132
+ registryOf,
133
+ releasingAppear,
134
+ type Resolution,
135
+ resolutionOf,
136
+ restingOf,
137
+ sameResolution,
138
+ serverStartingStyle,
139
+ snapshotOf,
140
+ startLinksOf,
141
+ startOf,
142
+ warnDroppedTransform,
143
+ withOnUpdate,
144
+ } from "../../spine.ts"
145
+ import { inheritedContext, serverVariantNode, startsAtAnimate, startsQuiet, type WardicVariantContextValue } from "../../variant-tree.ts"
146
+ import { followAtom } from "./bridge.tsx"
147
+ import {
148
+ appearStyle,
149
+ useWardicAppear,
150
+ useWardicGate,
151
+ useWardicPositionalKeys,
152
+ useWardicDefaultTransition,
153
+ useBuiltProjection,
154
+ useWardicReducedMotion,
155
+ useWardicRenderer,
156
+ useWardicRuntime,
157
+ useWardicSkipAnimations,
158
+ useElementFeatures,
159
+ useFeatureRegistry,
160
+ } from "./provider.tsx"
161
+ import { type Feature, type FeatureRegistry, type FeatureSection, LAYOUT_PROPS, missingMessage, unreadColorIn } from "../../feature.ts"
162
+ import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED, CLIENT_ONLY_SYNC, CLIENT_ONLY_SYNC_DEFERRED, reactivityIn } from "./solid-reactivity.ts"
163
+ import { useWardicConfig } from "./wardic-config.tsx"
164
+ import { pointMapOptionOf, transformPagePointOf } from "../../wardic-config-value.ts"
165
+ import { configView, type Fixed, type PerKey, type PerKeyApart } from "./config-view.ts"
166
+ import { Lifecycle, type WardEvent, type WardEvents, type WardPressInfo, type WardSettled } from "./lifecycle.ts"
167
+ import { neverLands, NO_EVENTS, serverWhen } from "./waiters.ts"
168
+ import { usePresenceContext } from "./presence.tsx"
169
+ import { createVariantNode, useVariantContext, type VariantNode, WardicVariantContext } from "./variant-node.ts"
170
+ import type { DragTrack } from "../../drag-track.ts"
171
+ import { DragGesture, FocusGesture, HoverGesture, InViewGesture, PanGesture, PressGesture } from "../../features/keys.ts"
172
+
173
+ /**
174
+ * A Wardic element's `style`: every CSS property and the transform keys (`x`,
175
+ * `scale`, `rotate`…), each a value or a **Live value**: an `effect/reactivity` Atom, or an
176
+ * accessor, uncalled (a signal, a memo, a ward's `read(key)`). A called value is a resting value:
177
+ * the element shows it at rest, and a return goes to where it is then. A Live value reading
178
+ * `undefined` (a ward's `read(key)` for a key with no value) leaves the key where it is.
179
+ */
180
+ export type WardStyle = { readonly [K in keyof WardicValues]?: WardicValues[K] | LiveSource<number | string | undefined> | undefined }
181
+
182
+ /** A ward's config values: the element's motion, and its `style`. */
183
+ export interface WardConfigValues extends Omit<SharedWardConfig, SolidOneCallback> {
184
+ /**
185
+ * The element's style: Wardic's animated keys go over it, and a key no layer of the Override
186
+ * stack sets returns to it. Its Live values are followed through the gate.
187
+ */
188
+ readonly style?: WardStyle | string | undefined
189
+ }
190
+
191
+ /**
192
+ * The config keys whose values are functions: read as they are, never called as accessors (#259).
193
+ * `dragConstraints`' function is its container's accessor (#273), read at each measure; a
194
+ * `transformTemplate` is called by the renderer (#443).
195
+ */
196
+ type WardCallbackKey = "onUpdate" | "dragConstraints" | "onMeasureDragConstraints" | "transformTemplate" | "onBeforeLayoutMeasure" | "onLayoutMeasure"
197
+
198
+ /**
199
+ * A ward's config: each key a value, or an accessor of it, read per key. A getter,
200
+ * a store's property or a component's prop is tracked as it's read, and an accessor is called as
201
+ * it's read, so a change re-runs only what reads that key; a plain value is a constant. `initial`,
202
+ * `drag` and its settings, and `layout` and the rest of its keys are read once, at setup.
203
+ */
204
+ export type WardConfig = PerKey<WardConfigValues, WardCallbackKey>
205
+
206
+ /**
207
+ * A ward's config `C` with its transitions' entries checked against the keys each drives. A wrapper that hands its config on takes `config: WardChecked<C>` for its own
208
+ * `<const C extends WardConfig>`, and passes `C` on: `ward<C>(config)`.
209
+ */
210
+ export type WardChecked<C> = WardCheckedConfig<C, PerKeyApart<WardConfigValues, WardCallbackKey>>
211
+
212
+ /** Every key a ward reads, its callbacks among them. */
213
+ const WARD_KEYS = [
214
+ "initial",
215
+ "animate",
216
+ "variants",
217
+ "custom",
218
+ "inherit",
219
+ "whileHover",
220
+ "whileTap",
221
+ "whileInView",
222
+ "whileFocus",
223
+ "viewport",
224
+ "drag",
225
+ "whileDrag",
226
+ "dragConstraints",
227
+ "dragElastic",
228
+ "dragMomentum",
229
+ "dragSnapToOrigin",
230
+ "dragTransition",
231
+ "dragPropagation",
232
+ "propagate",
233
+ "dragDirectionLock",
234
+ "dragControls",
235
+ "dragListener",
236
+ "onMeasureDragConstraints",
237
+ "transition",
238
+ "exit",
239
+ "layout",
240
+ "layoutDependency",
241
+ "layoutId",
242
+ "layoutScroll",
243
+ "layoutRoot",
244
+ "layoutAnchor",
245
+ "layoutCrossfade",
246
+ "onUpdate",
247
+ "transformTemplate",
248
+ "onBeforeLayoutMeasure",
249
+ "onLayoutMeasure",
250
+ "appear",
251
+ "style",
252
+ "key",
253
+ ] as const satisfies ReadonlyArray<keyof WardConfigValues>
254
+ /** Types only: a key `WardConfigValues` gains and {@link WARD_KEYS} misses fails here. */
255
+ type UnreadKey = Exclude<keyof WardConfigValues, (typeof WARD_KEYS)[number]>
256
+ const everyKeyRead: [UnreadKey] extends [never] ? true : UnreadKey = true
257
+ void everyKeyRead
258
+ /**
259
+ * Types only: a Solid 2 motion prop no ward key reads fails here (#273: `whileInView` and
260
+ * `whileFocus` were split off the element and dropped).
261
+ */
262
+ type UnreadProp = Exclude<(typeof MOTION_PROPS_V2)[number], (typeof WARD_KEYS)[number]>
263
+ const everyPropRead: [UnreadProp] extends [never] ? true : UnreadProp = true
264
+ void everyPropRead
265
+
266
+ /**
267
+ * The target memo's comparison (#337): {@link sameResolution}, and a change when there's nothing to
268
+ * compare with. Solid 2 calls a memo's `equals` with no previous value when the memo was made inside
269
+ * an action's transaction, as a ward an optimistic write makes is, before anything has committed.
270
+ */
271
+ const sameTarget = (a: Resolution | undefined, b: Resolution | undefined): boolean => {
272
+ if (Predicate.isUndefined(a)) return false
273
+ if (Predicate.isUndefined(b)) return false
274
+ return sameResolution(a, b)
275
+ }
276
+
277
+ /** A ward's config read per key (#259). */
278
+ const WARD_VIEW = configView<WardConfigValues>(WARD_KEYS, ["onUpdate", "dragConstraints", "onMeasureDragConstraints", "transformTemplate", "onBeforeLayoutMeasure", "onLayoutMeasure"])
279
+
280
+ /** `config` read per key (#259), for a read outside a ward: a `wardic.<tag>`'s props at setup. Internal. */
281
+ export const wardConfigView = (config: WardConfig): WardConfigValues => WARD_VIEW.of(config)
282
+
283
+ /** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
284
+ const WHOLE_ACCESSOR =
285
+ "ward(config) takes its config as an object, read per key (#259): make a key reactive with an accessor " +
286
+ "(`ward({ animate: () => ({ x: x() }) })`), a getter, a store or a component's props, not the whole config " +
287
+ "(`ward(() => ({ … }))`)."
288
+
289
+ /**
290
+ * {@link Ward.read}: completion offers the keys its config animates, and any other
291
+ * key is accepted; a transform key reads a number, any other the type its config gives it.
292
+ */
293
+ export interface WardRead<C> {
294
+ <K extends WardKey<C>>(key: K): Accessor<WardValueOf<C, K & string>>
295
+ }
296
+
297
+ /** The props a spread of a {@link Ward} applies. */
298
+ /**
299
+ * What {@link Ward.with} takes (the Solid 1 ward's `ward({ ref, style })`): the element's own
300
+ * `ref` and `style`, given where the ward is spread.
301
+ */
302
+ export interface WardWithProps {
303
+ /** Called with the element beside the ward's own ref: a `ref` written after the spread would replace it. */
304
+ readonly ref?: ((element: HTMLElement) => void) | ReadonlyArray<(element: HTMLElement) => void> | undefined
305
+ /** Laid over the config's `style`, key by key: a Live value in it is followed as one in the config is. */
306
+ readonly style?: WardStyle | string | undefined
307
+ }
308
+
309
+ /** What a ward's spread gives its element: the ward itself as its `ref`, and its `style`. */
310
+ export interface WardProps {
311
+ /** The ward: Solid calls it with the element. */
312
+ readonly ref: (element: HTMLElement) => void
313
+ /**
314
+ * The element's style: the Starting style over the config's `style` until the gate's first
315
+ * commit, then the config's `style` without the keys the gate holds. Never per frame.
316
+ */
317
+ readonly style: JSX.CSSProperties
318
+ }
319
+
320
+ /**
321
+ * A ward's mark (#349): what tells a ward given to a component's `wardRef` from a function handed the
322
+ * component's own ward. Internal: its value is the ward's {@link WardShare}.
323
+ */
324
+ export const WARD: unique symbol = Symbol("wardic.ward")
325
+
326
+ /** Any ward, whatever its config: what `wardRef` takes in, and `parent`. */
327
+ export interface AnyWard {
328
+ readonly [WARD]: unknown
329
+ }
330
+
331
+ /**
332
+ * A ward's own state, read by the members it shares with every other ward (#525): what they need of
333
+ * it, and each member's closure once made.
334
+ */
335
+ interface WardState {
336
+ readonly shared: () => WardShare
337
+ readonly Provider: (props: { readonly children?: JSX.Element }) => JSX.Element
338
+ readonly read: (key: string) => Accessor<unknown>
339
+ readonly atom: (key: string) => Atom.Atom<unknown>
340
+ readonly with: (own: WardWithProps) => WardProps
341
+ readonly lifecycle: Lifecycle
342
+ settled: Accessor<WardSettled | undefined> | undefined
343
+ tapped: Accessor<WardPressInfo | undefined> | undefined
344
+ next: (<E extends WardEvent>(name: E) => Promise<WardEvents[E]>) | undefined
345
+ each: (<E extends WardEvent>(name: E) => AsyncIterable<WardEvents[E]>) | undefined
346
+ when: (<E extends WardEvent>(name: E) => Accessor<WardEvents[E]>) | undefined
347
+ }
348
+
349
+ /** Where a ward keeps its {@link WardState}: on itself, not enumerable, so a spread never sees it. */
350
+ const WARD_STATE: unique symbol = Symbol("wardic.wardState")
351
+
352
+ /** A ward's {@link WardState}. */
353
+ const stateOf = (ward: object): WardState => (ward as { readonly [WARD_STATE]: WardState })[WARD_STATE]
354
+
355
+ /**
356
+ * The members every client ward shares (#525): one prototype over `Function.prototype`, so a ward is
357
+ * still a function, Solid's ref. Each is a getter: its closure is made at its first read and kept on
358
+ * that ward, so one taken off the ward still works and one never read is never made. A ward was
359
+ * given each as its own property, a descriptor and most a closure apiece, in one `defineProperties` a
360
+ * ward: the line a Solid 2 mount spent most in. A ward keeps `ref`, `style` and its attributes as its
361
+ * own, enumerable, as a spread and `Object.keys` read them.
362
+ */
363
+ const WARD_MEMBER_KEYS: PropertyDescriptorMap = {
364
+ [WARD]: {
365
+ get(this: object): WardShare {
366
+ return stateOf(this).shared()
367
+ },
368
+ },
369
+ Provider: {
370
+ get(this: object): WardState["Provider"] {
371
+ return stateOf(this).Provider
372
+ },
373
+ },
374
+ read: {
375
+ get(this: object): WardState["read"] {
376
+ return stateOf(this).read
377
+ },
378
+ },
379
+ atom: {
380
+ get(this: object): WardState["atom"] {
381
+ return stateOf(this).atom
382
+ },
383
+ },
384
+ with: {
385
+ get(this: object): WardState["with"] {
386
+ return stateOf(this).with
387
+ },
388
+ },
389
+ settled: {
390
+ get(this: object): Accessor<WardSettled | undefined> {
391
+ const state = stateOf(this)
392
+ if (Predicate.isNotUndefined(state.settled)) return state.settled
393
+ const lifecycle = state.lifecycle
394
+ state.settled = () => lifecycle.read()
395
+ return state.settled
396
+ },
397
+ },
398
+ tapped: {
399
+ get(this: object): Accessor<WardPressInfo | undefined> {
400
+ const state = stateOf(this)
401
+ if (Predicate.isNotUndefined(state.tapped)) return state.tapped
402
+ const lifecycle = state.lifecycle
403
+ state.tapped = () => lifecycle.tapped()
404
+ return state.tapped
405
+ },
406
+ },
407
+ next: {
408
+ get(this: object): NonNullable<WardState["next"]> {
409
+ const state = stateOf(this)
410
+ if (Predicate.isNotUndefined(state.next)) return state.next
411
+ const lifecycle = state.lifecycle
412
+ const next = <E extends WardEvent>(name: E): Promise<WardEvents[E]> => lifecycle.wait(name)
413
+ state.next = next
414
+ return next
415
+ },
416
+ },
417
+ each: {
418
+ get(this: object): NonNullable<WardState["each"]> {
419
+ const state = stateOf(this)
420
+ if (Predicate.isNotUndefined(state.each)) return state.each
421
+ const lifecycle = state.lifecycle
422
+ const each = <E extends WardEvent>(name: E): AsyncIterable<WardEvents[E]> => lifecycle.each(name)
423
+ state.each = each
424
+ return each
425
+ },
426
+ },
427
+ when: {
428
+ get(this: object): NonNullable<WardState["when"]> {
429
+ const state = stateOf(this)
430
+ if (Predicate.isNotUndefined(state.when)) return state.when
431
+ const lifecycle = state.lifecycle
432
+ const when = <E extends WardEvent>(name: E): Accessor<WardEvents[E]> => lifecycle.when(name)
433
+ state.when = when
434
+ return when
435
+ },
436
+ },
437
+ }
438
+
439
+ /** {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`. */
440
+ const WARD_MEMBERS: object = /*#__PURE__*/ Object.create(Function.prototype, WARD_MEMBER_KEYS)
441
+
442
+ /** `ward(config, options)`'s options. */
443
+ export interface WardOptions {
444
+ /**
445
+ * Its variant parent, for a ward made outside the tree its element renders in: it
446
+ * inherits that ward's variant names and transition, and joins its stagger and `when`, as an
447
+ * element rendered under it would. Stagger counts children in the order they're made. Left out,
448
+ * it's the one where the ward is made. A ward given to a component with none, under another
449
+ * variant parent it would inherit from, is an error.
450
+ */
451
+ readonly parent?: AnyWard | undefined
452
+ }
453
+
454
+ /**
455
+ * One element's motion binding: a ref carrying its props (see the module). Spread it, give it to
456
+ * `ref` (alone, or in an array with your own), or give it to a Wardic component's `wardRef`.
457
+ */
458
+ export interface Ward<C extends WardConfig = WardConfig> extends WardProps, AnyWard {
459
+ /** Mounts the ward on `element`: Solid calls it as a ref. */
460
+ (element: HTMLElement): void
461
+ /**
462
+ * Its spread's props alone: what Solid 2's `merge` reads when the ward is spread, calling it
463
+ * as a function source. Only `ref`, `style` and the Starting style's attributes, on no prototype, so
464
+ * none of the ward's own names (`name`, `length`, `read`, `next`…) shadows the element's props.
465
+ */
466
+ (previous?: unknown): WardProps
467
+ /**
468
+ * Hands this element's variant context to the subtree: its Variant children
469
+ * inherit its variant name and transition, and join its stagger and `when`.
470
+ */
471
+ readonly Provider: (props: { readonly children?: JSX.Element }) => JSX.Element
472
+ /**
473
+ * The element's value for `key`, as an accessor: what Wardic shows
474
+ * for it, whoever moves it, as a number for a transform key (`x`, not its `transform`). At rest
475
+ * outside the gate, its `initial`, else its `style` value, else a transform key's identity. One
476
+ * accessor a key, made at the first ask. Read, not `value` (the Solid 1 ward's name): a spread
477
+ * would give it to `<li>`'s and `<input>`'s `value`. Its keys are typed from the config.
478
+ */
479
+ readonly read: WardRead<C>
480
+ /** The element's value for `key` as an `effect/reactivity` Atom, `undefined` while the gate doesn't hold the key. */
481
+ readonly atom: <K extends WardKey<C>>(key: K) => Atom.Atom<WardValueOf<C, K & string> | undefined>
482
+ /**
483
+ * The element's last landing, as an async value: `undefined` before the first,
484
+ * ready from its first read, and pending while a Retarget runs, keeping the last landing meanwhile.
485
+ * `isPending(() => card.settled())` is "animating"; `card.settled()?.definition` is what landed:
486
+ * the variant name `animate` changed to, else the target values. Solid 1's
487
+ * `onAnimationStart` / `onAnimationComplete` have no place here.
488
+ */
489
+ readonly settled: Accessor<WardSettled | undefined>
490
+ /**
491
+ * The element's last tap, as an async value, as {@link settled} is its last
492
+ * landing: `undefined` before the first, ready from its first read, and pending while a press is
493
+ * held, from a pointer or a key (a **Keyboard press**), keeping the last tap meanwhile. So
494
+ * `isPending(() => card.tapped())` is "pressed". A tap resolves it to the tap's event (its `point`,
495
+ * its `input`, its element); a cancel, or a press a drag took over, keeps the last tap. Its first read
496
+ * asks for the press, as `next("tap")` does: the ward runs its recognizer, and its element is made
497
+ * focusable.
498
+ *
499
+ * ```tsx
500
+ * <button {...send}>{isPending(() => send.tapped()) ? "Release to send" : "Send"}</button>
501
+ * ```
502
+ */
503
+ readonly tapped: Accessor<WardPressInfo | undefined>
504
+ /**
505
+ * A promise of the element's next `name` after the call, to `await` in a handler
506
+ * or an action:
507
+ * - `"settled"`: its next landing. A Retarget the next one interrupts doesn't land; it waits for
508
+ * one that does.
509
+ * - `"hoverStart"`, `"hoverEnd"`, `"pressStart"`, `"tap"`, `"tapCancel"`: Motion's hover and tap
510
+ * events, with the pointer's `point` in the viewport. A press a drag took over is neither a
511
+ * tap nor a cancel.
512
+ * - `"hover"`: the pointer over the element while it's hovered, its start (after
513
+ * `"hoverStart"`) and each move, as `"drag"` is a drag's. Wardic's own: Motion's hover has only
514
+ * a start and an end.
515
+ * - `"dragStart"`, `"drag"` (its start and each move), `"dragEnd"`: a drag's, with its `point`,
516
+ * `offset`, `delta` and `velocity`; `"dragTransitionEnd"`, its release at rest. A ward that
517
+ * doesn't drag never has one.
518
+ * - `"panSessionStart"` (with its `point`), `"panStart"`, `"pan"`, `"panEnd"`: a pan's, as a
519
+ * drag's. A pan moves nothing; once started, a press it took over is neither a tap nor a cancel.
520
+ *
521
+ * A gesture's event starts its recognizer, if its `while*` hasn't. Rejected with a
522
+ * `DOMException` named `"AbortError"` once the ward is disposed.
523
+ */
524
+ readonly next: <E extends WardEvent>(name: E) => Promise<WardEvents[E]>
525
+ /**
526
+ * Every `name` from the call on, as an async iterable, for a `for await`: each step waits as
527
+ * `next(name)` does, so one that comes while its body runs is missed; the loop ends once the ward is
528
+ * disposed, with no `AbortError`. To act on each one in an effect, use {@link when}: a memo over
529
+ * `each` misses one between its steps, and on a page rendered on the server it needs
530
+ * `ssrSource: "client"` and a `<Loading>`.
531
+ */
532
+ readonly each: <E extends WardEvent>(name: E) => AsyncIterable<WardEvents[E]>
533
+ /**
534
+ * Every `name`, as a memo for an effect: pending until the first, so the effect runs at each
535
+ * one and never before, typed as the event, on any page (no `ssrSource`, no `<Loading>`). It hears
536
+ * each one as it's told, so none is lost between steps; several in one flush run the effect once,
537
+ * with the latest. A failure (`"settled"`'s) goes to the effect's `error` arm
538
+ * (`createEffect(card.when("settled"), { effect, error })`); without one, Solid logs it and skips
539
+ * the run. Read it in an effect, not in the element's own JSX, whose region it would wait on. Call
540
+ * it in a component's body, as `createMemo`.
541
+ *
542
+ * ```tsx
543
+ * const card = ward({ drag: "x" })
544
+ * createEffect(card.when("dragEnd"), (release) => {
545
+ * if (Math.abs(release.offset.x) >= 120) dismiss(release.offset.x < 0 ? "left" : "right")
546
+ * })
547
+ * ```
548
+ */
549
+ readonly when: <E extends WardEvent>(name: E) => Accessor<WardEvents[E]>
550
+ /**
551
+ * The ward's props with the element's own (the Solid 1 ward's `ward({ ref, style })`): its
552
+ * `ref` called beside the ward's, and its `style` over the config's, key by key. For a style made
553
+ * after the ward, a value derived from the ward's own:
554
+ *
555
+ * ```tsx
556
+ * const swipe = ward({ drag: "x", dragSnapToOrigin: true })
557
+ * const opacity = createTransform(swipe.read("x"), [-150, 0, 150], [0, 1, 0])
558
+ * <div {...swipe.with({ style: { opacity } })} />
559
+ * ```
560
+ *
561
+ * The latest call's props are the element's. A spread runs it again on every run of the element's
562
+ * props, which makes nothing new: a ward is made once.
563
+ */
564
+ readonly with: (props: WardWithProps) => WardProps
565
+ }
566
+
567
+ /** What a `wardic.*` component or a `<Reorder>` item adds to a ward. Internal. */
568
+ /**
569
+ * The config keys that want a gesture on Solid 2 (#525), as the ward's `wants*` read them: an element
570
+ * given none, its keys fixed, is `gestureless`. Pan is wanted only through the lifecycle.
571
+ */
572
+ export const GESTURE_KEYS = ["whileHover", "whileTap", "whileInView", "whileFocus"] as const
573
+
574
+ export interface WardInternals {
575
+ /** Its tag, so an SVG element's attribute keys render as attributes. */
576
+ readonly tag?: string | undefined
577
+ /**
578
+ * Its config can never want a gesture (#525): its keys are fixed and it was given none of
579
+ * `GESTURE_KEYS`. It watches for a late one only from its first want through its lifecycle (a
580
+ * `next("tap")`), so a Feature that arrives lazily still starts it.
581
+ */
582
+ readonly gestureless?: boolean | undefined
583
+ /**
584
+ * Set a drag element's defaults on the element at mount: a `wardic.create(Component)` wrap's,
585
+ * whose component may not pass `style` and `draggable` on (as on the Solid 1 binding).
586
+ */
587
+ readonly defaultsOnElement?: boolean | undefined
588
+ /**
589
+ * A `<Reorder>` item's drag (ADR-0019 *Amendment (Reorder)*, ADR-0020): the gesture's axis, read
590
+ * at each drag's start and held until its end (`true` = free); it makes the element draggable
591
+ * with no `drag` in its config.
592
+ */
593
+ readonly dragAxis?: (() => boolean | "x" | "y") | undefined
594
+ /** A `<Reorder>` item's: each drag sample, after its projection write. */
595
+ readonly onDragSample?: ((sample: Drag.Sample) => void) | undefined
596
+ /** A `<Reorder>` item's: its projection node's handle, once registered; what it returns is called at unmount. */
597
+ readonly onLayoutHandle?: ((handle: ProjectionSystem.NodeHandle) => () => void) | undefined
598
+ /** A `<Reorder>` item's: its node raised while dragged. */
599
+ readonly raiseWhileDragged?: boolean | undefined
600
+ /** A `<Reorder>` item's: its Enter and Space are its **Keyboard reorder**'s (ADR-0037), so its press hears no keys (#427). */
601
+ readonly keysTaken?: boolean | undefined
602
+ /** A `<Reorder>` item's: whether a **Keyboard reorder** has it lifted (ADR-0037), which turns its `whileDrag` on. */
603
+ readonly lifted?: Accessor<boolean> | undefined
604
+ /** A `<Reorder>` item's base style (its `touch-action`), under the user's style, over the drag defaults. */
605
+ readonly baseStyle?: (() => object | undefined) | undefined
606
+ /**
607
+ * Told the element at mount, and how to run a watch in its watch Scope (#379), with the ward's
608
+ * `onDefect`: closed at the unmount. What it returns is called at unmount.
609
+ */
610
+ readonly onMount?: ((element: HTMLElement, watch: (make: (onDefect: InputFeed.OnDefect) => Effect.Effect<void, never, Scope.Scope | WardicServices>) => void) => () => void) | undefined
611
+ /** Values fixed over the config's, read as its own are: a `<Reorder>` item's `layout`, its Layout mode. */
612
+ readonly fixed?: Fixed<WardConfigValues> | undefined
613
+ /** A `<Reorder>` item's group, which `Reorder.Item` checks a given item against (#349). */
614
+ readonly group?: unknown
615
+ /** The component it's made for, named in its errors (#349). */
616
+ readonly name?: string | undefined
617
+ /** Its variant parent, given (`ward(config, { parent })`, #349). */
618
+ readonly parent?: AnyWard | undefined
619
+ /**
620
+ * The ward given to the component this one drives an element for (#349): its config, variant node
621
+ * and lifecycle are this one's, and it follows this one's element while it's mounted.
622
+ */
623
+ readonly share?: WardShare | undefined
624
+ /** The Features it brings beside its section's (#511): a Complete element's every one. None for a Slim element. */
625
+ readonly brings?: ReadonlyArray<Feature> | undefined
626
+ /** Whether it's a **Complete element** (#511): an error in development under a `strict` section. */
627
+ readonly complete?: boolean | undefined
628
+ }
629
+
630
+
631
+ /**
632
+ * What a ward shares with the wards a component given it makes, one an element (#349). Internal:
633
+ * a ward's {@link WARD} value.
634
+ */
635
+ export interface WardShare {
636
+ /** Its config, as it was given. */
637
+ readonly config: WardConfig
638
+ /** Its config at setup: what a component reads of it (its Provider, the parent check). */
639
+ readonly setup: WardConfigValues
640
+ /** What made it adds (a `<Reorder>` item's), and its parent. */
641
+ readonly internal: WardInternals
642
+ /** The variant context it was made under, or its given parent's. */
643
+ readonly parent: WardicVariantContextValue | undefined
644
+ /** Whether its parent was given (`ward(config, { parent })`). */
645
+ readonly chosen: boolean
646
+ /**
647
+ * Whether it carries its variants (#398): its config sets `variants` or `inherit`. One that doesn't
648
+ * is a **Listening ward**: the element it's given to builds its own variant node from its own
649
+ * props, where it renders or under the chosen parent.
650
+ */
651
+ readonly carries: boolean
652
+ /** What its `.Provider` hands down: a child's `parent` given as this ward. */
653
+ readonly provided: WardicVariantContextValue | undefined
654
+ /** The **Layout group** it was made in (#432): its `layoutId`'s namespace, on whatever element it's given to. */
655
+ readonly layoutGroup: string | undefined
656
+ /** Its variant node, on the client: a driving ward's. */
657
+ readonly node: VariantNode | undefined
658
+ /** Its lifecycle, on the client: a driving ward's, so `settled`, `next` and `each` hear it. */
659
+ readonly lifecycle: Lifecycle | undefined
660
+ /**
661
+ * A driving ward's element mounted: this ward follows it until the returned release. One at a
662
+ * time: `name` (the component) is in the error a second one throws.
663
+ */
664
+ readonly drive: (driver: Driver, name: string) => () => void
665
+ }
666
+
667
+ /** A ward driving an element for a given ward (#349): what the given ward's `read`, `atom` and `next` follow. */
668
+ export interface Driver {
669
+ /** Start the recognizers a `next` now asks for, on its element. */
670
+ readonly wanted: () => void
671
+ /** Its `read(key)`'s Atom: what it shows for `key`. */
672
+ readonly readAtom: (key: string) => Atom.Atom<unknown>
673
+ /** Its `atom(key)`: the gate's output for `key`. */
674
+ readonly atom: (key: string) => Atom.Atom<unknown>
675
+ }
676
+
677
+ /** A ward's share, or `undefined` for anything else (a function handed a component's own ward). */
678
+ export const shareOf = (value: unknown): WardShare | undefined => {
679
+ if (Bool.not(Predicate.hasProperty(value, WARD))) return undefined
680
+ return (value as Record<typeof WARD, WardShare>)[WARD]
681
+ }
682
+
683
+ /** A ward driving an element while another is: a ward drives one element at a time (#349's Q5). */
684
+ const secondElement = (name: string): string =>
685
+ `${name}: this ward is already on another element. A ward drives one element at a time: make one for each element, ` +
686
+ "in the <For> callback or a component of its own, rather than giving or spreading the same one twice."
687
+
688
+ /** Whether `other` is an element other than `el` still on the page (#349's Q5). */
689
+ const stillOn = (other: HTMLElement | undefined, el: HTMLElement | undefined): boolean => {
690
+ if (Predicate.isUndefined(other)) return false
691
+ return Bool.and(other !== el, other.isConnected)
692
+ }
693
+
694
+ /** What a ward's errors call it: the component it drives an element for, else `ward(config)`. */
695
+ const nameOf = (internal: WardInternals): string => UndefinedOr.match(internal.name, { onUndefined: () => "ward(config)", onDefined: identity })
696
+
697
+ /** What a Slim element tells its ward: it brings no Feature of its own (#511). */
698
+ export const SLIM: WardInternals = {}
699
+ /** A ward's internals from `ward()`'s options: its chosen parent, if any. */
700
+ export const internalsOf = (options: WardOptions | undefined, kind: WardInternals): WardInternals => {
701
+ if (Predicate.isUndefined(options)) return kind
702
+ if (Predicate.isUndefined(options.parent)) return kind
703
+ return { ...kind, parent: options.parent }
704
+ }
705
+
706
+ /**
707
+ * Which gesture layers are on, and on which element: one value, so the target memo reads one signal
708
+ * for the three (#259), recorded on its element, so a ward moved to another reads none there.
709
+ */
710
+ interface Gestures {
711
+ readonly element: HTMLElement | undefined
712
+ readonly inView: boolean
713
+ readonly focused: boolean
714
+ readonly hovered: boolean
715
+ readonly pressed: boolean
716
+ readonly dragging: boolean
717
+ }
718
+ const NO_GESTURES: Gestures = { element: undefined, inView: false, focused: false, hovered: false, pressed: false, dragging: false }
719
+ /** A gesture layer of {@link Gestures}. */
720
+ type GestureLayer = "inView" | "focused" | "hovered" | "pressed" | "dragging"
721
+
722
+ /** Whether a ward's call is Solid applying it as a ref. */
723
+ const isElement = (value: unknown): value is HTMLElement => Predicate.hasProperty(value, "nodeType")
724
+
725
+ /** A context value as Solid 2's context takes it: `null` for none. */
726
+ const contextOf = (value: WardicVariantContextValue | undefined): WardicVariantContextValue | null => Option.getOrNull(Option.fromUndefinedOr(value))
727
+
728
+ /**
729
+ * Says, once per provider, that a colour of the element's needs the `colors` Feature (#511, ADR-0067
730
+ * decision 7): a value naming a wide-gamut space, while the page reads none, outside a lazy load.
731
+ * Development only (its caller's `DEV`).
732
+ */
733
+ const warnUnreadColors = (registry: FeatureRegistry, features: FeatureSection, values: () => Values.Values): void => {
734
+ createEffect(
735
+ () => {
736
+ if (features.pending()) return undefined
737
+ return unreadColorIn(values())
738
+ },
739
+ (unread) => {
740
+ if (Predicate.isUndefined(unread)) return
741
+ registry.warnOnce("colors", missingMessage("colors", `The colour \`${unread}\``, "@wardic/solid/unstable/v2"))
742
+ },
743
+ CLIENT_ONLY,
744
+ )
745
+ }
746
+
747
+ /** Whether a config carries its variants (#398): it sets `variants` or `inherit`. */
748
+ const carriesVariants = (config: WardConfigValues): boolean => Bool.or(Predicate.isNotUndefined(config.variants), Predicate.isNotUndefined(config.inherit))
749
+
750
+ /** A child made with `{ parent }` naming a Listening ward (#398's Q10). */
751
+ const LISTENING_PARENT =
752
+ "ward(config, { parent }): the parent given carries no variants (no `variants` or `inherit` in its ward({ … })): it only listens, " +
753
+ "and its element's props hold its variants, so a child can't join it by `{ parent }` (#398). Render the child inside that " +
754
+ "ward's element, where it joins through the tree, or put the variants in the parent's ward({ … })."
755
+
756
+ /**
757
+ * The **Layout group** a ward's `layoutId` goes in (#432): the one it's made in, as its presence and
758
+ * variant parent are; a driving ward's is its given ward's, where that was made, unless the element's
759
+ * own props set the `layoutId` (#398), which is then the element's.
760
+ */
761
+ const layoutGroupFor = (share: WardShare | undefined, fixed: WardInternals["fixed"]): string | undefined => {
762
+ if (Predicate.isUndefined(share)) return useLayoutGroupId()
763
+ if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return useLayoutGroupId()
764
+ return share.layoutGroup
765
+ }
766
+
767
+ /**
768
+ * The variant context a ward is made under (#349): a driving ward's given ward's, else its given
769
+ * parent's, else the one around it. A driving ward for a Listening ward (#398) takes the one around
770
+ * its element instead, unless the ward's parent was chosen: its element builds its own node there.
771
+ */
772
+ const variantParentOf = (internal: WardInternals): WardicVariantContextValue | undefined => {
773
+ const share = internal.share
774
+ if (Predicate.isNotUndefined(share)) {
775
+ if (Bool.or(share.carries, share.chosen)) return share.parent
776
+ return useVariantContext()
777
+ }
778
+ const parent = shareOf(internal.parent)
779
+ if (Predicate.isNotUndefined(parent)) {
780
+ if (Bool.not(parent.carries)) throw new Error(LISTENING_PARENT)
781
+ return parent.provided
782
+ }
783
+ return useVariantContext()
784
+ }
785
+
786
+ /**
787
+ * A ward's variant node: a driving ward's is its given ward's (#349), unless that ward listens
788
+ * (#398), when its element builds its own from its props; any other ward's is its own, made now.
789
+ */
790
+ const nodeFor = (
791
+ share: WardShare | undefined,
792
+ cfg: () => WardConfigValues,
793
+ config: WardConfigValues,
794
+ parent: WardicVariantContextValue | undefined,
795
+ change: Accessor<ControlsChange | undefined> | undefined,
796
+ ): VariantNode => {
797
+ if (Predicate.isNotUndefined(share)) {
798
+ const node = share.node
799
+ if (Predicate.isNotUndefined(node)) {
800
+ if (share.carries) return node
801
+ }
802
+ }
803
+ return createVariantNode(cfg, config, parent, change)
804
+ }
805
+
806
+ /** A ward's **Animation controls** (#433): the controls, its view with each change as its entry, and the change in effect. */
807
+ interface Controls {
808
+ readonly controls: WardicAnimationControls
809
+ readonly view: WardConfigValues
810
+ readonly change: Accessor<ControlsChange | undefined>
811
+ readonly set: (change: ControlsChange) => void
812
+ }
813
+
814
+ /** No change: a ward without Animation controls. */
815
+ const NO_CHANGE: Accessor<ControlsChange | undefined> = constUndefined
816
+
817
+ /**
818
+ * A ward's config with its `animate` read once, at setup (#433): **Animation controls** make each change
819
+ * they make its entry, over the rest of its keys as given, the view marked controlled; anything else, none.
820
+ */
821
+ const controlsOf = (given: WardConfigValues, animate: WardConfigValues["animate"]): Controls | undefined => {
822
+ if (Bool.not(isAnimationControls(animate))) return undefined
823
+ const [change, setChange] = createSignal<ControlsChange | undefined>(undefined)
824
+ const view = Object.create(given, {
825
+ animate: { enumerable: true, get: () => UndefinedOr.map(change(), (made) => made.definition) },
826
+ controlled: { enumerable: true, value: true },
827
+ }) as WardConfigValues
828
+ return { controls: animate as WardicAnimationControls, view, change, set: (made) => setChange(() => made) }
829
+ }
830
+
831
+ /**
832
+ * `view` with its **Config transition** as its own when it gives none (#434, Motion's
833
+ * `{ ...config, ...props }`), read per read as its keys are; `view` itself with no `WardicConfig` above.
834
+ */
835
+ const configuredView = (view: WardConfigValues, config: WardicConfigValue | undefined): WardConfigValues => {
836
+ if (Predicate.isUndefined(config)) return view
837
+ return Object.create(view, {
838
+ transition: { enumerable: true, get: () => UndefinedOr.match(view.transition, { onUndefined: config.transition, onDefined: identity }) },
839
+ }) as WardConfigValues
840
+ }
841
+
842
+ /**
843
+ * Whether a node's `when` gate lets a Retarget start (ADR-0007), as a memo, so only a flip of it
844
+ * re-runs what reads it. A plain node's gate never shuts (its `canStart` is `constTrue`), so it has
845
+ * none (#525).
846
+ */
847
+ const gateOf = (node: { readonly canStart: () => boolean }): Accessor<boolean> => {
848
+ if (node.canStart === constTrue) return constTrue
849
+ return createMemo(() => node.canStart(), CLIENT_ONLY)
850
+ }
851
+
852
+ /** A ward's lifecycle: a driving ward's is its given ward's (#349), any other its own, made now. */
853
+ const lifecycleFor = (share: WardShare | undefined, owner: Owner | null, want: () => void): Lifecycle => {
854
+ const shared = UndefinedOr.map(share, lifecycleOfShare)
855
+ if (Predicate.isNotUndefined(shared)) return shared
856
+ return new Lifecycle(owner, want)
857
+ }
858
+ const lifecycleOfShare = (share: WardShare): Lifecycle | undefined => share.lifecycle
859
+ /** A mount's element. */
860
+ const elementOfMount = (m: { readonly element: HTMLElement }): HTMLElement => m.element
861
+
862
+ /**
863
+ * A ward mounting an element another ward left in the same task: a spread's expression
864
+ * (`{...ward(config)}`), which Solid 2 runs again on every run of the element's props, making a new
865
+ * ward each time.
866
+ */
867
+ const REMADE =
868
+ "ward(config) made a new ward for an element another ward just left: Solid 2 runs a spread's expression " +
869
+ "(`<div {...ward(config)} />`) again on every run of the element's props. Make it once, in the component's body, " +
870
+ "and spread that: `const card = ward(config)` then `<div {...card} />`. Or give it to `ref={ward(config)}`, client-only."
871
+
872
+ /**
873
+ * The keys a ward reads as it goes, through its target or its style (#257 item 1): one still loading
874
+ * when the ward is made holds its region until it lands. Any other key is fixed at setup.
875
+ */
876
+ const LOADS_AS_IT_GOES: ReadonlySet<string> = new Set(["animate", "whileHover", "whileTap", "whileFocus", "whileInView", "whileDrag", "transition", "style", "custom"])
877
+
878
+ /** A ward's setup key still loading when it's made (#257 item 1). */
879
+ const loadingAtSetup = (key: string): string =>
880
+ `ward(config): \`${key}\` was still loading when the ward was made. A ward reads it once, when it's made: give it a value, or make the ward once its data is in.`
881
+
882
+ /** A ward that starts at its `animate`, still loading when it's made (#257 item 1). */
883
+ const STARTS_AT_PENDING =
884
+ "ward(config): `animate` was still loading when the ward was made, and with `initial={false}` a ward starts there. Give it an `initial`, or make the ward once its data is in."
885
+
886
+ /** A name list standing for an `animate` still loading at setup, on a ward with `variants` (#257 item 1). */
887
+ const LOADING_NAMES: ReadonlyArray<string> = []
888
+
889
+ /**
890
+ * The config setup reads: a key still loading that setup fixes is an error (#257 item 1). A loading
891
+ * `animate` names the ward's own variants when it has `variants` (what it can name), and is a target
892
+ * of values otherwise: setup reads it only to tell which.
893
+ */
894
+ const configAtSetup = (setup: { readonly config: WardConfigValues; readonly pending: ReadonlyArray<string> }): WardConfigValues => {
895
+ if (setup.pending.length === 0) return setup.config
896
+ const fixed = Arr.findFirst(setup.pending, (key) => Bool.not(LOADS_AS_IT_GOES.has(key)))
897
+ if (Option.isSome(fixed)) throw new Error(loadingAtSetup(fixed.value))
898
+ const config = setup.config
899
+ if (Bool.and(Arr.contains(setup.pending, "animate"), Predicate.isNotUndefined(config.variants))) return { ...config, animate: LOADING_NAMES as NonNullable<WardConfigValues["animate"]> }
900
+ return config
901
+ }
902
+
903
+ /**
904
+ * Elements a ward has left in this task: a ward mounting one is {@link REMADE}. Cleared once, at the
905
+ * task's end, by one microtask however many leave (#259: one a ward cost 0.2 ms an unmount of 1,000).
906
+ */
907
+ // Module state (#460, Q7): the page's one end-of-task batch: cleared by one microtask at the task's end.
908
+ const justLeft = new Set<Element>()
909
+ const forgetJustLeft = (): void => justLeft.clear()
910
+
911
+ /** {@link ward} with a `wardic.<tag>`'s additions. Internal. */
912
+ /**
913
+ * Makes a mounted element's layout node with `arrive` if it was on its way as the element mounted and
914
+ * `services` has `layout` now (#582). A module's function, not a ward's: a ward makes none.
915
+ */
916
+ const layoutArrivedIn = (arrive: ((projection: ProjectionSystem.Shape) => void) | undefined, services: Context.Context<never>): void => {
917
+ UndefinedOr.map(arrive, (make) => UndefinedOr.map(projectionIn(services), make))
918
+ }
919
+
920
+ export function wardWith(config: WardConfig, internal: WardInternals): Ward {
921
+ if (Predicate.isFunction(config)) throw new Error(WHOLE_ACCESSOR)
922
+ const runtime = useWardicRuntime()
923
+ // Its Features (#511, ADR-0067), a Complete element's every one: what they register, a server
924
+ // render's elements read too (the `colors` Feature's spaces).
925
+ const features = useElementFeatures(internal.brings, internal.complete === true)
926
+ // A server render takes the lean path: the Starting style only, no spine (ADR-0021).
927
+ if (isServer) return serverWard(config, internal)
928
+ const gate = useWardicGate()
929
+ // Its section's projection system, the `layout` Feature's (#511): `undefined` without it. Read now,
930
+ // which builds the Features given to its section at once: the first element to ask builds them.
931
+ const layoutProjection = projectionIn(untrack(features.services))
932
+ // The provider's, once any section has built it: what its values register with.
933
+ const builtProjection = useBuiltProjection()
934
+ const reducedMotion = useWardicReducedMotion()
935
+ // Whether its animations are skipped (#468): its nearest WardicConfig's, read as each starts.
936
+ const skipAnimations = useWardicSkipAnimations()
937
+ // Where its drag's and pan's points are (#443): its nearest WardicConfig's, read as each starts.
938
+ const pagePoint = transformPagePointOf(useWardicConfig())
939
+ const positionalKeys = useWardicPositionalKeys()
940
+ const defaultTransition = useWardicDefaultTransition()
941
+ const owner = getOwner()
942
+ const reactivity = reactivityIn(owner)
943
+ const registry = registryOf(runtime)
944
+ // SSR/hydration-stable: the server ward makes the same one call.
945
+ const id = createUniqueId()
946
+ // Its config, read per key where it's read (#259): a change re-runs only what reads the key. With
947
+ // Animation controls for its `animate` (#433), read once, each change they make is its entry.
948
+ // Under a `WardicConfig`, its Config transition is its own when it gives none (#434).
949
+ const asGiven = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig())
950
+ // The config at setup, a plain copy read untracked: what setup reads, the keys read once among it.
951
+ // A key still loading (#257 item 1) is left out of it: one the ward reads as it goes holds its
952
+ // region until it lands; one setup fixes is an error, naming it. Its `animate` there tells
953
+ // Animation controls; one still loading is none.
954
+ const givenSetup = WARD_VIEW.setupOf(asGiven)
955
+ const controls = controlsOf(asGiven, givenSetup.config.animate)
956
+ const view = UndefinedOr.match(controls, { onUndefined: () => asGiven, onDefined: (c) => c.view })
957
+ const cfg = (): WardConfigValues => view
958
+ const setup = UndefinedOr.match(controls, { onUndefined: () => givenSetup, onDefined: () => WARD_VIEW.setupOf(view) })
959
+ const initialConfig = UndefinedOr.match(controls, { onUndefined: () => configAtSetup(setup), onDefined: () => controlledConfigOf(configAtSetup(setup), undefined) })
960
+ // Its Animation controls' change (#433), read with the Override stack: none without them.
961
+ const ownChange = UndefinedOr.match(controls, { onUndefined: () => NO_CHANGE, onDefined: (c) => c.change })
962
+
963
+ // A ward a component was given (#349), whose element this one drives: its variant node and its
964
+ // lifecycle are that ward's, so its children, stagger and `next` readers are where it was made.
965
+ const share = internal.share
966
+ // Its place in variant orchestration (ADR-0007, #50): where it's made, its given parent's (#349),
967
+ // or its given ward's.
968
+ const parent = variantParentOf(internal)
969
+ const node = nodeFor(share, cfg, initialConfig, parent, UndefinedOr.map(controls, (c) => c.change))
970
+
971
+ // The nearest <AnimatePresence> (ADR-0007), or none.
972
+ const presence = usePresenceContext()
973
+ // The Layout group its `layoutId` goes in (#432): where it's made, or a given ward's.
974
+ const layoutGroup = layoutGroupFor(share, internal.fixed)
975
+
976
+ // The values it starts from, read once (ADR-0003): its `initial`, or the one it inherits, or its
977
+ // `animate` with `initial={false}` (its own, inherited, or its presence's first render, #134).
978
+ const presenceBlocks = presenceBlocksInitial(presence)
979
+ if (Bool.and(Arr.contains(setup.pending, "animate"), startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw new Error(STARTS_AT_PENDING)
980
+ const start = startOf(initialConfig, node.inherited, presenceBlocks, untrack)
981
+ // Read once by the provider (#618, M1).
982
+ const { project } = useWardicRenderer()
983
+
984
+ // The Starting style: the projected `initial`, carried by `style` until the gate's first commit
985
+ // (ADR-0021 decision 6, ADR-0034); an svg-inner tag's attribute keys as attributes. While
986
+ // hydrating, what the server rendered, the DOM's project (the Hydration hold). A layout node's is
987
+ // drawn through its projection at rest, as its first commit draws it (#245).
988
+ const layoutNode = isLayoutNode(initialConfig)
989
+ const drawnStart = drawnAtRest(start.initialValues, layoutNode, initialConfig.transformTemplate)
990
+ const projected = project(drawnStart)
991
+ const hydrating = isHydrating()
992
+ const startingPatch = Bool.match(hydrating, { onTrue: () => DomRenderer.project(drawnStart), onFalse: () => projected })
993
+ if (hydrating) flagStartingStyle(runtime, id, startingPatch, projected)
994
+ const seed = Svg.splitPatchForTag(internal.tag, startingPatch)
995
+
996
+ // Its drag axis and a drag element's defaults (ADR-0004, ADR-0019 *Amendment (Reorder)*), under
997
+ // the user's style: `drag` is read once, as on the Solid 1 binding.
998
+ const dragAxis = dragAxisOf(initialConfig, internal)
999
+ const dragDefaults = dragDefaultsOf(initialConfig, internal)
1000
+
1001
+ // Its routed `style` keys (#130, ADR-0043), and its `style`, switched by the gate's hooks.
1002
+ const live = createLiveStyle({ registry: registryOf(runtime), onDroppedTransform: () => warnDroppedTransform(runtime, id), reactivity })
1003
+ const projectStarting = Bool.match(hydrating, { onTrue: () => DomRenderer.project, onFalse: () => project })
1004
+ // The element's style (#264): the config's, with the latest `.with()` style over it, key by key.
1005
+ // `.with()` runs in the spread's computation, an owned scope: it tells `read(key)` through a
1006
+ // signal written there (`ownedWrite`), and never `style`, whose spread would run `.with` again.
1007
+ let given: WardWithProps = NO_WITH
1008
+ // Made at the first `read(key)` or `.with()`: most elements call neither.
1009
+ let withCalls: Signal<undefined> | undefined
1010
+ const withCallsOf = (): Signal<undefined> => {
1011
+ if (Predicate.isUndefined(withCalls)) withCalls = runWithOwner(owner, () => createSignal(undefined, { equals: false, ownedWrite: true }))
1012
+ return withCalls
1013
+ }
1014
+ const userStyle = (): WardStyle | string | undefined => withStyleOver(cfg().style, given.style)
1015
+ const elementStyle = createElementStyle({
1016
+ userStyle,
1017
+ starting: seed.style,
1018
+ startingWith: (routed: Values.Values): Renderer.Patch =>
1019
+ Svg.splitPatchForTag(internal.tag, projectStarting(drawnAtRest({ ...routed, ...start.initialValues }, layoutNode, initialConfig.transformTemplate))).style,
1020
+ live,
1021
+ defaults: dragDefaults,
1022
+ base: internal.baseStyle,
1023
+ reactivity,
1024
+ })
1025
+
1026
+ const snapshot = snapshotOf(start)
1027
+ const reuse = makeReuse()
1028
+ // Where its element starts (#414): the ward's start, or a fresh one for an element given after the
1029
+ // last one left the page, as a mount after the first render's (no presence holds its `initial`
1030
+ // back). Its Snapshot goes back to it, and its Starting style comes back on until its first commit.
1031
+ let begun = start
1032
+ const beginFresh = (): void => {
1033
+ // The config now, a plain copy read untracked, as setup reads it: this runs in the mount effect.
1034
+ const now = WARD_VIEW.setupOf(view).config
1035
+ begun = startOf(now, node.inherited, false, untrack)
1036
+ snapshot.values = { ...begun.initialValues }
1037
+ snapshot.velocities = {}
1038
+ snapshot.drawnAt = {}
1039
+ elementStyle.restart(Svg.splitPatchForTag(internal.tag, project(drawnAtRest(begun.initialValues, layoutNode, now.transformTemplate))).style)
1040
+ }
1041
+ const configNow = (): WardConfigValues => view
1042
+ const styleNow = (): WardStyle | string | undefined => untrack(userStyle)
1043
+
1044
+ // What its exit resolves from under an <AnimatePresence> (#277: its `exit`, `variants`, `custom` and
1045
+ // transition), kept current while it's alive: the presence resolves it as the ward leaves (ADR-0007).
1046
+ const exitConfig = { current: NO_EXIT_CONFIG }
1047
+ if (Predicate.isNotUndefined(presence)) {
1048
+ // Its inherited transition is read untracked here: the effect keeps it current.
1049
+ exitConfig.current = untrack(() => exitConfigOf(initialConfig, node.inherited))
1050
+ createEffect(
1051
+ () => exitConfigOf(cfg(), node.inherited),
1052
+ (config) => {
1053
+ exitConfig.current = config
1054
+ },
1055
+ CLIENT_ONLY_DEFERRED,
1056
+ )
1057
+ }
1058
+
1059
+ // Its layout node (ADR-0009): the projection system it registers one with, decided at setup, as
1060
+ // `layout` is read once, and what a release runs on, its Release offset (ADR-0016, *Amendment
1061
+ // (#140)*). Its section's `layout` makes its node (#511): without it, its layout props do nothing,
1062
+ // and development says so once, unless `layout` is on its way.
1063
+ const wantsNode = wantsLayoutNode(initialConfig)
1064
+ if (DEV && wantsNode && Predicate.isUndefined(layoutProjection) && Bool.not(untrack(features.pending))) {
1065
+ useFeatureRegistry().warnOnce("layout", missingMessage("layout", LAYOUT_PROPS, "@wardic/solid/unstable/v2"))
1066
+ }
1067
+ const layoutNodes = Bool.match(wantsNode, { onTrue: () => layoutProjection, onFalse: constUndefined })
1068
+ const dragTransition = dragTransitionOf(initialConfig.dragElastic, initialConfig.dragTransition)
1069
+
1070
+ // The element, set by the ref during render. Its write is the one a ward makes in an owned scope: a
1071
+ // ward called with its element in a component's body (WT2), not given to `ref`.
1072
+ const [element, setElement] = createSignal<HTMLElement | undefined>(undefined, { ownedWrite: true })
1073
+
1074
+ // Its gesture layers' states (ADR-0005), one signal for the three, so the target reads one (#259),
1075
+ // each recorded on its element: the hover and press recognizers, each started on its element the
1076
+ // first time its `while*` target is set (#87, ADR-0040), and the drag's. A write that changes
1077
+ // nothing keeps the same object.
1078
+ const [gestureState, setGestureState] = createSignal<Gestures>(NO_GESTURES)
1079
+ /** Set `layer` on `el`: a state recorded on another element starts again from none. */
1080
+ const setGesture = (el: HTMLElement, layer: GestureLayer, on: boolean): void => {
1081
+ setGestureState((g) => {
1082
+ if (g.element !== el) return Bool.match(on, { onTrue: (): Gestures => ({ ...NO_GESTURES, element: el, [layer]: true }), onFalse: () => g })
1083
+ if (g[layer] === on) return g
1084
+ return { ...g, [layer]: on }
1085
+ })
1086
+ }
1087
+ // The layers on the element mounted now: a state recorded on one the ward has left reads as none, so
1088
+ // a move resets nothing by writing (#257's audit: the reset, written in the mount's effect, fed the
1089
+ // target memo and re-ran the effect, EFFECT_WRITES_OWN_SOURCE). With none recorded there's nothing
1090
+ // to compare, so the element isn't read: its arrival doesn't re-run the target memo (#320).
1091
+ const gestures = (): Gestures => {
1092
+ const g = gestureState()
1093
+ if (g === NO_GESTURES) return g
1094
+ if (g.element === element()) return g
1095
+ return NO_GESTURES
1096
+ }
1097
+ const dragging = (): boolean => gestures().dragging
1098
+ // The keys these read are `GESTURE_KEYS` (#525).
1099
+ const wantsHover = (): boolean => Predicate.isNotUndefined(cfg().whileHover)
1100
+ const wantsPress = (): boolean => Predicate.isNotUndefined(cfg().whileTap)
1101
+ const wantsInView = (): boolean => Predicate.isNotUndefined(cfg().whileInView)
1102
+ const wantsFocus = (): boolean => Predicate.isNotUndefined(cfg().whileFocus)
1103
+
1104
+ // The Override stack, compared by value: a change that resolves the same target doesn't Retarget.
1105
+ // A keyboard lift turns `whileDrag` on, as a drag does (ADR-0037).
1106
+ const lifted = UndefinedOr.match(internal.lifted, { onUndefined: () => constFalse, onDefined: identity })
1107
+ // The target reads the lift through a boundary (#666): an item with no `whileDrag` of its own
1108
+ // resolves the same lifted or not (a dragged parent's name hands down with its own drag on), so
1109
+ // every lift and drop re-ran its target for nothing. A Reorder item's alone: no other ward lifts.
1110
+ const liftedLayer = UndefinedOr.match(internal.lifted, {
1111
+ onUndefined: () => constFalse,
1112
+ onDefined: (isLifted) => createMemo(() => Predicate.isNotUndefined(cfg().whileDrag) && isLifted(), CLIENT_ONLY),
1113
+ })
1114
+ const target = createMemo<Resolution>(
1115
+ () => {
1116
+ const g = gestures()
1117
+ return resolutionOf(
1118
+ cfg(),
1119
+ node.inherited,
1120
+ start.initialLink,
1121
+ {
1122
+ inView: g.inView,
1123
+ focused: g.focused,
1124
+ hovered: g.hovered,
1125
+ pressed: g.pressed,
1126
+ dragged: Bool.or(g.dragging, liftedLayer()),
1127
+ dragging: g.dragging,
1128
+ },
1129
+ snapshot,
1130
+ ownChange(),
1131
+ )
1132
+ },
1133
+ { equals: sameTarget, transparent: true },
1134
+ )
1135
+ // A colour only the `colors` Feature reads, on a Slim element without it (#511, decision 7): said
1136
+ // once per provider, in development only, and not while a lazy load is on its way.
1137
+ // eslint-disable-next-line solid/reactivity -- read inside the warning's effect, where it tracks
1138
+ if (DEV && internal.complete !== true) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved)
1139
+ // Its gesture states, for what its variant node hands down (#291): bound at setup, before its
1140
+ // children read them. Read from the gestures themselves, not the target: a gesture whose layer
1141
+ // resolves to nothing new leaves the target as it was (`sameResolution`), but is on all the same.
1142
+ // Only a provider has one: a guard, so other wards make nothing here.
1143
+ const bindGestures = node.bindGestures
1144
+ if (Predicate.isNotUndefined(bindGestures)) {
1145
+ // eslint-disable-next-line solid/reactivity -- read inside the variant node's gestures memo, where it tracks
1146
+ bindGestures(() => {
1147
+ const g = gestures()
1148
+ return { inView: g.inView, focused: g.focused, hovered: g.hovered, pressed: g.pressed, dragged: Bool.or(g.dragging, lifted()) }
1149
+ })
1150
+ }
1151
+
1152
+ // Its Retargets' starts and landings (#257, ADR-0046): `settled()` and `next("settled")`, each with
1153
+ // the gesture layers its target was resolved with.
1154
+ // A gesture's event asked for starts its recognizer on the mounted element (and on later mounts).
1155
+ // The ward driving an element for this one, given to a component (#349): its `read`, `atom` and
1156
+ // `next` follow that element. Followed through an Atom made at the first `read`, `atom` or drive.
1157
+ let driver: Driver | undefined
1158
+ let driven: Atom.Writable<Driver | undefined> | undefined
1159
+ const drivenAtom = (): Atom.Writable<Driver | undefined> => {
1160
+ if (Predicate.isNotUndefined(driven)) return driven
1161
+ const atom = Atom.make<Driver | undefined>(driver)
1162
+ runWithOwner(owner, () => onCleanup(registry().mount(atom)))
1163
+ driven = atom
1164
+ return atom
1165
+ }
1166
+
1167
+ // A driving ward's are its given ward's (#349), whose `next` starts them on the element it drives.
1168
+ const lifecycle = lifecycleFor(share, owner, () => {
1169
+ watchLateGestures()
1170
+ UndefinedOr.map(mounted, startRecognizers)
1171
+ UndefinedOr.map(driver, (d) => d.wanted())
1172
+ })
1173
+
1174
+
1175
+ // The mounted element: registered with the gate, its layout node, its spine built over it, and how
1176
+ // to run a watch in its watch Scope (#318, #379): its gesture watches and its drag track.
1177
+ interface Mounted {
1178
+ readonly element: HTMLElement
1179
+ readonly spine: ElementSpine
1180
+ /** Its layout node: made at mount, or as `layout` arrives (#582), which writes it here. */
1181
+ layout: ProjectionSystem.NodeHandle | undefined
1182
+ /** Makes its layout node on a `layout` that arrived after it mounted (#582); absent unless one was on its way. */
1183
+ readonly arriveLayout: ((projection: ProjectionSystem.Shape) => void) | undefined
1184
+ readonly watch: (watch: Effect.Effect<void, never, Scope.Scope | WardicServices>) => void
1185
+ /** Starts its drag track with a `drag` that arrived after it mounted (#551); absent unless one was on its way. */
1186
+ readonly startDrag: ((gesture: DragGesture["Service"]) => void) | undefined
1187
+ hover: boolean
1188
+ press: boolean
1189
+ pan: boolean
1190
+ inView: boolean
1191
+ focus: boolean
1192
+ readonly dispose: () => void
1193
+ }
1194
+ /** A handler's throw, reported as a fiber's failure is (ADR-0030, decision 4); the watch goes on. */
1195
+ const onDefect = (cause: Cause.Cause<never>): void => {
1196
+ runtime.runFork(Report.failure("wardic.ward: a gesture handler failed", cause))
1197
+ }
1198
+ // The provider's Features, for development's word on a missing one (#511).
1199
+ const featureRegistry = useFeatureRegistry()
1200
+ /**
1201
+ * A gesture's service when the element `wanted` it: its section's Feature's (#511), `undefined`
1202
+ * without it, which development says once, unless it's on its way.
1203
+ */
1204
+ const gestureIn = <I, S>(services: Context.Context<never>, name: keyof typeof GESTURE_WORDS, key: Context.Key<I, S>, wanted: boolean): S | undefined => {
1205
+ if (Bool.not(wanted)) return undefined
1206
+ const service = serviceIn(services, key)
1207
+ if (DEV && Predicate.isUndefined(service) && Bool.not(untrack(features.pending))) {
1208
+ featureRegistry.warnOnce(name, missingMessage(name, GESTURE_WORDS[name], "@wardic/solid/unstable/v2"))
1209
+ }
1210
+ return service
1211
+ }
1212
+ /**
1213
+ * Start the hover, press and pan recognizers its config or a `next` now wants, each once a mount:
1214
+ * each hover or press transition sets its gesture layer, and every event is told to the lifecycle
1215
+ * for `next` (#257, #273).
1216
+ */
1217
+ const startRecognizers = (m: Mounted): void => {
1218
+ // Each through its section's Feature (#511), read as it starts: one that arrives lazily starts from
1219
+ // then on, as the effect below runs this again.
1220
+ const services = untrack(features.services)
1221
+ const hover = gestureIn(services, "hover", HoverGesture, Bool.or(untrack(wantsHover), lifecycle.wantsHover))
1222
+ if (Predicate.isNotUndefined(hover) && Bool.not(m.hover)) {
1223
+ m.hover = true
1224
+ m.watch(
1225
+ hover.watch(m.element, {
1226
+ on: (transition) => {
1227
+ setGesture(m.element, "hovered", transition.active)
1228
+ lifecycle.hovered(transition, m.element)
1229
+ },
1230
+ // Each move while it's hovered, for `hover` (#397): told only to a `next` or `when` that asked.
1231
+ onMove: (event) => lifecycle.hoverMoved(event, m.element),
1232
+ onDefect,
1233
+ }),
1234
+ )
1235
+ }
1236
+ const press = gestureIn(services, "press", PressGesture, Bool.or(untrack(wantsPress), lifecycle.wantsPress))
1237
+ if (Predicate.isNotUndefined(press) && Bool.not(m.press)) {
1238
+ m.press = true
1239
+ m.watch(
1240
+ press.watch(
1241
+ m.element,
1242
+ {
1243
+ on: (press) => {
1244
+ setGesture(m.element, "pressed", press.phase === "start")
1245
+ lifecycle.pressed(press, m.element)
1246
+ },
1247
+ onDefect,
1248
+ },
1249
+ internal.keysTaken === true,
1250
+ () => tapPropagates(untrack(cfg).propagate),
1251
+ ),
1252
+ )
1253
+ }
1254
+ // A pan sets no layer: only a `next` wants it (#273).
1255
+ const pan = gestureIn(services, "pan", PanGesture, lifecycle.wantsPan)
1256
+ if (Predicate.isNotUndefined(pan) && Bool.not(m.pan)) {
1257
+ m.pan = true
1258
+ m.watch(pan.watch(m.element, { on: (sample) => lifecycle.panned(sample, m.element), onDefect }, { mapPoint: pointMapOptionOf(pagePoint) }))
1259
+ }
1260
+ // In view as its `viewport` says, read when it starts (#273).
1261
+ const inView = gestureIn(services, "inView", InViewGesture, Bool.or(untrack(wantsInView), lifecycle.wantsInView))
1262
+ if (Predicate.isNotUndefined(inView) && Bool.not(m.inView)) {
1263
+ m.inView = true
1264
+ m.watch(
1265
+ inView.watch(m.element, inViewOptionsOf(untrack(cfg).viewport), {
1266
+ on: (transition) => {
1267
+ setGesture(m.element, "inView", transition.active)
1268
+ lifecycle.viewed(transition)
1269
+ },
1270
+ onDefect,
1271
+ }),
1272
+ )
1273
+ }
1274
+ // Focused as the browser shows it (`:focus-visible`, #273).
1275
+ const focus = gestureIn(services, "focus", FocusGesture, untrack(wantsFocus))
1276
+ if (Predicate.isNotUndefined(focus) && Bool.not(m.focus)) {
1277
+ m.focus = true
1278
+ m.watch(focus.watch(m.element, { visible: true }, { on: (focused) => setGesture(m.element, "focused", focused), onDefect }))
1279
+ }
1280
+ }
1281
+ let mounted: Mounted | undefined
1282
+ // The last two elements given to its ref, for a second one still on the page as it mounts (#349's Q5).
1283
+ let refdLast: HTMLElement | undefined
1284
+ let refdBefore: HTMLElement | undefined
1285
+ // One given after the last one left the page, which enters fresh (#414). Read as the ref is called,
1286
+ // before Solid inserts it: one replacing the last in the same update finds it still on the page.
1287
+ let fresh: HTMLElement | undefined
1288
+ // Inside a child `mode="wait"` holds off the page (#277, ADR-0048), it mounts once the child is on
1289
+ // it: `shown` ticks then, and the mount effect, which reads `ticked`, runs again. Only under a
1290
+ // presence: with none, its compute calls a no-op and makes nothing. `held` cancels the wait.
1291
+ let ticked: () => undefined = constUndefined
1292
+ let shown: (() => void) | undefined
1293
+ if (Predicate.isNotUndefined(presence)) {
1294
+ const [read, tick] = createSignal<undefined>(undefined, { equals: false })
1295
+ ticked = read
1296
+ shown = () => tick(undefined)
1297
+ }
1298
+ let held: (() => void) | undefined
1299
+ const unhold = (): void => {
1300
+ if (Predicate.isUndefined(held)) return
1301
+ held()
1302
+ held = undefined
1303
+ }
1304
+ /** Whether `el` waits off the page for its held child: its mount queued with the presence. */
1305
+ const heldBack = (el: HTMLElement): boolean => {
1306
+ unhold()
1307
+ if (Predicate.isUndefined(shown)) return false
1308
+ held = presenceHold(presence, el, shown)
1309
+ return Predicate.isNotUndefined(held)
1310
+ }
1311
+ const unmount = (): void => {
1312
+ unhold()
1313
+ if (Predicate.isUndefined(mounted)) return
1314
+ const left = mounted.element
1315
+ mounted.dispose()
1316
+ mounted = undefined
1317
+ if (justLeft.size === 0) queueMicrotask(forgetJustLeft)
1318
+ justLeft.add(left)
1319
+ }
1320
+ // Its element's mount goes, and its lifecycle's waits are rejected (#257): one cleanup.
1321
+ // A driving ward's lifecycle is its given ward's, which outlives the element (#349).
1322
+ onCleanup(() => {
1323
+ unmount()
1324
+ if (Predicate.isUndefined(share)) lifecycle.dispose()
1325
+ })
1326
+
1327
+ const mount = (el: HTMLElement): Mounted => {
1328
+ if (justLeft.has(el)) throw new Error(REMADE)
1329
+ // The ward a component was given follows this element while it's mounted (#349): one at a time.
1330
+ let undrive: (() => void) | undefined
1331
+ if (Predicate.isNotUndefined(share)) {
1332
+ undrive = share.drive(
1333
+ {
1334
+ wanted: () => {
1335
+ UndefinedOr.map(mounted, startRecognizers)
1336
+ },
1337
+ readAtom: (key) => readEntry(key).atom,
1338
+ atom: (key) => gate.valueOf(id, key),
1339
+ },
1340
+ nameOf(internal),
1341
+ )
1342
+ }
1343
+ // The gate commits each frame onto the element (ADR-0006, ADR-0034); the hooks switch its
1344
+ // `style`. An element with `onUpdate` at mount is told each committed frame (#233). While
1345
+ // hydrating, its Appear animation is found here, taken over by its first Retarget that starts,
1346
+ // and removed in its first commit (the Handoff, ADR-0044 decision 6).
1347
+ const handoff = Bool.match(hydrating, { onTrue: () => Option.getOrUndefined(handoffOf(el)), onFalse: constUndefined })
1348
+ // Its Transform template (#443), drawn with its first write: the one at mount, then each other one
1349
+ // its config gives.
1350
+ const templateAtMount = configNow().transformTemplate
1351
+ let template = templateAtMount
1352
+ const registered = registeredValuesOf(templateAtMount)
1353
+ const unregister = gate.register(id, releasingAppear(withOnUpdate({ target: el, ...elementStyle.hooks }, configNow().onUpdate, configNow), handoff, el), registered)
1354
+ // Its values, for the projection's flights (ADR-0012 *Amendment (#137)*).
1355
+ // None while no section has `layout`: there's no flight to follow them (#511).
1356
+ const unregisterValues = UndefinedOr.match(builtProjection(), { onUndefined: () => constVoid, onDefined: (projection) => projection.registerValues(el, () => snapshot.values) })
1357
+ const links = startLinksOf(el, styleNow, live)
1358
+ // Its exit record, under an <AnimatePresence>: the presence removes it once the exit settles.
1359
+ const presenceRecord = UndefinedOr.map(presence, (registrar) => {
1360
+ const record = presenceRecordOf(el, begun, (custom, inherited) => exitTargetOf(exitConfig.current, custom, snapshot, inherited), links, presenceTreeOf(initialConfig), snapshot, reducedMotion, skipAnimations)
1361
+ registrar.register(record)
1362
+ return record
1363
+ })
1364
+ const recordFrame = recordFrameOf(presenceRecord)
1365
+ // Its exit is drawn through its template (#443): it rides in its presence record, whose drawn values
1366
+ // the projection reads as it leaves. A later one is written with the values it holds, so the commit
1367
+ // that may take its Starting style off holds them.
1368
+ // Nothing with none (#460): no follow.
1369
+ let unfollowTemplate: () => void = constVoid
1370
+ if (Predicate.isNotUndefined(templateAtMount)) {
1371
+ recordFrame(registered as Values.Values)
1372
+ unfollowTemplate = followTemplate(templateAtMount, () => view.transformTemplate, reactivity.watch, (next) => {
1373
+ template = next
1374
+ gate.write(id, { ...snapshot.values, [DomRenderer.TEMPLATE_KEY]: next })
1375
+ recordFrame({ [DomRenderer.TEMPLATE_KEY]: next } as unknown as Values.Values)
1376
+ })
1377
+ }
1378
+ // Where it starts when its child takes over from a leaver (#286): asked before its layout node
1379
+ // registers, which moves from the leaver's box, and before its first Retarget.
1380
+ const taken = presenceSeedOf(presence, el)
1381
+ // Its one projection node (ADR-0009, ADR-0010), its own `x`/`y` drawn on top of it (#363).
1382
+ // Its layout animations' starts and landings, and its drag's release at rest, go to the lifecycle,
1383
+ // for `next("layoutStart")`, `next("layoutComplete")` and `next("dragTransitionEnd")` (#257, #273):
1384
+ // Solid 2 has no props for them.
1385
+ let layout: ProjectionSystem.NodeHandle | undefined
1386
+ // A `<Reorder>` item's group registers the node, until the unmount.
1387
+ let handedOver: (() => void) | undefined
1388
+ // `layout` on its way as it mounted (#582): its node is made as it arrives (`arriveLayout`), as
1389
+ // Motion's is, and measures from then on; nothing before it is replayed.
1390
+ let arriveLayout: ((projection: ProjectionSystem.Shape) => void) | undefined
1391
+ if (wantsNode) {
1392
+ // `takenNow`: where a child that takes over from a leaver starts, at its mount only (#286).
1393
+ const layoutNodeOn = (projection: ProjectionSystem.Shape, takenNow: PresenceSeed | undefined): void => {
1394
+ const started = (): void => lifecycle.layoutStarted()
1395
+ const completed = (): void => lifecycle.layoutCompleted()
1396
+ const released = (): void => lifecycle.released()
1397
+ const handle = projection.register(
1398
+ registrationOf({
1399
+ ...layoutOptionsOf({
1400
+ id,
1401
+ element: el,
1402
+ config: configNow,
1403
+ parent: node.inherited,
1404
+ snapshot,
1405
+ dragTransition,
1406
+ raiseWhileDragged: internal.raiseWhileDragged === true,
1407
+ taken: takenNow,
1408
+ layoutGroup,
1409
+ reducedMotion,
1410
+ skipAnimations,
1411
+ heldTransform: heldTransformFor(snapshot, templateAtMount, () => template),
1412
+ }),
1413
+ onLayoutAnimationStart: () => started,
1414
+ onLayoutAnimationComplete: () => completed,
1415
+ // Its drag's Release offset at rest, for `next("dragTransitionEnd")` (#273).
1416
+ onReleaseEnd: () => released,
1417
+ }),
1418
+ )
1419
+ layout = handle
1420
+ handedOver = UndefinedOr.map(internal.onLayoutHandle, (onHandle) => onHandle(handle))
1421
+ }
1422
+ // Its section's `layout` as it mounts: had at setup, or arrived since (#582).
1423
+ const now = UndefinedOr.match(layoutNodes, { onDefined: identity, onUndefined: () => projectionIn(untrack(features.services)) })
1424
+ if (Predicate.isNotUndefined(now)) layoutNodeOn(now, taken)
1425
+ if (Predicate.isUndefined(layout)) {
1426
+ arriveLayout = (projection) => {
1427
+ if (Predicate.isNotUndefined(layout)) return
1428
+ layoutNodeOn(projection, undefined)
1429
+ // A plain field, not a getter: a getter of its own on every record gave each its own shape (#582).
1430
+ m.layout = layout
1431
+ }
1432
+ }
1433
+ }
1434
+ // Its watch Scope (#318, #379, ADR-0055): its gesture watches and its drag track run in it, each
1435
+ // subscribed at once with no fiber of its own, until the unmount closes it. Made at the first
1436
+ // watch: a ward with no gesture makes and closes none.
1437
+ let watchScope: Scope.Closeable | undefined
1438
+ const watchIn = (watch: Effect.Effect<void, never, Scope.Scope | WardicServices>): void => {
1439
+ if (Predicate.isUndefined(watchScope)) watchScope = OwnerScope.open(runtime)
1440
+ runtime.runSync(watch.pipe(Scope.provide(watchScope)))
1441
+ }
1442
+ if (internal.defaultsOnElement === true) UndefinedOr.map(dragDefaults, (defaults) => applyDragDefaults(el, defaults))
1443
+ // The drag track (ADR-0004): the pointer direct-sets `x`/`y` while the spring drives the rest and
1444
+ // `whileDrag`; on a layout node it feeds the projection (ADR-0016).
1445
+ const locked = initialConfig.dragDirectionLock === true
1446
+ // Its section's `drag` Feature drives it (#511): without it, `drag` does nothing, and development
1447
+ // says so once, unless `drag` is on its way.
1448
+ const dragGesture = gestureIn(untrack(features.services), "drag", DragGesture, Predicate.isNotUndefined(dragAxis))
1449
+ // Whether its track drives its layout node (ADR-0016): the node it has as the track is made, at
1450
+ // mount or as `drag` arrives; a node made later leaves it moving `x`/`y` (#582).
1451
+ let dragProjected = false
1452
+ const driveDrag = (gesture: DragGesture["Service"]): DragTrack => {
1453
+ const axis = UndefinedOr.getOrThrow(dragAxis)
1454
+ dragProjected = Predicate.isNotUndefined(layout)
1455
+ // Motion's `dragConstraints` (#273): a box of numbers, or a container measured against the element.
1456
+ const constraints = gesture.constraintsOf(initialConfig.dragConstraints, el, () => untrack(cfg).onMeasureDragConstraints, pagePoint)
1457
+ return gesture.drive({
1458
+ watch: (track) => watchIn(track(onDefect)),
1459
+ fork: (response) => void runtime.runFork(response),
1460
+ gate,
1461
+ id,
1462
+ element: el,
1463
+ snapshot,
1464
+ recordFrame,
1465
+ // A drag's start turns its `style`'s will-change value on (#443).
1466
+ setDragging: draggingWithWillChange(live, (on: boolean) => setGesture(el, "dragging", on), el),
1467
+ // A Batch member's element takes its transform from its Batch as its drag reads or writes it (#665).
1468
+ claim: claimForDrag(el),
1469
+ mapPoint: pagePoint,
1470
+ skipAnimations,
1471
+ config: {
1472
+ axis,
1473
+ constraints: constraints.constraints,
1474
+ elastic: initialConfig.dragElastic,
1475
+ momentum: initialConfig.dragMomentum,
1476
+ snapToOrigin: initialConfig.dragSnapToOrigin,
1477
+ propagation: initialConfig.dragPropagation,
1478
+ directionLock: initialConfig.dragDirectionLock,
1479
+ transition: dragTransition,
1480
+ listen: initialConfig.dragListener,
1481
+ },
1482
+ container: constraints.container,
1483
+ controls: initialConfig.dragControls,
1484
+ ...UndefinedOr.match(layout, { onUndefined: () => ({}), onDefined: (projectionNode) => ({ projection: projectionNode }) }),
1485
+ ...UndefinedOr.match(internal.dragAxis, { onUndefined: () => ({}), onDefined: (axisAt) => ({ axisAt }) }),
1486
+ // Its samples to a `<Reorder>` item's group, and to the lifecycle for `next("dragStart")` (#257)
1487
+ // and, with a direction lock, `next("directionLock")` (#273).
1488
+ onSample: UndefinedOr.match(internal.onDragSample, {
1489
+ onUndefined: () => (sample: Drag.Sample) => lifecycle.dragged(sample, locked, el),
1490
+ onDefined: (onSample) => (sample: Drag.Sample) => {
1491
+ onSample(sample)
1492
+ lifecycle.dragged(sample, locked, el)
1493
+ },
1494
+ }),
1495
+ // Its release at rest, for `next("dragTransitionEnd")` (#273).
1496
+ onReleaseEnd: () => lifecycle.released(),
1497
+ })
1498
+ }
1499
+ let dragTrack = UndefinedOr.map(dragGesture, driveDrag)
1500
+ const spineOptions: ElementSpineOptions = {
1501
+ runtime,
1502
+ gate,
1503
+ id,
1504
+ element: el,
1505
+ tag: internal.tag,
1506
+ config: configNow,
1507
+ parent: node.inherited,
1508
+ canStart: node.canStart,
1509
+ extraDelay: node.extraDelay,
1510
+ byName: node.names,
1511
+ onFrame: node.onFrame,
1512
+ reducedMotion,
1513
+ skipAnimations,
1514
+ positionalKeys,
1515
+ defaultTransition,
1516
+ start: begun,
1517
+ snapshot,
1518
+ reuse,
1519
+ links,
1520
+ styleNow,
1521
+ live,
1522
+ presence: presenceRecord,
1523
+ projected: Predicate.isNotUndefined(layout),
1524
+ dragAxis,
1525
+ drag: dragTrack,
1526
+ handoff,
1527
+ animation: lifecycle,
1528
+ }
1529
+ // A `drag` on its way as it mounted (#551): its track starts as the Feature arrives (`startDrag`),
1530
+ // and the spine reads it at each Retarget from then on. Only then is `drag` a getter, so an
1531
+ // element that has it at mount, or never wants it, pays nothing.
1532
+ let startDrag: ((gesture: DragGesture["Service"]) => void) | undefined
1533
+ if (Predicate.isNotUndefined(dragAxis) && Predicate.isUndefined(dragTrack) && untrack(features.pending)) {
1534
+ Object.defineProperty(spineOptions, "drag", { get: () => dragTrack })
1535
+ // Whether that track drives the layout node (#582): until it starts, whether the element has one.
1536
+ Object.defineProperty(spineOptions, "projected", {
1537
+ get: () => UndefinedOr.match(dragTrack, { onUndefined: () => Predicate.isNotUndefined(layout), onDefined: () => dragProjected }),
1538
+ })
1539
+ startDrag = (gesture) => {
1540
+ if (Predicate.isUndefined(dragTrack)) dragTrack = driveDrag(gesture)
1541
+ }
1542
+ }
1543
+ const spine = makeElementSpine(spineOptions)
1544
+ // A child back under its key starts where its leaver is drawn (#286), before its first Retarget.
1545
+ if (Predicate.isNotUndefined(taken)) spine.seed(taken)
1546
+ // Live values in `style` (#130, ADR-0043): followed from the first routed key on.
1547
+ spine.follow({ resolved: () => untrack(target).resolved, dragging: () => untrack(dragging) })
1548
+ // Its Imperative animations (#433) go through its spine while it's mounted, and its Animation controls reach it.
1549
+ const unregisterAnimatable = registerAnimatable(el, spine)
1550
+ const unsubscribe = UndefinedOr.match(controls, {
1551
+ onUndefined: () => constVoid,
1552
+ onDefined: (c) => subscribe(c.controls, controlledElement(c.set, { custom: () => untrack(() => view.custom), snapshot }, spine.stop)),
1553
+ })
1554
+ const m: Mounted = {
1555
+ element: el,
1556
+ spine,
1557
+ layout,
1558
+ arriveLayout,
1559
+ watch: watchIn,
1560
+ startDrag,
1561
+ hover: false,
1562
+ press: false,
1563
+ pan: false,
1564
+ inView: false,
1565
+ focus: false,
1566
+ dispose: () => {
1567
+ if (Predicate.isNotUndefined(undrive)) undrive()
1568
+ UndefinedOr.map(mountedHook, (end) => end())
1569
+ unregisterAnimatable()
1570
+ unsubscribe()
1571
+ spine.dispose()
1572
+ // Its gesture watches' and drag track's listeners go, a running release stops, and their spans end.
1573
+ UndefinedOr.map(watchScope, (scope) => OwnerScope.close(runtime, scope, "wardic.ward: a finalizer failed"))
1574
+ // The group lets go of the node before it's disposed.
1575
+ UndefinedOr.map(handedOver, (release) => release())
1576
+ UndefinedOr.map(layout, (node) => node.dispose())
1577
+ unfollowTemplate()
1578
+ unregisterValues()
1579
+ unregister()
1580
+ },
1581
+ }
1582
+ startRecognizers(m)
1583
+ const mountedHook = UndefinedOr.map(internal.onMount, (onMount) => onMount(el, (make) => watchIn(make(onDefect))))
1584
+ return m
1585
+ }
1586
+
1587
+ // A `while*` target set after mount starts its recognizer then (#87, ADR-0040). Its compute reads
1588
+ // the two keys, so only their changes re-run it (#259).
1589
+ // Its section's Features are read there too, so a gesture's arriving lazily starts it (#511): each
1590
+ // start checks what's wanted.
1591
+ // An element whose config can never want one (`gestureless`, #525) makes it at its first want
1592
+ // through its lifecycle instead: no computation an element until then.
1593
+ let watchingLate = false
1594
+ const watchLateGestures = (): void => {
1595
+ if (watchingLate) return
1596
+ watchingLate = true
1597
+ runWithOwner(owner, () =>
1598
+ createEffect(
1599
+ () => ({ wanted: Bool.some([wantsHover(), wantsPress(), wantsInView(), wantsFocus()]), services: features.services() }),
1600
+ () => {
1601
+ UndefinedOr.map(mounted, startRecognizers)
1602
+ },
1603
+ CLIENT_ONLY_SYNC_DEFERRED,
1604
+ ),
1605
+ )
1606
+ }
1607
+ if (internal.gestureless !== true) watchLateGestures()
1608
+
1609
+ // `layout` on its way (#582): an element mounted before it arrives makes its node then, as its
1610
+ // gestures and drag start theirs; a load that brings none gets development's word then.
1611
+ if (Bool.and(wantsNode, Predicate.isUndefined(layoutProjection)) && untrack(features.pending)) {
1612
+ createEffect(
1613
+ () => ({ services: features.services(), pending: features.pending() }),
1614
+ // Its apply returns nothing: a function returned there would be its cleanup.
1615
+ ({ services, pending }) => {
1616
+ UndefinedOr.map(mounted, (m) => layoutArrivedIn(m.arriveLayout, services))
1617
+ if (DEV && Predicate.isUndefined(projectionIn(services)) && Bool.not(pending)) {
1618
+ featureRegistry.warnOnce("layout", missingMessage("layout", LAYOUT_PROPS, "@wardic/solid/unstable/v2"))
1619
+ }
1620
+ },
1621
+ CLIENT_ONLY_DEFERRED,
1622
+ )
1623
+ }
1624
+
1625
+ // A `drag` on its way (#551): an element mounted before it arrives starts its track then, as its
1626
+ // gestures' recognizers do, and nothing before it is replayed; a load that brings none gets
1627
+ // development's word then.
1628
+ if (Predicate.isNotUndefined(dragAxis) && untrack(features.pending)) {
1629
+ createEffect(
1630
+ () => ({ services: features.services(), pending: features.pending() }),
1631
+ // Its apply returns nothing: a function returned there would be its cleanup.
1632
+ ({ services, pending }) => {
1633
+ UndefinedOr.match(serviceIn(services, DragGesture), {
1634
+ // A `layout` from the same load makes its node first, so the track drives it (#582).
1635
+ onDefined: (gesture) =>
1636
+ UndefinedOr.map(mounted, (m) => {
1637
+ layoutArrivedIn(m.arriveLayout, services)
1638
+ UndefinedOr.map(m.startDrag, (start) => start(gesture))
1639
+ }),
1640
+ onUndefined: () => {
1641
+ if (DEV && Bool.not(pending)) featureRegistry.warnOnce("drag", missingMessage("drag", GESTURE_WORDS.drag, "@wardic/solid/unstable/v2"))
1642
+ },
1643
+ })
1644
+ },
1645
+ CLIENT_ONLY_DEFERRED,
1646
+ )
1647
+ }
1648
+
1649
+ // A `layoutDependency` change re-measures its layout node (not at mount: it measures as it registers).
1650
+ // Only a change of its value: a memo, since a Solid 2 effect applies on every re-run of its compute,
1651
+ // and `cfg()` is re-read on any of the config's changes (a `style` change re-measured, #209 PR 5's lab).
1652
+ // Its node may be made as `layout` arrives (#582), so it's read at each change.
1653
+ if (wantsNode) {
1654
+ const dependency = createMemo(() => cfg().layoutDependency, CLIENT_ONLY)
1655
+ createEffect(
1656
+ dependency,
1657
+ () => {
1658
+ UndefinedOr.map(UndefinedOr.map(mounted, (m) => m.layout), (node) => node.notify())
1659
+ },
1660
+ CLIENT_ONLY_DEFERRED,
1661
+ )
1662
+ }
1663
+
1664
+ // Whether the `when` gate lets a Retarget start (ADR-0007), as a memo: an element with variants of
1665
+ // its own reads its `when` off its config, and only a flip of the gate may re-run the effect.
1666
+ const open = gateOf(node)
1667
+
1668
+ // Mount, then Retarget on each change of the target or of the `when` gate: both are read here,
1669
+ // so a gate's flip re-runs it and releases a held Retarget. Only once the ref has given the
1670
+ // element (#320): until then the effect reads nothing else, so the target is first resolved with
1671
+ // its element, once, and a config that lands before the element (an async one) doesn't run it.
1672
+ createEffect(
1673
+ () => {
1674
+ const el = element()
1675
+ if (Predicate.isUndefined(el)) return undefined
1676
+ return { el, resolution: target(), open: open(), shown: ticked() }
1677
+ },
1678
+ (mounting) => {
1679
+ if (Predicate.isUndefined(mounting)) return
1680
+ const { el, resolution } = mounting
1681
+ if (Predicate.isUndefined(mounted) || mounted.element !== el) {
1682
+ // Another element it was spread on, or the one it's on, still on the page: a ward drives one
1683
+ // element at a time (#349's Q5). One the page has let go of is left behind.
1684
+ if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw new Error(secondElement("ward(config)"))
1685
+ refdBefore = undefined
1686
+ // Held off the page: nothing starts until it's on it.
1687
+ if (heldBack(el)) return
1688
+ // A new element starts with no gesture on, read from its gesture state (#257's audit).
1689
+ unmount()
1690
+ // One that came after the last left the page enters fresh (#414).
1691
+ if (el === fresh) beginFresh()
1692
+ // Its config is read at mount (its layout node's options, its `onUpdate`, its spine's) through
1693
+ // the per-key view (#259): untracked, so said, as the Retarget below.
1694
+ mounted = untrack(() => mount(el))
1695
+ }
1696
+ // The spine reads the variant context (its gates, its stagger, what it inherits) at the
1697
+ // Retarget, once: untracked, so said (Solid 2's dev build warns of a reactive read in an
1698
+ // effect's apply, STRICT_READ_UNTRACKED). The effect's compute is what re-runs it.
1699
+ const spine = mounted.spine
1700
+ untrack(() => spine.retarget(resolution))
1701
+ },
1702
+ CLIENT_ONLY_SYNC,
1703
+ )
1704
+
1705
+ // `<card.Provider>` hands down what this element hands its children (#50).
1706
+ const Provider = (props: { readonly children?: JSX.Element }): JSX.Element => (
1707
+ <WardicVariantContext value={contextOf(node.provided)}>{props.children}</WardicVariantContext>
1708
+ )
1709
+
1710
+ // The element's value per key (#130, ADR-0043 decision 5): the gate's output while it holds the
1711
+ // key, else where the key rests. One accessor a key, made on first ask, under the ward's owner. It
1712
+ // carries its Atom (#209 PR 3's Q2): a `style` given it follows the Atom, set at the gate's write,
1713
+ // so a key derived from it paints in the same frame. Where the key rests is Solid's (the user's
1714
+ // style), mirrored into an Atom of its own.
1715
+ let reads: Map<string, ReadEntry> | undefined
1716
+ const readEntry = (key: string): ReadEntry => {
1717
+ if (Predicate.isUndefined(reads)) reads = new Map()
1718
+ const known = reads.get(key)
1719
+ if (Predicate.isNotUndefined(known)) return known
1720
+ const output = gate.valueOf(id, key)
1721
+ const following = drivenAtom()
1722
+ const entry = runWithOwner(owner, (): ReadEntry => {
1723
+ const resting = createMemo(() => {
1724
+ withCallsOf()[0]()
1725
+ return restingOf(key, start.initialValues, userStyle(), (raw) => live.read(raw))
1726
+ }, CLIENT_ONLY)
1727
+ const restingAtom = Atom.make<unknown>(untrack(resting))
1728
+ onCleanup(registry().mount(restingAtom))
1729
+ createEffect(
1730
+ resting,
1731
+ (value) => {
1732
+ registry().set(restingAtom, value)
1733
+ },
1734
+ CLIENT_ONLY_DEFERRED,
1735
+ )
1736
+ const own = Atom.make((get) => UndefinedOr.match(get(output), { onUndefined: () => get(restingAtom), onDefined: identity }))
1737
+ // Given to a component (#349): what the element it drives shows, while it's there.
1738
+ const atom = Atom.make((get) => UndefinedOr.match(get(following), { onUndefined: () => get(own), onDefined: (d) => get(d.readAtom(key)) }))
1739
+ return { accessor: followAtom(registry(), atom), atom }
1740
+ })
1741
+ reads.set(key, entry)
1742
+ return entry
1743
+ }
1744
+ const read = (key: string): Accessor<unknown> => readEntry(key).accessor
1745
+ // Its `atom(key)`: the gate's output, or, given to a component (#349), the one of the element it drives.
1746
+ const atomOf = (key: string): Atom.Atom<unknown> => {
1747
+ const own = gate.valueOf(id, key)
1748
+ const following = drivenAtom()
1749
+ return Atom.make((get) => UndefinedOr.match(get(following), { onUndefined: () => get(own), onDefined: (d) => get(d.atom(key)) }))
1750
+ }
1751
+
1752
+ // The element's style, read where it renders. The keys still loading at setup (#257 item 1) are
1753
+ // read there too, with the target, so its region holds until they land and Solid retries it: the
1754
+ // Retarget reads `transition` as it starts, untracked, which a pending one would throw out of.
1755
+ // After that a refetch keeps the last value (Solid holds the previous one), and holds nothing.
1756
+ const holdWhileLoading: () => void = Bool.match(setup.pending.length === 0, {
1757
+ onTrue: () => constVoid,
1758
+ onFalse: () => {
1759
+ const config = cfg() as unknown as Readonly<Record<string, unknown>>
1760
+ // Client-only, so transparent to hydration ids as every computation of the binding's is (#618).
1761
+ const loaded = createMemo((): true => {
1762
+ Arr.forEach(setup.pending, (key) => void config[key])
1763
+ target()
1764
+ return true
1765
+ }, CLIENT_ONLY)
1766
+ return () => {
1767
+ loaded()
1768
+ }
1769
+ },
1770
+ })
1771
+ const renderedStyle = (): JSX.CSSProperties => {
1772
+ holdWhileLoading()
1773
+ return elementStyle.style(userStyle()) as JSX.CSSProperties
1774
+ }
1775
+
1776
+ // The ward: a ref, and its own props. Under a presence, its element is told to it as it's made
1777
+ // (#286): its `key`, and whether it's a twin.
1778
+ // What it shares with a component it's given to (#349), made when one asks.
1779
+ let shared: WardShare | undefined
1780
+ const sharedNow = (): WardShare => {
1781
+ if (Predicate.isNotUndefined(shared)) return shared
1782
+ /**
1783
+ * A ward driving an element for this one, given to a component (#349): followed until the release,
1784
+ * its `read` and `atom` Atoms reading the driver's. One at a time, and not while this one is on an
1785
+ * element of its own (#349's Q5).
1786
+ */
1787
+ const drive = (next: Driver, name: string): (() => void) => {
1788
+ if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw new Error(secondElement(name))
1789
+ driver = next
1790
+ UndefinedOr.map(driven, (atom) => registry().set(atom, next))
1791
+ return () => {
1792
+ if (driver !== next) return
1793
+ driver = undefined
1794
+ UndefinedOr.map(driven, (atom) => registry().set(atom, undefined))
1795
+ }
1796
+ }
1797
+ shared = {
1798
+ config,
1799
+ setup: initialConfig,
1800
+ internal,
1801
+ parent,
1802
+ chosen: Predicate.isNotUndefined(internal.parent),
1803
+ carries: carriesVariants(initialConfig),
1804
+ provided: node.provided,
1805
+ layoutGroup,
1806
+ node,
1807
+ lifecycle,
1808
+ drive,
1809
+ }
1810
+ return shared
1811
+ }
1812
+
1813
+ const setMade = madeWith(presence, setElement, initialConfig)
1814
+ const self = ((value?: unknown): WardProps | undefined => {
1815
+ if (isElement(value)) {
1816
+ const last = refdLast
1817
+ if (Predicate.isNotUndefined(last)) {
1818
+ if (last !== value) {
1819
+ refdBefore = last
1820
+ if (Bool.not(last.isConnected)) fresh = value
1821
+ }
1822
+ }
1823
+ refdLast = value
1824
+ setMade(value)
1825
+ return undefined
1826
+ }
1827
+ return spreadNow()
1828
+ }) as Ward
1829
+ // What a spread of the ward reads (#495): its spread's props alone, made at its first spread, so a
1830
+ // ward given only to `ref` makes none, and a Reorder item's keyboard attributes are in it.
1831
+ let spread: WardProps | undefined
1832
+ // Its `style` and its attributes as descriptors, made once (#460): its own keys, its spread and each
1833
+ // `.with()` share them.
1834
+ const styleKey: PropertyDescriptor = { get: renderedStyle, enumerable: true }
1835
+ const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults))
1836
+ const spreadNow = (): WardProps => {
1837
+ if (Predicate.isUndefined(spread)) spread = spreadOfWard(self, { value: self, enumerable: true }, styleKey, attributes)
1838
+ return spread
1839
+ }
1840
+ // Its members are the ones every ward shares (#525), reading this state: its own are `ref`, `style`
1841
+ // and its attributes.
1842
+ const state: WardState = {
1843
+ shared: sharedNow,
1844
+ Provider,
1845
+ read,
1846
+ atom: atomOf,
1847
+ with: (own: WardWithProps): WardProps => {
1848
+ given = own
1849
+ withCallsOf()[1](undefined)
1850
+ return spreadPropsOf({ ref: { value: withRef(own.ref, self), enumerable: true }, style: styleKey, ...attributes })
1851
+ },
1852
+ lifecycle,
1853
+ settled: undefined,
1854
+ tapped: undefined,
1855
+ next: undefined,
1856
+ each: undefined,
1857
+ when: undefined,
1858
+ }
1859
+ Object.setPrototypeOf(self, WARD_MEMBERS)
1860
+ Object.defineProperties(self, {
1861
+ [WARD_STATE]: { value: state },
1862
+ ref: { value: self, enumerable: true },
1863
+ style: styleKey,
1864
+ ...attributes,
1865
+ })
1866
+ return self
1867
+ }
1868
+
1869
+ /** A key's `read`: its accessor, and the Atom it follows. */
1870
+ interface ReadEntry {
1871
+ readonly accessor: Accessor<unknown>
1872
+ readonly atom: Atom.Atom<unknown>
1873
+ }
1874
+
1875
+ /** No `.with()` props: the config's style alone. */
1876
+ const NO_WITH: WardWithProps = {}
1877
+
1878
+ /** The last `.with()` merge, by its two styles: `style` reads it more than once a run. */
1879
+ // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
1880
+ const withMerges = new WeakMap<object, { readonly own: unknown; readonly merged: WardStyle | string | undefined }>()
1881
+
1882
+ /**
1883
+ * The config's `style` with a `.with()` style over it, key by key (#264, `Style.over`): the config's
1884
+ * as it is with none. One merge for the same two styles, so the element's Live values see one object.
1885
+ */
1886
+ const withStyleOver = (own: WardStyle | string | undefined, extra: WardStyle | string | undefined): WardStyle | string | undefined => {
1887
+ if (Predicate.isUndefined(extra)) return own
1888
+ if (Predicate.isString(extra)) return Style.over(extra, own) as WardStyle
1889
+ return Option.getOrElse(
1890
+ Option.map(Option.filter(Option.fromUndefinedOr(withMerges.get(extra)), (known) => known.own === own), (known) => known.merged),
1891
+ () => {
1892
+ const merged = Style.over(extra, own) as WardStyle
1893
+ withMerges.set(extra, { own, merged })
1894
+ return merged
1895
+ },
1896
+ )
1897
+ }
1898
+
1899
+ /** A `.with()` ref beside the ward's own: the user's first, as `refsOf` orders them. */
1900
+ const withRef = (user: WardWithProps["ref"], self: Ward): ((element: HTMLElement) => void) => {
1901
+ if (Predicate.isUndefined(user)) return self
1902
+ const refs = Arr.ensure(user) as ReadonlyArray<(element: HTMLElement) => void>
1903
+ return (element) => {
1904
+ Arr.forEach(refs, (ref) => ref(element))
1905
+ self(element)
1906
+ }
1907
+ }
1908
+
1909
+ /**
1910
+ * The Starting style's attributes, and a drag element's default ones when it `drags`, as a ward's own
1911
+ * keys: enumerable, so a spread applies them. Made once a ward (#460), into one map.
1912
+ */
1913
+ const attributeKeysOf = (attrs: Readonly<Record<string, unknown>>, drags: boolean): PropertyDescriptorMap => {
1914
+ const keys: PropertyDescriptorMap = {}
1915
+ addAttributeKeys(keys, attrs)
1916
+ if (drags) addAttributeKeys(keys, Style.DRAG_DEFAULT_ATTRIBUTES)
1917
+ return keys
1918
+ }
1919
+
1920
+ /** Each of `attrs` as an enumerable key, into `keys`: a later one wins a key both set. */
1921
+ const addAttributeKeys = (keys: PropertyDescriptorMap, attrs: Readonly<Record<string, unknown>>): void =>
1922
+ Arr.forEach(Object.keys(attrs), (key) => {
1923
+ keys[key] = { value: attrs[key], enumerable: true }
1924
+ })
1925
+
1926
+ /**
1927
+ * A spread's props, reaching no name but their own (#495): what a ward, its `.with()` or a Reorder group
1928
+ * hands an element's spread, and nothing else. Solid 2's `merge` calls a function source and reads each key off
1929
+ * what it returns with `in`, so a ward that returned itself shadowed the element's props with its own
1930
+ * names (`name`, `length`, `read`, `next`…), and an object with a prototype would with
1931
+ * `Object.prototype`'s (`constructor`, `toString`).
1932
+ */
1933
+ export const spreadPropsOf = <P = WardProps,>(descriptors: PropertyDescriptorMap): P => Object.defineProperties(new SpreadProps(), descriptors) as P
1934
+
1935
+ /**
1936
+ * What a spread's props are made from (#495): a constructor whose prototype has no prototype and no
1937
+ * names, so its objects reach none but their own. An `Object.create(null)` would too, but V8 keeps it
1938
+ * in dictionary mode: 217 bytes each in Node 24, against 49 (`.tmp/495/spreadmem.mjs`).
1939
+ */
1940
+ const SpreadProps = function SpreadProps(): void {} as unknown as new () => object
1941
+ SpreadProps.prototype = Object.create(null)
1942
+
1943
+ /** The props a Reorder item adds to its ward's spread (#495): its keyboard attributes. Only items have them. */
1944
+ // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
1945
+ const SPREAD_EXTRAS = new WeakMap<object, PropertyDescriptorMap>()
1946
+
1947
+ /**
1948
+ * `ward` with `descriptors` defined on it and added to its spread (#495), for a ward that carries props
1949
+ * of its own kind (a Reorder item's keyboard attributes). Before the ward's first spread.
1950
+ */
1951
+ export const withSpreadProps = <W extends object>(ward: W, descriptors: PropertyDescriptorMap): W => {
1952
+ SPREAD_EXTRAS.set(ward, descriptors)
1953
+ return Object.defineProperties(ward, descriptors)
1954
+ }
1955
+
1956
+ /** A ward's spread: its `ref`, `style` and attributes, and what {@link withSpreadProps} added, on no prototype. Made at its first spread (#460: one map). */
1957
+ const spreadOfWard = (ward: object, ref: PropertyDescriptor, style: PropertyDescriptor, attributes: PropertyDescriptorMap): WardProps => {
1958
+ const extras = SPREAD_EXTRAS.get(ward)
1959
+ if (Predicate.isUndefined(extras)) return spreadPropsOf({ ref, style, ...attributes })
1960
+ return spreadPropsOf({ ref, style, ...attributes, ...extras })
1961
+ }
1962
+
1963
+ /** A server's output Atom: nothing is written there, so it stays `undefined`. */
1964
+ const NO_OUTPUT: Atom.Atom<unknown> = Atom.make<unknown>(undefined)
1965
+
1966
+ /** A style value read on a server: an Atom through a server's own registry, an accessor called (#130). */
1967
+ const readServerStyle = (value: unknown): unknown => readLive(value, serverRegistryOf, untrack)
1968
+
1969
+ /**
1970
+ * {@link wardWith} during a server render (ADR-0021, decisions 1 and 4): the element's Starting
1971
+ * style and attributes, computed purely, and nothing else: no runtime, no spine, no signals. It
1972
+ * makes the client's one `createUniqueId` call, so later hydration keys land where the client's
1973
+ * render puts them, and its `.Provider` renders the same nesting, with the same names and inert
1974
+ * orchestration. No Appear animation yet (PR 4 of #209).
1975
+ */
1976
+ const serverWard = (config: WardConfig, internal: WardInternals): Ward => {
1977
+ createUniqueId()
1978
+ const view = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig())
1979
+ // A key still loading (#257 item 1): one setup fixes is the client's error here too. One the ward
1980
+ // reads as it goes is read again, throwing Solid's `NotReadyError`: a server waits for it and
1981
+ // renders the component again, so its region streams once the data is in, Appear and all.
1982
+ // Both are checked before the read that waits.
1983
+ const setup = WARD_VIEW.setupOf(view)
1984
+ // Animation controls (#433) set nothing on a server: no entry yet, and controlled, as on the client.
1985
+ const atSetup = uncontrolledOf(configAtSetup(setup))
1986
+ // Where it's made, its given parent's, or its given ward's (#349).
1987
+ const parent = variantParentOf(internal)
1988
+ const presenceBlocks = presenceBlocksInitial(usePresenceContext())
1989
+ if (Bool.and(Arr.contains(setup.pending, "animate"), startsAtAnimate(atSetup, inheritedContext(atSetup, parent), presenceBlocks))) throw new Error(STARTS_AT_PENDING)
1990
+ const c = uncontrolledOf(WARD_VIEW.snapshotOf(view))
1991
+ const node = serverVariantNode(c, parent)
1992
+ const initialValues = startOf(c, node.inherited, presenceBlocks, untrack).initialValues
1993
+ const layoutNode = isLayoutNode(c)
1994
+ const seed = Style.starting(internal.tag, drawnAtRest(initialValues, layoutNode, c.transformTemplate))
1995
+ // Its Appear animation (#48, ADR-0044): its slot in the render's, and the group its Variant
1996
+ // children join when it leads one.
1997
+ const appear = appearEntryOf(useWardicAppear(), c, internal.tag, initialValues, node, startsQuiet(c, node.inherited, presenceBlocks, untrack), settingOf(useWardicConfig()), useWardicSkipAnimations()())
1998
+ // A late chunk's root (#245): the chunk's Appear rules go through the head registry, read once
1999
+ // the chunk has rendered and streamed with it as a head patch. A late element under another late
2000
+ // one registers too: the first read writes the batch, and any other finds it written and adds no
2001
+ // tag, so Solid 1's `within` (which kept a chunk to one `<style>` node) isn't needed.
2002
+ if (appear.chunkRoot) UndefinedOr.map(appear.state, (state) => useHead(appearStyle(state.chunkCss, state.nonce)))
2003
+ const Provider = (props: { readonly children?: JSX.Element }): JSX.Element => (
2004
+ <WardicVariantContext value={contextOf(appear.provided)}>{props.children}</WardicVariantContext>
2005
+ )
2006
+ // Its routed keys' values join the Starting style, under `initial`'s (#130); a `<Reorder>` item's
2007
+ // base style, a drag element's defaults, then its Appear slot go under the user's style. A user
2008
+ // style with its own `animation` keeps it, over the slot, and the slot is left undefined.
2009
+ const dragDefaults = dragDefaultsOf(c, internal)
2010
+ // The element's style for its user style: the config's, or a `.with()` style over it (#264).
2011
+ const styleFor = (user: WardStyle | string | undefined): JSX.CSSProperties => {
2012
+ const parts = split(user)
2013
+ if (setsAnimation(parts.css)) appear.veto("its own style sets an animation")
2014
+ return pipe(
2015
+ serverStartingStyle(internal.tag, seed.style, initialValues, parts.routed, layoutNode, untrack, c.transformTemplate),
2016
+ Style.over(parts.css),
2017
+ Style.over(UndefinedOr.match(internal.baseStyle, { onUndefined: constUndefined, onDefined: (base) => base() })),
2018
+ Style.over(dragDefaults),
2019
+ Style.over(appear.style),
2020
+ ) as JSX.CSSProperties
2021
+ }
2022
+ const style = styleFor(c.style)
2023
+ let given: WardWithProps = NO_WITH
2024
+ const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults))
2025
+ // A spread of it reads its spread's props alone, made at its first spread, as the client's (#495).
2026
+ let spread: WardProps | undefined
2027
+ const self = ((): WardProps => {
2028
+ if (Predicate.isUndefined(spread)) spread = spreadOfWard(self, { value: noRef, enumerable: true }, { value: style, enumerable: true }, attributes)
2029
+ return spread
2030
+ }) as Ward
2031
+ // What it shares with a component it's given to (#349): a server's component renders its own.
2032
+ const shared: WardShare = {
2033
+ config,
2034
+ setup: atSetup,
2035
+ internal,
2036
+ parent,
2037
+ chosen: Predicate.isNotUndefined(internal.parent),
2038
+ carries: carriesVariants(atSetup),
2039
+ provided: appear.provided,
2040
+ layoutGroup: useLayoutGroupId(),
2041
+ node: undefined,
2042
+ lifecycle: undefined,
2043
+ drive: () => constVoid,
2044
+ }
2045
+ Object.defineProperties(self, {
2046
+ [WARD]: { value: shared },
2047
+ ref: { value: noRef, enumerable: true },
2048
+ style: { value: style, enumerable: true },
2049
+ ...attributes,
2050
+ Provider: { value: Provider },
2051
+ read: { value: (key: string) => () => restingOf(key, initialValues, withStyleOver(c.style, given.style), readServerStyle) },
2052
+ atom: { value: (): Atom.Atom<unknown> => NO_OUTPUT },
2053
+ // Nothing animates on a server: nothing has landed, and nothing will.
2054
+ settled: { value: constUndefined },
2055
+ // Nothing is pressed on a server either.
2056
+ tapped: { value: constUndefined },
2057
+ next: { value: neverLands },
2058
+ each: { value: () => NO_EVENTS },
2059
+ when: { value: serverWhen },
2060
+ // The element's own style over the config's, rendered in its Starting style (#264).
2061
+ with: {
2062
+ value: (own: WardWithProps): WardProps => {
2063
+ given = own
2064
+ return spreadPropsOf({
2065
+ ref: { value: noRef, enumerable: true },
2066
+ style: { value: styleFor(withStyleOver(c.style, own.style)), enumerable: true },
2067
+ ...attributes,
2068
+ })
2069
+ },
2070
+ },
2071
+ })
2072
+ return self
2073
+ }
2074
+
2075
+ /** A server render's `ref`: Solid never calls it there. */
2076
+ const noRef = constUndefined
2077
+
2078
+