@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
package/view/validate.mjs DELETED
@@ -1,1649 +0,0 @@
1
- // validateView: checks a Kerf UI view document (kerf-ui-document/v1, see
2
- // docs/26-ui-editor.md) against the component-props and composition
3
- // catalogs. Pure and synchronous, with no Node APIs, so the editor runs it in
4
- // the browser and the CLI runs it in Node. The catalog index, the type
5
- // system, and the `$css` grammar it checks against live in catalog.mjs,
6
- // types.mjs, and css-grammar.mjs.
7
-
8
- import {
9
- channelOf,
10
- fieldParent,
11
- fieldZoneOf,
12
- isBinding,
13
- isObject,
14
- keyOf,
15
- propsOf,
16
- quoteValue,
17
- resolveType,
18
- withFieldZones,
19
- } from './catalog.mjs';
20
- import { childKind } from './child-kind.mjs';
21
- import { CSS_HELPERS, parseCssCall } from './css-grammar.mjs';
22
- import { ICON_NAME, isAssignable, isLiteralOf, literalOf } from './types.mjs';
23
- import { hasTypeExpressions, validTypeExpression } from './type-expression.mjs';
24
-
25
- export const VIEW_DOCUMENT_SCHEMA_ID = 'kerf-ui-document/v1';
26
-
27
- const ULID = /^[0-9A-HJKMNP-TV-Z]{26}$/;
28
- const CAMEL = /^[a-z][A-Za-z0-9]*$/;
29
- const PASCAL = /^[A-Z][A-Za-z0-9]*$/;
30
- const ACTION_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
31
- const ACTION_PROP = /^action$|[a-z]Action$/;
32
- // Loop variable names the generated module already uses.
33
- const RESERVED_NAMES = new Set(['inputs', 'slots', 'each', 'handlers']);
34
- const PARAM_KINDS = new Set([
35
- 'string',
36
- 'number',
37
- 'boolean',
38
- 'enum',
39
- 'literal',
40
- 'content',
41
- 'array',
42
- 'object',
43
- // The exact type of one component prop (KF-H3CB2P: app-supplied values):
44
- // `{ kind: 'prop', component: '@kerfjs/ui:search-field', prop: 'model' }`,
45
- // for values a document cannot spell, such as functions and signals.
46
- 'prop',
47
- ]);
48
-
49
- const only = (value, keys) =>
50
- Object.keys(value).filter((key) => !keys.includes(key));
51
-
52
- // Optional props print as `T | undefined`; messages name the type itself.
53
- function describe(type) {
54
- return (type?.text ?? type?.kind ?? 'unknown').replace(/ \| undefined$/, '');
55
- }
56
-
57
- /** Validates one param or slot-input type in the document's own grammar. */
58
- function validateDeclaredType(ctx, type, path) {
59
- if (type?.typescript !== undefined) {
60
- if (!validTypeExpression(type))
61
- ctx.report(
62
- 'KUI-V001',
63
- path,
64
- 'invalid TypeScript expression or portable import context',
65
- );
66
- return;
67
- }
68
- if (!isObject(type) || !PARAM_KINDS.has(type.kind)) {
69
- ctx.report(
70
- 'KUI-V001',
71
- path,
72
- `type must be one of ${[...PARAM_KINDS].join(', ')}`,
73
- );
74
- return;
75
- }
76
- if (
77
- type.kind === 'enum' &&
78
- !(Array.isArray(type.values) && type.values.length)
79
- ) {
80
- ctx.report(
81
- 'KUI-V001',
82
- path,
83
- 'an enum type needs a non-empty `values` list',
84
- );
85
- }
86
- if (type.kind === 'prop') {
87
- const owner =
88
- typeof type.component === 'string'
89
- ? ctx.catalog.components.get(type.component)?.component
90
- : undefined;
91
- if (!owner?.props.some((prop) => prop.name === type.prop)) {
92
- ctx.report(
93
- 'KUI-V001',
94
- path,
95
- 'a prop type names a catalog `component` key and one of its `prop`s',
96
- );
97
- }
98
- return;
99
- }
100
- if (type.kind === 'array') {
101
- if (!isObject(type.items))
102
- ctx.report('KUI-V001', path, 'an array type needs `items`');
103
- else validateDeclaredType(ctx, type.items, `${path}.items`);
104
- }
105
- if (type.kind === 'object') {
106
- if (!Array.isArray(type.props)) {
107
- ctx.report('KUI-V001', path, 'an object type needs a `props` list');
108
- return;
109
- }
110
- type.props.forEach((prop, index) => {
111
- const at = `${path}.props[${index}]`;
112
- if (
113
- !isObject(prop) ||
114
- typeof prop.name !== 'string' ||
115
- typeof prop.required !== 'boolean'
116
- ) {
117
- ctx.report(
118
- 'KUI-V001',
119
- at,
120
- 'a prop needs `name`, `type`, and `required`',
121
- );
122
- return;
123
- }
124
- validateDeclaredType(ctx, prop.type, `${at}.type`);
125
- });
126
- }
127
- }
128
-
129
- /** Resolves a `$bind` path to its type, or reports why it cannot. */
130
- function bindingType(ctx, path, scope, at) {
131
- if (typeof path !== 'string' || path === '') {
132
- ctx.report('KUI-V007', at, '`$bind` needs a dotted path');
133
- return undefined;
134
- }
135
- const [head, ...rest] = path.split('.');
136
- let type = scope.get(head) ?? ctx.params.get(head)?.type;
137
- if (!type) {
138
- ctx.report(
139
- 'KUI-V007',
140
- at,
141
- `\`$bind\` path "${path}" names nothing in scope`,
142
- );
143
- return undefined;
144
- }
145
- const project = type.typescript;
146
- for (const segment of rest) {
147
- const prop = propsOf(type, {})?.find((item) => item.name === segment);
148
- if (!prop) {
149
- if (project) return { kind: 'unknown', typescript: project };
150
- ctx.report(
151
- 'KUI-V007',
152
- at,
153
- `\`$bind\` path "${path}" has no "${segment}"`,
154
- );
155
- return undefined;
156
- }
157
- type = prop.type;
158
- }
159
- return project ? { ...type, typescript: project } : type;
160
- }
161
-
162
- /**
163
- * The type of a dynamic value (`$param` or `$bind`), `null` for a literal, or
164
- * `undefined` after reporting an unresolvable reference.
165
- */
166
- function dynamicType(ctx, value, scope, at) {
167
- if (!isObject(value)) return null;
168
- if ('$param' in value) {
169
- const param = ctx.params.get(value.$param);
170
- if (!param)
171
- ctx.report(
172
- 'KUI-V007',
173
- at,
174
- `\`$param\` "${value.$param}" is not a document param`,
175
- );
176
- return param?.type;
177
- }
178
- if ('$bind' in value) return bindingType(ctx, value.$bind, scope, at);
179
- return null;
180
- }
181
-
182
- function checkPropValue(ctx, prop, value, definitions, scope, at, rowScoped) {
183
- if (isObject(value) && '$action' in value) {
184
- if (
185
- !ACTION_PROP.test(prop.name) ||
186
- resolveType(prop.type, definitions).kind !== 'string'
187
- ) {
188
- ctx.report(
189
- 'KUI-V009',
190
- at,
191
- `\`$action\` is only valid on an action-name prop, not "${prop.name}"`,
192
- );
193
- } else if (
194
- typeof value.$action !== 'string' ||
195
- !ACTION_NAME.test(value.$action)
196
- ) {
197
- ctx.report('KUI-V001', at, 'an action name is lowercase kebab-case');
198
- } else {
199
- ctx.noteAction(value.$action, rowScoped ? 'row' : 'view', at);
200
- }
201
- return;
202
- }
203
- if (isObject(value) && '$icon' in value) {
204
- if (prop.iconSource !== 'lucide') {
205
- ctx.report(
206
- 'KUI-V013',
207
- at,
208
- `\`$icon\` is only valid on an icon-data prop, not "${prop.name}"`,
209
- );
210
- } else if (
211
- typeof value.$icon !== 'string' ||
212
- !ICON_NAME.test(value.$icon)
213
- ) {
214
- ctx.report(
215
- 'KUI-V013',
216
- at,
217
- 'an icon name is a kebab-case Lucide name such as "inbox"',
218
- );
219
- } else if (ctx.icons && !ctx.icons.has(value.$icon)) {
220
- ctx.report('KUI-V013', at, `unknown Lucide icon "${value.$icon}"`);
221
- }
222
- return;
223
- }
224
- if (isObject(value) && '$css' in value) {
225
- const target = resolveType(prop.type, definitions);
226
- const kinds =
227
- target.kind === 'union'
228
- ? target.members.map((member) => member.kind)
229
- : [target.kind];
230
- if (!kinds.includes('css-value')) {
231
- ctx.report(
232
- 'KUI-V010',
233
- at,
234
- `\`$css\` is only valid on a css-value prop, not "${prop.name}"`,
235
- );
236
- return;
237
- }
238
- const helpers = parseCssCall(value.$css);
239
- const allowed = prop.cssValue?.helpers ?? CSS_HELPERS;
240
- // The catalog's non-standalone helpers (`plus`) may appear nested.
241
- const nested = [...allowed, ...(prop.cssValue?.nonStandaloneHelpers ?? [])];
242
- if (
243
- !helpers ||
244
- !allowed.includes(helpers[0]) ||
245
- !helpers
246
- .slice(1)
247
- .every((name) => nested.includes(name) || CSS_HELPERS.includes(name))
248
- ) {
249
- ctx.report(
250
- 'KUI-V010',
251
- at,
252
- `\`$css\` must be one literal-argument call to ${allowed.join(', ')}`,
253
- );
254
- }
255
- return;
256
- }
257
- const type = dynamicType(ctx, value, scope, at);
258
- if (type === undefined) return;
259
- // A param typed as a component prop binds only to that prop.
260
- if (type?.kind === 'prop') {
261
- // Outside a node's own props (a `#text` value, a `#view` prop, a `$if`
262
- // condition, a `$slot` input) no component prop is being set, so a
263
- // prop-typed value fits nothing there (KF-3624D4). Reading
264
- // `ctx.component` there would name whichever component was checked last.
265
- if (!ctx.inProps) {
266
- ctx.report(
267
- 'KUI-V004',
268
- at,
269
- `a ${type.component} "${type.prop}" value fits only that prop, not "${prop.name}"`,
270
- );
271
- return;
272
- }
273
- if (type.component !== ctx.component || type.prop !== prop.name) {
274
- ctx.report(
275
- 'KUI-V004',
276
- at,
277
- `a ${type.component} "${type.prop}" value does not fit "${prop.name}" of ${ctx.component}`,
278
- );
279
- }
280
- return;
281
- }
282
- if (type === null) {
283
- const hooks = {
284
- slot: (slot) => checkValueSlot(ctx, slot, at),
285
- dynamic: (item, type) =>
286
- nestedDynamicFits(ctx, item, type, definitions, scope, at),
287
- };
288
- if (!literalOf(value, prop.type, definitions, hooks)) {
289
- ctx.report(
290
- 'KUI-V004',
291
- at,
292
- `${quoteValue(value)} is not a valid ${describe(prop.type)}`,
293
- );
294
- }
295
- } else if (!isAssignable(type, prop.type, definitions)) {
296
- ctx.report(
297
- 'KUI-V004',
298
- at,
299
- `a ${describe(type)} value does not fit ${describe(prop.type)}`,
300
- );
301
- }
302
- }
303
-
304
- /**
305
- * A `$param` / `$bind` inside a list or object prop value (KF-3QEZFB: nested
306
- * params): it fits when its type is assignable to that position's type, as a
307
- * whole prop's does. A prop-typed param names a whole component prop, so it
308
- * never fits inside one. Each value object resolves once (an unknown param or
309
- * an out-of-scope path reports once, though a union may try it against
310
- * several members); an unresolved one counts as fitting, so it is not also a
311
- * type mismatch.
312
- */
313
- function nestedDynamicFits(ctx, value, type, definitions, scope, at) {
314
- if (!ctx.nestedDynamics.has(value))
315
- ctx.nestedDynamics.set(value, dynamicType(ctx, value, scope, at));
316
- const found = ctx.nestedDynamics.get(value);
317
- if (found === undefined) return true;
318
- if (found?.kind === 'prop') return false;
319
- return isAssignable(found, type, definitions);
320
- }
321
-
322
- /**
323
- * A `$slot` inside a prop value (KF-SXDM56: item slots): the application
324
- * fills it with content, as a zone's `$slot`, but it passes no input. Each
325
- * slot object reports once, though a union may try it against several
326
- * members. Returns true, so a malformed slot is not also a type mismatch.
327
- */
328
- function checkValueSlot(ctx, slot, at) {
329
- if (ctx.checkedSlots.has(slot)) return true;
330
- ctx.checkedSlots.add(slot);
331
- for (const key of only(slot, ['$slot']))
332
- ctx.report(
333
- 'KUI-V001',
334
- `${at}`,
335
- `a \`$slot\` in a prop value passes no "${key}"`,
336
- );
337
- if (typeof slot.$slot !== 'string' || !CAMEL.test(slot.$slot)) {
338
- ctx.report('KUI-V001', at, 'a slot name is a camelCase identifier');
339
- } else if (ctx.slots.get(slot.$slot)?.input) {
340
- ctx.report(
341
- 'KUI-V001',
342
- at,
343
- `slot "${slot.$slot}" declares an input, which a \`$slot\` in a prop value cannot pass`,
344
- );
345
- }
346
- return true;
347
- }
348
-
349
- /**
350
- * Why a `rootAttributes` key cannot appear in a document (KF-65FTKX: data-*
351
- * only), or undefined. Documents carry lowercase `data-*` names only; the
352
- * node marker and other `data-kerf-*` names, the row key (`data-key`), and
353
- * the editor's `data-editor-*` hooks are reserved for the generated view.
354
- */
355
- export function dataAttributeProblem(key) {
356
- if (!/^data-[a-z0-9]+(?:[-_.][a-z0-9]+)*$/.test(key))
357
- return `"${key}" is not a lowercase data-* attribute name`;
358
- if (/^data-(?:kerf-|editor-|key$)/.test(key))
359
- return `"${key}" is reserved for the generated view and the editor`;
360
- }
361
-
362
- /** A zone key's binding: the composition zone, or a content (`slot`) prop. */
363
- function zonesOf(ctx, component) {
364
- const zones = new Map();
365
- const entry =
366
- component.export && component.key.includes('#')
367
- ? undefined
368
- : ctx.catalog.entries.get(component.key);
369
- for (const zone of entry?.zones ?? []) {
370
- if (zone.jsx?.prop) zones.set(zone.id, { prop: zone.jsx.prop, zone });
371
- }
372
- for (const prop of component.props) {
373
- if (prop.slot) {
374
- zones.set(prop.name, {
375
- prop: prop.name,
376
- text: prop.type.acceptsText === true,
377
- });
378
- }
379
- }
380
- // A Web Awesome element's slots are its zones; its default slot is its
381
- // children, and slotted text is ordinary light-DOM text.
382
- for (const slot of component.slots ?? []) {
383
- zones.set(slot.name, { prop: 'children', slot: slot.name, text: true });
384
- }
385
- for (const binding of zones.values()) {
386
- if (binding.text === undefined) {
387
- const prop = component.props.find((item) => item.name === binding.prop);
388
- binding.text = prop?.type.acceptsText === true;
389
- }
390
- }
391
- return zones;
392
- }
393
-
394
- function variantMatches(variant, present, literals) {
395
- if (!variant.required.every((name) => present.has(name))) return false;
396
- if (variant.forbidden.some((name) => present.has(name))) return false;
397
- return Object.entries(variant.when ?? {}).every(([name, value]) => {
398
- if (!present.has(name)) return value === false || value === undefined;
399
- return !literals.has(name) || literals.get(name) === value;
400
- });
401
- }
402
-
403
- // Callers pass only objects: checkChild classifies non-objects, and root and
404
- // `$each` templates are checked for a `type` before they get here.
405
- function checkNode(ctx, node, at, scope, rowScoped, parentKey, text = false) {
406
- // A scoped run (validate-move.mjs) records where each node is checked:
407
- // these arguments and the enclosing control.
408
- const trace = ctx.trace;
409
- trace?.entries?.set(node, [
410
- at,
411
- scope,
412
- rowScoped,
413
- parentKey,
414
- text,
415
- ctx.interactiveHost,
416
- ]);
417
- ctx.noteId(node.id, at);
418
- if (node.type === '#text') {
419
- for (const key of only(node, ['id', 'type', 'value']))
420
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown field on a text node');
421
- if (!text) {
422
- ctx.report(
423
- 'KUI-V004',
424
- at,
425
- 'this zone does not take plain text; place a text component (such as Text) instead',
426
- );
427
- }
428
- checkPropValue(
429
- ctx,
430
- { name: 'value', type: { kind: 'string' } },
431
- node.value,
432
- {},
433
- scope,
434
- `${at}.value`,
435
- rowScoped,
436
- );
437
- return;
438
- }
439
- if (node.type === '#view') {
440
- for (const key of only(node, ['id', 'type', 'src', 'props']))
441
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown field on a #view node');
442
- checkView(ctx, node, at, scope, rowScoped);
443
- return;
444
- }
445
- for (const key of only(node, ['id', 'type', 'name', 'props', 'zones']))
446
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown node field');
447
- const resolved =
448
- typeof node.type === 'string'
449
- ? ctx.catalog.components.get(node.type)
450
- : undefined;
451
- if (!resolved) {
452
- ctx.report(
453
- 'KUI-V002',
454
- `${at}.type`,
455
- `unknown component type ${JSON.stringify(node.type)}`,
456
- );
457
- return;
458
- }
459
- const { component, definitions } = resolved;
460
- const pkg = keyOf(node.type).slice(0, keyOf(node.type).lastIndexOf(':'));
461
- if (ctx.packages && !ctx.packages.has(pkg)) {
462
- ctx.report(
463
- 'KUI-V002',
464
- `${at}.type`,
465
- `${pkg} is not listed in the document's catalogs`,
466
- );
467
- }
468
- if (node.name !== undefined) {
469
- ctx.noteName(node.name, at);
470
- if (channelOf(component) === 'none') {
471
- ctx.report(
472
- 'KUI-V011',
473
- `${at}.name`,
474
- `${node.type} has no data-* channel for the node marker, so it cannot be named`,
475
- );
476
- }
477
- }
478
- const interactive = interactiveOf(ctx.catalog, node);
479
- if (interactive && ctx.interactiveHost) {
480
- ctx.report(
481
- 'KUI-V014',
482
- at,
483
- `${node.type} renders a control or link, so it cannot sit inside ${ctx.interactiveHost}, which renders one itself`,
484
- );
485
- }
486
- const host = ctx.interactiveHost;
487
- if (interactive === 'root' && !host) ctx.interactiveHost = node.type;
488
- if (trace?.shallow === node) trace.hostAfter = ctx.interactiveHost;
489
- const zones = zonesOf(ctx, component);
490
- // The component whose props are checked next, for a prop-typed param.
491
- ctx.component = node.type;
492
- const byName = new Map(component.props.map((prop) => [prop.name, prop]));
493
- const native = new Set(component.nativeAttributes ?? []);
494
- const present = new Set();
495
- const literals = new Map();
496
- if (node.props !== undefined && !isObject(node.props))
497
- ctx.report('KUI-V001', `${at}.props`, '`props` is an object');
498
- // A field zone fills a content field inside a prop value (KF-PD6QC5), so
499
- // the prop is checked with the zone's placeholder in that field.
500
- const ownProps = isObject(node.props) ? node.props : {};
501
- const ownZones = isObject(node.zones) ? node.zones : {};
502
- const filledProps = withFieldZones(
503
- ownProps,
504
- Object.fromEntries(
505
- Object.entries(ownZones).filter(([, children]) =>
506
- Array.isArray(children),
507
- ),
508
- ),
509
- component,
510
- definitions,
511
- );
512
- ctx.inProps = true;
513
- for (const [name, value] of Object.entries(filledProps)) {
514
- const propAt = `${at}.props.${name}`;
515
- const prop = byName.get(name);
516
- if ([...zones.values()].some((zone) => zone.zone && zone.prop === name)) {
517
- ctx.report(
518
- 'KUI-V003',
519
- propAt,
520
- `"${name}" is a zone; fill it through \`zones\``,
521
- );
522
- continue;
523
- }
524
- if (!prop && !native.has(name)) {
525
- ctx.report('KUI-V003', propAt, `${node.type} has no prop "${name}"`);
526
- continue;
527
- }
528
- present.add(name);
529
- if (!isObject(value) || Array.isArray(value)) literals.set(name, value);
530
- // A literal data-* channel names only unreserved data-* keys (KF-65FTKX).
531
- if (
532
- name === 'rootAttributes' &&
533
- isObject(value) &&
534
- !isBinding(value) &&
535
- Object.keys(value).filter((key) => {
536
- const problem = dataAttributeProblem(key);
537
- if (problem) ctx.report('KUI-V015', `${propAt}.${key}`, problem);
538
- return problem;
539
- }).length
540
- )
541
- continue;
542
- checkPropValue(
543
- ctx,
544
- prop ?? {
545
- name,
546
- type: {
547
- kind: 'union',
548
- members: [
549
- { kind: 'string' },
550
- { kind: 'number' },
551
- { kind: 'boolean' },
552
- ],
553
- },
554
- },
555
- value,
556
- definitions,
557
- scope,
558
- propAt,
559
- rowScoped,
560
- );
561
- }
562
- ctx.inProps = false;
563
- if (node.zones !== undefined && !isObject(node.zones))
564
- ctx.report('KUI-V001', `${at}.zones`, '`zones` is an object');
565
- const shapes = new Map();
566
- for (const [zoneKey, children] of Object.entries(
567
- isObject(node.zones) ? node.zones : {},
568
- )) {
569
- const zoneAt = `${at}.zones.${zoneKey}`;
570
- const field = zones.has(zoneKey)
571
- ? undefined
572
- : fieldZoneOf(component, definitions, zoneKey);
573
- const binding = zones.get(zoneKey) ?? field;
574
- if (!binding) {
575
- ctx.report('KUI-V003', zoneAt, `${node.type} has no zone "${zoneKey}"`);
576
- continue;
577
- }
578
- if (!Array.isArray(children)) {
579
- ctx.report('KUI-V001', zoneAt, 'a zone is a list of children');
580
- continue;
581
- }
582
- if (field) {
583
- const own = ownProps[field.prop];
584
- if (isBinding(own)) {
585
- ctx.report(
586
- 'KUI-V003',
587
- zoneAt,
588
- `"${field.prop}" is bound, so a zone cannot fill "${zoneKey}"`,
589
- );
590
- } else if (
591
- field.path.reduce(
592
- (current, step) =>
593
- current === undefined || current === null
594
- ? undefined
595
- : current[step],
596
- own,
597
- ) !== undefined
598
- ) {
599
- ctx.report(
600
- 'KUI-V003',
601
- zoneAt,
602
- `"${zoneKey}" is set in both \`props\` and \`zones\``,
603
- );
604
- }
605
- } else if (isObject(node.props) && binding.prop in node.props) {
606
- ctx.report(
607
- 'KUI-V003',
608
- zoneAt,
609
- `"${binding.prop}" is set in both \`props\` and \`zones\``,
610
- );
611
- }
612
- // KF-YCM09F: an empty zone list is an explicit null, which a required
613
- // prop of a nullable type (SplitView's `detail` with nothing selected)
614
- // accepts; a zone left out entirely still leaves the prop missing.
615
- if (
616
- children.length > 0 ||
617
- (!field && byName.get(binding.prop)?.type?.nullable === true)
618
- )
619
- present.add(binding.prop);
620
- // A field inside a value another component renders (a view's toolbar
621
- // config) places its children in that component (KF-THTR71).
622
- const parent =
623
- (field && fieldParent(ctx, node, component, definitions, zoneKey)) ||
624
- node.type;
625
- // A shallow run checks the node alone, noting where a child appended to
626
- // `trace.zone` would be checked.
627
- if (trace?.shallow === node) {
628
- if (zoneKey === trace.zone)
629
- trace.child = [
630
- `${zoneAt}[${children.length - 1}]`,
631
- scope,
632
- rowScoped,
633
- parent,
634
- binding.text,
635
- ctx.interactiveHost,
636
- ];
637
- } else
638
- children.forEach((child, index) =>
639
- checkChild(
640
- ctx,
641
- child,
642
- `${zoneAt}[${index}]`,
643
- scope,
644
- rowScoped,
645
- parent,
646
- binding.text,
647
- ),
648
- );
649
- shapes.set(zoneKey, combine(children.map((child) => childShape(child))));
650
- }
651
- ctx.interactiveHost = host;
652
- if (component.variants) {
653
- if (
654
- !component.variants.some((variant) =>
655
- variantMatches(variant, present, literals),
656
- )
657
- ) {
658
- ctx.report(
659
- 'KUI-V004',
660
- at,
661
- `${node.type} props match none of its variants`,
662
- );
663
- }
664
- } else {
665
- for (const prop of component.props) {
666
- if (prop.required && !prop.variantOnly && !present.has(prop.name)) {
667
- ctx.report('KUI-V005', at, `${node.type} requires "${prop.name}"`);
668
- }
669
- }
670
- }
671
- checkComposition(ctx, node, at, parentKey, shapes, literals, zones);
672
- }
673
-
674
- /**
675
- * An `$each` template: one keyable node, or (KF-8J8E5V: per-item row
676
- * designs) an `$if` chain whose every branch is one. `else` is required, so
677
- * each item yields exactly one row and a repeat never filters.
678
- */
679
- function checkTemplate(
680
- ctx,
681
- template,
682
- at,
683
- scope,
684
- parentKey,
685
- text,
686
- chain = true,
687
- ) {
688
- // A chain nests only in `else`; `then` is always one node.
689
- if (chain && isObject(template) && '$if' in template) {
690
- for (const key of only(template, ['$if', 'then', 'else']))
691
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown `$if` field');
692
- checkPropValue(
693
- ctx,
694
- { name: 'condition', type: { kind: 'boolean' } },
695
- template.$if,
696
- {},
697
- scope,
698
- `${at}.$if`,
699
- true,
700
- );
701
- checkTemplate(
702
- ctx,
703
- template.then,
704
- `${at}.then`,
705
- scope,
706
- parentKey,
707
- text,
708
- false,
709
- );
710
- if ('else' in template)
711
- checkTemplate(ctx, template.else, `${at}.else`, scope, parentKey, text);
712
- else
713
- ctx.report(
714
- 'KUI-V008',
715
- at,
716
- 'a template `$if` needs an `else`, so every item yields exactly one row',
717
- );
718
- return;
719
- }
720
- if (!isObject(template) || !('type' in template)) {
721
- ctx.report(
722
- 'KUI-V008',
723
- at,
724
- 'the template is exactly one node, or an `$if` chain of them',
725
- );
726
- return;
727
- }
728
- const entry = ctx.catalog.components.get(template.type);
729
- if (entry && channelOf(entry.component) === 'none') {
730
- ctx.report(
731
- 'KUI-V008',
732
- at,
733
- `${template.type} has no data-* channel to carry the row key`,
734
- );
735
- }
736
- checkNode(ctx, template, at, scope, true, parentKey, text);
737
- }
738
-
739
- /**
740
- * An `$each`'s rows: exactly one of `template` (one node or an `$if` chain)
741
- * and `templates`, a map of one node per item kind picked by `kind`
742
- * (KF-YX6HMT: keyed row designs). `templates` needs a `default`, which an
743
- * item of any other kind takes, so every item yields exactly one row.
744
- */
745
- function checkRows(ctx, child, at, scope, parentKey, text) {
746
- if (!('templates' in child)) {
747
- if ('kind' in child)
748
- ctx.report(
749
- 'KUI-V008',
750
- `${at}.kind`,
751
- '`kind` picks one of `templates`; this `$each` has none',
752
- );
753
- checkTemplate(
754
- ctx,
755
- child.template,
756
- `${at}.template`,
757
- scope,
758
- parentKey,
759
- text,
760
- );
761
- return;
762
- }
763
- if ('template' in child)
764
- ctx.report(
765
- 'KUI-V008',
766
- at,
767
- 'an `$each` has exactly one of `template` and `templates`',
768
- );
769
- const templates = isObject(child.templates) ? child.templates : {};
770
- if (!('default' in templates))
771
- ctx.report(
772
- 'KUI-V008',
773
- `${at}.templates`,
774
- '`templates` needs a `default` row design, which an item of any other kind takes',
775
- );
776
- if ('kind' in child)
777
- checkPropValue(
778
- ctx,
779
- { name: 'kind', type: { kind: 'string' } },
780
- child.kind,
781
- {},
782
- scope,
783
- `${at}.kind`,
784
- true,
785
- );
786
- else
787
- ctx.report(
788
- 'KUI-V008',
789
- `${at}.kind`,
790
- '`templates` needs a `kind` that resolves to a string on the item',
791
- );
792
- for (const [kind, template] of Object.entries(templates)) {
793
- const path = `${at}.templates.${kind}`;
794
- if (!isObject(template) || !('type' in template))
795
- ctx.report(
796
- 'KUI-V008',
797
- path,
798
- 'each `templates` entry is exactly one node',
799
- );
800
- else checkTemplate(ctx, template, path, scope, parentKey, text, false);
801
- }
802
- }
803
-
804
- /**
805
- * The templates an `$each` can render a row from: its `template`, or every
806
- * entry of its `templates` map in order (KF-YX6HMT). Each is one node or an
807
- * `$if` chain of them.
808
- */
809
- export function eachTemplates(each) {
810
- if (!('templates' in each)) return [each.template];
811
- // A malformed map is one malformed template, so walkers report it.
812
- return isObject(each.templates)
813
- ? Object.values(each.templates)
814
- : [each.templates];
815
- }
816
-
817
- /** Every node an `$each` can render a row from, in order; the first keys it. */
818
- export function eachNodes(each) {
819
- return eachTemplates(each).flatMap(templateNodes);
820
- }
821
-
822
- /**
823
- * The nodes an `$each` template can render, in branch order: the template
824
- * itself, or every leaf of its `$if` chain.
825
- */
826
- export function templateNodes(template) {
827
- if (isObject(template) && '$if' in template)
828
- return [
829
- ...templateNodes(template.then),
830
- ...('else' in template ? templateNodes(template.else) : []),
831
- ];
832
- return isObject(template) ? [template] : [];
833
- }
834
-
835
- function checkChild(ctx, child, at, scope, rowScoped, parentKey, text = false) {
836
- if (!isObject(child)) {
837
- ctx.report('KUI-V001', at, 'a zone child is an object');
838
- return;
839
- }
840
- switch (childKind(child)) {
841
- case 'each':
842
- return checkEach(ctx, child, at, scope, rowScoped, parentKey, text);
843
- case 'if':
844
- return checkIf(ctx, child, at, scope, rowScoped, parentKey, text);
845
- case 'slot':
846
- return checkSlot(ctx, child, at, scope, rowScoped);
847
- default:
848
- return checkNode(ctx, child, at, scope, rowScoped, parentKey, text);
849
- }
850
- }
851
-
852
- /** Checks an `$each` child: its fields, source list, key, and rows. */
853
- function checkEach(ctx, child, at, scope, rowScoped, parentKey, text) {
854
- for (const key of only(child, [
855
- '$each',
856
- 'as',
857
- 'key',
858
- 'template',
859
- 'templates',
860
- 'kind',
861
- ]))
862
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown `$each` field');
863
- // KF-CFA1S1: an inner `$each` in this document renders as a plain map, but
864
- // a document composed into another's row cannot know it is in one: its
865
- // module renders a keyed each(), which kerf refuses inside a row render.
866
- if (ctx.rowHost && !rowScoped) {
867
- ctx.report(
868
- 'KUI-V016',
869
- at,
870
- 'a document composed into an `$each` row cannot repeat; move the `$each` into the composing document',
871
- );
872
- }
873
- const source = dynamicType(ctx, child.$each, scope, `${at}.$each`);
874
- const list = source ? resolveType(source, {}) : undefined;
875
- if (source === null)
876
- ctx.report(
877
- 'KUI-V008',
878
- `${at}.$each`,
879
- '`$each` iterates a `$param` or `$bind`, not a literal',
880
- );
881
- else if (list && list.kind !== 'array')
882
- ctx.report(
883
- 'KUI-V008',
884
- `${at}.$each`,
885
- `\`$each\` needs an array, not ${describe(list)}`,
886
- );
887
- // kerf's each() keys rows by item identity, so items are objects.
888
- else if (
889
- list &&
890
- !['object', 'unknown', 'record'].includes(resolveType(list.items, {}).kind)
891
- ) {
892
- ctx.report(
893
- 'KUI-V008',
894
- `${at}.$each`,
895
- '`$each` items are objects (each() keys rows by item identity)',
896
- );
897
- }
898
- if (
899
- typeof child.as !== 'string' ||
900
- !CAMEL.test(child.as) ||
901
- RESERVED_NAMES.has(child.as) ||
902
- ctx.params.has(child.as) ||
903
- scope.has(child.as)
904
- ) {
905
- ctx.report(
906
- 'KUI-V008',
907
- `${at}.as`,
908
- '`as` names the item with a camelCase identifier that is not reserved, a param, or an outer item',
909
- );
910
- return;
911
- }
912
- const inner = new Map(scope).set(
913
- child.as,
914
- list?.kind === 'array' ? list.items : { kind: 'unknown' },
915
- );
916
- const keyType =
917
- typeof child.key === 'string' && child.key.split('.')[0] === child.as
918
- ? bindingType(ctx, child.key, inner, `${at}.key`)
919
- : undefined;
920
- const keyKind = keyType && resolveType(keyType, {}).kind;
921
- if (!keyType || !['string', 'number', 'unknown'].includes(keyKind)) {
922
- ctx.report(
923
- 'KUI-V008',
924
- `${at}.key`,
925
- '`key` is a path on the item that resolves to a string or number',
926
- );
927
- }
928
- checkRows(ctx, child, at, inner, parentKey, text);
929
- }
930
-
931
- /** Checks an `$if` child: its condition and both branches. */
932
- function checkIf(ctx, child, at, scope, rowScoped, parentKey, text) {
933
- for (const key of only(child, ['$if', 'then', 'else']))
934
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown `$if` field');
935
- checkPropValue(
936
- ctx,
937
- { name: 'condition', type: { kind: 'boolean' } },
938
- child.$if,
939
- {},
940
- scope,
941
- `${at}.$if`,
942
- rowScoped,
943
- );
944
- checkChild(ctx, child.then, `${at}.then`, scope, rowScoped, parentKey, text);
945
- if ('else' in child)
946
- checkChild(
947
- ctx,
948
- child.else,
949
- `${at}.else`,
950
- scope,
951
- rowScoped,
952
- parentKey,
953
- text,
954
- );
955
- }
956
-
957
- /** Checks a `$slot` child: its name and the input it passes. */
958
- function checkSlot(ctx, child, at, scope, rowScoped) {
959
- for (const key of only(child, ['$slot', 'input']))
960
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown `$slot` field');
961
- if (typeof child.$slot !== 'string' || !CAMEL.test(child.$slot)) {
962
- ctx.report(
963
- 'KUI-V001',
964
- `${at}.$slot`,
965
- 'a slot name is a camelCase identifier',
966
- );
967
- return;
968
- }
969
- const declared = ctx.slots.get(child.$slot);
970
- const props = declared?.input?.props ?? [];
971
- if (child.input !== undefined && !declared?.input) {
972
- ctx.report(
973
- 'KUI-V001',
974
- `${at}.input`,
975
- `slot "${child.$slot}" declares no input`,
976
- );
977
- return;
978
- }
979
- const given = isObject(child.input) ? child.input : {};
980
- for (const prop of props) {
981
- if (!(prop.name in given)) {
982
- if (prop.required)
983
- ctx.report(
984
- 'KUI-V005',
985
- `${at}.input`,
986
- `slot "${child.$slot}" requires input "${prop.name}"`,
987
- );
988
- continue;
989
- }
990
- checkPropValue(
991
- ctx,
992
- prop,
993
- given[prop.name],
994
- {},
995
- scope,
996
- `${at}.input.${prop.name}`,
997
- rowScoped,
998
- );
999
- }
1000
- for (const name of Object.keys(given)) {
1001
- if (!props.some((prop) => prop.name === name))
1002
- ctx.report(
1003
- 'KUI-V003',
1004
- `${at}.input.${name}`,
1005
- `slot "${child.$slot}" has no input "${name}"`,
1006
- );
1007
- }
1008
- }
1009
-
1010
- /**
1011
- * KF-3X7MFF: where a `#view`'s `src` points, relative to the top document's
1012
- * folder, from the composing document at `from` (undefined for the top
1013
- * document): `src` resolves from the folder of the document that contains it,
1014
- * as each generated module imports its children. A posix path with `.`
1015
- * segments removed and `..` folded; it may start with `../` (or `/`).
1016
- */
1017
- export function composedViewPath(from, src) {
1018
- const parts = from === undefined ? [] : from.split('/').slice(0, -1);
1019
- if (src.startsWith('/')) parts.length = 0;
1020
- for (const part of src.split('/')) {
1021
- if (part === '' || part === '.') continue;
1022
- if (part !== '..') parts.push(part);
1023
- // `..` folds a folder; above the root (`/`) it stays at the root.
1024
- else if (parts.length && parts.at(-1) !== '..') {
1025
- if (parts.at(-1) !== '') parts.pop();
1026
- } else parts.push(part);
1027
- }
1028
- return `${src.startsWith('/') ? '/' : ''}${parts.join('/')}`;
1029
- }
1030
-
1031
- function checkView(ctx, node, at, scope, rowScoped) {
1032
- if (typeof node.src !== 'string' || node.src === '') {
1033
- ctx.report(
1034
- 'KUI-V012',
1035
- `${at}.src`,
1036
- 'a #view node names its document in `src`',
1037
- );
1038
- return;
1039
- }
1040
- if (!ctx.resolveView) return;
1041
- // Cycles compare where sources point, not their text: the same `src` in
1042
- // two folders names two documents.
1043
- const path = composedViewPath(ctx.viewPath, node.src);
1044
- if (ctx.viewStack.includes(path)) {
1045
- ctx.report('KUI-V012', `${at}.src`, `#view "${node.src}" is cyclic`);
1046
- return;
1047
- }
1048
- const child = ctx.resolveView(node.src, path);
1049
- if (!isObject(child)) {
1050
- ctx.report('KUI-V012', `${at}.src`, `#view "${node.src}" was not found`);
1051
- return;
1052
- }
1053
- if (isObject(child.slots) && Object.keys(child.slots).length > 0) {
1054
- ctx.report(
1055
- 'KUI-V012',
1056
- `${at}.src`,
1057
- `#view "${node.src}" declares slots, which a composing document cannot fill`,
1058
- );
1059
- }
1060
- const params = isObject(child.params) ? child.params : {};
1061
- const given = isObject(node.props) ? node.props : {};
1062
- for (const [name, value] of Object.entries(given)) {
1063
- if (!isObject(params[name])) {
1064
- ctx.report(
1065
- 'KUI-V012',
1066
- `${at}.props.${name}`,
1067
- `#view "${node.src}" has no param "${name}"`,
1068
- );
1069
- continue;
1070
- }
1071
- checkPropValue(
1072
- ctx,
1073
- { name, type: params[name].type },
1074
- value,
1075
- {},
1076
- scope,
1077
- `${at}.props.${name}`,
1078
- rowScoped,
1079
- );
1080
- }
1081
- for (const [name, param] of Object.entries(params)) {
1082
- if (
1083
- isObject(param) &&
1084
- !('default' in param) &&
1085
- param.optional !== true &&
1086
- !(name in given)
1087
- ) {
1088
- ctx.report(
1089
- 'KUI-V012',
1090
- at,
1091
- `#view "${node.src}" requires param "${name}"`,
1092
- );
1093
- }
1094
- }
1095
- const nested = validateView(child, ctx.catalog, {
1096
- resolveView: ctx.resolveView,
1097
- icons: ctx.icons,
1098
- viewStack: [...ctx.viewStack, path],
1099
- viewPath: path,
1100
- // A composed document inside a control renders inside it too.
1101
- interactiveHost: ctx.interactiveHost,
1102
- // ... and one inside a row renders inside that row.
1103
- rowHost: ctx.rowHost || rowScoped,
1104
- });
1105
- for (const diagnostic of nested.diagnostics) {
1106
- ctx.report(
1107
- diagnostic.code,
1108
- `${at}{${node.src}}${diagnostic.path.slice(1)}`,
1109
- diagnostic.message,
1110
- );
1111
- }
1112
- // KF-RDZ7N7: a document composed into a row renders inside that keyed row,
1113
- // and the generated row passes its key to the composed root, so a delegated
1114
- // handler reads the row key there. Its actions are row actions of the
1115
- // composing document; its own contract keeps them view-scoped, since
1116
- // standalone it has no row.
1117
- for (const [name, actionScope] of nested.actions)
1118
- ctx.noteAction(name, rowScoped ? 'row' : actionScope, at);
1119
- }
1120
-
1121
- // Zone shapes, as the ESLint rule computes them over JSX: how many direct
1122
- // children a zone can hold at least and at most, and which ones.
1123
- const shape = (min, max, items) => ({ min, max, items });
1124
- function combine(shapes) {
1125
- return shapes.reduce(
1126
- (total, item) =>
1127
- shape(total.min + item.min, total.max + item.max, [
1128
- ...total.items,
1129
- ...item.items,
1130
- ]),
1131
- shape(0, 0, []),
1132
- );
1133
- }
1134
- function childShape(child) {
1135
- if (!isObject(child)) return shape(0, 0, []);
1136
- switch (childKind(child)) {
1137
- case 'each': {
1138
- const items = eachTemplates(child).flatMap((template) =>
1139
- isObject(template) ? childShape(template).items : [],
1140
- );
1141
- return shape(0, Number.POSITIVE_INFINITY, items);
1142
- }
1143
- case 'if': {
1144
- const then = childShape(child.then);
1145
- const otherwise =
1146
- 'else' in child ? childShape(child.else) : shape(0, 0, []);
1147
- return shape(
1148
- Math.min(then.min, otherwise.min),
1149
- Math.max(then.max, otherwise.max),
1150
- [...then.items, ...otherwise.items],
1151
- );
1152
- }
1153
- case 'slot':
1154
- case 'view':
1155
- return shape(1, 1, []);
1156
- default:
1157
- if (child.type === '#text') return shape(1, 1, [{ label: 'text' }]);
1158
- return shape(1, 1, [{ node: child }]);
1159
- }
1160
- }
1161
-
1162
- // Interactive content (HTML's button, a, input, label, and so on) cannot hold
1163
- // more of it: the parser splits the host and the row contract breaks. An
1164
- // entry's `content.interactive` rules say whether a node renders a control as
1165
- // its root or inside it; `content.exports` does the same per JSX export.
1166
- function interactiveOf(catalog, node) {
1167
- const [base, exportName] = node.type.split('#');
1168
- const content = catalog.entries.get(base)?.content;
1169
- const rules = exportName
1170
- ? content?.exports?.[exportName]?.interactive
1171
- : content?.interactive;
1172
- const props = isObject(node.props) ? node.props : {};
1173
- const applies = (rule) =>
1174
- !rule.whenProps ||
1175
- rule.whenProps.some((name) => props[name] != null && props[name] !== false);
1176
- const matched = (rules ?? []).filter(applies).map((rule) => rule.kind);
1177
- return matched.includes('root') ? 'root' : matched[0];
1178
- }
1179
-
1180
- const conditionLabel = ({ prop, equals }) =>
1181
- `\`${prop}=${JSON.stringify(equals)}\``;
1182
-
1183
- function bringsInset(entry, node) {
1184
- const geometry = entry?.layout?.geometry;
1185
- if (
1186
- !geometry ||
1187
- !['margin', 'border', 'padding'].every((side) => geometry[side] === 'self')
1188
- )
1189
- return false;
1190
- const props = isObject(node.props) ? node.props : {};
1191
- return !(entry.insetFreeWhen ?? []).some((condition) => {
1192
- const value = props[condition.prop];
1193
- const known = !isObject(value);
1194
- return !known || value === condition.equals;
1195
- });
1196
- }
1197
-
1198
- function checkComposition(
1199
- ctx,
1200
- node,
1201
- at,
1202
- parentKey,
1203
- shapes,
1204
- literals,
1205
- bindings,
1206
- ) {
1207
- const [base, exportName] = node.type.split('#');
1208
- const entry = ctx.catalog.entries.get(base);
1209
- if (!entry) return;
1210
- const exportContract = exportName
1211
- ? entry.jsxExports?.[exportName]
1212
- : undefined;
1213
- const rootsOf = (key) => ctx.catalog.entries.get(key)?.rendersAs ?? [key];
1214
- const parents = exportName ? exportContract?.parents : entry.parents;
1215
- if (parents?.mode === 'listed' && parentKey) {
1216
- const parentRoots = rootsOf(keyOf(parentKey));
1217
- if (!parentRoots.every((root) => parents.entries.includes(root))) {
1218
- ctx.report(
1219
- 'KUI-L201',
1220
- at,
1221
- `\`${node.type}\` requires one of these cataloged parents: ${parents.entries.join(', ')}`,
1222
- );
1223
- }
1224
- }
1225
- if (exportName) return;
1226
- const insetCondition = (entry.insetFreeChildren ?? []).find(
1227
- (condition) =>
1228
- literals.has(condition.prop) &&
1229
- literals.get(condition.prop) === condition.equals,
1230
- );
1231
- for (const zone of entry.zones ?? []) {
1232
- if (!zone.jsx?.prop) continue;
1233
- const found = shapes.get(zone.id) ?? shape(0, 0, []);
1234
- const allowed = new Set(
1235
- zone.accepts
1236
- .map((accepted) =>
1237
- accepted.includes(':') ? accepted : `${entry.package}:${accepted}`,
1238
- )
1239
- .filter((accepted) => ctx.catalog.entries.has(accepted)),
1240
- );
1241
- if (allowed.size) {
1242
- for (const item of found.items) {
1243
- const key = item.node
1244
- ? item.node.type.includes('#')
1245
- ? item.node.type.replace('#', ':')
1246
- : item.node.type
1247
- : undefined;
1248
- const roots = key ? rootsOf(key) : [];
1249
- if (!key || !roots.every((root) => allowed.has(root))) {
1250
- ctx.report(
1251
- 'KUI-L202',
1252
- `${at}.zones.${zone.id}`,
1253
- `\`${node.type}\` zone \`${zone.id}\` does not accept ${key ?? item.label}; catalog accepts: ${[...allowed].join(', ')}`,
1254
- );
1255
- }
1256
- }
1257
- }
1258
- const { min, max } = zone.cardinality;
1259
- if (found.max < min || (max !== 'unbounded' && found.min > max)) {
1260
- ctx.report(
1261
- 'KUI-L203',
1262
- `${at}.zones.${zone.id}`,
1263
- `\`${node.type}\` zone \`${zone.id}\` requires ${min}..${max} direct children; found ${found.max < min ? found.max : found.min}`,
1264
- );
1265
- }
1266
- }
1267
- // The inset rule reads the children region, whether the catalog binds it
1268
- // as a zone or the component exposes it as a content prop.
1269
- const childrenKey = [...bindings].find(
1270
- ([, binding]) => binding.prop === 'children',
1271
- )?.[0];
1272
- const children = childrenKey ? shapes.get(childrenKey) : undefined;
1273
- if (!insetCondition || !children) return;
1274
- for (const item of children.items) {
1275
- const childEntry = item.node && ctx.catalog.entries.get(item.node.type);
1276
- if (!childEntry || !bringsInset(childEntry, item.node)) continue;
1277
- const fix = childEntry.insetFreeWhen?.length
1278
- ? `set ${childEntry.insetFreeWhen.map(conditionLabel).join(' or ')}`
1279
- : 'use an inset-free child';
1280
- ctx.report(
1281
- 'KUI-L204',
1282
- `${at}.zones.${childrenKey}`,
1283
- `\`${item.node.type}\` brings its own content-item inset into \`${node.type}\` with ${conditionLabel(insetCondition)}, which expects inset-free content; ${fix}`,
1284
- );
1285
- }
1286
- }
1287
-
1288
- /**
1289
- * Kerf UI's whole-screen layouts: each fills its parent's height and has no
1290
- * height of its own, so below the root it collapses to its bar unless a
1291
- * SizedRegion or another of these layouts gives it a height (KF-KQ72TW).
1292
- */
1293
- const SCREEN_LAYOUTS = new Set([
1294
- '@kerfjs/ui:nav-stack',
1295
- '@kerfjs/ui:split-view',
1296
- '@kerfjs/ui:tab-navigator',
1297
- '@kerfjs/ui:workbench',
1298
- ]);
1299
- const SIZED_REGION = '@kerfjs/ui:sized-region';
1300
-
1301
- const PANE = '@kerfjs/ui:pane';
1302
-
1303
- /**
1304
- * Whether `node`'s `zone` gives a child a definite height. A SizedRegion or
1305
- * another whole-screen layout always does. A Pane with a literal `fill: true`
1306
- * gives its `content` zone one when the Pane itself sits in a sized place (the
1307
- * root, inside a SizedRegion or layout), since its rows then have a height
1308
- * (KF-AMEZB3: a filled root Pane sizes a nested layout).
1309
- */
1310
- function zoneSizes(node, zone, sized) {
1311
- if (node.type === SIZED_REGION || SCREEN_LAYOUTS.has(node.type)) return true;
1312
- return (
1313
- sized &&
1314
- node.type === PANE &&
1315
- zone === 'content' &&
1316
- isObject(node.props) &&
1317
- node.props.fill === true
1318
- );
1319
- }
1320
-
1321
- /**
1322
- * `KUI-H001` hints (non-blocking): a whole-screen layout below the root whose
1323
- * place has no definite height: its parent is not a SizedRegion, another
1324
- * whole-screen layout, or a filled Pane's content in a sized place. `sized`
1325
- * is whether `node` itself sits in a place with a definite height.
1326
- */
1327
- function hintUnsizedLayouts(node, at, sized, hints, isRoot = false) {
1328
- if (!isObject(node) || typeof node.type !== 'string') return;
1329
- if (!isRoot && !sized && SCREEN_LAYOUTS.has(node.type))
1330
- hints.push({
1331
- code: 'KUI-H001',
1332
- path: at,
1333
- message: `${node.type} has no height of its own here and collapses to its bar; wrap it in ${SIZED_REGION}`,
1334
- });
1335
- const child = (item, path, childSized) => {
1336
- if (!isObject(item)) return;
1337
- switch (childKind(item)) {
1338
- case 'each':
1339
- if ('templates' in item)
1340
- for (const [kind, template] of Object.entries(
1341
- isObject(item.templates) ? item.templates : {},
1342
- ))
1343
- child(template, `${path}.templates.${kind}`, childSized);
1344
- else child(item.template, `${path}.template`, childSized);
1345
- break;
1346
- case 'if':
1347
- child(item.then, `${path}.then`, childSized);
1348
- if ('else' in item) child(item.else, `${path}.else`, childSized);
1349
- break;
1350
- default:
1351
- hintUnsizedLayouts(item, path, childSized, hints);
1352
- }
1353
- };
1354
- for (const [zone, children] of Object.entries(
1355
- isObject(node.zones) ? node.zones : {},
1356
- )) {
1357
- const childSized = zoneSizes(node, zone, sized);
1358
- if (Array.isArray(children))
1359
- children.forEach((item, index) =>
1360
- child(item, `${at}.zones.${zone}[${index}]`, childSized),
1361
- );
1362
- }
1363
- }
1364
-
1365
- /**
1366
- * Validates a view document. Returns `{ valid, diagnostics, hints, actions }`,
1367
- * where each diagnostic is `{ code, path, message }` (a `KUI-V###` document id
1368
- * or a `KUI-L201`–`L204` composition id) and `actions` maps each action name
1369
- * to its `row` or `view` scope. `hints` are non-blocking `KUI-H###` advice
1370
- * about a valid document (a nested layout with no height); they never make it
1371
- * invalid. `options.resolveView(src, path)` loads a composed document, where
1372
- * `path` is where `src` points relative to the top document's folder (each
1373
- * `src` resolves from the document that contains it); without it, `#view`
1374
- * nodes are checked for shape only.
1375
- */
1376
- export function validateView(document, catalog, options = {}) {
1377
- return runView(document, catalog, options);
1378
- }
1379
-
1380
- /**
1381
- * A validation context: the options, a diagnostics sink, and the id, name,
1382
- * and action tables. A `trace` marks a scoped run (validate-move.mjs): it
1383
- * records each action use, and a `quiet` one leaves conflicts to its caller.
1384
- */
1385
- function createContext(catalog, options, trace) {
1386
- const diagnostics = [];
1387
- const ids = new Map();
1388
- const names = new Map();
1389
- const actions = new Map();
1390
- const ctx = {
1391
- catalog,
1392
- diagnostics,
1393
- actions,
1394
- trace,
1395
- resolveView: options.resolveView,
1396
- icons: options.icons ? new Set(options.icons) : undefined,
1397
- viewStack: options.viewStack ?? [],
1398
- viewPath: options.viewPath,
1399
- params: new Map(),
1400
- slots: new Map(),
1401
- checkedSlots: new WeakSet(),
1402
- nestedDynamics: new WeakMap(),
1403
- packages: undefined,
1404
- interactiveHost: options.interactiveHost,
1405
- rowHost: options.rowHost === true,
1406
- report(code, path, message) {
1407
- diagnostics.push({ code, path, message });
1408
- },
1409
- noteId(id, at) {
1410
- if (typeof id !== 'string' || !ULID.test(id)) {
1411
- ctx.report('KUI-V006', `${at}.id`, 'a node id is a 26-character ULID');
1412
- } else if (ids.has(id)) {
1413
- ctx.report(
1414
- 'KUI-V006',
1415
- `${at}.id`,
1416
- `duplicate node id ${id} (first at ${ids.get(id)})`,
1417
- );
1418
- } else ids.set(id, at);
1419
- },
1420
- noteName(name, at) {
1421
- if (typeof name !== 'string' || !CAMEL.test(name)) {
1422
- ctx.report(
1423
- 'KUI-V006',
1424
- `${at}.name`,
1425
- 'a node name is a camelCase identifier',
1426
- );
1427
- } else if (names.has(name)) {
1428
- ctx.report(
1429
- 'KUI-V006',
1430
- `${at}.name`,
1431
- `duplicate node name "${name}" (first at ${names.get(name)})`,
1432
- );
1433
- } else names.set(name, at);
1434
- },
1435
- noteAction(name, scope, at) {
1436
- if (trace) {
1437
- trace.notes.push([name, scope]);
1438
- if (trace.quiet) return;
1439
- }
1440
- const seen = actions.get(name);
1441
- if (seen && seen !== scope) {
1442
- ctx.report(
1443
- 'KUI-V009',
1444
- at,
1445
- `action "${name}" is used with both row and view scope`,
1446
- );
1447
- } else actions.set(name, scope);
1448
- },
1449
- };
1450
- return ctx;
1451
- }
1452
-
1453
- /**
1454
- * Checks a document's own fields, params, and slots into `ctx`, which then
1455
- * knows them. False when the document is not an object.
1456
- */
1457
- function checkHeader(ctx, document) {
1458
- if (!isObject(document)) {
1459
- ctx.report('KUI-V001', '$', 'a view document is a JSON object');
1460
- return false;
1461
- }
1462
- for (const key of only(document, [
1463
- '$schema',
1464
- 'schema',
1465
- 'name',
1466
- 'catalogs',
1467
- 'params',
1468
- 'slots',
1469
- 'root',
1470
- ])) {
1471
- ctx.report('KUI-V001', `$.${key}`, 'unknown top-level field');
1472
- }
1473
- if (document.schema !== VIEW_DOCUMENT_SCHEMA_ID) {
1474
- ctx.report(
1475
- 'KUI-V001',
1476
- '$.schema',
1477
- `schema must be "${VIEW_DOCUMENT_SCHEMA_ID}"`,
1478
- );
1479
- }
1480
- if (typeof document.name !== 'string' || !PASCAL.test(document.name)) {
1481
- ctx.report('KUI-V001', '$.name', 'name is a PascalCase identifier');
1482
- }
1483
- if (
1484
- !Array.isArray(document.catalogs) ||
1485
- document.catalogs.some((item) => typeof item !== 'string')
1486
- ) {
1487
- ctx.report(
1488
- 'KUI-V001',
1489
- '$.catalogs',
1490
- 'catalogs is a list of package names or catalog paths',
1491
- );
1492
- } else {
1493
- // Only package names can be checked here; a path's package is the caller's
1494
- // to resolve, so a document naming any path skips the package check.
1495
- const pathLike = document.catalogs.some(
1496
- (item) => item.startsWith('.') || item.startsWith('/'),
1497
- );
1498
- if (!pathLike) ctx.packages = new Set(document.catalogs);
1499
- }
1500
- for (const [name, param] of Object.entries(
1501
- isObject(document.params) ? document.params : {},
1502
- )) {
1503
- const at = `$.params.${name}`;
1504
- if (!CAMEL.test(name) || !isObject(param)) {
1505
- ctx.report(
1506
- 'KUI-V001',
1507
- at,
1508
- 'a param is a camelCase name mapped to `{ type, default?, optional? }`',
1509
- );
1510
- continue;
1511
- }
1512
- for (const key of only(param, [
1513
- 'type',
1514
- 'default',
1515
- 'optional',
1516
- 'description',
1517
- ]))
1518
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown param field');
1519
- // KF-JE8KHX: `optional: true` makes an input optional with no default,
1520
- // so an omitted value reads as absent (an optional item field extracted
1521
- // into a row document).
1522
- if ('optional' in param && (param.optional !== true || 'default' in param))
1523
- ctx.report(
1524
- 'KUI-V001',
1525
- `${at}.optional`,
1526
- 'optional is `true`, on a param with no default (a default already makes it optional)',
1527
- );
1528
- validateDeclaredType(ctx, param.type, `${at}.type`);
1529
- // A prop-typed param's default is a literal of that prop (KF-V9V2B6: a
1530
- // Select's choices promoted with their current list).
1531
- const owner =
1532
- param.type?.kind === 'prop'
1533
- ? ctx.catalog.components.get(param.type.component)
1534
- : undefined;
1535
- const ownerProp = owner?.component.props.find(
1536
- (prop) => prop.name === param.type.prop,
1537
- );
1538
- if (
1539
- 'default' in param &&
1540
- PARAM_KINDS.has(param.type?.kind) &&
1541
- !(ownerProp
1542
- ? isLiteralOf(param.default, ownerProp.type, owner.definitions)
1543
- : isLiteralOf(param.default, param.type))
1544
- ) {
1545
- ctx.report(
1546
- 'KUI-V004',
1547
- `${at}.default`,
1548
- `the default is not a valid ${describe(param.type)}`,
1549
- );
1550
- }
1551
- ctx.params.set(name, param);
1552
- }
1553
- if (document.params !== undefined && !isObject(document.params))
1554
- ctx.report('KUI-V001', '$.params', 'params is an object');
1555
- for (const [name, slot] of Object.entries(
1556
- isObject(document.slots) ? document.slots : {},
1557
- )) {
1558
- const at = `$.slots.${name}`;
1559
- if (!CAMEL.test(name) || !isObject(slot)) {
1560
- ctx.report(
1561
- 'KUI-V001',
1562
- at,
1563
- 'a slot is a camelCase name mapped to `{ input? }`',
1564
- );
1565
- continue;
1566
- }
1567
- for (const key of only(slot, ['input', 'description']))
1568
- ctx.report('KUI-V001', `${at}.${key}`, 'unknown slot field');
1569
- if (slot.input !== undefined) {
1570
- if (slot.input?.kind !== 'object')
1571
- ctx.report('KUI-V001', `${at}.input`, 'a slot input is an object type');
1572
- else validateDeclaredType(ctx, slot.input, `${at}.input`);
1573
- }
1574
- ctx.slots.set(name, slot);
1575
- }
1576
- return true;
1577
- }
1578
-
1579
- /**
1580
- * `validateView` with an optional `trace` (validate-move.mjs): its
1581
- * `entries` map, when given, records where each node is checked. Internal.
1582
- */
1583
- export function runView(document, catalog, options, trace) {
1584
- const ctx = createContext(catalog, options, trace);
1585
- const { diagnostics, actions } = ctx;
1586
- if (!checkHeader(ctx, document))
1587
- return { valid: false, diagnostics, hints: [], actions };
1588
- // KF-PK3GVY: an editor's empty draft has no root yet; it is a document,
1589
- // but nothing can generate or render it until a component becomes one.
1590
- if (document.root === undefined) {
1591
- ctx.report(
1592
- 'KUI-V017',
1593
- '$.root',
1594
- 'the document has no root; add a component to start it',
1595
- );
1596
- } else if (!isObject(document.root) || !('type' in document.root)) {
1597
- ctx.report('KUI-V001', '$.root', 'root is exactly one node');
1598
- } else {
1599
- checkNode(ctx, document.root, '$.root', new Map(), false, undefined);
1600
- }
1601
- const hints = [];
1602
- if (hasTypeExpressions(document))
1603
- hints.push({
1604
- code: 'KUI-H002',
1605
- path: '$.params',
1606
- message:
1607
- 'TypeScript parameter expressions require the owning project compiler; this pass checks structure only.',
1608
- });
1609
- hintUnsizedLayouts(document.root, '$.root', true, hints, true);
1610
- return { valid: diagnostics.length === 0, diagnostics, hints, actions };
1611
- }
1612
-
1613
- /**
1614
- * Checks pieces of `document` alone (KF-SFAA5R: scoped move validation), as
1615
- * `validateView(document, catalog)` checks them in the place `entry`
1616
- * describes (an `entries` record of a traced run). Returns a function that
1617
- * checks `item`, a node (or, with `asChild`, any zone child) and its
1618
- * subtree, or, with `shallow`, the node alone, noting where a child appended
1619
- * to `zone` would be checked. Action conflicts and duplicate ids and names
1620
- * are left to the caller: each run has its own tables. Internal.
1621
- */
1622
- export function createScopedCheck(document, catalog) {
1623
- const header = createContext(catalog, {});
1624
- checkHeader(header, document);
1625
- return (item, entry, { asChild = false, shallow = false, zone } = {}) => {
1626
- const trace = {
1627
- quiet: true,
1628
- notes: [],
1629
- shallow: shallow ? item : undefined,
1630
- zone,
1631
- child: undefined,
1632
- hostAfter: undefined,
1633
- };
1634
- const ctx = createContext(catalog, {}, trace);
1635
- ctx.params = header.params;
1636
- ctx.slots = header.slots;
1637
- ctx.packages = header.packages;
1638
- ctx.interactiveHost = entry[5];
1639
- (asChild ? checkChild : checkNode)(ctx, item, ...entry.slice(0, 5));
1640
- return { ...trace, diagnostics: ctx.diagnostics };
1641
- };
1642
- }
1643
-
1644
- /**
1645
- * What a parent's checks read of node `node` as its child: its type and
1646
- * whether it brings its own content-item inset (`KUI-L204`). Internal.
1647
- */
1648
- export const childFacts = (catalog, node) =>
1649
- `${node.type} ${bringsInset(catalog.entries.get(node.type), node)}`;