@wardic/solid 2.2.0 → 3.0.0-next.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 (541) hide show
  1. package/README.md +39 -18
  2. package/dist/browser/animation-frame.js +1 -1
  3. package/dist/browser/animation-frame.js.map +1 -1
  4. package/dist/browser/config-view.js +35 -6
  5. package/dist/browser/config-view.js.map +1 -1
  6. package/dist/browser/create-batch.js +1 -1
  7. package/dist/browser/diagnostic-codes.js +216 -0
  8. package/dist/browser/diagnostic-codes.js.map +1 -0
  9. package/dist/browser/diagnostics.js +79 -0
  10. package/dist/browser/diagnostics.js.map +1 -0
  11. package/dist/browser/element-style.js +61 -7
  12. package/dist/browser/element-style.js.map +1 -1
  13. package/dist/browser/element.js +24 -6
  14. package/dist/browser/element.js.map +1 -1
  15. package/dist/browser/feature-section.js +5 -13
  16. package/dist/browser/feature-section.js.map +1 -1
  17. package/dist/browser/frame-effect.js +1 -1
  18. package/dist/browser/frame-effect.js.map +1 -1
  19. package/dist/browser/gesture-callbacks.js +1 -1
  20. package/dist/browser/gesture-callbacks.js.map +1 -1
  21. package/dist/browser/hooks/auto.js +270 -0
  22. package/dist/browser/hooks/auto.js.map +1 -0
  23. package/dist/browser/hooks/config-scope.js +120 -0
  24. package/dist/browser/hooks/config-scope.js.map +1 -0
  25. package/dist/browser/hooks/config.js +37 -0
  26. package/dist/browser/hooks/config.js.map +1 -0
  27. package/dist/browser/hooks/drag.js +633 -0
  28. package/dist/browser/hooks/drag.js.map +1 -0
  29. package/dist/browser/hooks/elements.js +183 -0
  30. package/dist/browser/hooks/elements.js.map +1 -0
  31. package/dist/browser/hooks/group.js +28 -0
  32. package/dist/browser/hooks/group.js.map +1 -0
  33. package/dist/browser/hooks/index.js +10 -0
  34. package/dist/browser/hooks/index.js.map +1 -0
  35. package/dist/browser/hooks/kept.js +32 -0
  36. package/dist/browser/hooks/kept.js.map +1 -0
  37. package/dist/browser/hooks/layout-group-of.js +39 -0
  38. package/dist/browser/hooks/layout-group-of.js.map +1 -0
  39. package/dist/browser/hooks/layout-group.js +92 -0
  40. package/dist/browser/hooks/layout-group.js.map +1 -0
  41. package/dist/browser/hooks/make-ward.js +157 -0
  42. package/dist/browser/hooks/make-ward.js.map +1 -0
  43. package/dist/browser/hooks/presence-scope.js +88 -0
  44. package/dist/browser/hooks/presence-scope.js.map +1 -0
  45. package/dist/browser/hooks/presence.js +24 -0
  46. package/dist/browser/hooks/presence.js.map +1 -0
  47. package/dist/browser/hooks/props.js +148 -0
  48. package/dist/browser/hooks/props.js.map +1 -0
  49. package/dist/browser/hooks/reads.js +241 -0
  50. package/dist/browser/hooks/reads.js.map +1 -0
  51. package/dist/browser/hooks/refs.js +87 -0
  52. package/dist/browser/hooks/refs.js.map +1 -0
  53. package/dist/browser/hooks/reorder-elements.js +269 -0
  54. package/dist/browser/hooks/reorder-elements.js.map +1 -0
  55. package/dist/browser/hooks/reorder.js +176 -0
  56. package/dist/browser/hooks/reorder.js.map +1 -0
  57. package/dist/browser/hooks/rune.js +800 -0
  58. package/dist/browser/hooks/rune.js.map +1 -0
  59. package/dist/browser/hooks/server-features.client.js +2 -0
  60. package/dist/browser/hooks/server-features.client.js.map +1 -0
  61. package/dist/browser/hooks/server-features.js +13 -0
  62. package/dist/browser/hooks/server-features.js.map +1 -0
  63. package/dist/browser/hooks/settings.js +29 -0
  64. package/dist/browser/hooks/settings.js.map +1 -0
  65. package/dist/browser/hooks/setup.js +154 -0
  66. package/dist/browser/hooks/setup.js.map +1 -0
  67. package/dist/browser/hooks/stage.js +117 -0
  68. package/dist/browser/hooks/stage.js.map +1 -0
  69. package/dist/browser/hooks/ward.js +2212 -0
  70. package/dist/browser/hooks/ward.js.map +1 -0
  71. package/dist/browser/hooks/wardic-provider.js +29 -0
  72. package/dist/browser/hooks/wardic-provider.js.map +1 -0
  73. package/dist/browser/hooks/wardic-scope.js +68 -0
  74. package/dist/browser/hooks/wardic-scope.js.map +1 -0
  75. package/dist/browser/hooks/wards.js +563 -0
  76. package/dist/browser/hooks/wards.js.map +1 -0
  77. package/dist/browser/index.js +23 -11
  78. package/dist/browser/index.js.map +1 -1
  79. package/dist/browser/layout.js +7 -58
  80. package/dist/browser/layout.js.map +1 -1
  81. package/dist/browser/lazy-batch-gestures.js +1 -1
  82. package/dist/browser/lifecycle.js +37 -0
  83. package/dist/browser/lifecycle.js.map +1 -1
  84. package/dist/browser/presence-handle.js +28 -12
  85. package/dist/browser/presence-handle.js.map +1 -1
  86. package/dist/browser/presence.js +3 -1
  87. package/dist/browser/presence.js.map +1 -1
  88. package/dist/browser/provider.js +124 -90
  89. package/dist/browser/provider.js.map +1 -1
  90. package/dist/browser/reorder-components.js +50 -0
  91. package/dist/browser/reorder-components.js.map +1 -0
  92. package/dist/browser/reorder.js +51 -278
  93. package/dist/browser/reorder.js.map +1 -1
  94. package/dist/browser/runtime.js +26 -15
  95. package/dist/browser/runtime.js.map +1 -1
  96. package/dist/browser/spans-check.js +8 -3
  97. package/dist/browser/spans-check.js.map +1 -1
  98. package/dist/browser/stage.js.map +1 -1
  99. package/dist/browser/unstable/v2/index.js +0 -8
  100. package/dist/browser/unstable/v2/index.js.map +1 -1
  101. package/dist/browser/v1/index.js +1 -1
  102. package/dist/browser/v1/index.js.map +1 -1
  103. package/dist/browser/variant-node.js +4 -2
  104. package/dist/browser/variant-node.js.map +1 -1
  105. package/dist/browser/w.js +33 -3
  106. package/dist/browser/w.js.map +1 -1
  107. package/dist/browser/ward.js +594 -61
  108. package/dist/browser/ward.js.map +1 -1
  109. package/dist/browser/wardic-config.js +62 -29
  110. package/dist/browser/wardic-config.js.map +1 -1
  111. package/dist/browser/wardic-context.js +23 -0
  112. package/dist/browser/wardic-context.js.map +1 -0
  113. package/dist/browser/wardic.js +3 -0
  114. package/dist/browser/wardic.js.map +1 -1
  115. package/dist/server/animation-frame.js +1 -1
  116. package/dist/server/animation-frame.js.map +1 -1
  117. package/dist/server/config-view.js +35 -6
  118. package/dist/server/config-view.js.map +1 -1
  119. package/dist/server/create-batch.js +1 -1
  120. package/dist/server/diagnostic-codes.js +216 -0
  121. package/dist/server/diagnostic-codes.js.map +1 -0
  122. package/dist/server/diagnostics.js +79 -0
  123. package/dist/server/diagnostics.js.map +1 -0
  124. package/dist/server/element-style.js +61 -7
  125. package/dist/server/element-style.js.map +1 -1
  126. package/dist/server/element.js +24 -6
  127. package/dist/server/element.js.map +1 -1
  128. package/dist/server/feature-section.js +5 -13
  129. package/dist/server/feature-section.js.map +1 -1
  130. package/dist/server/frame-effect.js +1 -1
  131. package/dist/server/frame-effect.js.map +1 -1
  132. package/dist/server/gesture-callbacks.js +1 -1
  133. package/dist/server/gesture-callbacks.js.map +1 -1
  134. package/dist/server/hooks/auto.js +270 -0
  135. package/dist/server/hooks/auto.js.map +1 -0
  136. package/dist/server/hooks/config-scope.js +120 -0
  137. package/dist/server/hooks/config-scope.js.map +1 -0
  138. package/dist/server/hooks/config.js +37 -0
  139. package/dist/server/hooks/config.js.map +1 -0
  140. package/dist/server/hooks/drag.js +633 -0
  141. package/dist/server/hooks/drag.js.map +1 -0
  142. package/dist/server/hooks/elements.js +192 -0
  143. package/dist/server/hooks/elements.js.map +1 -0
  144. package/dist/server/hooks/group.js +28 -0
  145. package/dist/server/hooks/group.js.map +1 -0
  146. package/dist/server/hooks/index.js +10 -0
  147. package/dist/server/hooks/index.js.map +1 -0
  148. package/dist/server/hooks/kept.js +32 -0
  149. package/dist/server/hooks/kept.js.map +1 -0
  150. package/dist/server/hooks/layout-group-of.js +39 -0
  151. package/dist/server/hooks/layout-group-of.js.map +1 -0
  152. package/dist/server/hooks/layout-group.js +109 -0
  153. package/dist/server/hooks/layout-group.js.map +1 -0
  154. package/dist/server/hooks/make-ward.js +157 -0
  155. package/dist/server/hooks/make-ward.js.map +1 -0
  156. package/dist/server/hooks/presence-scope.js +87 -0
  157. package/dist/server/hooks/presence-scope.js.map +1 -0
  158. package/dist/server/hooks/presence.js +24 -0
  159. package/dist/server/hooks/presence.js.map +1 -0
  160. package/dist/server/hooks/props.js +148 -0
  161. package/dist/server/hooks/props.js.map +1 -0
  162. package/dist/server/hooks/reads.js +241 -0
  163. package/dist/server/hooks/reads.js.map +1 -0
  164. package/dist/server/hooks/refs.js +87 -0
  165. package/dist/server/hooks/refs.js.map +1 -0
  166. package/dist/server/hooks/reorder-elements.js +309 -0
  167. package/dist/server/hooks/reorder-elements.js.map +1 -0
  168. package/dist/server/hooks/reorder.js +176 -0
  169. package/dist/server/hooks/reorder.js.map +1 -0
  170. package/dist/server/hooks/rune.js +800 -0
  171. package/dist/server/hooks/rune.js.map +1 -0
  172. package/dist/server/hooks/server-features.client.js +2 -0
  173. package/dist/server/hooks/server-features.client.js.map +1 -0
  174. package/dist/server/hooks/server-features.js +13 -0
  175. package/dist/server/hooks/server-features.js.map +1 -0
  176. package/dist/server/hooks/settings.js +29 -0
  177. package/dist/server/hooks/settings.js.map +1 -0
  178. package/dist/server/hooks/setup.js +154 -0
  179. package/dist/server/hooks/setup.js.map +1 -0
  180. package/dist/server/hooks/stage.js +117 -0
  181. package/dist/server/hooks/stage.js.map +1 -0
  182. package/dist/server/hooks/ward.js +2212 -0
  183. package/dist/server/hooks/ward.js.map +1 -0
  184. package/dist/server/hooks/wardic-provider.js +29 -0
  185. package/dist/server/hooks/wardic-provider.js.map +1 -0
  186. package/dist/server/hooks/wardic-scope.js +68 -0
  187. package/dist/server/hooks/wardic-scope.js.map +1 -0
  188. package/dist/server/hooks/wards.js +563 -0
  189. package/dist/server/hooks/wards.js.map +1 -0
  190. package/dist/server/index.js +23 -11
  191. package/dist/server/index.js.map +1 -1
  192. package/dist/server/layout.js +7 -75
  193. package/dist/server/layout.js.map +1 -1
  194. package/dist/server/lazy-batch-gestures.js +1 -1
  195. package/dist/server/lifecycle.js +37 -0
  196. package/dist/server/lifecycle.js.map +1 -1
  197. package/dist/server/presence-handle.js +28 -12
  198. package/dist/server/presence-handle.js.map +1 -1
  199. package/dist/server/presence.js +3 -1
  200. package/dist/server/presence.js.map +1 -1
  201. package/dist/server/provider.js +125 -100
  202. package/dist/server/provider.js.map +1 -1
  203. package/dist/server/reorder-components.js +50 -0
  204. package/dist/server/reorder-components.js.map +1 -0
  205. package/dist/server/reorder.js +51 -348
  206. package/dist/server/reorder.js.map +1 -1
  207. package/dist/server/runtime.js +26 -15
  208. package/dist/server/runtime.js.map +1 -1
  209. package/dist/server/spans-check.js +8 -3
  210. package/dist/server/spans-check.js.map +1 -1
  211. package/dist/server/stage.js.map +1 -1
  212. package/dist/server/unstable/v2/index.js +0 -8
  213. package/dist/server/unstable/v2/index.js.map +1 -1
  214. package/dist/server/v1/index.js +1 -1
  215. package/dist/server/v1/index.js.map +1 -1
  216. package/dist/server/variant-node.js +4 -2
  217. package/dist/server/variant-node.js.map +1 -1
  218. package/dist/server/w.js +33 -3
  219. package/dist/server/w.js.map +1 -1
  220. package/dist/server/ward.js +594 -61
  221. package/dist/server/ward.js.map +1 -1
  222. package/dist/server/wardic-config.js +63 -30
  223. package/dist/server/wardic-config.js.map +1 -1
  224. package/dist/server/wardic-context.js +23 -0
  225. package/dist/server/wardic-context.js.map +1 -0
  226. package/dist/server/wardic.js +3 -0
  227. package/dist/server/wardic.js.map +1 -1
  228. package/dist/solid/animation-frame.js +1 -1
  229. package/dist/solid/animation-frame.js.map +1 -1
  230. package/dist/solid/batch-reorder-group.d.ts +1 -1
  231. package/dist/solid/batch-reorder.d.ts +1 -1
  232. package/dist/solid/batch-reorder.d.ts.map +1 -1
  233. package/dist/solid/config-view.d.ts +11 -0
  234. package/dist/solid/config-view.d.ts.map +1 -1
  235. package/dist/solid/config-view.js +31 -7
  236. package/dist/solid/config-view.js.map +1 -1
  237. package/dist/solid/create-batch.jsx +1 -1
  238. package/dist/solid/diagnostic-codes.d.ts +10 -0
  239. package/dist/solid/diagnostic-codes.d.ts.map +1 -0
  240. package/dist/solid/diagnostic-codes.js +246 -0
  241. package/dist/solid/diagnostic-codes.js.map +1 -0
  242. package/dist/solid/diagnostics.d.ts +33 -0
  243. package/dist/solid/diagnostics.d.ts.map +1 -0
  244. package/dist/solid/diagnostics.js +76 -0
  245. package/dist/solid/diagnostics.js.map +1 -0
  246. package/dist/solid/element-style.d.ts +16 -2
  247. package/dist/solid/element-style.d.ts.map +1 -1
  248. package/dist/solid/element-style.js +61 -7
  249. package/dist/solid/element-style.js.map +1 -1
  250. package/dist/solid/element.d.ts +3 -1
  251. package/dist/solid/element.d.ts.map +1 -1
  252. package/dist/solid/element.jsx +27 -8
  253. package/dist/solid/element.jsx.map +1 -1
  254. package/dist/solid/feature-section.d.ts +0 -7
  255. package/dist/solid/feature-section.d.ts.map +1 -1
  256. package/dist/solid/feature-section.js +5 -13
  257. package/dist/solid/feature-section.js.map +1 -1
  258. package/dist/solid/frame-effect.jsx +1 -1
  259. package/dist/solid/frame-effect.jsx.map +1 -1
  260. package/dist/solid/gesture-callbacks.js +1 -1
  261. package/dist/solid/gesture-callbacks.js.map +1 -1
  262. package/dist/solid/hooks/auto.d.ts +44 -0
  263. package/dist/solid/hooks/auto.d.ts.map +1 -0
  264. package/dist/solid/hooks/auto.js +269 -0
  265. package/dist/solid/hooks/auto.js.map +1 -0
  266. package/dist/solid/hooks/config-scope.d.ts +84 -0
  267. package/dist/solid/hooks/config-scope.d.ts.map +1 -0
  268. package/dist/solid/hooks/config-scope.jsx +128 -0
  269. package/dist/solid/hooks/config-scope.jsx.map +1 -0
  270. package/dist/solid/hooks/config.d.ts +28 -0
  271. package/dist/solid/hooks/config.d.ts.map +1 -0
  272. package/dist/solid/hooks/config.jsx +37 -0
  273. package/dist/solid/hooks/config.jsx.map +1 -0
  274. package/dist/solid/hooks/drag.d.ts +220 -0
  275. package/dist/solid/hooks/drag.d.ts.map +1 -0
  276. package/dist/solid/hooks/drag.js +586 -0
  277. package/dist/solid/hooks/drag.js.map +1 -0
  278. package/dist/solid/hooks/elements.d.ts +11 -0
  279. package/dist/solid/hooks/elements.d.ts.map +1 -0
  280. package/dist/solid/hooks/elements.jsx +218 -0
  281. package/dist/solid/hooks/elements.jsx.map +1 -0
  282. package/dist/solid/hooks/group.d.ts +46 -0
  283. package/dist/solid/hooks/group.d.ts.map +1 -0
  284. package/dist/solid/hooks/group.jsx +25 -0
  285. package/dist/solid/hooks/group.jsx.map +1 -0
  286. package/dist/solid/hooks/index.d.ts +28 -0
  287. package/dist/solid/hooks/index.d.ts.map +1 -0
  288. package/dist/solid/hooks/index.js +10 -0
  289. package/dist/solid/hooks/index.js.map +1 -0
  290. package/dist/solid/hooks/kept.d.ts +60 -0
  291. package/dist/solid/hooks/kept.d.ts.map +1 -0
  292. package/dist/solid/hooks/kept.js +33 -0
  293. package/dist/solid/hooks/kept.js.map +1 -0
  294. package/dist/solid/hooks/layout-group-of.d.ts +27 -0
  295. package/dist/solid/hooks/layout-group-of.d.ts.map +1 -0
  296. package/dist/solid/hooks/layout-group-of.js +39 -0
  297. package/dist/solid/hooks/layout-group-of.js.map +1 -0
  298. package/dist/solid/hooks/layout-group.d.ts +60 -0
  299. package/dist/solid/hooks/layout-group.d.ts.map +1 -0
  300. package/dist/solid/hooks/layout-group.jsx +80 -0
  301. package/dist/solid/hooks/layout-group.jsx.map +1 -0
  302. package/dist/solid/hooks/make-ward.d.ts +123 -0
  303. package/dist/solid/hooks/make-ward.d.ts.map +1 -0
  304. package/dist/solid/hooks/make-ward.js +147 -0
  305. package/dist/solid/hooks/make-ward.js.map +1 -0
  306. package/dist/solid/hooks/presence-scope.d.ts +84 -0
  307. package/dist/solid/hooks/presence-scope.d.ts.map +1 -0
  308. package/dist/solid/hooks/presence-scope.jsx +63 -0
  309. package/dist/solid/hooks/presence-scope.jsx.map +1 -0
  310. package/dist/solid/hooks/presence.d.ts +51 -0
  311. package/dist/solid/hooks/presence.d.ts.map +1 -0
  312. package/dist/solid/hooks/presence.jsx +26 -0
  313. package/dist/solid/hooks/presence.jsx.map +1 -0
  314. package/dist/solid/hooks/props.d.ts +52 -0
  315. package/dist/solid/hooks/props.d.ts.map +1 -0
  316. package/dist/solid/hooks/props.js +140 -0
  317. package/dist/solid/hooks/props.js.map +1 -0
  318. package/dist/solid/hooks/reads.d.ts +38 -0
  319. package/dist/solid/hooks/reads.d.ts.map +1 -0
  320. package/dist/solid/hooks/reads.js +218 -0
  321. package/dist/solid/hooks/reads.js.map +1 -0
  322. package/dist/solid/hooks/refs.d.ts +25 -0
  323. package/dist/solid/hooks/refs.d.ts.map +1 -0
  324. package/dist/solid/hooks/refs.js +89 -0
  325. package/dist/solid/hooks/refs.js.map +1 -0
  326. package/dist/solid/hooks/reorder-elements.d.ts +23 -0
  327. package/dist/solid/hooks/reorder-elements.d.ts.map +1 -0
  328. package/dist/solid/hooks/reorder-elements.jsx +274 -0
  329. package/dist/solid/hooks/reorder-elements.jsx.map +1 -0
  330. package/dist/solid/hooks/reorder.d.ts +55 -0
  331. package/dist/solid/hooks/reorder.d.ts.map +1 -0
  332. package/dist/solid/hooks/reorder.js +152 -0
  333. package/dist/solid/hooks/reorder.js.map +1 -0
  334. package/dist/solid/hooks/rune.d.ts +885 -0
  335. package/dist/solid/hooks/rune.d.ts.map +1 -0
  336. package/dist/solid/hooks/rune.js +817 -0
  337. package/dist/solid/hooks/rune.js.map +1 -0
  338. package/dist/solid/hooks/server-features.client.d.ts +10 -0
  339. package/dist/solid/hooks/server-features.client.d.ts.map +1 -0
  340. package/dist/solid/hooks/server-features.client.js +2 -0
  341. package/dist/solid/hooks/server-features.client.js.map +1 -0
  342. package/dist/solid/hooks/server-features.d.ts +10 -0
  343. package/dist/solid/hooks/server-features.d.ts.map +1 -0
  344. package/dist/solid/hooks/server-features.js +13 -0
  345. package/dist/solid/hooks/server-features.js.map +1 -0
  346. package/dist/solid/hooks/settings.d.ts +11 -0
  347. package/dist/solid/hooks/settings.d.ts.map +1 -0
  348. package/dist/solid/hooks/settings.js +31 -0
  349. package/dist/solid/hooks/settings.js.map +1 -0
  350. package/dist/solid/hooks/setup.d.ts +31 -0
  351. package/dist/solid/hooks/setup.d.ts.map +1 -0
  352. package/dist/solid/hooks/setup.js +155 -0
  353. package/dist/solid/hooks/setup.js.map +1 -0
  354. package/dist/solid/hooks/stage.d.ts +187 -0
  355. package/dist/solid/hooks/stage.d.ts.map +1 -0
  356. package/dist/solid/hooks/stage.js +117 -0
  357. package/dist/solid/hooks/stage.js.map +1 -0
  358. package/dist/solid/hooks/ward.d.ts +394 -0
  359. package/dist/solid/hooks/ward.d.ts.map +1 -0
  360. package/dist/solid/hooks/ward.js +2258 -0
  361. package/dist/solid/hooks/ward.js.map +1 -0
  362. package/dist/solid/hooks/wardic-provider.d.ts +32 -0
  363. package/dist/solid/hooks/wardic-provider.d.ts.map +1 -0
  364. package/dist/solid/hooks/wardic-provider.jsx +29 -0
  365. package/dist/solid/hooks/wardic-provider.jsx.map +1 -0
  366. package/dist/solid/hooks/wardic-scope.d.ts +49 -0
  367. package/dist/solid/hooks/wardic-scope.d.ts.map +1 -0
  368. package/dist/solid/hooks/wardic-scope.jsx +63 -0
  369. package/dist/solid/hooks/wardic-scope.jsx.map +1 -0
  370. package/dist/solid/hooks/wards.d.ts +157 -0
  371. package/dist/solid/hooks/wards.d.ts.map +1 -0
  372. package/dist/solid/hooks/wards.js +523 -0
  373. package/dist/solid/hooks/wards.js.map +1 -0
  374. package/dist/solid/index.d.ts +21 -14
  375. package/dist/solid/index.d.ts.map +1 -1
  376. package/dist/solid/index.jsx +23 -11
  377. package/dist/solid/index.jsx.map +1 -1
  378. package/dist/solid/layout.d.ts +2 -44
  379. package/dist/solid/layout.d.ts.map +1 -1
  380. package/dist/solid/layout.jsx +7 -49
  381. package/dist/solid/layout.jsx.map +1 -1
  382. package/dist/solid/lazy-batch-gestures.js +1 -1
  383. package/dist/solid/lazy-batch-gestures.js.map +1 -1
  384. package/dist/solid/lifecycle.d.ts +19 -0
  385. package/dist/solid/lifecycle.d.ts.map +1 -1
  386. package/dist/solid/lifecycle.js +40 -0
  387. package/dist/solid/lifecycle.js.map +1 -1
  388. package/dist/solid/presence-handle.d.ts +13 -6
  389. package/dist/solid/presence-handle.d.ts.map +1 -1
  390. package/dist/solid/presence-handle.js +30 -12
  391. package/dist/solid/presence-handle.js.map +1 -1
  392. package/dist/solid/presence.d.ts +3 -1
  393. package/dist/solid/presence.d.ts.map +1 -1
  394. package/dist/solid/presence.jsx +3 -1
  395. package/dist/solid/presence.jsx.map +1 -1
  396. package/dist/solid/provider.d.ts +25 -32
  397. package/dist/solid/provider.d.ts.map +1 -1
  398. package/dist/solid/provider.jsx +126 -82
  399. package/dist/solid/provider.jsx.map +1 -1
  400. package/dist/solid/reorder-components.d.ts +32 -0
  401. package/dist/solid/reorder-components.d.ts.map +1 -0
  402. package/dist/solid/reorder-components.jsx +49 -0
  403. package/dist/solid/reorder-components.jsx.map +1 -0
  404. package/dist/solid/reorder.d.ts +50 -76
  405. package/dist/solid/reorder.d.ts.map +1 -1
  406. package/dist/solid/reorder.jsx +45 -206
  407. package/dist/solid/reorder.jsx.map +1 -1
  408. package/dist/solid/runtime.d.ts +20 -7
  409. package/dist/solid/runtime.d.ts.map +1 -1
  410. package/dist/solid/runtime.js +25 -14
  411. package/dist/solid/runtime.js.map +1 -1
  412. package/dist/solid/spans-check.d.ts +5 -1
  413. package/dist/solid/spans-check.d.ts.map +1 -1
  414. package/dist/solid/spans-check.js +8 -3
  415. package/dist/solid/spans-check.js.map +1 -1
  416. package/dist/solid/stage.d.ts +14 -0
  417. package/dist/solid/stage.d.ts.map +1 -1
  418. package/dist/solid/stage.js.map +1 -1
  419. package/dist/solid/unstable/v2/index.d.ts +2 -26
  420. package/dist/solid/unstable/v2/index.d.ts.map +1 -1
  421. package/dist/solid/unstable/v2/index.jsx +0 -16
  422. package/dist/solid/unstable/v2/index.jsx.map +1 -1
  423. package/dist/solid/v1/index.d.ts +1 -1
  424. package/dist/solid/v1/index.d.ts.map +1 -1
  425. package/dist/solid/v1/index.jsx +1 -1
  426. package/dist/solid/v1/index.jsx.map +1 -1
  427. package/dist/solid/variant-node.d.ts +6 -0
  428. package/dist/solid/variant-node.d.ts.map +1 -1
  429. package/dist/solid/variant-node.js +2 -0
  430. package/dist/solid/variant-node.js.map +1 -1
  431. package/dist/solid/w.d.ts +9 -3
  432. package/dist/solid/w.d.ts.map +1 -1
  433. package/dist/solid/w.jsx +36 -3
  434. package/dist/solid/w.jsx.map +1 -1
  435. package/dist/solid/ward.d.ts +134 -7
  436. package/dist/solid/ward.d.ts.map +1 -1
  437. package/dist/solid/ward.jsx +564 -60
  438. package/dist/solid/ward.jsx.map +1 -1
  439. package/dist/solid/wardic-config.d.ts +17 -12
  440. package/dist/solid/wardic-config.d.ts.map +1 -1
  441. package/dist/solid/wardic-config.jsx +68 -22
  442. package/dist/solid/wardic-config.jsx.map +1 -1
  443. package/dist/solid/wardic-context.d.ts +15 -0
  444. package/dist/solid/wardic-context.d.ts.map +1 -0
  445. package/dist/solid/wardic-context.js +23 -0
  446. package/dist/solid/wardic-context.js.map +1 -0
  447. package/dist/solid/wardic-instance.d.ts +6 -4
  448. package/dist/solid/wardic-instance.d.ts.map +1 -1
  449. package/dist/solid/wardic.d.ts +3 -0
  450. package/dist/solid/wardic.d.ts.map +1 -1
  451. package/dist/solid/wardic.jsx +3 -0
  452. package/dist/solid/wardic.jsx.map +1 -1
  453. package/package.json +29 -7
  454. package/skills/wardic-diagnostics/SKILL.md +472 -0
  455. package/skills/wardic-migrate/SKILL.md +204 -0
  456. package/skills/wardic-solid/SKILL.md +60 -0
  457. package/skills/wardic-solid/events.md +70 -0
  458. package/skills/wardic-solid/from-motion.md +59 -0
  459. package/skills/wardic-solid/lists-and-presence.md +110 -0
  460. package/skills/wardic-solid/reorder-and-grips.md +88 -0
  461. package/skills/wardic-solid/runes.md +151 -0
  462. package/skills/wardic-solid/scopes-and-settings.md +75 -0
  463. package/src/animation-frame.ts +1 -1
  464. package/src/batch-reorder-group.tsx +1 -1
  465. package/src/batch-reorder.ts +1 -1
  466. package/src/config-view.ts +35 -7
  467. package/src/create-batch.tsx +1 -1
  468. package/src/diagnostic-codes.ts +254 -0
  469. package/src/diagnostics.ts +88 -0
  470. package/src/element-style.ts +77 -9
  471. package/src/element.tsx +36 -12
  472. package/src/feature-section.ts +5 -15
  473. package/src/frame-effect.tsx +1 -1
  474. package/src/gesture-callbacks.ts +1 -1
  475. package/src/hooks/auto.ts +303 -0
  476. package/src/hooks/config-scope.tsx +215 -0
  477. package/src/hooks/config.tsx +54 -0
  478. package/src/hooks/drag.ts +741 -0
  479. package/src/hooks/elements.tsx +234 -0
  480. package/src/hooks/group.tsx +55 -0
  481. package/src/hooks/index.ts +41 -0
  482. package/src/hooks/kept.ts +89 -0
  483. package/src/hooks/layout-group-of.ts +46 -0
  484. package/src/hooks/layout-group.tsx +111 -0
  485. package/src/hooks/make-ward.ts +218 -0
  486. package/src/hooks/presence-scope.tsx +156 -0
  487. package/src/hooks/presence.tsx +67 -0
  488. package/src/hooks/props.ts +190 -0
  489. package/src/hooks/reads.ts +258 -0
  490. package/src/hooks/refs.ts +114 -0
  491. package/src/hooks/reorder-elements.tsx +323 -0
  492. package/src/hooks/reorder.ts +205 -0
  493. package/src/hooks/rune.ts +1756 -0
  494. package/src/hooks/server-features.client.ts +10 -0
  495. package/src/hooks/server-features.ts +12 -0
  496. package/src/hooks/settings.ts +44 -0
  497. package/src/hooks/setup.ts +184 -0
  498. package/src/hooks/stage.ts +359 -0
  499. package/src/hooks/ward.ts +2587 -0
  500. package/src/hooks/wardic-provider.tsx +51 -0
  501. package/src/hooks/wardic-scope.tsx +112 -0
  502. package/src/hooks/wards.ts +681 -0
  503. package/src/index.tsx +27 -15
  504. package/src/layout.tsx +7 -74
  505. package/src/lazy-batch-gestures.ts +1 -1
  506. package/src/lifecycle.ts +40 -0
  507. package/src/presence-handle.ts +39 -20
  508. package/src/presence.tsx +3 -1
  509. package/src/provider.tsx +136 -88
  510. package/src/reorder-components.tsx +61 -0
  511. package/src/reorder.tsx +89 -307
  512. package/src/runtime.ts +43 -13
  513. package/src/spans-check.ts +12 -3
  514. package/src/stage.ts +15 -0
  515. package/src/unstable/v2/index.tsx +2 -26
  516. package/src/v1/index.tsx +1 -1
  517. package/src/variant-node.ts +8 -0
  518. package/src/w.tsx +38 -5
  519. package/src/ward.tsx +694 -60
  520. package/src/wardic-config.tsx +68 -21
  521. package/src/wardic-context.ts +26 -0
  522. package/src/wardic-instance.ts +6 -4
  523. package/src/wardic.tsx +3 -0
  524. package/dist/browser/create-wardic.js +0 -36
  525. package/dist/browser/create-wardic.js.map +0 -1
  526. package/dist/browser/presence-hooks.js +0 -144
  527. package/dist/browser/presence-hooks.js.map +0 -1
  528. package/dist/server/create-wardic.js +0 -36
  529. package/dist/server/create-wardic.js.map +0 -1
  530. package/dist/server/presence-hooks.js +0 -144
  531. package/dist/server/presence-hooks.js.map +0 -1
  532. package/dist/solid/create-wardic.d.ts +0 -25
  533. package/dist/solid/create-wardic.d.ts.map +0 -1
  534. package/dist/solid/create-wardic.jsx +0 -34
  535. package/dist/solid/create-wardic.jsx.map +0 -1
  536. package/dist/solid/presence-hooks.d.ts +0 -53
  537. package/dist/solid/presence-hooks.d.ts.map +0 -1
  538. package/dist/solid/presence-hooks.jsx +0 -117
  539. package/dist/solid/presence-hooks.jsx.map +0 -1
  540. package/src/create-wardic.tsx +0 -46
  541. package/src/presence-hooks.tsx +0 -159
@@ -46,6 +46,7 @@ function _P$2(_p3, _p4) {
46
46
  Object.defineProperty(this, "children", _d$4);
47
47
  }
48
48
  _P$2.prototype = Object.prototype;
49
+ import * as InputSource from "@wardic/core/InputSource";
49
50
  import * as Press from "@wardic/dom/unstable/Press";
50
51
  import * as Report from "@wardic/dom/Report";
51
52
  import * as Renderer from "@wardic/core/Renderer";
@@ -63,10 +64,11 @@ import * as Predicate from "effect/Predicate";
63
64
  import * as UndefinedOr from "effect/UndefinedOr";
64
65
  import * as Atom from "effect/reactivity/Atom";
65
66
  import { isServer, useHead } from "@solidjs/web";
66
- import { createEffect, createMemo, createSignal, createUniqueId, DEV, getOwner, isHydrating, onCleanup, runWithOwner, untrack } from "solid-js";
67
+ import { createEffect, createMemo, createSignal, createUniqueId, DEV, getOwner, isHydrating, onCleanup, refresh, runWithOwner, untrack } from "solid-js";
67
68
  import { MOTION_PROPS_V2 } from "./motion-props.js";
68
69
  import * as OwnerScope from "@wardic/dom/unstable/OwnerScope";
69
70
  import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures";
71
+ import { misuse, report } from "./diagnostics.js";
70
72
  import { inViewOptionsOf } from "./gesture-callbacks.js";
71
73
  import * as Keys from "@wardic/dom/unstable/features/Keys";
72
74
  import { createElementStyle } from "./element-style.js";
@@ -87,13 +89,20 @@ import { appearStyle, useWardicAppear, useWardicGate, useWardicValueReads, useWa
87
89
  import * as Feature from "@wardic/dom/unstable/Feature";
88
90
  import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED, CLIENT_ONLY_SYNC, CLIENT_ONLY_SYNC_DEFERRED, firstCallOwnerHere, reactivityIn } from "./solid-reactivity.js";
89
91
  import { useWardicConfig } from "./wardic-config.js";
90
- import { configView } from "./config-view.js";
92
+ import { configView, fixedOver, fixMore } from "./config-view.js";
91
93
  import { Lifecycle } from "./lifecycle.js";
92
94
  import { neverLands, NO_EVENTS, serverWhen } from "./waiters.js";
93
95
  import { usePresenceContext } from "./presence.js";
94
96
  import { createVariantNode, useVariantContext, WardicVariantContext } from "./variant-node.js";
95
97
  /** The entry a missing Feature's message tells the app to import it from: this binding's (#566). */
96
98
  const ENTRY = "@wardic/solid";
99
+ /**
100
+ * Development's word on a missing Feature (#511), with how a Solid 2 app adds it: dom's default names
101
+ * `<LazyWardic>`, Solid 1's still, deleted from Solid 2 (probe: behaviour-runes, after the scopes round).
102
+ */
103
+ const missingMessage = (feature, what) => Feature.missingMessage(feature, what, ENTRY, `which this element's WardicProvider doesn't have. Add it: \`import { ${feature} } from "${ENTRY}"\`, then \`<WardicProvider features={[${feature}]}>\`, or give it to \`makeWard({ features })\`.`);
104
+ /** Development's word on a missing Feature, once a provider, as its coded diagnostic (solid-next). */
105
+ const warnMissing = (registry, feature, what) => registry.warnOnce(feature, missingMessage(feature, what), "WARDIC_FEATURE_MISSING");
97
106
  /** Every key a ward reads, its callbacks among them. */
98
107
  const WARD_KEYS = ["initial", "animate", "variants", "custom", "inherit", "whileHover", "whileTap", "whileInView", "whileFocus", "viewport", "drag", "whileDrag", "dragConstraints", "dragElastic", "dragMomentum", "dragSnapToOrigin", "dragTransition", "dragPropagation", "propagate", "dragDirectionLock", "dragControls", "dragListener", "onMeasureDragConstraints", "transition", "exit", "layout", "layoutDependency", "layoutId", "layoutScroll", "layoutRoot", "layoutAnchor", "layoutCrossfade", "onUpdate", "transformTemplate", "onBeforeLayoutMeasure", "onLayoutMeasure", "appear", "style", "key"];
99
108
  const everyKeyRead = true;
@@ -115,7 +124,7 @@ export const WARD_VIEW = configView(WARD_KEYS, ["onUpdate", "dragConstraints", "
115
124
  /** `config` read per key (#259), for a read outside a ward: a `wardic.<tag>`'s props at setup. Internal. */
116
125
  export const wardConfigView = config => WARD_VIEW.of(config);
117
126
  /** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
118
- const WHOLE_ACCESSOR = "ward(config) takes its config as an object, read per key (#259): make a key reactive with an accessor " + "(`ward({ animate: () => ({ x: x() }) })`), a getter, a store or a component's props, not the whole config " + "(`ward(() => ({ … }))`).";
127
+ const WHOLE_ACCESSOR = "ward(config) takes its config as an object, read per key: make a key reactive with an accessor " + "(`ward({ animate: () => ({ x: x() }) })`), a getter, a store or a component's props, not the whole config " + "(`ward(() => ({ … }))`).";
119
128
  /**
120
129
  * A ward's mark (#349): what tells a ward given to a component's `wardRef` from a function handed the
121
130
  * component's own ward. Internal: its value is the ward's {@link WardShare}.
@@ -204,7 +213,9 @@ const WARD_MEMBER_KEYS = {
204
213
  return state.tapped;
205
214
  }
206
215
  },
216
+ // `next`, `each` and `when` can be given again: the hooks' own take their place ({@link shareMembers}).
207
217
  next: {
218
+ configurable: true,
208
219
  get() {
209
220
  const state = stateOf(this);
210
221
  if (Predicate.isNotUndefined(state.next)) return state.next;
@@ -215,6 +226,7 @@ const WARD_MEMBER_KEYS = {
215
226
  }
216
227
  },
217
228
  each: {
229
+ configurable: true,
218
230
  get() {
219
231
  const state = stateOf(this);
220
232
  if (Predicate.isNotUndefined(state.each)) return state.each;
@@ -225,6 +237,7 @@ const WARD_MEMBER_KEYS = {
225
237
  }
226
238
  },
227
239
  when: {
240
+ configurable: true,
228
241
  get() {
229
242
  const state = stateOf(this);
230
243
  if (Predicate.isNotUndefined(state.when)) return state.when;
@@ -235,8 +248,68 @@ const WARD_MEMBER_KEYS = {
235
248
  }
236
249
  }
237
250
  };
238
- /** {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`. */
251
+ /**
252
+ * {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`.
253
+ *
254
+ * Module state (#460, Q7): made once, and added to once more where the hooks are loaded
255
+ * ({@link shareMembers}), with their own members for every ward.
256
+ */
239
257
  const WARD_MEMBERS = /*#__PURE__*/Object.create(Function.prototype, WARD_MEMBER_KEYS);
258
+ /**
259
+ * Whether `ward` has a state of its own, as a client's has and a server's hasn't: where the hooks
260
+ * keep what they know of it (probe: hooks-first). True of nothing but a ward made here.
261
+ */
262
+ export const keepsState = ward => Predicate.hasProperty(ward, WARD_STATE);
263
+ /** What the hooks keep of `ward`, one with a state of its own ({@link keepsState}): none until they've kept something. */
264
+ export const hooksOf = ward => stateOf(ward).hooks;
265
+ /** Keeps `kept` of `ward` for the hooks, one with a state of its own ({@link keepsState}). */
266
+ export const keepForHooks = (ward, kept) => {
267
+ stateOf(ward).hooks = kept;
268
+ };
269
+ /**
270
+ * Fixes more of `ward`'s config from here on (probe: hooks-first), a ward with a state of its own:
271
+ * what a presence that takes it after it's made has its `animate`, `exit` and `custom` read
272
+ * through, with nothing set up for it on a ward no presence takes. Read in the config's place at
273
+ * the next read of each key; {@link targetAgain} makes that read happen.
274
+ */
275
+ export const fixLater = (ward, fixed) => {
276
+ fixMore(stateOf(ward).written, fixed);
277
+ };
278
+ /**
279
+ * Works `ward`'s target out again (probe: hooks-first): after {@link fixLater}, since what read those
280
+ * keys read them before they were fixed, and follows nothing that says so. From then on it follows
281
+ * whatever the fixed values read. Not in a component's body or a computation, where Solid allows no
282
+ * refresh: at the settle.
283
+ */
284
+ export const targetAgain = ward => {
285
+ const state = stateOf(ward);
286
+ const target = state.target;
287
+ if (Predicate.isNotUndefined(target)) void refresh(target);
288
+ // The names it hands its followers come from its `animate` too: a leader a presence takes hands
289
+ // down the name it leaves by.
290
+ const handsDown = state.handsDown;
291
+ if (Predicate.isNotUndefined(handsDown)) void refresh(handsDown);
292
+ // And what a presence above it leaves it by: its `exit`, kept current by an effect that read it
293
+ // before more was fixed, and isn't told. A ward a presence of the hooks takes keeps its `exit` for
294
+ // that presence, so one above it runs none for it (HP30). Read here; the effect follows whatever it
295
+ // followed, and reads through what's fixed the next time it runs.
296
+ const exitNow = state.exitNow;
297
+ if (Predicate.isNotUndefined(exitNow)) state.exitConfig.current = untrack(exitNow);
298
+ };
299
+ /**
300
+ * More members for the prototype every client ward shares (probe: hooks-first): the hooks' own, a
301
+ * ward's reads and whether it's shown, given once as the hooks load. Each a getter over what the
302
+ * hooks keep of the ward ({@link hooksOf}), as the members here are over its state, so a ward
303
+ * carries nothing for them. One given a name that's here already takes its place.
304
+ */
305
+ export const shareMembers = keys => {
306
+ Object.defineProperties(WARD_MEMBERS, keys);
307
+ };
308
+ /** A member every client ward shares, as it's read of `ward`: for one that takes its place for some wards ({@link shareMembers}). */
309
+ export const sharedMember = name => {
310
+ const descriptor = Object.getOwnPropertyDescriptor(WARD_MEMBERS, name);
311
+ return descriptor.get;
312
+ };
240
313
  /** What a `wardic.*` component or a `<Reorder>` item adds to a ward. Internal. */
241
314
  /**
242
315
  * The config keys that want a gesture on Solid 2 (#525), as the ward's `wants*` read them: an element
@@ -307,21 +380,30 @@ const warnUnreadColors = (registry, features, values) => {
307
380
  return Feature.unreadColorIn(values());
308
381
  }, unread => {
309
382
  if (Predicate.isUndefined(unread)) return;
310
- registry.warnOnce("colors", Feature.missingMessage("colors", `The colour \`${unread}\``, ENTRY));
383
+ warnMissing(registry, "colors", `The colour \`${unread}\``);
311
384
  }, CLIENT_ONLY);
312
385
  };
313
386
  /** Whether a config carries its variants (#398): it sets `variants` or `inherit`. */
314
387
  const carriesVariants = config => Bool.or(Predicate.isNotUndefined(config.variants), Predicate.isNotUndefined(config.inherit));
388
+ /** Whether a ward made with `internal` and `config` carries its variants (#398): by its config, or by its maker's word (a hook ward's). */
389
+ const carriesFor = (internal, config) => Bool.or(internal.carries === true, carriesVariants(config));
315
390
  /** A child made with `{ parent }` naming a Listening ward (#398's Q10). */
316
- const LISTENING_PARENT = "ward(config, { parent }): the parent given carries no variants (no `variants` or `inherit` in its ward({ … })): it only listens, " + "and its element's props hold its variants, so a child can't join it by `{ parent }` (#398). Render the child inside that " + "ward's element, where it joins through the tree, or put the variants in the parent's ward({ … }).";
391
+ const LISTENING_PARENT = "ward(config, { parent }): the parent given carries no variants (no `variants` or `inherit` in its ward({ … })): it only listens, " + "and its element's props hold its variants, so a child can't join it by `{ parent }`. Render the child inside that " + "ward's element, where it joins through the tree, or put the variants in the parent's ward({ … }).";
392
+ /** The **Layout group** a ward made here with `internal` is in: its maker's choice, else the one around it. */
393
+ const groupOf = internal => {
394
+ const chosen = internal.layoutGroup;
395
+ if (Predicate.isNotUndefined(chosen)) return chosen.id;
396
+ return useLayoutGroupId();
397
+ };
317
398
  /**
318
399
  * The **Layout group** a ward's `layoutId` goes in (#432): the one it's made in, as its presence and
319
- * variant parent are; a driving ward's is its given ward's, where that was made, unless the element's
320
- * own props set the `layoutId` (#398), which is then the element's.
400
+ * variant parent are, or its maker's choice; a driving ward's is its given ward's, where that was made,
401
+ * unless the element's own props set the `layoutId` (#398), which is then the element's.
321
402
  */
322
- const layoutGroupFor = (share, fixed) => {
323
- if (Predicate.isUndefined(share)) return useLayoutGroupId();
324
- if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return useLayoutGroupId();
403
+ const layoutGroupFor = (share, internal) => {
404
+ if (Predicate.isUndefined(share)) return groupOf(internal);
405
+ const fixed = internal.fixed;
406
+ if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return groupOf(internal);
325
407
  return share.layoutGroup;
326
408
  };
327
409
  /**
@@ -337,7 +419,7 @@ const variantParentOf = internal => {
337
419
  }
338
420
  const parent = shareOf(internal.parent);
339
421
  if (Predicate.isNotUndefined(parent)) {
340
- if (Bool.not(parent.carries)) throw new Error(LISTENING_PARENT);
422
+ if (Bool.not(parent.carries)) throw misuse("WARDIC_PARENT_WITHOUT_VARIANTS", LISTENING_PARENT);
341
423
  return parent.provided;
342
424
  }
343
425
  return useVariantContext();
@@ -382,6 +464,12 @@ const controlsOf = (given, animate) => {
382
464
  set: made => setChange(() => made)
383
465
  };
384
466
  };
467
+ /** A ward's config settings: its own over its nearest `WardicConfig`'s, where it has any (`wardicConfig`), else that config's. */
468
+ const configOf = internal => {
469
+ const own = internal.wardicConfig;
470
+ if (Predicate.isNotUndefined(own)) return own;
471
+ return useWardicConfig();
472
+ };
385
473
  /**
386
474
  * `view` with its **Config transition** as its own when it gives none (#434, Motion's
387
475
  * `{ ...config, ...props }`), read per read as its keys are; `view` itself with no `WardicConfig` above.
@@ -440,10 +528,22 @@ const LOADING_NAMES = [];
440
528
  * `animate` names the ward's own variants when it has `variants` (what it can name), and is a target
441
529
  * of values otherwise: setup reads it only to tell which.
442
530
  */
531
+ /**
532
+ * `config` a **Variant child** by its own word, where its internals say so (probe: hooks-first, the
533
+ * gap grill's Q26): core's `variantChild` set on the copy its variant decisions read. As it is for
534
+ * every other ward, a component's among them.
535
+ */
536
+ const variantChildBy = (internal, config) => {
537
+ if (internal.variantChild !== true) return config;
538
+ return {
539
+ ...config,
540
+ variantChild: true
541
+ };
542
+ };
443
543
  export const configAtSetup = setup => {
444
544
  if (setup.pending.length === 0) return setup.config;
445
545
  const fixed = Arr.findFirst(setup.pending, key => Bool.not(LOADS_AS_IT_GOES.has(key)));
446
- if (Option.isSome(fixed)) throw new Error(loadingAtSetup(fixed.value));
546
+ if (Option.isSome(fixed)) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", loadingAtSetup(fixed.value));
447
547
  const config = setup.config;
448
548
  if (Bool.and(Arr.contains(setup.pending, "animate"), Predicate.isNotUndefined(config.variants))) return {
449
549
  ...config,
@@ -467,7 +567,7 @@ const layoutArrivedIn = (arrive, services) => {
467
567
  UndefinedOr.map(arrive, make => UndefinedOr.map(Keys.projectionIn(services), make));
468
568
  };
469
569
  export function wardWith(config, internal) {
470
- if (Predicate.isFunction(config)) throw new Error(WHOLE_ACCESSOR);
570
+ if (Predicate.isFunction(config)) throw misuse("WARDIC_CONFIG_AS_ACCESSOR", WHOLE_ACCESSOR);
471
571
  const runtime = useWardicRuntime();
472
572
  // Its Features (#511, ADR-0067), a Complete element's every one: what they register, a server
473
573
  // render's elements read too (the `colors` Feature's spaces).
@@ -480,11 +580,14 @@ export function wardWith(config, internal) {
480
580
  const layoutProjection = Keys.projectionIn(untrack(features.services));
481
581
  // The provider's, once any section has built it: what its values register with.
482
582
  const builtProjection = useBuiltProjection();
483
- const reducedMotion = useWardicReducedMotion();
583
+ // Its config's settings: its own over its nearest WardicConfig's, where a hook ward gives any
584
+ // (probe: behaviour-runes), else that config's.
585
+ const wardicConfig = configOf(internal);
586
+ const reducedMotion = useWardicReducedMotion(wardicConfig);
484
587
  // Whether its animations are skipped (#468): its nearest WardicConfig's, read as each starts.
485
- const skipAnimations = useWardicSkipAnimations();
588
+ const skipAnimations = useWardicSkipAnimations(wardicConfig);
486
589
  // Where its drag's and pan's points are (#443): its nearest WardicConfig's, read as each starts.
487
- const pagePoint = WardicConfigValue.transformPagePointOf(useWardicConfig());
590
+ const pagePoint = WardicConfigValue.transformPagePointOf(wardicConfig);
488
591
  const positionalKeys = useWardicPositionalKeys();
489
592
  const defaultTransition = useWardicDefaultTransition();
490
593
  // How a value is read in the Environment's own terms (#672).
@@ -505,7 +608,8 @@ export function wardWith(config, internal) {
505
608
  // Its config, read per key where it's read (#259): a change re-runs only what reads the key. With
506
609
  // Animation controls for its `animate` (#433), read once, each change they make is its entry.
507
610
  // Under a `WardicConfig`, its Config transition is its own when it gives none (#434).
508
- const asGiven = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig());
611
+ const written = WARD_VIEW.of(config, internal.fixed);
612
+ const asGiven = configuredView(written, wardicConfig);
509
613
  // The config at setup, a plain copy read untracked: what setup reads, the keys read once among it.
510
614
  // A key still loading (#257 item 1) is left out of it: one the ward reads as it goes holds its
511
615
  // region until it lands; one setup fixes is an error, naming it. Its `animate` there tells
@@ -521,10 +625,10 @@ export function wardWith(config, internal) {
521
625
  onUndefined: () => givenSetup,
522
626
  onDefined: () => WARD_VIEW.setupOf(view)
523
627
  });
524
- const initialConfig = UndefinedOr.match(controls, {
628
+ const initialConfig = variantChildBy(internal, UndefinedOr.match(controls, {
525
629
  onUndefined: () => configAtSetup(setup),
526
630
  onDefined: () => AnimationControls.controlledConfigOf(configAtSetup(setup), undefined)
527
- });
631
+ }));
528
632
  // Its Animation controls' change (#433), read with the Override stack: none without them.
529
633
  const ownChange = UndefinedOr.match(controls, {
530
634
  onUndefined: () => NO_CHANGE,
@@ -543,12 +647,14 @@ export function wardWith(config, internal) {
543
647
  // The nearest <AnimatePresence> (ADR-0007), or none.
544
648
  const presence = usePresenceContext();
545
649
  // The Layout group its `layoutId` goes in (#432): where it's made, or a given ward's.
546
- const layoutGroup = layoutGroupFor(share, internal.fixed);
650
+ const layoutGroup = layoutGroupFor(share, internal);
547
651
  // The values it starts from, read once (ADR-0003): its `initial`, or the one it inherits, or its
548
652
  // `animate` with `initial={false}` (its own, inherited, or its presence's first render, #134).
549
653
  const presenceBlocks = PresenceRecord.presenceBlocksInitial(presence);
550
- if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw new Error(STARTS_AT_PENDING);
551
- const start = Spine.startOf(initialConfig, node.inherited, presenceBlocks, untrack);
654
+ if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", STARTS_AT_PENDING);
655
+ // Untracked as a whole: a target that's a store's (a store given as a hook's rune) is read here,
656
+ // in the component's body, for its values now.
657
+ const start = untrack(() => Spine.startOf(initialConfig, node.inherited, presenceBlocks, untrack));
552
658
  // A variant whose resolver throws is this element's alone: reported once until it resolves, the element
553
659
  // keeping its last target (#979; ADR-0074).
554
660
  Spine.reportStart(variantFailures, start);
@@ -617,17 +723,30 @@ export function wardWith(config, internal) {
617
723
  // last one left the page, as a mount after the first render's (no presence holds its `initial`
618
724
  // back). Its Snapshot goes back to it, and its Starting style comes back on until its first commit.
619
725
  let begun = start;
620
- const beginFresh = () => {
621
- // The config now, a plain copy read untracked, as setup reads it: this runs in the mount effect.
726
+ // A fresh start and the Starting style it draws, from the config now: a plain copy read untracked,
727
+ // as setup reads it. Read in the mount effect, and by an element's first read of its style.
728
+ const freshStart = () => {
622
729
  const now = WARD_VIEW.setupOf(view).config;
623
- begun = Spine.startOf(now, node.inherited, false, untrack);
730
+ const from = Spine.startOf(now, node.inherited, false, untrack);
731
+ return {
732
+ from,
733
+ starting: Svg.splitPatchForTag(internal.tag, project(ElementSetup.drawnAtRest(from.initialValues, layoutNode, now.transformTemplate))).style
734
+ };
735
+ };
736
+ const freshStarting = () => freshStart().starting;
737
+ const beginFresh = () => {
738
+ const fresh = freshStart();
739
+ begun = fresh.from;
740
+ // As the first start (#979): its variant's resolver that throws is reported, here where it begins.
624
741
  Spine.reportStart(variantFailures, begun);
625
742
  snapshot.values = {
626
743
  ...begun.initialValues
627
744
  };
628
745
  snapshot.velocities = {};
629
746
  snapshot.drawnAt = {};
630
- elementStyle.restart(Svg.splitPatchForTag(internal.tag, project(ElementSetup.drawnAtRest(begun.initialValues, layoutNode, now.transformTemplate))).style);
747
+ // Its element read this Starting style as it was made, where it was seen coming, so that read
748
+ // isn't run again: any other read of its style is.
749
+ elementStyle.restart(fresh.starting);
631
750
  };
632
751
  const configNow = () => view;
633
752
  const styleNow = () => untrack(userStyle);
@@ -636,10 +755,15 @@ export function wardWith(config, internal) {
636
755
  const exitConfig = {
637
756
  current: Spine.NO_EXIT_CONFIG
638
757
  };
758
+ // How it's read of its config, under a presence: none with no presence above it, and nothing
759
+ // made for it then. Mapped from the presence, a function was made for every ward to make it by.
760
+ let exitNow;
639
761
  if (Predicate.isNotUndefined(presence)) {
762
+ const now = () => Spine.exitConfigOf(cfg(), node.inherited);
763
+ exitNow = now;
640
764
  // Its inherited transition is read untracked here: the effect keeps it current.
641
765
  exitConfig.current = untrack(() => Spine.exitConfigOf(initialConfig, node.inherited));
642
- createEffect(() => Spine.exitConfigOf(cfg(), node.inherited), config => {
766
+ createEffect(now, config => {
643
767
  exitConfig.current = config;
644
768
  }, CLIENT_ONLY_DEFERRED);
645
769
  }
@@ -648,8 +772,21 @@ export function wardWith(config, internal) {
648
772
  // (#140)*). Its section's `layout` makes its node (#511): without it, its layout props do nothing,
649
773
  // and development says so once, unless `layout` is on its way.
650
774
  const wantsNode = Feature.wantsLayoutNode(initialConfig);
775
+ /**
776
+ * Whether its drag waits for its layout node (probe: behaviour-runes): it wants one, has none yet, and a
777
+ * Feature is still on its way (`pending`, read now where not given). A hook row's lazy `layout` that came
778
+ * after `drag` was left out of the track (#582), so a behaviour's `measured()` never saw the drag.
779
+ */
780
+ const holdsForNode = (wants, node, pending) => {
781
+ if (Bool.not(wants)) return false;
782
+ if (Predicate.isNotUndefined(node)) return false;
783
+ return UndefinedOr.match(pending, {
784
+ onUndefined: () => untrack(features.pending),
785
+ onDefined: identity
786
+ });
787
+ };
651
788
  if (DEV && wantsNode && Predicate.isUndefined(layoutProjection) && Bool.not(untrack(features.pending))) {
652
- useFeatureRegistry().warnOnce("layout", Feature.missingMessage("layout", Feature.LAYOUT_PROPS, ENTRY));
789
+ warnMissing(useFeatureRegistry(), "layout", Feature.LAYOUT_PROPS);
653
790
  }
654
791
  const layoutNodes = Bool.match(wantsNode, {
655
792
  onTrue: () => layoutProjection,
@@ -728,9 +865,12 @@ export function wardWith(config, internal) {
728
865
  transparent: true
729
866
  });
730
867
  // A colour only the `colors` Feature reads, on a Slim element without it (#511, decision 7): said
731
- // once per provider, in development only, and not while a lazy load is on its way.
868
+ // once per provider, in development only, and not while a lazy load is on its way. Not of a ward that
869
+ // asks for its Features as it uses them (`targeted`, the hooks'): it asks for `colors` a microtask after
870
+ // a colour shows, when this had already found none on its way, and said so wrongly (AS2, CL1; seen once
871
+ // it was coded, where it had gone to Effect's log unread).
732
872
  // eslint-disable-next-line solid/reactivity -- read inside the warning's effect, where it tracks
733
- if (DEV && internal.complete !== true) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved);
873
+ if (DEV && Bool.and(internal.complete !== true, Predicate.isUndefined(internal.targeted))) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved);
734
874
  // Its gesture states, for what its variant node hands down (#291): bound at setup, before its
735
875
  // children read them. Read from the gestures themselves, not the target: a gesture whose layer
736
876
  // resolves to nothing new leaves the target as it was (`sameResolution`), but is on all the same.
@@ -790,7 +930,7 @@ export function wardWith(config, internal) {
790
930
  if (Bool.not(wanted)) return undefined;
791
931
  const service = GestureFeatures.serviceIn(services, key);
792
932
  if (DEV && Predicate.isUndefined(service) && Bool.not(untrack(features.pending))) {
793
- featureRegistry.warnOnce(name, Feature.missingMessage(name, GestureFeatures.GESTURE_WORDS[name], ENTRY));
933
+ warnMissing(featureRegistry, name, GestureFeatures.GESTURE_WORDS[name]);
794
934
  }
795
935
  return service;
796
936
  };
@@ -861,6 +1001,14 @@ export function wardWith(config, internal) {
861
1001
  onDefect
862
1002
  }));
863
1003
  }
1004
+ // A behaviour's input (probe: behaviour-runes): told once a mount, once its gestures' input is there.
1005
+ const onInput = internal.onInput;
1006
+ if (Predicate.isNotUndefined(onInput) && Bool.not(m.input)) {
1007
+ UndefinedOr.map(GestureFeatures.serviceIn(services, InputSource.InputSource), input => {
1008
+ m.input = true;
1009
+ onInput(m.element, input, make => m.watch(make(onDefect)), effect => void runtime.runFork(effect), runtime);
1010
+ });
1011
+ }
864
1012
  };
865
1013
  let mounted;
866
1014
  // The last two elements given to its ref, for a second one still on the page as it mounts (#349's Q5).
@@ -894,25 +1042,32 @@ export function wardWith(config, internal) {
894
1042
  held = PresenceRecord.presenceHold(presence, el, shown);
895
1043
  return Predicate.isNotUndefined(held);
896
1044
  };
1045
+ /**
1046
+ * Its element's mount ended, and what `afterMount` gave it handed back to be called once the caller's
1047
+ * own work is done (probe: behaviour-runes): a rune's undoing that throws ends nothing of the binding's.
1048
+ */
897
1049
  const unmount = () => {
898
1050
  unhold();
899
- if (Predicate.isUndefined(mounted)) return;
1051
+ if (Predicate.isUndefined(mounted)) return constVoid;
900
1052
  const left = mounted.element;
1053
+ const afterUnmount = mounted.afterUnmount;
901
1054
  mounted.dispose();
902
1055
  mounted = undefined;
903
1056
  if (justLeft.size === 0) queueMicrotask(forgetJustLeft);
904
1057
  justLeft.add(left);
1058
+ return afterUnmount;
905
1059
  };
906
1060
  // Its element's mount goes, and its lifecycle's waits are rejected (#257): one cleanup, which ends
907
1061
  // what its accessors mounted at their first calls too (#566).
908
1062
  // A driving ward's lifecycle is its given ward's, which outlives the element (#349).
909
1063
  onCleanup(() => {
910
- unmount();
1064
+ const afterUnmount = unmount();
911
1065
  if (Predicate.isUndefined(share)) lifecycle.dispose();
912
1066
  UndefinedOr.map(cleanups, all => Arr.forEach(all, runCleanup));
1067
+ afterUnmount();
913
1068
  });
914
1069
  const mount = el => {
915
- if (justLeft.has(el)) throw new Error(REMADE);
1070
+ if (justLeft.has(el)) throw misuse("WARDIC_WARD_MADE_IN_SPREAD", REMADE);
916
1071
  // The ward a component was given follows this element while it's mounted (#349): one at a time.
917
1072
  let undrive;
918
1073
  if (Predicate.isNotUndefined(share)) {
@@ -1079,7 +1234,10 @@ export function wardWith(config, internal) {
1079
1234
  propagation: initialConfig.dragPropagation,
1080
1235
  directionLock: initialConfig.dragDirectionLock,
1081
1236
  transition: dragTransition,
1082
- listen: initialConfig.dragListener
1237
+ listen: UndefinedOr.match(internal.dragListen, {
1238
+ onUndefined: () => initialConfig.dragListener,
1239
+ onDefined: identity
1240
+ })
1083
1241
  },
1084
1242
  container: constraints.container,
1085
1243
  controls: initialConfig.dragControls,
@@ -1108,7 +1266,14 @@ export function wardWith(config, internal) {
1108
1266
  onReleaseEnd: () => lifecycle.released()
1109
1267
  });
1110
1268
  };
1111
- let dragTrack = UndefinedOr.map(dragGesture, driveDrag);
1269
+ // One that wants a layout node whose `layout` is still on its way holds its drag back until the node
1270
+ // is made, so its track drives the node (probe: behaviour-runes): a hook row's Features come as its
1271
+ // config asks, `drag` before `layout` as often as not, and a node made after the track was left out
1272
+ // of it (#582), so a behaviour's `measured()` never saw the drag.
1273
+ let dragTrack = Bool.match(holdsForNode(wantsNode, layout), {
1274
+ onTrue: constUndefined,
1275
+ onFalse: () => UndefinedOr.map(dragGesture, driveDrag)
1276
+ });
1112
1277
  const spineOptions = {
1113
1278
  runtime,
1114
1279
  gate,
@@ -1192,6 +1357,8 @@ export function wardWith(config, internal) {
1192
1357
  pan: false,
1193
1358
  inView: false,
1194
1359
  focus: false,
1360
+ input: false,
1361
+ afterUnmount: constVoid,
1195
1362
  dispose: () => {
1196
1363
  if (Predicate.isNotUndefined(undrive)) undrive();
1197
1364
  UndefinedOr.map(mountedHook, end => end());
@@ -1242,9 +1409,10 @@ export function wardWith(config, internal) {
1242
1409
  services,
1243
1410
  pending
1244
1411
  }) => {
1245
- UndefinedOr.map(mounted, m => layoutArrivedIn(m.arriveLayout, services));
1412
+ // Its node reads its config's options (its `layoutId`, an accessor's): untracked, as at its mount, so said.
1413
+ UndefinedOr.map(mounted, m => untrack(() => layoutArrivedIn(m.arriveLayout, services)));
1246
1414
  if (DEV && Predicate.isUndefined(Keys.projectionIn(services)) && Bool.not(pending)) {
1247
- featureRegistry.warnOnce("layout", Feature.missingMessage("layout", Feature.LAYOUT_PROPS, ENTRY));
1415
+ warnMissing(featureRegistry, "layout", Feature.LAYOUT_PROPS);
1248
1416
  }
1249
1417
  }, CLIENT_ONLY_DEFERRED);
1250
1418
  }
@@ -1264,11 +1432,14 @@ export function wardWith(config, internal) {
1264
1432
  UndefinedOr.match(GestureFeatures.serviceIn(services, Keys.DragGesture), {
1265
1433
  // A `layout` from the same load makes its node first, so the track drives it (#582).
1266
1434
  onDefined: gesture => UndefinedOr.map(mounted, m => {
1267
- layoutArrivedIn(m.arriveLayout, services);
1268
- UndefinedOr.map(m.startDrag, start => start(gesture));
1435
+ untrack(() => layoutArrivedIn(m.arriveLayout, services));
1436
+ // One that wants a node starts its drag once it has one, or once nothing more is coming.
1437
+ if (Bool.not(holdsForNode(wantsNode, m.layout, pending))) UndefinedOr.map(m.startDrag, start => start(gesture));
1438
+ // Its input with it, for a behaviour's keys (probe: behaviour-runes).
1439
+ startRecognizers(m);
1269
1440
  }),
1270
1441
  onUndefined: () => {
1271
- if (DEV && Bool.not(pending)) featureRegistry.warnOnce("drag", Feature.missingMessage("drag", GestureFeatures.GESTURE_WORDS.drag, ENTRY));
1442
+ if (DEV && Bool.not(pending)) warnMissing(featureRegistry, "drag", GestureFeatures.GESTURE_WORDS.drag);
1272
1443
  }
1273
1444
  });
1274
1445
  }, CLIENT_ONLY_DEFERRED);
@@ -1305,26 +1476,43 @@ export function wardWith(config, internal) {
1305
1476
  el,
1306
1477
  resolution
1307
1478
  } = mounting;
1479
+ let mountedNow = false;
1480
+ // What the last element's `afterMount` gave, called once this one is mounted and aimed.
1481
+ let afterLast = constVoid;
1308
1482
  if (Predicate.isUndefined(mounted) || mounted.element !== el) {
1309
1483
  // Another element it was spread on, or the one it's on, still on the page: a ward drives one
1310
1484
  // element at a time (#349's Q5). One the page has let go of is left behind.
1311
- if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw new Error(secondElement("ward(config)"));
1485
+ if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement("ward(config)"));
1312
1486
  refdBefore = undefined;
1313
1487
  // Held off the page: nothing starts until it's on it.
1314
1488
  if (heldBack(el)) return;
1315
1489
  // A new element starts with no gesture on, read from its gesture state (#257's audit).
1316
- unmount();
1317
- // One that came after the last left the page enters fresh (#414).
1318
- if (el === fresh) beginFresh();
1490
+ afterLast = unmount();
1491
+ // One that came after the last left the page enters fresh (#414). One that doesn't, read as
1492
+ // one that would, reads its style again.
1493
+ Bool.match(el === fresh, {
1494
+ onTrue: beginFresh,
1495
+ onFalse: elementStyle.notFresh
1496
+ });
1319
1497
  // Its config is read at mount (its layout node's options, its `onUpdate`, its spine's) through
1320
1498
  // the per-key view (#259): untracked, so said, as the Retarget below.
1321
1499
  mounted = untrack(() => mount(el));
1500
+ mountedNow = true;
1322
1501
  }
1323
1502
  // The spine reads the variant context (its gates, its stagger, what it inherits) at the
1324
1503
  // Retarget, once: untracked, so said (Solid 2's dev build warns of a reactive read in an
1325
1504
  // effect's apply, STRICT_READ_UNTRACKED). The effect's compute is what re-runs it.
1326
- const spine = mounted.spine;
1505
+ const m = mounted;
1506
+ const spine = m.spine;
1507
+ // What it resolved to, told to a ward that asks for its Features as it uses them (`targeted`).
1508
+ const targeted = internal.targeted;
1509
+ if (Predicate.isNotUndefined(targeted)) targeted(resolution.resolved);
1327
1510
  untrack(() => spine.retarget(resolution));
1511
+ // A hooks ward's runes' `ref`s, once it's mounted and aimed (probe: behaviour-runes): the last
1512
+ // element's undone, then this one's run. Not untracked, which is the `ref`'s author's to say.
1513
+ afterLast();
1514
+ const afterMount = internal.afterMount;
1515
+ if (mountedNow && Predicate.isNotUndefined(afterMount)) m.afterUnmount = afterMount(el);
1328
1516
  }, CLIENT_ONLY_SYNC);
1329
1517
  // `<card.Provider>` hands down what this element hands its children (#50).
1330
1518
  const Provider = props => WardicVariantContext(new _P$(node, props));
@@ -1396,9 +1584,45 @@ export function wardWith(config, internal) {
1396
1584
  };
1397
1585
  }
1398
1586
  });
1587
+ // Whether its presence says the next element it's given enters afresh (probe: hooks-first).
1588
+ const presenceSaysFresh = () => {
1589
+ const enters = internal.entersFresh;
1590
+ if (Predicate.isUndefined(enters)) return false;
1591
+ return enters(self);
1592
+ };
1593
+ // Whether the element a first read of its style is for enters fresh (#414), told before its mount
1594
+ // begins it: its ref has decided it for one given and not yet mounted, and will say this of the next.
1595
+ const comesFresh = () => {
1596
+ const last = refdLast;
1597
+ if (Predicate.isUndefined(last)) return presenceSaysFresh();
1598
+ if (UndefinedOr.map(mounted, elementOfMount) !== last) return fresh === last;
1599
+ return Bool.or(Bool.not(last.isConnected), presenceSaysFresh());
1600
+ };
1601
+ // Each computation that has read its style: one for each element it's on, the same at every run of
1602
+ // that element's props. So a first read is an element's being made.
1603
+ const styleReaders = new WeakSet();
1399
1604
  const renderedStyle = () => {
1400
1605
  holdWhileLoading();
1401
- return elementStyle.style(userStyle());
1606
+ const user = userStyle();
1607
+ const reader = getOwner();
1608
+ // Read outside a computation, or by one that has read it before: as the gate has it.
1609
+ if (Predicate.isNull(reader)) return elementStyle.style(user);
1610
+ if (styleReaders.has(reader)) return elementStyle.style(user);
1611
+ // An element that enters fresh reads its Starting style here, derived from what its ref goes by.
1612
+ // Its mount begins the entry once the ref has given it, and doesn't run this read again: told
1613
+ // of the restart afterwards, a spread re-ran on a write its own effect had led to, through the
1614
+ // ref it calls (EFFECT_WRITES_OWN_SOURCE).
1615
+ const style = Bool.match(comesFresh(), {
1616
+ onTrue: () => elementStyle.entering(user, untrack(freshStarting)),
1617
+ onFalse: () => elementStyle.style(user)
1618
+ });
1619
+ styleReaders.add(reader);
1620
+ // Told to the hooks, where they made it, in development alone (probe: hooks-first, Q29).
1621
+ if (DEV) {
1622
+ const styled = internal.styled;
1623
+ if (Predicate.isNotUndefined(styled)) styled(self);
1624
+ }
1625
+ return style;
1402
1626
  };
1403
1627
  // The ward: a ref, and its own props. Under a presence, its element is told to it as it's made
1404
1628
  // (#286): its `key`, and whether it's a twin.
@@ -1412,7 +1636,7 @@ export function wardWith(config, internal) {
1412
1636
  * element of its own (#349's Q5).
1413
1637
  */
1414
1638
  const drive = (next, name) => {
1415
- if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw new Error(secondElement(name));
1639
+ if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement(name));
1416
1640
  driver = next;
1417
1641
  UndefinedOr.map(driven, atom => registry().set(atom, next));
1418
1642
  return () => {
@@ -1425,9 +1649,10 @@ export function wardWith(config, internal) {
1425
1649
  config,
1426
1650
  setup: initialConfig,
1427
1651
  internal,
1652
+ fixed: () => fixedOver(written),
1428
1653
  parent,
1429
1654
  chosen: Predicate.isNotUndefined(internal.parent),
1430
- carries: carriesVariants(initialConfig),
1655
+ carries: carriesFor(internal, initialConfig),
1431
1656
  provided: node.provided,
1432
1657
  layoutGroup,
1433
1658
  node,
@@ -1439,6 +1664,10 @@ export function wardWith(config, internal) {
1439
1664
  const setMade = Spine.madeWith(presence, setElement, initialConfig);
1440
1665
  const self = value => {
1441
1666
  if (isElement(value)) {
1667
+ // Told to the hooks, where they made it (probe: hooks-first): what a leaving row finds inside it.
1668
+ // No callback made for it: this runs for every element of every ward.
1669
+ const handed = internal.handed;
1670
+ if (Predicate.isNotUndefined(handed)) handed(value, self);
1442
1671
  const last = refdLast;
1443
1672
  if (Predicate.isNotUndefined(last)) {
1444
1673
  if (last !== value) {
@@ -1446,12 +1675,21 @@ export function wardWith(config, internal) {
1446
1675
  if (Bool.not(last.isConnected)) fresh = value;
1447
1676
  }
1448
1677
  }
1678
+ // A presence's next value (probe: hooks-first): its element enters afresh though the last may
1679
+ // still be on the page, and so does the first one of a value that came after the page opened.
1680
+ if (Bool.and(last !== value, presenceSaysFresh())) fresh = value;
1449
1681
  refdLast = value;
1450
1682
  setMade(value);
1451
1683
  return undefined;
1452
1684
  }
1453
1685
  return spreadNow();
1454
1686
  };
1687
+ // The presence it's made under, for a hook ward to watch its child's leave by (probe: hooks-first).
1688
+ // No callback made for it: this runs for every ward under a presence, each row of a list.
1689
+ if (Predicate.isNotUndefined(presence)) {
1690
+ const madeUnder = internal.madeUnder;
1691
+ if (Predicate.isNotUndefined(madeUnder)) madeUnder(self, presence);
1692
+ }
1455
1693
  // What a spread of the ward reads (#495): its spread's props alone, made at its first spread, so a
1456
1694
  // ward given only to `ref` makes none, and a Reorder item's keyboard attributes are in it.
1457
1695
  let spread;
@@ -1491,11 +1729,17 @@ export function wardWith(config, internal) {
1491
1729
  lifecycle,
1492
1730
  element,
1493
1731
  hold: holdWhileLoading,
1732
+ written,
1733
+ target,
1734
+ handsDown: node.handsDown,
1735
+ exitConfig,
1736
+ exitNow,
1494
1737
  settled: undefined,
1495
1738
  tapped: undefined,
1496
1739
  next: undefined,
1497
1740
  each: undefined,
1498
- when: undefined
1741
+ when: undefined,
1742
+ hooks: undefined
1499
1743
  };
1500
1744
  Object.setPrototypeOf(self, WARD_MEMBERS);
1501
1745
  Object.defineProperties(self, {
@@ -1614,19 +1858,19 @@ const serverWard = (config, internal) => {
1614
1858
  // A server's own values: the DOM's, its context's constant (#672).
1615
1859
  const ownValues = ElementSetup.valueReadsOf(useWardicValueReads()).ownValues;
1616
1860
  createUniqueId();
1617
- const view = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig());
1861
+ const view = configuredView(WARD_VIEW.of(config, internal.fixed), configOf(internal));
1618
1862
  // A key still loading (#257 item 1): one setup fixes is the client's error here too. One the ward
1619
1863
  // reads as it goes is read again, throwing Solid's `NotReadyError`: a server waits for it and
1620
1864
  // renders the component again, so its region streams once the data is in, Appear and all.
1621
1865
  // Both are checked before the read that waits.
1622
1866
  const setup = WARD_VIEW.setupOf(view);
1623
1867
  // Animation controls (#433) set nothing on a server: no entry yet, and controlled, as on the client.
1624
- const atSetup = AnimationControls.uncontrolledOf(configAtSetup(setup));
1868
+ const atSetup = variantChildBy(internal, AnimationControls.uncontrolledOf(configAtSetup(setup)));
1625
1869
  // Where it's made, its given parent's, or its given ward's (#349).
1626
1870
  const parent = variantParentOf(internal);
1627
1871
  const presenceBlocks = PresenceRecord.presenceBlocksInitial(usePresenceContext());
1628
- if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(atSetup, VariantTree.inheritedContext(atSetup, parent), presenceBlocks))) throw new Error(STARTS_AT_PENDING);
1629
- const c = AnimationControls.uncontrolledOf(WARD_VIEW.snapshotOf(view));
1872
+ if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(atSetup, VariantTree.inheritedContext(atSetup, parent), presenceBlocks))) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", STARTS_AT_PENDING);
1873
+ const c = variantChildBy(internal, AnimationControls.uncontrolledOf(WARD_VIEW.snapshotOf(view)));
1630
1874
  const node = VariantTree.serverVariantNode(c, parent);
1631
1875
  const serverStart = Spine.startOf(c, node.inherited, presenceBlocks, untrack);
1632
1876
  // A variant that throws leaves its values out of the markup, logged on the server (#979).
@@ -1656,7 +1900,13 @@ const serverWard = (config, internal) => {
1656
1900
  onDefined: base => base()
1657
1901
  })), Style.over(dragDefaults), Style.over(appear.style));
1658
1902
  };
1659
- const style = styleFor(c.style);
1903
+ // Worked out at its first read, a spread's (probe: behaviour-runes): what's made after the ward and
1904
+ // before its element renders still counts, a hooks row's grip, which takes its `touch-action` away.
1905
+ let style;
1906
+ const styleNow = () => {
1907
+ if (Predicate.isUndefined(style)) style = styleFor(c.style);
1908
+ return style;
1909
+ };
1660
1910
  let given = NO_WITH;
1661
1911
  const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults));
1662
1912
  // A spread of it reads its spread's props alone, made at its first spread, as the client's (#495).
@@ -1666,7 +1916,7 @@ const serverWard = (config, internal) => {
1666
1916
  value: noRef,
1667
1917
  enumerable: true
1668
1918
  }, {
1669
- value: style,
1919
+ get: styleNow,
1670
1920
  enumerable: true
1671
1921
  }, attributes);
1672
1922
  return spread;
@@ -1676,11 +1926,12 @@ const serverWard = (config, internal) => {
1676
1926
  config,
1677
1927
  setup: atSetup,
1678
1928
  internal,
1929
+ fixed: () => internal.fixed,
1679
1930
  parent,
1680
1931
  chosen: Predicate.isNotUndefined(internal.parent),
1681
- carries: carriesVariants(atSetup),
1932
+ carries: carriesFor(internal, atSetup),
1682
1933
  provided: appear.provided,
1683
- layoutGroup: useLayoutGroupId(),
1934
+ layoutGroup: groupOf(internal),
1684
1935
  node: undefined,
1685
1936
  lifecycle: undefined,
1686
1937
  drive: () => constVoid
@@ -1694,7 +1945,7 @@ const serverWard = (config, internal) => {
1694
1945
  enumerable: true
1695
1946
  },
1696
1947
  style: {
1697
- value: style,
1948
+ get: styleNow,
1698
1949
  enumerable: true
1699
1950
  },
1700
1951
  ...attributes,
@@ -1724,8 +1975,11 @@ const serverWard = (config, internal) => {
1724
1975
  when: {
1725
1976
  value: serverWhen
1726
1977
  },
1727
- // The element's own style over the config's, rendered in its Starting style (#264).
1978
+ // The element's own style over the config's, rendered in its Starting style (#264). Configurable,
1979
+ // as a client's is by being a shared member: so what makes a ward of this one can give it a
1980
+ // `with` of its own, on a server as in a browser (the hooks', for what their runes add to a spread).
1728
1981
  with: {
1982
+ configurable: true,
1729
1983
  value: own => {
1730
1984
  given = own;
1731
1985
  return spreadPropsOf({
@@ -1746,4 +2000,283 @@ const serverWard = (config, internal) => {
1746
2000
  };
1747
2001
  /** A server render's `ref`: Solid never calls it there. */
1748
2002
  const noRef = constUndefined;
2003
+ /** No values: what a function rune's ward rests at, having no config ({@link holderWard}). */
2004
+ const NO_VALUES = {};
2005
+ /** A function rune's ward's config, as it's written and at setup: none. */
2006
+ const NO_WRITTEN = Object.freeze({});
2007
+ /** A function rune's ward's exit: none, never read again, as it has no `exitNow`. */
2008
+ const NO_EXIT = Object.freeze({
2009
+ current: Spine.NO_EXIT_CONFIG
2010
+ });
2011
+ /**
2012
+ * What development says of `member` used in a function rune's body (the ward split's Q7): it's the
2013
+ * finished ward's, and that ward isn't made yet.
2014
+ */
2015
+ const usedEarly = member => `createRune(fn): ${member} was used in the rune's body, before its ward is made. It's the ward's, and the ward ` + "doesn't exist until every rune has run: use it where the ward is rendered, or in an effect or a callback.";
2016
+ // Module state (#460, Q7): what development has said, each member once.
2017
+ const SAID_EARLY = new Set();
2018
+ /** Says {@link usedEarly} of `member`, once, in development. */
2019
+ const sayEarly = member => {
2020
+ if (Predicate.isUndefined(DEV)) return;
2021
+ if (SAID_EARLY.has(member)) return;
2022
+ SAID_EARLY.add(member);
2023
+ report("WARDIC_RUNE_READ_TOO_EARLY", usedEarly(member));
2024
+ };
2025
+ /** The finished ward each function rune's ward hands on to, told it by {@link holderFinished}. */
2026
+ // Module state (#460, Q7): held weakly by the function rune's ward.
2027
+ const FINISHING = new WeakMap();
2028
+ /** Tells `holder`, a function rune's ward ({@link holderWard}), the ward it's part of, now that it's made. */
2029
+ export const holderFinished = (holder, ward) => {
2030
+ UndefinedOr.map(FINISHING.get(holder), finish => finish(ward));
2031
+ };
2032
+ /**
2033
+ * A function rune's ward (probe: behaviour-runes, the ward split's Q6–Q8, Q11), made before the ward it's
2034
+ * part of, since every rune runs before that ward is: a lifecycle and what the hooks keep, with no config,
2035
+ * no variant node and no mount. The finished ward adopts its lifecycle through its share, as a ward given
2036
+ * to a component does (#349), and drives its `read` and `atom` while it's on an element: as the second
2037
+ * binding ward this replaces did, at a fraction of its cost. What only the finished ward has, its
2038
+ * `Provider`, its spread and `with`, its `style` and its element, it hands on to that ward once
2039
+ * {@link holderFinished} says which: used in the rune's body, before then, development says so. It takes
2040
+ * no hydration id, on a server or in a browser.
2041
+ */
2042
+ export const holderWard = internal => {
2043
+ // Where it's made: the variant context and Layout group its finished ward takes through its share.
2044
+ const parent = variantParentOf(internal);
2045
+ const layoutGroup = groupOf(internal);
2046
+ if (isServer) return serverHolder(internal, parent, layoutGroup);
2047
+ return clientHolder(internal, parent, layoutGroup);
2048
+ };
2049
+ /** A function rune's ward in a browser ({@link holderWard}). */
2050
+ const clientHolder = (internal, parent, layoutGroup) => {
2051
+ const registry = Spine.registryOf(useWardicRuntime());
2052
+ const firstCallOwner = firstCallOwnerHere();
2053
+ let finished;
2054
+ // The finished ward on its element (#349's driver): what its `read`, `atom` and `next` follow.
2055
+ let driver;
2056
+ let driven;
2057
+ let cleanups;
2058
+ const addCleanup = cleanup => {
2059
+ if (Predicate.isUndefined(cleanups)) cleanups = [];
2060
+ cleanups.push(cleanup);
2061
+ };
2062
+ const drivenAtom = () => {
2063
+ if (Predicate.isNotUndefined(driven)) return driven;
2064
+ const atom = Atom.make(driver);
2065
+ addCleanup(registry().mount(atom));
2066
+ driven = atom;
2067
+ return atom;
2068
+ };
2069
+ // Its gestures are its finished ward's: a `next` that asks for one starts it on that ward's element.
2070
+ const lifecycle = new Lifecycle(firstCallOwner, () => {
2071
+ UndefinedOr.map(driver, d => d.wanted());
2072
+ });
2073
+ onCleanup(() => {
2074
+ lifecycle.dispose();
2075
+ UndefinedOr.map(cleanups, all => Arr.forEach(all, runCleanup));
2076
+ });
2077
+ // A key's value: the finished ward's element's, while it drives this one; where nothing rests, else.
2078
+ let reads;
2079
+ const read = key => {
2080
+ if (Predicate.isUndefined(reads)) reads = new Map();
2081
+ const known = reads.get(key);
2082
+ if (Predicate.isNotUndefined(known)) return known;
2083
+ const following = drivenAtom();
2084
+ const resting = ElementSetup.restingOf(key, NO_VALUES, undefined, identity);
2085
+ const atom = Atom.make(get => UndefinedOr.match(get(following), {
2086
+ onUndefined: () => resting,
2087
+ onDefined: d => get(d.readAtom(key))
2088
+ }));
2089
+ const accessor = runWithOwner(firstCallOwner, () => followAtom(registry(), atom, addCleanup));
2090
+ reads.set(key, accessor);
2091
+ return accessor;
2092
+ };
2093
+ const atomOf = key => {
2094
+ const following = drivenAtom();
2095
+ return Atom.make(get => UndefinedOr.match(get(following), {
2096
+ onUndefined: constUndefined,
2097
+ onDefined: d => get(d.atom(key))
2098
+ }));
2099
+ };
2100
+ // Followed by one finished ward at a time (#349's Q5).
2101
+ const drive = (next, name) => {
2102
+ if (Predicate.isNotUndefined(driver)) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement(name));
2103
+ driver = next;
2104
+ UndefinedOr.map(driven, atom => registry().set(atom, next));
2105
+ return () => {
2106
+ if (driver !== next) return;
2107
+ driver = undefined;
2108
+ UndefinedOr.map(driven, atom => registry().set(atom, undefined));
2109
+ };
2110
+ };
2111
+ const shared = {
2112
+ config: NO_WRITTEN,
2113
+ setup: NO_WRITTEN,
2114
+ internal,
2115
+ fixed: () => internal.fixed,
2116
+ parent,
2117
+ chosen: Predicate.isNotUndefined(internal.parent),
2118
+ carries: false,
2119
+ provided: undefined,
2120
+ layoutGroup,
2121
+ node: undefined,
2122
+ lifecycle,
2123
+ drive
2124
+ };
2125
+ const self = value => UndefinedOr.match(finished, {
2126
+ onUndefined: () => {
2127
+ sayEarly("the ward as a ref or a spread");
2128
+ return undefined;
2129
+ },
2130
+ onDefined: to => to(value)
2131
+ });
2132
+ const state = {
2133
+ shared: () => shared,
2134
+ Provider: props => UndefinedOr.match(finished, {
2135
+ onUndefined: () => {
2136
+ sayEarly("Provider");
2137
+ return props.children;
2138
+ },
2139
+ onDefined: to => to.Provider(props)
2140
+ }),
2141
+ read,
2142
+ atom: atomOf,
2143
+ with: own => UndefinedOr.match(finished, {
2144
+ onUndefined: () => {
2145
+ sayEarly("with");
2146
+ return spreadPropsOf({});
2147
+ },
2148
+ onDefined: to => to.with(own)
2149
+ }),
2150
+ lifecycle,
2151
+ element: () => UndefinedOr.match(finished, {
2152
+ onUndefined: constUndefined,
2153
+ onDefined: to => UndefinedOr.match(sensedOf(to), {
2154
+ onUndefined: constUndefined,
2155
+ onDefined: sensed => sensed.element()
2156
+ })
2157
+ }),
2158
+ hold: () => {
2159
+ UndefinedOr.map(finished, to => stateOf(to).hold());
2160
+ },
2161
+ written: NO_WRITTEN,
2162
+ target: undefined,
2163
+ handsDown: undefined,
2164
+ exitConfig: NO_EXIT,
2165
+ exitNow: undefined,
2166
+ settled: undefined,
2167
+ tapped: undefined,
2168
+ next: undefined,
2169
+ each: undefined,
2170
+ when: undefined,
2171
+ hooks: undefined
2172
+ };
2173
+ FINISHING.set(self, ward => {
2174
+ finished = ward;
2175
+ });
2176
+ Object.setPrototypeOf(self, WARD_MEMBERS);
2177
+ Object.defineProperties(self, {
2178
+ [WARD_STATE]: {
2179
+ value: state
2180
+ },
2181
+ ref: {
2182
+ value: self,
2183
+ enumerable: true
2184
+ },
2185
+ style: {
2186
+ get: () => styleOf(finished),
2187
+ enumerable: true
2188
+ }
2189
+ });
2190
+ return self;
2191
+ };
2192
+ /** A function rune's ward's `style`: its finished ward's. */
2193
+ const styleOf = finished => UndefinedOr.match(finished, {
2194
+ onUndefined: () => {
2195
+ sayEarly("style");
2196
+ return {};
2197
+ },
2198
+ onDefined: to => to.style
2199
+ });
2200
+ /** A function rune's ward on a server ({@link holderWard}): a server ward's members, and its share. Nothing hears anything there. */
2201
+ const serverHolder = (internal, parent, layoutGroup) => {
2202
+ let finished;
2203
+ const self = () => UndefinedOr.match(finished, {
2204
+ onUndefined: () => {
2205
+ sayEarly("the ward as a ref or a spread");
2206
+ return undefined;
2207
+ },
2208
+ onDefined: to => to()
2209
+ });
2210
+ const shared = {
2211
+ config: NO_WRITTEN,
2212
+ setup: NO_WRITTEN,
2213
+ internal,
2214
+ fixed: () => internal.fixed,
2215
+ parent,
2216
+ chosen: Predicate.isNotUndefined(internal.parent),
2217
+ carries: false,
2218
+ provided: undefined,
2219
+ layoutGroup,
2220
+ node: undefined,
2221
+ lifecycle: undefined,
2222
+ drive: () => constVoid
2223
+ };
2224
+ FINISHING.set(self, ward => {
2225
+ finished = ward;
2226
+ });
2227
+ Object.defineProperties(self, {
2228
+ [WARD]: {
2229
+ value: shared
2230
+ },
2231
+ ref: {
2232
+ value: noRef,
2233
+ enumerable: true
2234
+ },
2235
+ style: {
2236
+ get: () => styleOf(finished),
2237
+ enumerable: true
2238
+ },
2239
+ Provider: {
2240
+ value: props => UndefinedOr.match(finished, {
2241
+ onUndefined: () => {
2242
+ sayEarly("Provider");
2243
+ return props.children;
2244
+ },
2245
+ onDefined: to => to.Provider(props)
2246
+ })
2247
+ },
2248
+ read: {
2249
+ value: key => () => ElementSetup.restingOf(key, NO_VALUES, undefined, identity)
2250
+ },
2251
+ atom: {
2252
+ value: () => NO_OUTPUT
2253
+ },
2254
+ settled: {
2255
+ value: constUndefined
2256
+ },
2257
+ tapped: {
2258
+ value: constUndefined
2259
+ },
2260
+ next: {
2261
+ value: neverLands
2262
+ },
2263
+ each: {
2264
+ value: () => NO_EVENTS
2265
+ },
2266
+ when: {
2267
+ value: serverWhen
2268
+ },
2269
+ with: {
2270
+ configurable: true,
2271
+ value: own => UndefinedOr.match(finished, {
2272
+ onUndefined: () => {
2273
+ sayEarly("with");
2274
+ return spreadPropsOf({});
2275
+ },
2276
+ onDefined: to => to.with(own)
2277
+ })
2278
+ }
2279
+ });
2280
+ return self;
2281
+ };
1749
2282
  //# sourceMappingURL=ward.js.map