@wardic/solid 2.2.0 → 3.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. package/README.md +22 -18
  2. package/dist/browser/config-view.js +33 -5
  3. package/dist/browser/config-view.js.map +1 -1
  4. package/dist/browser/create-batch.js +1 -1
  5. package/dist/browser/element-style.js +61 -7
  6. package/dist/browser/element-style.js.map +1 -1
  7. package/dist/browser/element.js +19 -2
  8. package/dist/browser/element.js.map +1 -1
  9. package/dist/browser/feature-section.js +5 -13
  10. package/dist/browser/feature-section.js.map +1 -1
  11. package/dist/browser/hooks/auto.js +270 -0
  12. package/dist/browser/hooks/auto.js.map +1 -0
  13. package/dist/browser/hooks/config-scope.js +120 -0
  14. package/dist/browser/hooks/config-scope.js.map +1 -0
  15. package/dist/browser/hooks/config.js +37 -0
  16. package/dist/browser/hooks/config.js.map +1 -0
  17. package/dist/browser/hooks/drag.js +632 -0
  18. package/dist/browser/hooks/drag.js.map +1 -0
  19. package/dist/browser/hooks/elements.js +183 -0
  20. package/dist/browser/hooks/elements.js.map +1 -0
  21. package/dist/browser/hooks/group.js +28 -0
  22. package/dist/browser/hooks/group.js.map +1 -0
  23. package/dist/browser/hooks/index.js +10 -0
  24. package/dist/browser/hooks/index.js.map +1 -0
  25. package/dist/browser/hooks/kept.js +32 -0
  26. package/dist/browser/hooks/kept.js.map +1 -0
  27. package/dist/browser/hooks/layout-group-of.js +39 -0
  28. package/dist/browser/hooks/layout-group-of.js.map +1 -0
  29. package/dist/browser/hooks/layout-group.js +92 -0
  30. package/dist/browser/hooks/layout-group.js.map +1 -0
  31. package/dist/browser/hooks/make-ward.js +157 -0
  32. package/dist/browser/hooks/make-ward.js.map +1 -0
  33. package/dist/browser/hooks/presence-scope.js +87 -0
  34. package/dist/browser/hooks/presence-scope.js.map +1 -0
  35. package/dist/browser/hooks/presence.js +24 -0
  36. package/dist/browser/hooks/presence.js.map +1 -0
  37. package/dist/browser/hooks/props.js +148 -0
  38. package/dist/browser/hooks/props.js.map +1 -0
  39. package/dist/browser/hooks/reads.js +241 -0
  40. package/dist/browser/hooks/reads.js.map +1 -0
  41. package/dist/browser/hooks/refs.js +87 -0
  42. package/dist/browser/hooks/refs.js.map +1 -0
  43. package/dist/browser/hooks/reorder-elements.js +268 -0
  44. package/dist/browser/hooks/reorder-elements.js.map +1 -0
  45. package/dist/browser/hooks/reorder.js +176 -0
  46. package/dist/browser/hooks/reorder.js.map +1 -0
  47. package/dist/browser/hooks/rune.js +799 -0
  48. package/dist/browser/hooks/rune.js.map +1 -0
  49. package/dist/browser/hooks/server-features.client.js +2 -0
  50. package/dist/browser/hooks/server-features.client.js.map +1 -0
  51. package/dist/browser/hooks/server-features.js +13 -0
  52. package/dist/browser/hooks/server-features.js.map +1 -0
  53. package/dist/browser/hooks/settings.js +29 -0
  54. package/dist/browser/hooks/settings.js.map +1 -0
  55. package/dist/browser/hooks/setup.js +154 -0
  56. package/dist/browser/hooks/setup.js.map +1 -0
  57. package/dist/browser/hooks/stage.js +117 -0
  58. package/dist/browser/hooks/stage.js.map +1 -0
  59. package/dist/browser/hooks/ward.js +2193 -0
  60. package/dist/browser/hooks/ward.js.map +1 -0
  61. package/dist/browser/hooks/wardic-provider.js +29 -0
  62. package/dist/browser/hooks/wardic-provider.js.map +1 -0
  63. package/dist/browser/hooks/wardic-scope.js +68 -0
  64. package/dist/browser/hooks/wardic-scope.js.map +1 -0
  65. package/dist/browser/hooks/wards.js +562 -0
  66. package/dist/browser/hooks/wards.js.map +1 -0
  67. package/dist/browser/index.js +23 -11
  68. package/dist/browser/index.js.map +1 -1
  69. package/dist/browser/layout.js +7 -58
  70. package/dist/browser/layout.js.map +1 -1
  71. package/dist/browser/lazy-batch-gestures.js +1 -1
  72. package/dist/browser/lifecycle.js +37 -0
  73. package/dist/browser/lifecycle.js.map +1 -1
  74. package/dist/browser/presence-handle.js +28 -12
  75. package/dist/browser/presence-handle.js.map +1 -1
  76. package/dist/browser/presence.js +3 -1
  77. package/dist/browser/presence.js.map +1 -1
  78. package/dist/browser/provider.js +85 -70
  79. package/dist/browser/provider.js.map +1 -1
  80. package/dist/browser/reorder-components.js +50 -0
  81. package/dist/browser/reorder-components.js.map +1 -0
  82. package/dist/browser/reorder.js +46 -274
  83. package/dist/browser/reorder.js.map +1 -1
  84. package/dist/browser/stage.js.map +1 -1
  85. package/dist/browser/unstable/v2/index.js +0 -8
  86. package/dist/browser/unstable/v2/index.js.map +1 -1
  87. package/dist/browser/v1/index.js +1 -1
  88. package/dist/browser/v1/index.js.map +1 -1
  89. package/dist/browser/variant-node.js +4 -2
  90. package/dist/browser/variant-node.js.map +1 -1
  91. package/dist/browser/w.js +33 -3
  92. package/dist/browser/w.js.map +1 -1
  93. package/dist/browser/ward.js +576 -49
  94. package/dist/browser/ward.js.map +1 -1
  95. package/dist/browser/wardic-config.js +62 -29
  96. package/dist/browser/wardic-config.js.map +1 -1
  97. package/dist/browser/wardic-context.js +23 -0
  98. package/dist/browser/wardic-context.js.map +1 -0
  99. package/dist/browser/wardic.js +3 -0
  100. package/dist/browser/wardic.js.map +1 -1
  101. package/dist/server/config-view.js +33 -5
  102. package/dist/server/config-view.js.map +1 -1
  103. package/dist/server/create-batch.js +1 -1
  104. package/dist/server/element-style.js +61 -7
  105. package/dist/server/element-style.js.map +1 -1
  106. package/dist/server/element.js +19 -2
  107. package/dist/server/element.js.map +1 -1
  108. package/dist/server/feature-section.js +5 -13
  109. package/dist/server/feature-section.js.map +1 -1
  110. package/dist/server/hooks/auto.js +270 -0
  111. package/dist/server/hooks/auto.js.map +1 -0
  112. package/dist/server/hooks/config-scope.js +120 -0
  113. package/dist/server/hooks/config-scope.js.map +1 -0
  114. package/dist/server/hooks/config.js +37 -0
  115. package/dist/server/hooks/config.js.map +1 -0
  116. package/dist/server/hooks/drag.js +632 -0
  117. package/dist/server/hooks/drag.js.map +1 -0
  118. package/dist/server/hooks/elements.js +192 -0
  119. package/dist/server/hooks/elements.js.map +1 -0
  120. package/dist/server/hooks/group.js +28 -0
  121. package/dist/server/hooks/group.js.map +1 -0
  122. package/dist/server/hooks/index.js +10 -0
  123. package/dist/server/hooks/index.js.map +1 -0
  124. package/dist/server/hooks/kept.js +32 -0
  125. package/dist/server/hooks/kept.js.map +1 -0
  126. package/dist/server/hooks/layout-group-of.js +39 -0
  127. package/dist/server/hooks/layout-group-of.js.map +1 -0
  128. package/dist/server/hooks/layout-group.js +109 -0
  129. package/dist/server/hooks/layout-group.js.map +1 -0
  130. package/dist/server/hooks/make-ward.js +157 -0
  131. package/dist/server/hooks/make-ward.js.map +1 -0
  132. package/dist/server/hooks/presence-scope.js +86 -0
  133. package/dist/server/hooks/presence-scope.js.map +1 -0
  134. package/dist/server/hooks/presence.js +24 -0
  135. package/dist/server/hooks/presence.js.map +1 -0
  136. package/dist/server/hooks/props.js +148 -0
  137. package/dist/server/hooks/props.js.map +1 -0
  138. package/dist/server/hooks/reads.js +241 -0
  139. package/dist/server/hooks/reads.js.map +1 -0
  140. package/dist/server/hooks/refs.js +87 -0
  141. package/dist/server/hooks/refs.js.map +1 -0
  142. package/dist/server/hooks/reorder-elements.js +308 -0
  143. package/dist/server/hooks/reorder-elements.js.map +1 -0
  144. package/dist/server/hooks/reorder.js +176 -0
  145. package/dist/server/hooks/reorder.js.map +1 -0
  146. package/dist/server/hooks/rune.js +799 -0
  147. package/dist/server/hooks/rune.js.map +1 -0
  148. package/dist/server/hooks/server-features.client.js +2 -0
  149. package/dist/server/hooks/server-features.client.js.map +1 -0
  150. package/dist/server/hooks/server-features.js +13 -0
  151. package/dist/server/hooks/server-features.js.map +1 -0
  152. package/dist/server/hooks/settings.js +29 -0
  153. package/dist/server/hooks/settings.js.map +1 -0
  154. package/dist/server/hooks/setup.js +154 -0
  155. package/dist/server/hooks/setup.js.map +1 -0
  156. package/dist/server/hooks/stage.js +117 -0
  157. package/dist/server/hooks/stage.js.map +1 -0
  158. package/dist/server/hooks/ward.js +2193 -0
  159. package/dist/server/hooks/ward.js.map +1 -0
  160. package/dist/server/hooks/wardic-provider.js +29 -0
  161. package/dist/server/hooks/wardic-provider.js.map +1 -0
  162. package/dist/server/hooks/wardic-scope.js +68 -0
  163. package/dist/server/hooks/wardic-scope.js.map +1 -0
  164. package/dist/server/hooks/wards.js +562 -0
  165. package/dist/server/hooks/wards.js.map +1 -0
  166. package/dist/server/index.js +23 -11
  167. package/dist/server/index.js.map +1 -1
  168. package/dist/server/layout.js +7 -75
  169. package/dist/server/layout.js.map +1 -1
  170. package/dist/server/lazy-batch-gestures.js +1 -1
  171. package/dist/server/lifecycle.js +37 -0
  172. package/dist/server/lifecycle.js.map +1 -1
  173. package/dist/server/presence-handle.js +28 -12
  174. package/dist/server/presence-handle.js.map +1 -1
  175. package/dist/server/presence.js +3 -1
  176. package/dist/server/presence.js.map +1 -1
  177. package/dist/server/provider.js +86 -80
  178. package/dist/server/provider.js.map +1 -1
  179. package/dist/server/reorder-components.js +50 -0
  180. package/dist/server/reorder-components.js.map +1 -0
  181. package/dist/server/reorder.js +46 -344
  182. package/dist/server/reorder.js.map +1 -1
  183. package/dist/server/stage.js.map +1 -1
  184. package/dist/server/unstable/v2/index.js +0 -8
  185. package/dist/server/unstable/v2/index.js.map +1 -1
  186. package/dist/server/v1/index.js +1 -1
  187. package/dist/server/v1/index.js.map +1 -1
  188. package/dist/server/variant-node.js +4 -2
  189. package/dist/server/variant-node.js.map +1 -1
  190. package/dist/server/w.js +33 -3
  191. package/dist/server/w.js.map +1 -1
  192. package/dist/server/ward.js +576 -49
  193. package/dist/server/ward.js.map +1 -1
  194. package/dist/server/wardic-config.js +63 -30
  195. package/dist/server/wardic-config.js.map +1 -1
  196. package/dist/server/wardic-context.js +23 -0
  197. package/dist/server/wardic-context.js.map +1 -0
  198. package/dist/server/wardic.js +3 -0
  199. package/dist/server/wardic.js.map +1 -1
  200. package/dist/solid/batch-reorder-group.d.ts +1 -1
  201. package/dist/solid/batch-reorder.d.ts +1 -1
  202. package/dist/solid/batch-reorder.d.ts.map +1 -1
  203. package/dist/solid/config-view.d.ts +11 -0
  204. package/dist/solid/config-view.d.ts.map +1 -1
  205. package/dist/solid/config-view.js +29 -6
  206. package/dist/solid/config-view.js.map +1 -1
  207. package/dist/solid/create-batch.jsx +1 -1
  208. package/dist/solid/element-style.d.ts +16 -2
  209. package/dist/solid/element-style.d.ts.map +1 -1
  210. package/dist/solid/element-style.js +61 -7
  211. package/dist/solid/element-style.js.map +1 -1
  212. package/dist/solid/element.d.ts +3 -1
  213. package/dist/solid/element.d.ts.map +1 -1
  214. package/dist/solid/element.jsx +21 -2
  215. package/dist/solid/element.jsx.map +1 -1
  216. package/dist/solid/feature-section.d.ts +0 -7
  217. package/dist/solid/feature-section.d.ts.map +1 -1
  218. package/dist/solid/feature-section.js +5 -13
  219. package/dist/solid/feature-section.js.map +1 -1
  220. package/dist/solid/hooks/auto.d.ts +44 -0
  221. package/dist/solid/hooks/auto.d.ts.map +1 -0
  222. package/dist/solid/hooks/auto.js +269 -0
  223. package/dist/solid/hooks/auto.js.map +1 -0
  224. package/dist/solid/hooks/config-scope.d.ts +84 -0
  225. package/dist/solid/hooks/config-scope.d.ts.map +1 -0
  226. package/dist/solid/hooks/config-scope.jsx +128 -0
  227. package/dist/solid/hooks/config-scope.jsx.map +1 -0
  228. package/dist/solid/hooks/config.d.ts +28 -0
  229. package/dist/solid/hooks/config.d.ts.map +1 -0
  230. package/dist/solid/hooks/config.jsx +37 -0
  231. package/dist/solid/hooks/config.jsx.map +1 -0
  232. package/dist/solid/hooks/drag.d.ts +220 -0
  233. package/dist/solid/hooks/drag.d.ts.map +1 -0
  234. package/dist/solid/hooks/drag.js +585 -0
  235. package/dist/solid/hooks/drag.js.map +1 -0
  236. package/dist/solid/hooks/elements.d.ts +11 -0
  237. package/dist/solid/hooks/elements.d.ts.map +1 -0
  238. package/dist/solid/hooks/elements.jsx +218 -0
  239. package/dist/solid/hooks/elements.jsx.map +1 -0
  240. package/dist/solid/hooks/group.d.ts +46 -0
  241. package/dist/solid/hooks/group.d.ts.map +1 -0
  242. package/dist/solid/hooks/group.jsx +25 -0
  243. package/dist/solid/hooks/group.jsx.map +1 -0
  244. package/dist/solid/hooks/index.d.ts +28 -0
  245. package/dist/solid/hooks/index.d.ts.map +1 -0
  246. package/dist/solid/hooks/index.js +10 -0
  247. package/dist/solid/hooks/index.js.map +1 -0
  248. package/dist/solid/hooks/kept.d.ts +60 -0
  249. package/dist/solid/hooks/kept.d.ts.map +1 -0
  250. package/dist/solid/hooks/kept.js +33 -0
  251. package/dist/solid/hooks/kept.js.map +1 -0
  252. package/dist/solid/hooks/layout-group-of.d.ts +27 -0
  253. package/dist/solid/hooks/layout-group-of.d.ts.map +1 -0
  254. package/dist/solid/hooks/layout-group-of.js +39 -0
  255. package/dist/solid/hooks/layout-group-of.js.map +1 -0
  256. package/dist/solid/hooks/layout-group.d.ts +60 -0
  257. package/dist/solid/hooks/layout-group.d.ts.map +1 -0
  258. package/dist/solid/hooks/layout-group.jsx +80 -0
  259. package/dist/solid/hooks/layout-group.jsx.map +1 -0
  260. package/dist/solid/hooks/make-ward.d.ts +123 -0
  261. package/dist/solid/hooks/make-ward.d.ts.map +1 -0
  262. package/dist/solid/hooks/make-ward.js +147 -0
  263. package/dist/solid/hooks/make-ward.js.map +1 -0
  264. package/dist/solid/hooks/presence-scope.d.ts +84 -0
  265. package/dist/solid/hooks/presence-scope.d.ts.map +1 -0
  266. package/dist/solid/hooks/presence-scope.jsx +62 -0
  267. package/dist/solid/hooks/presence-scope.jsx.map +1 -0
  268. package/dist/solid/hooks/presence.d.ts +51 -0
  269. package/dist/solid/hooks/presence.d.ts.map +1 -0
  270. package/dist/solid/hooks/presence.jsx +26 -0
  271. package/dist/solid/hooks/presence.jsx.map +1 -0
  272. package/dist/solid/hooks/props.d.ts +52 -0
  273. package/dist/solid/hooks/props.d.ts.map +1 -0
  274. package/dist/solid/hooks/props.js +140 -0
  275. package/dist/solid/hooks/props.js.map +1 -0
  276. package/dist/solid/hooks/reads.d.ts +38 -0
  277. package/dist/solid/hooks/reads.d.ts.map +1 -0
  278. package/dist/solid/hooks/reads.js +218 -0
  279. package/dist/solid/hooks/reads.js.map +1 -0
  280. package/dist/solid/hooks/refs.d.ts +25 -0
  281. package/dist/solid/hooks/refs.d.ts.map +1 -0
  282. package/dist/solid/hooks/refs.js +89 -0
  283. package/dist/solid/hooks/refs.js.map +1 -0
  284. package/dist/solid/hooks/reorder-elements.d.ts +23 -0
  285. package/dist/solid/hooks/reorder-elements.d.ts.map +1 -0
  286. package/dist/solid/hooks/reorder-elements.jsx +273 -0
  287. package/dist/solid/hooks/reorder-elements.jsx.map +1 -0
  288. package/dist/solid/hooks/reorder.d.ts +55 -0
  289. package/dist/solid/hooks/reorder.d.ts.map +1 -0
  290. package/dist/solid/hooks/reorder.js +152 -0
  291. package/dist/solid/hooks/reorder.js.map +1 -0
  292. package/dist/solid/hooks/rune.d.ts +885 -0
  293. package/dist/solid/hooks/rune.d.ts.map +1 -0
  294. package/dist/solid/hooks/rune.js +816 -0
  295. package/dist/solid/hooks/rune.js.map +1 -0
  296. package/dist/solid/hooks/server-features.client.d.ts +10 -0
  297. package/dist/solid/hooks/server-features.client.d.ts.map +1 -0
  298. package/dist/solid/hooks/server-features.client.js +2 -0
  299. package/dist/solid/hooks/server-features.client.js.map +1 -0
  300. package/dist/solid/hooks/server-features.d.ts +10 -0
  301. package/dist/solid/hooks/server-features.d.ts.map +1 -0
  302. package/dist/solid/hooks/server-features.js +13 -0
  303. package/dist/solid/hooks/server-features.js.map +1 -0
  304. package/dist/solid/hooks/settings.d.ts +11 -0
  305. package/dist/solid/hooks/settings.d.ts.map +1 -0
  306. package/dist/solid/hooks/settings.js +31 -0
  307. package/dist/solid/hooks/settings.js.map +1 -0
  308. package/dist/solid/hooks/setup.d.ts +31 -0
  309. package/dist/solid/hooks/setup.d.ts.map +1 -0
  310. package/dist/solid/hooks/setup.js +155 -0
  311. package/dist/solid/hooks/setup.js.map +1 -0
  312. package/dist/solid/hooks/stage.d.ts +187 -0
  313. package/dist/solid/hooks/stage.d.ts.map +1 -0
  314. package/dist/solid/hooks/stage.js +117 -0
  315. package/dist/solid/hooks/stage.js.map +1 -0
  316. package/dist/solid/hooks/ward.d.ts +394 -0
  317. package/dist/solid/hooks/ward.d.ts.map +1 -0
  318. package/dist/solid/hooks/ward.js +2237 -0
  319. package/dist/solid/hooks/ward.js.map +1 -0
  320. package/dist/solid/hooks/wardic-provider.d.ts +32 -0
  321. package/dist/solid/hooks/wardic-provider.d.ts.map +1 -0
  322. package/dist/solid/hooks/wardic-provider.jsx +29 -0
  323. package/dist/solid/hooks/wardic-provider.jsx.map +1 -0
  324. package/dist/solid/hooks/wardic-scope.d.ts +49 -0
  325. package/dist/solid/hooks/wardic-scope.d.ts.map +1 -0
  326. package/dist/solid/hooks/wardic-scope.jsx +63 -0
  327. package/dist/solid/hooks/wardic-scope.jsx.map +1 -0
  328. package/dist/solid/hooks/wards.d.ts +157 -0
  329. package/dist/solid/hooks/wards.d.ts.map +1 -0
  330. package/dist/solid/hooks/wards.js +522 -0
  331. package/dist/solid/hooks/wards.js.map +1 -0
  332. package/dist/solid/index.d.ts +21 -14
  333. package/dist/solid/index.d.ts.map +1 -1
  334. package/dist/solid/index.jsx +23 -11
  335. package/dist/solid/index.jsx.map +1 -1
  336. package/dist/solid/layout.d.ts +2 -44
  337. package/dist/solid/layout.d.ts.map +1 -1
  338. package/dist/solid/layout.jsx +7 -49
  339. package/dist/solid/layout.jsx.map +1 -1
  340. package/dist/solid/lazy-batch-gestures.js +1 -1
  341. package/dist/solid/lazy-batch-gestures.js.map +1 -1
  342. package/dist/solid/lifecycle.d.ts +19 -0
  343. package/dist/solid/lifecycle.d.ts.map +1 -1
  344. package/dist/solid/lifecycle.js +40 -0
  345. package/dist/solid/lifecycle.js.map +1 -1
  346. package/dist/solid/presence-handle.d.ts +13 -6
  347. package/dist/solid/presence-handle.d.ts.map +1 -1
  348. package/dist/solid/presence-handle.js +30 -12
  349. package/dist/solid/presence-handle.js.map +1 -1
  350. package/dist/solid/presence.d.ts +3 -1
  351. package/dist/solid/presence.d.ts.map +1 -1
  352. package/dist/solid/presence.jsx +3 -1
  353. package/dist/solid/presence.jsx.map +1 -1
  354. package/dist/solid/provider.d.ts +25 -32
  355. package/dist/solid/provider.d.ts.map +1 -1
  356. package/dist/solid/provider.jsx +86 -62
  357. package/dist/solid/provider.jsx.map +1 -1
  358. package/dist/solid/reorder-components.d.ts +32 -0
  359. package/dist/solid/reorder-components.d.ts.map +1 -0
  360. package/dist/solid/reorder-components.jsx +49 -0
  361. package/dist/solid/reorder-components.jsx.map +1 -0
  362. package/dist/solid/reorder.d.ts +50 -76
  363. package/dist/solid/reorder.d.ts.map +1 -1
  364. package/dist/solid/reorder.jsx +40 -202
  365. package/dist/solid/reorder.jsx.map +1 -1
  366. package/dist/solid/stage.d.ts +14 -0
  367. package/dist/solid/stage.d.ts.map +1 -1
  368. package/dist/solid/stage.js.map +1 -1
  369. package/dist/solid/unstable/v2/index.d.ts +2 -26
  370. package/dist/solid/unstable/v2/index.d.ts.map +1 -1
  371. package/dist/solid/unstable/v2/index.jsx +0 -16
  372. package/dist/solid/unstable/v2/index.jsx.map +1 -1
  373. package/dist/solid/v1/index.d.ts +1 -1
  374. package/dist/solid/v1/index.d.ts.map +1 -1
  375. package/dist/solid/v1/index.jsx +1 -1
  376. package/dist/solid/v1/index.jsx.map +1 -1
  377. package/dist/solid/variant-node.d.ts +6 -0
  378. package/dist/solid/variant-node.d.ts.map +1 -1
  379. package/dist/solid/variant-node.js +2 -0
  380. package/dist/solid/variant-node.js.map +1 -1
  381. package/dist/solid/w.d.ts +9 -3
  382. package/dist/solid/w.d.ts.map +1 -1
  383. package/dist/solid/w.jsx +36 -3
  384. package/dist/solid/w.jsx.map +1 -1
  385. package/dist/solid/ward.d.ts +134 -7
  386. package/dist/solid/ward.d.ts.map +1 -1
  387. package/dist/solid/ward.jsx +546 -48
  388. package/dist/solid/ward.jsx.map +1 -1
  389. package/dist/solid/wardic-config.d.ts +17 -12
  390. package/dist/solid/wardic-config.d.ts.map +1 -1
  391. package/dist/solid/wardic-config.jsx +68 -22
  392. package/dist/solid/wardic-config.jsx.map +1 -1
  393. package/dist/solid/wardic-context.d.ts +15 -0
  394. package/dist/solid/wardic-context.d.ts.map +1 -0
  395. package/dist/solid/wardic-context.js +23 -0
  396. package/dist/solid/wardic-context.js.map +1 -0
  397. package/dist/solid/wardic-instance.d.ts +6 -4
  398. package/dist/solid/wardic-instance.d.ts.map +1 -1
  399. package/dist/solid/wardic.d.ts +3 -0
  400. package/dist/solid/wardic.d.ts.map +1 -1
  401. package/dist/solid/wardic.jsx +3 -0
  402. package/dist/solid/wardic.jsx.map +1 -1
  403. package/package.json +26 -6
  404. package/src/batch-reorder-group.tsx +1 -1
  405. package/src/batch-reorder.ts +1 -1
  406. package/src/config-view.ts +30 -6
  407. package/src/create-batch.tsx +1 -1
  408. package/src/element-style.ts +77 -9
  409. package/src/element.tsx +25 -4
  410. package/src/feature-section.ts +5 -15
  411. package/src/hooks/auto.ts +303 -0
  412. package/src/hooks/config-scope.tsx +215 -0
  413. package/src/hooks/config.tsx +54 -0
  414. package/src/hooks/drag.ts +740 -0
  415. package/src/hooks/elements.tsx +234 -0
  416. package/src/hooks/group.tsx +55 -0
  417. package/src/hooks/index.ts +41 -0
  418. package/src/hooks/kept.ts +89 -0
  419. package/src/hooks/layout-group-of.ts +46 -0
  420. package/src/hooks/layout-group.tsx +111 -0
  421. package/src/hooks/make-ward.ts +218 -0
  422. package/src/hooks/presence-scope.tsx +155 -0
  423. package/src/hooks/presence.tsx +67 -0
  424. package/src/hooks/props.ts +190 -0
  425. package/src/hooks/reads.ts +258 -0
  426. package/src/hooks/refs.ts +114 -0
  427. package/src/hooks/reorder-elements.tsx +321 -0
  428. package/src/hooks/reorder.ts +205 -0
  429. package/src/hooks/rune.ts +1755 -0
  430. package/src/hooks/server-features.client.ts +10 -0
  431. package/src/hooks/server-features.ts +12 -0
  432. package/src/hooks/settings.ts +44 -0
  433. package/src/hooks/setup.ts +184 -0
  434. package/src/hooks/stage.ts +359 -0
  435. package/src/hooks/ward.ts +2563 -0
  436. package/src/hooks/wardic-provider.tsx +51 -0
  437. package/src/hooks/wardic-scope.tsx +112 -0
  438. package/src/hooks/wards.ts +679 -0
  439. package/src/index.tsx +27 -15
  440. package/src/layout.tsx +7 -74
  441. package/src/lazy-batch-gestures.ts +1 -1
  442. package/src/lifecycle.ts +40 -0
  443. package/src/presence-handle.ts +39 -20
  444. package/src/presence.tsx +3 -1
  445. package/src/provider.tsx +96 -71
  446. package/src/reorder-components.tsx +61 -0
  447. package/src/reorder.tsx +84 -303
  448. package/src/stage.ts +15 -0
  449. package/src/unstable/v2/index.tsx +2 -26
  450. package/src/v1/index.tsx +1 -1
  451. package/src/variant-node.ts +8 -0
  452. package/src/w.tsx +38 -5
  453. package/src/ward.tsx +674 -48
  454. package/src/wardic-config.tsx +68 -21
  455. package/src/wardic-context.ts +26 -0
  456. package/src/wardic-instance.ts +6 -4
  457. package/src/wardic.tsx +3 -0
  458. package/dist/browser/create-wardic.js +0 -36
  459. package/dist/browser/create-wardic.js.map +0 -1
  460. package/dist/browser/presence-hooks.js +0 -144
  461. package/dist/browser/presence-hooks.js.map +0 -1
  462. package/dist/server/create-wardic.js +0 -36
  463. package/dist/server/create-wardic.js.map +0 -1
  464. package/dist/server/presence-hooks.js +0 -144
  465. package/dist/server/presence-hooks.js.map +0 -1
  466. package/dist/solid/create-wardic.d.ts +0 -25
  467. package/dist/solid/create-wardic.d.ts.map +0 -1
  468. package/dist/solid/create-wardic.jsx +0 -34
  469. package/dist/solid/create-wardic.jsx.map +0 -1
  470. package/dist/solid/presence-hooks.d.ts +0 -53
  471. package/dist/solid/presence-hooks.d.ts.map +0 -1
  472. package/dist/solid/presence-hooks.jsx +0 -117
  473. package/dist/solid/presence-hooks.jsx.map +0 -1
  474. package/src/create-wardic.tsx +0 -46
  475. package/src/presence-hooks.tsx +0 -159
@@ -0,0 +1,241 @@
1
+ /**
2
+ * A hook ward's reads (probe: hooks-first): its gestures and its motion as state, on the ward itself.
3
+ *
4
+ * ```tsx
5
+ * const card = createWard({ whileHover: lift })
6
+ * <article {...card}>{card.hovering() ? "Over" : "Away"}</article>
7
+ * ```
8
+ *
9
+ * - `hovering()`, `pressing()`, `dragging()`, `viewing()` and `focusing()` are the gestures: each is
10
+ * what the sensor of that gesture reads when it's given the ward (`createHover(card)` and the rest),
11
+ * reached from the ward. The sensors stay, for an element with no ward and for a drag's samples.
12
+ * - `animating()` is whether an animation of its own is on its way: `isPending(() => card.settled())`.
13
+ *
14
+ * **Nothing is made until one is first read.** Each is a getter, the same function for every ward. At
15
+ * its first read it makes one signal and listens to the ward's own events, as a sensor given the ward
16
+ * does, so nothing listens to its element twice; and it asks for its gesture's Feature, as a first
17
+ * listener does, so a ward that brings what its config uses reads `hovering()` with no `whileHover`.
18
+ * The accessor is kept, so `const over = card.hovering` is the same one read anywhere.
19
+ *
20
+ * On a server each is `false`.
21
+ *
22
+ * The six getters are on the prototype every client ward shares, where `settled` and `tapped` are
23
+ * (`SHARED`, `ward.ts`), and a ward carries nothing for them. A ward with no state of its own, a
24
+ * server's or a Stage's, is given them as its own.
25
+ *
26
+ * @module
27
+ */
28
+ import { isServer } from "@solidjs/web";
29
+ import * as Keys from "@wardic/dom/unstable/features/Keys";
30
+ import * as GestureFeatures from "@wardic/dom/unstable/GestureFeatures";
31
+ import * as OwnerScope from "@wardic/dom/unstable/OwnerScope";
32
+ import * as Report from "@wardic/dom/Report";
33
+ import { constFalse, constVoid } from "effect/Function";
34
+ import * as Predicate from "effect/Predicate";
35
+ import * as Scope from "effect/Scope";
36
+ import { createEffect, createMemo, createSignal, isPending, runWithOwner } from "solid-js";
37
+ import { useInstanceFeatures, useWardicRuntime } from "../provider.js";
38
+ import { CLIENT_ONLY, onSettledClientOnly } from "../solid-reactivity.js";
39
+ import { sensedOf } from "../ward.js";
40
+ import { keptFor } from "./kept.js";
41
+ /**
42
+ * What `ward`'s reads go by, of what the hooks keep of it (`kept.ts`): none for a ward they didn't
43
+ * make, or one with no Features of its own. For a ward with a state of its own, a client's.
44
+ */
45
+ const readsOf = ward => {
46
+ const kept = keptFor(ward);
47
+ if (Predicate.isUndefined(kept)) return undefined;
48
+ const ask = kept.ask;
49
+ const instance = kept.instance;
50
+ if (Predicate.isUndefined(ask) || Predicate.isUndefined(instance)) return undefined;
51
+ return {
52
+ ask,
53
+ instance,
54
+ owner: kept.owner
55
+ };
56
+ };
57
+ // Module state (#460, Q7): each ward's reads made so far, held weakly by the ward.
58
+ const MADE = new WeakMap();
59
+ // Module state (#460, Q7): the finished ward each function rune's ward is part of, held weakly by the rune's.
60
+ const DRIVEN = new WeakMap();
61
+ /**
62
+ * Says which ward a function rune's ward is part of. The two share a lifecycle, so the rune's hears
63
+ * every event; what it isn't told is the element, which is the finished ward's alone, and `focusing`
64
+ * watches the element.
65
+ */
66
+ export const drivenBy = (rune, ward) => {
67
+ DRIVEN.set(rune, ward);
68
+ };
69
+ /** The ward whose element `ward` reads, and whose leave it holds: the one it's part of, or itself. */
70
+ export const onOf = ward => {
71
+ const by = DRIVEN.get(ward);
72
+ if (Predicate.isUndefined(by)) return ward;
73
+ return by;
74
+ };
75
+ /** The element `ward` is on: its own, or the one the ward it's part of is on. Read where it's tracked. */
76
+ const elementOf = ward => {
77
+ const sensed = sensedOf(onOf(ward));
78
+ if (Predicate.isUndefined(sensed)) return undefined;
79
+ return sensed.element();
80
+ };
81
+ /** A ward event's listener for a read: each told as `on` has it, the ward's end ending nothing more. */
82
+ const heard = on => ({
83
+ next: on,
84
+ error: constVoid
85
+ });
86
+ /** `ward`'s `name`, made by `make` the first time it's read and kept. */
87
+ const kept = (ward, name, make) => {
88
+ const known = MADE.get(ward);
89
+ if (Predicate.isNotUndefined(known)) {
90
+ const read = known[name];
91
+ if (Predicate.isNotUndefined(read)) return read;
92
+ }
93
+ const read = make();
94
+ MADE.set(ward, {
95
+ ...known,
96
+ [name]: read
97
+ });
98
+ return read;
99
+ };
100
+ /**
101
+ * A gesture's read over the ward's own events: `false` until `listen` says otherwise. Listening to the
102
+ * ward's lifecycle starts its recognizer, as `when` would, and `feature` is asked for as a listener asks.
103
+ */
104
+ const gesture = (ward, name, feature, listen) => {
105
+ // A build-time flag: a server's ward has no lifecycle, and rests at `false`.
106
+ if (isServer) return constFalse;
107
+ return kept(ward, name, () => {
108
+ const sensed = sensedOf(ward);
109
+ if (Predicate.isUndefined(sensed)) return constFalse;
110
+ const of = readsOf(ward);
111
+ if (Predicate.isNotUndefined(of) && Predicate.isNotUndefined(feature)) of.ask(feature);
112
+ const [value, setValue] = createSignal(false);
113
+ listen(sensed.lifecycle, now => void setValue(now));
114
+ return value;
115
+ });
116
+ };
117
+ /**
118
+ * `focusing`: a ward tells no focus events, so its element is watched by the Focus gesture of the ward's
119
+ * own Features, once that Feature and the element are both there, and again on another element.
120
+ */
121
+ const focus = (ward, of) => {
122
+ of.ask("focus");
123
+ const [value, setValue] = createSignal(false);
124
+ runWithOwner(of.owner, () => {
125
+ const runtime = useWardicRuntime();
126
+ const own = useInstanceFeatures(of.instance);
127
+ const onDefect = cause => {
128
+ runtime.runFork(Report.failure("wardic.createWard: its focus read failed", cause));
129
+ };
130
+ // Its gesture through a memo: an effect runs again whenever what it reads does, the same answer
131
+ // or not, and its ward's services change as each of its other Features arrives. Watched again
132
+ // then, it began at `false` with the focus still on its element.
133
+ const watching = createMemo(() => GestureFeatures.serviceIn(own.services(), Keys.FocusGesture), CLIENT_ONLY);
134
+ // Begun at the settle, as what needs an element on the page is: a function rune may take the read
135
+ // off its ward before the ward it's part of exists, and whose element it reads is known by then
136
+ // (`drivenBy`, which nothing follows). Begun as the read was made, it looked the element up on its
137
+ // own ward, and found the right one only when its services happened to change afterwards.
138
+ onSettledClientOnly(() => {
139
+ runWithOwner(of.owner, () => {
140
+ createEffect(() => ({
141
+ element: elementOf(ward),
142
+ watch: watching()
143
+ }), ({
144
+ element,
145
+ watch
146
+ }) => {
147
+ if (Predicate.isUndefined(element)) return undefined;
148
+ if (Predicate.isUndefined(watch)) return undefined;
149
+ const scope = OwnerScope.open(runtime);
150
+ runtime.runSync(watch.watch(element, {}, {
151
+ on: now => void setValue(now),
152
+ onDefect
153
+ }).pipe(Scope.provide(scope)));
154
+ // Its cleanup: before the next element's watch, and as the ward ends.
155
+ return () => {
156
+ OwnerScope.close(runtime, scope, "wardic.createWard: its focus read's finalizer failed");
157
+ setValue(false);
158
+ };
159
+ }, CLIENT_ONLY);
160
+ });
161
+ });
162
+ });
163
+ return value;
164
+ };
165
+ // Each getter is one function for every ward: `this` is the ward it's read on.
166
+ function hovering() {
167
+ return gesture(this, "hovering", "hover", (lifecycle, set) => {
168
+ lifecycle.listen("hoverStart", heard(() => set(true)));
169
+ lifecycle.listen("hoverEnd", heard(() => set(false)));
170
+ });
171
+ }
172
+ function pressing() {
173
+ return gesture(this, "pressing", "press", (lifecycle, set) => {
174
+ lifecycle.listen("pressStart", heard(() => set(true)));
175
+ lifecycle.listen("tap", heard(() => set(false)));
176
+ lifecycle.listen("tapCancel", heard(() => set(false)));
177
+ // A press a drag took over tells neither of the two above.
178
+ lifecycle.listen("dragStart", heard(() => set(false)));
179
+ });
180
+ }
181
+ function dragging() {
182
+ // Nothing is asked for: a ward drags by its config's `drag`, which brought the Feature.
183
+ return gesture(this, "dragging", undefined, (lifecycle, set) => {
184
+ lifecycle.listen("dragStart", heard(() => set(true)));
185
+ lifecycle.listen("dragEnd", heard(() => set(false)));
186
+ });
187
+ }
188
+ function viewing() {
189
+ return gesture(this, "viewing", "inView", (lifecycle, set) => {
190
+ lifecycle.listen("viewportEnter", heard(() => set(true)));
191
+ lifecycle.listen("viewportLeave", heard(() => set(false)));
192
+ });
193
+ }
194
+ function focusing() {
195
+ if (isServer) return constFalse;
196
+ return kept(this, "focusing", () => {
197
+ if (Predicate.isUndefined(sensedOf(this))) return constFalse;
198
+ const of = readsOf(this);
199
+ // A ward with no Features of its own to ask (a Reorder's row): not read in this probe.
200
+ if (Predicate.isUndefined(of)) return constFalse;
201
+ return focus(this, of);
202
+ });
203
+ }
204
+ function animating() {
205
+ if (isServer) return constFalse;
206
+ return kept(this, "animating", () => {
207
+ const ward = this;
208
+ return () => isPending(() => ward.settled());
209
+ });
210
+ }
211
+ /**
212
+ * The six reads, as getters: shared by every client ward (`SHARED`, `ward.ts`), and a ward's own
213
+ * properties where it has no state to share them by. Not enumerable, so a spread never sees them.
214
+ */
215
+ export const READS = {
216
+ hovering: {
217
+ get: hovering,
218
+ configurable: true
219
+ },
220
+ pressing: {
221
+ get: pressing,
222
+ configurable: true
223
+ },
224
+ dragging: {
225
+ get: dragging,
226
+ configurable: true
227
+ },
228
+ viewing: {
229
+ get: viewing,
230
+ configurable: true
231
+ },
232
+ focusing: {
233
+ get: focusing,
234
+ configurable: true
235
+ },
236
+ animating: {
237
+ get: animating,
238
+ configurable: true
239
+ }
240
+ };
241
+ //# sourceMappingURL=reads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reads.js","names":["isServer","Keys","GestureFeatures","OwnerScope","Report","constFalse","constVoid","Predicate","Scope","createEffect","createMemo","createSignal","isPending","runWithOwner","useInstanceFeatures","useWardicRuntime","CLIENT_ONLY","onSettledClientOnly","sensedOf","keptFor","readsOf","ward","kept","isUndefined","undefined","ask","instance","owner","MADE","WeakMap","DRIVEN","drivenBy","rune","set","onOf","by","get","elementOf","sensed","element","heard","on","next","error","name","make","known","isNotUndefined","read","gesture","feature","listen","of","value","setValue","lifecycle","now","focus","runtime","own","onDefect","cause","runFork","failure","watching","serviceIn","services","FocusGesture","watch","scope","open","runSync","pipe","provide","close","hovering","pressing","dragging","viewing","focusing","animating","settled","READS","configurable"],"sources":["../../../src/hooks/reads.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,KAAK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,EAAE;EAAI,CAAE;EAC7CJ,QAAQ,EAAE;IAAE3C,GAAG,EAAE2C,QAAQ;IAAEI,YAAY,EAAE;EAAI,CAAE;EAC/CH,SAAS,EAAE;IAAE5C,GAAG,EAAE4C,SAAS;IAAEG,YAAY,EAAE;EAAI;CAChD","ignoreList":[]}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * A rune's `ref` at work (probe: hooks-first): each rune's `ref` handed its ward's Subject while that's
3
+ * on show, and undone once it isn't (`RuneRef`, `rune.ts`). The same for every Environment: what its
4
+ * hooks give is the Subject on show, the page's an element and a Stage's what its Environment draws.
5
+ *
6
+ * - **A memo of the Subject on show, and one effect over it,** made only for a ward whose runes give a
7
+ * `ref` and that goes by a `show` or a presence's word. The memo is what makes the same Subject,
8
+ * still on show, no change: an effect runs again whenever what it reads does, whatever the answer,
9
+ * and a `ref` would run again on a Subject it has.
10
+ * - **The effect's own cleanup is the refs' undoing.** Solid runs it before the next Subject's refs,
11
+ * and as the owner the ward was made under ends.
12
+ * - **Once the Subject is on show:** the page's in the page by then, where Solid's own `ref` has it
13
+ * before. A page ward with no `show` has its binding run them as it mounts its element, its first
14
+ * target written, and undo them as it lets the element go, with nothing of their own made for them
15
+ * (`ward.ts`'s cheap `ref`, probe: behaviour-runes), until a presence takes it. A `show` ward's, and
16
+ * a taken one's, run after the flush that put the Subject on show, as an effect is. So within one
17
+ * flush the first kind's run before the second's, whatever their order on the page (the owner's yes,
18
+ * 2026-11-30); a ward's own runes' are in the order they were given, either way.
19
+ * - **Each `ref` is called as it is, and so is its undoing.** A signal either one reads as it runs is
20
+ * read once, and Solid reports it (`STRICT_READ_UNTRACKED`), as it reports one read in a `ref` of
21
+ * its own: the read won't update. The hooks called both under `untrack` at first, which kept a
22
+ * row's `ref` that read its `item` quiet, and kept as quiet a `ref` that meant to follow a signal
23
+ * and never would. A value read once on purpose is read outside the `ref`, or under `untrack`
24
+ * there, by whoever means it.
25
+ * - **Wherever its Subject is on show.** The page's hooks call this in a browser alone, nothing being
26
+ * on show on a server, and once the page has settled (`ward.ts`'s `refsAtWork`), or as a presence
27
+ * takes a ward whose binding ran them till then; a Stage's as its ward is made, wherever its Stage
28
+ * runs, which needn't be a browser. What's made here takes none of Solid's hydration ids.
29
+ * - **Nothing here writes a signal.** A memo derives, and an effect's callback calls the refs: what a
30
+ * `ref` writes is its own author's, from a listener.
31
+ *
32
+ * @module
33
+ */
34
+ import * as Arr from "effect/Array";
35
+ import * as Bool from "effect/Boolean";
36
+ import * as MutableRef from "effect/MutableRef";
37
+ import * as Option from "effect/Option";
38
+ import * as Predicate from "effect/Predicate";
39
+ import * as UndefinedOr from "effect/UndefinedOr";
40
+ import { createEffect, createMemo, onCleanup } from "solid-js";
41
+ import { CLIENT_ONLY } from "../solid-reactivity.js";
42
+ const isRef = value => Predicate.isFunction(value);
43
+ /** What a `ref` gave back to undo it: nothing, for one with nothing to undo. */
44
+ const isUndoing = value => Predicate.isFunction(value);
45
+ const undo = undoing => undoing();
46
+ /** Every rune's `ref` among a ward's `configs`, in the order its runes were given. */
47
+ export const runeRefsOf = configs => Arr.filter(Arr.map(configs, config => config.ref), isRef);
48
+ /** Each of `refs` run on `subject` in turn, and what undoes them: what they gave back, in the reverse. */
49
+ export const refsRun = (refs, subject) => {
50
+ const undoings = Arr.filter(Arr.map(refs, ref => ref(subject)), isUndoing);
51
+ return () => Arr.forEach(Arr.reverse(undoings), undo);
52
+ };
53
+ /**
54
+ * `refs` run on what `subjectOnShow` gives, each time it gives another: the Subject its ward is on
55
+ * while that's on show, and nothing while it's hidden or gone. Each `ref` in turn, and what they gave
56
+ * back in the reverse once the Subject is on show no more.
57
+ *
58
+ * `already`, where they're on a Subject already, run there by its ward's mount (the cheap `ref`, `ward.ts`)
59
+ * until a presence took the ward: kept, not run again, while that's the Subject on show, and undone once
60
+ * it isn't. Undone too where the ward ends before this has run.
61
+ */
62
+ export const attending = (refs, subjectOnShow, already = Option.none()) => {
63
+ if (Arr.isReadonlyArrayEmpty(refs)) return;
64
+ // Held till the effect's first run takes it.
65
+ const handed = MutableRef.make(already);
66
+ if (Option.isSome(already)) onCleanup(() => void Option.map(MutableRef.getAndSet(handed, Option.none()), undoAttended));
67
+ const subject = createMemo(subjectOnShow, CLIENT_ONLY);
68
+ createEffect(subject, now => onShowFrom(refs, MutableRef.getAndSet(handed, Option.none()), now), CLIENT_ONLY);
69
+ };
70
+ const undoAttended = attended => attended.undo();
71
+ /**
72
+ * `refs` on `now`, the Subject on show, and what undoes them: kept as they are where `handed` has them
73
+ * on it already, else what `handed` has undone first. Nothing with nothing on show.
74
+ */
75
+ const onShowFrom = (refs, handed, now) => Option.match(handed, {
76
+ onNone: () => refsOn(refs, now),
77
+ onSome: was => Bool.match(now === was.subject, {
78
+ onTrue: () => was.undo,
79
+ onFalse: () => {
80
+ was.undo();
81
+ return refsOn(refs, now);
82
+ }
83
+ })
84
+ });
85
+ /** `refs` run on `now`, where something's on show. */
86
+ const refsOn = (refs, now) => UndefinedOr.map(now, subject => refsRun(refs, subject));
87
+ //# sourceMappingURL=refs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.js","names":["Arr","Bool","MutableRef","Option","Predicate","UndefinedOr","createEffect","createMemo","onCleanup","CLIENT_ONLY","isRef","value","isFunction","isUndoing","undo","undoing","runeRefsOf","configs","filter","map","config","ref","refsRun","refs","subject","undoings","forEach","reverse","attending","subjectOnShow","already","none","isReadonlyArrayEmpty","handed","make","isSome","getAndSet","undoAttended","now","onShowFrom","attended","match","onNone","refsOn","onSome","was","onTrue","onFalse"],"sources":["../../../src/hooks/refs.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,OAAO,KAAKA,GAAG,MAAM,cAAc;AACnC,OAAO,KAAKC,IAAI,MAAM,gBAAgB;AACtC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,SAAS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s/web";
3
+ var _m$ = Symbol(),
4
+ _m$2 = Symbol(),
5
+ _m$3 = Symbol(),
6
+ _m$4 = Symbol();
7
+ var _d$ = {
8
+ get() {
9
+ const Element = this[_m$];
10
+ const rest = this[_m$2];
11
+ const list = this[_m$3];
12
+ return Element(_$mergeProps(rest, {
13
+ runes: [list]
14
+ }));
15
+ },
16
+ enumerable: true,
17
+ configurable: true
18
+ };
19
+ function _P$(_p, _p2, _p3, _p4) {
20
+ this[_m$] = _p;
21
+ this[_m$2] = _p2;
22
+ this[_m$3] = _p3;
23
+ this.value = _p4;
24
+ Object.defineProperty(this, "children", _d$);
25
+ }
26
+ _P$.prototype = Object.prototype;
27
+ var _d$2 = {
28
+ get() {
29
+ const Element = this[_m$];
30
+ const rest = this[_m$2];
31
+ const spread = this[_m$3];
32
+ const refs = this[_m$4];
33
+ return Element(_$mergeProps(rest, spread, {
34
+ ref: refs
35
+ }));
36
+ },
37
+ enumerable: true,
38
+ configurable: true
39
+ };
40
+ function _P$2(_p5, _p6, _p7, _p8, _p9) {
41
+ this[_m$] = _p5;
42
+ this[_m$2] = _p6;
43
+ this[_m$3] = _p7;
44
+ this[_m$4] = _p8;
45
+ this.value = _p9;
46
+ Object.defineProperty(this, "children", _d$2);
47
+ }
48
+ _P$2.prototype = Object.prototype;
49
+ var _d$3 = {
50
+ get() {
51
+ const element = this[_m$];
52
+ return element();
53
+ },
54
+ enumerable: true,
55
+ configurable: true
56
+ };
57
+ function _P$3(_p0) {
58
+ this[_m$] = _p0;
59
+ Object.defineProperty(this, "children", _d$3);
60
+ }
61
+ _P$3.prototype = Object.prototype;
62
+ /**
63
+ * `<Reorder.Group>` and `<Reorder.Item>` (probe: hooks-first, the Reorder round's utilities, the gap grill's
64
+ * Q39): a list its visitor reorders, as components, built from what the hooks' entry exports alone, as an
65
+ * app would build them. Utilities, not primitives: `createReorder` is the primitive.
66
+ *
67
+ * - **The group** is a `createReorder` of its props: `values` its order, `onReorder` told each new one,
68
+ * `key`, `axis`, `keyboard`, `announcements`, `instructions` and its `style` each read through its
69
+ * prop. Its element is a Wardic element of the tag `as` names, `"ul"` by default, the list given to it
70
+ * as a rune beside its motion props (the round's LW1). `groupRef` is handed the list once it's made.
71
+ * - **An item** is its group's row for `value`, made where it renders (`list.row`, the round's RW1): its
72
+ * motion props one rune, read through its props as an element's are, `tabindex` and
73
+ * `aria-describedby` its own beside the keyboard reorder's. Its element is the tag `as` names, `"li"`
74
+ * by default, and `wardRef` is handed its row. Outside a group it throws, as Motion's does.
75
+ *
76
+ * What they don't do, each a decision of the round's (Q6): a group made with `reorderGroup` given to
77
+ * `groupRef`, and an item made with `reorderItem` given to `wardRef`, to drive.
78
+ *
79
+ * @module
80
+ */
81
+ import { dynamic, isServer } from "@solidjs/web";
82
+ import * as Arr from "effect/Array";
83
+ import * as Bool from "effect/Boolean";
84
+ import { identity } from "effect/Function";
85
+ import * as Predicate from "effect/Predicate";
86
+ import * as Rec from "effect/Record";
87
+ import * as UndefinedOr from "effect/UndefinedOr";
88
+ import { $PROXY, createContext, createMemo, createRoot, isHydrating, omit, untrack, useContext } from "solid-js";
89
+ import { createGrip } from "./drag.js";
90
+ /** The motion props an item takes into its rune: an element's, `key` among them, less `drag` and `layoutId`, which the group sets. */
91
+ const ITEM_MOTION_KEYS = ["initial", "animate", "variants", "custom", "inherit", "whileHover", "whileTap", "propagate", "whileFocus", "whileInView", "viewport", "exit", "whileDrag", "dragConstraints", "dragElastic", "dragMomentum", "dragSnapToOrigin", "dragTransition", "dragPropagation", "dragDirectionLock", "onMeasureDragConstraints", "layout", "layoutDependency", "layoutScroll", "layoutRoot", "layoutAnchor", "layoutCrossfade", "onUpdate", "transformTemplate", "onBeforeLayoutMeasure", "onLayoutMeasure", "appear", "transition", "style", "key"];
92
+ /** The keys the group sets on its items, which an item takes from nowhere else: off its element, and out of its rune. */
93
+ const GROUP_SET = ["drag", "layoutId"];
94
+ /** The item's own attributes beside the keyboard reorder's: given to its row as its rune's `props`. */
95
+ const KEYBOARD_KEYS = ["tabindex", "aria-describedby"];
96
+ /** What an item keeps for itself, off its element: its motion props, its keyboard attributes, its `value`, `as`, `ref` and `wardRef`. */
97
+ const ITEM_KEPT = [...ITEM_MOTION_KEYS, ...KEYBOARD_KEYS, ...GROUP_SET, "value", "as", "ref", "wardRef"];
98
+ /** What a group keeps for itself, off its element: its list's config, `as`, `style` (its list's) and `groupRef`. */
99
+ const GROUP_KEPT = ["values", "onReorder", "key", "axis", "keyboard", "announcements", "instructions", "as", "style", "groupRef"];
100
+ /** The variant props a name on which changes what an item's children read. */
101
+ const NAMED_KEYS = ["initial", "animate", "exit", "whileHover", "whileTap", "whileFocus", "whileInView", "whileDrag"];
102
+ /** The keys whose value is a function as it's given, never an accessor of it, and `custom`: each read through its prop as it is. */
103
+ const AS_GIVEN = new Set(["onUpdate", "dragConstraints", "onMeasureDragConstraints", "transformTemplate", "onBeforeLayoutMeasure", "onLayoutMeasure", "custom"]);
104
+ /**
105
+ * A group given to `groupRef`, or a ward given to `wardRef`, to drive: forms of today's components the
106
+ * round dropped (Q6). Each is a function, as a callback is, so each is known by what it carries: a group
107
+ * its `controller`, a ward its `next` (the owner's word after the round's review: an error, not a call).
108
+ */
109
+ const isGroup = Predicate.and(Predicate.isFunction, Predicate.hasProperty("controller"));
110
+ const isWard = Predicate.and(Predicate.isFunction, Predicate.hasProperty("next"));
111
+ const GIVEN_GROUP = "Reorder.Group: groupRef takes a function, handed the group the component makes, `groupRef={(list) => …}`. A group made " + "with reorderGroup isn't given to it to drive: give its config as the component's props.";
112
+ const GIVEN_WARD = "Reorder.Item: wardRef takes a function, handed the item's ward, `wardRef={(row) => …}`. A ward made beforehand isn't " + "given to it to drive: give its config as the component's props.";
113
+ /** The group an item renders in. */
114
+ const ListContext = createContext(null);
115
+ /** The row a grip renders in (probe: behaviour-runes, Q29): its item's ward. */
116
+ const RowContext = createContext(null);
117
+ /**
118
+ * What a grip keeps for itself, off its element: its motion props, its own `tabindex` and
119
+ * `aria-describedby` (its rune's `props`, so they win over the grip's, as an item's do), `as` and `ref`.
120
+ */
121
+ const GRIP_KEPT = [...ITEM_MOTION_KEYS, ...KEYBOARD_KEYS, "as", "ref"];
122
+ /** A grip's `type`, where it's a `<button>`, as it is by default (Q33): one that submits nothing. */
123
+ const BUTTON = {
124
+ type: "button"
125
+ };
126
+ const NOTHING = {};
127
+ /** Whether a prop is a value as it's given, not a getter of Solid's that follows a signal. */
128
+ const isGivenAsValue = given => Predicate.isNotUndefined(given) && Bool.not(Predicate.isFunction(given.get));
129
+ /**
130
+ * `key` of `props` into `into`, as the hooks read a rune fastest: a prop given as a value, its value;
131
+ * one that follows a signal, an accessor of it; a function a key takes as its value, and props a parent
132
+ * spread whose keys can change (Solid's proxy), read through their getters. As `w.<tag>` reads its own
133
+ * (`elements.tsx`).
134
+ */
135
+ const readInto = (into, props, key, proxied) => {
136
+ if (Bool.and(Bool.not(proxied), isGivenAsValue(Object.getOwnPropertyDescriptor(props, key)))) {
137
+ into[key] = props[key];
138
+ return;
139
+ }
140
+ if (Bool.and(Bool.not(proxied), Bool.not(AS_GIVEN.has(key)))) {
141
+ into[key] = () => props[key];
142
+ return;
143
+ }
144
+ Object.defineProperty(into, key, {
145
+ enumerable: true,
146
+ get: () => props[key]
147
+ });
148
+ };
149
+ /** An item's props, the ones it has as it's made, as its row's rune: its motion props, and its keyboard attributes as the rune's `props`. */
150
+ const itemRuneOf = props => {
151
+ const rune = {};
152
+ const proxied = $PROXY in props;
153
+ Arr.forEach(ITEM_MOTION_KEYS, key => {
154
+ if (key in props) readInto(rune, props, key, proxied);
155
+ });
156
+ const own = {};
157
+ Arr.forEach(KEYBOARD_KEYS, key => {
158
+ if (key in props) readInto(own, props, key, proxied);
159
+ });
160
+ if (Bool.not(Rec.isEmptyRecord(own))) rune["props"] = own;
161
+ return rune;
162
+ };
163
+ /** A variant name, or a list of them. */
164
+ const isName = Predicate.or(Predicate.isString, Arr.isArray);
165
+ /** Whether an item's props, as it's made, change what its children read: so its row's Provider goes round them. */
166
+ const changesWhatChildrenRead = given => {
167
+ if ("variants" in given) return true;
168
+ if (given["inherit"] === false) return true;
169
+ return Arr.some(NAMED_KEYS, key => isName(given[key]));
170
+ };
171
+ /** The element's refs: the user's, one or a list, then the ward's. Read once, as Solid reads a `ref`. */
172
+ const refsOf = (given, ward) => Arr.append(Arr.filter(Arr.ensure(given), Predicate.isNotUndefined), ward);
173
+ /**
174
+ * A tag's plain element, made once and kept, as `w.<tag>`'s is: a server's render holds what it renders
175
+ * in a memo of its own, a browser hydrating under a plain owner, which takes the id the server's memo
176
+ * took, and a browser not hydrating under the component's own.
177
+ */
178
+ const plainElementOf = tag => {
179
+ const render = dynamic(() => tag, {
180
+ static: true
181
+ });
182
+ return props => {
183
+ if (isServer) return createMemo(() => render(props));
184
+ if (isHydrating()) return createRoot(() => render(props));
185
+ return render(props);
186
+ };
187
+ };
188
+ /** Each tag's plain element, made as it's first used. */
189
+ // Module state (#460, Q7): a tag's element is the same for every item, on every page and request.
190
+ const PLAIN = new Map();
191
+ /** `tag`'s plain element, made on its first use and kept. */
192
+ const plainOf = tag => {
193
+ const known = PLAIN.get(tag);
194
+ if (Predicate.isNotUndefined(known)) return known;
195
+ const made = plainElementOf(tag);
196
+ PLAIN.set(tag, made);
197
+ return made;
198
+ };
199
+ /**
200
+ * `<Reorder.Group>`, `<Reorder.Item>` and `<Reorder.Grip>`, a group's list made by `listOf` (`createReorder`),
201
+ * its element by `elements` (the Wardic element of each tag, `w`'s, which takes the list as one of its
202
+ * `runes`), and each item's and grip's ward by `createWard`: the hooks' own for an app of the hooks, and
203
+ * for the main entry the same maker without the page the hooks' module sets up as it loads, so the main
204
+ * entry's components still need a provider (probe: behaviour-runes).
205
+ */
206
+ export const reorderElementsOf = (elements, listOf, createWard) => {
207
+ const Group = props => {
208
+ const own = props;
209
+ // Each of its list's options read through its prop, as `createReorder` reads its source's.
210
+ const source = {
211
+ each: () => own.values,
212
+ onReorder: values => own.onReorder(values),
213
+ key: untrack(() => own.key),
214
+ get axis() {
215
+ return own.axis;
216
+ },
217
+ get keyboard() {
218
+ return own.keyboard;
219
+ },
220
+ get announcements() {
221
+ return own.announcements;
222
+ },
223
+ get instructions() {
224
+ return own.instructions;
225
+ },
226
+ get style() {
227
+ return own.style;
228
+ }
229
+ };
230
+ const list = listOf(source);
231
+ const groupRef = untrack(() => own.groupRef);
232
+ if (isGroup(groupRef)) throw new Error(GIVEN_GROUP);
233
+ if (Predicate.isFunction(groupRef)) groupRef(list);
234
+ const Element = UndefinedOr.getOrThrow(elements[UndefinedOr.match(untrack(() => own.as), {
235
+ onUndefined: () => "ul",
236
+ onDefined: identity
237
+ })]);
238
+ const rest = omit(props, ...GROUP_KEPT);
239
+ return ListContext(new _P$(Element, rest, list, list));
240
+ };
241
+ const Item = props => {
242
+ const list = useContext(ListContext);
243
+ if (Predicate.isNull(list)) throw new Error("Reorder.Item must be a child of Reorder.Group");
244
+ const own = props;
245
+ const Element = plainOf(UndefinedOr.match(untrack(() => own.as), {
246
+ onUndefined: () => "li",
247
+ onDefined: identity
248
+ }));
249
+ // Its row a plain ward of its group's behaviour and its own props (probe: behaviour-runes, Q12): what
250
+ // an app writes, `createWard(list.item(value), ...)`.
251
+ const row = untrack(() => createWard(list.item(own.value), itemRuneOf(props)));
252
+ const wardRef = untrack(() => own.wardRef);
253
+ if (isWard(wardRef)) throw new Error(GIVEN_WARD);
254
+ if (Predicate.isFunction(wardRef)) wardRef(row);
255
+ // Its spread's props, as a spread of it reads them: called with nothing, as Solid's `merge` calls a
256
+ // ward it spreads (#495), for the keyboard attributes and the drag's style a row's binding gives
257
+ // there, not on the ward as its own keys. As an object: spread as the function it is, `merge` calls
258
+ // it in a computation whose keys `spread` can't know, and inserts children too (#525).
259
+ const spread = untrack(() => row());
260
+ const rest = omit(props, ...ITEM_KEPT);
261
+ const refs = refsOf(untrack(() => own.ref), row);
262
+ // Its row given to its grips (Q29), each a `<Reorder.Grip>` inside it.
263
+ const element = () => RowContext(new _P$2(Element, rest, spread, refs, row));
264
+ return Bool.match(untrack(() => changesWhatChildrenRead(props)), {
265
+ onFalse: element,
266
+ onTrue: () => {
267
+ const Provider = row.Provider;
268
+ return Provider(new _P$3(element));
269
+ }
270
+ });
271
+ };
272
+ /**
273
+ * `<Reorder.Grip>` (probe: behaviour-runes, Q29, Q33): a grip of the item it's inside, `createGrip` of
274
+ * its row, as an app writes one: while it's there, the item drags from its grips alone and hears its
275
+ * keys from them. The element `as` names, a `<button type="button">` by default; its motion props a rune.
276
+ */
277
+ const Grip = props => {
278
+ const row = useContext(RowContext);
279
+ if (Predicate.isNull(row)) throw new Error("Reorder.Grip must be inside a Reorder.Item");
280
+ const own = props;
281
+ const tag = UndefinedOr.match(untrack(() => own.as), {
282
+ onUndefined: () => "button",
283
+ onDefined: identity
284
+ });
285
+ const Element = plainOf(tag);
286
+ const grip = untrack(() => createWard(createGrip(row), itemRuneOf(props)));
287
+ const spread = untrack(() => grip());
288
+ const rest = omit(props, ...GRIP_KEPT);
289
+ const typed = Bool.match(tag === "button", {
290
+ onTrue: () => BUTTON,
291
+ onFalse: () => NOTHING
292
+ });
293
+ return (() => {
294
+ var _ref$ = refsOf(untrack(() => own.ref), grip);
295
+ return Element(_$mergeProps(typed, rest, spread, {
296
+ ref(r$) {
297
+ (typeof _ref$ === "function" || Array.isArray(_ref$)) && _$applyRef(_ref$, r$);
298
+ }
299
+ }));
300
+ })();
301
+ };
302
+ return {
303
+ Group,
304
+ Item,
305
+ Grip
306
+ };
307
+ };
308
+ //# sourceMappingURL=reorder-elements.js.map