@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
@@ -1,4 +1,5 @@
1
1
  import { createComponent as _$createComponent } from "@solidjs/web";
2
+ import * as InputSource from "@wardic/core/InputSource";
2
3
  import * as Press from "@wardic/dom/unstable/Press";
3
4
  import * as Report from "@wardic/dom/Report";
4
5
  import * as Renderer from "@wardic/core/Renderer";
@@ -16,10 +17,11 @@ import * as Predicate from "effect/Predicate";
16
17
  import * as UndefinedOr from "effect/UndefinedOr";
17
18
  import * as Atom from "effect/reactivity/Atom";
18
19
  import { isServer, useHead } from "@solidjs/web";
19
- import { createEffect, createMemo, createSignal, createUniqueId, DEV, getOwner, isHydrating, onCleanup, runWithOwner, untrack } from "solid-js";
20
+ import { createEffect, createMemo, createSignal, createUniqueId, DEV, getOwner, isHydrating, onCleanup, refresh, runWithOwner, untrack } from "solid-js";
20
21
  import { MOTION_PROPS_V2 } from "./motion-props.js";
21
22
  import * as OwnerScope from "@wardic/dom/unstable/OwnerScope";
22
23
  import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures";
24
+ import { misuse, report } from "./diagnostics.js";
23
25
  import { inViewOptionsOf } from "./gesture-callbacks.js";
24
26
  import * as Keys from "@wardic/dom/unstable/features/Keys";
25
27
  import { createElementStyle } from "./element-style.js";
@@ -40,13 +42,20 @@ import { appearStyle, useWardicAppear, useWardicGate, useWardicValueReads, useWa
40
42
  import * as Feature from "@wardic/dom/unstable/Feature";
41
43
  import { CLIENT_ONLY, CLIENT_ONLY_DEFERRED, CLIENT_ONLY_SYNC, CLIENT_ONLY_SYNC_DEFERRED, firstCallOwnerHere, reactivityIn } from "./solid-reactivity.js";
42
44
  import { useWardicConfig } from "./wardic-config.js";
43
- import { configView } from "./config-view.js";
45
+ import { configView, fixedOver, fixMore } from "./config-view.js";
44
46
  import { Lifecycle } from "./lifecycle.js";
45
47
  import { neverLands, NO_EVENTS, serverWhen } from "./waiters.js";
46
48
  import { usePresenceContext } from "./presence.js";
47
49
  import { createVariantNode, useVariantContext, WardicVariantContext } from "./variant-node.js";
48
50
  /** The entry a missing Feature's message tells the app to import it from: this binding's (#566). */
49
51
  const ENTRY = "@wardic/solid";
52
+ /**
53
+ * Development's word on a missing Feature (#511), with how a Solid 2 app adds it: dom's default names
54
+ * `<LazyWardic>`, Solid 1's still, deleted from Solid 2 (probe: behaviour-runes, after the scopes round).
55
+ */
56
+ 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 })\`.`);
57
+ /** Development's word on a missing Feature, once a provider, as its coded diagnostic (solid-next). */
58
+ const warnMissing = (registry, feature, what) => registry.warnOnce(feature, missingMessage(feature, what), "WARDIC_FEATURE_MISSING");
50
59
  /** Every key a ward reads, its callbacks among them. */
51
60
  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"];
52
61
  const everyKeyRead = true;
@@ -68,7 +77,7 @@ export const WARD_VIEW = configView(WARD_KEYS, ["onUpdate", "dragConstraints", "
68
77
  /** `config` read per key (#259), for a read outside a ward: a `wardic.<tag>`'s props at setup. Internal. */
69
78
  export const wardConfigView = config => WARD_VIEW.of(config);
70
79
  /** A config given whole as an accessor, which the Solid 2 binding no longer reads (#259). */
71
- 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(() => ({ … }))`).";
80
+ 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(() => ({ … }))`).";
72
81
  /**
73
82
  * A ward's mark (#349): what tells a ward given to a component's `wardRef` from a function handed the
74
83
  * component's own ward. Internal: its value is the ward's {@link WardShare}.
@@ -157,7 +166,9 @@ const WARD_MEMBER_KEYS = {
157
166
  return state.tapped;
158
167
  }
159
168
  },
169
+ // `next`, `each` and `when` can be given again: the hooks' own take their place ({@link shareMembers}).
160
170
  next: {
171
+ configurable: true,
161
172
  get() {
162
173
  const state = stateOf(this);
163
174
  if (Predicate.isNotUndefined(state.next)) return state.next;
@@ -168,6 +179,7 @@ const WARD_MEMBER_KEYS = {
168
179
  }
169
180
  },
170
181
  each: {
182
+ configurable: true,
171
183
  get() {
172
184
  const state = stateOf(this);
173
185
  if (Predicate.isNotUndefined(state.each)) return state.each;
@@ -178,6 +190,7 @@ const WARD_MEMBER_KEYS = {
178
190
  }
179
191
  },
180
192
  when: {
193
+ configurable: true,
181
194
  get() {
182
195
  const state = stateOf(this);
183
196
  if (Predicate.isNotUndefined(state.when)) return state.when;
@@ -188,8 +201,68 @@ const WARD_MEMBER_KEYS = {
188
201
  }
189
202
  }
190
203
  };
191
- /** {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`. */
204
+ /**
205
+ * {@link WARD_MEMBER_KEYS} on one prototype over `Function.prototype`.
206
+ *
207
+ * Module state (#460, Q7): made once, and added to once more where the hooks are loaded
208
+ * ({@link shareMembers}), with their own members for every ward.
209
+ */
192
210
  const WARD_MEMBERS = /*#__PURE__*/Object.create(Function.prototype, WARD_MEMBER_KEYS);
211
+ /**
212
+ * Whether `ward` has a state of its own, as a client's has and a server's hasn't: where the hooks
213
+ * keep what they know of it (probe: hooks-first). True of nothing but a ward made here.
214
+ */
215
+ export const keepsState = ward => Predicate.hasProperty(ward, WARD_STATE);
216
+ /** What the hooks keep of `ward`, one with a state of its own ({@link keepsState}): none until they've kept something. */
217
+ export const hooksOf = ward => stateOf(ward).hooks;
218
+ /** Keeps `kept` of `ward` for the hooks, one with a state of its own ({@link keepsState}). */
219
+ export const keepForHooks = (ward, kept) => {
220
+ stateOf(ward).hooks = kept;
221
+ };
222
+ /**
223
+ * Fixes more of `ward`'s config from here on (probe: hooks-first), a ward with a state of its own:
224
+ * what a presence that takes it after it's made has its `animate`, `exit` and `custom` read
225
+ * through, with nothing set up for it on a ward no presence takes. Read in the config's place at
226
+ * the next read of each key; {@link targetAgain} makes that read happen.
227
+ */
228
+ export const fixLater = (ward, fixed) => {
229
+ fixMore(stateOf(ward).written, fixed);
230
+ };
231
+ /**
232
+ * Works `ward`'s target out again (probe: hooks-first): after {@link fixLater}, since what read those
233
+ * keys read them before they were fixed, and follows nothing that says so. From then on it follows
234
+ * whatever the fixed values read. Not in a component's body or a computation, where Solid allows no
235
+ * refresh: at the settle.
236
+ */
237
+ export const targetAgain = ward => {
238
+ const state = stateOf(ward);
239
+ const target = state.target;
240
+ if (Predicate.isNotUndefined(target)) void refresh(target);
241
+ // The names it hands its followers come from its `animate` too: a leader a presence takes hands
242
+ // down the name it leaves by.
243
+ const handsDown = state.handsDown;
244
+ if (Predicate.isNotUndefined(handsDown)) void refresh(handsDown);
245
+ // And what a presence above it leaves it by: its `exit`, kept current by an effect that read it
246
+ // before more was fixed, and isn't told. A ward a presence of the hooks takes keeps its `exit` for
247
+ // that presence, so one above it runs none for it (HP30). Read here; the effect follows whatever it
248
+ // followed, and reads through what's fixed the next time it runs.
249
+ const exitNow = state.exitNow;
250
+ if (Predicate.isNotUndefined(exitNow)) state.exitConfig.current = untrack(exitNow);
251
+ };
252
+ /**
253
+ * More members for the prototype every client ward shares (probe: hooks-first): the hooks' own, a
254
+ * ward's reads and whether it's shown, given once as the hooks load. Each a getter over what the
255
+ * hooks keep of the ward ({@link hooksOf}), as the members here are over its state, so a ward
256
+ * carries nothing for them. One given a name that's here already takes its place.
257
+ */
258
+ export const shareMembers = keys => {
259
+ Object.defineProperties(WARD_MEMBERS, keys);
260
+ };
261
+ /** A member every client ward shares, as it's read of `ward`: for one that takes its place for some wards ({@link shareMembers}). */
262
+ export const sharedMember = name => {
263
+ const descriptor = Object.getOwnPropertyDescriptor(WARD_MEMBERS, name);
264
+ return descriptor.get;
265
+ };
193
266
  /** What a `wardic.*` component or a `<Reorder>` item adds to a ward. Internal. */
194
267
  /**
195
268
  * The config keys that want a gesture on Solid 2 (#525), as the ward's `wants*` read them: an element
@@ -260,21 +333,30 @@ const warnUnreadColors = (registry, features, values) => {
260
333
  return Feature.unreadColorIn(values());
261
334
  }, unread => {
262
335
  if (Predicate.isUndefined(unread)) return;
263
- registry.warnOnce("colors", Feature.missingMessage("colors", `The colour \`${unread}\``, ENTRY));
336
+ warnMissing(registry, "colors", `The colour \`${unread}\``);
264
337
  }, CLIENT_ONLY);
265
338
  };
266
339
  /** Whether a config carries its variants (#398): it sets `variants` or `inherit`. */
267
340
  const carriesVariants = config => Bool.or(Predicate.isNotUndefined(config.variants), Predicate.isNotUndefined(config.inherit));
341
+ /** 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). */
342
+ const carriesFor = (internal, config) => Bool.or(internal.carries === true, carriesVariants(config));
268
343
  /** A child made with `{ parent }` naming a Listening ward (#398's Q10). */
269
- 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({ … }).";
344
+ 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({ … }).";
345
+ /** The **Layout group** a ward made here with `internal` is in: its maker's choice, else the one around it. */
346
+ const groupOf = internal => {
347
+ const chosen = internal.layoutGroup;
348
+ if (Predicate.isNotUndefined(chosen)) return chosen.id;
349
+ return useLayoutGroupId();
350
+ };
270
351
  /**
271
352
  * The **Layout group** a ward's `layoutId` goes in (#432): the one it's made in, as its presence and
272
- * variant parent are; a driving ward's is its given ward's, where that was made, unless the element's
273
- * own props set the `layoutId` (#398), which is then the element's.
353
+ * variant parent are, or its maker's choice; a driving ward's is its given ward's, where that was made,
354
+ * unless the element's own props set the `layoutId` (#398), which is then the element's.
274
355
  */
275
- const layoutGroupFor = (share, fixed) => {
276
- if (Predicate.isUndefined(share)) return useLayoutGroupId();
277
- if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return useLayoutGroupId();
356
+ const layoutGroupFor = (share, internal) => {
357
+ if (Predicate.isUndefined(share)) return groupOf(internal);
358
+ const fixed = internal.fixed;
359
+ if (Bool.and(Predicate.isNotUndefined(fixed), Predicate.hasProperty(fixed, "layoutId"))) return groupOf(internal);
278
360
  return share.layoutGroup;
279
361
  };
280
362
  /**
@@ -290,7 +372,7 @@ const variantParentOf = internal => {
290
372
  }
291
373
  const parent = shareOf(internal.parent);
292
374
  if (Predicate.isNotUndefined(parent)) {
293
- if (Bool.not(parent.carries)) throw new Error(LISTENING_PARENT);
375
+ if (Bool.not(parent.carries)) throw misuse("WARDIC_PARENT_WITHOUT_VARIANTS", LISTENING_PARENT);
294
376
  return parent.provided;
295
377
  }
296
378
  return useVariantContext();
@@ -335,6 +417,12 @@ const controlsOf = (given, animate) => {
335
417
  set: made => setChange(() => made)
336
418
  };
337
419
  };
420
+ /** A ward's config settings: its own over its nearest `WardicConfig`'s, where it has any (`wardicConfig`), else that config's. */
421
+ const configOf = internal => {
422
+ const own = internal.wardicConfig;
423
+ if (Predicate.isNotUndefined(own)) return own;
424
+ return useWardicConfig();
425
+ };
338
426
  /**
339
427
  * `view` with its **Config transition** as its own when it gives none (#434, Motion's
340
428
  * `{ ...config, ...props }`), read per read as its keys are; `view` itself with no `WardicConfig` above.
@@ -393,10 +481,22 @@ const LOADING_NAMES = [];
393
481
  * `animate` names the ward's own variants when it has `variants` (what it can name), and is a target
394
482
  * of values otherwise: setup reads it only to tell which.
395
483
  */
484
+ /**
485
+ * `config` a **Variant child** by its own word, where its internals say so (probe: hooks-first, the
486
+ * gap grill's Q26): core's `variantChild` set on the copy its variant decisions read. As it is for
487
+ * every other ward, a component's among them.
488
+ */
489
+ const variantChildBy = (internal, config) => {
490
+ if (internal.variantChild !== true) return config;
491
+ return {
492
+ ...config,
493
+ variantChild: true
494
+ };
495
+ };
396
496
  export const configAtSetup = setup => {
397
497
  if (setup.pending.length === 0) return setup.config;
398
498
  const fixed = Arr.findFirst(setup.pending, key => Bool.not(LOADS_AS_IT_GOES.has(key)));
399
- if (Option.isSome(fixed)) throw new Error(loadingAtSetup(fixed.value));
499
+ if (Option.isSome(fixed)) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", loadingAtSetup(fixed.value));
400
500
  const config = setup.config;
401
501
  if (Bool.and(Arr.contains(setup.pending, "animate"), Predicate.isNotUndefined(config.variants))) return {
402
502
  ...config,
@@ -420,7 +520,7 @@ const layoutArrivedIn = (arrive, services) => {
420
520
  UndefinedOr.map(arrive, make => UndefinedOr.map(Keys.projectionIn(services), make));
421
521
  };
422
522
  export function wardWith(config, internal) {
423
- if (Predicate.isFunction(config)) throw new Error(WHOLE_ACCESSOR);
523
+ if (Predicate.isFunction(config)) throw misuse("WARDIC_CONFIG_AS_ACCESSOR", WHOLE_ACCESSOR);
424
524
  const runtime = useWardicRuntime();
425
525
  // Its Features (#511, ADR-0067), a Complete element's every one: what they register, a server
426
526
  // render's elements read too (the `colors` Feature's spaces).
@@ -433,11 +533,14 @@ export function wardWith(config, internal) {
433
533
  const layoutProjection = Keys.projectionIn(untrack(features.services));
434
534
  // The provider's, once any section has built it: what its values register with.
435
535
  const builtProjection = useBuiltProjection();
436
- const reducedMotion = useWardicReducedMotion();
536
+ // Its config's settings: its own over its nearest WardicConfig's, where a hook ward gives any
537
+ // (probe: behaviour-runes), else that config's.
538
+ const wardicConfig = configOf(internal);
539
+ const reducedMotion = useWardicReducedMotion(wardicConfig);
437
540
  // Whether its animations are skipped (#468): its nearest WardicConfig's, read as each starts.
438
- const skipAnimations = useWardicSkipAnimations();
541
+ const skipAnimations = useWardicSkipAnimations(wardicConfig);
439
542
  // Where its drag's and pan's points are (#443): its nearest WardicConfig's, read as each starts.
440
- const pagePoint = WardicConfigValue.transformPagePointOf(useWardicConfig());
543
+ const pagePoint = WardicConfigValue.transformPagePointOf(wardicConfig);
441
544
  const positionalKeys = useWardicPositionalKeys();
442
545
  const defaultTransition = useWardicDefaultTransition();
443
546
  // How a value is read in the Environment's own terms (#672).
@@ -458,7 +561,8 @@ export function wardWith(config, internal) {
458
561
  // Its config, read per key where it's read (#259): a change re-runs only what reads the key. With
459
562
  // Animation controls for its `animate` (#433), read once, each change they make is its entry.
460
563
  // Under a `WardicConfig`, its Config transition is its own when it gives none (#434).
461
- const asGiven = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig());
564
+ const written = WARD_VIEW.of(config, internal.fixed);
565
+ const asGiven = configuredView(written, wardicConfig);
462
566
  // The config at setup, a plain copy read untracked: what setup reads, the keys read once among it.
463
567
  // A key still loading (#257 item 1) is left out of it: one the ward reads as it goes holds its
464
568
  // region until it lands; one setup fixes is an error, naming it. Its `animate` there tells
@@ -474,10 +578,10 @@ export function wardWith(config, internal) {
474
578
  onUndefined: () => givenSetup,
475
579
  onDefined: () => WARD_VIEW.setupOf(view)
476
580
  });
477
- const initialConfig = UndefinedOr.match(controls, {
581
+ const initialConfig = variantChildBy(internal, UndefinedOr.match(controls, {
478
582
  onUndefined: () => configAtSetup(setup),
479
583
  onDefined: () => AnimationControls.controlledConfigOf(configAtSetup(setup), undefined)
480
- });
584
+ }));
481
585
  // Its Animation controls' change (#433), read with the Override stack: none without them.
482
586
  const ownChange = UndefinedOr.match(controls, {
483
587
  onUndefined: () => NO_CHANGE,
@@ -496,12 +600,14 @@ export function wardWith(config, internal) {
496
600
  // The nearest <AnimatePresence> (ADR-0007), or none.
497
601
  const presence = usePresenceContext();
498
602
  // The Layout group its `layoutId` goes in (#432): where it's made, or a given ward's.
499
- const layoutGroup = layoutGroupFor(share, internal.fixed);
603
+ const layoutGroup = layoutGroupFor(share, internal);
500
604
  // The values it starts from, read once (ADR-0003): its `initial`, or the one it inherits, or its
501
605
  // `animate` with `initial={false}` (its own, inherited, or its presence's first render, #134).
502
606
  const presenceBlocks = PresenceRecord.presenceBlocksInitial(presence);
503
- if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw new Error(STARTS_AT_PENDING);
504
- const start = Spine.startOf(initialConfig, node.inherited, presenceBlocks, untrack);
607
+ if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(initialConfig, node.inherited, presenceBlocks))) throw misuse("WARDIC_KEY_LOADING_AT_SETUP", STARTS_AT_PENDING);
608
+ // Untracked as a whole: a target that's a store's (a store given as a hook's rune) is read here,
609
+ // in the component's body, for its values now.
610
+ const start = untrack(() => Spine.startOf(initialConfig, node.inherited, presenceBlocks, untrack));
505
611
  // A variant whose resolver throws is this element's alone: reported once until it resolves, the element
506
612
  // keeping its last target (#979; ADR-0074).
507
613
  Spine.reportStart(variantFailures, start);
@@ -570,17 +676,30 @@ export function wardWith(config, internal) {
570
676
  // last one left the page, as a mount after the first render's (no presence holds its `initial`
571
677
  // back). Its Snapshot goes back to it, and its Starting style comes back on until its first commit.
572
678
  let begun = start;
573
- const beginFresh = () => {
574
- // The config now, a plain copy read untracked, as setup reads it: this runs in the mount effect.
679
+ // A fresh start and the Starting style it draws, from the config now: a plain copy read untracked,
680
+ // as setup reads it. Read in the mount effect, and by an element's first read of its style.
681
+ const freshStart = () => {
575
682
  const now = WARD_VIEW.setupOf(view).config;
576
- begun = Spine.startOf(now, node.inherited, false, untrack);
683
+ const from = Spine.startOf(now, node.inherited, false, untrack);
684
+ return {
685
+ from,
686
+ starting: Svg.splitPatchForTag(internal.tag, project(ElementSetup.drawnAtRest(from.initialValues, layoutNode, now.transformTemplate))).style
687
+ };
688
+ };
689
+ const freshStarting = () => freshStart().starting;
690
+ const beginFresh = () => {
691
+ const fresh = freshStart();
692
+ begun = fresh.from;
693
+ // As the first start (#979): its variant's resolver that throws is reported, here where it begins.
577
694
  Spine.reportStart(variantFailures, begun);
578
695
  snapshot.values = {
579
696
  ...begun.initialValues
580
697
  };
581
698
  snapshot.velocities = {};
582
699
  snapshot.drawnAt = {};
583
- elementStyle.restart(Svg.splitPatchForTag(internal.tag, project(ElementSetup.drawnAtRest(begun.initialValues, layoutNode, now.transformTemplate))).style);
700
+ // Its element read this Starting style as it was made, where it was seen coming, so that read
701
+ // isn't run again: any other read of its style is.
702
+ elementStyle.restart(fresh.starting);
584
703
  };
585
704
  const configNow = () => view;
586
705
  const styleNow = () => untrack(userStyle);
@@ -589,10 +708,15 @@ export function wardWith(config, internal) {
589
708
  const exitConfig = {
590
709
  current: Spine.NO_EXIT_CONFIG
591
710
  };
711
+ // How it's read of its config, under a presence: none with no presence above it, and nothing
712
+ // made for it then. Mapped from the presence, a function was made for every ward to make it by.
713
+ let exitNow;
592
714
  if (Predicate.isNotUndefined(presence)) {
715
+ const now = () => Spine.exitConfigOf(cfg(), node.inherited);
716
+ exitNow = now;
593
717
  // Its inherited transition is read untracked here: the effect keeps it current.
594
718
  exitConfig.current = untrack(() => Spine.exitConfigOf(initialConfig, node.inherited));
595
- createEffect(() => Spine.exitConfigOf(cfg(), node.inherited), config => {
719
+ createEffect(now, config => {
596
720
  exitConfig.current = config;
597
721
  }, CLIENT_ONLY_DEFERRED);
598
722
  }
@@ -601,8 +725,21 @@ export function wardWith(config, internal) {
601
725
  // (#140)*). Its section's `layout` makes its node (#511): without it, its layout props do nothing,
602
726
  // and development says so once, unless `layout` is on its way.
603
727
  const wantsNode = Feature.wantsLayoutNode(initialConfig);
728
+ /**
729
+ * Whether its drag waits for its layout node (probe: behaviour-runes): it wants one, has none yet, and a
730
+ * Feature is still on its way (`pending`, read now where not given). A hook row's lazy `layout` that came
731
+ * after `drag` was left out of the track (#582), so a behaviour's `measured()` never saw the drag.
732
+ */
733
+ const holdsForNode = (wants, node, pending) => {
734
+ if (Bool.not(wants)) return false;
735
+ if (Predicate.isNotUndefined(node)) return false;
736
+ return UndefinedOr.match(pending, {
737
+ onUndefined: () => untrack(features.pending),
738
+ onDefined: identity
739
+ });
740
+ };
604
741
  if (DEV && wantsNode && Predicate.isUndefined(layoutProjection) && Bool.not(untrack(features.pending))) {
605
- useFeatureRegistry().warnOnce("layout", Feature.missingMessage("layout", Feature.LAYOUT_PROPS, ENTRY));
742
+ warnMissing(useFeatureRegistry(), "layout", Feature.LAYOUT_PROPS);
606
743
  }
607
744
  const layoutNodes = Bool.match(wantsNode, {
608
745
  onTrue: () => layoutProjection,
@@ -681,9 +818,12 @@ export function wardWith(config, internal) {
681
818
  transparent: true
682
819
  });
683
820
  // A colour only the `colors` Feature reads, on a Slim element without it (#511, decision 7): said
684
- // once per provider, in development only, and not while a lazy load is on its way.
821
+ // once per provider, in development only, and not while a lazy load is on its way. Not of a ward that
822
+ // asks for its Features as it uses them (`targeted`, the hooks'): it asks for `colors` a microtask after
823
+ // a colour shows, when this had already found none on its way, and said so wrongly (AS2, CL1; seen once
824
+ // it was coded, where it had gone to Effect's log unread).
685
825
  // eslint-disable-next-line solid/reactivity -- read inside the warning's effect, where it tracks
686
- if (DEV && internal.complete !== true) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved);
826
+ if (DEV && Bool.and(internal.complete !== true, Predicate.isUndefined(internal.targeted))) warnUnreadColors(useFeatureRegistry(), features, () => target().resolved);
687
827
  // Its gesture states, for what its variant node hands down (#291): bound at setup, before its
688
828
  // children read them. Read from the gestures themselves, not the target: a gesture whose layer
689
829
  // resolves to nothing new leaves the target as it was (`sameResolution`), but is on all the same.
@@ -743,7 +883,7 @@ export function wardWith(config, internal) {
743
883
  if (Bool.not(wanted)) return undefined;
744
884
  const service = GestureFeatures.serviceIn(services, key);
745
885
  if (DEV && Predicate.isUndefined(service) && Bool.not(untrack(features.pending))) {
746
- featureRegistry.warnOnce(name, Feature.missingMessage(name, GestureFeatures.GESTURE_WORDS[name], ENTRY));
886
+ warnMissing(featureRegistry, name, GestureFeatures.GESTURE_WORDS[name]);
747
887
  }
748
888
  return service;
749
889
  };
@@ -814,6 +954,14 @@ export function wardWith(config, internal) {
814
954
  onDefect
815
955
  }));
816
956
  }
957
+ // A behaviour's input (probe: behaviour-runes): told once a mount, once its gestures' input is there.
958
+ const onInput = internal.onInput;
959
+ if (Predicate.isNotUndefined(onInput) && Bool.not(m.input)) {
960
+ UndefinedOr.map(GestureFeatures.serviceIn(services, InputSource.InputSource), input => {
961
+ m.input = true;
962
+ onInput(m.element, input, make => m.watch(make(onDefect)), effect => void runtime.runFork(effect), runtime);
963
+ });
964
+ }
817
965
  };
818
966
  let mounted;
819
967
  // The last two elements given to its ref, for a second one still on the page as it mounts (#349's Q5).
@@ -847,25 +995,32 @@ export function wardWith(config, internal) {
847
995
  held = PresenceRecord.presenceHold(presence, el, shown);
848
996
  return Predicate.isNotUndefined(held);
849
997
  };
998
+ /**
999
+ * Its element's mount ended, and what `afterMount` gave it handed back to be called once the caller's
1000
+ * own work is done (probe: behaviour-runes): a rune's undoing that throws ends nothing of the binding's.
1001
+ */
850
1002
  const unmount = () => {
851
1003
  unhold();
852
- if (Predicate.isUndefined(mounted)) return;
1004
+ if (Predicate.isUndefined(mounted)) return constVoid;
853
1005
  const left = mounted.element;
1006
+ const afterUnmount = mounted.afterUnmount;
854
1007
  mounted.dispose();
855
1008
  mounted = undefined;
856
1009
  if (justLeft.size === 0) queueMicrotask(forgetJustLeft);
857
1010
  justLeft.add(left);
1011
+ return afterUnmount;
858
1012
  };
859
1013
  // Its element's mount goes, and its lifecycle's waits are rejected (#257): one cleanup, which ends
860
1014
  // what its accessors mounted at their first calls too (#566).
861
1015
  // A driving ward's lifecycle is its given ward's, which outlives the element (#349).
862
1016
  onCleanup(() => {
863
- unmount();
1017
+ const afterUnmount = unmount();
864
1018
  if (Predicate.isUndefined(share)) lifecycle.dispose();
865
1019
  UndefinedOr.map(cleanups, all => Arr.forEach(all, runCleanup));
1020
+ afterUnmount();
866
1021
  });
867
1022
  const mount = el => {
868
- if (justLeft.has(el)) throw new Error(REMADE);
1023
+ if (justLeft.has(el)) throw misuse("WARDIC_WARD_MADE_IN_SPREAD", REMADE);
869
1024
  // The ward a component was given follows this element while it's mounted (#349): one at a time.
870
1025
  let undrive;
871
1026
  if (Predicate.isNotUndefined(share)) {
@@ -1032,7 +1187,10 @@ export function wardWith(config, internal) {
1032
1187
  propagation: initialConfig.dragPropagation,
1033
1188
  directionLock: initialConfig.dragDirectionLock,
1034
1189
  transition: dragTransition,
1035
- listen: initialConfig.dragListener
1190
+ listen: UndefinedOr.match(internal.dragListen, {
1191
+ onUndefined: () => initialConfig.dragListener,
1192
+ onDefined: identity
1193
+ })
1036
1194
  },
1037
1195
  container: constraints.container,
1038
1196
  controls: initialConfig.dragControls,
@@ -1061,7 +1219,14 @@ export function wardWith(config, internal) {
1061
1219
  onReleaseEnd: () => lifecycle.released()
1062
1220
  });
1063
1221
  };
1064
- let dragTrack = UndefinedOr.map(dragGesture, driveDrag);
1222
+ // One that wants a layout node whose `layout` is still on its way holds its drag back until the node
1223
+ // is made, so its track drives the node (probe: behaviour-runes): a hook row's Features come as its
1224
+ // config asks, `drag` before `layout` as often as not, and a node made after the track was left out
1225
+ // of it (#582), so a behaviour's `measured()` never saw the drag.
1226
+ let dragTrack = Bool.match(holdsForNode(wantsNode, layout), {
1227
+ onTrue: constUndefined,
1228
+ onFalse: () => UndefinedOr.map(dragGesture, driveDrag)
1229
+ });
1065
1230
  const spineOptions = {
1066
1231
  runtime,
1067
1232
  gate,
@@ -1145,6 +1310,8 @@ export function wardWith(config, internal) {
1145
1310
  pan: false,
1146
1311
  inView: false,
1147
1312
  focus: false,
1313
+ input: false,
1314
+ afterUnmount: constVoid,
1148
1315
  dispose: () => {
1149
1316
  if (Predicate.isNotUndefined(undrive)) undrive();
1150
1317
  UndefinedOr.map(mountedHook, end => end());
@@ -1195,9 +1362,10 @@ export function wardWith(config, internal) {
1195
1362
  services,
1196
1363
  pending
1197
1364
  }) => {
1198
- UndefinedOr.map(mounted, m => layoutArrivedIn(m.arriveLayout, services));
1365
+ // Its node reads its config's options (its `layoutId`, an accessor's): untracked, as at its mount, so said.
1366
+ UndefinedOr.map(mounted, m => untrack(() => layoutArrivedIn(m.arriveLayout, services)));
1199
1367
  if (DEV && Predicate.isUndefined(Keys.projectionIn(services)) && Bool.not(pending)) {
1200
- featureRegistry.warnOnce("layout", Feature.missingMessage("layout", Feature.LAYOUT_PROPS, ENTRY));
1368
+ warnMissing(featureRegistry, "layout", Feature.LAYOUT_PROPS);
1201
1369
  }
1202
1370
  }, CLIENT_ONLY_DEFERRED);
1203
1371
  }
@@ -1217,11 +1385,14 @@ export function wardWith(config, internal) {
1217
1385
  UndefinedOr.match(GestureFeatures.serviceIn(services, Keys.DragGesture), {
1218
1386
  // A `layout` from the same load makes its node first, so the track drives it (#582).
1219
1387
  onDefined: gesture => UndefinedOr.map(mounted, m => {
1220
- layoutArrivedIn(m.arriveLayout, services);
1221
- UndefinedOr.map(m.startDrag, start => start(gesture));
1388
+ untrack(() => layoutArrivedIn(m.arriveLayout, services));
1389
+ // One that wants a node starts its drag once it has one, or once nothing more is coming.
1390
+ if (Bool.not(holdsForNode(wantsNode, m.layout, pending))) UndefinedOr.map(m.startDrag, start => start(gesture));
1391
+ // Its input with it, for a behaviour's keys (probe: behaviour-runes).
1392
+ startRecognizers(m);
1222
1393
  }),
1223
1394
  onUndefined: () => {
1224
- if (DEV && Bool.not(pending)) featureRegistry.warnOnce("drag", Feature.missingMessage("drag", GestureFeatures.GESTURE_WORDS.drag, ENTRY));
1395
+ if (DEV && Bool.not(pending)) warnMissing(featureRegistry, "drag", GestureFeatures.GESTURE_WORDS.drag);
1225
1396
  }
1226
1397
  });
1227
1398
  }, CLIENT_ONLY_DEFERRED);
@@ -1258,26 +1429,43 @@ export function wardWith(config, internal) {
1258
1429
  el,
1259
1430
  resolution
1260
1431
  } = mounting;
1432
+ let mountedNow = false;
1433
+ // What the last element's `afterMount` gave, called once this one is mounted and aimed.
1434
+ let afterLast = constVoid;
1261
1435
  if (Predicate.isUndefined(mounted) || mounted.element !== el) {
1262
1436
  // Another element it was spread on, or the one it's on, still on the page: a ward drives one
1263
1437
  // element at a time (#349's Q5). One the page has let go of is left behind.
1264
- if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw new Error(secondElement("ward(config)"));
1438
+ if (Bool.or(stillOn(refdBefore, el), stillOn(UndefinedOr.map(mounted, elementOfMount), el))) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement("ward(config)"));
1265
1439
  refdBefore = undefined;
1266
1440
  // Held off the page: nothing starts until it's on it.
1267
1441
  if (heldBack(el)) return;
1268
1442
  // A new element starts with no gesture on, read from its gesture state (#257's audit).
1269
- unmount();
1270
- // One that came after the last left the page enters fresh (#414).
1271
- if (el === fresh) beginFresh();
1443
+ afterLast = unmount();
1444
+ // One that came after the last left the page enters fresh (#414). One that doesn't, read as
1445
+ // one that would, reads its style again.
1446
+ Bool.match(el === fresh, {
1447
+ onTrue: beginFresh,
1448
+ onFalse: elementStyle.notFresh
1449
+ });
1272
1450
  // Its config is read at mount (its layout node's options, its `onUpdate`, its spine's) through
1273
1451
  // the per-key view (#259): untracked, so said, as the Retarget below.
1274
1452
  mounted = untrack(() => mount(el));
1453
+ mountedNow = true;
1275
1454
  }
1276
1455
  // The spine reads the variant context (its gates, its stagger, what it inherits) at the
1277
1456
  // Retarget, once: untracked, so said (Solid 2's dev build warns of a reactive read in an
1278
1457
  // effect's apply, STRICT_READ_UNTRACKED). The effect's compute is what re-runs it.
1279
- const spine = mounted.spine;
1458
+ const m = mounted;
1459
+ const spine = m.spine;
1460
+ // What it resolved to, told to a ward that asks for its Features as it uses them (`targeted`).
1461
+ const targeted = internal.targeted;
1462
+ if (Predicate.isNotUndefined(targeted)) targeted(resolution.resolved);
1280
1463
  untrack(() => spine.retarget(resolution));
1464
+ // A hooks ward's runes' `ref`s, once it's mounted and aimed (probe: behaviour-runes): the last
1465
+ // element's undone, then this one's run. Not untracked, which is the `ref`'s author's to say.
1466
+ afterLast();
1467
+ const afterMount = internal.afterMount;
1468
+ if (mountedNow && Predicate.isNotUndefined(afterMount)) m.afterUnmount = afterMount(el);
1281
1469
  }, CLIENT_ONLY_SYNC);
1282
1470
  // `<card.Provider>` hands down what this element hands its children (#50).
1283
1471
  const Provider = props => _$createComponent(WardicVariantContext, {
@@ -1356,9 +1544,45 @@ export function wardWith(config, internal) {
1356
1544
  };
1357
1545
  }
1358
1546
  });
1547
+ // Whether its presence says the next element it's given enters afresh (probe: hooks-first).
1548
+ const presenceSaysFresh = () => {
1549
+ const enters = internal.entersFresh;
1550
+ if (Predicate.isUndefined(enters)) return false;
1551
+ return enters(self);
1552
+ };
1553
+ // Whether the element a first read of its style is for enters fresh (#414), told before its mount
1554
+ // begins it: its ref has decided it for one given and not yet mounted, and will say this of the next.
1555
+ const comesFresh = () => {
1556
+ const last = refdLast;
1557
+ if (Predicate.isUndefined(last)) return presenceSaysFresh();
1558
+ if (UndefinedOr.map(mounted, elementOfMount) !== last) return fresh === last;
1559
+ return Bool.or(Bool.not(last.isConnected), presenceSaysFresh());
1560
+ };
1561
+ // Each computation that has read its style: one for each element it's on, the same at every run of
1562
+ // that element's props. So a first read is an element's being made.
1563
+ const styleReaders = new WeakSet();
1359
1564
  const renderedStyle = () => {
1360
1565
  holdWhileLoading();
1361
- return elementStyle.style(userStyle());
1566
+ const user = userStyle();
1567
+ const reader = getOwner();
1568
+ // Read outside a computation, or by one that has read it before: as the gate has it.
1569
+ if (Predicate.isNull(reader)) return elementStyle.style(user);
1570
+ if (styleReaders.has(reader)) return elementStyle.style(user);
1571
+ // An element that enters fresh reads its Starting style here, derived from what its ref goes by.
1572
+ // Its mount begins the entry once the ref has given it, and doesn't run this read again: told
1573
+ // of the restart afterwards, a spread re-ran on a write its own effect had led to, through the
1574
+ // ref it calls (EFFECT_WRITES_OWN_SOURCE).
1575
+ const style = Bool.match(comesFresh(), {
1576
+ onTrue: () => elementStyle.entering(user, untrack(freshStarting)),
1577
+ onFalse: () => elementStyle.style(user)
1578
+ });
1579
+ styleReaders.add(reader);
1580
+ // Told to the hooks, where they made it, in development alone (probe: hooks-first, Q29).
1581
+ if (DEV) {
1582
+ const styled = internal.styled;
1583
+ if (Predicate.isNotUndefined(styled)) styled(self);
1584
+ }
1585
+ return style;
1362
1586
  };
1363
1587
  // The ward: a ref, and its own props. Under a presence, its element is told to it as it's made
1364
1588
  // (#286): its `key`, and whether it's a twin.
@@ -1372,7 +1596,7 @@ export function wardWith(config, internal) {
1372
1596
  * element of its own (#349's Q5).
1373
1597
  */
1374
1598
  const drive = (next, name) => {
1375
- if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw new Error(secondElement(name));
1599
+ if (Bool.or(Predicate.isNotUndefined(driver), stillOn(UndefinedOr.map(mounted, elementOfMount), undefined))) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement(name));
1376
1600
  driver = next;
1377
1601
  UndefinedOr.map(driven, atom => registry().set(atom, next));
1378
1602
  return () => {
@@ -1385,9 +1609,10 @@ export function wardWith(config, internal) {
1385
1609
  config,
1386
1610
  setup: initialConfig,
1387
1611
  internal,
1612
+ fixed: () => fixedOver(written),
1388
1613
  parent,
1389
1614
  chosen: Predicate.isNotUndefined(internal.parent),
1390
- carries: carriesVariants(initialConfig),
1615
+ carries: carriesFor(internal, initialConfig),
1391
1616
  provided: node.provided,
1392
1617
  layoutGroup,
1393
1618
  node,
@@ -1399,6 +1624,10 @@ export function wardWith(config, internal) {
1399
1624
  const setMade = Spine.madeWith(presence, setElement, initialConfig);
1400
1625
  const self = value => {
1401
1626
  if (isElement(value)) {
1627
+ // Told to the hooks, where they made it (probe: hooks-first): what a leaving row finds inside it.
1628
+ // No callback made for it: this runs for every element of every ward.
1629
+ const handed = internal.handed;
1630
+ if (Predicate.isNotUndefined(handed)) handed(value, self);
1402
1631
  const last = refdLast;
1403
1632
  if (Predicate.isNotUndefined(last)) {
1404
1633
  if (last !== value) {
@@ -1406,12 +1635,21 @@ export function wardWith(config, internal) {
1406
1635
  if (Bool.not(last.isConnected)) fresh = value;
1407
1636
  }
1408
1637
  }
1638
+ // A presence's next value (probe: hooks-first): its element enters afresh though the last may
1639
+ // still be on the page, and so does the first one of a value that came after the page opened.
1640
+ if (Bool.and(last !== value, presenceSaysFresh())) fresh = value;
1409
1641
  refdLast = value;
1410
1642
  setMade(value);
1411
1643
  return undefined;
1412
1644
  }
1413
1645
  return spreadNow();
1414
1646
  };
1647
+ // The presence it's made under, for a hook ward to watch its child's leave by (probe: hooks-first).
1648
+ // No callback made for it: this runs for every ward under a presence, each row of a list.
1649
+ if (Predicate.isNotUndefined(presence)) {
1650
+ const madeUnder = internal.madeUnder;
1651
+ if (Predicate.isNotUndefined(madeUnder)) madeUnder(self, presence);
1652
+ }
1415
1653
  // What a spread of the ward reads (#495): its spread's props alone, made at its first spread, so a
1416
1654
  // ward given only to `ref` makes none, and a Reorder item's keyboard attributes are in it.
1417
1655
  let spread;
@@ -1451,11 +1689,17 @@ export function wardWith(config, internal) {
1451
1689
  lifecycle,
1452
1690
  element,
1453
1691
  hold: holdWhileLoading,
1692
+ written,
1693
+ target,
1694
+ handsDown: node.handsDown,
1695
+ exitConfig,
1696
+ exitNow,
1454
1697
  settled: undefined,
1455
1698
  tapped: undefined,
1456
1699
  next: undefined,
1457
1700
  each: undefined,
1458
- when: undefined
1701
+ when: undefined,
1702
+ hooks: undefined
1459
1703
  };
1460
1704
  Object.setPrototypeOf(self, WARD_MEMBERS);
1461
1705
  Object.defineProperties(self, {
@@ -1574,19 +1818,19 @@ const serverWard = (config, internal) => {
1574
1818
  // A server's own values: the DOM's, its context's constant (#672).
1575
1819
  const ownValues = ElementSetup.valueReadsOf(useWardicValueReads()).ownValues;
1576
1820
  createUniqueId();
1577
- const view = configuredView(WARD_VIEW.of(config, internal.fixed), useWardicConfig());
1821
+ const view = configuredView(WARD_VIEW.of(config, internal.fixed), configOf(internal));
1578
1822
  // A key still loading (#257 item 1): one setup fixes is the client's error here too. One the ward
1579
1823
  // reads as it goes is read again, throwing Solid's `NotReadyError`: a server waits for it and
1580
1824
  // renders the component again, so its region streams once the data is in, Appear and all.
1581
1825
  // Both are checked before the read that waits.
1582
1826
  const setup = WARD_VIEW.setupOf(view);
1583
1827
  // Animation controls (#433) set nothing on a server: no entry yet, and controlled, as on the client.
1584
- const atSetup = AnimationControls.uncontrolledOf(configAtSetup(setup));
1828
+ const atSetup = variantChildBy(internal, AnimationControls.uncontrolledOf(configAtSetup(setup)));
1585
1829
  // Where it's made, its given parent's, or its given ward's (#349).
1586
1830
  const parent = variantParentOf(internal);
1587
1831
  const presenceBlocks = PresenceRecord.presenceBlocksInitial(usePresenceContext());
1588
- if (Bool.and(Arr.contains(setup.pending, "animate"), VariantTree.startsAtAnimate(atSetup, VariantTree.inheritedContext(atSetup, parent), presenceBlocks))) throw new Error(STARTS_AT_PENDING);
1589
- const c = AnimationControls.uncontrolledOf(WARD_VIEW.snapshotOf(view));
1832
+ 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);
1833
+ const c = variantChildBy(internal, AnimationControls.uncontrolledOf(WARD_VIEW.snapshotOf(view)));
1590
1834
  const node = VariantTree.serverVariantNode(c, parent);
1591
1835
  const serverStart = Spine.startOf(c, node.inherited, presenceBlocks, untrack);
1592
1836
  // A variant that throws leaves its values out of the markup, logged on the server (#979).
@@ -1623,7 +1867,13 @@ const serverWard = (config, internal) => {
1623
1867
  onDefined: base => base()
1624
1868
  })), Style.over(dragDefaults), Style.over(appear.style));
1625
1869
  };
1626
- const style = styleFor(c.style);
1870
+ // Worked out at its first read, a spread's (probe: behaviour-runes): what's made after the ward and
1871
+ // before its element renders still counts, a hooks row's grip, which takes its `touch-action` away.
1872
+ let style;
1873
+ const styleNow = () => {
1874
+ if (Predicate.isUndefined(style)) style = styleFor(c.style);
1875
+ return style;
1876
+ };
1627
1877
  let given = NO_WITH;
1628
1878
  const attributes = attributeKeysOf(seed.attrs, Predicate.isNotUndefined(dragDefaults));
1629
1879
  // A spread of it reads its spread's props alone, made at its first spread, as the client's (#495).
@@ -1633,7 +1883,7 @@ const serverWard = (config, internal) => {
1633
1883
  value: noRef,
1634
1884
  enumerable: true
1635
1885
  }, {
1636
- value: style,
1886
+ get: styleNow,
1637
1887
  enumerable: true
1638
1888
  }, attributes);
1639
1889
  return spread;
@@ -1643,11 +1893,12 @@ const serverWard = (config, internal) => {
1643
1893
  config,
1644
1894
  setup: atSetup,
1645
1895
  internal,
1896
+ fixed: () => internal.fixed,
1646
1897
  parent,
1647
1898
  chosen: Predicate.isNotUndefined(internal.parent),
1648
- carries: carriesVariants(atSetup),
1899
+ carries: carriesFor(internal, atSetup),
1649
1900
  provided: appear.provided,
1650
- layoutGroup: useLayoutGroupId(),
1901
+ layoutGroup: groupOf(internal),
1651
1902
  node: undefined,
1652
1903
  lifecycle: undefined,
1653
1904
  drive: () => constVoid
@@ -1661,7 +1912,7 @@ const serverWard = (config, internal) => {
1661
1912
  enumerable: true
1662
1913
  },
1663
1914
  style: {
1664
- value: style,
1915
+ get: styleNow,
1665
1916
  enumerable: true
1666
1917
  },
1667
1918
  ...attributes,
@@ -1691,8 +1942,11 @@ const serverWard = (config, internal) => {
1691
1942
  when: {
1692
1943
  value: serverWhen
1693
1944
  },
1694
- // The element's own style over the config's, rendered in its Starting style (#264).
1945
+ // The element's own style over the config's, rendered in its Starting style (#264). Configurable,
1946
+ // as a client's is by being a shared member: so what makes a ward of this one can give it a
1947
+ // `with` of its own, on a server as in a browser (the hooks', for what their runes add to a spread).
1695
1948
  with: {
1949
+ configurable: true,
1696
1950
  value: own => {
1697
1951
  given = own;
1698
1952
  return spreadPropsOf({
@@ -1713,4 +1967,283 @@ const serverWard = (config, internal) => {
1713
1967
  };
1714
1968
  /** A server render's `ref`: Solid never calls it there. */
1715
1969
  const noRef = constUndefined;
1970
+ /** No values: what a function rune's ward rests at, having no config ({@link holderWard}). */
1971
+ const NO_VALUES = {};
1972
+ /** A function rune's ward's config, as it's written and at setup: none. */
1973
+ const NO_WRITTEN = Object.freeze({});
1974
+ /** A function rune's ward's exit: none, never read again, as it has no `exitNow`. */
1975
+ const NO_EXIT = Object.freeze({
1976
+ current: Spine.NO_EXIT_CONFIG
1977
+ });
1978
+ /**
1979
+ * What development says of `member` used in a function rune's body (the ward split's Q7): it's the
1980
+ * finished ward's, and that ward isn't made yet.
1981
+ */
1982
+ 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.";
1983
+ // Module state (#460, Q7): what development has said, each member once.
1984
+ const SAID_EARLY = new Set();
1985
+ /** Says {@link usedEarly} of `member`, once, in development. */
1986
+ const sayEarly = member => {
1987
+ if (Predicate.isUndefined(DEV)) return;
1988
+ if (SAID_EARLY.has(member)) return;
1989
+ SAID_EARLY.add(member);
1990
+ report("WARDIC_RUNE_READ_TOO_EARLY", usedEarly(member));
1991
+ };
1992
+ /** The finished ward each function rune's ward hands on to, told it by {@link holderFinished}. */
1993
+ // Module state (#460, Q7): held weakly by the function rune's ward.
1994
+ const FINISHING = new WeakMap();
1995
+ /** Tells `holder`, a function rune's ward ({@link holderWard}), the ward it's part of, now that it's made. */
1996
+ export const holderFinished = (holder, ward) => {
1997
+ UndefinedOr.map(FINISHING.get(holder), finish => finish(ward));
1998
+ };
1999
+ /**
2000
+ * A function rune's ward (probe: behaviour-runes, the ward split's Q6–Q8, Q11), made before the ward it's
2001
+ * part of, since every rune runs before that ward is: a lifecycle and what the hooks keep, with no config,
2002
+ * no variant node and no mount. The finished ward adopts its lifecycle through its share, as a ward given
2003
+ * to a component does (#349), and drives its `read` and `atom` while it's on an element: as the second
2004
+ * binding ward this replaces did, at a fraction of its cost. What only the finished ward has, its
2005
+ * `Provider`, its spread and `with`, its `style` and its element, it hands on to that ward once
2006
+ * {@link holderFinished} says which: used in the rune's body, before then, development says so. It takes
2007
+ * no hydration id, on a server or in a browser.
2008
+ */
2009
+ export const holderWard = internal => {
2010
+ // Where it's made: the variant context and Layout group its finished ward takes through its share.
2011
+ const parent = variantParentOf(internal);
2012
+ const layoutGroup = groupOf(internal);
2013
+ if (isServer) return serverHolder(internal, parent, layoutGroup);
2014
+ return clientHolder(internal, parent, layoutGroup);
2015
+ };
2016
+ /** A function rune's ward in a browser ({@link holderWard}). */
2017
+ const clientHolder = (internal, parent, layoutGroup) => {
2018
+ const registry = Spine.registryOf(useWardicRuntime());
2019
+ const firstCallOwner = firstCallOwnerHere();
2020
+ let finished;
2021
+ // The finished ward on its element (#349's driver): what its `read`, `atom` and `next` follow.
2022
+ let driver;
2023
+ let driven;
2024
+ let cleanups;
2025
+ const addCleanup = cleanup => {
2026
+ if (Predicate.isUndefined(cleanups)) cleanups = [];
2027
+ cleanups.push(cleanup);
2028
+ };
2029
+ const drivenAtom = () => {
2030
+ if (Predicate.isNotUndefined(driven)) return driven;
2031
+ const atom = Atom.make(driver);
2032
+ addCleanup(registry().mount(atom));
2033
+ driven = atom;
2034
+ return atom;
2035
+ };
2036
+ // Its gestures are its finished ward's: a `next` that asks for one starts it on that ward's element.
2037
+ const lifecycle = new Lifecycle(firstCallOwner, () => {
2038
+ UndefinedOr.map(driver, d => d.wanted());
2039
+ });
2040
+ onCleanup(() => {
2041
+ lifecycle.dispose();
2042
+ UndefinedOr.map(cleanups, all => Arr.forEach(all, runCleanup));
2043
+ });
2044
+ // A key's value: the finished ward's element's, while it drives this one; where nothing rests, else.
2045
+ let reads;
2046
+ const read = key => {
2047
+ if (Predicate.isUndefined(reads)) reads = new Map();
2048
+ const known = reads.get(key);
2049
+ if (Predicate.isNotUndefined(known)) return known;
2050
+ const following = drivenAtom();
2051
+ const resting = ElementSetup.restingOf(key, NO_VALUES, undefined, identity);
2052
+ const atom = Atom.make(get => UndefinedOr.match(get(following), {
2053
+ onUndefined: () => resting,
2054
+ onDefined: d => get(d.readAtom(key))
2055
+ }));
2056
+ const accessor = runWithOwner(firstCallOwner, () => followAtom(registry(), atom, addCleanup));
2057
+ reads.set(key, accessor);
2058
+ return accessor;
2059
+ };
2060
+ const atomOf = key => {
2061
+ const following = drivenAtom();
2062
+ return Atom.make(get => UndefinedOr.match(get(following), {
2063
+ onUndefined: constUndefined,
2064
+ onDefined: d => get(d.atom(key))
2065
+ }));
2066
+ };
2067
+ // Followed by one finished ward at a time (#349's Q5).
2068
+ const drive = (next, name) => {
2069
+ if (Predicate.isNotUndefined(driver)) throw misuse("WARDIC_WARD_ON_TWO_SUBJECTS", secondElement(name));
2070
+ driver = next;
2071
+ UndefinedOr.map(driven, atom => registry().set(atom, next));
2072
+ return () => {
2073
+ if (driver !== next) return;
2074
+ driver = undefined;
2075
+ UndefinedOr.map(driven, atom => registry().set(atom, undefined));
2076
+ };
2077
+ };
2078
+ const shared = {
2079
+ config: NO_WRITTEN,
2080
+ setup: NO_WRITTEN,
2081
+ internal,
2082
+ fixed: () => internal.fixed,
2083
+ parent,
2084
+ chosen: Predicate.isNotUndefined(internal.parent),
2085
+ carries: false,
2086
+ provided: undefined,
2087
+ layoutGroup,
2088
+ node: undefined,
2089
+ lifecycle,
2090
+ drive
2091
+ };
2092
+ const self = value => UndefinedOr.match(finished, {
2093
+ onUndefined: () => {
2094
+ sayEarly("the ward as a ref or a spread");
2095
+ return undefined;
2096
+ },
2097
+ onDefined: to => to(value)
2098
+ });
2099
+ const state = {
2100
+ shared: () => shared,
2101
+ Provider: props => UndefinedOr.match(finished, {
2102
+ onUndefined: () => {
2103
+ sayEarly("Provider");
2104
+ return props.children;
2105
+ },
2106
+ onDefined: to => to.Provider(props)
2107
+ }),
2108
+ read,
2109
+ atom: atomOf,
2110
+ with: own => UndefinedOr.match(finished, {
2111
+ onUndefined: () => {
2112
+ sayEarly("with");
2113
+ return spreadPropsOf({});
2114
+ },
2115
+ onDefined: to => to.with(own)
2116
+ }),
2117
+ lifecycle,
2118
+ element: () => UndefinedOr.match(finished, {
2119
+ onUndefined: constUndefined,
2120
+ onDefined: to => UndefinedOr.match(sensedOf(to), {
2121
+ onUndefined: constUndefined,
2122
+ onDefined: sensed => sensed.element()
2123
+ })
2124
+ }),
2125
+ hold: () => {
2126
+ UndefinedOr.map(finished, to => stateOf(to).hold());
2127
+ },
2128
+ written: NO_WRITTEN,
2129
+ target: undefined,
2130
+ handsDown: undefined,
2131
+ exitConfig: NO_EXIT,
2132
+ exitNow: undefined,
2133
+ settled: undefined,
2134
+ tapped: undefined,
2135
+ next: undefined,
2136
+ each: undefined,
2137
+ when: undefined,
2138
+ hooks: undefined
2139
+ };
2140
+ FINISHING.set(self, ward => {
2141
+ finished = ward;
2142
+ });
2143
+ Object.setPrototypeOf(self, WARD_MEMBERS);
2144
+ Object.defineProperties(self, {
2145
+ [WARD_STATE]: {
2146
+ value: state
2147
+ },
2148
+ ref: {
2149
+ value: self,
2150
+ enumerable: true
2151
+ },
2152
+ style: {
2153
+ get: () => styleOf(finished),
2154
+ enumerable: true
2155
+ }
2156
+ });
2157
+ return self;
2158
+ };
2159
+ /** A function rune's ward's `style`: its finished ward's. */
2160
+ const styleOf = finished => UndefinedOr.match(finished, {
2161
+ onUndefined: () => {
2162
+ sayEarly("style");
2163
+ return {};
2164
+ },
2165
+ onDefined: to => to.style
2166
+ });
2167
+ /** A function rune's ward on a server ({@link holderWard}): a server ward's members, and its share. Nothing hears anything there. */
2168
+ const serverHolder = (internal, parent, layoutGroup) => {
2169
+ let finished;
2170
+ const self = () => UndefinedOr.match(finished, {
2171
+ onUndefined: () => {
2172
+ sayEarly("the ward as a ref or a spread");
2173
+ return undefined;
2174
+ },
2175
+ onDefined: to => to()
2176
+ });
2177
+ const shared = {
2178
+ config: NO_WRITTEN,
2179
+ setup: NO_WRITTEN,
2180
+ internal,
2181
+ fixed: () => internal.fixed,
2182
+ parent,
2183
+ chosen: Predicate.isNotUndefined(internal.parent),
2184
+ carries: false,
2185
+ provided: undefined,
2186
+ layoutGroup,
2187
+ node: undefined,
2188
+ lifecycle: undefined,
2189
+ drive: () => constVoid
2190
+ };
2191
+ FINISHING.set(self, ward => {
2192
+ finished = ward;
2193
+ });
2194
+ Object.defineProperties(self, {
2195
+ [WARD]: {
2196
+ value: shared
2197
+ },
2198
+ ref: {
2199
+ value: noRef,
2200
+ enumerable: true
2201
+ },
2202
+ style: {
2203
+ get: () => styleOf(finished),
2204
+ enumerable: true
2205
+ },
2206
+ Provider: {
2207
+ value: props => UndefinedOr.match(finished, {
2208
+ onUndefined: () => {
2209
+ sayEarly("Provider");
2210
+ return props.children;
2211
+ },
2212
+ onDefined: to => to.Provider(props)
2213
+ })
2214
+ },
2215
+ read: {
2216
+ value: key => () => ElementSetup.restingOf(key, NO_VALUES, undefined, identity)
2217
+ },
2218
+ atom: {
2219
+ value: () => NO_OUTPUT
2220
+ },
2221
+ settled: {
2222
+ value: constUndefined
2223
+ },
2224
+ tapped: {
2225
+ value: constUndefined
2226
+ },
2227
+ next: {
2228
+ value: neverLands
2229
+ },
2230
+ each: {
2231
+ value: () => NO_EVENTS
2232
+ },
2233
+ when: {
2234
+ value: serverWhen
2235
+ },
2236
+ with: {
2237
+ configurable: true,
2238
+ value: own => UndefinedOr.match(finished, {
2239
+ onUndefined: () => {
2240
+ sayEarly("with");
2241
+ return spreadPropsOf({});
2242
+ },
2243
+ onDefined: to => to.with(own)
2244
+ })
2245
+ }
2246
+ });
2247
+ return self;
2248
+ };
1716
2249
  //# sourceMappingURL=ward.js.map