@kerfjs/ui 5.0.0-beta.131 → 5.0.0-beta.133

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 (484) hide show
  1. package/README.md +26 -14
  2. package/ai/application-ui-profile-sync.cjs +5 -14
  3. package/ai/application-ui-profile.d.ts +0 -2
  4. package/ai/application-ui-profile.defaults.json +0 -4
  5. package/ai/application-ui-profile.mjs +5 -14
  6. package/ai/application-ui-profile.schema.json +0 -4
  7. package/ai/choice-wiring-mode.cjs +68 -0
  8. package/ai/component-catalog.json +13 -9
  9. package/ai/component-composition-rules.json +2 -10
  10. package/ai/component-composition.d.ts +0 -17
  11. package/ai/component-composition.json +9 -12
  12. package/ai/component-composition.schema.json +0 -59
  13. package/ai/components/combobox.md +1 -1
  14. package/ai/components/disclosure.md +2 -0
  15. package/ai/components/form.md +1 -2
  16. package/ai/components/popup-menu.md +1 -0
  17. package/ai/components/switch.md +1 -1
  18. package/ai/components/tab-panel.md +0 -1
  19. package/ai/components/toolbar-control-group.md +2 -2
  20. package/ai/public-api-signatures-v1.md +218 -205
  21. package/ai/skill.md +3 -20
  22. package/ai/webawesome-jsx-signatures-v1.md +1 -1
  23. package/dist/backdrop-image.d.ts +1 -1
  24. package/dist/backdrop-image.js +1 -1
  25. package/dist/badge.js +1 -1
  26. package/dist/button.js +1 -1
  27. package/dist/catalog-library.d.ts +26 -0
  28. package/dist/catalog-library.js +2484 -0
  29. package/dist/catalog-library.js.map +1 -0
  30. package/dist/catalog-resources.d.ts +3 -3
  31. package/dist/catalog-resources.js +1 -20
  32. package/dist/catalog-resources.js.map +1 -1
  33. package/dist/catalog.d.ts +5 -4
  34. package/dist/catalog.js +151 -24
  35. package/dist/catalog.js.map +1 -1
  36. package/dist/checkbox-group.js +1 -1
  37. package/dist/checkbox.js +1 -1
  38. package/dist/chip.js +1 -1
  39. package/dist/choice-chips.d.ts +3 -3
  40. package/dist/choice-chips.js +1 -1
  41. package/dist/{chunk-Q5BPZPCO.js → chunk-22T7FFCL.js} +2 -2
  42. package/dist/{chunk-Q5BPZPCO.js.map → chunk-22T7FFCL.js.map} +1 -1
  43. package/dist/{chunk-BCHK33XL.js → chunk-27NEAPV7.js} +2 -2
  44. package/dist/{chunk-BCHK33XL.js.map → chunk-27NEAPV7.js.map} +1 -1
  45. package/dist/{chunk-76BLSFEA.js → chunk-2OYMXGW2.js} +6 -5
  46. package/dist/chunk-2OYMXGW2.js.map +1 -0
  47. package/dist/{chunk-EHR7R7YP.js → chunk-3DPHCZQB.js} +2 -2
  48. package/dist/{chunk-EHR7R7YP.js.map → chunk-3DPHCZQB.js.map} +1 -1
  49. package/dist/{chunk-RPJOLDSR.js → chunk-3UIZ36BP.js} +3 -3
  50. package/dist/{chunk-RPJOLDSR.js.map → chunk-3UIZ36BP.js.map} +1 -1
  51. package/dist/{chunk-QZA75NOK.js → chunk-42NLFCIN.js} +6 -6
  52. package/dist/{chunk-QZA75NOK.js.map → chunk-42NLFCIN.js.map} +1 -1
  53. package/dist/{chunk-UPHPFKAD.js → chunk-4GGIML4E.js} +2 -2
  54. package/dist/{chunk-UPHPFKAD.js.map → chunk-4GGIML4E.js.map} +1 -1
  55. package/dist/{chunk-5KWXM5O7.js → chunk-5C34PAUY.js} +2 -2
  56. package/dist/{chunk-5KWXM5O7.js.map → chunk-5C34PAUY.js.map} +1 -1
  57. package/dist/{chunk-6PHG2DMG.js → chunk-6OH734CG.js} +2 -2
  58. package/dist/{chunk-6PHG2DMG.js.map → chunk-6OH734CG.js.map} +1 -1
  59. package/dist/{chunk-E7ZRBMVQ.js → chunk-7XIY7G4K.js} +3 -3
  60. package/dist/{chunk-E7ZRBMVQ.js.map → chunk-7XIY7G4K.js.map} +1 -1
  61. package/dist/{chunk-OKZTLRGG.js → chunk-B5Q3KE4Z.js} +2 -2
  62. package/dist/{chunk-OKZTLRGG.js.map → chunk-B5Q3KE4Z.js.map} +1 -1
  63. package/dist/{chunk-SGYBIKQA.js → chunk-BADEZQ3V.js} +4 -4
  64. package/dist/chunk-BADEZQ3V.js.map +1 -0
  65. package/dist/{chunk-CJAKN2KZ.js → chunk-BLBMUD2W.js} +2 -2
  66. package/dist/{chunk-CJAKN2KZ.js.map → chunk-BLBMUD2W.js.map} +1 -1
  67. package/dist/{chunk-TRJS7M2H.js → chunk-BNRH7XG5.js} +2 -2
  68. package/dist/{chunk-TRJS7M2H.js.map → chunk-BNRH7XG5.js.map} +1 -1
  69. package/dist/{chunk-NA4LKVPX.js → chunk-BNXJQB2Y.js} +2 -2
  70. package/dist/{chunk-NA4LKVPX.js.map → chunk-BNXJQB2Y.js.map} +1 -1
  71. package/dist/{chunk-CCPWJDRW.js → chunk-BQHGXQVA.js} +2 -2
  72. package/dist/{chunk-CCPWJDRW.js.map → chunk-BQHGXQVA.js.map} +1 -1
  73. package/dist/{chunk-COQI4OMZ.js → chunk-BRDTP3RT.js} +1 -1
  74. package/dist/chunk-BRDTP3RT.js.map +1 -0
  75. package/dist/{chunk-RGB4DPMN.js → chunk-DGYGRMES.js} +3 -3
  76. package/dist/chunk-DGYGRMES.js.map +1 -0
  77. package/dist/{chunk-V3IXAI4L.js → chunk-DNNHT7RB.js} +2 -2
  78. package/dist/{chunk-V3IXAI4L.js.map → chunk-DNNHT7RB.js.map} +1 -1
  79. package/dist/{chunk-UU37OR3D.js → chunk-DT7KOBQJ.js} +1 -1
  80. package/dist/chunk-DT7KOBQJ.js.map +1 -0
  81. package/dist/{chunk-CUUW57WB.js → chunk-DXZA7OC6.js} +58 -14
  82. package/dist/chunk-DXZA7OC6.js.map +1 -0
  83. package/dist/{chunk-4OH6JSGU.js → chunk-F25UMYDX.js} +2 -2
  84. package/dist/{chunk-4OH6JSGU.js.map → chunk-F25UMYDX.js.map} +1 -1
  85. package/dist/{chunk-76VCWWUA.js → chunk-HSMSTCNZ.js} +2 -2
  86. package/dist/{chunk-76VCWWUA.js.map → chunk-HSMSTCNZ.js.map} +1 -1
  87. package/dist/{chunk-ECVTRAXN.js → chunk-IQOO3ZQK.js} +2 -2
  88. package/dist/{chunk-ECVTRAXN.js.map → chunk-IQOO3ZQK.js.map} +1 -1
  89. package/dist/{chunk-2FA3SX57.js → chunk-IXT2ARIM.js} +4 -4
  90. package/dist/{chunk-2FA3SX57.js.map → chunk-IXT2ARIM.js.map} +1 -1
  91. package/dist/{chunk-DBP3N6E5.js → chunk-JBL6SCNN.js} +3 -3
  92. package/dist/{chunk-DBP3N6E5.js.map → chunk-JBL6SCNN.js.map} +1 -1
  93. package/dist/{chunk-7KN5OQVN.js → chunk-JNQBPRAA.js} +2 -2
  94. package/dist/{chunk-7KN5OQVN.js.map → chunk-JNQBPRAA.js.map} +1 -1
  95. package/dist/{chunk-CPTQABDQ.js → chunk-JNSPYECP.js} +2 -2
  96. package/dist/{chunk-CPTQABDQ.js.map → chunk-JNSPYECP.js.map} +1 -1
  97. package/dist/{chunk-E7Q6UNCB.js → chunk-KBDYXGYT.js} +2 -2
  98. package/dist/{chunk-E7Q6UNCB.js.map → chunk-KBDYXGYT.js.map} +1 -1
  99. package/dist/{chunk-WVQDIOD7.js → chunk-KKMZP3YL.js} +2 -2
  100. package/dist/{chunk-WVQDIOD7.js.map → chunk-KKMZP3YL.js.map} +1 -1
  101. package/dist/{chunk-WSPXSWFG.js → chunk-KZEHTRPC.js} +3 -3
  102. package/dist/chunk-KZEHTRPC.js.map +1 -0
  103. package/dist/{chunk-KACJOE2N.js → chunk-LH5V6XGH.js} +2 -2
  104. package/dist/{chunk-KACJOE2N.js.map → chunk-LH5V6XGH.js.map} +1 -1
  105. package/dist/{chunk-VBXKYT4O.js → chunk-LH7YRRY7.js} +2 -2
  106. package/dist/{chunk-VBXKYT4O.js.map → chunk-LH7YRRY7.js.map} +1 -1
  107. package/dist/{chunk-QXXLDY6I.js → chunk-LI7AQ5NQ.js} +4 -4
  108. package/dist/{chunk-QXXLDY6I.js.map → chunk-LI7AQ5NQ.js.map} +1 -1
  109. package/dist/{chunk-CAB5IWV7.js → chunk-LSFPZR52.js} +4 -4
  110. package/dist/{chunk-CAB5IWV7.js.map → chunk-LSFPZR52.js.map} +1 -1
  111. package/dist/{chunk-CRHKWHTA.js → chunk-LUWZ7UZQ.js} +4 -4
  112. package/dist/{chunk-CRHKWHTA.js.map → chunk-LUWZ7UZQ.js.map} +1 -1
  113. package/dist/{chunk-CMG4OZPV.js → chunk-LWWIBUDK.js} +2 -2
  114. package/dist/{chunk-CMG4OZPV.js.map → chunk-LWWIBUDK.js.map} +1 -1
  115. package/dist/{chunk-LOW7J7SE.js → chunk-MHF2NK7F.js} +4 -4
  116. package/dist/{chunk-LOW7J7SE.js.map → chunk-MHF2NK7F.js.map} +1 -1
  117. package/dist/{chunk-JHUEYWWI.js → chunk-MPM6YBOM.js} +2 -2
  118. package/dist/{chunk-JHUEYWWI.js.map → chunk-MPM6YBOM.js.map} +1 -1
  119. package/dist/{chunk-3UEMBHBK.js → chunk-MPT6Y7Z2.js} +2 -2
  120. package/dist/{chunk-3UEMBHBK.js.map → chunk-MPT6Y7Z2.js.map} +1 -1
  121. package/dist/{chunk-OZKBIPXU.js → chunk-NO2XO7S6.js} +3 -3
  122. package/dist/{chunk-OZKBIPXU.js.map → chunk-NO2XO7S6.js.map} +1 -1
  123. package/dist/{chunk-FQETQ7CM.js → chunk-NSNQWDJ4.js} +2 -2
  124. package/dist/{chunk-FQETQ7CM.js.map → chunk-NSNQWDJ4.js.map} +1 -1
  125. package/dist/{chunk-UOBC36FL.js → chunk-OW2ODKHN.js} +2 -2
  126. package/dist/{chunk-UOBC36FL.js.map → chunk-OW2ODKHN.js.map} +1 -1
  127. package/dist/{chunk-PVKAIVKE.js → chunk-P427MACE.js} +63 -74
  128. package/dist/chunk-P427MACE.js.map +1 -0
  129. package/dist/{chunk-LET362AM.js → chunk-PBXTHYB4.js} +2 -2
  130. package/dist/chunk-PBXTHYB4.js.map +1 -0
  131. package/dist/{chunk-C4FBYP2D.js → chunk-PIYFVFPL.js} +9 -3
  132. package/dist/chunk-PIYFVFPL.js.map +1 -0
  133. package/dist/{chunk-FR5G77K5.js → chunk-PJKH2GZ3.js} +2 -2
  134. package/dist/{chunk-FR5G77K5.js.map → chunk-PJKH2GZ3.js.map} +1 -1
  135. package/dist/{chunk-FNJA4S6J.js → chunk-QNA27ABY.js} +3 -3
  136. package/dist/{chunk-FNJA4S6J.js.map → chunk-QNA27ABY.js.map} +1 -1
  137. package/dist/{chunk-RHMY45DK.js → chunk-QNB5DKKP.js} +5 -5
  138. package/dist/{chunk-RHMY45DK.js.map → chunk-QNB5DKKP.js.map} +1 -1
  139. package/dist/{chunk-XO5IOPM5.js → chunk-QWAAR5JX.js} +8 -8
  140. package/dist/{chunk-XO5IOPM5.js.map → chunk-QWAAR5JX.js.map} +1 -1
  141. package/dist/{chunk-6BXPN5SC.js → chunk-RO3TSZ5W.js} +3 -3
  142. package/dist/{chunk-6BXPN5SC.js.map → chunk-RO3TSZ5W.js.map} +1 -1
  143. package/dist/{chunk-4IXG6XCT.js → chunk-RUCUU7Z7.js} +2 -2
  144. package/dist/{chunk-4IXG6XCT.js.map → chunk-RUCUU7Z7.js.map} +1 -1
  145. package/dist/{chunk-QSJAIXLM.js → chunk-SDQZYSCA.js} +3 -3
  146. package/dist/{chunk-QSJAIXLM.js.map → chunk-SDQZYSCA.js.map} +1 -1
  147. package/dist/{chunk-3XSY5LAB.js → chunk-SXZTDJMG.js} +4 -4
  148. package/dist/{chunk-3XSY5LAB.js.map → chunk-SXZTDJMG.js.map} +1 -1
  149. package/dist/{chunk-LJV2FNOC.js → chunk-T7M5FKCE.js} +3 -3
  150. package/dist/{chunk-LJV2FNOC.js.map → chunk-T7M5FKCE.js.map} +1 -1
  151. package/dist/{chunk-KS7EXW4P.js → chunk-TIRBSPP2.js} +2 -2
  152. package/dist/{chunk-KS7EXW4P.js.map → chunk-TIRBSPP2.js.map} +1 -1
  153. package/dist/{chunk-2GEGIPDR.js → chunk-U5SQOZNK.js} +4 -4
  154. package/dist/{chunk-2GEGIPDR.js.map → chunk-U5SQOZNK.js.map} +1 -1
  155. package/dist/{chunk-Y4VR6VNM.js → chunk-UPOS666Q.js} +2 -2
  156. package/dist/{chunk-Y4VR6VNM.js.map → chunk-UPOS666Q.js.map} +1 -1
  157. package/dist/{chunk-YE6KCAIN.js → chunk-USSGJ3MD.js} +2 -2
  158. package/dist/{chunk-YE6KCAIN.js.map → chunk-USSGJ3MD.js.map} +1 -1
  159. package/dist/{chunk-4UWLHKNU.js → chunk-UWLJ7UEK.js} +3 -3
  160. package/dist/{chunk-4UWLHKNU.js.map → chunk-UWLJ7UEK.js.map} +1 -1
  161. package/dist/{chunk-SNUDT6AX.js → chunk-VHAYQGWR.js} +2 -2
  162. package/dist/{chunk-SNUDT6AX.js.map → chunk-VHAYQGWR.js.map} +1 -1
  163. package/dist/{chunk-DV6GE57V.js → chunk-VWGRAE2Q.js} +2 -2
  164. package/dist/chunk-VWGRAE2Q.js.map +1 -0
  165. package/dist/{chunk-4L5ZIKDZ.js → chunk-W7J3MQNV.js} +2 -2
  166. package/dist/{chunk-4L5ZIKDZ.js.map → chunk-W7J3MQNV.js.map} +1 -1
  167. package/dist/{chunk-MVWR5WRX.js → chunk-WWDDKUDW.js} +3 -3
  168. package/dist/{chunk-MVWR5WRX.js.map → chunk-WWDDKUDW.js.map} +1 -1
  169. package/dist/{chunk-4CYCJ3NY.js → chunk-XNSYDA6G.js} +10 -10
  170. package/dist/{chunk-4CYCJ3NY.js.map → chunk-XNSYDA6G.js.map} +1 -1
  171. package/dist/{chunk-WEQNPYVA.js → chunk-XXKRHKFH.js} +2 -2
  172. package/dist/{chunk-WEQNPYVA.js.map → chunk-XXKRHKFH.js.map} +1 -1
  173. package/dist/{chunk-OQFWF7Q7.js → chunk-XZ253TGP.js} +3 -3
  174. package/dist/{chunk-OQFWF7Q7.js.map → chunk-XZ253TGP.js.map} +1 -1
  175. package/dist/{chunk-3TBMGGTA.js → chunk-Y672Z7QY.js} +2 -2
  176. package/dist/{chunk-3TBMGGTA.js.map → chunk-Y672Z7QY.js.map} +1 -1
  177. package/dist/chunk-YM7VF5SY.js +22 -0
  178. package/dist/chunk-YM7VF5SY.js.map +1 -0
  179. package/dist/{chunk-S7QB5KMM.js → chunk-YRQ4KKLG.js} +29 -56
  180. package/dist/chunk-YRQ4KKLG.js.map +1 -0
  181. package/dist/{chunk-MMOQR426.js → chunk-YS3H6DEQ.js} +2 -2
  182. package/dist/{chunk-MMOQR426.js.map → chunk-YS3H6DEQ.js.map} +1 -1
  183. package/dist/{chunk-QR7MGGOM.js → chunk-YVGHWCMY.js} +3 -3
  184. package/dist/{chunk-QR7MGGOM.js.map → chunk-YVGHWCMY.js.map} +1 -1
  185. package/dist/{chunk-IPYQYLSX.js → chunk-ZDI5I2HT.js} +6 -6
  186. package/dist/{chunk-IPYQYLSX.js.map → chunk-ZDI5I2HT.js.map} +1 -1
  187. package/dist/{chunk-JAC6AVZN.js → chunk-ZIZXXYXM.js} +3 -3
  188. package/dist/{chunk-JAC6AVZN.js.map → chunk-ZIZXXYXM.js.map} +1 -1
  189. package/dist/collapsible-panel.d.ts +5 -5
  190. package/dist/collapsible-panel.js +4 -4
  191. package/dist/collapsible-panel.js.map +1 -1
  192. package/dist/color-field.js +2 -2
  193. package/dist/color-picker.js +1 -1
  194. package/dist/color-swatches.js +1 -1
  195. package/dist/column-explorer.d.ts +2 -2
  196. package/dist/column-explorer.js +166 -21
  197. package/dist/column-explorer.js.map +1 -1
  198. package/dist/column-track.d.ts +1 -1
  199. package/dist/column-track.js +1 -1
  200. package/dist/combobox.d.ts +8 -4
  201. package/dist/combobox.js +1 -1
  202. package/dist/compose-B_GFfFhm.d.ts +36 -0
  203. package/dist/content-item.d.ts +1 -1
  204. package/dist/content-item.js +1 -1
  205. package/dist/content-swap.d.ts +3 -3
  206. package/dist/content-swap.js +1 -1
  207. package/dist/corner-status.d.ts +3 -3
  208. package/dist/corner-status.js +1 -1
  209. package/dist/device-class.js +101 -1
  210. package/dist/device-class.js.map +1 -1
  211. package/dist/disclosure-arrow.d.ts +3 -3
  212. package/dist/disclosure-arrow.js +1 -1
  213. package/dist/disclosure.d.ts +14 -2
  214. package/dist/disclosure.js +13 -4
  215. package/dist/disclosure.js.map +1 -1
  216. package/dist/edge-activity-indicator.d.ts +3 -3
  217. package/dist/edge-activity-indicator.js +1 -1
  218. package/dist/empty-state.d.ts +3 -3
  219. package/dist/empty-state.js +1 -1
  220. package/dist/{extension-attributes-IJ4decoa.d.ts → extension-attributes-CnqvBmj3.d.ts} +1 -1
  221. package/dist/file-picker.d.ts +3 -3
  222. package/dist/file-picker.js +1 -1
  223. package/dist/floating-toolbar.d.ts +3 -3
  224. package/dist/floating-toolbar.js +1 -1
  225. package/dist/form.d.ts +3 -3
  226. package/dist/form.js +1 -1
  227. package/dist/framed-list.js +1 -1
  228. package/dist/gauge.js +1 -1
  229. package/dist/grid.js +1 -1
  230. package/dist/index.d.ts +2 -2
  231. package/dist/index.js +66 -66
  232. package/dist/list-action-row.js +1 -1
  233. package/dist/list-detail-dialog.d.ts +3 -3
  234. package/dist/list-detail-dialog.js +7 -7
  235. package/dist/list-detail-dialog.js.map +1 -1
  236. package/dist/list-header.d.ts +1 -1
  237. package/dist/list-header.js +1 -1
  238. package/dist/list-inset-control.d.ts +3 -3
  239. package/dist/list-inset-control.js +1 -1
  240. package/dist/list-inset-text.js +1 -1
  241. package/dist/list-item.js +1 -1
  242. package/dist/list.d.ts +1 -1
  243. package/dist/list.js +1 -1
  244. package/dist/loading-spinner.d.ts +3 -3
  245. package/dist/loading-spinner.js +1 -1
  246. package/dist/lucide-icon.d.ts +3 -3
  247. package/dist/lucide-icon.js +1 -1
  248. package/dist/message-composer.js +1 -1
  249. package/dist/{nav-stack-DKrvqFjA.d.ts → nav-stack-IKSMxo2A.d.ts} +3 -3
  250. package/dist/nav-stack.d.ts +2 -2
  251. package/dist/nav-stack.js +1 -1
  252. package/dist/paged-view.d.ts +3 -3
  253. package/dist/paged-view.js +1 -1
  254. package/dist/paged-view.js.map +1 -1
  255. package/dist/pane.js +1 -1
  256. package/dist/popup-menu-register.js +7 -1
  257. package/dist/popup-menu-register.js.map +1 -1
  258. package/dist/popup-menu.d.ts +3 -20
  259. package/dist/popup-menu.js +1 -1
  260. package/dist/progress-bar.js +1 -1
  261. package/dist/progress-ring.js +1 -1
  262. package/dist/radio-group.js +1 -1
  263. package/dist/resizable-region.d.ts +3 -3
  264. package/dist/resizable-region.js +1 -1
  265. package/dist/row.d.ts +1 -1
  266. package/dist/row.js +1 -1
  267. package/dist/scroll-effect.d.ts +1 -1
  268. package/dist/scroll-effect.js +1 -1
  269. package/dist/{search-field-7wLt3Bd5.d.ts → search-field-BA48RaJY.d.ts} +3 -3
  270. package/dist/search-field-model.d.ts +2 -2
  271. package/dist/search-field.d.ts +2 -2
  272. package/dist/search-field.js +1 -1
  273. package/dist/segmented-control.d.ts +3 -3
  274. package/dist/segmented-control.js +1 -1
  275. package/dist/select-register.js +3 -2
  276. package/dist/select-register.js.map +1 -1
  277. package/dist/select.d.ts +3 -13
  278. package/dist/select.js +1 -1
  279. package/dist/sized-region.d.ts +3 -3
  280. package/dist/sized-region.js +1 -1
  281. package/dist/skeleton.d.ts +3 -3
  282. package/dist/skeleton.js +1 -1
  283. package/dist/slider.js +1 -1
  284. package/dist/spacer.d.ts +3 -3
  285. package/dist/spacer.js +1 -1
  286. package/dist/split-button.js +1 -1
  287. package/dist/split-view.d.ts +4 -4
  288. package/dist/split-view.js +1 -1
  289. package/dist/state-banner.js +1 -1
  290. package/dist/styles/components/actions/popup-menu/popup-menu.css +12 -125
  291. package/dist/styles/components/actions/toolbar/toolbar.css +0 -7
  292. package/dist/styles/components/data-display/value-table/value-table.css +3 -1
  293. package/dist/styles/components/forms/select/select.css +0 -60
  294. package/dist/styles/components/forms/switch/switch.css +9 -0
  295. package/dist/styles/components/forms/text-field/text-field.css +1 -1
  296. package/dist/styles/components/surfaces/disclosure/disclosure.css +24 -4
  297. package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +1 -1
  298. package/dist/styles/disclosure.css +24 -4
  299. package/dist/styles/popup-menu.css +12 -125
  300. package/dist/styles/select.css +0 -60
  301. package/dist/styles/surface-scaffold.css +1 -1
  302. package/dist/styles/switch.css +9 -0
  303. package/dist/styles/text-field.css +1 -1
  304. package/dist/styles/toolbar.css +0 -7
  305. package/dist/styles/value-table.css +3 -1
  306. package/dist/styles/webawesome.css +7 -0
  307. package/dist/summary-row.js +1 -1
  308. package/dist/sunken-panel.d.ts +3 -3
  309. package/dist/sunken-panel.js +1 -1
  310. package/dist/surface-scaffold.d.ts +9 -5
  311. package/dist/surface-scaffold.js +1 -1
  312. package/dist/switch.d.ts +3 -1
  313. package/dist/switch.js +1 -1
  314. package/dist/tab-bar-item.js +1 -1
  315. package/dist/tab-bar.d.ts +3 -3
  316. package/dist/tab-bar.js +1 -1
  317. package/dist/tab-navigator.d.ts +3 -3
  318. package/dist/tab-navigator.js +2 -2
  319. package/dist/tab-navigator.js.map +1 -1
  320. package/dist/tab-panel.d.ts +3 -3
  321. package/dist/tab-panel.js +1 -1
  322. package/dist/tag-field.d.ts +3 -3
  323. package/dist/tag-field.js +1 -1
  324. package/dist/text-field.d.ts +2 -2
  325. package/dist/text-field.js +1 -1
  326. package/dist/text.d.ts +1 -1
  327. package/dist/text.js +1 -1
  328. package/dist/toolbar-control-group.d.ts +7 -7
  329. package/dist/toolbar-control-group.js +1 -1
  330. package/dist/toolbar-text.d.ts +3 -3
  331. package/dist/toolbar-text.js +1 -1
  332. package/dist/toolbar.d.ts +3 -3
  333. package/dist/toolbar.js +1 -1
  334. package/dist/tree-list.d.ts +3 -3
  335. package/dist/tree-list.js +151 -3
  336. package/dist/tree-list.js.map +1 -1
  337. package/dist/{tree-rows-Bms5QJvG.d.ts → tree-rows-BXChApji.d.ts} +1 -1
  338. package/dist/{types-DmHWkSd6.d.ts → types-CuKf5G87.d.ts} +6 -2
  339. package/dist/value-preview.d.ts +3 -3
  340. package/dist/value-preview.js +1 -1
  341. package/dist/value-table.d.ts +5 -5
  342. package/dist/value-table.js +1 -1
  343. package/dist/wire-catalog.d.ts +5 -5
  344. package/dist/wire-catalog.js +13 -4
  345. package/dist/wire-catalog.js.map +1 -1
  346. package/dist/wire-color-fields.js +73 -2
  347. package/dist/wire-color-fields.js.map +1 -1
  348. package/dist/wire-color-pickers.js +1 -1
  349. package/dist/wire-column-explorer.js +92 -1
  350. package/dist/wire-column-explorer.js.map +1 -1
  351. package/dist/wire-content-items.js +204 -1
  352. package/dist/wire-content-items.js.map +1 -1
  353. package/dist/wire-nav-stack.js +423 -1
  354. package/dist/wire-nav-stack.js.map +1 -1
  355. package/dist/wire-resizable-regions.js +1 -1
  356. package/dist/wire-search-fields.d.ts +2 -2
  357. package/dist/wire-search-fields.js +1 -1
  358. package/dist/wire-sidebar.js +228 -1
  359. package/dist/wire-sidebar.js.map +1 -1
  360. package/dist/wire-sliders.js +29 -1
  361. package/dist/wire-sliders.js.map +1 -1
  362. package/dist/wire-tab-bars.d.ts +1 -1
  363. package/dist/wire-tab-navigator.js +150 -1
  364. package/dist/wire-tab-navigator.js.map +1 -1
  365. package/dist/wire-tag-fields.js +252 -2
  366. package/dist/wire-tag-fields.js.map +1 -1
  367. package/dist/wire-tree-list.js +186 -1
  368. package/dist/wire-tree-list.js.map +1 -1
  369. package/dist/wire-workbench.js +1 -1
  370. package/dist/workbench-dialog.d.ts +3 -3
  371. package/dist/workbench-dialog.js +5 -5
  372. package/dist/workbench-dialog.js.map +1 -1
  373. package/dist/workbench.d.ts +4 -4
  374. package/dist/workbench.js +1 -1
  375. package/docs/accessibility.md +1 -1
  376. package/docs/catalog.md +59 -0
  377. package/docs/component-contract.md +4 -3
  378. package/docs/component-selection.md +7 -2
  379. package/docs/disclosure.md +22 -0
  380. package/docs/examples/composed-catalog.tsx +113 -0
  381. package/docs/examples/scoped-combobox.ts +99 -0
  382. package/docs/examples/typed-action-table.tsx +34 -0
  383. package/docs/forms-and-validation.md +2 -0
  384. package/docs/investigations/combobox-seed-ownership.md +49 -0
  385. package/docs/investigations/measure-scoped-combobox.mjs +87 -0
  386. package/docs/investigations/scoped-combobox.md +98 -0
  387. package/docs/list-detail-dialog.md +2 -3
  388. package/docs/scroll-effect.md +2 -2
  389. package/docs/surface-scaffold.md +5 -6
  390. package/docs/switch.md +21 -0
  391. package/docs/ui-doctor.md +16 -0
  392. package/docs/workbench-dialog.md +2 -3
  393. package/doctor/cli.mjs +38 -25
  394. package/doctor/explain-use.mjs +320 -0
  395. package/llms.txt +3 -44
  396. package/package.json +6 -33
  397. package/ux-demo/recipes/app-shell.tsx +141 -48
  398. package/ux-demo/recipes/collapsible-sidebar.tsx +169 -43
  399. package/ux-demo/recipes/compact-toolbar.tsx +114 -22
  400. package/ux-demo/recipes/composer-form.tsx +104 -14
  401. package/ux-demo/recipes/list-detail-dialog.tsx +84 -38
  402. package/ux-demo/recipes/list-workspace-states.tsx +152 -29
  403. package/ux-demo/recipes/loading-inspector.tsx +174 -30
  404. package/ux-demo/recipes/media-detail.tsx +146 -29
  405. package/ux-demo/recipes/navigation-sidebar.tsx +113 -24
  406. package/ux-demo/recipes/navigation-stack.tsx +43 -7
  407. package/ux-demo/recipes/workspace-header.tsx +66 -2
  408. package/ai/component-props-overlay.json +0 -8910
  409. package/ai/component-props-overlay.schema.json +0 -82
  410. package/ai/component-props.json +0 -34289
  411. package/ai/component-props.schema.json +0 -408
  412. package/ai/view-document.schema.json +0 -467
  413. package/dist/browser/editor.js +0 -50
  414. package/dist/chunk-3K5V3ZSD.js +0 -77
  415. package/dist/chunk-3K5V3ZSD.js.map +0 -1
  416. package/dist/chunk-63TJH2RF.js +0 -231
  417. package/dist/chunk-63TJH2RF.js.map +0 -1
  418. package/dist/chunk-6V6UHPJD.js +0 -153
  419. package/dist/chunk-6V6UHPJD.js.map +0 -1
  420. package/dist/chunk-76BLSFEA.js.map +0 -1
  421. package/dist/chunk-C4FBYP2D.js.map +0 -1
  422. package/dist/chunk-COQI4OMZ.js.map +0 -1
  423. package/dist/chunk-CUUW57WB.js.map +0 -1
  424. package/dist/chunk-D2KHQNJ6.js +0 -155
  425. package/dist/chunk-D2KHQNJ6.js.map +0 -1
  426. package/dist/chunk-DV6GE57V.js.map +0 -1
  427. package/dist/chunk-FCO7BT4P.js +0 -256
  428. package/dist/chunk-FCO7BT4P.js.map +0 -1
  429. package/dist/chunk-GHV36C6I.js +0 -94
  430. package/dist/chunk-GHV36C6I.js.map +0 -1
  431. package/dist/chunk-HPOXLOVC.js +0 -184
  432. package/dist/chunk-HPOXLOVC.js.map +0 -1
  433. package/dist/chunk-I2K4OQKB.js +0 -426
  434. package/dist/chunk-I2K4OQKB.js.map +0 -1
  435. package/dist/chunk-LET362AM.js.map +0 -1
  436. package/dist/chunk-PVKAIVKE.js.map +0 -1
  437. package/dist/chunk-RGB4DPMN.js.map +0 -1
  438. package/dist/chunk-S7QB5KMM.js.map +0 -1
  439. package/dist/chunk-SGYBIKQA.js.map +0 -1
  440. package/dist/chunk-TXBNPEIJ.js +0 -31
  441. package/dist/chunk-TXBNPEIJ.js.map +0 -1
  442. package/dist/chunk-UU37OR3D.js.map +0 -1
  443. package/dist/chunk-WCMGPAY2.js +0 -103
  444. package/dist/chunk-WCMGPAY2.js.map +0 -1
  445. package/dist/chunk-WSPXSWFG.js.map +0 -1
  446. package/dist/chunk-X43QQWVC.js +0 -208
  447. package/dist/chunk-X43QQWVC.js.map +0 -1
  448. package/dist/chunk-YA6OAJY6.js +0 -155
  449. package/dist/chunk-YA6OAJY6.js.map +0 -1
  450. package/dist/editor.d.ts +0 -447
  451. package/dist/editor.js +0 -15608
  452. package/dist/editor.js.map +0 -1
  453. package/dist/styles/editor/editor.css +0 -585
  454. package/dist/styles/editor.css +0 -4
  455. package/dist/view-runtime.d.ts +0 -9
  456. package/dist/view-runtime.js +0 -8
  457. package/dist/view-runtime.js.map +0 -1
  458. package/docs/editor-host.md +0 -397
  459. package/docs/view.md +0 -314
  460. package/props/cli.d.mts +0 -1
  461. package/props/cli.mjs +0 -142
  462. package/props/component-props.d.mts +0 -180
  463. package/props/component-props.mjs +0 -1208
  464. package/view/catalog.mjs +0 -229
  465. package/view/child-kind.mjs +0 -22
  466. package/view/cli.d.mts +0 -18
  467. package/view/cli.mjs +0 -316
  468. package/view/contract.mjs +0 -418
  469. package/view/css-grammar.mjs +0 -93
  470. package/view/generate.d.mts +0 -16
  471. package/view/generate.mjs +0 -739
  472. package/view/index.d.mts +0 -491
  473. package/view/index.mjs +0 -36
  474. package/view/interpret.mjs +0 -339
  475. package/view/project-types-worker.mjs +0 -55
  476. package/view/project-types.d.mts +0 -43
  477. package/view/project-types.mjs +0 -618
  478. package/view/type-expression.d.mts +0 -15
  479. package/view/type-expression.mjs +0 -162
  480. package/view/types.mjs +0 -165
  481. package/view/validate-move.mjs +0 -353
  482. package/view/validate.mjs +0 -1649
  483. package/vite-editor.d.mts +0 -173
  484. package/vite-editor.mjs +0 -548
@@ -0,0 +1,98 @@
1
+ # Scoped Combobox pilot
2
+
3
+ Retain the public `Combobox` and `wireComboboxes` entries. Use the typed
4
+ [scoped recipe](../examples/scoped-combobox.ts) as a reference for applications
5
+ that dynamically add fields with independent callbacks. It makes the seed and
6
+ callback lifetime explicit and costs 403 additional gzip bytes in the measured
7
+ one-field app. A single-field consumer already gets the same listener count with
8
+ less source. A browser reproduced duplicate commits when the two wiring styles
9
+ were mixed. Resolve that ownership ambiguity before adding an API to the package
10
+ (KF-Z9RA3T).
11
+
12
+ ## One field, two authoring patterns
13
+
14
+ The current public recipe captures the initial string in its surrounding
15
+ function. Each additional field routes through the common commit callback.
16
+
17
+ ```ts
18
+ const unmount = mount(root, () => Combobox({ id, value: initialValue, ...props() }));
19
+ const release = wireComboboxes(root, { onCommit: handleCommit });
20
+ // On teardown
21
+ release();
22
+ unmount();
23
+ ```
24
+
25
+ The scoped example registers a field outside the repeating render. Dynamic
26
+ suggestions, accessible names and hints still belong in the render. The caller
27
+ can locally determine which callback receives each field's commits.
28
+
29
+ ```ts
30
+ const owner = createComboboxOwner();
31
+ const tag = owner.field({ id, initialValue, onCommit: addTag });
32
+ const unmount = mount(root, () => tag.render(props()));
33
+ owner.connect(root);
34
+ // On teardown
35
+ owner.dispose();
36
+ unmount();
37
+ ```
38
+
39
+ ## Ownership and limits
40
+
41
+ - A registration captures its seed once and owns one callback. A surviving
42
+ input retains its draft through focused and blurred renders. Form reset
43
+ uses the captured seed. Re-register after removal to take a new seed.
44
+ The server renders escaped text with no host, global registry or document.
45
+ - Use one owner per mounted application root and document-unique HTML ids.
46
+ Multiple nested feature components use the same owner and can register
47
+ independently. An ancestor/descendant or second same-host connection
48
+ throws before installing. Sibling roots operate independently. The
49
+ overlap check consults ancestors and the proposed host's own subtree
50
+ on connection. Keep the host outside the repeating render and dispose
51
+ before reparenting a connected root.
52
+ - The owner fixes commit keys on creation. Every field uses that policy.
53
+ A sibling root may choose different keys. Registrations accept field
54
+ options only. Duplicate live IDs and renders from disposed handles throw.
55
+ A stale disposer checks the registration's token before removal.
56
+ - Register before rendering. On removal, dispose a field while its input is
57
+ connected, then remove its markup. The last field releases the installation.
58
+ Disposing the owner clears registrations and releases all wiring. Dispose
59
+ before unmount so focusout can close an open list and stop anchor tracking.
60
+ A raw removal bypasses that ordering. The token protects field handles;
61
+ it cannot distinguish stray live markup reusing a registered HTML id.
62
+ - Manual wiring delegates to every Combobox underneath its root and publishes
63
+ no ownership marker. It can consume keys on unregistered fields, and installing
64
+ it alongside an owner can invoke both callbacks. Keep a whole delegated
65
+ region under one wiring style. Independently movable child applications or
66
+ per-field delimiter sets need a stronger routing contract.
67
+
68
+ ## Measurements
69
+
70
+ Production package browser conditions, ES2022 ESM, esbuild 0.25.12, Node
71
+ 22.23.5, minified, gzip defaults. These bytes include a mounted app and its
72
+ component stylesheet dependencies. Run `node ui/docs/investigations/measure-scoped-combobox.mjs`
73
+ after building root and UI packages. The script contains the executable
74
+ before/after apps.
75
+
76
+ | Mounted consumer | JS bytes | JS gzip | CSS bytes | CSS gzip |
77
+ | ----------------------------------- | -------: | ------: | --------: | -------: |
78
+ | Manual Combobox | 66,258 | 24,595 | 19,343 | 3,803 |
79
+ | Scoped Combobox | 67,280 | 24,998 | 19,343 | 3,803 |
80
+ | Button only | 49,363 | 18,030 | 31,043 | 5,559 |
81
+ | Button plus an unused scoped import | 49,362 | 17,995 | 33,160 | 5,933 |
82
+
83
+ The last row is a deliberate unused import. esbuild removes the owner logic,
84
+ but the browser component entry includes a CSS side effect. This adds 374
85
+ gzip CSS bytes. A Button-only application that omits the import contains
86
+ neither Combobox CSS nor the recipe.
87
+
88
+ | Fields on one root | Live root listeners | Subtree observers | Removed listeners / disconnected observers after final release |
89
+ | ------------------ | ------------------: | ----------------: | -------------------------------------------------------------: |
90
+ | 1 | 5 | 1 | 5 / 1 |
91
+ | 50 | 5 | 1 | 5 / 1 |
92
+
93
+ Counts exclude anchor positioning for an open popover. The browser fixture
94
+ exercises sibling roots, nested fields, a late registration, pointer and
95
+ keyboard routing, a composing Enter, active-option restoration after reorder,
96
+ field removal and id reuse, native reset, and repeated disposal. The legacy
97
+ Combobox suite supplies the filtering and create-policy coverage. The Node
98
+ test renders escaped seeds independently without a browser global.
@@ -97,9 +97,8 @@ functions are re-exported from this subpath. Give sibling dialogs distinct
97
97
  `rootAttributes['data-key']` values so a re-render morphs each into itself.
98
98
 
99
99
  Pass `embedded` to render it in flow and always shown instead, keeping its
100
- `height`, for a catalog, a design canvas, or a document; `openDialog()` and
101
- `closeDialog()` leave it alone. The Kerf UI editor shows a ListDetailDialog this
102
- way on its edit canvas.
100
+ `height`, for a catalog, an inline preview, or a document; `openDialog()` and
101
+ `closeDialog()` leave it alone.
103
102
 
104
103
  See the [list-detail dialog recipe](recipes.md#list-detail-dialog) for a
105
104
  complete, production-backed example.
@@ -26,8 +26,8 @@ import { ScrollEffect } from '@kerfjs/ui/scroll-effect';
26
26
 
27
27
  - `effects` (required): a list of presets. A kind may repeat; repeats stack like any other effects.
28
28
  - `children`: the content the effects apply to.
29
- - `rootAttributes`: application `data-*` metadata on the root, such as an
30
- editor node marker. The component's own markers stay protected.
29
+ - `rootAttributes`: application `data-*` metadata on the root, such as a
30
+ row key or a test hook. The component's own markers stay protected.
31
31
 
32
32
  ### Presets
33
33
 
@@ -102,8 +102,6 @@ the drop shadow. Use it where
102
102
  a dialog is shown rather than opened, such as a catalog specimen, a design
103
103
  canvas, or a document. `openDialog` and `closeDialog` leave an embedded dialog
104
104
  alone, and its close button and `data-dialog-close` controls do not hide it.
105
- The Kerf UI editor shows every DialogSurface embedded on its edit canvas so its
106
- content can be seen and selected; play mode keeps the authored presentation.
107
105
 
108
106
  ### Sibling dialogs keep their identity
109
107
 
@@ -586,15 +584,16 @@ hand-built draggable panel. It takes the same geometry props as
586
584
  `minHeight` accepts a branded `CssLength` and protects fixed controls plus a
587
585
  useful content region while resizing. CSS resolves the length and caps the
588
586
  minimum by `maxHeight` and the available dynamic viewport. Resizable overlays
589
- default to 160px; the editor Library configures 320px for its header, view tabs,
590
- search field, and visible result rows. Keyboard resize reports the actual
587
+ default to 160px; raise it when fixed header controls and a few visible rows
588
+ must stay usable. Keyboard resize reports the actual
591
589
  constrained box, so stored height agrees with what the person sees.
592
590
 
593
591
  The surface is `popover="manual"`, so the controller provides its light
594
592
  dismiss; changing an `auto` popover into a pinned one is not possible while
595
593
  it is open. The title is the move handle: a focusable button named by the
596
594
  label, whose accessible description (`moveDescription`) explains the drag
597
- and the keys. Focus stays where the person puts it, as with any non-modal
595
+ and the keys. The default adds that moving pins the surface only when it is
596
+ `pinnable`; a persistent surface is always pinned. Focus stays where the person puts it, as with any non-modal
598
597
  popover; give its first control `autofocus` to move focus in on open.
599
598
 
600
599
  The application owns storage. `onChange` reports `{ pinned, placement, reason }`
@@ -656,7 +655,7 @@ The controller keeps its pinned state, placement, and the Pin toggle's
656
655
  `aria-pressed` across application re-renders. An application that closes the
657
656
  panel after a task (a drop from a library) checks `isPopoverPinned()` first.
658
657
  `presentation="embedded"` (with `pinned` for the pinned look) renders it in
659
- flow for a catalog or a design canvas, with its border and no drop shadow;
658
+ flow for a catalog or an inline preview, with its border and no drop shadow;
660
659
  `wirePinnablePopover` leaves an embedded surface alone.
661
660
 
662
661
  Wrap one `PopupMenu` (or another single `wa-dropdown`) with `PopupSurface`. `inset="none"` removes menu
package/docs/switch.md ADDED
@@ -0,0 +1,21 @@
1
+ # Switch placement
2
+
3
+ Use a Switch for a setting that takes effect immediately. Its native checkbox supplies keyboard and form behavior. Listen for the input's `change` event to persist the new value.
4
+
5
+ ```tsx
6
+ import { Switch } from "@kerfjs/ui/switch";
7
+
8
+ <Switch
9
+ label="Group new tickets automatically"
10
+ hint="Keep related tickets together as they arrive."
11
+ labelPlacement="start"
12
+ checked={groupTickets.value}
13
+ action="toggle-group-tickets"
14
+ />;
15
+ ```
16
+
17
+ ## Layout and accessibility requirements
18
+
19
+ - Omit `labelPlacement` or use `"end"` for the compact inline layout with the track before the label.
20
+ - Use `"start"` in settings rows. The label and hint share the leading text column. The track stays at the trailing edge of the available width, including when the text wraps. Both edges follow the writing direction.
21
+ - Default and compact sizes use the same placement rules. The visible label provides the switch's name and its hint provides the description. Clicking the label activates the switch, Space toggles a focused switch, and the focus ring follows the track. A disabled switch retains its native disabled behavior.
package/docs/ui-doctor.md CHANGED
@@ -368,3 +368,19 @@ process.exitCode = report.exitCode;
368
368
  `--package` accepts either a workspace package name or a workspace-relative package path. The doctor uses the selected package for compiler, lint, profile-discovery start, and analyzer scope, while workspace profile precedence and root lockfiles remain authoritative.
369
369
 
370
370
  A repair agent should run JSON mode, apply only source-located safe changes, and rerun until exit `0`. Do not treat exit `2`, a skipped required stage, or an empty changed selection as clean. Browser evidence is objective input; the evaluator's named subjective rubric still requires human review.
371
+
372
+ ## Explain one JSX use
373
+
374
+ `kerf-ui-doctor --root . --explain-use src/picker.tsx:12:7 --format json`
375
+ inspects a one-based position inside a Combobox or ChoiceChips opening tag.
376
+ The version 1 response includes the component contract, active mode,
377
+ application-owned state, event, candidate wiring roots and source locations
378
+ of cleanup calls. Text format is the default. A native wrapping ChoiceChips
379
+ group needs no behavior installation. Its listbox or scrolling mode uses
380
+ `wireChoiceChips`. A dynamic mode reports the unresolved alternatives.
381
+
382
+ The project's TypeScript source graph supplies evidence of calls. Even when
383
+ the same root binding appears in both locations, verify that setup executes
384
+ for this mount and its owner invokes cleanup. Unknown wrappers need manual
385
+ inspection. Use the returned component card, exact prop signatures, and
386
+ catalog route to check a proposed change with the keyboard.
@@ -81,9 +81,8 @@ Escape closes the dialog.
81
81
  - `leftRail`, `rightRail`, `bottomDrawer`: `WorkbenchPanel`s.
82
82
  - `compact`, `closeLabel` (default `Close`), `lightDismiss`.
83
83
  - `embedded`: render in flow and always shown, keeping `height`, for a
84
- catalog, a design canvas, or a document. `openDialog()` and `closeDialog()`
85
- leave it alone. The Kerf UI editor shows a WorkbenchDialog this way on its
86
- edit canvas.
84
+ catalog, an inline preview, or a document. `openDialog()` and `closeDialog()`
85
+ leave it alone.
87
86
  - Roomy sizing: `size` (default `large`), `preferredWidth`, `height` (default
88
87
  560px), `maxHeight`, `viewportGutter`, and `mainMinSize`.
89
88
  - `rootAttributes`, `className`, `slot`.
package/doctor/cli.mjs CHANGED
@@ -34,6 +34,7 @@ try {
34
34
  console.log(`Usage: kerf-ui-doctor [--full | --changed] [options]
35
35
 
36
36
  Options:
37
+ --explain-use <file:line:column> Explain this JSX opening tag and its wiring
37
38
  --root <path> Workspace root (default: current directory)
38
39
  --package <name|path> Select one workspace package
39
40
  --path <path> Restrict changed mode (repeatable)
@@ -53,6 +54,7 @@ Exit codes: 0 clean, 1 findings, 2 configuration/tool failure, 130 cancelled.`);
53
54
  const { options } = parseCliArguments(args, {
54
55
  values: {
55
56
  '--root': 'root',
57
+ '--explain-use': 'explainUse',
56
58
  '--package': 'package',
57
59
  '--path': 'paths',
58
60
  '--config': 'config',
@@ -91,31 +93,42 @@ Exit codes: 0 clean, 1 findings, 2 configuration/tool failure, 130 cancelled.`);
91
93
  throw new Error('--fail-on must be error, review, or warning.');
92
94
  if (!['recommended-ui', 'strict-ui'].includes(eslintConfig))
93
95
  throw new Error('--eslint must be recommended-ui or strict-ui.');
94
- const abort = new globalThis.AbortController();
95
- process.once('SIGINT', () => abort.abort());
96
- const paths =
97
- changed && !explicitPaths.length ? await changedPaths(root) : explicitPaths;
98
- const report = await runUiDoctor({
99
- root,
100
- package: packageSelector,
101
- mode: changed ? 'changed' : full ? 'full' : undefined,
102
- paths,
103
- configPath,
104
- cache: !noCache,
105
- signal: abort.signal,
106
- eslintConfig,
107
- failOn,
108
- browser: url
109
- ? { url, browsers: browserList?.split(',').map((item) => item.trim()) }
110
- : undefined,
111
- });
112
- const rendered =
113
- format === 'json'
114
- ? JSON.stringify(report, null, 2)
115
- : formatUiDoctorText(report);
116
- if (output) await writeFile(resolve(root, output), `${rendered}\n`);
117
- else console.log(rendered);
118
- process.exitCode = report.exitCode;
96
+ if (options.explainUse) {
97
+ const { explainUse, formatUse } = await import('./explain-use.mjs');
98
+ const report = explainUse(root, options.explainUse);
99
+ const rendered =
100
+ format === 'json' ? JSON.stringify(report, null, 2) : formatUse(report);
101
+ if (output) await writeFile(resolve(root, output), rendered + '\n');
102
+ else console.log(rendered);
103
+ } else {
104
+ const abort = new globalThis.AbortController();
105
+ process.once('SIGINT', () => abort.abort());
106
+ const paths =
107
+ changed && !explicitPaths.length
108
+ ? await changedPaths(root)
109
+ : explicitPaths;
110
+ const report = await runUiDoctor({
111
+ root,
112
+ package: packageSelector,
113
+ mode: changed ? 'changed' : full ? 'full' : undefined,
114
+ paths,
115
+ configPath,
116
+ cache: !noCache,
117
+ signal: abort.signal,
118
+ eslintConfig,
119
+ failOn,
120
+ browser: url
121
+ ? { url, browsers: browserList?.split(',').map((item) => item.trim()) }
122
+ : undefined,
123
+ });
124
+ const rendered =
125
+ format === 'json'
126
+ ? JSON.stringify(report, null, 2)
127
+ : formatUiDoctorText(report);
128
+ if (output) await writeFile(resolve(root, output), `${rendered}\n`);
129
+ else console.log(rendered);
130
+ process.exitCode = report.exitCode;
131
+ }
119
132
  } catch (error) {
120
133
  console.error(`kerf-ui-doctor: ${error.message}`);
121
134
  process.exitCode =
@@ -0,0 +1,320 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
3
+ import ts from 'typescript';
4
+
5
+ import modes from '../ai/choice-wiring-mode.cjs';
6
+
7
+ const catalog = JSON.parse(
8
+ readFileSync(
9
+ new URL('../ai/component-catalog.json', import.meta.url),
10
+ 'utf8',
11
+ ),
12
+ );
13
+ const supported = catalog.entries.filter((entry) =>
14
+ ['combobox', 'choice-chips'].includes(entry.id),
15
+ );
16
+ const inside = (root, file) => {
17
+ const path = relative(root, file);
18
+ return !isAbsolute(path) && path !== '..' && !path.startsWith('..' + sep);
19
+ };
20
+
21
+ function visit(node, fn) {
22
+ fn(node);
23
+ node.forEachChild((child) => {
24
+ visit(child, fn);
25
+ });
26
+ }
27
+
28
+ function location(root, node) {
29
+ const file = node.getSourceFile();
30
+ const { line, character } = file.getLineAndCharacterOfPosition(
31
+ node.getStart(),
32
+ );
33
+ return `${relative(root, file.fileName).split(sep).join('/')}:${line + 1}:${character + 1}`;
34
+ }
35
+
36
+ // Follow only import/export aliases. A wrapper function with the same name
37
+ // has its own contract. Stopping there is more useful than guessing its props.
38
+ function imported(checker, node) {
39
+ if (ts.isPropertyAccessExpression(node)) {
40
+ const declaration = checker
41
+ .getSymbolAtLocation(node.expression)
42
+ ?.declarations?.find(ts.isNamespaceImport);
43
+ const from = declaration?.parent.parent.moduleSpecifier?.text;
44
+ if (
45
+ from &&
46
+ (from === 'kerfjs' ||
47
+ from === '@kerfjs/ui' ||
48
+ from.startsWith('@kerfjs/ui/'))
49
+ )
50
+ return { from, name: node.name.text };
51
+ }
52
+ let symbol = checker.getSymbolAtLocation(node);
53
+ const seen = new Set();
54
+ while (symbol && !seen.has(symbol)) {
55
+ seen.add(symbol);
56
+ for (const decl of symbol.declarations ?? []) {
57
+ if (!ts.isImportSpecifier(decl) && !ts.isExportSpecifier(decl)) continue;
58
+ const owner = ts.isImportSpecifier(decl)
59
+ ? decl.parent.parent.parent
60
+ : decl.parent.parent;
61
+ const from = owner.moduleSpecifier?.text;
62
+ if (
63
+ from === 'kerfjs' ||
64
+ from === '@kerfjs/ui' ||
65
+ from?.startsWith('@kerfjs/ui/')
66
+ )
67
+ return { from, name: (decl.propertyName ?? decl.name).text };
68
+ }
69
+ if (!(symbol.flags & ts.SymbolFlags.Alias)) break;
70
+ symbol = checker.getImmediateAliasedSymbol(symbol);
71
+ }
72
+ return null;
73
+ }
74
+
75
+ function programFor(root, file) {
76
+ const config = ts.findConfigFile(dirname(file), ts.sys.fileExists);
77
+ if (config && inside(root, config)) {
78
+ const parsed = ts.getParsedCommandLineOfConfigFile(
79
+ config,
80
+ {},
81
+ {
82
+ ...ts.sys,
83
+ onUnRecoverableConfigFileDiagnostic: (d) => {
84
+ throw new Error(ts.flattenDiagnosticMessageText(d.messageText, '\n'));
85
+ },
86
+ },
87
+ );
88
+ if (!parsed) throw new Error('Cannot read the consumer tsconfig.');
89
+ return ts.createProgram(
90
+ [...new Set([...parsed.fileNames, file])],
91
+ parsed.options,
92
+ );
93
+ }
94
+ return ts.createProgram([file], {
95
+ allowJs: true,
96
+ jsx: ts.JsxEmit.Preserve,
97
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
98
+ module: ts.ModuleKind.ESNext,
99
+ target: ts.ScriptTarget.Latest,
100
+ });
101
+ }
102
+
103
+ function selectedTag(source, line, column) {
104
+ const starts = source.getLineStarts();
105
+ if (
106
+ line < 1 ||
107
+ line > starts.length ||
108
+ column < 1 ||
109
+ starts[line - 1] + column - 1 >= (starts[line] ?? source.end + 1)
110
+ )
111
+ throw new Error('The JSX location falls outside the file.');
112
+ const pos = starts[line - 1] + column - 1;
113
+ let target;
114
+ visit(source, (node) => {
115
+ if (
116
+ (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node)) &&
117
+ node.getStart() <= pos &&
118
+ pos < node.end
119
+ )
120
+ target = node;
121
+ });
122
+ if (!target) throw new Error('Choose a position inside a JSX opening tag.');
123
+ return target;
124
+ }
125
+
126
+ function mountRoot(checker, target) {
127
+ for (let node = target.parent; node; node = node.parent) {
128
+ if (
129
+ !ts.isCallExpression(node) ||
130
+ !node.arguments[1] ||
131
+ target.pos < node.arguments[1].pos ||
132
+ target.end > node.arguments[1].end
133
+ )
134
+ continue;
135
+ const api = imported(checker, node.expression);
136
+ if (api?.from === 'kerfjs' && api.name === 'mount')
137
+ return node.arguments[0];
138
+ }
139
+ }
140
+
141
+ function observedCalls(checker, files, root, binding, host) {
142
+ const setups = [];
143
+ const releases = new Map();
144
+ // Gather identifier calls by symbol, so a shadowed disposer name cannot
145
+ // provide false evidence of cleanup. Calls observed in dormant code are
146
+ // still reported only as syntax.
147
+ for (const file of files)
148
+ visit(file, (node) => {
149
+ if (!ts.isCallExpression(node)) return;
150
+ if (ts.isIdentifier(node.expression)) {
151
+ const sym = checker.getSymbolAtLocation(node.expression);
152
+ if (sym) {
153
+ let sites = releases.get(sym);
154
+ if (!sites) releases.set(sym, (sites = []));
155
+ sites.push(location(root, node));
156
+ }
157
+ }
158
+ const api = imported(checker, node.expression);
159
+ if (
160
+ api?.name !== binding.export ||
161
+ ![binding.import, '@kerfjs/ui', binding.componentImport].includes(
162
+ api.from,
163
+ )
164
+ )
165
+ return;
166
+ const arg = node.arguments[0];
167
+ const local =
168
+ ts.isVariableDeclaration(node.parent) &&
169
+ ts.isIdentifier(node.parent.name)
170
+ ? node.parent.name
171
+ : null;
172
+ const same =
173
+ arg &&
174
+ host &&
175
+ ts.isIdentifier(arg) &&
176
+ ts.isIdentifier(host) &&
177
+ checker.getSymbolAtLocation(arg) !== undefined &&
178
+ checker.getSymbolAtLocation(arg) === checker.getSymbolAtLocation(host);
179
+ setups.push({
180
+ site: location(root, node),
181
+ root: arg?.getText() ?? null,
182
+ rootEvidence: same ? 'same binding in source' : 'relationship unknown',
183
+ retention: local
184
+ ? 'assigned'
185
+ : ts.isReturnStatement(node.parent)
186
+ ? 'returned'
187
+ : ts.isExpressionStatement(node.parent)
188
+ ? 'discarded'
189
+ : 'unknown',
190
+ symbol: local && checker.getSymbolAtLocation(local),
191
+ });
192
+ });
193
+ return setups
194
+ .map(({ symbol, ...rest }) => ({
195
+ ...rest,
196
+ cleanupCalls: symbol ? (releases.get(symbol) ?? []) : [],
197
+ }))
198
+ .sort((a, b) => a.site.localeCompare(b.site));
199
+ }
200
+
201
+ export function explainUse(root, position) {
202
+ const match = /^(.+):(\d+):(\d+)$/.exec(position);
203
+ if (!match)
204
+ throw new Error('--explain-use expects file:line:column (one-based).');
205
+ const file = resolve(root, match[1]);
206
+ if (!inside(root, file) || !ts.sys.fileExists(file))
207
+ throw new Error('Select an existing file inside the workspace.');
208
+ const program = programFor(root, file);
209
+ const checker = program.getTypeChecker();
210
+ const use = selectedTag(
211
+ program.getSourceFile(file),
212
+ Number(match[2]),
213
+ Number(match[3]),
214
+ );
215
+ const name = imported(checker, use.tagName);
216
+ const entry = supported.find(
217
+ (e) =>
218
+ e.name === name?.name &&
219
+ [e.delivery.browserImport, '@kerfjs/ui'].includes(name.from),
220
+ );
221
+ const result = {
222
+ schemaVersion: 1,
223
+ location: location(root, use),
224
+ tag: use.tagName.getText(),
225
+ component: entry?.name ?? null,
226
+ };
227
+ if (!entry)
228
+ return {
229
+ ...result,
230
+ unknown: [
231
+ 'Component provenance or wrapper behavior could not be established. Inspect its public contract.',
232
+ ],
233
+ };
234
+ const attrs = modes.tsAttributes(ts, use);
235
+ const { mode, required } =
236
+ entry.id === 'combobox'
237
+ ? { mode: 'free-text suggestions', required: true }
238
+ : modes.choiceMode(attrs);
239
+ const binding = entry.wiring.find((w) => w.required);
240
+ const files = program
241
+ .getSourceFiles()
242
+ .filter(
243
+ (s) =>
244
+ !s.isDeclarationFile &&
245
+ inside(root, s.fileName) &&
246
+ !s.fileName.split(sep).includes('node_modules'),
247
+ );
248
+ const setups = observedCalls(
249
+ checker,
250
+ files,
251
+ root,
252
+ { ...binding, componentImport: entry.delivery.browserImport },
253
+ mountRoot(checker, use),
254
+ );
255
+ const unknown = [];
256
+ if (required === null || mode === 'unknown')
257
+ unknown.push(
258
+ 'Dynamic props can select different interaction modes. Resolve the final multiple and overflow values.',
259
+ );
260
+ if (required !== false && !setups.length)
261
+ unknown.push(
262
+ 'No setup observed in the inspected sources. Check the application entry point.',
263
+ );
264
+ if (setups.length)
265
+ unknown.push(
266
+ 'A call site does not prove execution, root containment or eventual disposal.',
267
+ );
268
+ const action = attrs.findLast(
269
+ ([key]) => key === 'action' || key === '...',
270
+ )?.[1];
271
+ return {
272
+ ...result,
273
+ mode,
274
+ alternatives: mode === 'unknown' ? ['radios', 'checkboxes', 'listbox'] : [],
275
+ required,
276
+ owner: entry.appOwns,
277
+ helper: binding.export,
278
+ behavior: binding.reason,
279
+ event: entry.id === 'combobox' ? 'onCommit' : 'change',
280
+ action: action ?? null,
281
+ setups,
282
+ diagnostics: [
283
+ ...(required === true && !setups.length ? ['KUI-L401'] : []),
284
+ ...(setups.some((s) => s.retention === 'discarded') ? ['KUI-L402'] : []),
285
+ ],
286
+ unknown,
287
+ demo: `?component=${entry.id}`,
288
+ recipe: `@kerfjs/ui/ai/components/${entry.id}.md`,
289
+ signature: `@kerfjs/ui/ai/public-api-signatures-v1.md#kerfjsui${entry.id}`,
290
+ next:
291
+ required === false
292
+ ? 'Use the native input change event.'
293
+ : `At the owning root, retain the disposer returned by ${binding.export} and invoke it when that owner is removed.`,
294
+ };
295
+ }
296
+
297
+ export function formatUse(report) {
298
+ const lines = [`${report.location} <${report.tag}>`];
299
+ if (!report.component) return [...lines, ...report.unknown].join('\n');
300
+ lines.push(
301
+ `Mode: ${report.mode}`,
302
+ `Application owns: ${report.owner.join('; ')}`,
303
+ `Wiring: ${report.helper} (${report.required === null ? 'depends on props' : report.required ? 'required' : 'optional'})`,
304
+ `Event: ${report.event}${report.action ? ' → ' + report.action : ''}`,
305
+ );
306
+ for (const setup of report.setups) {
307
+ lines.push(
308
+ ` ${setup.site} root ${setup.root} (${setup.rootEvidence}); disposer ${setup.retention}`,
309
+ );
310
+ for (const call of setup.cleanupCalls)
311
+ lines.push(` cleanup call: ${call}`);
312
+ }
313
+ lines.push(
314
+ ...report.unknown,
315
+ `${report.diagnostics.join(', ')} ${report.next}`.trim(),
316
+ `Contract: ${report.recipe} · ${report.signature}`,
317
+ `Runnable demo: ${report.demo}`,
318
+ );
319
+ return lines.join('\n');
320
+ }