@kerfjs/ui 5.0.0-beta.124 → 5.0.0-beta.126

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 (518) hide show
  1. package/README.md +6 -0
  2. package/ai/application-ui-diagnostic-ids-v1.json +1 -0
  3. package/ai/component-catalog.json +168 -7
  4. package/ai/component-catalog.schema.json +14 -1
  5. package/ai/component-composition.json +97 -6
  6. package/ai/component-props.json +447 -40
  7. package/ai/components/README.md +1 -0
  8. package/ai/components/combobox.md +1 -1
  9. package/ai/components/gauge.md +83 -0
  10. package/ai/components/segmented-control.md +1 -0
  11. package/ai/components/surface-scaffold.md +19 -5
  12. package/ai/components/tab-bar.md +2 -0
  13. package/ai/components/toolbar.md +1 -0
  14. package/ai/public-api-signatures-v1.md +345 -295
  15. package/ai/skill.md +36 -27
  16. package/ai/view-document.schema.json +55 -2
  17. package/ai/webawesome-jsx-signatures-v1.md +1 -1
  18. package/analyzer/cli.mjs +60 -24
  19. package/analyzer/index.mjs +331 -58
  20. package/catalog-projection-cli.mjs +86 -50
  21. package/dist/anchored-surface.js +2 -1
  22. package/dist/browser/editor.js +11 -8
  23. package/dist/browser/gauge.js +3 -0
  24. package/dist/browser/segmented-control.js +1 -0
  25. package/dist/catalog-resources.d.ts +1 -1
  26. package/dist/catalog.d.ts +1 -1
  27. package/dist/catalog.js +7 -7
  28. package/dist/{chunk-VX3YF2UD.js → chunk-3K5V3ZSD.js} +3 -3
  29. package/dist/{chunk-VX3YF2UD.js.map → chunk-3K5V3ZSD.js.map} +1 -1
  30. package/dist/chunk-3SCGTP5O.js +682 -0
  31. package/dist/chunk-3SCGTP5O.js.map +1 -0
  32. package/dist/{chunk-3JOEJT2Z.js → chunk-3ZKUXWAV.js} +4 -4
  33. package/dist/chunk-3ZKUXWAV.js.map +1 -0
  34. package/dist/{chunk-ADMWT7FX.js → chunk-3ZWYGGEC.js} +136 -8
  35. package/dist/chunk-3ZWYGGEC.js.map +1 -0
  36. package/dist/{chunk-KLR3DCHH.js → chunk-4L5ZIKDZ.js} +1 -1
  37. package/dist/chunk-4L5ZIKDZ.js.map +1 -0
  38. package/dist/{chunk-2E7S5C4D.js → chunk-4UWLHKNU.js} +5 -5
  39. package/dist/chunk-4UWLHKNU.js.map +1 -0
  40. package/dist/{chunk-EXGDKG7B.js → chunk-5A2DN3LR.js} +5 -5
  41. package/dist/chunk-5A2DN3LR.js.map +1 -0
  42. package/dist/{chunk-DJ65XFVN.js → chunk-63TJH2RF.js} +4 -4
  43. package/dist/chunk-63TJH2RF.js.map +1 -0
  44. package/dist/{chunk-Q2CLQ3IJ.js → chunk-6PHG2DMG.js} +1 -1
  45. package/dist/chunk-6PHG2DMG.js.map +1 -0
  46. package/dist/{chunk-SPI6VMIY.js → chunk-6T7AX365.js} +4 -4
  47. package/dist/chunk-6T7AX365.js.map +1 -0
  48. package/dist/{chunk-GVII4JSD.js → chunk-6V6UHPJD.js} +4 -4
  49. package/dist/chunk-6V6UHPJD.js.map +1 -0
  50. package/dist/{chunk-2LM3PYHA.js → chunk-C2TY5DJC.js} +11 -8
  51. package/dist/chunk-C2TY5DJC.js.map +1 -0
  52. package/dist/{chunk-3WYREXW4.js → chunk-COMEWURO.js} +8 -6
  53. package/dist/chunk-COMEWURO.js.map +1 -0
  54. package/dist/{chunk-VPDSPD76.js → chunk-DB64I3DB.js} +4 -3
  55. package/dist/chunk-DB64I3DB.js.map +1 -0
  56. package/dist/{chunk-SBCXWGNP.js → chunk-DBCDYBZP.js} +2 -2
  57. package/dist/{chunk-SBCXWGNP.js.map → chunk-DBCDYBZP.js.map} +1 -1
  58. package/dist/{chunk-CNM6ZWP2.js → chunk-DJWBXEF4.js} +4 -2
  59. package/dist/chunk-DJWBXEF4.js.map +1 -0
  60. package/dist/{chunk-7AUZG5EW.js → chunk-E2MTHHLS.js} +3 -3
  61. package/dist/{chunk-7AUZG5EW.js.map → chunk-E2MTHHLS.js.map} +1 -1
  62. package/dist/{chunk-JG4ONAOI.js → chunk-EI55KWHP.js} +2 -2
  63. package/dist/chunk-EI55KWHP.js.map +1 -0
  64. package/dist/{chunk-MVKHSAKE.js → chunk-GE2BQXB3.js} +41 -4
  65. package/dist/chunk-GE2BQXB3.js.map +1 -0
  66. package/dist/{chunk-KELWWCMX.js → chunk-I2K4OQKB.js} +4 -4
  67. package/dist/chunk-I2K4OQKB.js.map +1 -0
  68. package/dist/chunk-IFDTSVE6.js +9 -0
  69. package/dist/chunk-IFDTSVE6.js.map +1 -0
  70. package/dist/{chunk-TPLVC5BE.js → chunk-IR32NI2O.js} +336 -247
  71. package/dist/chunk-IR32NI2O.js.map +1 -0
  72. package/dist/{chunk-ZKKO4MHC.js → chunk-JYKP7TBZ.js} +4 -2
  73. package/dist/chunk-JYKP7TBZ.js.map +1 -0
  74. package/dist/{chunk-F3PZGFEA.js → chunk-K3C35KGR.js} +4 -4
  75. package/dist/chunk-K3C35KGR.js.map +1 -0
  76. package/dist/{chunk-4RECPEHI.js → chunk-KBS3GP6S.js} +4 -3
  77. package/dist/chunk-KBS3GP6S.js.map +1 -0
  78. package/dist/{chunk-YHRJNKD5.js → chunk-KS7EXW4P.js} +6 -4
  79. package/dist/chunk-KS7EXW4P.js.map +1 -0
  80. package/dist/{chunk-V6N3YLTM.js → chunk-LTOTL5AS.js} +3 -3
  81. package/dist/chunk-LTOTL5AS.js.map +1 -0
  82. package/dist/chunk-M64TAGZY.js +590 -0
  83. package/dist/chunk-M64TAGZY.js.map +1 -0
  84. package/dist/{chunk-JZZVWTUB.js → chunk-MMOQR426.js} +2 -2
  85. package/dist/chunk-MMOQR426.js.map +1 -0
  86. package/dist/{chunk-SJBMKA4X.js → chunk-OHT2AXER.js} +11 -10
  87. package/dist/chunk-OHT2AXER.js.map +1 -0
  88. package/dist/{chunk-4Z4QSTRF.js → chunk-OZKBIPXU.js} +38 -5
  89. package/dist/chunk-OZKBIPXU.js.map +1 -0
  90. package/dist/{chunk-Q2SLOMN6.js → chunk-RHMY45DK.js} +4 -4
  91. package/dist/chunk-RHMY45DK.js.map +1 -0
  92. package/dist/{chunk-BZXA5SSA.js → chunk-S7QB5KMM.js} +2 -2
  93. package/dist/{chunk-BZXA5SSA.js.map → chunk-S7QB5KMM.js.map} +1 -1
  94. package/dist/{chunk-HDXUHLTQ.js → chunk-SHECA2N4.js} +8 -2
  95. package/dist/chunk-SHECA2N4.js.map +1 -0
  96. package/dist/{chunk-R6FIXYAE.js → chunk-SJEPM5ZU.js} +2 -2
  97. package/dist/{chunk-R6FIXYAE.js.map → chunk-SJEPM5ZU.js.map} +1 -1
  98. package/dist/{chunk-FJMABKKV.js → chunk-UQ4FRQ6M.js} +35 -17
  99. package/dist/chunk-UQ4FRQ6M.js.map +1 -0
  100. package/dist/{chunk-S4ZGTDSG.js → chunk-UU37OR3D.js} +2 -2
  101. package/dist/chunk-UU37OR3D.js.map +1 -0
  102. package/dist/{chunk-SWXWLSUD.js → chunk-WEQNPYVA.js} +1 -1
  103. package/dist/{chunk-SWXWLSUD.js.map → chunk-WEQNPYVA.js.map} +1 -1
  104. package/dist/{chunk-5SFHBYEY.js → chunk-WUVHP3UC.js} +97 -24
  105. package/dist/chunk-WUVHP3UC.js.map +1 -0
  106. package/dist/{chunk-3S3WXAZ5.js → chunk-X43QQWVC.js} +3 -2
  107. package/dist/chunk-X43QQWVC.js.map +1 -0
  108. package/dist/{chunk-Z3T24FX3.js → chunk-YE6KCAIN.js} +3 -2
  109. package/dist/chunk-YE6KCAIN.js.map +1 -0
  110. package/dist/{chunk-BCO673YW.js → chunk-Z3BT2SZE.js} +3 -3
  111. package/dist/chunk-Z3BT2SZE.js.map +1 -0
  112. package/dist/{chunk-NYNNNEAU.js → chunk-ZC4KSRAF.js} +7 -7
  113. package/dist/chunk-ZC4KSRAF.js.map +1 -0
  114. package/dist/collapsible-panel.d.ts +2 -2
  115. package/dist/collapsible-panel.js +2 -2
  116. package/dist/collapsible-panel.js.map +1 -1
  117. package/dist/column-explorer.d.ts +2 -2
  118. package/dist/column-explorer.js +2 -2
  119. package/dist/column-explorer.js.map +1 -1
  120. package/dist/dialog-surface-controller-BeKZ3e8Z.d.ts +251 -0
  121. package/dist/editor-frame.d.ts +1 -1
  122. package/dist/editor-frame.js +1 -1
  123. package/dist/editor.d.ts +38 -20
  124. package/dist/editor.js +10869 -6993
  125. package/dist/editor.js.map +1 -1
  126. package/dist/file-picker.js +1 -1
  127. package/dist/gauge.d.ts +73 -0
  128. package/dist/gauge.js +157 -0
  129. package/dist/gauge.js.map +1 -0
  130. package/dist/help-tags-register.js +2 -1
  131. package/dist/help-tags-register.js.map +1 -1
  132. package/dist/index.d.ts +2 -1
  133. package/dist/index.js +29 -28
  134. package/dist/list-action-row.d.ts +1 -1
  135. package/dist/list-action-row.js +1 -1
  136. package/dist/list-detail-dialog.d.ts +7 -7
  137. package/dist/list-detail-dialog.js +6 -5
  138. package/dist/list-detail-dialog.js.map +1 -1
  139. package/dist/list-header.d.ts +1 -1
  140. package/dist/list-header.js +1 -1
  141. package/dist/list-item.d.ts +1 -1
  142. package/dist/list-item.js +1 -1
  143. package/dist/message-composer.js +1 -1
  144. package/dist/nav-stack.d.ts +6 -6
  145. package/dist/nav-stack.js +1 -1
  146. package/dist/popup-menu-register.js +1 -7
  147. package/dist/popup-menu-register.js.map +1 -1
  148. package/dist/popup-menu.d.ts +2 -2
  149. package/dist/popup-menu.js +1 -1
  150. package/dist/resizable-region.js +1 -1
  151. package/dist/segmented-control.d.ts +22 -1
  152. package/dist/segmented-control.js +3 -1
  153. package/dist/select-register.js +17 -23
  154. package/dist/select-register.js.map +1 -1
  155. package/dist/split-view.d.ts +6 -6
  156. package/dist/split-view.js +1 -1
  157. package/dist/styles/badge.css +39 -0
  158. package/dist/styles/collapsible-panel.css +34 -25
  159. package/dist/styles/components/actions/popup-menu/popup-menu.css +4 -4
  160. package/dist/styles/components/actions/toolbar/toolbar.css +34 -1
  161. package/dist/styles/components/actions/toolbar-control-group/toolbar-control-group.css +1 -1
  162. package/dist/styles/components/feedback/badge/badge.css +39 -0
  163. package/dist/styles/components/feedback/gauge/gauge.css +132 -0
  164. package/dist/styles/components/forms/segmented-control/segmented-control.css +17 -1
  165. package/dist/styles/components/layout/collapsible-panel/collapsible-panel.css +34 -25
  166. package/dist/styles/components/layout/split-view/split-view.css +19 -33
  167. package/dist/styles/components/navigation/nav-stack/nav-stack.css +15 -19
  168. package/dist/styles/components/navigation/tab-navigator/tab-navigator.css +30 -29
  169. package/dist/styles/components/surfaces/editor-frame/editor-frame.css +2 -2
  170. package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +259 -4
  171. package/dist/styles/editor/editor.css +55 -0
  172. package/dist/styles/editor-frame.css +2 -2
  173. package/dist/styles/gauge.css +132 -0
  174. package/dist/styles/nav-stack.css +15 -19
  175. package/dist/styles/popup-menu.css +4 -4
  176. package/dist/styles/segmented-control.css +17 -1
  177. package/dist/styles/split-view.css +19 -33
  178. package/dist/styles/styles.css +1 -0
  179. package/dist/styles/surface-scaffold.css +259 -4
  180. package/dist/styles/tab-navigator.css +30 -29
  181. package/dist/styles/toolbar-control-group.css +1 -1
  182. package/dist/styles/toolbar.css +34 -1
  183. package/dist/styles/webawesome.css +4 -5
  184. package/dist/surface-scaffold-register.js +2 -1
  185. package/dist/surface-scaffold-register.js.map +1 -1
  186. package/dist/surface-scaffold.d.ts +153 -246
  187. package/dist/surface-scaffold.js +3 -2
  188. package/dist/toolbar-control-group.d.ts +2 -2
  189. package/dist/toolbar-control-group.js +1 -1
  190. package/dist/toolbar.d.ts +6 -1
  191. package/dist/toolbar.js +1 -1
  192. package/dist/tree-list.d.ts +2 -2
  193. package/dist/tree-list.js +1 -1
  194. package/dist/wire-catalog.d.ts +1 -1
  195. package/dist/wire-catalog.js +3 -2
  196. package/dist/wire-catalog.js.map +1 -1
  197. package/dist/wire-checkboxes.js +2 -1
  198. package/dist/wire-choice-chips.js +2 -1
  199. package/dist/wire-color-fields.js +2 -1
  200. package/dist/wire-color-pickers.js +2 -1
  201. package/dist/wire-comboboxes.d.ts +2 -0
  202. package/dist/wire-comboboxes.js +2 -1
  203. package/dist/wire-content-items.js +2 -1
  204. package/dist/wire-corner-status.js +2 -1
  205. package/dist/wire-nav-stack.js +2 -1
  206. package/dist/wire-overlay-sheets.js +2 -1
  207. package/dist/wire-paged-views.js +2 -2
  208. package/dist/wire-paged-views.js.map +1 -1
  209. package/dist/wire-resizable-regions.js +2 -1
  210. package/dist/wire-scroll-dividers.js +1 -1
  211. package/dist/wire-search-fields.js +2 -1
  212. package/dist/wire-sidebar.js +2 -1
  213. package/dist/wire-tab-bars.d.ts +41 -2
  214. package/dist/wire-tab-bars.js +1 -1
  215. package/dist/wire-tab-navigator.js +2 -1
  216. package/dist/wire-tag-fields.js +2 -1
  217. package/dist/wire-workbench.js +2 -1
  218. package/dist/workbench-dialog.d.ts +7 -7
  219. package/dist/workbench-dialog.js +5 -4
  220. package/dist/workbench-dialog.js.map +1 -1
  221. package/dist/workbench.d.ts +1 -1
  222. package/dist/workbench.js +1 -1
  223. package/docs/accessibility.md +3 -6
  224. package/docs/component-contract.md +47 -7
  225. package/docs/component-selection.md +90 -79
  226. package/docs/design/sketch/Kerf-UI.sketch +0 -0
  227. package/docs/design/sketch/README.md +1 -1
  228. package/docs/design/sketch/content/README.md +8 -8
  229. package/docs/design/sketch/coverage.md +7 -5
  230. package/docs/design/sketch/unified/README.md +1 -1
  231. package/docs/design/sketch/unified/pages/content.png +0 -0
  232. package/docs/design/templates/button/full-width-dark.svg +1 -1
  233. package/docs/design/templates/button/full-width.svg +1 -1
  234. package/docs/design/templates/button/icons-dark.svg +1 -1
  235. package/docs/design/templates/button/icons.svg +1 -1
  236. package/docs/design/templates/button/pill-dark.svg +1 -1
  237. package/docs/design/templates/button/pill.svg +1 -1
  238. package/docs/design/templates/button/toggles-dark.svg +1 -1
  239. package/docs/design/templates/button/toggles.svg +1 -1
  240. package/docs/design/templates/button-dark.svg +1 -1
  241. package/docs/design/templates/button.svg +1 -1
  242. package/docs/design/templates/checkbox/compact-dark.svg +1 -1
  243. package/docs/design/templates/checkbox/compact.svg +1 -1
  244. package/docs/design/templates/checkbox/mixed-dark.svg +1 -1
  245. package/docs/design/templates/checkbox/mixed.svg +1 -1
  246. package/docs/design/templates/checkbox/states-dark.svg +1 -1
  247. package/docs/design/templates/checkbox/states.svg +1 -1
  248. package/docs/design/templates/checkbox-dark.svg +1 -1
  249. package/docs/design/templates/checkbox-group/vertical-dark.svg +1 -1
  250. package/docs/design/templates/checkbox-group/vertical.svg +1 -1
  251. package/docs/design/templates/checkbox-group-dark.svg +1 -1
  252. package/docs/design/templates/checkbox-group.svg +1 -1
  253. package/docs/design/templates/checkbox.svg +1 -1
  254. package/docs/design/templates/chip/tags-dark.svg +1 -1
  255. package/docs/design/templates/chip/tags.svg +1 -1
  256. package/docs/design/templates/chip-dark.svg +1 -1
  257. package/docs/design/templates/chip.svg +1 -1
  258. package/docs/design/templates/choice-chips/compact-icons-dark.svg +1 -1
  259. package/docs/design/templates/choice-chips/compact-icons.svg +1 -1
  260. package/docs/design/templates/choice-chips-dark.svg +1 -1
  261. package/docs/design/templates/choice-chips.svg +1 -1
  262. package/docs/design/templates/color-field/compact-dark.svg +1 -1
  263. package/docs/design/templates/color-field/compact.svg +1 -1
  264. package/docs/design/templates/color-field/error-dark.svg +1 -1
  265. package/docs/design/templates/color-field/error.svg +1 -1
  266. package/docs/design/templates/color-field/hint-dark.svg +1 -1
  267. package/docs/design/templates/color-field/hint.svg +1 -1
  268. package/docs/design/templates/color-field-dark.svg +1 -1
  269. package/docs/design/templates/color-field.svg +1 -1
  270. package/docs/design/templates/color-picker/gray-dark.svg +1 -1
  271. package/docs/design/templates/color-picker/gray.svg +1 -1
  272. package/docs/design/templates/color-picker/hsb-dark.svg +1 -1
  273. package/docs/design/templates/color-picker/hsb.svg +1 -1
  274. package/docs/design/templates/color-picker/rgb-dark.svg +1 -1
  275. package/docs/design/templates/color-picker/rgb.svg +1 -1
  276. package/docs/design/templates/color-picker-dark.svg +1 -1
  277. package/docs/design/templates/color-picker.svg +1 -1
  278. package/docs/design/templates/disclosure/embedded-dark.svg +1 -1
  279. package/docs/design/templates/disclosure/embedded.svg +1 -1
  280. package/docs/design/templates/disclosure/framed-sunken-dark.svg +1 -1
  281. package/docs/design/templates/disclosure/framed-sunken.svg +1 -1
  282. package/docs/design/templates/disclosure/plain-dark.svg +1 -1
  283. package/docs/design/templates/disclosure/plain.svg +1 -1
  284. package/docs/design/templates/disclosure-dark.svg +1 -1
  285. package/docs/design/templates/disclosure.svg +1 -1
  286. package/docs/design/templates/empty-state/filtered-dark.svg +1 -1
  287. package/docs/design/templates/empty-state/filtered.svg +1 -1
  288. package/docs/design/templates/empty-state/with-action-dark.svg +1 -1
  289. package/docs/design/templates/empty-state/with-action.svg +1 -1
  290. package/docs/design/templates/empty-state-dark.svg +1 -1
  291. package/docs/design/templates/empty-state.svg +1 -1
  292. package/docs/design/templates/gauge/bare-dark.svg +1 -0
  293. package/docs/design/templates/gauge/bare.svg +1 -0
  294. package/docs/design/templates/gauge/full-dark.svg +1 -0
  295. package/docs/design/templates/gauge/full.svg +1 -0
  296. package/docs/design/templates/gauge-dark.svg +1 -0
  297. package/docs/design/templates/gauge.svg +1 -0
  298. package/docs/design/templates/list/compact-dark.svg +1 -1
  299. package/docs/design/templates/list/compact.svg +1 -1
  300. package/docs/design/templates/list/stack-dark.svg +1 -1
  301. package/docs/design/templates/list/stack.svg +1 -1
  302. package/docs/design/templates/list-action-row/default-dark.svg +1 -1
  303. package/docs/design/templates/list-action-row/default.svg +1 -1
  304. package/docs/design/templates/list-action-row/icon-tile-dark.svg +1 -1
  305. package/docs/design/templates/list-action-row/icon-tile.svg +1 -1
  306. package/docs/design/templates/list-action-row/selected-dark.svg +1 -1
  307. package/docs/design/templates/list-action-row/selected.svg +1 -1
  308. package/docs/design/templates/list-action-row/trailing-menu-dark.svg +1 -1
  309. package/docs/design/templates/list-action-row/trailing-menu.svg +1 -1
  310. package/docs/design/templates/list-action-row-dark.svg +1 -1
  311. package/docs/design/templates/list-action-row.svg +1 -1
  312. package/docs/design/templates/list-dark.svg +1 -1
  313. package/docs/design/templates/list-header/action-dark.svg +1 -1
  314. package/docs/design/templates/list-header/action.svg +1 -1
  315. package/docs/design/templates/list-header/inline-action-dark.svg +1 -1
  316. package/docs/design/templates/list-header/inline-action.svg +1 -1
  317. package/docs/design/templates/list-header/toggle-collapsed-dark.svg +1 -1
  318. package/docs/design/templates/list-header/toggle-collapsed.svg +1 -1
  319. package/docs/design/templates/list-header/toggle-expanded-dark.svg +1 -1
  320. package/docs/design/templates/list-header/toggle-expanded.svg +1 -1
  321. package/docs/design/templates/list-header-dark.svg +1 -1
  322. package/docs/design/templates/list-header.svg +1 -1
  323. package/docs/design/templates/list-item/default-dark.svg +1 -1
  324. package/docs/design/templates/list-item/default.svg +1 -1
  325. package/docs/design/templates/list-item/icon-tile-dark.svg +1 -1
  326. package/docs/design/templates/list-item/icon-tile.svg +1 -1
  327. package/docs/design/templates/list-item/multiline-dark.svg +1 -1
  328. package/docs/design/templates/list-item/multiline.svg +1 -1
  329. package/docs/design/templates/list-item/selected-dark.svg +1 -1
  330. package/docs/design/templates/list-item/selected.svg +1 -1
  331. package/docs/design/templates/list-item/trailing-dark.svg +1 -1
  332. package/docs/design/templates/list-item/trailing.svg +1 -1
  333. package/docs/design/templates/list-item-dark.svg +1 -1
  334. package/docs/design/templates/list-item.svg +1 -1
  335. package/docs/design/templates/list.svg +1 -1
  336. package/docs/design/templates/progress-ring/sizes-dark.svg +1 -1
  337. package/docs/design/templates/progress-ring/sizes.svg +1 -1
  338. package/docs/design/templates/progress-ring/tones-dark.svg +1 -1
  339. package/docs/design/templates/progress-ring/tones.svg +1 -1
  340. package/docs/design/templates/progress-ring-dark.svg +1 -1
  341. package/docs/design/templates/progress-ring.svg +1 -1
  342. package/docs/design/templates/search-field/empty-dark.svg +1 -1
  343. package/docs/design/templates/search-field/empty.svg +1 -1
  344. package/docs/design/templates/search-field/tokens-dark.svg +1 -1
  345. package/docs/design/templates/search-field/tokens.svg +1 -1
  346. package/docs/design/templates/search-field-dark.svg +1 -1
  347. package/docs/design/templates/search-field.svg +1 -1
  348. package/docs/design/templates/segmented-control/equal-dark.svg +1 -1
  349. package/docs/design/templates/segmented-control/equal.svg +1 -1
  350. package/docs/design/templates/segmented-control/pill-small-dark.svg +1 -1
  351. package/docs/design/templates/segmented-control/pill-small.svg +1 -1
  352. package/docs/design/templates/segmented-control-dark.svg +1 -1
  353. package/docs/design/templates/segmented-control.svg +1 -1
  354. package/docs/design/templates/select/compact-dark.svg +1 -1
  355. package/docs/design/templates/select/compact.svg +1 -1
  356. package/docs/design/templates/select/form-dark.svg +1 -1
  357. package/docs/design/templates/select/form.svg +1 -1
  358. package/docs/design/templates/select/icons-dark.svg +1 -1
  359. package/docs/design/templates/select/icons.svg +1 -1
  360. package/docs/design/templates/select-dark.svg +1 -1
  361. package/docs/design/templates/select.svg +1 -1
  362. package/docs/design/templates/split-button/full-width-dark.svg +1 -1
  363. package/docs/design/templates/split-button/full-width.svg +1 -1
  364. package/docs/design/templates/split-button/pill-dark.svg +1 -1
  365. package/docs/design/templates/split-button/pill.svg +1 -1
  366. package/docs/design/templates/split-button/states-dark.svg +1 -1
  367. package/docs/design/templates/split-button/states.svg +1 -1
  368. package/docs/design/templates/split-button/tones-dark.svg +1 -1
  369. package/docs/design/templates/split-button/tones.svg +1 -1
  370. package/docs/design/templates/split-button-dark.svg +1 -1
  371. package/docs/design/templates/split-button.svg +1 -1
  372. package/docs/design/templates/state-banner/danger-dark.svg +1 -1
  373. package/docs/design/templates/state-banner/danger.svg +1 -1
  374. package/docs/design/templates/state-banner/info-badge-dark.svg +1 -1
  375. package/docs/design/templates/state-banner/info-badge.svg +1 -1
  376. package/docs/design/templates/state-banner/info-dark.svg +1 -1
  377. package/docs/design/templates/state-banner/info.svg +1 -1
  378. package/docs/design/templates/state-banner/strip-dark.svg +1 -1
  379. package/docs/design/templates/state-banner/strip.svg +1 -1
  380. package/docs/design/templates/state-banner/success-dark.svg +1 -1
  381. package/docs/design/templates/state-banner/success.svg +1 -1
  382. package/docs/design/templates/state-banner/warning-dark.svg +1 -1
  383. package/docs/design/templates/state-banner/warning.svg +1 -1
  384. package/docs/design/templates/state-banner-dark.svg +1 -1
  385. package/docs/design/templates/state-banner.svg +1 -1
  386. package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -1
  387. package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -1
  388. package/docs/design/templates/tab-bar-dark.svg +1 -1
  389. package/docs/design/templates/tab-bar.svg +1 -1
  390. package/docs/design/templates/tag-field/error-dark.svg +1 -1
  391. package/docs/design/templates/tag-field/error.svg +1 -1
  392. package/docs/design/templates/tag-field/tags-dark.svg +1 -1
  393. package/docs/design/templates/tag-field/tags.svg +1 -1
  394. package/docs/design/templates/tag-field-dark.svg +1 -1
  395. package/docs/design/templates/tag-field.svg +1 -1
  396. package/docs/design/templates/text-field/labeled-dark.svg +1 -1
  397. package/docs/design/templates/text-field/labeled.svg +1 -1
  398. package/docs/design/templates/text-field/search-dark.svg +1 -1
  399. package/docs/design/templates/text-field/search.svg +1 -1
  400. package/docs/design/templates/text-field-dark.svg +1 -1
  401. package/docs/design/templates/text-field.svg +1 -1
  402. package/docs/design/templates/toolbar/title-and-actions-dark.svg +1 -1
  403. package/docs/design/templates/toolbar/title-and-actions.svg +1 -1
  404. package/docs/design/templates/toolbar/width-visibility-320-dark.svg +1 -1
  405. package/docs/design/templates/toolbar/width-visibility-320.svg +1 -1
  406. package/docs/design/templates/toolbar/width-visibility-600-dark.svg +1 -1
  407. package/docs/design/templates/toolbar/width-visibility-600.svg +1 -1
  408. package/docs/design/templates/toolbar-control-group/borderless-single-dark.svg +1 -1
  409. package/docs/design/templates/toolbar-control-group/borderless-single.svg +1 -1
  410. package/docs/design/templates/toolbar-control-group/glass-dark.svg +1 -1
  411. package/docs/design/templates/toolbar-control-group/glass.svg +1 -1
  412. package/docs/design/templates/toolbar-control-group/icon-buttons-dark.svg +1 -1
  413. package/docs/design/templates/toolbar-control-group/icon-buttons.svg +1 -1
  414. package/docs/design/templates/toolbar-control-group/icon-tile-brand-dark.svg +1 -1
  415. package/docs/design/templates/toolbar-control-group/icon-tile-brand.svg +1 -1
  416. package/docs/design/templates/toolbar-control-group/icon-tile-danger-dark.svg +1 -1
  417. package/docs/design/templates/toolbar-control-group/icon-tile-danger.svg +1 -1
  418. package/docs/design/templates/toolbar-control-group/icon-tile-neutral-dark.svg +1 -1
  419. package/docs/design/templates/toolbar-control-group/icon-tile-neutral.svg +1 -1
  420. package/docs/design/templates/toolbar-control-group/icon-tile-success-dark.svg +1 -1
  421. package/docs/design/templates/toolbar-control-group/icon-tile-success.svg +1 -1
  422. package/docs/design/templates/toolbar-control-group/icon-tile-warning-dark.svg +1 -1
  423. package/docs/design/templates/toolbar-control-group/icon-tile-warning.svg +1 -1
  424. package/docs/design/templates/toolbar-control-group/push-buttons-dark.svg +1 -1
  425. package/docs/design/templates/toolbar-control-group/push-buttons.svg +1 -1
  426. package/docs/design/templates/toolbar-control-group/with-text-dark.svg +1 -1
  427. package/docs/design/templates/toolbar-control-group/with-text.svg +1 -1
  428. package/docs/design/templates/toolbar-control-group-dark.svg +1 -1
  429. package/docs/design/templates/toolbar-control-group.svg +1 -1
  430. package/docs/design/templates/toolbar-dark.svg +1 -1
  431. package/docs/design/templates/toolbar.svg +1 -1
  432. package/docs/design/templates/tree-list/files-dark.svg +1 -1
  433. package/docs/design/templates/tree-list/files.svg +1 -1
  434. package/docs/design/templates/tree-list/outline-dark.svg +1 -1
  435. package/docs/design/templates/tree-list/outline.svg +1 -1
  436. package/docs/design/templates/tree-list-dark.svg +1 -1
  437. package/docs/design/templates/tree-list.svg +1 -1
  438. package/docs/design/templates/value-table/details-dark.svg +1 -1
  439. package/docs/design/templates/value-table/details.svg +1 -1
  440. package/docs/design/templates/value-table-dark.svg +1 -1
  441. package/docs/design/templates/value-table.svg +1 -1
  442. package/docs/design/templates.md +5 -4
  443. package/docs/editor-frame.md +1 -1
  444. package/docs/editor-host.md +15 -2
  445. package/docs/gauge.md +55 -0
  446. package/docs/overlay-tooltip.md +1 -1
  447. package/docs/progress.md +3 -2
  448. package/docs/recipes.md +1 -1
  449. package/docs/surface-scaffold.md +63 -2
  450. package/docs/ui-analyzer.md +42 -0
  451. package/docs/ui-doctor.md +45 -1
  452. package/docs/ui-evaluator.md +35 -0
  453. package/docs/ux-demo.md +1 -1
  454. package/docs/view.md +295 -0
  455. package/docs/webawesome-theme.md +16 -0
  456. package/doctor/cli.mjs +36 -31
  457. package/doctor/index.mjs +349 -162
  458. package/evaluator/cli.mjs +36 -30
  459. package/llms.txt +27 -5
  460. package/package.json +10 -2
  461. package/props/cli.mjs +47 -21
  462. package/scripts/lib/cli-args.mjs +98 -0
  463. package/ux-demo/recipes/compact-toolbar.tsx +1 -1
  464. package/ux-demo/recipes/loading-inspector.tsx +1 -1
  465. package/view/catalog.mjs +229 -0
  466. package/view/child-kind.mjs +22 -0
  467. package/view/cli.mjs +142 -119
  468. package/view/contract.mjs +84 -11
  469. package/view/css-grammar.mjs +93 -0
  470. package/view/generate.d.mts +16 -0
  471. package/view/generate.mjs +122 -43
  472. package/view/index.d.mts +80 -14
  473. package/view/index.mjs +5 -9
  474. package/view/interpret.mjs +104 -36
  475. package/view/types.mjs +161 -0
  476. package/view/validate-move.mjs +66 -30
  477. package/view/validate.mjs +420 -654
  478. package/vite-editor.d.mts +16 -1
  479. package/vite-editor.mjs +74 -4
  480. package/dist/chunk-2E7S5C4D.js.map +0 -1
  481. package/dist/chunk-2LM3PYHA.js.map +0 -1
  482. package/dist/chunk-3JOEJT2Z.js.map +0 -1
  483. package/dist/chunk-3S3WXAZ5.js.map +0 -1
  484. package/dist/chunk-3WYREXW4.js.map +0 -1
  485. package/dist/chunk-4RECPEHI.js.map +0 -1
  486. package/dist/chunk-4Z4QSTRF.js.map +0 -1
  487. package/dist/chunk-5SFHBYEY.js.map +0 -1
  488. package/dist/chunk-ADMWT7FX.js.map +0 -1
  489. package/dist/chunk-BCO673YW.js.map +0 -1
  490. package/dist/chunk-CNM6ZWP2.js.map +0 -1
  491. package/dist/chunk-DJ65XFVN.js.map +0 -1
  492. package/dist/chunk-EXGDKG7B.js.map +0 -1
  493. package/dist/chunk-F3PZGFEA.js.map +0 -1
  494. package/dist/chunk-FJMABKKV.js.map +0 -1
  495. package/dist/chunk-GVII4JSD.js.map +0 -1
  496. package/dist/chunk-HDXUHLTQ.js.map +0 -1
  497. package/dist/chunk-JG4ONAOI.js.map +0 -1
  498. package/dist/chunk-JZZVWTUB.js.map +0 -1
  499. package/dist/chunk-KELWWCMX.js.map +0 -1
  500. package/dist/chunk-KLR3DCHH.js.map +0 -1
  501. package/dist/chunk-LD6A6PYB.js +0 -268
  502. package/dist/chunk-LD6A6PYB.js.map +0 -1
  503. package/dist/chunk-MVKHSAKE.js.map +0 -1
  504. package/dist/chunk-NYNNNEAU.js.map +0 -1
  505. package/dist/chunk-Q2CLQ3IJ.js.map +0 -1
  506. package/dist/chunk-Q2SLOMN6.js.map +0 -1
  507. package/dist/chunk-S4ZGTDSG.js.map +0 -1
  508. package/dist/chunk-SJBMKA4X.js.map +0 -1
  509. package/dist/chunk-SPI6VMIY.js.map +0 -1
  510. package/dist/chunk-TPLVC5BE.js.map +0 -1
  511. package/dist/chunk-V6N3YLTM.js.map +0 -1
  512. package/dist/chunk-VNT4MXR5.js +0 -548
  513. package/dist/chunk-VNT4MXR5.js.map +0 -1
  514. package/dist/chunk-VPDSPD76.js.map +0 -1
  515. package/dist/chunk-YHRJNKD5.js.map +0 -1
  516. package/dist/chunk-Z3T24FX3.js.map +0 -1
  517. package/dist/chunk-ZKKO4MHC.js.map +0 -1
  518. package/dist/{nav-stack-DwxpXxqJ.d.ts → nav-stack-vQ3ieerq.d.ts} +3 -3
package/llms.txt CHANGED
@@ -158,7 +158,9 @@ explains when to reuse, compose, extend, or use native HTML.
158
158
  it; `kerf-ui-view check` fails on hand edits, and `kerf-ui-view diff` lists
159
159
  breaking contract changes first. A server-driven app renders documents at
160
160
  runtime with `interpretView`, passing the `<name>Contract` from a
161
- `--declarations-only` module so a changed document fails loudly.
161
+ `--declarations-only` module so a changed document fails loudly. The
162
+ [view documents guide](./docs/view.md) covers the format, the generated
163
+ module and its contract, the CLI, and the `@kerfjs/ui/view` API.
162
164
  Load [compile-time contracts](./ai/compile-time-contracts-v1.json) for stable
163
165
  `KUI-T###` ids, exact declaration symbols, and the boundary between rejected
164
166
  source states and relationships that still require runtime/catalog checks.
@@ -270,6 +272,11 @@ title-style labels as `KUI-D040`. See
270
272
  `TabBar`, `LucideIcon`; see
271
273
  [webawesome-migration.md](./docs/webawesome-migration.md)), and file a
272
274
  component gap rather than dropping to the raw tag.
275
+ - **No network.** No Kerf UI component requests anything at runtime: icons
276
+ are bundled Lucide SVG and no component renders a Web Awesome element. An
277
+ application that renders Web Awesome elements itself registers a local
278
+ icon library, or `wa-icon` fetches from Font Awesome's CDN (see
279
+ [webawesome-theme.md](./docs/webawesome-theme.md)).
273
280
  - **Reach for the primitive, not for CSS.** The package is built to look right
274
281
  without an application customization layer. Before adding `padding`, `margin`,
275
282
  `width`, `height`, `border`, `background`, a wrapper card, or a decoration,
@@ -561,7 +568,10 @@ headingLevel`, `SearchField clearIcon`, `ContentItem frame="framed"` for a
561
568
  `icon`, `items`, optional `placement` and `disabled`), which renders a
562
569
  `PopupMenu` as the row's sibling trailing control. Do not force a dropdown or button width. Nothing
563
570
  wraps inside a group: an icon sits beside its label on one row, and a
564
- `ToolbarText` is one ellipsized line unless you opt into `wrap`/`maxLines`. A
571
+ `ToolbarText` is one ellipsized line unless you opt into `wrap`/`maxLines`.
572
+ For a leading zone made of control groups (no title), set
573
+ `Toolbar responsive="wrap-groups"`: each leading group shares a row with the
574
+ trailing zone while it fits and otherwise moves, whole, to the next row. A
565
575
  Select or PopupMenu trigger drops its focus ring while its popup is open and
566
576
  the ring follows the control's shape; never add ring CSS. Compact
567
577
  mixed groups keep standard item padding and raised selected chrome without an
@@ -686,8 +696,10 @@ headingLevel`, `SearchField clearIcon`, `ContentItem frame="framed"` for a
686
696
  them to render. The `wire…` helpers own the _ephemeral_ parts: `wireNavStack` the
687
697
  content-slide, per-view top/bottom chrome cross-fade, and focus move/restore
688
698
  (mark a preferred new-view target with `data-nav-focus`), `wireTabBars` the
689
- overflow autoscroll, drag preview, and
690
- replacement focus after controlled automatic tab activation,
699
+ overflow autoscroll, drag preview,
700
+ replacement focus after controlled automatic tab activation, and the
701
+ `onFitChange` tab-fit report (overflow and zone widths) an app reads instead of
702
+ measuring TabBar's parts,
691
703
  `wireResizableRegions` the live drag preview, `wireScrollDividers` the
692
704
  scroll-state attributes from which a `Pane` draws its chrome dividers and a
693
705
  `TabBar` its overflow dividers; they report committed changes via
@@ -923,6 +935,10 @@ created, input }`. Never use a hand-styled `<input list>` + `<datalist>`.
923
935
  `@kerfjs/ui/progress-ring`): `value` of `max` (omit `value` for
924
936
  indeterminate), a `label`, `valueText`, tones. Never use `wa-progress-bar` or
925
937
  `wa-progress-ring`.
938
+ - **Read a live rate at a glance with `Gauge`** (`@kerfjs/ui/gauge`): a
939
+ speedometer dial named by `label`, `value` of `max` (pinned past `max`),
940
+ `valueText`, `unit`, `variant` `full` or `bare` (chip height), `tone`,
941
+ `size`, and typed `colors` for a consumer palette. Not for progress.
926
942
  - **Pick a value on a range with `Slider`** (`@kerfjs/ui/slider`): a native
927
943
  range input drawn as a track, fill, and thumb, with `showValue`/`unit`,
928
944
  `ticks`, and `hint`; call `wireSliders(root)` once. Never use `wa-slider`.
@@ -1015,7 +1031,12 @@ created, input }`. Never use a hand-styled `<input list>` + `<datalist>`.
1015
1031
  (default 99, so 128 shows "99+"); a count of 0 shows nothing. The group owns
1016
1032
  the corner placement, the ring against its surface, and compact sizing. The
1017
1033
  badge is `aria-hidden`, so name the count in the button's `ariaLabel` and
1018
- `title`.
1034
+ `title`. A `SegmentedControl` choice (such as a toolbar view switcher's)
1035
+ takes the same `badge`, `badgeTone`, and `badgeMax`; the control owns its
1036
+ placement over the choice's icon and its ring against the segment's fill.
1037
+ Name the count in the choice's `label` and `title`, and give a badged
1038
+ choice its own `content` (its `label` is otherwise also the visible text).
1039
+ Never imitate an exclusive view switch with group buttons to get a badge.
1019
1040
  For app-supplied text that can run long (a tag or category name), set
1020
1041
  `maxWidth` (a `CssLength`, such as `px(160)`): the label truncates with an
1021
1042
  ellipsis and string or number content becomes the hover `title`.
@@ -1193,6 +1214,7 @@ Key conditional `StateBanner` siblings with `rootAttributes={{ "data-key": "…"
1193
1214
 
1194
1215
  Key sibling `DialogSurface`s that render conditionally with `rootAttributes={{ "data-key": "…" }}` so a re-render morphs each dialog into itself; never wrap one in a keyed app `div`. Modal `DialogSurface` bounds use typed `viewportGutter` and `maxHeight` (`CssLength` or `"viewport"`); explicit caps stay within the dynamic viewport minus both gutters. Omitted props keep the default caps (20px clear of each edge, 80% of the viewport height at 420px wide or narrower). Application render state chooses responsive values, and preview layout remains application-owned. `height` sets a definite bounded modal size and `bodyLayout="fill"` lets one child fill the body; `bodyLayout="fill-last"` keeps leading rows at their height above one filling last child, and `footerPresentation="floating"` (with a typed `footerOffset`) floats a chat composer over the body while the body reserves its measured height; give the transcript `scrollClearance="block-end"` (a `scrollable` `List` or a `Pane`) to let it scroll beneath the composer, with the last message still resting above it, through the published `--kui-scroll-clearance-block-end` context (overlaying chrome publishes `--kui-scroll-clearance-block-start` / `-end`; one scroller per covered edge opts in; a composed Pane opts in through `PaneConfig.scrollClearance` on a Workbench `mainPane` or panel `pane`, a `CollapsiblePanel` `pane`, or a `NavStack` view's `pane`). `headerPresentation="floating"` lays the title bar over the body on the translucent `--kui-chrome-material-raised` (opaque under reduced transparency, increased contrast, and forced colors); the register measures it and the body reserves it, and a `fill` body's only child with `scrollClearance="both"` scrolls beneath both the title bar and a floating composer through the published `--kui-scroll-clearance-block-start`. `presentation="bottom-sheet"` attaches the dialog to the bottom edge with square bottom corners, safe-area and virtual-keyboard clearance behind the panel, and a slide in/out (`enterMotion` / `exitMotion`); `resizable` adds a top grabber separator bounded by `minHeight` and `maxHeight`. `PopoverDialogSurface` is the non-modal, light-dismiss counterpart on the native Popover API, with the same size props and an `embedded` in-flow presentation; `describedBy` sets its `aria-describedby` (usually a title `ToolbarText`'s `descriptionId`).
1195
1216
  Render a non-modal dialog as `PopoverDialogSurface`; `dismiss="manual"` keeps a request open until it is answered, and `anchorName` docks it to an app region named with the same CSS `anchor-name`.
1217
+ Render a panel the person can pin and move (a library, a palette) as `PinnablePopoverSurface` and call `wirePinnablePopover(surface, { pinned, placement, onChange })`: transient below its `popoverTarget` control with light dismiss; pinned (its Pin toggle or `pinPopover`, read with `isPopoverPinned`) it stays open, drags by its title, moves with the arrow keys, resizes, and stays in the viewport gutter; the app stores what `onChange` reports.
1196
1218
 
1197
1219
  Render a modal dialog as `DialogSurface` itself, a native `<dialog>` (`alert` renders `role="alertdialog"` for a destructive confirmation; pair it with `describedBy` on the message): `label` (or `labelledBy` with a `heading`, such as an xl `ToolbarText` with a description) names it, `describedBy` (the heading ToolbarText's `descriptionId`, or app-owned summary copy) describes it as `aria-describedby`, `children` is its body, `footer` holds its buttons, and `headerActions` sit before its close button (`withoutHeader` drops the header for content that owns its heading and close control). Open it with `openDialog(dialog)` and close it with `closeDialog(dialog)` from `@kerfjs/ui/surface-scaffold`; never toggle its `open` attribute. The close button, any `data-dialog-close` element inside (a Cancel button), Escape, and, with `lightDismiss`, a backdrop press dispatch a cancelable `kui-request-close` (`detail.source`: `close-button`, `escape`, or `backdrop`); cancel it to keep the dialog open (the panel pulses). The native `close` event fires once it closes. `openDialog` installs the listeners and, while the dialog is open, measures its floating header/footer, follows a bottom sheet's keyboard and grabber, and keeps that state across re-renders; import `@kerfjs/ui/surface-scaffold/register` only when a dialog may open some other way. Do not write `wa-dialog` inside a `DialogSurface`.
1198
1220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerfjs/ui",
3
- "version": "5.0.0-beta.124",
3
+ "version": "5.0.0-beta.126",
4
4
  "description": "Accessible, composable UI primitives for kerf applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,6 +40,7 @@
40
40
  "sideEffects": [
41
41
  "**/*.css",
42
42
  "./dist/browser/*.js",
43
+ "./src/components/actions/popup-menu/register/popup-menu-register.ts",
43
44
  "./dist/select-register.js",
44
45
  "./dist/popup-menu-register.js",
45
46
  "./dist/help-tags-register.js",
@@ -353,6 +354,11 @@
353
354
  "browser": "./dist/browser/progress-ring.js",
354
355
  "import": "./dist/progress-ring.js"
355
356
  },
357
+ "./gauge": {
358
+ "types": "./dist/gauge.d.ts",
359
+ "browser": "./dist/browser/gauge.js",
360
+ "import": "./dist/gauge.js"
361
+ },
356
362
  "./loading-spinner": {
357
363
  "types": "./dist/loading-spinner.d.ts",
358
364
  "browser": "./dist/browser/loading-spinner.js",
@@ -692,6 +698,7 @@
692
698
  "./loading-spinner.css": "./dist/styles/loading-spinner.css",
693
699
  "./progress-bar.css": "./dist/styles/progress-bar.css",
694
700
  "./progress-ring.css": "./dist/styles/progress-ring.css",
701
+ "./gauge.css": "./dist/styles/gauge.css",
695
702
  "./select.css": "./dist/styles/select.css",
696
703
  "./popup-menu.css": "./dist/styles/popup-menu.css",
697
704
  "./anchored-surface.css": "./dist/styles/anchored-surface.css",
@@ -747,6 +754,7 @@
747
754
  "vite-ux-review.d.mts",
748
755
  "view",
749
756
  "props",
757
+ "scripts/lib/cli-args.mjs",
750
758
  "scripts/lib/json-schema-subset.mjs",
751
759
  "scripts/component-catalog-extension-validation.mjs",
752
760
  "analyzer",
@@ -859,7 +867,7 @@
859
867
  "@typescript-eslint/parser": "^8.65.0",
860
868
  "@vitest/coverage-v8": "^4.1.12",
861
869
  "axe-core": "^4.14.0",
862
- "domotion-svg": "^0.30.1",
870
+ "domotion-svg": "^0.35.0",
863
871
  "esbuild": "^0.25.0",
864
872
  "eslint": "^10.8.0",
865
873
  "eslint-plugin-simple-import-sort": "^12.1.1",
package/props/cli.mjs CHANGED
@@ -5,11 +5,18 @@
5
5
  // Reads package.json#kerfComponentCatalog: `output` (the composition catalog
6
6
  // create-kerf-component writes), `propsOutput` (where to write), and an
7
7
  // optional `propsOverlay` of inspector hints. Run after the package's build.
8
- import { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
8
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
9
9
  import { resolve } from 'node:path';
10
10
  import process from 'node:process';
11
11
  import { fileURLToPath } from 'node:url';
12
12
 
13
+ import {
14
+ CLI_USAGE_EXIT,
15
+ isMainModule,
16
+ parseCliArguments,
17
+ readJsonFile,
18
+ wantsHelp,
19
+ } from '../scripts/lib/cli-args.mjs';
13
20
  import { validateJsonSchemaSubset } from '../scripts/lib/json-schema-subset.mjs';
14
21
  import { buildPackageComponentProps } from './component-props.mjs';
15
22
 
@@ -18,30 +25,51 @@ const USAGE = `Usage: kerf-ui-props (--write | --check) [--root <package directo
18
25
  Reads package.json#kerfComponentCatalog.output (composition catalog),
19
26
  .propsOutput (destination), and optional .propsOverlay (inspector hints).
20
27
  Run it after building the package: it reads the built declarations.
28
+
29
+ Options:
30
+ --write write the props catalog
31
+ --check fail when the props catalog is missing or stale
32
+ --root <path> package directory (default: current directory)
33
+ -h, --help show this help
34
+
35
+ Exit codes: 0 success, 1 stale catalog or schema problems, 2 usage or
36
+ input error.
21
37
  `;
22
38
 
23
- const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
39
+ // Every read names its file on failure (missing, unreadable, invalid JSON).
40
+ const readJson = (path) => readJsonFile(path);
24
41
  const schemaPath = fileURLToPath(
25
42
  new URL('../ai/component-props.schema.json', import.meta.url),
26
43
  );
27
44
 
28
45
  /** Runs one invocation; returns `{ code, output }` instead of exiting, for tests. */
29
46
  export function run(argv) {
30
- const write = argv.includes('--write');
31
- const check = argv.includes('--check');
32
- const rootFlag = argv.indexOf('--root');
33
- const known = new Set(['--write', '--check', '--root']);
34
- const unknown = argv.filter(
35
- (item, index) => !known.has(item) && argv[index - 1] !== '--root',
36
- );
37
- if (
38
- write === check ||
39
- unknown.length ||
40
- (rootFlag >= 0 && !argv[rootFlag + 1])
41
- ) {
42
- return { code: 2, output: USAGE };
47
+ if (wantsHelp(argv)) return { code: 0, output: USAGE };
48
+ let options;
49
+ try {
50
+ ({ options } = parseCliArguments(argv, {
51
+ values: { '--root': 'root' },
52
+ flags: { '--write': 'write', '--check': 'check' },
53
+ }));
54
+ if (options.write === options.check)
55
+ throw new Error('choose exactly one of --write or --check');
56
+ } catch (error) {
57
+ return { code: 2, output: `kerf-ui-props: ${error.message}\n\n${USAGE}` };
58
+ }
59
+ const write = options.write === true;
60
+ const root = resolve(options.root ?? process.cwd());
61
+ try {
62
+ return runIn(root, write);
63
+ } catch (error) {
64
+ return {
65
+ code: CLI_USAGE_EXIT,
66
+ output: `kerf-ui-props: ${error.message}\n`,
67
+ };
43
68
  }
44
- const root = resolve(rootFlag >= 0 ? argv[rootFlag + 1] : process.cwd());
69
+ }
70
+
71
+ /** Writes or checks the props catalog of the package at `root`. */
72
+ function runIn(root, write) {
45
73
  const packagePath = resolve(root, 'package.json');
46
74
  if (!existsSync(packagePath)) {
47
75
  return { code: 2, output: `kerf-ui-props: no package.json in ${root}\n` };
@@ -105,11 +133,9 @@ export function run(argv) {
105
133
  };
106
134
  }
107
135
 
108
- if (
109
- process.argv[1] &&
110
- // npm runs bins through symlinks (node_modules/.bin), so compare real paths.
111
- realpathSync(resolve(process.argv[1])) === fileURLToPath(import.meta.url)
112
- ) {
136
+ // npm runs bins through symlinks (node_modules/.bin); isMainModule compares
137
+ // real paths.
138
+ if (isMainModule(import.meta.url)) {
113
139
  const result = run(process.argv.slice(2));
114
140
  (result.code === 0 ? process.stdout : process.stderr).write(result.output);
115
141
  process.exitCode = result.code;
@@ -0,0 +1,98 @@
1
+ // The shared argument contract for every @kerfjs/ui bin (KF-FSCXYT: uniform
2
+ // --help; KF-7NZM4K: missing values and unknown flags are usage errors, and
3
+ // file problems name the file). Each bin prints its usage and exits 0 on
4
+ // --help / -h without doing any work, and reports a usage or input error as
5
+ // `<bin>: <message>` with exit status 2.
6
+ import { readFileSync, realpathSync } from 'node:fs';
7
+ import { resolve } from 'node:path';
8
+ import process from 'node:process';
9
+ import { fileURLToPath } from 'node:url';
10
+
11
+ /** Exit status for a usage, configuration, or input-file error. */
12
+ export const CLI_USAGE_EXIT = 2;
13
+
14
+ /** True when `--help` or `-h` appears anywhere in `argv`. */
15
+ export function wantsHelp(argv) {
16
+ return argv.includes('--help') || argv.includes('-h');
17
+ }
18
+
19
+ /**
20
+ * Parses `argv` against a declared option set and throws on anything else.
21
+ *
22
+ * - `values` maps a flag that takes a value to its option key.
23
+ * - `repeatable` lists value flags that may repeat (collected into arrays).
24
+ * - `flags` maps a boolean flag to its option key.
25
+ * - `positionals` allows bare arguments (returned in order); otherwise a bare
26
+ * argument is an unknown argument.
27
+ */
28
+ export function parseCliArguments(
29
+ argv,
30
+ { values = {}, repeatable = [], flags = {}, positionals = false } = {},
31
+ ) {
32
+ const options = {};
33
+ for (const flag of repeatable) options[values[flag]] = [];
34
+ const bare = [];
35
+ const unknown = [];
36
+ for (let index = 0; index < argv.length; index += 1) {
37
+ const argument = argv[index];
38
+ if (Object.hasOwn(values, argument)) {
39
+ const value = argv[index + 1];
40
+ if (value === undefined || value === '' || value.startsWith('--'))
41
+ throw new Error(`${argument} requires a value.`);
42
+ index += 1;
43
+ const key = values[argument];
44
+ if (repeatable.includes(argument)) options[key].push(value);
45
+ else options[key] = value;
46
+ } else if (Object.hasOwn(flags, argument)) {
47
+ options[flags[argument]] = true;
48
+ } else if (!argument.startsWith('-') && positionals) {
49
+ bare.push(argument);
50
+ } else {
51
+ unknown.push(argument);
52
+ }
53
+ }
54
+ if (unknown.length)
55
+ throw new Error(`Unknown arguments: ${unknown.join(' ')}`);
56
+ return { options, positionals: bare };
57
+ }
58
+
59
+ /**
60
+ * Reads and parses a JSON file, naming the file in every failure:
61
+ * `<path>: file not found`, `<path>: invalid JSON: …`, or `<path>: <reason>`.
62
+ */
63
+ export function readJsonFile(path, label = path) {
64
+ let text;
65
+ try {
66
+ text = readFileSync(path, 'utf8');
67
+ } catch (error) {
68
+ throw new Error(
69
+ error?.code === 'ENOENT'
70
+ ? `${label}: file not found`
71
+ : `${label}: ${error?.message ?? String(error)}`,
72
+ { cause: error },
73
+ );
74
+ }
75
+ try {
76
+ return JSON.parse(text);
77
+ } catch (error) {
78
+ throw new Error(`${label}: invalid JSON: ${error.message}`, {
79
+ cause: error,
80
+ });
81
+ }
82
+ }
83
+
84
+ /**
85
+ * True when the module at `moduleUrl` is the process entry point. npm runs
86
+ * bins through `node_modules/.bin` symlinks, so both sides are real paths.
87
+ */
88
+ export function isMainModule(moduleUrl) {
89
+ const entry = process.argv[1];
90
+ if (!entry) return false;
91
+ try {
92
+ return (
93
+ realpathSync(resolve(entry)) === realpathSync(fileURLToPath(moduleUrl))
94
+ );
95
+ } catch {
96
+ return false;
97
+ }
98
+ }
@@ -60,7 +60,7 @@ export const createRecipe: RecipeFactory = (announce) => {
60
60
  action="recipe-action"
61
61
  appearance="toolbar"
62
62
  shape="pill"
63
- size="small"
63
+ size="compact"
64
64
  choices={[
65
65
  { value: 'list', label: 'List' },
66
66
  { value: 'board', label: 'Board' },
@@ -139,7 +139,7 @@ export const createRecipe: RecipeFactory = (announce) => {
139
139
  value="details"
140
140
  appearance="toolbar"
141
141
  shape="pill"
142
- size="small"
142
+ size="compact"
143
143
  placeholder={p}
144
144
  choices={[
145
145
  {
@@ -0,0 +1,229 @@
1
+ // The catalog side of @kerfjs/ui/view: indexes component-props and
2
+ // composition documents (createViewCatalog), resolves prop types, and maps
3
+ // field zones (a content field inside a prop value) to the prop path they
4
+ // fill. Shared by the validator, the generator, and the interpreter.
5
+
6
+ export const isObject = (value) =>
7
+ value !== null && typeof value === 'object' && !Array.isArray(value);
8
+ export const keyOf = (type) => type.split('#')[0];
9
+
10
+ /**
11
+ * Indexes component-props and composition documents for validation. Each
12
+ * component keeps the `definitions` table of the document that declared it,
13
+ * so two packages' same-named types never collide.
14
+ */
15
+ export function createViewCatalog({ props = [], composition = [] }) {
16
+ const components = new Map();
17
+ for (const document of props) {
18
+ for (const component of document.components ?? []) {
19
+ components.set(component.key, {
20
+ component,
21
+ definitions: document.definitions ?? {},
22
+ });
23
+ }
24
+ }
25
+ const entries = new Map();
26
+ // A config type another component renders as an entry (KF-THTR71), keyed
27
+ // `package:TypeName` since type names are only unique within a package.
28
+ const configParents = new Map();
29
+ for (const document of composition) {
30
+ for (const entry of document.entries ?? []) {
31
+ entries.set(entry.key, entry);
32
+ for (const name of entry.configTypes ?? [])
33
+ configParents.set(
34
+ `${keyOf(entry.key).split(':')[0]}:${name}`,
35
+ entry.key,
36
+ );
37
+ }
38
+ }
39
+ return { components, entries, configParents };
40
+ }
41
+
42
+ export function resolveType(type, definitions) {
43
+ let current = type;
44
+ for (let hops = 0; current?.kind === 'ref' && hops < 32; hops += 1) {
45
+ current = definitions[current.ref];
46
+ }
47
+ return current ?? { kind: 'unknown' };
48
+ }
49
+
50
+ export const propsOf = (type, definitions) =>
51
+ resolveType(type, definitions).props;
52
+
53
+ /** A type, or each member of a union of it (unions of unions flattened). */
54
+ function membersOf(type, definitions) {
55
+ const resolved = resolveType(type, definitions);
56
+ return resolved.kind === 'union'
57
+ ? resolved.members.flatMap((member) => membersOf(member, definitions))
58
+ : [resolved];
59
+ }
60
+
61
+ const INDEX = /^\d+$/;
62
+
63
+ /**
64
+ * A zone key that names a content field inside a prop value (KF-PD6QC5:
65
+ * field zones): the prop, then field names and list indexes, dot-separated
66
+ * (`leftRail.content`, `mainToolbar.title`, `views.0.content`). Walks the
67
+ * prop's type through refs, union members, objects (never a field the type
68
+ * forbids), and lists, and ends at rendered content. Returns the prop, the
69
+ * path inside its value, and whether the field takes text; undefined for any
70
+ * other key.
71
+ */
72
+ export function fieldZoneOf(component, definitions, key) {
73
+ const walked = walkField(component, definitions, key);
74
+ if (!walked) return undefined;
75
+ const content = walked.types
76
+ .flatMap((type) => membersOf(type, definitions))
77
+ .find((type) => type.kind === 'content');
78
+ return content
79
+ ? {
80
+ prop: walked.name,
81
+ path: walked.path.map((step) =>
82
+ INDEX.test(step) ? Number(step) : step,
83
+ ),
84
+ text: content.acceptsText === true,
85
+ }
86
+ : undefined;
87
+ }
88
+
89
+ /**
90
+ * The types a field zone key reaches in a component's prop value, with the
91
+ * named types (`ref`s) of the value that holds that field: a NavStack view's
92
+ * `views.0.toolbar.leading` is held by a `NavStackViewToolbar`.
93
+ */
94
+ function walkField(component, definitions, key) {
95
+ if (typeof key !== 'string' || !key.includes('.')) return undefined;
96
+ const [name, ...path] = key.split('.');
97
+ const prop = component.props.find((item) => item.name === name);
98
+ if (!prop || prop.slot || prop.zone) return undefined;
99
+ let types = [prop.type];
100
+ let holders = [];
101
+ for (const step of path) {
102
+ holders = types.flatMap((type) => (type.kind === 'ref' ? [type.ref] : []));
103
+ const next = [];
104
+ for (const type of types.flatMap((item) => membersOf(item, definitions))) {
105
+ if (INDEX.test(step)) {
106
+ if (type.kind === 'array') next.push(type.items);
107
+ continue;
108
+ }
109
+ const field =
110
+ type.kind === 'object'
111
+ ? type.props?.find((item) => item.name === step)
112
+ : undefined;
113
+ if (field && resolveType(field.type, definitions).kind !== 'never')
114
+ next.push(field.type);
115
+ }
116
+ if (!next.length) return undefined;
117
+ types = next;
118
+ }
119
+ return { name, path, types, holders };
120
+ }
121
+
122
+ /**
123
+ * The component a field zone's children are placed in (KF-THTR71): a
124
+ * content field inside a value another component renders, such as a
125
+ * NavStack view's toolbar config, which renders as a Toolbar. A config type
126
+ * may name one field (`ListDetailDialogList.toolbar`) when only that field
127
+ * renders in the component. Undefined when neither the field nor its holder
128
+ * is cataloged.
129
+ */
130
+ export function fieldParent(ctx, node, component, definitions, key) {
131
+ const pkg = keyOf(node.type).split(':')[0];
132
+ const walked = walkField(component, definitions, key);
133
+ const field = walked?.path.at(-1);
134
+ for (const holder of walked?.holders ?? []) {
135
+ // KF-WBH5P2: one field of a holder that renders only that field in
136
+ // another component (`ListDetailDialogList.toolbar` in a Toolbar)
137
+ // names it alone; the whole holder's mapping is the fallback.
138
+ const parent =
139
+ ctx.catalog.configParents?.get(`${pkg}:${holder}.${field}`) ??
140
+ ctx.catalog.configParents?.get(`${pkg}:${holder}`);
141
+ if (parent) return parent;
142
+ }
143
+ return undefined;
144
+ }
145
+
146
+ /**
147
+ * Where a field zone's children go in a prop value while it is checked,
148
+ * interpreted, or generated: a placeholder no document can spell, so it
149
+ * never reads as a literal of the document's own.
150
+ */
151
+ export class ZoneFill {
152
+ constructor(key, children) {
153
+ this.key = key;
154
+ this.children = children;
155
+ }
156
+ }
157
+
158
+ /**
159
+ * A prop value as a problem quotes it: JSON, with each field zone written as
160
+ * `<zone key>` rather than its nodes (KF-20GMVX), so the message stays short
161
+ * and does not change when something inside the zone does.
162
+ */
163
+ export function quoteValue(value) {
164
+ return JSON.stringify(value, (_key, item) =>
165
+ item instanceof ZoneFill ? `<zone ${item.key}>` : item,
166
+ );
167
+ }
168
+
169
+ /** `value` with `fill` at `path`, copying each object and list on the way. */
170
+ function withAt(value, path, fill) {
171
+ if (!path.length) return fill;
172
+ const [step, ...rest] = path;
173
+ if (typeof step === 'number') {
174
+ const list = Array.isArray(value) ? [...value] : [];
175
+ list[step] = withAt(list[step], rest, fill);
176
+ return list;
177
+ }
178
+ const object = isObject(value) ? { ...value } : {};
179
+ object[step] = withAt(object[step], rest, fill);
180
+ return object;
181
+ }
182
+
183
+ /** Whether a value is a binding (`$param`, `$bind`, …) rather than a literal. */
184
+ export const isBinding = (value) =>
185
+ isObject(value) && Object.keys(value).some((key) => key.startsWith('$'));
186
+
187
+ /**
188
+ * `props` with each filled field zone's placeholder (a `ZoneFill`) at its
189
+ * path, so the zone fills that content field (KF-PD6QC5). A prop held by a
190
+ * binding is left alone; validation reports the clash.
191
+ */
192
+ export function withFieldZones(props, zones, component, definitions) {
193
+ let merged = props;
194
+ for (const key of Object.keys(zones)) {
195
+ const field = fieldZoneOf(component, definitions, key);
196
+ if (!field || !zones[key].length || isBinding(merged[field.prop])) continue;
197
+ merged = {
198
+ ...merged,
199
+ [field.prop]: withAt(
200
+ merged[field.prop],
201
+ field.path,
202
+ new ZoneFill(key, zones[key]),
203
+ ),
204
+ };
205
+ }
206
+ return merged;
207
+ }
208
+
209
+ /**
210
+ * How a component carries application `data-*` attributes (the node marker
211
+ * and a row key): its `rootAttributes` prop, a Web Awesome element's own
212
+ * attributes, or nothing. A generated `dataChannel` field wins when present.
213
+ */
214
+ export function channelOf(component) {
215
+ if (component.dataChannel) return component.dataChannel;
216
+ if (component.source === 'webawesome') return 'attributes';
217
+ return component.props.some((prop) => prop.name === 'rootAttributes')
218
+ ? 'rootAttributes'
219
+ : 'none';
220
+ }
221
+
222
+ /** The prop a zone key fills: the composition zone's binding or the prop itself. */
223
+ export function zonePropOf(catalog, component, key) {
224
+ const entry = component.key.includes('#')
225
+ ? undefined
226
+ : catalog.entries.get(component.key);
227
+ const zone = entry?.zones?.find((item) => item.id === key && item.jsx?.prop);
228
+ return zone ? zone.jsx.prop : key;
229
+ }
@@ -0,0 +1,22 @@
1
+ // childKind: the one place that tells a view child's kind apart (KF-TZKGBZ:
2
+ // one shared child-kind dispatch). A child is an `$each` list, an `$if`
3
+ // branch, a `$slot` placement, a composed `#view` node, or a component node;
4
+ // every walker switches on this instead of repeating the `in` checks, so a
5
+ // new control-flow kind has one place to be added.
6
+
7
+ /** The kind of a view child: `each`, `if`, `slot`, `view`, or `node`. */
8
+ export function childKind(child) {
9
+ if ('$each' in child) return 'each';
10
+ if ('$if' in child) return 'if';
11
+ if ('$slot' in child) return 'slot';
12
+ return child.type === '#view' ? 'view' : 'node';
13
+ }
14
+
15
+ /**
16
+ * The child with its kind, as a value TypeScript narrows on: switching on
17
+ * `classifyChild(child).kind` makes `.child` the `$each`, `$if`, `$slot`, or
18
+ * node shape in each case.
19
+ */
20
+ export function classifyChild(child) {
21
+ return { kind: childKind(child), child };
22
+ }