@wardic/solid 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (764) hide show
  1. package/README.md +5 -2
  2. package/dist/browser/animation-controls.js +3 -149
  3. package/dist/browser/animation-controls.js.map +1 -1
  4. package/dist/browser/appear.js +3 -743
  5. package/dist/browser/appear.js.map +1 -1
  6. package/dist/browser/batch-gestures.js.map +1 -1
  7. package/dist/browser/batch-reorder-group.js +40 -11
  8. package/dist/browser/batch-reorder-group.js.map +1 -1
  9. package/dist/browser/batch-reorder-places.js +517 -50
  10. package/dist/browser/batch-reorder-places.js.map +1 -1
  11. package/dist/browser/batch-reorder.js +284 -42
  12. package/dist/browser/batch-reorder.js.map +1 -1
  13. package/dist/browser/batch.js +3 -2511
  14. package/dist/browser/batch.js.map +1 -1
  15. package/dist/browser/config.js +11 -1
  16. package/dist/browser/config.js.map +1 -1
  17. package/dist/browser/create-animate.js +4 -2
  18. package/dist/browser/create-animate.js.map +1 -1
  19. package/dist/browser/create-batch.js +2 -2
  20. package/dist/browser/create-batch.js.map +1 -1
  21. package/dist/browser/create-ward.js +54 -13
  22. package/dist/browser/create-ward.js.map +1 -1
  23. package/dist/browser/create-wardic.js +44 -0
  24. package/dist/browser/create-wardic.js.map +1 -0
  25. package/dist/browser/drag-constraints.js +3 -75
  26. package/dist/browser/drag-constraints.js.map +1 -1
  27. package/dist/browser/drag-controls.js +3 -50
  28. package/dist/browser/drag-controls.js.map +1 -1
  29. package/dist/browser/drag-defaults.js +4 -0
  30. package/dist/browser/drag-defaults.js.map +1 -0
  31. package/dist/browser/drag-track.js +3 -826
  32. package/dist/browser/drag-track.js.map +1 -1
  33. package/dist/browser/drag-transition.js +3 -55
  34. package/dist/browser/drag-transition.js.map +1 -1
  35. package/dist/browser/element-setup.js +4 -0
  36. package/dist/browser/element-setup.js.map +1 -0
  37. package/dist/browser/element.js +12 -3
  38. package/dist/browser/element.js.map +1 -1
  39. package/dist/browser/feature.js +3 -270
  40. package/dist/browser/feature.js.map +1 -1
  41. package/dist/browser/features/all.js +3 -9
  42. package/dist/browser/features/all.js.map +1 -1
  43. package/dist/browser/features/colors.js +3 -32
  44. package/dist/browser/features/colors.js.map +1 -1
  45. package/dist/browser/features/dom-animation.js +3 -6
  46. package/dist/browser/features/dom-animation.js.map +1 -1
  47. package/dist/browser/features/dom-max.js +3 -3
  48. package/dist/browser/features/dom-max.js.map +1 -1
  49. package/dist/browser/features/drag.js +3 -27
  50. package/dist/browser/features/drag.js.map +1 -1
  51. package/dist/browser/features/focus.js +3 -17
  52. package/dist/browser/features/focus.js.map +1 -1
  53. package/dist/browser/features/hover.js +3 -17
  54. package/dist/browser/features/hover.js.map +1 -1
  55. package/dist/browser/features/in-view.js +3 -17
  56. package/dist/browser/features/in-view.js.map +1 -1
  57. package/dist/browser/features/input.js +3 -26
  58. package/dist/browser/features/input.js.map +1 -1
  59. package/dist/browser/features/keys.js +3 -18
  60. package/dist/browser/features/keys.js.map +1 -1
  61. package/dist/browser/features/layout.js +3 -32
  62. package/dist/browser/features/layout.js.map +1 -1
  63. package/dist/browser/features/pan.js +3 -17
  64. package/dist/browser/features/pan.js.map +1 -1
  65. package/dist/browser/features/press.js +3 -11
  66. package/dist/browser/features/press.js.map +1 -1
  67. package/dist/browser/features/scroll.js +3 -20
  68. package/dist/browser/features/scroll.js.map +1 -1
  69. package/dist/browser/gesture-features.js +3 -28
  70. package/dist/browser/gesture-features.js.map +1 -1
  71. package/dist/browser/gesture-info.js +3 -42
  72. package/dist/browser/gesture-info.js.map +1 -1
  73. package/dist/browser/imperative.js +3 -708
  74. package/dist/browser/imperative.js.map +1 -1
  75. package/dist/browser/index.js +2 -1
  76. package/dist/browser/index.js.map +1 -1
  77. package/dist/browser/instance-features.js +66 -0
  78. package/dist/browser/instance-features.js.map +1 -0
  79. package/dist/browser/instant.js +3 -50
  80. package/dist/browser/instant.js.map +1 -1
  81. package/dist/browser/layout-group.js +3 -26
  82. package/dist/browser/layout-group.js.map +1 -1
  83. package/dist/browser/layout-member.js +3 -373
  84. package/dist/browser/layout-member.js.map +1 -1
  85. package/dist/browser/layout-projection.js +8 -1
  86. package/dist/browser/layout-projection.js.map +1 -1
  87. package/dist/browser/layout.js +5 -6
  88. package/dist/browser/layout.js.map +1 -1
  89. package/dist/browser/lazy-batch-gestures.js.map +1 -1
  90. package/dist/browser/live-scroll.js +29 -21
  91. package/dist/browser/live-scroll.js.map +1 -1
  92. package/dist/browser/live-style.js +3 -313
  93. package/dist/browser/live-style.js.map +1 -1
  94. package/dist/browser/live-value.js +11 -2
  95. package/dist/browser/live-value.js.map +1 -1
  96. package/dist/browser/member-hold.js +3 -180
  97. package/dist/browser/member-hold.js.map +1 -1
  98. package/dist/browser/messages.js +20 -0
  99. package/dist/browser/messages.js.map +1 -0
  100. package/dist/browser/owner-scope.js +3 -28
  101. package/dist/browser/owner-scope.js.map +1 -1
  102. package/dist/browser/presence-controller.js +3 -1449
  103. package/dist/browser/presence-controller.js.map +1 -1
  104. package/dist/browser/presence-record.js +9 -24
  105. package/dist/browser/presence-record.js.map +1 -1
  106. package/dist/browser/presence.js.map +1 -1
  107. package/dist/browser/press.js +3 -23
  108. package/dist/browser/press.js.map +1 -1
  109. package/dist/browser/provider.js +65 -11
  110. package/dist/browser/provider.js.map +1 -1
  111. package/dist/browser/reactivity.js +0 -7
  112. package/dist/browser/reactivity.js.map +1 -1
  113. package/dist/browser/reorder.js.map +1 -1
  114. package/dist/browser/retarget-legs.js +3 -1021
  115. package/dist/browser/retarget-legs.js.map +1 -1
  116. package/dist/browser/runtime.js +62 -21
  117. package/dist/browser/runtime.js.map +1 -1
  118. package/dist/browser/scroll-values.js +46 -0
  119. package/dist/browser/scroll-values.js.map +1 -0
  120. package/dist/browser/server-interpolators.js +3 -19
  121. package/dist/browser/server-interpolators.js.map +1 -1
  122. package/dist/browser/spans-check.js +25 -0
  123. package/dist/browser/spans-check.js.map +1 -0
  124. package/dist/browser/spine.js +3 -3043
  125. package/dist/browser/spine.js.map +1 -1
  126. package/dist/browser/timelines.js +4 -0
  127. package/dist/browser/timelines.js.map +1 -0
  128. package/dist/browser/unstable/v2/batch-reorder-group.js +36 -6
  129. package/dist/browser/unstable/v2/batch-reorder-group.js.map +1 -1
  130. package/dist/browser/unstable/v2/create-animate.js +4 -2
  131. package/dist/browser/unstable/v2/create-animate.js.map +1 -1
  132. package/dist/browser/unstable/v2/create-batch.js +2 -2
  133. package/dist/browser/unstable/v2/create-batch.js.map +1 -1
  134. package/dist/browser/unstable/v2/create-wardic.js +45 -0
  135. package/dist/browser/unstable/v2/create-wardic.js.map +1 -0
  136. package/dist/browser/unstable/v2/element.js +12 -2
  137. package/dist/browser/unstable/v2/element.js.map +1 -1
  138. package/dist/browser/unstable/v2/index.js +1 -0
  139. package/dist/browser/unstable/v2/index.js.map +1 -1
  140. package/dist/browser/unstable/v2/lifecycle.js +2 -0
  141. package/dist/browser/unstable/v2/lifecycle.js.map +1 -1
  142. package/dist/browser/unstable/v2/live-scroll.js +22 -13
  143. package/dist/browser/unstable/v2/live-scroll.js.map +1 -1
  144. package/dist/browser/unstable/v2/live-value.js +9 -1
  145. package/dist/browser/unstable/v2/live-value.js.map +1 -1
  146. package/dist/browser/unstable/v2/presence.js.map +1 -1
  147. package/dist/browser/unstable/v2/provider.js +68 -13
  148. package/dist/browser/unstable/v2/provider.js.map +1 -1
  149. package/dist/browser/unstable/v2/reorder.js.map +1 -1
  150. package/dist/browser/unstable/v2/w.js +7 -8
  151. package/dist/browser/unstable/v2/w.js.map +1 -1
  152. package/dist/browser/unstable/v2/ward.js +45 -12
  153. package/dist/browser/unstable/v2/ward.js.map +1 -1
  154. package/dist/browser/unstable/v2/wardic-instance.js +2 -0
  155. package/dist/browser/unstable/v2/wardic-instance.js.map +1 -0
  156. package/dist/browser/variant-target.js +3 -228
  157. package/dist/browser/variant-target.js.map +1 -1
  158. package/dist/browser/variant-tree.js +3 -393
  159. package/dist/browser/variant-tree.js.map +1 -1
  160. package/dist/browser/w.js +8 -9
  161. package/dist/browser/w.js.map +1 -1
  162. package/dist/browser/wardic-config-value.js +3 -90
  163. package/dist/browser/wardic-config-value.js.map +1 -1
  164. package/dist/browser/wardic-instance.js +2 -0
  165. package/dist/browser/wardic-instance.js.map +1 -0
  166. package/dist/server/animation-controls.js +3 -149
  167. package/dist/server/animation-controls.js.map +1 -1
  168. package/dist/server/appear.js +3 -743
  169. package/dist/server/appear.js.map +1 -1
  170. package/dist/server/batch-gestures.js.map +1 -1
  171. package/dist/server/batch-reorder-group.js +40 -11
  172. package/dist/server/batch-reorder-group.js.map +1 -1
  173. package/dist/server/batch-reorder-places.js +517 -50
  174. package/dist/server/batch-reorder-places.js.map +1 -1
  175. package/dist/server/batch-reorder.js +284 -42
  176. package/dist/server/batch-reorder.js.map +1 -1
  177. package/dist/server/batch.js +3 -2511
  178. package/dist/server/batch.js.map +1 -1
  179. package/dist/server/config.js +11 -1
  180. package/dist/server/config.js.map +1 -1
  181. package/dist/server/create-animate.js +4 -2
  182. package/dist/server/create-animate.js.map +1 -1
  183. package/dist/server/create-batch.js +2 -2
  184. package/dist/server/create-batch.js.map +1 -1
  185. package/dist/server/create-ward.js +54 -13
  186. package/dist/server/create-ward.js.map +1 -1
  187. package/dist/server/create-wardic.js +44 -0
  188. package/dist/server/create-wardic.js.map +1 -0
  189. package/dist/server/drag-constraints.js +3 -75
  190. package/dist/server/drag-constraints.js.map +1 -1
  191. package/dist/server/drag-controls.js +3 -50
  192. package/dist/server/drag-controls.js.map +1 -1
  193. package/dist/server/drag-defaults.js +4 -0
  194. package/dist/server/drag-defaults.js.map +1 -0
  195. package/dist/server/drag-track.js +3 -826
  196. package/dist/server/drag-track.js.map +1 -1
  197. package/dist/server/drag-transition.js +3 -55
  198. package/dist/server/drag-transition.js.map +1 -1
  199. package/dist/server/element-setup.js +4 -0
  200. package/dist/server/element-setup.js.map +1 -0
  201. package/dist/server/element.js +12 -3
  202. package/dist/server/element.js.map +1 -1
  203. package/dist/server/feature.js +3 -270
  204. package/dist/server/feature.js.map +1 -1
  205. package/dist/server/features/all.js +3 -9
  206. package/dist/server/features/all.js.map +1 -1
  207. package/dist/server/features/colors.js +3 -32
  208. package/dist/server/features/colors.js.map +1 -1
  209. package/dist/server/features/dom-animation.js +3 -6
  210. package/dist/server/features/dom-animation.js.map +1 -1
  211. package/dist/server/features/dom-max.js +3 -3
  212. package/dist/server/features/dom-max.js.map +1 -1
  213. package/dist/server/features/drag.js +3 -27
  214. package/dist/server/features/drag.js.map +1 -1
  215. package/dist/server/features/focus.js +3 -17
  216. package/dist/server/features/focus.js.map +1 -1
  217. package/dist/server/features/hover.js +3 -17
  218. package/dist/server/features/hover.js.map +1 -1
  219. package/dist/server/features/in-view.js +3 -17
  220. package/dist/server/features/in-view.js.map +1 -1
  221. package/dist/server/features/input.js +3 -26
  222. package/dist/server/features/input.js.map +1 -1
  223. package/dist/server/features/keys.js +3 -18
  224. package/dist/server/features/keys.js.map +1 -1
  225. package/dist/server/features/layout.js +3 -32
  226. package/dist/server/features/layout.js.map +1 -1
  227. package/dist/server/features/pan.js +3 -17
  228. package/dist/server/features/pan.js.map +1 -1
  229. package/dist/server/features/press.js +3 -11
  230. package/dist/server/features/press.js.map +1 -1
  231. package/dist/server/features/scroll.js +3 -20
  232. package/dist/server/features/scroll.js.map +1 -1
  233. package/dist/server/gesture-features.js +3 -28
  234. package/dist/server/gesture-features.js.map +1 -1
  235. package/dist/server/gesture-info.js +3 -42
  236. package/dist/server/gesture-info.js.map +1 -1
  237. package/dist/server/imperative.js +3 -708
  238. package/dist/server/imperative.js.map +1 -1
  239. package/dist/server/index.js +2 -1
  240. package/dist/server/index.js.map +1 -1
  241. package/dist/server/instance-features.js +66 -0
  242. package/dist/server/instance-features.js.map +1 -0
  243. package/dist/server/instant.js +3 -50
  244. package/dist/server/instant.js.map +1 -1
  245. package/dist/server/layout-group.js +3 -26
  246. package/dist/server/layout-group.js.map +1 -1
  247. package/dist/server/layout-member.js +3 -373
  248. package/dist/server/layout-member.js.map +1 -1
  249. package/dist/server/layout-projection.js +8 -1
  250. package/dist/server/layout-projection.js.map +1 -1
  251. package/dist/server/layout.js +5 -6
  252. package/dist/server/layout.js.map +1 -1
  253. package/dist/server/lazy-batch-gestures.js.map +1 -1
  254. package/dist/server/live-scroll.js +29 -21
  255. package/dist/server/live-scroll.js.map +1 -1
  256. package/dist/server/live-style.js +3 -313
  257. package/dist/server/live-style.js.map +1 -1
  258. package/dist/server/live-value.js +11 -2
  259. package/dist/server/live-value.js.map +1 -1
  260. package/dist/server/member-hold.js +3 -180
  261. package/dist/server/member-hold.js.map +1 -1
  262. package/dist/server/messages.js +20 -0
  263. package/dist/server/messages.js.map +1 -0
  264. package/dist/server/owner-scope.js +3 -28
  265. package/dist/server/owner-scope.js.map +1 -1
  266. package/dist/server/presence-controller.js +3 -1449
  267. package/dist/server/presence-controller.js.map +1 -1
  268. package/dist/server/presence-record.js +9 -24
  269. package/dist/server/presence-record.js.map +1 -1
  270. package/dist/server/presence.js.map +1 -1
  271. package/dist/server/press.js +3 -23
  272. package/dist/server/press.js.map +1 -1
  273. package/dist/server/provider.js +65 -11
  274. package/dist/server/provider.js.map +1 -1
  275. package/dist/server/reactivity.js +0 -7
  276. package/dist/server/reactivity.js.map +1 -1
  277. package/dist/server/reorder.js.map +1 -1
  278. package/dist/server/retarget-legs.js +3 -1021
  279. package/dist/server/retarget-legs.js.map +1 -1
  280. package/dist/server/runtime.js +62 -21
  281. package/dist/server/runtime.js.map +1 -1
  282. package/dist/server/scroll-values.js +46 -0
  283. package/dist/server/scroll-values.js.map +1 -0
  284. package/dist/server/server-interpolators.js +3 -19
  285. package/dist/server/server-interpolators.js.map +1 -1
  286. package/dist/server/spans-check.js +25 -0
  287. package/dist/server/spans-check.js.map +1 -0
  288. package/dist/server/spine.js +3 -3043
  289. package/dist/server/spine.js.map +1 -1
  290. package/dist/server/timelines.js +4 -0
  291. package/dist/server/timelines.js.map +1 -0
  292. package/dist/server/unstable/v2/batch-reorder-group.js +36 -6
  293. package/dist/server/unstable/v2/batch-reorder-group.js.map +1 -1
  294. package/dist/server/unstable/v2/create-animate.js +4 -2
  295. package/dist/server/unstable/v2/create-animate.js.map +1 -1
  296. package/dist/server/unstable/v2/create-batch.js +2 -2
  297. package/dist/server/unstable/v2/create-batch.js.map +1 -1
  298. package/dist/server/unstable/v2/create-wardic.js +45 -0
  299. package/dist/server/unstable/v2/create-wardic.js.map +1 -0
  300. package/dist/server/unstable/v2/element.js +12 -2
  301. package/dist/server/unstable/v2/element.js.map +1 -1
  302. package/dist/server/unstable/v2/index.js +1 -0
  303. package/dist/server/unstable/v2/index.js.map +1 -1
  304. package/dist/server/unstable/v2/lifecycle.js +2 -0
  305. package/dist/server/unstable/v2/lifecycle.js.map +1 -1
  306. package/dist/server/unstable/v2/live-scroll.js +22 -13
  307. package/dist/server/unstable/v2/live-scroll.js.map +1 -1
  308. package/dist/server/unstable/v2/live-value.js +9 -1
  309. package/dist/server/unstable/v2/live-value.js.map +1 -1
  310. package/dist/server/unstable/v2/presence.js.map +1 -1
  311. package/dist/server/unstable/v2/provider.js +68 -13
  312. package/dist/server/unstable/v2/provider.js.map +1 -1
  313. package/dist/server/unstable/v2/reorder.js.map +1 -1
  314. package/dist/server/unstable/v2/w.js +7 -8
  315. package/dist/server/unstable/v2/w.js.map +1 -1
  316. package/dist/server/unstable/v2/ward.js +45 -12
  317. package/dist/server/unstable/v2/ward.js.map +1 -1
  318. package/dist/server/unstable/v2/wardic-instance.js +2 -0
  319. package/dist/server/unstable/v2/wardic-instance.js.map +1 -0
  320. package/dist/server/variant-target.js +3 -228
  321. package/dist/server/variant-target.js.map +1 -1
  322. package/dist/server/variant-tree.js +3 -393
  323. package/dist/server/variant-tree.js.map +1 -1
  324. package/dist/server/w.js +8 -9
  325. package/dist/server/w.js.map +1 -1
  326. package/dist/server/wardic-config-value.js +3 -90
  327. package/dist/server/wardic-config-value.js.map +1 -1
  328. package/dist/server/wardic-instance.js +2 -0
  329. package/dist/server/wardic-instance.js.map +1 -0
  330. package/dist/solid/animation-controls.d.ts +1 -102
  331. package/dist/solid/animation-controls.d.ts.map +1 -1
  332. package/dist/solid/animation-controls.js +3 -128
  333. package/dist/solid/animation-controls.js.map +1 -1
  334. package/dist/solid/appear.d.ts +1 -218
  335. package/dist/solid/appear.d.ts.map +1 -1
  336. package/dist/solid/appear.js +3 -529
  337. package/dist/solid/appear.js.map +1 -1
  338. package/dist/solid/batch-gestures.d.ts +2 -2
  339. package/dist/solid/batch-gestures.d.ts.map +1 -1
  340. package/dist/solid/batch-gestures.js.map +1 -1
  341. package/dist/solid/batch-reorder-group.d.ts +17 -15
  342. package/dist/solid/batch-reorder-group.d.ts.map +1 -1
  343. package/dist/solid/batch-reorder-group.jsx +37 -7
  344. package/dist/solid/batch-reorder-group.jsx.map +1 -1
  345. package/dist/solid/batch-reorder-places.d.ts +184 -23
  346. package/dist/solid/batch-reorder-places.d.ts.map +1 -1
  347. package/dist/solid/batch-reorder-places.js +397 -41
  348. package/dist/solid/batch-reorder-places.js.map +1 -1
  349. package/dist/solid/batch-reorder.d.ts +30 -1
  350. package/dist/solid/batch-reorder.d.ts.map +1 -1
  351. package/dist/solid/batch-reorder.js +298 -37
  352. package/dist/solid/batch-reorder.js.map +1 -1
  353. package/dist/solid/batch.d.ts +1 -511
  354. package/dist/solid/batch.d.ts.map +1 -1
  355. package/dist/solid/batch.js +3 -2484
  356. package/dist/solid/batch.js.map +1 -1
  357. package/dist/solid/config.d.ts +2 -690
  358. package/dist/solid/config.d.ts.map +1 -1
  359. package/dist/solid/config.js +11 -1
  360. package/dist/solid/config.js.map +1 -1
  361. package/dist/solid/create-animate.d.ts.map +1 -1
  362. package/dist/solid/create-animate.jsx +3 -1
  363. package/dist/solid/create-animate.jsx.map +1 -1
  364. package/dist/solid/create-batch.jsx +2 -2
  365. package/dist/solid/create-batch.jsx.map +1 -1
  366. package/dist/solid/create-ward.d.ts +8 -3
  367. package/dist/solid/create-ward.d.ts.map +1 -1
  368. package/dist/solid/create-ward.jsx +50 -11
  369. package/dist/solid/create-ward.jsx.map +1 -1
  370. package/dist/solid/create-wardic.d.ts +24 -0
  371. package/dist/solid/create-wardic.d.ts.map +1 -0
  372. package/dist/solid/create-wardic.jsx +42 -0
  373. package/dist/solid/create-wardic.jsx.map +1 -0
  374. package/dist/solid/drag-constraints.d.ts +1 -45
  375. package/dist/solid/drag-constraints.d.ts.map +1 -1
  376. package/dist/solid/drag-constraints.js +3 -48
  377. package/dist/solid/drag-constraints.js.map +1 -1
  378. package/dist/solid/drag-controls.d.ts +1 -49
  379. package/dist/solid/drag-controls.d.ts.map +1 -1
  380. package/dist/solid/drag-controls.js +3 -50
  381. package/dist/solid/drag-controls.js.map +1 -1
  382. package/dist/solid/drag-defaults.d.ts +2 -0
  383. package/dist/solid/drag-defaults.d.ts.map +1 -0
  384. package/dist/solid/drag-defaults.js +4 -0
  385. package/dist/solid/drag-defaults.js.map +1 -0
  386. package/dist/solid/drag-track.d.ts +1 -232
  387. package/dist/solid/drag-track.d.ts.map +1 -1
  388. package/dist/solid/drag-track.js +3 -641
  389. package/dist/solid/drag-track.js.map +1 -1
  390. package/dist/solid/drag-transition.d.ts +1 -19
  391. package/dist/solid/drag-transition.d.ts.map +1 -1
  392. package/dist/solid/drag-transition.js +3 -30
  393. package/dist/solid/drag-transition.js.map +1 -1
  394. package/dist/solid/element-setup.d.ts +2 -0
  395. package/dist/solid/element-setup.d.ts.map +1 -0
  396. package/dist/solid/element-setup.js +4 -0
  397. package/dist/solid/element-setup.js.map +1 -0
  398. package/dist/solid/element.d.ts +27 -8
  399. package/dist/solid/element.d.ts.map +1 -1
  400. package/dist/solid/element.jsx +13 -5
  401. package/dist/solid/element.jsx.map +1 -1
  402. package/dist/solid/feature.d.ts +1 -118
  403. package/dist/solid/feature.d.ts.map +1 -1
  404. package/dist/solid/feature.js +3 -257
  405. package/dist/solid/feature.js.map +1 -1
  406. package/dist/solid/features/all.d.ts +1 -9
  407. package/dist/solid/features/all.d.ts.map +1 -1
  408. package/dist/solid/features/all.js +3 -9
  409. package/dist/solid/features/all.js.map +1 -1
  410. package/dist/solid/features/colors.d.ts +1 -11
  411. package/dist/solid/features/colors.d.ts.map +1 -1
  412. package/dist/solid/features/colors.js +3 -33
  413. package/dist/solid/features/colors.js.map +1 -1
  414. package/dist/solid/features/dom-animation.d.ts +1 -10
  415. package/dist/solid/features/dom-animation.d.ts.map +1 -1
  416. package/dist/solid/features/dom-animation.js +3 -6
  417. package/dist/solid/features/dom-animation.js.map +1 -1
  418. package/dist/solid/features/dom-max.d.ts +1 -9
  419. package/dist/solid/features/dom-max.d.ts.map +1 -1
  420. package/dist/solid/features/dom-max.js +3 -3
  421. package/dist/solid/features/dom-max.js.map +1 -1
  422. package/dist/solid/features/drag.d.ts +1 -4
  423. package/dist/solid/features/drag.d.ts.map +1 -1
  424. package/dist/solid/features/drag.js +3 -27
  425. package/dist/solid/features/drag.js.map +1 -1
  426. package/dist/solid/features/focus.d.ts +1 -4
  427. package/dist/solid/features/focus.d.ts.map +1 -1
  428. package/dist/solid/features/focus.js +3 -15
  429. package/dist/solid/features/focus.js.map +1 -1
  430. package/dist/solid/features/hover.d.ts +1 -4
  431. package/dist/solid/features/hover.d.ts.map +1 -1
  432. package/dist/solid/features/hover.js +3 -15
  433. package/dist/solid/features/hover.js.map +1 -1
  434. package/dist/solid/features/in-view.d.ts +1 -4
  435. package/dist/solid/features/in-view.d.ts.map +1 -1
  436. package/dist/solid/features/in-view.js +3 -15
  437. package/dist/solid/features/in-view.js.map +1 -1
  438. package/dist/solid/features/input.d.ts +1 -25
  439. package/dist/solid/features/input.d.ts.map +1 -1
  440. package/dist/solid/features/input.js +3 -26
  441. package/dist/solid/features/input.js.map +1 -1
  442. package/dist/solid/features/keys.d.ts +1 -69
  443. package/dist/solid/features/keys.d.ts.map +1 -1
  444. package/dist/solid/features/keys.js +3 -25
  445. package/dist/solid/features/keys.js.map +1 -1
  446. package/dist/solid/features/layout.d.ts +1 -31
  447. package/dist/solid/features/layout.d.ts.map +1 -1
  448. package/dist/solid/features/layout.js +3 -33
  449. package/dist/solid/features/layout.js.map +1 -1
  450. package/dist/solid/features/pan.d.ts +1 -4
  451. package/dist/solid/features/pan.d.ts.map +1 -1
  452. package/dist/solid/features/pan.js +3 -15
  453. package/dist/solid/features/pan.js.map +1 -1
  454. package/dist/solid/features/press.d.ts +1 -10
  455. package/dist/solid/features/press.d.ts.map +1 -1
  456. package/dist/solid/features/press.js +3 -9
  457. package/dist/solid/features/press.js.map +1 -1
  458. package/dist/solid/features/scroll.d.ts +1 -15
  459. package/dist/solid/features/scroll.d.ts.map +1 -1
  460. package/dist/solid/features/scroll.js +3 -20
  461. package/dist/solid/features/scroll.js.map +1 -1
  462. package/dist/solid/gesture-features.d.ts +1 -27
  463. package/dist/solid/gesture-features.d.ts.map +1 -1
  464. package/dist/solid/gesture-features.js +3 -28
  465. package/dist/solid/gesture-features.js.map +1 -1
  466. package/dist/solid/gesture-info.d.ts +1 -58
  467. package/dist/solid/gesture-info.d.ts.map +1 -1
  468. package/dist/solid/gesture-info.js +3 -22
  469. package/dist/solid/gesture-info.js.map +1 -1
  470. package/dist/solid/imperative.d.ts +1 -202
  471. package/dist/solid/imperative.d.ts.map +1 -1
  472. package/dist/solid/imperative.js +3 -622
  473. package/dist/solid/imperative.js.map +1 -1
  474. package/dist/solid/index.d.ts +4 -2
  475. package/dist/solid/index.d.ts.map +1 -1
  476. package/dist/solid/index.jsx +2 -1
  477. package/dist/solid/index.jsx.map +1 -1
  478. package/dist/solid/instance-features.d.ts +7 -0
  479. package/dist/solid/instance-features.d.ts.map +1 -0
  480. package/dist/solid/instance-features.js +63 -0
  481. package/dist/solid/instance-features.js.map +1 -0
  482. package/dist/solid/instant.d.ts +1 -43
  483. package/dist/solid/instant.d.ts.map +1 -1
  484. package/dist/solid/instant.js +3 -48
  485. package/dist/solid/instant.js.map +1 -1
  486. package/dist/solid/layout-group.d.ts +1 -13
  487. package/dist/solid/layout-group.d.ts.map +1 -1
  488. package/dist/solid/layout-group.js +3 -26
  489. package/dist/solid/layout-group.js.map +1 -1
  490. package/dist/solid/layout-member.d.ts +1 -126
  491. package/dist/solid/layout-member.d.ts.map +1 -1
  492. package/dist/solid/layout-member.js +3 -177
  493. package/dist/solid/layout-member.js.map +1 -1
  494. package/dist/solid/layout-projection.d.ts +6 -0
  495. package/dist/solid/layout-projection.d.ts.map +1 -1
  496. package/dist/solid/layout-projection.jsx +8 -1
  497. package/dist/solid/layout-projection.jsx.map +1 -1
  498. package/dist/solid/layout.d.ts +4 -3
  499. package/dist/solid/layout.d.ts.map +1 -1
  500. package/dist/solid/layout.jsx +5 -6
  501. package/dist/solid/layout.jsx.map +1 -1
  502. package/dist/solid/lazy-batch-gestures.d.ts +2 -2
  503. package/dist/solid/lazy-batch-gestures.d.ts.map +1 -1
  504. package/dist/solid/lazy-batch-gestures.js.map +1 -1
  505. package/dist/solid/live-scroll.d.ts +4 -0
  506. package/dist/solid/live-scroll.d.ts.map +1 -1
  507. package/dist/solid/live-scroll.jsx +29 -19
  508. package/dist/solid/live-scroll.jsx.map +1 -1
  509. package/dist/solid/live-style.d.ts +1 -147
  510. package/dist/solid/live-style.d.ts.map +1 -1
  511. package/dist/solid/live-style.js +3 -304
  512. package/dist/solid/live-style.js.map +1 -1
  513. package/dist/solid/live-value.d.ts +1 -0
  514. package/dist/solid/live-value.d.ts.map +1 -1
  515. package/dist/solid/live-value.jsx +12 -3
  516. package/dist/solid/live-value.jsx.map +1 -1
  517. package/dist/solid/member-hold.d.ts +1 -46
  518. package/dist/solid/member-hold.d.ts.map +1 -1
  519. package/dist/solid/member-hold.js +3 -188
  520. package/dist/solid/member-hold.js.map +1 -1
  521. package/dist/solid/messages.d.ts +20 -0
  522. package/dist/solid/messages.d.ts.map +1 -0
  523. package/dist/solid/messages.js +22 -0
  524. package/dist/solid/messages.js.map +1 -0
  525. package/dist/solid/owner-scope.d.ts +1 -15
  526. package/dist/solid/owner-scope.d.ts.map +1 -1
  527. package/dist/solid/owner-scope.js +3 -30
  528. package/dist/solid/owner-scope.js.map +1 -1
  529. package/dist/solid/presence-controller.d.ts +1 -121
  530. package/dist/solid/presence-controller.d.ts.map +1 -1
  531. package/dist/solid/presence-controller.js +3 -1335
  532. package/dist/solid/presence-controller.js.map +1 -1
  533. package/dist/solid/presence-record.d.ts +6 -168
  534. package/dist/solid/presence-record.d.ts.map +1 -1
  535. package/dist/solid/presence-record.js +9 -23
  536. package/dist/solid/presence-record.js.map +1 -1
  537. package/dist/solid/presence.d.ts +3 -1
  538. package/dist/solid/presence.d.ts.map +1 -1
  539. package/dist/solid/presence.jsx.map +1 -1
  540. package/dist/solid/press.d.ts +1 -23
  541. package/dist/solid/press.d.ts.map +1 -1
  542. package/dist/solid/press.js +3 -18
  543. package/dist/solid/press.js.map +1 -1
  544. package/dist/solid/provider.d.ts +24 -4
  545. package/dist/solid/provider.d.ts.map +1 -1
  546. package/dist/solid/provider.jsx +63 -7
  547. package/dist/solid/provider.jsx.map +1 -1
  548. package/dist/solid/reactivity.d.ts +1 -20
  549. package/dist/solid/reactivity.d.ts.map +1 -1
  550. package/dist/solid/reactivity.js +0 -7
  551. package/dist/solid/reactivity.js.map +1 -1
  552. package/dist/solid/reorder.d.ts +5 -4
  553. package/dist/solid/reorder.d.ts.map +1 -1
  554. package/dist/solid/reorder.jsx.map +1 -1
  555. package/dist/solid/retarget-legs.d.ts +1 -188
  556. package/dist/solid/retarget-legs.d.ts.map +1 -1
  557. package/dist/solid/retarget-legs.js +3 -825
  558. package/dist/solid/retarget-legs.js.map +1 -1
  559. package/dist/solid/runtime.d.ts +15 -27
  560. package/dist/solid/runtime.d.ts.map +1 -1
  561. package/dist/solid/runtime.js +52 -23
  562. package/dist/solid/runtime.js.map +1 -1
  563. package/dist/solid/scroll-values.d.ts +30 -0
  564. package/dist/solid/scroll-values.d.ts.map +1 -0
  565. package/dist/solid/scroll-values.js +44 -0
  566. package/dist/solid/scroll-values.js.map +1 -0
  567. package/dist/solid/server-interpolators.d.ts +1 -12
  568. package/dist/solid/server-interpolators.d.ts.map +1 -1
  569. package/dist/solid/server-interpolators.js +3 -19
  570. package/dist/solid/server-interpolators.js.map +1 -1
  571. package/dist/solid/spans-check.d.ts +4 -0
  572. package/dist/solid/spans-check.d.ts.map +1 -0
  573. package/dist/solid/spans-check.js +23 -0
  574. package/dist/solid/spans-check.js.map +1 -0
  575. package/dist/solid/spine.d.ts +1 -612
  576. package/dist/solid/spine.d.ts.map +1 -1
  577. package/dist/solid/spine.js +3 -2886
  578. package/dist/solid/spine.js.map +1 -1
  579. package/dist/solid/timelines.d.ts +2 -0
  580. package/dist/solid/timelines.d.ts.map +1 -0
  581. package/dist/solid/timelines.js +4 -0
  582. package/dist/solid/timelines.js.map +1 -0
  583. package/dist/solid/unstable/v2/batch-reorder-group.d.ts +18 -17
  584. package/dist/solid/unstable/v2/batch-reorder-group.d.ts.map +1 -1
  585. package/dist/solid/unstable/v2/batch-reorder-group.jsx +32 -5
  586. package/dist/solid/unstable/v2/batch-reorder-group.jsx.map +1 -1
  587. package/dist/solid/unstable/v2/create-animate.d.ts.map +1 -1
  588. package/dist/solid/unstable/v2/create-animate.jsx +3 -1
  589. package/dist/solid/unstable/v2/create-animate.jsx.map +1 -1
  590. package/dist/solid/unstable/v2/create-batch.jsx +2 -2
  591. package/dist/solid/unstable/v2/create-batch.jsx.map +1 -1
  592. package/dist/solid/unstable/v2/create-wardic.d.ts +25 -0
  593. package/dist/solid/unstable/v2/create-wardic.d.ts.map +1 -0
  594. package/dist/solid/unstable/v2/create-wardic.jsx +43 -0
  595. package/dist/solid/unstable/v2/create-wardic.jsx.map +1 -0
  596. package/dist/solid/unstable/v2/element.d.ts +53 -18
  597. package/dist/solid/unstable/v2/element.d.ts.map +1 -1
  598. package/dist/solid/unstable/v2/element.jsx +13 -4
  599. package/dist/solid/unstable/v2/element.jsx.map +1 -1
  600. package/dist/solid/unstable/v2/index.d.ts +3 -1
  601. package/dist/solid/unstable/v2/index.d.ts.map +1 -1
  602. package/dist/solid/unstable/v2/index.jsx +1 -0
  603. package/dist/solid/unstable/v2/index.jsx.map +1 -1
  604. package/dist/solid/unstable/v2/lifecycle.d.ts +29 -0
  605. package/dist/solid/unstable/v2/lifecycle.d.ts.map +1 -1
  606. package/dist/solid/unstable/v2/lifecycle.js +2 -0
  607. package/dist/solid/unstable/v2/lifecycle.js.map +1 -1
  608. package/dist/solid/unstable/v2/live-scroll.d.ts +4 -0
  609. package/dist/solid/unstable/v2/live-scroll.d.ts.map +1 -1
  610. package/dist/solid/unstable/v2/live-scroll.jsx +22 -11
  611. package/dist/solid/unstable/v2/live-scroll.jsx.map +1 -1
  612. package/dist/solid/unstable/v2/live-value.d.ts +1 -0
  613. package/dist/solid/unstable/v2/live-value.d.ts.map +1 -1
  614. package/dist/solid/unstable/v2/live-value.jsx +10 -1
  615. package/dist/solid/unstable/v2/live-value.jsx.map +1 -1
  616. package/dist/solid/unstable/v2/presence.d.ts +3 -1
  617. package/dist/solid/unstable/v2/presence.d.ts.map +1 -1
  618. package/dist/solid/unstable/v2/presence.jsx.map +1 -1
  619. package/dist/solid/unstable/v2/provider.d.ts +24 -4
  620. package/dist/solid/unstable/v2/provider.d.ts.map +1 -1
  621. package/dist/solid/unstable/v2/provider.jsx +66 -10
  622. package/dist/solid/unstable/v2/provider.jsx.map +1 -1
  623. package/dist/solid/unstable/v2/reorder.d.ts +4 -3
  624. package/dist/solid/unstable/v2/reorder.d.ts.map +1 -1
  625. package/dist/solid/unstable/v2/reorder.jsx.map +1 -1
  626. package/dist/solid/unstable/v2/w.d.ts +42 -10
  627. package/dist/solid/unstable/v2/w.d.ts.map +1 -1
  628. package/dist/solid/unstable/v2/w.jsx +5 -7
  629. package/dist/solid/unstable/v2/w.jsx.map +1 -1
  630. package/dist/solid/unstable/v2/ward.d.ts +17 -9
  631. package/dist/solid/unstable/v2/ward.d.ts.map +1 -1
  632. package/dist/solid/unstable/v2/ward.jsx +40 -10
  633. package/dist/solid/unstable/v2/ward.jsx.map +1 -1
  634. package/dist/solid/unstable/v2/wardic-instance.d.ts +47 -0
  635. package/dist/solid/unstable/v2/wardic-instance.d.ts.map +1 -0
  636. package/dist/solid/unstable/v2/wardic-instance.js +2 -0
  637. package/dist/solid/unstable/v2/wardic-instance.js.map +1 -0
  638. package/dist/solid/variant-target.d.ts +1 -103
  639. package/dist/solid/variant-target.d.ts.map +1 -1
  640. package/dist/solid/variant-target.js +3 -181
  641. package/dist/solid/variant-target.js.map +1 -1
  642. package/dist/solid/variant-tree.d.ts +1 -348
  643. package/dist/solid/variant-tree.d.ts.map +1 -1
  644. package/dist/solid/variant-tree.js +3 -357
  645. package/dist/solid/variant-tree.js.map +1 -1
  646. package/dist/solid/w.d.ts +25 -10
  647. package/dist/solid/w.d.ts.map +1 -1
  648. package/dist/solid/w.jsx +8 -7
  649. package/dist/solid/w.jsx.map +1 -1
  650. package/dist/solid/ward-keys.d.ts +22 -3
  651. package/dist/solid/ward-keys.d.ts.map +1 -1
  652. package/dist/solid/wardic-config-value.d.ts +1 -86
  653. package/dist/solid/wardic-config-value.d.ts.map +1 -1
  654. package/dist/solid/wardic-config-value.js +3 -105
  655. package/dist/solid/wardic-config-value.js.map +1 -1
  656. package/dist/solid/wardic-instance.d.ts +46 -0
  657. package/dist/solid/wardic-instance.d.ts.map +1 -0
  658. package/dist/solid/wardic-instance.js +2 -0
  659. package/dist/solid/wardic-instance.js.map +1 -0
  660. package/package.json +4 -4
  661. package/src/animation-controls.ts +3 -206
  662. package/src/appear.ts +3 -824
  663. package/src/batch-gestures.ts +2 -2
  664. package/src/batch-reorder-group.tsx +47 -21
  665. package/src/batch-reorder-places.ts +566 -54
  666. package/src/batch-reorder.ts +333 -40
  667. package/src/batch.ts +3 -3078
  668. package/src/config.ts +5 -804
  669. package/src/create-animate.tsx +3 -1
  670. package/src/create-batch.tsx +2 -2
  671. package/src/create-ward.tsx +55 -50
  672. package/src/create-wardic.tsx +45 -0
  673. package/src/drag-constraints.ts +3 -103
  674. package/src/drag-controls.ts +3 -94
  675. package/src/drag-defaults.ts +3 -0
  676. package/src/drag-track.ts +3 -955
  677. package/src/drag-transition.ts +3 -43
  678. package/src/element-setup.ts +3 -0
  679. package/src/element.tsx +53 -16
  680. package/src/feature.ts +3 -359
  681. package/src/features/all.ts +3 -18
  682. package/src/features/colors.ts +3 -36
  683. package/src/features/dom-animation.ts +3 -15
  684. package/src/features/dom-max.ts +3 -11
  685. package/src/features/drag.ts +3 -30
  686. package/src/features/focus.ts +3 -17
  687. package/src/features/hover.ts +3 -17
  688. package/src/features/in-view.ts +3 -17
  689. package/src/features/input.ts +3 -34
  690. package/src/features/keys.ts +3 -89
  691. package/src/features/layout.ts +3 -54
  692. package/src/features/pan.ts +3 -17
  693. package/src/features/press.ts +3 -17
  694. package/src/features/scroll.ts +3 -21
  695. package/src/gesture-features.ts +3 -35
  696. package/src/gesture-info.ts +3 -81
  697. package/src/imperative.ts +3 -894
  698. package/src/index.tsx +6 -1
  699. package/src/instance-features.ts +88 -0
  700. package/src/instant.ts +3 -90
  701. package/src/layout-group.ts +3 -32
  702. package/src/layout-member.ts +3 -319
  703. package/src/layout-projection.tsx +10 -1
  704. package/src/layout.tsx +7 -6
  705. package/src/lazy-batch-gestures.ts +3 -3
  706. package/src/live-scroll.tsx +30 -22
  707. package/src/live-style.ts +3 -450
  708. package/src/live-value.tsx +12 -2
  709. package/src/member-hold.ts +3 -222
  710. package/src/messages.ts +27 -0
  711. package/src/owner-scope.ts +3 -31
  712. package/src/presence-controller.ts +3 -1616
  713. package/src/presence-record.ts +8 -192
  714. package/src/presence.tsx +3 -1
  715. package/src/press.ts +3 -40
  716. package/src/provider.tsx +72 -7
  717. package/src/reactivity.ts +3 -23
  718. package/src/reorder.tsx +5 -4
  719. package/src/retarget-legs.ts +3 -1049
  720. package/src/runtime.ts +62 -43
  721. package/src/scroll-values.ts +53 -0
  722. package/src/server-interpolators.ts +3 -33
  723. package/src/spans-check.ts +25 -0
  724. package/src/spine.ts +3 -3508
  725. package/src/timelines.ts +3 -0
  726. package/src/unstable/v2/batch-reorder-group.tsx +42 -18
  727. package/src/unstable/v2/create-animate.tsx +3 -1
  728. package/src/unstable/v2/create-batch.tsx +2 -2
  729. package/src/unstable/v2/create-wardic.tsx +46 -0
  730. package/src/unstable/v2/element.tsx +86 -24
  731. package/src/unstable/v2/index.tsx +5 -0
  732. package/src/unstable/v2/lifecycle.ts +35 -0
  733. package/src/unstable/v2/live-scroll.tsx +22 -11
  734. package/src/unstable/v2/live-value.tsx +10 -0
  735. package/src/unstable/v2/presence.tsx +3 -1
  736. package/src/unstable/v2/provider.tsx +75 -9
  737. package/src/unstable/v2/reorder.tsx +9 -4
  738. package/src/unstable/v2/w.tsx +50 -13
  739. package/src/unstable/v2/ward.tsx +61 -51
  740. package/src/unstable/v2/wardic-instance.ts +50 -0
  741. package/src/variant-target.ts +3 -240
  742. package/src/variant-tree.ts +3 -638
  743. package/src/w.tsx +34 -16
  744. package/src/ward-keys.ts +38 -17
  745. package/src/wardic-config-value.ts +3 -150
  746. package/src/wardic-instance.ts +49 -0
  747. package/dist/browser/batch-handoff.js +0 -72
  748. package/dist/browser/batch-handoff.js.map +0 -1
  749. package/dist/browser/frame-time.js +0 -40
  750. package/dist/browser/frame-time.js.map +0 -1
  751. package/dist/server/batch-handoff.js +0 -72
  752. package/dist/server/batch-handoff.js.map +0 -1
  753. package/dist/server/frame-time.js +0 -40
  754. package/dist/server/frame-time.js.map +0 -1
  755. package/dist/solid/batch-handoff.d.ts +0 -25
  756. package/dist/solid/batch-handoff.d.ts.map +0 -1
  757. package/dist/solid/batch-handoff.js +0 -75
  758. package/dist/solid/batch-handoff.js.map +0 -1
  759. package/dist/solid/frame-time.d.ts +0 -21
  760. package/dist/solid/frame-time.d.ts.map +0 -1
  761. package/dist/solid/frame-time.js +0 -41
  762. package/dist/solid/frame-time.js.map +0 -1
  763. package/src/batch-handoff.ts +0 -87
  764. package/src/frame-time.ts +0 -45
package/src/appear.ts CHANGED
@@ -1,824 +1,3 @@
1
- /**
2
- * Appear animations in the Solid binding (#48, ADR-0044): a server-rendered mount animation played
3
- * in CSS from first paint, and taken over at mount (the **Handoff**).
4
- *
5
- * - **Both sides** describe an element's mount animation the same way ({@link MountAnimation}): its
6
- * starting values, its targets, its own transition and whether motion is reduced. The rule's name
7
- * is the hash of that description ({@link keyOf}), so the client tells a Handoff it can continue
8
- * from one it can't.
9
- * - **On a server** the provider holds one render's {@link ServerAppear}. Each element that
10
- * qualifies takes a slot (its inline `animation: var(--wardic-aN)`); a Variant child joins its
11
- * parent's group, in render order. Once the render is done, `css()` works out each one's timing
12
- * (its stagger, its `when`) and writes the head's `<style>`.
13
- * - **At mount** the spine finds the element's animation ({@link handoffOf}), starts its first legs
14
- * that far in, and removes it in its first commit.
15
- */
16
- import type * as DefaultTransition from "@wardic/core/DefaultTransition"
17
- import * as Easing from "@wardic/core/Easing"
18
- import type * as Frame from "@wardic/core/Frame"
19
- import * as Machine from "@wardic/core/Machine"
20
- import type * as InterpolatorRegistry from "@wardic/core/InterpolatorRegistry"
21
- import type * as ReducedMotion from "@wardic/core/ReducedMotion"
22
- import type * as Values from "@wardic/core/Values"
23
- import * as Appear from "@wardic/dom/Appear"
24
- import type * as DomRenderer from "@wardic/dom/DomRenderer"
25
- import * as DomDefaultTransition from "@wardic/dom/DomDefaultTransition"
26
- import * as DomPositionalKeys from "@wardic/dom/DomPositionalKeys"
27
- import * as OwnValues from "@wardic/dom/OwnValues"
28
- import * as Arr from "effect/Array"
29
- import * as Bool from "effect/Boolean"
30
- import * as Effect from "effect/Effect"
31
- import { identity } from "effect/Function"
32
- import * as Match from "effect/Match"
33
- import * as Option from "effect/Option"
34
- import * as Order from "effect/Order"
35
- import * as Predicate from "effect/Predicate"
36
- import * as Rec from "effect/Record"
37
- import * as Result from "effect/Result"
38
- import * as UndefinedOr from "effect/UndefinedOr"
39
- import type { WardicTransition } from "./config.ts"
40
- import { entriesOf, type KeyframesStart, keyframesFrom, type Leg, legsOf, NO_VELOCITY, runOf, type StopsByKey, transitionForKey } from "./retarget-legs.ts"
41
- import { withServerInterpolators } from "./server-interpolators.ts"
42
- import type { Keyframes } from "./variant-target.ts"
43
- import { childDelayOf, type WardicStaggerConfig } from "./variant-tree.ts"
44
-
45
- // --- The mount animation, on both sides -------------------------------------------------------
46
-
47
- /** An element's mount animation, described the same on the server and the client. */
48
- export interface MountAnimation {
49
- /** The element's tag, for SVG's routing; `undefined` for an element whose tag isn't known. */
50
- readonly tag: string | undefined
51
- /** Each animated key's start. */
52
- readonly from: Values.Values
53
- /** Each animated key's target. */
54
- readonly to: Values.Values
55
- /** The element's own transition: its stagger isn't in it (ADR-0007). */
56
- readonly transition: WardicTransition | undefined
57
- /** Whether reduced motion is on for it (ADR-0029). */
58
- readonly reduced: boolean
59
- /**
60
- * Whether it's a layout node (#245): drawn through its projection at rest, as the client draws
61
- * it, its own translate on top (#363). Part of its rule's name (`Appear.Spec.projected`).
62
- */
63
- readonly layout: boolean
64
- /** Each key's Keyframes of more than two stops (#429), `from` at their first: part of its key. Left out with none. */
65
- readonly stops?: StopsByKey | undefined
66
- /**
67
- * Whether it's a **Skipped animation** (#468): every key lands on its first frame, so its rule is
68
- * 0 s, holding its end from first paint. Part of its key; left out when it isn't.
69
- */
70
- readonly skipped?: boolean | undefined
71
- /** Its **Transform template** (#443): its stops drawn through it, as the client draws them. Left out with none. */
72
- readonly template?: DomRenderer.TransformTemplate | undefined
73
- }
74
-
75
- /** What stands in for a function with no easing name: canonical text holding it is no key. */
76
- const UNNAMED = "\u0000unnamed"
77
-
78
- /**
79
- * A value as canonical text: JSON with each object's keys in order, `undefined`s left out, and a
80
- * function by its easing name (`Easing.nameOf`), else {@link UNNAMED}. Written directly, its cases
81
- * built once at module load: it runs per element (#69's PR 2).
82
- */
83
- const textOf: (value: unknown) => string = /*#__PURE__*/ Match.type<unknown>().pipe(
84
- Match.when(Predicate.isFunction, (fn) => Option.match(Easing.nameOf(fn as Easing.Easing), { onNone: () => UNNAMED, onSome: (easing) => `{"easing":${JSON.stringify(easing)}}` })),
85
- Match.when(Arr.isArray, (items) => `[${Arr.map(items as ReadonlyArray<unknown>, (item) => textOf(item)).join(",")}]`),
86
- Match.when(Predicate.isObject, (record) => {
87
- const keys = Arr.sort(Arr.filter(Object.keys(record), (key) => Predicate.isNotUndefined((record as Record<string, unknown>)[key])), Order.String)
88
- return `{${Arr.map(keys, (key) => `${JSON.stringify(key)}:${textOf((record as Record<string, unknown>)[key])}`).join(",")}}`
89
- }),
90
- Match.orElse((v) => String(JSON.stringify(v))),
91
- )
92
-
93
- /** Where a Path's key samples it (#438): nine points, its ends among them. */
94
- const PATH_SAMPLES = [0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1] as const
95
-
96
- /** An axis's number in `values`, its identity 0 when it has none (#438), as the leg reads it on a server. */
97
- const axisIn = (values: Values.Values, key: "x" | "y"): number => UndefinedOr.match(values[key], { onUndefined: () => 0, onDefined: (v) => Number(v) })
98
-
99
- /**
100
- * A mount animation's transition as its key holds it: a Path (#438), a function, as its samples
101
- * between the mount's ends, so two paths key apart and one path keys the same each time. Sampling it
102
- * again is safe: an arc's memory of its side changes only with the way it travels.
103
- */
104
- const keyedTransitionOf = (m: MountAnimation): unknown =>
105
- UndefinedOr.match(m.transition, {
106
- onUndefined: () => null,
107
- onDefined: (t: WardicTransition) =>
108
- UndefinedOr.match(t.path, {
109
- onUndefined: () => t,
110
- onDefined: (path) => {
111
- const from = { x: axisIn(m.from, "x"), y: axisIn(m.from, "y") }
112
- const at = path(from, { x: UndefinedOr.match(m.to.x, { onUndefined: () => from.x, onDefined: Number }), y: UndefinedOr.match(m.to.y, { onUndefined: () => from.y, onDefined: Number }) })
113
- return { ...t, path: Arr.map(PATH_SAMPLES, (p) => at(p)) }
114
- },
115
- }),
116
- })
117
-
118
- /** A value as canonical text; `None` when a function in it has no easing name. */
119
- const canonical = (value: unknown): Option.Option<string> => Option.filter(Option.some(textOf(value)), (text) => Bool.not(text.includes(UNNAMED)))
120
-
121
- /** Each mount animation's canonical starts, targets and transition, by its `from`: both its plays share one. */
122
- // Module state (#460, Q7): a cache held weakly by the object it's for, so it goes with it.
123
- const baseKeys = /*#__PURE__*/ new WeakMap<Values.Values, Option.Option<string>>()
124
-
125
- /**
126
- * The mount animation's key: its starts, targets and transition as one canonical text, and whether
127
- * motion is reduced. `None` when the transition holds a function with no easing name
128
- * (`Easing.nameOf`): the server can't tell it from another, so the element keeps its Starting style.
129
- */
130
- export const keyOf = (m: MountAnimation): Option.Option<string> => {
131
- const base = Option.getOrElse(Option.fromUndefinedOr(baseKeys.get(m.from)), () => {
132
- const computed = canonical({ from: m.from, to: m.to, transition: keyedTransitionOf(m), stops: m.stops })
133
- baseKeys.set(m.from, computed)
134
- return computed
135
- })
136
- // A skipped one's (#468) named apart: an unskipped one's name is as it was.
137
- return Option.map(base, (text) => Bool.match(m.skipped === true, { onTrue: () => `${text}|skipped`, onFalse: () => `${text}|reduced:${m.reduced}` }))
138
- }
139
-
140
- /**
141
- * A Batch's entrance's key (#706, Q9): its keys and each one's transition as a member's change runs them,
142
- * as canonical text, and whether motion is reduced, or the change is skipped (#468). The server's rule
143
- * group's, and what a client checks a member's Appear animation against. `None` when a transition holds
144
- * a function with no easing name: the Batch waits for the JavaScript (Q4).
145
- */
146
- export const batchKeyOf = (keys: ReadonlyArray<string>, transitions: ReadonlyArray<unknown>, reduced: boolean, skipped: boolean): Option.Option<string> =>
147
- Option.map(canonical({ keys, transitions }), (text) => Bool.match(skipped, { onTrue: () => `${text}|skipped`, onFalse: () => `${text}|reduced:${reduced}` }))
148
-
149
- /** Whether a mount animation plays for ever: its transition repeats for ever, and it isn't skipped (#468), which lands it. */
150
- const playsForever = (m: MountAnimation): boolean => Bool.and(m.skipped !== true, repeatsForever(m.transition))
151
-
152
- /** Whether a transition repeats for ever: a tween's `repeat: Infinity`, a tween as it runs (ADR-0051). */
153
- export const repeatsForever = (transition: WardicTransition | undefined): boolean =>
154
- UndefinedOr.match(runOf(transition), { onUndefined: () => false, onDefined: (run) => Bool.and(run.type === "tween", (run as Machine.AnimateOptions).repeat === Number.POSITIVE_INFINITY) })
155
-
156
- /** A transition's own delay, 0 without one. */
157
- const ownDelayOf = (transition: WardicTransition | undefined): number =>
158
- UndefinedOr.match(transition, { onUndefined: () => 0, onDefined: ({ delay = 0 }) => delay })
159
-
160
- /**
161
- * The seconds a rule holds before it moves, of the delay the client counts: a transition's own
162
- * delay is in its rule, except a forever-repeating one's, whose rule is a cycle and whose own delay
163
- * goes in `animation-delay` with the stagger.
164
- */
165
- const heldInRule = (transition: WardicTransition | undefined): number =>
166
- Bool.match(repeatsForever(transition), { onTrue: () => 0, onFalse: () => ownDelayOf(transition) })
167
-
168
- /**
169
- * The transition a server samples: as given, but for one that repeats for ever, two runs and the
170
- * delay that follows them, with no delay before (one cycle of the CSS, played `infinite`). Two
171
- * runs, so a cycle is exact for every `repeatType`, `reverse` and `mirror` included.
172
- */
173
- const sampledTransition = (transition: WardicTransition | undefined): WardicTransition | undefined =>
174
- Bool.match(repeatsForever(transition), {
175
- onTrue: () => ({ ...transition, delay: 0, repeat: 1 }) as WardicTransition,
176
- onFalse: () => transition,
177
- })
178
-
179
- /**
180
- * One machine of a Retarget's legs, run together: each step steps every leg not yet settled, and
181
- * merges their values; it settles with the last. What a server samples. Built with the DOM's
182
- * Interpolators (a server projects with the DOM's `project`, ADR-0021 decision 2).
183
- */
184
- const together = (legs: ReadonlyArray<Leg>): Machine.Machine<Frame.Frame<Values.Values>> => {
185
- const machines = Effect.runSync(
186
- withServerInterpolators(Effect.all(Arr.map(legs, (leg): Effect.Effect<Machine.Machine<Frame.Frame<unknown>>, never, InterpolatorRegistry.InterpolatorRegistry> => machineOfLeg(leg)))),
187
- )
188
- return Machine.make({
189
- settles: true,
190
- span: { name: "wardic.appear", attributes: { legs: legs.length } },
191
- start: () => {
192
- const runs = Arr.map(machines, (machine, i) => ({ step: machine.start(), key: keyOfLeg(legs[i] as Leg), last: Option.none<Frame.Frame<unknown>>() }))
193
- return (dt) => {
194
- const value: Record<string, number | string> = {}
195
- const done = Arr.reduce(runs, true, (all, run) => {
196
- const frame = Option.getOrElse(Option.filter(run.last, (last) => last.done), () => run.step(dt))
197
- run.last = Option.some(frame)
198
- Option.match(run.key, {
199
- onNone: () => Object.assign(value, frame.value as Values.Values),
200
- onSome: (key) => Object.assign(value, { [key]: frame.value as number }),
201
- })
202
- return Bool.and(all, frame.done)
203
- })
204
- return { value, done }
205
- }
206
- },
207
- })
208
- }
209
-
210
- /** A leg's machine, built: a Blend's through the Interpolators `together` provides. */
211
- const machineOfLeg = (leg: Leg): Effect.Effect<Machine.Machine<Frame.Frame<unknown>>, never, InterpolatorRegistry.InterpolatorRegistry> =>
212
- Bool.match(leg._tag === "Blend", {
213
- onTrue: () => (leg as Extract<Leg, { _tag: "Blend" }>).machine(),
214
- onFalse: () => Effect.sync(() => (leg as Exclude<Leg, { _tag: "Blend" }>).machine() as Machine.Machine<Frame.Frame<unknown>>),
215
- })
216
-
217
- /** The key a Follow leg's single value is: its own. */
218
- const keyOfLeg = (leg: Leg): Option.Option<string> =>
219
- Bool.match(leg._tag === "Follow", { onTrue: () => Option.some((leg as Extract<Leg, { _tag: "Follow" }>).key), onFalse: () => Option.none() })
220
-
221
- /** The DOM's Positional keys, which a server's reduced rule snaps (ADR-0029, ADR-0036). */
222
- const DOM_POSITIONAL: ReducedMotion.PositionalKeys["Service"] = { isPositional: DomPositionalKeys.isPositional }
223
-
224
- /** The DOM's Default transition, which a key with no transition defined samples as the client runs it (ADR-0051). */
225
- const DOM_DEFAULTS: DefaultTransition.DefaultTransition["Service"] = { transitionFor: DomDefaultTransition.transitionFor, keyframes: DomDefaultTransition.keyframes }
226
-
227
- /**
228
- * Whether a value's own transition drives one of its keys while anything repeats for ever (#301): one
229
- * CSS cycle can't hold a key that stops beside one that repeats, nor two cycles' lengths. With every
230
- * key on the transition's own fields (a `layout` entry alone), it plays as before.
231
- */
232
- const foreverByValue = (m: MountAnimation): boolean => {
233
- const entries = entriesOf(m.transition)
234
- if (Predicate.isUndefined(entries)) return false
235
- const runsOn = Arr.map(Rec.keys(m.to), (key) => transitionForKey(m.transition, key))
236
- if (Arr.every(runsOn, (transition) => transition === entries.own)) return false
237
- return Bool.or(repeatsForever(m.transition), Arr.some(runsOn, repeatsForever))
238
- }
239
-
240
- /** A mount animation's spec for the DOM's sampler, or why it has none. */
241
- export const specOf = (m: MountAnimation): Result.Result<Appear.Spec, string> =>
242
- Option.match(keyOf(m), {
243
- onNone: () => Result.fail("its transition holds a function with no easing name"),
244
- onSome: (key) => {
245
- const skipped = m.skipped === true
246
- if (Bool.and(Bool.not(skipped), foreverByValue(m))) return Result.fail("a value's own transition repeats for ever beside another")
247
- const forever = playsForever(m)
248
- const transition = Bool.match(skipped, { onTrue: () => m.transition, onFalse: () => sampledTransition(m.transition) })
249
- const repeatDelay = UndefinedOr.match(m.transition, { onUndefined: () => 0, onDefined: (t) => Option.getOrElse(Option.fromUndefinedOr((t as Machine.AnimateOptions).repeatDelay), () => 0) })
250
- return Result.succeed({
251
- key,
252
- tag: m.tag,
253
- infinite: forever,
254
- projected: m.layout,
255
- template: m.template,
256
- // Skipped (#468): every key's snap, landing on its first frame, a rule of 0 s.
257
- machine: () =>
258
- Bool.match(forever, {
259
- onTrue: () => Machine.holdAfter(together(legsOf(m.from, m.to, transition, m.reduced, skipped, DOM_POSITIONAL, DOM_DEFAULTS, NO_VELOCITY, undefined, m.stops)), repeatDelay),
260
- onFalse: () => together(legsOf(m.from, m.to, transition, m.reduced, skipped, DOM_POSITIONAL, DOM_DEFAULTS, NO_VELOCITY, undefined, m.stops)),
261
- }),
262
- })
263
- },
264
- })
265
-
266
- /**
267
- * Why a mount animation can't play before hydration, or `None` when it can (decision 4): a key
268
- * starting from anything but `initial`, a value the DOM reads from the element (`auto`, `var()`),
269
- * or a start that can't take its target's shape (a length pair in two units).
270
- */
271
- export const unplayable = (initial: Values.Values, to: Values.Values): Option.Option<string> =>
272
- Arr.findFirst(Rec.toEntries(to), ([key, target]) =>
273
- Option.match(Option.fromUndefinedOr(initial[key]), {
274
- onNone: () => Option.some(`${key} starts from the element's own value (no initial)`),
275
- onSome: (start) =>
276
- Bool.match(Bool.or(readsElement(start), readsElement(target)), {
277
- onTrue: () => Option.some(`${key} is a value the DOM reads from the element`),
278
- onFalse: () =>
279
- // A start that can't take its target's shape, a length in another unit among them (ADR-0024).
280
- Bool.match(Option.isNone(OwnValues.valueLike(start, target)), {
281
- onTrue: () => Option.some(`${key}'s start and target don't take one shape`),
282
- onFalse: () => Option.none(),
283
- }),
284
- }),
285
- }))
286
-
287
- /** Whether a value is one the DOM reads from the element: `auto`, or a custom property. */
288
- const readsElement = (value: number | string): boolean => Predicate.isString(value) && /\bauto\b|var\(/.test(value)
289
-
290
- /** Whether an `initial` value, coerced to its target's shape, is that target: its key starts no leg (#448). */
291
- const atTarget = (start: number | string | undefined, target: number | string): boolean =>
292
- Option.exists(OwnValues.valueLike(start, target), (like) => like === target)
293
-
294
- // --- The server --------------------------------------------------------------------------------
295
-
296
- /** A variant parent's orchestration, on a server: its children in render order, its stagger and `when`. */
297
- export interface AppearGroup {
298
- readonly leader: Entry
299
- readonly stagger: WardicStaggerConfig
300
- readonly when: "beforeChildren" | "afterChildren" | undefined
301
- readonly children: Array<Entry>
302
- }
303
-
304
- /** One element's place in a server render's Appear animations. */
305
- export interface Entry {
306
- /** Its mount animation per motion setting, or why it has none; `None` when nothing animates. */
307
- readonly plays: { readonly normal: Option.Option<Result.Result<MountAnimation, string>>; readonly reduced: Option.Option<Result.Result<MountAnimation, string>> }
308
- readonly slot: Option.Option<Appear.Slot>
309
- /** The group it staggers in, as a Variant child. */
310
- readonly group: Option.Option<AppearGroup>
311
- /** Why it was ruled out after it rendered: its user style, read when `ward()` is called (ADR-0044, decision 4). */
312
- readonly vetoes: Array<string>
313
- /**
314
- * Whether it follows the user's preference (`"user"`, #434): its reduced play goes under the head's
315
- * media query. With `"always"` or `"never"` its plays are already that setting's.
316
- */
317
- readonly user: boolean
318
- /** Whether it's skipped (#468): its rule lands on first paint, and its own stagger holds it back no more than its client does. */
319
- readonly skipped: boolean
320
- /** Its tag, and the keys its mount animates: what names it when the provider explains (#585). */
321
- readonly tag: string | undefined
322
- readonly to: Option.Option<Values.Values>
323
- }
324
-
325
- /** One server render's Appear animations: the provider's (ADR-0044, decisions 3 and 5). */
326
- export interface ServerAppear {
327
- /** The provider's reduced motion: an element's, unless its nearest `WardicConfig` sets its own (#434). */
328
- readonly reducedMotion: ReducedMotion.Config
329
- /**
330
- * An element's entry, and its inline `animation` when it plays: its plays as its reduced motion has
331
- * them, `setting` (its nearest `WardicConfig`'s, #434) else the provider's. A skipped one's (#468)
332
- * are one play in both slots, whatever its reduced motion.
333
- */
334
- readonly enter: (
335
- animation: { readonly normal: Option.Option<Result.Result<MountAnimation, string>>; readonly reduced: Option.Option<Result.Result<MountAnimation, string>> },
336
- group: Option.Option<AppearGroup>,
337
- setting: ReducedMotion.Config | undefined,
338
- skipped: boolean,
339
- /** Its tag and its targets at mount, which name it when the provider explains (#585). */
340
- tag: string | undefined,
341
- to: Option.Option<Values.Values>,
342
- ) => {
343
- readonly entry: Entry
344
- readonly animation: Option.Option<string>
345
- /**
346
- * Entered after the shell was flushed, so in a chunk a stream sends later (#245), and no late
347
- * element around it: the chunk's root, which puts the chunk's `<style>` after itself.
348
- */
349
- readonly chunkRoot: boolean
350
- readonly late: boolean
351
- }
352
- /** A variant parent's group, its children to come. */
353
- readonly group: (leader: Entry, transition: WardicTransition | undefined) => AppearGroup
354
- /**
355
- * The head's CSS, once the shell is done: every element entered so far, its timing worked out,
356
- * and the rules. Called once, by the provider's `useAssets`: what enters after is late (#245).
357
- */
358
- readonly css: () => string
359
- /** Render a late element's subtree: an element inside it isn't a chunk's root (#245). */
360
- readonly within: <A>(late: boolean, render: () => A) => A
361
- /**
362
- * A late chunk's CSS (#245): the rules and timings of every element entered since the last
363
- * write, those the head sent left out; "" for none. The Solid 2 binding hands it to `useHead`,
364
- * which streams it with the chunk as a head patch (#209 PR 4a).
365
- */
366
- readonly chunkCss: () => string
367
- /**
368
- * A late chunk's `<style>` (#245), as server text: {@link chunkCss} in a `<style>`. The Solid 1
369
- * binding's chunk root's thunk asks for it once the chunk has rendered.
370
- */
371
- readonly chunk: () => string
372
- /** The nonce the page's Content Security Policy gives inline styles, which each `<style>` carries (#618, P1). */
373
- readonly nonce: string | undefined
374
- /**
375
- * A Batch's rule group's slot (#706): `play`'s rule, and `reduced`'s under the media query when given;
376
- * each member's style its own values, the slot and its delay. In the head's CSS, or a late chunk's.
377
- */
378
- readonly batch: (play: Appear.BatchKeyframes, reduced?: Appear.BatchKeyframes | undefined) => Appear.BatchSlot
379
- /** Says why a Batch, or one of its members, named by `name`, waits for the JavaScript, when the provider explains (#585, #706). */
380
- readonly waits: (name: string, reason: string) => void
381
- }
382
-
383
- /** No transition: no orchestration. */
384
- const NO_TRANSITION: WardicTransition = {}
385
-
386
- /** An element's reduced motion (#434): its nearest config's, else the provider's. */
387
- const settingOr = (setting: ReducedMotion.Config | undefined, provider: ReducedMotion.Config): ReducedMotion.Config => {
388
- if (Predicate.isNotUndefined(setting)) return setting
389
- return provider
390
- }
391
-
392
- /**
393
- * An element's plays under its reduced motion (#434): `"always"` plays its reduced one in both
394
- * settings, `"never"` its normal one, and `"user"` each in its own, the reduced under the media query.
395
- */
396
- const playsUnder = (plays: Entry["plays"], setting: ReducedMotion.Config): Entry["plays"] => {
397
- if (setting === "always") return { normal: plays.reduced, reduced: plays.reduced }
398
- if (setting === "never") return { normal: plays.normal, reduced: plays.normal }
399
- return plays
400
- }
401
-
402
- /** Whether an entry follows the user's preference (#434). */
403
- const isUser = (entry: Entry): boolean => entry.user
404
-
405
- /**
406
- * What a provider's `appear` explains with (#585): with `"explain"`, a Warning for each element that
407
- * waits for the JavaScript, logged as the render finds it with Effect's own logger, since a server
408
- * builds no runtime from the app's `env`; nothing otherwise.
409
- */
410
- export const explainerOf = (appear: boolean | "explain" | undefined): ((message: string) => void) | undefined => {
411
- if (appear !== "explain") return undefined
412
- return (message) => Effect.runSync(Effect.logWarning(message))
413
- }
414
-
415
- /** An element as the provider's explanation names it (#585): its tag and the keys its mount animates. */
416
- const nameOf = (entry: Entry): string => {
417
- const element = UndefinedOr.match(entry.tag, { onUndefined: () => "an element", onDefined: (tag) => `<${tag}>` })
418
- return Option.match(entry.to, { onNone: () => element, onSome: (to) => `${element} (${Rec.keys(to).join(", ")})` })
419
- }
420
-
421
- /**
422
- * A server render's Appear animations, for a provider whose reduced motion is `reducedMotion`. With
423
- * `explain` (the provider's `appear="explain"`, #585), it says why each element that doesn't play
424
- * waits for the JavaScript, as it finds out; without it, nothing is kept or said.
425
- */
426
- export const serverAppear = (reducedMotion: ReducedMotion.Config, explain?: (message: string) => void, nonce?: string): ServerAppear => {
427
- const sheet = Appear.sheet()
428
- const entries: Array<Entry> = []
429
- /** Says why what `name` names waits for the JavaScript, when the provider explains. */
430
- const waitsNamed = (name: string, reason: string): void => {
431
- if (Predicate.isNotUndefined(explain)) explain(`wardic.appear: ${name} waits for the JavaScript: ${reason}`)
432
- }
433
- /** Says why `entry` waits for the JavaScript, when the provider explains. */
434
- const waits = (entry: Entry, reason: string): void => waitsNamed(nameOf(entry), reason)
435
- // The shell is flushed once the head's CSS is asked for: what enters after is late (#245).
436
- let flushed = false
437
- // The entries written so far, and how deep the render is in late elements.
438
- let written = 0
439
- let lateDepth = 0
440
- /** The entries since the last write, now written. */
441
- const nextBatch = (): ReadonlyArray<Entry> => {
442
- const batch = entries.slice(written)
443
- written = entries.length
444
- return batch
445
- }
446
- /** A batch's timing, each slot defined, and the sheet's CSS for them (decision 5). */
447
- const write = (batch: ReadonlyArray<Entry>): string => {
448
- // Each entry's plays are its own setting's (#434): the normal ones always, the reduced ones under
449
- // the media query when an entry follows the user.
450
- const resolve = (pick: "normal" | "reduced") => timings(batch, pick)
451
- const normal = resolve("normal")
452
- const reduced = Bool.match(Arr.some(batch, isUser), { onTrue: () => Option.some(resolve("reduced")), onFalse: () => Option.none<Timings>() })
453
- const settings = Arr.prepend(Option.toArray(reduced), normal)
454
- // Most renders write no SVG geometry: no group pass.
455
- const supports = Bool.match(Arr.some(settings, (byEntry) => byEntry.geometry), {
456
- onTrue: () => groupSupports(batch, settings),
457
- onFalse: () => () => NO_SUPPORTS,
458
- })
459
- Arr.forEach(batch, (entry) =>
460
- Option.map(entry.slot, (slot) => {
461
- const play = UndefinedOr.getOrThrow(normal.get(entry))
462
- const reducedPlay = Option.map(Option.filter(reduced, () => entry.user), (byEntry) => UndefinedOr.getOrThrow(byEntry.get(entry)))
463
- const defined = Result.flatMap(play, (p) =>
464
- Option.match(reducedPlay, {
465
- onNone: () => slot.define(p, undefined, supports(entry)),
466
- onSome: (r) => Result.flatMap(r, (rp) => slot.define(p, rp, supports(entry))),
467
- }))
468
- Result.match(defined, { onFailure: (reason) => waits(entry, reason), onSuccess: () => undefined })
469
- }))
470
- return sheet.css()
471
- }
472
- const plays = (animation: Entry["plays"]): boolean =>
473
- Bool.or(Option.exists(animation.normal, Result.isSuccess), Option.exists(animation.reduced, Result.isSuccess))
474
- const chunkCss = (): string => write(nextBatch())
475
- return {
476
- reducedMotion,
477
- enter: (given, group, setting, skipped, tag, to) => {
478
- // Skipped (#468): its one play in both slots, under no media query.
479
- const own = Bool.match(skipped, { onTrue: (): ReducedMotion.Config => "never", onFalse: () => settingOr(setting, reducedMotion) })
480
- const animation = playsUnder(given, own)
481
- const slot = Option.liftPredicate(animation, plays).pipe(Option.map(() => sheet.slot()))
482
- const entry: Entry = { plays: animation, slot, group, vetoes: [], user: own === "user", skipped, tag, to }
483
- // Why it plays neither: its normal play's reason, its reduced one's when that differs (#585).
484
- if (Predicate.isNotUndefined(explain)) {
485
- const reasons = Arr.dedupe(Arr.flatMap([animation.normal, animation.reduced], (play) => Option.toArray(Option.flatMap(play, (p) => Result.getFailure(p)))))
486
- Arr.forEach(reasons, (reason) => waits(entry, reason))
487
- }
488
- entries.push(entry)
489
- Option.map(group, (g) => g.children.push(entry))
490
- return { entry, animation: Option.map(slot, (s) => s.animation), late: flushed, chunkRoot: Bool.and(flushed, lateDepth === 0) }
491
- },
492
- within: (late, render) => {
493
- // Per element on a server: a guard, no allocation.
494
- if (Bool.not(late)) return render()
495
- lateDepth++
496
- try {
497
- return render()
498
- } finally {
499
- lateDepth--
500
- }
501
- },
502
- chunkCss,
503
- chunk: () => Appear.chunkStyle(chunkCss(), nonce),
504
- nonce,
505
- batch: (play, reduced) => sheet.batch(play, reduced),
506
- waits: waitsNamed,
507
- group: (leader, transition) => {
508
- const { staggerChildren = 0, delayChildren = 0, from = "first", staggerDirection = 1, when } = UndefinedOr.match(transition, {
509
- onUndefined: () => NO_TRANSITION,
510
- onDefined: (t: WardicTransition) => t,
511
- })
512
- return { leader, stagger: { amount: staggerChildren, delayChildren, from, direction: staggerDirection }, when, children: [] }
513
- },
514
- css: () => {
515
- flushed = true
516
- return write(nextBatch())
517
- },
518
- }
519
- }
520
-
521
- /**
522
- * Each entry's play for one motion setting: its spec and its delay, or why it has none. A Variant
523
- * child starts after its stagger (`delayChildren` plus its place, ADR-0007), and after its parent
524
- * settles under `when: "beforeChildren"`; a parent under `"afterChildren"` starts once its last
525
- * child settles. A start that depends on an element with no rule has none.
526
- *
527
- * Timed a batch at a time (#245): the shell's, then each late chunk's, whose CSS starts when the
528
- * chunk lands. A late Variant child of a group led earlier is a fresh mount from then: its stagger
529
- * is among that group's children in its batch, and it doesn't wait on the leader (decision 5 of
530
- * *Amendment (#245)*). The shell's batch is every entry, so nothing changes for it.
531
- */
532
- const timings = (entries: ReadonlyArray<Entry>, pick: "normal" | "reduced"): Timings => {
533
- const memo = new Map<Entry, Result.Result<{ readonly play: TimedPlay; readonly settled: number }, string>>()
534
- let geometry = false
535
- const inBatch = new Set(entries)
536
- // Each group's children in this batch, once a group.
537
- const batchChildren = new Map<AppearGroup, ReadonlyArray<Entry>>()
538
- const childrenOf = (g: AppearGroup): ReadonlyArray<Entry> =>
539
- Option.getOrElse(Option.fromUndefinedOr(batchChildren.get(g)), () => {
540
- const children = Arr.filter(g.children, (child) => inBatch.has(child))
541
- batchChildren.set(g, children)
542
- return children
543
- })
544
- /** An entry's spec and rule, or why it has none; a missing play (nothing animates) is a rule of 0 s. */
545
- const ruleOf = (entry: Entry): Result.Result<Option.Option<{ readonly spec: Appear.Spec; readonly rule: Appear.Keyframes }>, string> =>
546
- Arr.match(entry.vetoes, {
547
- onNonEmpty: (vetoes) => Result.fail(vetoes.join("; ")),
548
- onEmpty: () => playOf(entry),
549
- })
550
- const playOf = (entry: Entry): Result.Result<Option.Option<{ readonly spec: Appear.Spec; readonly rule: Appear.Keyframes }>, string> =>
551
- Option.match(entry.plays[pick], {
552
- onNone: () => Result.succeed(Option.none()),
553
- onSome: (animation) =>
554
- Result.flatMap(Result.flatMap(animation, specOf), (spec) => Result.map(Appear.keyframes(spec), (rule) => Option.some({ spec, rule }))),
555
- })
556
- /** The seconds from first paint to when `entry` starts, and its play. */
557
- const timingOf = (entry: Entry): Result.Result<{ readonly play: TimedPlay; readonly settled: number }, string> =>
558
- Option.getOrElse(Option.fromUndefinedOr(memo.get(entry)), () => {
559
- const computed = Result.flatMap(ruleOf(entry), (rule) =>
560
- Result.map(startOf(entry), (start) => {
561
- const spec = Option.match(rule, { onNone: () => undefined, onSome: (r) => r.spec })
562
- // A forever-repeating rule is a cycle: its own delay plays before it, and it never settles.
563
- const mount = Option.match(entry.plays[pick], { onNone: () => undefined, onSome: (p) => Result.match(p, { onFailure: () => undefined, onSuccess: identity }) })
564
- const transition = UndefinedOr.map(mount, (m) => m.transition)
565
- const forever = UndefinedOr.match(mount, { onUndefined: () => false, onDefined: playsForever })
566
- const before = Bool.match(forever, { onTrue: () => ownDelayOf(transition), onFalse: () => 0 })
567
- const settled = Option.match(rule, { onNone: () => 0, onSome: (r) => Bool.match(forever, { onTrue: () => Number.POSITIVE_INFINITY, onFalse: () => r.rule.settled }) })
568
- const supports = Option.match(rule, { onNone: () => NO_SUPPORTS, onSome: (r) => r.rule.supports })
569
- geometry = Bool.or(geometry, Arr.isReadonlyArrayNonEmpty(supports))
570
- return { play: { spec: spec as Appear.Spec, delay: start + before, supports }, settled: start + before + settled }
571
- }))
572
- memo.set(entry, computed)
573
- return computed
574
- })
575
- /** When `entry` starts: its stagger, after its parent under `beforeChildren`, after its children under `afterChildren`. */
576
- const startOf = (entry: Entry): Result.Result<number, string> =>
577
- Result.flatMap(afterParent(entry), (afterLeader) => Result.map(afterChildren(entry), (afterKids) => Math.max(afterLeader, afterKids) + ownStaggerOf(entry, childrenOf)))
578
- // A leader written earlier started at first paint: a late child doesn't wait on it.
579
- const afterParent = (entry: Entry): Result.Result<number, string> =>
580
- Option.match(Option.filter(entry.group, (g) => Bool.and(g.when === "beforeChildren", inBatch.has(g.leader))), {
581
- onNone: () => Result.succeed(0),
582
- onSome: (g) =>
583
- Result.flatMap(
584
- Result.mapError(Result.map(timingOf(g.leader), (t) => t.settled), (reason) => `its parent has no rule (${reason})`),
585
- (settled) => Bool.match(Number.isFinite(settled), { onTrue: () => Result.succeed(settled), onFalse: () => Result.fail("its parent never settles") }),
586
- ),
587
- })
588
- const afterChildren = (entry: Entry): Result.Result<number, string> =>
589
- Option.match(Option.fromUndefinedOr(groupsLed.get(entry)), {
590
- onNone: () => Result.succeed(0),
591
- onSome: (g) =>
592
- Bool.match(g.when === "afterChildren", {
593
- onFalse: () => Result.succeed(0),
594
- onTrue: () =>
595
- Result.mapError(
596
- Result.map(Result.all(Arr.map(childrenOf(g), timingOf)), (kids) => Arr.reduce(kids, 0, (latest, t) => Math.max(latest, t.settled))),
597
- (reason) => `a child has no rule (${reason})`,
598
- ),
599
- }),
600
- })
601
- const groupsLed = new Map<Entry, AppearGroup>()
602
- Arr.forEach(entries, (entry) => Option.map(entry.group, (g) => groupsLed.set(g.leader, g)))
603
- const plays = new Map(Arr.map(entries, (entry) => [entry, Result.flatMap(timingOf(entry), (t) => Bool.match(Predicate.isUndefined(t.play.spec), {
604
- onTrue: () => Result.fail("nothing animates"),
605
- onFalse: () => Result.succeed(t.play),
606
- }))] as const))
607
- return Object.assign(plays, { geometry })
608
- }
609
-
610
- /** Each entry's play for one motion setting, and whether any of their rules writes SVG geometry. */
611
- type Timings = Map<Entry, Result.Result<TimedPlay, string>> & { readonly geometry: boolean }
612
-
613
- /** An element's play, with the SVG geometry properties its rule writes (#245, `Appear.Keyframes.supports`). */
614
- interface TimedPlay extends Appear.Play {
615
- readonly supports: ReadonlyArray<string>
616
- }
617
-
618
- const NO_SUPPORTS: ReadonlyArray<string> = []
619
-
620
- /**
621
- * The SVG geometry properties each entry's orchestrated group writes, over every play (#245,
622
- * `Appear.Keyframes.supports`): the whole tree a top leader orchestrates is defined under one
623
- * `@supports`, so a browser without them keeps all of it at its Starting style, not part of it
624
- * (decision 4: an element qualifies whole, and so does what it orchestrates). Per element on a
625
- * server: a render whose rules write none (most) pays a look at each play.
626
- */
627
- const groupSupports = (
628
- entries: ReadonlyArray<Entry>,
629
- settings: ReadonlyArray<Map<Entry, Result.Result<TimedPlay, string>>>,
630
- ): ((entry: Entry) => ReadonlyArray<string>) => {
631
- /** The leader at the top of an entry's orchestration: itself, outside any group. */
632
- const topOf = (entry: Entry): Entry => Option.match(entry.group, { onNone: () => entry, onSome: (g) => topOf(g.leader) })
633
- /** What an entry's own rules write, over every play. */
634
- const own = (entry: Entry): ReadonlyArray<string> =>
635
- Arr.flatMap(settings, (byEntry) =>
636
- Option.match(Option.fromUndefinedOr(byEntry.get(entry)), {
637
- onNone: () => NO_SUPPORTS,
638
- onSome: (play) => Result.match(play, { onFailure: () => NO_SUPPORTS, onSuccess: (p) => p.supports }),
639
- }))
640
- const byTop = new Map<Entry, ReadonlyArray<string>>()
641
- Arr.forEach(entries, (entry) =>
642
- Arr.match(own(entry), {
643
- onEmpty: () => undefined,
644
- onNonEmpty: (mine) => {
645
- const top = topOf(entry)
646
- byTop.set(top, Arr.appendAll(Option.getOrElse(Option.fromUndefinedOr(byTop.get(top)), () => NO_SUPPORTS), mine))
647
- },
648
- }))
649
- return (entry) =>
650
- Bool.match(byTop.size === 0, {
651
- onTrue: () => NO_SUPPORTS,
652
- onFalse: () => Option.getOrElse(Option.fromUndefinedOr(byTop.get(topOf(entry))), () => NO_SUPPORTS),
653
- })
654
- }
655
-
656
- /** An entry's own stagger: none when it's skipped (#468), as its client's snap has no delay; its `when` waits still hold. */
657
- const ownStaggerOf = (entry: Entry, childrenOf: (g: AppearGroup) => ReadonlyArray<Entry>): number => {
658
- if (entry.skipped) return 0
659
- return staggerOf(entry, childrenOf)
660
- }
661
-
662
- /**
663
- * A Variant child's stagger: its parent's `delayChildren` plus its place (ADR-0007), as the client
664
- * works it out, among the group's children in its batch (`childrenOf`, #245).
665
- */
666
- const staggerOf = (entry: Entry, childrenOf: (g: AppearGroup) => ReadonlyArray<Entry>): number =>
667
- Option.match(entry.group, {
668
- onNone: () => 0,
669
- onSome: (g) => {
670
- const children = childrenOf(g)
671
- const n = children.length
672
- const i = children.indexOf(entry)
673
- return childDelayOf(g.stagger, i, n)
674
- },
675
- })
676
-
677
- /** What the server knows of an element when it renders it. */
678
- export interface ServerElement {
679
- /** The element's own `appear` (the provider's is the render's {@link ServerAppear}). */
680
- readonly appear: boolean | undefined
681
- readonly tag: string | undefined
682
- /** Its starting values: `initial`, an inherited `initial` name, or `animate` under `initial={false}`. */
683
- readonly initial: Values.Values
684
- /** Its targets at mount: `animate`, or an inherited variant name resolved against its `variants`; `None` with neither. */
685
- readonly to: Option.Option<Values.Values>
686
- /** Its targets' Keyframes (#429), each such key's value in `to` their last stop; `undefined` with none. */
687
- readonly keyframes: Keyframes | undefined
688
- /** Whether its mount starts at its `animate` (#448, `startsQuiet`): nothing plays, its Keyframes included (#429). */
689
- readonly quiet: boolean
690
- /** Its own transition, else the one it inherits (ADR-0007). */
691
- readonly transition: WardicTransition | undefined
692
- /** Whether it's a layout node (`layout` or `layoutId`): drawn through its projection at rest (#245). */
693
- readonly layout: boolean
694
- /** Its **Transform template** (#443), when it has one. */
695
- readonly template?: DomRenderer.TransformTemplate | undefined
696
- /** The group it staggers in, as a Variant child: its parent's (`node.inherited`). */
697
- readonly group: Option.Option<AppearGroup>
698
- /** Whether it orchestrates its Variant children: it has variants of its own (ADR-0007). */
699
- readonly leads: boolean
700
- /** Its own transition, whose stagger and `when` its Variant children follow. */
701
- readonly ownTransition: WardicTransition | undefined
702
- /** Its nearest `WardicConfig`'s reduced motion (#434), over the provider's: `undefined` for none. */
703
- readonly reducedMotion?: ReducedMotion.Config | undefined
704
- /** Whether its nearest `WardicConfig` skips its animations (#468). Its transition's own `skipAnimations` counts too. */
705
- readonly skipAnimations?: boolean | undefined
706
- }
707
-
708
- /**
709
- * An element's entry in a server render's Appear animations: its inline `animation` when it plays
710
- * one, and the group its Variant children join when it leads one.
711
- */
712
- export const enterServer = (
713
- appear: ServerAppear,
714
- el: ServerElement,
715
- ): {
716
- readonly animation: Option.Option<string>
717
- readonly group: Option.Option<AppearGroup>
718
- readonly veto: (reason: string) => void
719
- /** Rendered after the shell (#245): in a late chunk, and that chunk's root when no late element is around it. */
720
- readonly late: boolean
721
- readonly chunkRoot: boolean
722
- } => {
723
- // Its starts and targets once, both plays sharing them (and so their key's text, `keyOf`). A key
724
- // already at its target, coerced to its shape, is left out, as the client's first Retarget starts
725
- // it no leg (#448); a Keyframes key never is, and starts at its first stop, unless the mount starts
726
- // at its `animate`, when nothing plays (#429, Motion's).
727
- const mount = Option.flatMap(el.to, (to) => {
728
- const moving = Rec.filter(to, (target, key) =>
729
- Bool.match(hasStops(el.keyframes, key), { onTrue: () => Bool.not(el.quiet), onFalse: () => Bool.not(atTarget(el.initial[key], target)) }))
730
- return Bool.match(Rec.isEmptyRecord(moving), {
731
- onTrue: () => Option.none(),
732
- onFalse: () => Option.some(Result.map(playable(el, moving), (prepared): KeyframesStart & { readonly to: Values.Values } => startedOf(prepared, el.keyframes))),
733
- })
734
- })
735
- // Skipped (#468): its config's, or its whole transition's own, as the client's legs read them.
736
- const skipped = Bool.or(el.skipAnimations === true, UndefinedOr.match(el.transition, { onUndefined: () => false, onDefined: (t) => t.skipAnimations === true }))
737
- const play = (reduced: boolean): Option.Option<Result.Result<MountAnimation, string>> =>
738
- Option.map(mount, (prepared) =>
739
- Result.map(prepared, ({ from, to, stops }): MountAnimation => ({
740
- tag: el.tag,
741
- from,
742
- to,
743
- transition: el.transition,
744
- reduced,
745
- layout: el.layout,
746
- stops,
747
- ...skippedField(skipped),
748
- ...UndefinedOr.match(el.template, { onUndefined: () => ({}), onDefined: (template) => ({ template }) }),
749
- })))
750
- const plays = Bool.match(skipped, {
751
- onTrue: () => {
752
- const one = play(false)
753
- return { normal: one, reduced: one }
754
- },
755
- onFalse: () => ({ normal: play(false), reduced: play(true) }),
756
- })
757
- const { entry, animation: inline, late, chunkRoot } = appear.enter(plays, el.group, el.reducedMotion, skipped, el.tag, el.to)
758
- return {
759
- late,
760
- chunkRoot,
761
- animation: inline,
762
- group: Option.liftPredicate(entry, () => el.leads).pipe(Option.map((leader) => appear.group(leader, el.ownTransition))),
763
- veto: (reason) => {
764
- entry.vetoes.push(reason)
765
- },
766
- }
767
- }
768
-
769
- /** A mount animation's `skipped` (#468): left out when it isn't, so its key is as before. */
770
- export const skippedField = (skipped: boolean): { readonly skipped?: true } => Bool.match(skipped, { onTrue: () => ({ skipped: true }) as const, onFalse: () => ({}) })
771
-
772
- /** Whether `key` has Keyframes in `keyframes` (#429). */
773
- const hasStops = (keyframes: Keyframes | undefined, key: string): boolean => {
774
- if (Predicate.isUndefined(keyframes)) return false
775
- return Object.hasOwn(keyframes, key)
776
- }
777
-
778
- /** A mount's starts with its Keyframes resolved (#429, `keyframesFrom`), as the client's first Retarget resolves them. */
779
- const startedOf = (prepared: { readonly from: Values.Values; readonly to: Values.Values }, keyframes: Keyframes | undefined): KeyframesStart & { readonly to: Values.Values } =>
780
- UndefinedOr.match(keyframes, {
781
- onUndefined: () => ({ from: prepared.from, to: prepared.to, stops: undefined }),
782
- onDefined: (byKey) => ({ ...keyframesFrom(prepared.from, prepared.to, byKey), to: prepared.to }),
783
- })
784
-
785
- /** An element's starts and targets, or why its mount animation can't play before hydration (decision 4). */
786
- const playable = (el: ServerElement, to: Values.Values): Result.Result<{ readonly from: Values.Values; readonly to: Values.Values }, string> => playableMatch({ el, to })
787
-
788
- /** {@link playable}'s cases, built once at module load: it runs per element (#69's PR 2). */
789
- const playableMatch: (input: { readonly el: ServerElement; readonly to: Values.Values }) => Result.Result<{ readonly from: Values.Values; readonly to: Values.Values }, string> =
790
- /*#__PURE__*/ Match.type<{ readonly el: ServerElement; readonly to: Values.Values }>().pipe(
791
- Match.when({ el: { appear: false } }, () => Result.fail("appear={false}")),
792
- Match.orElse(({ el, to }) =>
793
- Option.match(unplayable(el.initial, to), {
794
- onSome: (reason): Result.Result<{ readonly from: Values.Values; readonly to: Values.Values }, string> => Result.fail(reason),
795
- onNone: () => Result.succeed({ from: Rec.map(to, (target, key) => Option.getOrThrow(OwnValues.valueLike(el.initial[key] as number | string, target))), to }),
796
- })),
797
- )
798
-
799
- /** Whether a user style sets an `animation` of its own: the element's one CSS animation would be taken. */
800
- export const setsAnimation: (css: object | string | undefined) => boolean = /*#__PURE__*/ Match.type<object | string | undefined>().pipe(
801
- Match.when(Predicate.isString, (text) => /(^|;)\s*animation(-name)?\s*:/i.test(text)),
802
- Match.when(Predicate.isObject, (record) => Bool.or(Object.hasOwn(record, "animation"), Object.hasOwn(record, "animationName"))),
803
- Match.orElse(() => false),
804
- )
805
-
806
- // --- The Handoff -------------------------------------------------------------------------------
807
-
808
- /** An element's Appear animation, found at mount: the spine starts its first legs as far in as it has got. */
809
- export interface Handoff {
810
- readonly animation: Animation
811
- }
812
-
813
- /** The element's Appear animation, if a server started one (decision 6). */
814
- export const handoffOf = (element: Element): Option.Option<Handoff> => Option.map(Appear.find(element), (animation) => ({ animation }))
815
-
816
- /**
817
- * How far into its own run the client's first legs start, in seconds, read at their first tick:
818
- * where the CSS has got, less what the CSS waited that the client waits for itself. The CSS waited
819
- * its `animation-delay` and its rule's hold; the client's legs hold their transition's delay
820
- * (`clientDelay`, the stagger in it). The difference is a `when` wait, which the client has already
821
- * waited.
822
- */
823
- export const startAtOf = (handoff: Handoff, ownTransition: WardicTransition | undefined, clientDelay: number) => (): number =>
824
- Appear.elapsedOf(handoff.animation) - Appear.delayOf(handoff.animation) - heldInRule(ownTransition) + clientDelay
1
+ // #672: @wardic/dom/unstable/AppearAnimations since the lift; solid's modules import it through here until each
2
+ // has moved.
3
+ export * from "@wardic/dom/unstable/AppearAnimations"