@wardic/solid 2.2.0 → 3.0.0-next.0

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 (475) hide show
  1. package/README.md +22 -18
  2. package/dist/browser/config-view.js +33 -5
  3. package/dist/browser/config-view.js.map +1 -1
  4. package/dist/browser/create-batch.js +1 -1
  5. package/dist/browser/element-style.js +61 -7
  6. package/dist/browser/element-style.js.map +1 -1
  7. package/dist/browser/element.js +19 -2
  8. package/dist/browser/element.js.map +1 -1
  9. package/dist/browser/feature-section.js +5 -13
  10. package/dist/browser/feature-section.js.map +1 -1
  11. package/dist/browser/hooks/auto.js +270 -0
  12. package/dist/browser/hooks/auto.js.map +1 -0
  13. package/dist/browser/hooks/config-scope.js +120 -0
  14. package/dist/browser/hooks/config-scope.js.map +1 -0
  15. package/dist/browser/hooks/config.js +37 -0
  16. package/dist/browser/hooks/config.js.map +1 -0
  17. package/dist/browser/hooks/drag.js +632 -0
  18. package/dist/browser/hooks/drag.js.map +1 -0
  19. package/dist/browser/hooks/elements.js +183 -0
  20. package/dist/browser/hooks/elements.js.map +1 -0
  21. package/dist/browser/hooks/group.js +28 -0
  22. package/dist/browser/hooks/group.js.map +1 -0
  23. package/dist/browser/hooks/index.js +10 -0
  24. package/dist/browser/hooks/index.js.map +1 -0
  25. package/dist/browser/hooks/kept.js +32 -0
  26. package/dist/browser/hooks/kept.js.map +1 -0
  27. package/dist/browser/hooks/layout-group-of.js +39 -0
  28. package/dist/browser/hooks/layout-group-of.js.map +1 -0
  29. package/dist/browser/hooks/layout-group.js +92 -0
  30. package/dist/browser/hooks/layout-group.js.map +1 -0
  31. package/dist/browser/hooks/make-ward.js +157 -0
  32. package/dist/browser/hooks/make-ward.js.map +1 -0
  33. package/dist/browser/hooks/presence-scope.js +87 -0
  34. package/dist/browser/hooks/presence-scope.js.map +1 -0
  35. package/dist/browser/hooks/presence.js +24 -0
  36. package/dist/browser/hooks/presence.js.map +1 -0
  37. package/dist/browser/hooks/props.js +148 -0
  38. package/dist/browser/hooks/props.js.map +1 -0
  39. package/dist/browser/hooks/reads.js +241 -0
  40. package/dist/browser/hooks/reads.js.map +1 -0
  41. package/dist/browser/hooks/refs.js +87 -0
  42. package/dist/browser/hooks/refs.js.map +1 -0
  43. package/dist/browser/hooks/reorder-elements.js +268 -0
  44. package/dist/browser/hooks/reorder-elements.js.map +1 -0
  45. package/dist/browser/hooks/reorder.js +176 -0
  46. package/dist/browser/hooks/reorder.js.map +1 -0
  47. package/dist/browser/hooks/rune.js +799 -0
  48. package/dist/browser/hooks/rune.js.map +1 -0
  49. package/dist/browser/hooks/server-features.client.js +2 -0
  50. package/dist/browser/hooks/server-features.client.js.map +1 -0
  51. package/dist/browser/hooks/server-features.js +13 -0
  52. package/dist/browser/hooks/server-features.js.map +1 -0
  53. package/dist/browser/hooks/settings.js +29 -0
  54. package/dist/browser/hooks/settings.js.map +1 -0
  55. package/dist/browser/hooks/setup.js +154 -0
  56. package/dist/browser/hooks/setup.js.map +1 -0
  57. package/dist/browser/hooks/stage.js +117 -0
  58. package/dist/browser/hooks/stage.js.map +1 -0
  59. package/dist/browser/hooks/ward.js +2193 -0
  60. package/dist/browser/hooks/ward.js.map +1 -0
  61. package/dist/browser/hooks/wardic-provider.js +29 -0
  62. package/dist/browser/hooks/wardic-provider.js.map +1 -0
  63. package/dist/browser/hooks/wardic-scope.js +68 -0
  64. package/dist/browser/hooks/wardic-scope.js.map +1 -0
  65. package/dist/browser/hooks/wards.js +562 -0
  66. package/dist/browser/hooks/wards.js.map +1 -0
  67. package/dist/browser/index.js +23 -11
  68. package/dist/browser/index.js.map +1 -1
  69. package/dist/browser/layout.js +7 -58
  70. package/dist/browser/layout.js.map +1 -1
  71. package/dist/browser/lazy-batch-gestures.js +1 -1
  72. package/dist/browser/lifecycle.js +37 -0
  73. package/dist/browser/lifecycle.js.map +1 -1
  74. package/dist/browser/presence-handle.js +28 -12
  75. package/dist/browser/presence-handle.js.map +1 -1
  76. package/dist/browser/presence.js +3 -1
  77. package/dist/browser/presence.js.map +1 -1
  78. package/dist/browser/provider.js +85 -70
  79. package/dist/browser/provider.js.map +1 -1
  80. package/dist/browser/reorder-components.js +50 -0
  81. package/dist/browser/reorder-components.js.map +1 -0
  82. package/dist/browser/reorder.js +46 -274
  83. package/dist/browser/reorder.js.map +1 -1
  84. package/dist/browser/stage.js.map +1 -1
  85. package/dist/browser/unstable/v2/index.js +0 -8
  86. package/dist/browser/unstable/v2/index.js.map +1 -1
  87. package/dist/browser/v1/index.js +1 -1
  88. package/dist/browser/v1/index.js.map +1 -1
  89. package/dist/browser/variant-node.js +4 -2
  90. package/dist/browser/variant-node.js.map +1 -1
  91. package/dist/browser/w.js +33 -3
  92. package/dist/browser/w.js.map +1 -1
  93. package/dist/browser/ward.js +576 -49
  94. package/dist/browser/ward.js.map +1 -1
  95. package/dist/browser/wardic-config.js +62 -29
  96. package/dist/browser/wardic-config.js.map +1 -1
  97. package/dist/browser/wardic-context.js +23 -0
  98. package/dist/browser/wardic-context.js.map +1 -0
  99. package/dist/browser/wardic.js +3 -0
  100. package/dist/browser/wardic.js.map +1 -1
  101. package/dist/server/config-view.js +33 -5
  102. package/dist/server/config-view.js.map +1 -1
  103. package/dist/server/create-batch.js +1 -1
  104. package/dist/server/element-style.js +61 -7
  105. package/dist/server/element-style.js.map +1 -1
  106. package/dist/server/element.js +19 -2
  107. package/dist/server/element.js.map +1 -1
  108. package/dist/server/feature-section.js +5 -13
  109. package/dist/server/feature-section.js.map +1 -1
  110. package/dist/server/hooks/auto.js +270 -0
  111. package/dist/server/hooks/auto.js.map +1 -0
  112. package/dist/server/hooks/config-scope.js +120 -0
  113. package/dist/server/hooks/config-scope.js.map +1 -0
  114. package/dist/server/hooks/config.js +37 -0
  115. package/dist/server/hooks/config.js.map +1 -0
  116. package/dist/server/hooks/drag.js +632 -0
  117. package/dist/server/hooks/drag.js.map +1 -0
  118. package/dist/server/hooks/elements.js +192 -0
  119. package/dist/server/hooks/elements.js.map +1 -0
  120. package/dist/server/hooks/group.js +28 -0
  121. package/dist/server/hooks/group.js.map +1 -0
  122. package/dist/server/hooks/index.js +10 -0
  123. package/dist/server/hooks/index.js.map +1 -0
  124. package/dist/server/hooks/kept.js +32 -0
  125. package/dist/server/hooks/kept.js.map +1 -0
  126. package/dist/server/hooks/layout-group-of.js +39 -0
  127. package/dist/server/hooks/layout-group-of.js.map +1 -0
  128. package/dist/server/hooks/layout-group.js +109 -0
  129. package/dist/server/hooks/layout-group.js.map +1 -0
  130. package/dist/server/hooks/make-ward.js +157 -0
  131. package/dist/server/hooks/make-ward.js.map +1 -0
  132. package/dist/server/hooks/presence-scope.js +86 -0
  133. package/dist/server/hooks/presence-scope.js.map +1 -0
  134. package/dist/server/hooks/presence.js +24 -0
  135. package/dist/server/hooks/presence.js.map +1 -0
  136. package/dist/server/hooks/props.js +148 -0
  137. package/dist/server/hooks/props.js.map +1 -0
  138. package/dist/server/hooks/reads.js +241 -0
  139. package/dist/server/hooks/reads.js.map +1 -0
  140. package/dist/server/hooks/refs.js +87 -0
  141. package/dist/server/hooks/refs.js.map +1 -0
  142. package/dist/server/hooks/reorder-elements.js +308 -0
  143. package/dist/server/hooks/reorder-elements.js.map +1 -0
  144. package/dist/server/hooks/reorder.js +176 -0
  145. package/dist/server/hooks/reorder.js.map +1 -0
  146. package/dist/server/hooks/rune.js +799 -0
  147. package/dist/server/hooks/rune.js.map +1 -0
  148. package/dist/server/hooks/server-features.client.js +2 -0
  149. package/dist/server/hooks/server-features.client.js.map +1 -0
  150. package/dist/server/hooks/server-features.js +13 -0
  151. package/dist/server/hooks/server-features.js.map +1 -0
  152. package/dist/server/hooks/settings.js +29 -0
  153. package/dist/server/hooks/settings.js.map +1 -0
  154. package/dist/server/hooks/setup.js +154 -0
  155. package/dist/server/hooks/setup.js.map +1 -0
  156. package/dist/server/hooks/stage.js +117 -0
  157. package/dist/server/hooks/stage.js.map +1 -0
  158. package/dist/server/hooks/ward.js +2193 -0
  159. package/dist/server/hooks/ward.js.map +1 -0
  160. package/dist/server/hooks/wardic-provider.js +29 -0
  161. package/dist/server/hooks/wardic-provider.js.map +1 -0
  162. package/dist/server/hooks/wardic-scope.js +68 -0
  163. package/dist/server/hooks/wardic-scope.js.map +1 -0
  164. package/dist/server/hooks/wards.js +562 -0
  165. package/dist/server/hooks/wards.js.map +1 -0
  166. package/dist/server/index.js +23 -11
  167. package/dist/server/index.js.map +1 -1
  168. package/dist/server/layout.js +7 -75
  169. package/dist/server/layout.js.map +1 -1
  170. package/dist/server/lazy-batch-gestures.js +1 -1
  171. package/dist/server/lifecycle.js +37 -0
  172. package/dist/server/lifecycle.js.map +1 -1
  173. package/dist/server/presence-handle.js +28 -12
  174. package/dist/server/presence-handle.js.map +1 -1
  175. package/dist/server/presence.js +3 -1
  176. package/dist/server/presence.js.map +1 -1
  177. package/dist/server/provider.js +86 -80
  178. package/dist/server/provider.js.map +1 -1
  179. package/dist/server/reorder-components.js +50 -0
  180. package/dist/server/reorder-components.js.map +1 -0
  181. package/dist/server/reorder.js +46 -344
  182. package/dist/server/reorder.js.map +1 -1
  183. package/dist/server/stage.js.map +1 -1
  184. package/dist/server/unstable/v2/index.js +0 -8
  185. package/dist/server/unstable/v2/index.js.map +1 -1
  186. package/dist/server/v1/index.js +1 -1
  187. package/dist/server/v1/index.js.map +1 -1
  188. package/dist/server/variant-node.js +4 -2
  189. package/dist/server/variant-node.js.map +1 -1
  190. package/dist/server/w.js +33 -3
  191. package/dist/server/w.js.map +1 -1
  192. package/dist/server/ward.js +576 -49
  193. package/dist/server/ward.js.map +1 -1
  194. package/dist/server/wardic-config.js +63 -30
  195. package/dist/server/wardic-config.js.map +1 -1
  196. package/dist/server/wardic-context.js +23 -0
  197. package/dist/server/wardic-context.js.map +1 -0
  198. package/dist/server/wardic.js +3 -0
  199. package/dist/server/wardic.js.map +1 -1
  200. package/dist/solid/batch-reorder-group.d.ts +1 -1
  201. package/dist/solid/batch-reorder.d.ts +1 -1
  202. package/dist/solid/batch-reorder.d.ts.map +1 -1
  203. package/dist/solid/config-view.d.ts +11 -0
  204. package/dist/solid/config-view.d.ts.map +1 -1
  205. package/dist/solid/config-view.js +29 -6
  206. package/dist/solid/config-view.js.map +1 -1
  207. package/dist/solid/create-batch.jsx +1 -1
  208. package/dist/solid/element-style.d.ts +16 -2
  209. package/dist/solid/element-style.d.ts.map +1 -1
  210. package/dist/solid/element-style.js +61 -7
  211. package/dist/solid/element-style.js.map +1 -1
  212. package/dist/solid/element.d.ts +3 -1
  213. package/dist/solid/element.d.ts.map +1 -1
  214. package/dist/solid/element.jsx +21 -2
  215. package/dist/solid/element.jsx.map +1 -1
  216. package/dist/solid/feature-section.d.ts +0 -7
  217. package/dist/solid/feature-section.d.ts.map +1 -1
  218. package/dist/solid/feature-section.js +5 -13
  219. package/dist/solid/feature-section.js.map +1 -1
  220. package/dist/solid/hooks/auto.d.ts +44 -0
  221. package/dist/solid/hooks/auto.d.ts.map +1 -0
  222. package/dist/solid/hooks/auto.js +269 -0
  223. package/dist/solid/hooks/auto.js.map +1 -0
  224. package/dist/solid/hooks/config-scope.d.ts +84 -0
  225. package/dist/solid/hooks/config-scope.d.ts.map +1 -0
  226. package/dist/solid/hooks/config-scope.jsx +128 -0
  227. package/dist/solid/hooks/config-scope.jsx.map +1 -0
  228. package/dist/solid/hooks/config.d.ts +28 -0
  229. package/dist/solid/hooks/config.d.ts.map +1 -0
  230. package/dist/solid/hooks/config.jsx +37 -0
  231. package/dist/solid/hooks/config.jsx.map +1 -0
  232. package/dist/solid/hooks/drag.d.ts +220 -0
  233. package/dist/solid/hooks/drag.d.ts.map +1 -0
  234. package/dist/solid/hooks/drag.js +585 -0
  235. package/dist/solid/hooks/drag.js.map +1 -0
  236. package/dist/solid/hooks/elements.d.ts +11 -0
  237. package/dist/solid/hooks/elements.d.ts.map +1 -0
  238. package/dist/solid/hooks/elements.jsx +218 -0
  239. package/dist/solid/hooks/elements.jsx.map +1 -0
  240. package/dist/solid/hooks/group.d.ts +46 -0
  241. package/dist/solid/hooks/group.d.ts.map +1 -0
  242. package/dist/solid/hooks/group.jsx +25 -0
  243. package/dist/solid/hooks/group.jsx.map +1 -0
  244. package/dist/solid/hooks/index.d.ts +28 -0
  245. package/dist/solid/hooks/index.d.ts.map +1 -0
  246. package/dist/solid/hooks/index.js +10 -0
  247. package/dist/solid/hooks/index.js.map +1 -0
  248. package/dist/solid/hooks/kept.d.ts +60 -0
  249. package/dist/solid/hooks/kept.d.ts.map +1 -0
  250. package/dist/solid/hooks/kept.js +33 -0
  251. package/dist/solid/hooks/kept.js.map +1 -0
  252. package/dist/solid/hooks/layout-group-of.d.ts +27 -0
  253. package/dist/solid/hooks/layout-group-of.d.ts.map +1 -0
  254. package/dist/solid/hooks/layout-group-of.js +39 -0
  255. package/dist/solid/hooks/layout-group-of.js.map +1 -0
  256. package/dist/solid/hooks/layout-group.d.ts +60 -0
  257. package/dist/solid/hooks/layout-group.d.ts.map +1 -0
  258. package/dist/solid/hooks/layout-group.jsx +80 -0
  259. package/dist/solid/hooks/layout-group.jsx.map +1 -0
  260. package/dist/solid/hooks/make-ward.d.ts +123 -0
  261. package/dist/solid/hooks/make-ward.d.ts.map +1 -0
  262. package/dist/solid/hooks/make-ward.js +147 -0
  263. package/dist/solid/hooks/make-ward.js.map +1 -0
  264. package/dist/solid/hooks/presence-scope.d.ts +84 -0
  265. package/dist/solid/hooks/presence-scope.d.ts.map +1 -0
  266. package/dist/solid/hooks/presence-scope.jsx +62 -0
  267. package/dist/solid/hooks/presence-scope.jsx.map +1 -0
  268. package/dist/solid/hooks/presence.d.ts +51 -0
  269. package/dist/solid/hooks/presence.d.ts.map +1 -0
  270. package/dist/solid/hooks/presence.jsx +26 -0
  271. package/dist/solid/hooks/presence.jsx.map +1 -0
  272. package/dist/solid/hooks/props.d.ts +52 -0
  273. package/dist/solid/hooks/props.d.ts.map +1 -0
  274. package/dist/solid/hooks/props.js +140 -0
  275. package/dist/solid/hooks/props.js.map +1 -0
  276. package/dist/solid/hooks/reads.d.ts +38 -0
  277. package/dist/solid/hooks/reads.d.ts.map +1 -0
  278. package/dist/solid/hooks/reads.js +218 -0
  279. package/dist/solid/hooks/reads.js.map +1 -0
  280. package/dist/solid/hooks/refs.d.ts +25 -0
  281. package/dist/solid/hooks/refs.d.ts.map +1 -0
  282. package/dist/solid/hooks/refs.js +89 -0
  283. package/dist/solid/hooks/refs.js.map +1 -0
  284. package/dist/solid/hooks/reorder-elements.d.ts +23 -0
  285. package/dist/solid/hooks/reorder-elements.d.ts.map +1 -0
  286. package/dist/solid/hooks/reorder-elements.jsx +273 -0
  287. package/dist/solid/hooks/reorder-elements.jsx.map +1 -0
  288. package/dist/solid/hooks/reorder.d.ts +55 -0
  289. package/dist/solid/hooks/reorder.d.ts.map +1 -0
  290. package/dist/solid/hooks/reorder.js +152 -0
  291. package/dist/solid/hooks/reorder.js.map +1 -0
  292. package/dist/solid/hooks/rune.d.ts +885 -0
  293. package/dist/solid/hooks/rune.d.ts.map +1 -0
  294. package/dist/solid/hooks/rune.js +816 -0
  295. package/dist/solid/hooks/rune.js.map +1 -0
  296. package/dist/solid/hooks/server-features.client.d.ts +10 -0
  297. package/dist/solid/hooks/server-features.client.d.ts.map +1 -0
  298. package/dist/solid/hooks/server-features.client.js +2 -0
  299. package/dist/solid/hooks/server-features.client.js.map +1 -0
  300. package/dist/solid/hooks/server-features.d.ts +10 -0
  301. package/dist/solid/hooks/server-features.d.ts.map +1 -0
  302. package/dist/solid/hooks/server-features.js +13 -0
  303. package/dist/solid/hooks/server-features.js.map +1 -0
  304. package/dist/solid/hooks/settings.d.ts +11 -0
  305. package/dist/solid/hooks/settings.d.ts.map +1 -0
  306. package/dist/solid/hooks/settings.js +31 -0
  307. package/dist/solid/hooks/settings.js.map +1 -0
  308. package/dist/solid/hooks/setup.d.ts +31 -0
  309. package/dist/solid/hooks/setup.d.ts.map +1 -0
  310. package/dist/solid/hooks/setup.js +155 -0
  311. package/dist/solid/hooks/setup.js.map +1 -0
  312. package/dist/solid/hooks/stage.d.ts +187 -0
  313. package/dist/solid/hooks/stage.d.ts.map +1 -0
  314. package/dist/solid/hooks/stage.js +117 -0
  315. package/dist/solid/hooks/stage.js.map +1 -0
  316. package/dist/solid/hooks/ward.d.ts +394 -0
  317. package/dist/solid/hooks/ward.d.ts.map +1 -0
  318. package/dist/solid/hooks/ward.js +2237 -0
  319. package/dist/solid/hooks/ward.js.map +1 -0
  320. package/dist/solid/hooks/wardic-provider.d.ts +32 -0
  321. package/dist/solid/hooks/wardic-provider.d.ts.map +1 -0
  322. package/dist/solid/hooks/wardic-provider.jsx +29 -0
  323. package/dist/solid/hooks/wardic-provider.jsx.map +1 -0
  324. package/dist/solid/hooks/wardic-scope.d.ts +49 -0
  325. package/dist/solid/hooks/wardic-scope.d.ts.map +1 -0
  326. package/dist/solid/hooks/wardic-scope.jsx +63 -0
  327. package/dist/solid/hooks/wardic-scope.jsx.map +1 -0
  328. package/dist/solid/hooks/wards.d.ts +157 -0
  329. package/dist/solid/hooks/wards.d.ts.map +1 -0
  330. package/dist/solid/hooks/wards.js +522 -0
  331. package/dist/solid/hooks/wards.js.map +1 -0
  332. package/dist/solid/index.d.ts +21 -14
  333. package/dist/solid/index.d.ts.map +1 -1
  334. package/dist/solid/index.jsx +23 -11
  335. package/dist/solid/index.jsx.map +1 -1
  336. package/dist/solid/layout.d.ts +2 -44
  337. package/dist/solid/layout.d.ts.map +1 -1
  338. package/dist/solid/layout.jsx +7 -49
  339. package/dist/solid/layout.jsx.map +1 -1
  340. package/dist/solid/lazy-batch-gestures.js +1 -1
  341. package/dist/solid/lazy-batch-gestures.js.map +1 -1
  342. package/dist/solid/lifecycle.d.ts +19 -0
  343. package/dist/solid/lifecycle.d.ts.map +1 -1
  344. package/dist/solid/lifecycle.js +40 -0
  345. package/dist/solid/lifecycle.js.map +1 -1
  346. package/dist/solid/presence-handle.d.ts +13 -6
  347. package/dist/solid/presence-handle.d.ts.map +1 -1
  348. package/dist/solid/presence-handle.js +30 -12
  349. package/dist/solid/presence-handle.js.map +1 -1
  350. package/dist/solid/presence.d.ts +3 -1
  351. package/dist/solid/presence.d.ts.map +1 -1
  352. package/dist/solid/presence.jsx +3 -1
  353. package/dist/solid/presence.jsx.map +1 -1
  354. package/dist/solid/provider.d.ts +25 -32
  355. package/dist/solid/provider.d.ts.map +1 -1
  356. package/dist/solid/provider.jsx +86 -62
  357. package/dist/solid/provider.jsx.map +1 -1
  358. package/dist/solid/reorder-components.d.ts +32 -0
  359. package/dist/solid/reorder-components.d.ts.map +1 -0
  360. package/dist/solid/reorder-components.jsx +49 -0
  361. package/dist/solid/reorder-components.jsx.map +1 -0
  362. package/dist/solid/reorder.d.ts +50 -76
  363. package/dist/solid/reorder.d.ts.map +1 -1
  364. package/dist/solid/reorder.jsx +40 -202
  365. package/dist/solid/reorder.jsx.map +1 -1
  366. package/dist/solid/stage.d.ts +14 -0
  367. package/dist/solid/stage.d.ts.map +1 -1
  368. package/dist/solid/stage.js.map +1 -1
  369. package/dist/solid/unstable/v2/index.d.ts +2 -26
  370. package/dist/solid/unstable/v2/index.d.ts.map +1 -1
  371. package/dist/solid/unstable/v2/index.jsx +0 -16
  372. package/dist/solid/unstable/v2/index.jsx.map +1 -1
  373. package/dist/solid/v1/index.d.ts +1 -1
  374. package/dist/solid/v1/index.d.ts.map +1 -1
  375. package/dist/solid/v1/index.jsx +1 -1
  376. package/dist/solid/v1/index.jsx.map +1 -1
  377. package/dist/solid/variant-node.d.ts +6 -0
  378. package/dist/solid/variant-node.d.ts.map +1 -1
  379. package/dist/solid/variant-node.js +2 -0
  380. package/dist/solid/variant-node.js.map +1 -1
  381. package/dist/solid/w.d.ts +9 -3
  382. package/dist/solid/w.d.ts.map +1 -1
  383. package/dist/solid/w.jsx +36 -3
  384. package/dist/solid/w.jsx.map +1 -1
  385. package/dist/solid/ward.d.ts +134 -7
  386. package/dist/solid/ward.d.ts.map +1 -1
  387. package/dist/solid/ward.jsx +546 -48
  388. package/dist/solid/ward.jsx.map +1 -1
  389. package/dist/solid/wardic-config.d.ts +17 -12
  390. package/dist/solid/wardic-config.d.ts.map +1 -1
  391. package/dist/solid/wardic-config.jsx +68 -22
  392. package/dist/solid/wardic-config.jsx.map +1 -1
  393. package/dist/solid/wardic-context.d.ts +15 -0
  394. package/dist/solid/wardic-context.d.ts.map +1 -0
  395. package/dist/solid/wardic-context.js +23 -0
  396. package/dist/solid/wardic-context.js.map +1 -0
  397. package/dist/solid/wardic-instance.d.ts +6 -4
  398. package/dist/solid/wardic-instance.d.ts.map +1 -1
  399. package/dist/solid/wardic.d.ts +3 -0
  400. package/dist/solid/wardic.d.ts.map +1 -1
  401. package/dist/solid/wardic.jsx +3 -0
  402. package/dist/solid/wardic.jsx.map +1 -1
  403. package/package.json +26 -6
  404. package/src/batch-reorder-group.tsx +1 -1
  405. package/src/batch-reorder.ts +1 -1
  406. package/src/config-view.ts +30 -6
  407. package/src/create-batch.tsx +1 -1
  408. package/src/element-style.ts +77 -9
  409. package/src/element.tsx +25 -4
  410. package/src/feature-section.ts +5 -15
  411. package/src/hooks/auto.ts +303 -0
  412. package/src/hooks/config-scope.tsx +215 -0
  413. package/src/hooks/config.tsx +54 -0
  414. package/src/hooks/drag.ts +740 -0
  415. package/src/hooks/elements.tsx +234 -0
  416. package/src/hooks/group.tsx +55 -0
  417. package/src/hooks/index.ts +41 -0
  418. package/src/hooks/kept.ts +89 -0
  419. package/src/hooks/layout-group-of.ts +46 -0
  420. package/src/hooks/layout-group.tsx +111 -0
  421. package/src/hooks/make-ward.ts +218 -0
  422. package/src/hooks/presence-scope.tsx +155 -0
  423. package/src/hooks/presence.tsx +67 -0
  424. package/src/hooks/props.ts +190 -0
  425. package/src/hooks/reads.ts +258 -0
  426. package/src/hooks/refs.ts +114 -0
  427. package/src/hooks/reorder-elements.tsx +321 -0
  428. package/src/hooks/reorder.ts +205 -0
  429. package/src/hooks/rune.ts +1755 -0
  430. package/src/hooks/server-features.client.ts +10 -0
  431. package/src/hooks/server-features.ts +12 -0
  432. package/src/hooks/settings.ts +44 -0
  433. package/src/hooks/setup.ts +184 -0
  434. package/src/hooks/stage.ts +359 -0
  435. package/src/hooks/ward.ts +2563 -0
  436. package/src/hooks/wardic-provider.tsx +51 -0
  437. package/src/hooks/wardic-scope.tsx +112 -0
  438. package/src/hooks/wards.ts +679 -0
  439. package/src/index.tsx +27 -15
  440. package/src/layout.tsx +7 -74
  441. package/src/lazy-batch-gestures.ts +1 -1
  442. package/src/lifecycle.ts +40 -0
  443. package/src/presence-handle.ts +39 -20
  444. package/src/presence.tsx +3 -1
  445. package/src/provider.tsx +96 -71
  446. package/src/reorder-components.tsx +61 -0
  447. package/src/reorder.tsx +84 -303
  448. package/src/stage.ts +15 -0
  449. package/src/unstable/v2/index.tsx +2 -26
  450. package/src/v1/index.tsx +1 -1
  451. package/src/variant-node.ts +8 -0
  452. package/src/w.tsx +38 -5
  453. package/src/ward.tsx +674 -48
  454. package/src/wardic-config.tsx +68 -21
  455. package/src/wardic-context.ts +26 -0
  456. package/src/wardic-instance.ts +6 -4
  457. package/src/wardic.tsx +3 -0
  458. package/dist/browser/create-wardic.js +0 -36
  459. package/dist/browser/create-wardic.js.map +0 -1
  460. package/dist/browser/presence-hooks.js +0 -144
  461. package/dist/browser/presence-hooks.js.map +0 -1
  462. package/dist/server/create-wardic.js +0 -36
  463. package/dist/server/create-wardic.js.map +0 -1
  464. package/dist/server/presence-hooks.js +0 -144
  465. package/dist/server/presence-hooks.js.map +0 -1
  466. package/dist/solid/create-wardic.d.ts +0 -25
  467. package/dist/solid/create-wardic.d.ts.map +0 -1
  468. package/dist/solid/create-wardic.jsx +0 -34
  469. package/dist/solid/create-wardic.jsx.map +0 -1
  470. package/dist/solid/presence-hooks.d.ts +0 -53
  471. package/dist/solid/presence-hooks.d.ts.map +0 -1
  472. package/dist/solid/presence-hooks.jsx +0 -117
  473. package/dist/solid/presence-hooks.jsx.map +0 -1
  474. package/src/create-wardic.tsx +0 -46
  475. package/src/presence-hooks.tsx +0 -159
@@ -0,0 +1,258 @@
1
+ /**
2
+ * A hook ward's reads (probe: hooks-first): its gestures and its motion as state, on the ward itself.
3
+ *
4
+ * ```tsx
5
+ * const card = createWard({ whileHover: lift })
6
+ * <article {...card}>{card.hovering() ? "Over" : "Away"}</article>
7
+ * ```
8
+ *
9
+ * - `hovering()`, `pressing()`, `dragging()`, `viewing()` and `focusing()` are the gestures: each is
10
+ * what the sensor of that gesture reads when it's given the ward (`createHover(card)` and the rest),
11
+ * reached from the ward. The sensors stay, for an element with no ward and for a drag's samples.
12
+ * - `animating()` is whether an animation of its own is on its way: `isPending(() => card.settled())`.
13
+ *
14
+ * **Nothing is made until one is first read.** Each is a getter, the same function for every ward. At
15
+ * its first read it makes one signal and listens to the ward's own events, as a sensor given the ward
16
+ * does, so nothing listens to its element twice; and it asks for its gesture's Feature, as a first
17
+ * listener does, so a ward that brings what its config uses reads `hovering()` with no `whileHover`.
18
+ * The accessor is kept, so `const over = card.hovering` is the same one read anywhere.
19
+ *
20
+ * On a server each is `false`.
21
+ *
22
+ * The six getters are on the prototype every client ward shares, where `settled` and `tapped` are
23
+ * (`SHARED`, `ward.ts`), and a ward carries nothing for them. A ward with no state of its own, a
24
+ * server's or a Stage's, is given them as its own.
25
+ *
26
+ * @module
27
+ */
28
+ import { isServer } from "@solidjs/web"
29
+ import type * as Feature from "@wardic/dom/unstable/Feature"
30
+ import * as Keys from "@wardic/dom/unstable/features/Keys"
31
+ import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures"
32
+ import * as OwnerScope from "@wardic/dom/unstable/OwnerScope"
33
+ import * as Report from "@wardic/dom/Report"
34
+ import type * as Cause from "effect/Cause"
35
+ import { constFalse, constVoid } from "effect/Function"
36
+ import * as Predicate from "effect/Predicate"
37
+ import * as Scope from "effect/Scope"
38
+ import { type Accessor, createEffect, createMemo, createSignal, isPending, type Owner, runWithOwner } from "solid-js"
39
+ import type { Lifecycle } from "../lifecycle.ts"
40
+ import { useInstanceFeatures, useWardicRuntime } from "../provider.tsx"
41
+ import { CLIENT_ONLY, onSettledClientOnly } from "../solid-reactivity.ts"
42
+ import type { Listener } from "../waiters.ts"
43
+ import { type AnyWard, sensedOf, type Ward } from "../ward.tsx"
44
+ import type { AutoFeature } from "./auto.ts"
45
+ import { keptFor } from "./kept.ts"
46
+
47
+ /** The reads a hook ward has, by name. */
48
+ export interface WardReads {
49
+ /** `true` while the pointer is over its element (`createHover(ward)`'s reading). A touch never hovers. */
50
+ readonly hovering: Accessor<boolean>
51
+ /**
52
+ * `true` while a press is held on its element, a pointer's or the keyboard's, until its tap, its
53
+ * cancel, or a drag taking it over (`createPress(ward)`'s reading).
54
+ */
55
+ readonly pressing: Accessor<boolean>
56
+ /** `true` from a drag's start to its release. Its samples are `createDrag(ward)`'s. */
57
+ readonly dragging: Accessor<boolean>
58
+ /** `true` while its element is in view, by its own `viewport`. */
59
+ readonly viewing: Accessor<boolean>
60
+ /** `true` while its element has the focus (`createFocus(ward)`'s reading). */
61
+ readonly focusing: Accessor<boolean>
62
+ /** `true` while an animation of its own is on its way: `isPending(() => ward.settled())`. */
63
+ readonly animating: Accessor<boolean>
64
+ }
65
+
66
+ type Read = keyof WardReads
67
+
68
+ /** What a read needs of the ward the hooks made: how it asks for a Feature, its own Features, and its owner. */
69
+ interface ReadsOf {
70
+ readonly ask: (name: AutoFeature) => void
71
+ readonly instance: Feature.InstanceFeatures
72
+ readonly owner: Owner | null
73
+ }
74
+
75
+ /**
76
+ * What `ward`'s reads go by, of what the hooks keep of it (`kept.ts`): none for a ward they didn't
77
+ * make, or one with no Features of its own. For a ward with a state of its own, a client's.
78
+ */
79
+ const readsOf = (ward: object): ReadsOf | undefined => {
80
+ const kept = keptFor(ward)
81
+ if (Predicate.isUndefined(kept)) return undefined
82
+ const ask = kept.ask
83
+ const instance = kept.instance
84
+ if (Predicate.isUndefined(ask) || Predicate.isUndefined(instance)) return undefined
85
+ return { ask, instance, owner: kept.owner }
86
+ }
87
+
88
+ // Module state (#460, Q7): each ward's reads made so far, held weakly by the ward.
89
+ const MADE = new WeakMap<object, Partial<Record<Read, Accessor<boolean>>>>()
90
+
91
+ // Module state (#460, Q7): the finished ward each function rune's ward is part of, held weakly by the rune's.
92
+ const DRIVEN = new WeakMap<object, AnyWard>()
93
+
94
+ /**
95
+ * Says which ward a function rune's ward is part of. The two share a lifecycle, so the rune's hears
96
+ * every event; what it isn't told is the element, which is the finished ward's alone, and `focusing`
97
+ * watches the element.
98
+ */
99
+ export const drivenBy = (rune: object, ward: AnyWard): void => {
100
+ DRIVEN.set(rune, ward)
101
+ }
102
+
103
+ /** The ward whose element `ward` reads, and whose leave it holds: the one it's part of, or itself. */
104
+ export const onOf = (ward: AnyWard): AnyWard => {
105
+ const by = DRIVEN.get(ward)
106
+ if (Predicate.isUndefined(by)) return ward
107
+ return by
108
+ }
109
+
110
+ /** The element `ward` is on: its own, or the one the ward it's part of is on. Read where it's tracked. */
111
+ const elementOf = (ward: AnyWard): HTMLElement | undefined => {
112
+ const sensed = sensedOf(onOf(ward))
113
+ if (Predicate.isUndefined(sensed)) return undefined
114
+ return sensed.element()
115
+ }
116
+
117
+ /** A ward event's listener for a read: each told as `on` has it, the ward's end ending nothing more. */
118
+ const heard = <E>(on: (event: E) => void): Listener<E> => ({ next: on, error: constVoid })
119
+
120
+ /** `ward`'s `name`, made by `make` the first time it's read and kept. */
121
+ const kept = (ward: object, name: Read, make: () => Accessor<boolean>): Accessor<boolean> => {
122
+ const known = MADE.get(ward)
123
+ if (Predicate.isNotUndefined(known)) {
124
+ const read = known[name]
125
+ if (Predicate.isNotUndefined(read)) return read
126
+ }
127
+ const read = make()
128
+ MADE.set(ward, { ...known, [name]: read })
129
+ return read
130
+ }
131
+
132
+ /**
133
+ * A gesture's read over the ward's own events: `false` until `listen` says otherwise. Listening to the
134
+ * ward's lifecycle starts its recognizer, as `when` would, and `feature` is asked for as a listener asks.
135
+ */
136
+ const gesture = (ward: AnyWard, name: Read, feature: AutoFeature | undefined, listen: (lifecycle: Lifecycle, set: (now: boolean) => void) => void): Accessor<boolean> => {
137
+ // A build-time flag: a server's ward has no lifecycle, and rests at `false`.
138
+ if (isServer) return constFalse
139
+ return kept(ward, name, () => {
140
+ const sensed = sensedOf(ward)
141
+ if (Predicate.isUndefined(sensed)) return constFalse
142
+ const of = readsOf(ward)
143
+ if (Predicate.isNotUndefined(of) && Predicate.isNotUndefined(feature)) of.ask(feature)
144
+ const [value, setValue] = createSignal(false)
145
+ listen(sensed.lifecycle, (now) => void setValue(now))
146
+ return value
147
+ })
148
+ }
149
+
150
+ /**
151
+ * `focusing`: a ward tells no focus events, so its element is watched by the Focus gesture of the ward's
152
+ * own Features, once that Feature and the element are both there, and again on another element.
153
+ */
154
+ const focus = (ward: AnyWard, of: ReadsOf): Accessor<boolean> => {
155
+ of.ask("focus")
156
+ const [value, setValue] = createSignal(false)
157
+ runWithOwner(of.owner, () => {
158
+ const runtime = useWardicRuntime()
159
+ const own = useInstanceFeatures(of.instance)
160
+ const onDefect = (cause: Cause.Cause<never>): void => {
161
+ runtime.runFork(Report.failure("wardic.createWard: its focus read failed", cause))
162
+ }
163
+ // Its gesture through a memo: an effect runs again whenever what it reads does, the same answer
164
+ // or not, and its ward's services change as each of its other Features arrives. Watched again
165
+ // then, it began at `false` with the focus still on its element.
166
+ const watching = createMemo(() => GestureFeatures.serviceIn(own.services(), Keys.FocusGesture), CLIENT_ONLY)
167
+ // Begun at the settle, as what needs an element on the page is: a function rune may take the read
168
+ // off its ward before the ward it's part of exists, and whose element it reads is known by then
169
+ // (`drivenBy`, which nothing follows). Begun as the read was made, it looked the element up on its
170
+ // own ward, and found the right one only when its services happened to change afterwards.
171
+ onSettledClientOnly(() => {
172
+ runWithOwner(of.owner, () => {
173
+ createEffect(
174
+ () => ({ element: elementOf(ward), watch: watching() }),
175
+ ({ element, watch }) => {
176
+ if (Predicate.isUndefined(element)) return undefined
177
+ if (Predicate.isUndefined(watch)) return undefined
178
+ const scope = OwnerScope.open(runtime)
179
+ runtime.runSync(watch.watch(element, {}, { on: (now) => void setValue(now), onDefect }).pipe(Scope.provide(scope)))
180
+ // Its cleanup: before the next element's watch, and as the ward ends.
181
+ return () => {
182
+ OwnerScope.close(runtime, scope, "wardic.createWard: its focus read's finalizer failed")
183
+ setValue(false)
184
+ }
185
+ },
186
+ CLIENT_ONLY,
187
+ )
188
+ })
189
+ })
190
+ })
191
+ return value
192
+ }
193
+
194
+ // Each getter is one function for every ward: `this` is the ward it's read on.
195
+
196
+ function hovering(this: AnyWard): Accessor<boolean> {
197
+ return gesture(this, "hovering", "hover", (lifecycle, set) => {
198
+ lifecycle.listen("hoverStart", heard(() => set(true)))
199
+ lifecycle.listen("hoverEnd", heard(() => set(false)))
200
+ })
201
+ }
202
+
203
+ function pressing(this: AnyWard): Accessor<boolean> {
204
+ return gesture(this, "pressing", "press", (lifecycle, set) => {
205
+ lifecycle.listen("pressStart", heard(() => set(true)))
206
+ lifecycle.listen("tap", heard(() => set(false)))
207
+ lifecycle.listen("tapCancel", heard(() => set(false)))
208
+ // A press a drag took over tells neither of the two above.
209
+ lifecycle.listen("dragStart", heard(() => set(false)))
210
+ })
211
+ }
212
+
213
+ function dragging(this: AnyWard): Accessor<boolean> {
214
+ // Nothing is asked for: a ward drags by its config's `drag`, which brought the Feature.
215
+ return gesture(this, "dragging", undefined, (lifecycle, set) => {
216
+ lifecycle.listen("dragStart", heard(() => set(true)))
217
+ lifecycle.listen("dragEnd", heard(() => set(false)))
218
+ })
219
+ }
220
+
221
+ function viewing(this: AnyWard): Accessor<boolean> {
222
+ return gesture(this, "viewing", "inView", (lifecycle, set) => {
223
+ lifecycle.listen("viewportEnter", heard(() => set(true)))
224
+ lifecycle.listen("viewportLeave", heard(() => set(false)))
225
+ })
226
+ }
227
+
228
+ function focusing(this: AnyWard): Accessor<boolean> {
229
+ if (isServer) return constFalse
230
+ return kept(this, "focusing", () => {
231
+ if (Predicate.isUndefined(sensedOf(this))) return constFalse
232
+ const of = readsOf(this)
233
+ // A ward with no Features of its own to ask (a Reorder's row): not read in this probe.
234
+ if (Predicate.isUndefined(of)) return constFalse
235
+ return focus(this, of)
236
+ })
237
+ }
238
+
239
+ function animating(this: AnyWard): Accessor<boolean> {
240
+ if (isServer) return constFalse
241
+ return kept(this, "animating", () => {
242
+ const ward = this as unknown as Ward
243
+ return () => isPending(() => ward.settled())
244
+ })
245
+ }
246
+
247
+ /**
248
+ * The six reads, as getters: shared by every client ward (`SHARED`, `ward.ts`), and a ward's own
249
+ * properties where it has no state to share them by. Not enumerable, so a spread never sees them.
250
+ */
251
+ export const READS: { readonly [K in Read]: PropertyDescriptor } = {
252
+ hovering: { get: hovering, configurable: true },
253
+ pressing: { get: pressing, configurable: true },
254
+ dragging: { get: dragging, configurable: true },
255
+ viewing: { get: viewing, configurable: true },
256
+ focusing: { get: focusing, configurable: true },
257
+ animating: { get: animating, configurable: true },
258
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * A rune's `ref` at work (probe: hooks-first): each rune's `ref` handed its ward's Subject while that's
3
+ * on show, and undone once it isn't (`RuneRef`, `rune.ts`). The same for every Environment: what its
4
+ * hooks give is the Subject on show, the page's an element and a Stage's what its Environment draws.
5
+ *
6
+ * - **A memo of the Subject on show, and one effect over it,** made only for a ward whose runes give a
7
+ * `ref` and that goes by a `show` or a presence's word. The memo is what makes the same Subject,
8
+ * still on show, no change: an effect runs again whenever what it reads does, whatever the answer,
9
+ * and a `ref` would run again on a Subject it has.
10
+ * - **The effect's own cleanup is the refs' undoing.** Solid runs it before the next Subject's refs,
11
+ * and as the owner the ward was made under ends.
12
+ * - **Once the Subject is on show:** the page's in the page by then, where Solid's own `ref` has it
13
+ * before. A page ward with no `show` has its binding run them as it mounts its element, its first
14
+ * target written, and undo them as it lets the element go, with nothing of their own made for them
15
+ * (`ward.ts`'s cheap `ref`, probe: behaviour-runes), until a presence takes it. A `show` ward's, and
16
+ * a taken one's, run after the flush that put the Subject on show, as an effect is. So within one
17
+ * flush the first kind's run before the second's, whatever their order on the page (the owner's yes,
18
+ * 2026-11-30); a ward's own runes' are in the order they were given, either way.
19
+ * - **Each `ref` is called as it is, and so is its undoing.** A signal either one reads as it runs is
20
+ * read once, and Solid reports it (`STRICT_READ_UNTRACKED`), as it reports one read in a `ref` of
21
+ * its own: the read won't update. The hooks called both under `untrack` at first, which kept a
22
+ * row's `ref` that read its `item` quiet, and kept as quiet a `ref` that meant to follow a signal
23
+ * and never would. A value read once on purpose is read outside the `ref`, or under `untrack`
24
+ * there, by whoever means it.
25
+ * - **Wherever its Subject is on show.** The page's hooks call this in a browser alone, nothing being
26
+ * on show on a server, and once the page has settled (`ward.ts`'s `refsAtWork`), or as a presence
27
+ * takes a ward whose binding ran them till then; a Stage's as its ward is made, wherever its Stage
28
+ * runs, which needn't be a browser. What's made here takes none of Solid's hydration ids.
29
+ * - **Nothing here writes a signal.** A memo derives, and an effect's callback calls the refs: what a
30
+ * `ref` writes is its own author's, from a listener.
31
+ *
32
+ * @module
33
+ */
34
+ import * as Arr from "effect/Array"
35
+ import * as Bool from "effect/Boolean"
36
+ import * as MutableRef from "effect/MutableRef"
37
+ import * as Option from "effect/Option"
38
+ import * as Predicate from "effect/Predicate"
39
+ import * as UndefinedOr from "effect/UndefinedOr"
40
+ import { type Accessor, createEffect, createMemo, onCleanup } from "solid-js"
41
+ import { CLIENT_ONLY } from "../solid-reactivity.ts"
42
+ import type { RuneRef } from "./rune.ts"
43
+
44
+ /** A `ref` of any rune's, whatever its Subject: its ward's hooks hand it the Subject it's typed for. */
45
+ export type AnyRef = RuneRef<never>
46
+
47
+ const isRef = (value: unknown): value is AnyRef => Predicate.isFunction(value)
48
+
49
+ /** What a `ref` gave back to undo it: nothing, for one with nothing to undo. */
50
+ const isUndoing = (value: void | (() => void)): value is () => void => Predicate.isFunction(value)
51
+
52
+ const undo = (undoing: () => void): void => undoing()
53
+
54
+ /** Every rune's `ref` among a ward's `configs`, in the order its runes were given. */
55
+ export const runeRefsOf = (configs: ReadonlyArray<object>): ReadonlyArray<AnyRef> =>
56
+ Arr.filter(
57
+ Arr.map(configs, (config) => (config as { readonly ref?: unknown }).ref),
58
+ isRef,
59
+ )
60
+
61
+ /** `refs` on a Subject, and what undoes them: what `attending` hands over from its first run. */
62
+ export interface Attended<Subject> {
63
+ readonly subject: Subject
64
+ readonly undo: () => void
65
+ }
66
+
67
+ /** Each of `refs` run on `subject` in turn, and what undoes them: what they gave back, in the reverse. */
68
+ export const refsRun = <Subject extends object>(refs: ReadonlyArray<AnyRef>, subject: Subject): (() => void) => {
69
+ const undoings = Arr.filter(
70
+ Arr.map(refs as ReadonlyArray<RuneRef<Subject>>, (ref) => ref(subject)),
71
+ isUndoing,
72
+ )
73
+ return () => Arr.forEach(Arr.reverse(undoings), undo)
74
+ }
75
+
76
+ /**
77
+ * `refs` run on what `subjectOnShow` gives, each time it gives another: the Subject its ward is on
78
+ * while that's on show, and nothing while it's hidden or gone. Each `ref` in turn, and what they gave
79
+ * back in the reverse once the Subject is on show no more.
80
+ *
81
+ * `already`, where they're on a Subject already, run there by its ward's mount (the cheap `ref`, `ward.ts`)
82
+ * until a presence took the ward: kept, not run again, while that's the Subject on show, and undone once
83
+ * it isn't. Undone too where the ward ends before this has run.
84
+ */
85
+ export const attending = <Subject extends object>(refs: ReadonlyArray<AnyRef>, subjectOnShow: Accessor<Subject | undefined>, already: Option.Option<Attended<Subject>> = Option.none()): void => {
86
+ if (Arr.isReadonlyArrayEmpty(refs)) return
87
+ // Held till the effect's first run takes it.
88
+ const handed = MutableRef.make(already)
89
+ if (Option.isSome(already)) onCleanup(() => void Option.map(MutableRef.getAndSet(handed, Option.none()), undoAttended))
90
+ const subject = createMemo(subjectOnShow, CLIENT_ONLY)
91
+ createEffect(subject, (now) => onShowFrom(refs, MutableRef.getAndSet(handed, Option.none()), now), CLIENT_ONLY)
92
+ }
93
+
94
+ const undoAttended = <Subject>(attended: Attended<Subject>): void => attended.undo()
95
+
96
+ /**
97
+ * `refs` on `now`, the Subject on show, and what undoes them: kept as they are where `handed` has them
98
+ * on it already, else what `handed` has undone first. Nothing with nothing on show.
99
+ */
100
+ const onShowFrom = <Subject extends object>(refs: ReadonlyArray<AnyRef>, handed: Option.Option<Attended<Subject>>, now: Subject | undefined): (() => void) | undefined =>
101
+ Option.match(handed, {
102
+ onNone: () => refsOn(refs, now),
103
+ onSome: (was) =>
104
+ Bool.match(now === was.subject, {
105
+ onTrue: () => was.undo,
106
+ onFalse: () => {
107
+ was.undo()
108
+ return refsOn(refs, now)
109
+ },
110
+ }),
111
+ })
112
+
113
+ /** `refs` run on `now`, where something's on show. */
114
+ const refsOn = <Subject extends object>(refs: ReadonlyArray<AnyRef>, now: Subject | undefined): (() => void) | undefined => UndefinedOr.map(now, (subject) => refsRun(refs, subject))