@kerfjs/ui 5.0.0-beta.123 → 5.0.0-beta.124
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.
- package/README.md +28 -5
- package/ai/application-ui-diagnostic-ids-v1.json +25 -1
- package/ai/application-ui-profile-sync.cjs +16 -8
- package/ai/application-ui-profile.d.ts +2 -0
- package/ai/application-ui-profile.defaults.json +6 -2
- package/ai/application-ui-profile.mjs +16 -8
- package/ai/application-ui-profile.schema.json +133 -38
- package/ai/component-catalog.json +1499 -213
- package/ai/component-catalog.schema.json +19 -0
- package/ai/component-composition-rules.json +18 -2
- package/ai/component-composition.d.ts +13 -0
- package/ai/component-composition.json +684 -25
- package/ai/component-composition.schema.json +58 -0
- package/ai/component-props-overlay.json +952 -0
- package/ai/component-props-overlay.schema.json +68 -0
- package/ai/component-props.json +29624 -0
- package/ai/component-props.schema.json +401 -0
- package/ai/components/README.md +11 -4
- package/ai/components/application-tabs.md +2 -2
- package/ai/components/backdrop-image.md +2 -1
- package/ai/components/button.md +12 -6
- package/ai/components/checkbox-group.md +2 -0
- package/ai/components/checkbox.md +2 -0
- package/ai/components/chip.md +2 -0
- package/ai/components/choice-chips.md +5 -1
- package/ai/components/color-field.md +2 -0
- package/ai/components/color-picker.md +2 -0
- package/ai/components/color-swatches.md +2 -0
- package/ai/components/column-explorer.md +89 -0
- package/ai/components/column-track.md +3 -2
- package/ai/components/combobox.md +2 -0
- package/ai/components/content-item.md +7 -2
- package/ai/components/disclosure.md +2 -0
- package/ai/components/file-picker.md +5 -2
- package/ai/components/form.md +86 -0
- package/ai/components/foundation.md +1 -1
- package/ai/components/list-action-row.md +2 -0
- package/ai/components/list-detail-dialog.md +2 -0
- package/ai/components/list-header.md +2 -0
- package/ai/components/list-item.md +4 -0
- package/ai/components/list.md +6 -2
- package/ai/components/message-composer.md +3 -1
- package/ai/components/nav-stack.md +2 -0
- package/ai/components/paged-view.md +89 -0
- package/ai/components/pane.md +4 -1
- package/ai/components/popup-menu.md +5 -2
- package/ai/components/radio-group.md +2 -0
- package/ai/components/recipe-composer-form.md +2 -2
- package/ai/components/scroll-effect.md +84 -0
- package/ai/components/search-field.md +2 -0
- package/ai/components/segmented-control.md +2 -0
- package/ai/components/select.md +4 -0
- package/ai/components/sized-region.md +86 -0
- package/ai/components/slider.md +2 -0
- package/ai/components/split-button.md +3 -1
- package/ai/components/split-view.md +1 -1
- package/ai/components/state-banner.md +2 -0
- package/ai/components/summary-row.md +14 -8
- package/ai/components/surface-scaffold.md +5 -3
- package/ai/components/switch.md +2 -0
- package/ai/components/tab-bar.md +5 -2
- package/ai/components/tab-navigator.md +2 -0
- package/ai/components/tab-panel.md +84 -0
- package/ai/components/tabs.md +6 -2
- package/ai/components/tag-field.md +2 -0
- package/ai/components/text-field.md +2 -0
- package/ai/components/text.md +3 -0
- package/ai/components/toolbar-control-group.md +10 -3
- package/ai/components/toolbar-text.md +2 -0
- package/ai/components/toolbar.md +4 -3
- package/ai/components/tree-list.md +95 -0
- package/ai/components/wa-accordion-item.md +2 -0
- package/ai/components/wa-breadcrumb-item.md +2 -0
- package/ai/components/wa-button.md +2 -0
- package/ai/components/wa-carousel.md +2 -0
- package/ai/components/wa-checkbox.md +2 -0
- package/ai/components/wa-color-picker.md +2 -0
- package/ai/components/wa-comparison.md +2 -0
- package/ai/components/wa-copy-button.md +2 -0
- package/ai/components/wa-details.md +2 -0
- package/ai/components/wa-dialog.md +2 -0
- package/ai/components/wa-drawer.md +2 -0
- package/ai/components/wa-dropdown-item.md +2 -0
- package/ai/components/wa-input.md +2 -0
- package/ai/components/wa-known-date.md +2 -0
- package/ai/components/wa-number-input.md +2 -0
- package/ai/components/wa-otp-input.md +2 -0
- package/ai/components/wa-pagination.md +2 -0
- package/ai/components/wa-radio.md +2 -0
- package/ai/components/wa-rating.md +2 -0
- package/ai/components/wa-select.md +2 -0
- package/ai/components/wa-slider.md +2 -0
- package/ai/components/wa-switch.md +2 -0
- package/ai/components/wa-tab-panel.md +5 -5
- package/ai/components/wa-tab.md +2 -0
- package/ai/components/wa-tag-input.md +2 -0
- package/ai/components/wa-textarea.md +2 -0
- package/ai/components/wa-time-input.md +2 -0
- package/ai/components/wa-tree-item.md +12 -5
- package/ai/components/wa-tree.md +10 -5
- package/ai/components/wa-zoomable-frame.md +2 -0
- package/ai/components/workbench-dialog.md +2 -0
- package/ai/public-api-signatures-v1.md +1249 -127
- package/ai/skill.md +106 -39
- package/ai/view-document.schema.json +360 -0
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/analyzer/index.mjs +89 -1
- package/dist/anchor-name-BZ1rpxaw.d.ts +4 -0
- package/dist/backdrop-image.d.ts +6 -2
- package/dist/backdrop-image.js +2 -1
- package/dist/badge.js +1 -1
- package/dist/browser/backdrop-image.js +1 -0
- package/dist/browser/catalog.js +1 -1
- package/dist/browser/collapsible-panel.js +1 -0
- package/dist/browser/column-explorer.js +9 -0
- package/dist/browser/content-item.js +1 -0
- package/dist/browser/editor.js +45 -0
- package/dist/browser/form.js +3 -0
- package/dist/browser/list-detail-dialog.js +1 -0
- package/dist/browser/nav-stack.js +1 -0
- package/dist/browser/paged-view.js +3 -0
- package/dist/browser/scroll-effect.js +3 -0
- package/dist/browser/sized-region.js +3 -0
- package/dist/browser/split-view.js +1 -0
- package/dist/browser/tab-panel.js +3 -0
- package/dist/browser/toolbar-control-group.js +1 -0
- package/dist/browser/tree-list.js +7 -0
- package/dist/browser/workbench-dialog.js +1 -0
- package/dist/browser/workbench.js +1 -0
- package/dist/button.d.ts +54 -13
- package/dist/button.js +2 -1
- package/dist/catalog-resources.d.ts +3 -2
- package/dist/catalog.d.ts +3 -2
- package/dist/catalog.js +21 -17
- package/dist/catalog.js.map +1 -1
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip.js +1 -1
- package/dist/choice-chips.d.ts +21 -2
- package/dist/choice-chips.js +2 -1
- package/dist/{chunk-3WWX2O4G.js → chunk-2E7S5C4D.js} +5 -46
- package/dist/chunk-2E7S5C4D.js.map +1 -0
- package/dist/{chunk-QYMJHS4K.js → chunk-34FWYJX6.js} +9 -3
- package/dist/chunk-34FWYJX6.js.map +1 -0
- package/dist/{chunk-OUCHU7JB.js → chunk-3JOEJT2Z.js} +7 -7
- package/dist/{chunk-OUCHU7JB.js.map → chunk-3JOEJT2Z.js.map} +1 -1
- package/dist/chunk-3S3WXAZ5.js +207 -0
- package/dist/chunk-3S3WXAZ5.js.map +1 -0
- package/dist/{chunk-AN5IWMTM.js → chunk-3TBMGGTA.js} +6 -3
- package/dist/chunk-3TBMGGTA.js.map +1 -0
- package/dist/{chunk-3Z7N2NAZ.js → chunk-3XSY5LAB.js} +4 -4
- package/dist/{chunk-3Z7N2NAZ.js.map → chunk-3XSY5LAB.js.map} +1 -1
- package/dist/chunk-44AOBT2F.js +16 -0
- package/dist/chunk-44AOBT2F.js.map +1 -0
- package/dist/{chunk-YWLDLNAV.js → chunk-4IXG6XCT.js} +18 -3
- package/dist/chunk-4IXG6XCT.js.map +1 -0
- package/dist/chunk-4K7XXSOX.js +21 -0
- package/dist/chunk-4K7XXSOX.js.map +1 -0
- package/dist/{chunk-LZUUUHNH.js → chunk-4Z4QSTRF.js} +20 -3
- package/dist/chunk-4Z4QSTRF.js.map +1 -0
- package/dist/{chunk-QH5KOFNS.js → chunk-5KWXM5O7.js} +15 -3
- package/dist/chunk-5KWXM5O7.js.map +1 -0
- package/dist/{chunk-EYDXFOSH.js → chunk-5SFHBYEY.js} +2 -2
- package/dist/chunk-5SFHBYEY.js.map +1 -0
- package/dist/{chunk-HU5IHXCI.js → chunk-6BXPN5SC.js} +3 -3
- package/dist/{chunk-HU5IHXCI.js.map → chunk-6BXPN5SC.js.map} +1 -1
- package/dist/{chunk-6VVIW7VB.js → chunk-73LC3JAL.js} +13 -4
- package/dist/chunk-73LC3JAL.js.map +1 -0
- package/dist/{chunk-IO27YTL3.js → chunk-76VCWWUA.js} +2 -2
- package/dist/{chunk-IO27YTL3.js.map → chunk-76VCWWUA.js.map} +1 -1
- package/dist/{chunk-ETFP7HAR.js → chunk-7AUZG5EW.js} +13 -4
- package/dist/chunk-7AUZG5EW.js.map +1 -0
- package/dist/{chunk-3V4OCDTL.js → chunk-7DIWVGGA.js} +2 -14
- package/dist/chunk-7DIWVGGA.js.map +1 -0
- package/dist/chunk-7KN5OQVN.js +157 -0
- package/dist/chunk-7KN5OQVN.js.map +1 -0
- package/dist/chunk-7QQ3HE47.js +17 -0
- package/dist/chunk-7QQ3HE47.js.map +1 -0
- package/dist/{chunk-WPP5Q4A5.js → chunk-ADMWT7FX.js} +19 -1
- package/dist/chunk-ADMWT7FX.js.map +1 -0
- package/dist/{chunk-LMHN2TJL.js → chunk-BCHK33XL.js} +2 -2
- package/dist/{chunk-LMHN2TJL.js.map → chunk-BCHK33XL.js.map} +1 -1
- package/dist/chunk-BCO673YW.js +123 -0
- package/dist/chunk-BCO673YW.js.map +1 -0
- package/dist/{chunk-OQP3PFKQ.js → chunk-BZXA5SSA.js} +90 -33
- package/dist/chunk-BZXA5SSA.js.map +1 -0
- package/dist/{chunk-LTBVP6VN.js → chunk-C4FBYP2D.js} +2 -2
- package/dist/{chunk-LTBVP6VN.js.map → chunk-C4FBYP2D.js.map} +1 -1
- package/dist/{chunk-AMIHGFLP.js → chunk-CCPWJDRW.js} +4 -2
- package/dist/chunk-CCPWJDRW.js.map +1 -0
- package/dist/{chunk-S4Y3YTAI.js → chunk-CJAKN2KZ.js} +2 -2
- package/dist/{chunk-S4Y3YTAI.js.map → chunk-CJAKN2KZ.js.map} +1 -1
- package/dist/chunk-CKPI4WIN.js +58 -0
- package/dist/chunk-CKPI4WIN.js.map +1 -0
- package/dist/{chunk-HJXVVFBT.js → chunk-CMG4OZPV.js} +13 -2
- package/dist/chunk-CMG4OZPV.js.map +1 -0
- package/dist/{chunk-KH4KEMSP.js → chunk-COQI4OMZ.js} +1 -1
- package/dist/chunk-COQI4OMZ.js.map +1 -0
- package/dist/{chunk-G3J7JDP6.js → chunk-CPTQABDQ.js} +10 -3
- package/dist/chunk-CPTQABDQ.js.map +1 -0
- package/dist/{chunk-TI2GV36S.js → chunk-CRHKWHTA.js} +4 -4
- package/dist/{chunk-TI2GV36S.js.map → chunk-CRHKWHTA.js.map} +1 -1
- package/dist/{chunk-3KFMLOTH.js → chunk-DBP3N6E5.js} +8 -5
- package/dist/chunk-DBP3N6E5.js.map +1 -0
- package/dist/chunk-DJ65XFVN.js +231 -0
- package/dist/chunk-DJ65XFVN.js.map +1 -0
- package/dist/chunk-DKPYHVIV.js +13 -0
- package/dist/chunk-DKPYHVIV.js.map +1 -0
- package/dist/{chunk-ITUQC4FW.js → chunk-DV6GE57V.js} +31 -3
- package/dist/chunk-DV6GE57V.js.map +1 -0
- package/dist/{chunk-S3ECMF23.js → chunk-E7Q6UNCB.js} +11 -3
- package/dist/chunk-E7Q6UNCB.js.map +1 -0
- package/dist/{chunk-C26Q6P4Q.js → chunk-E7ZRBMVQ.js} +3 -3
- package/dist/{chunk-C26Q6P4Q.js.map → chunk-E7ZRBMVQ.js.map} +1 -1
- package/dist/chunk-ECVTRAXN.js +37 -0
- package/dist/chunk-ECVTRAXN.js.map +1 -0
- package/dist/{chunk-EIET4QLK.js → chunk-EHR7R7YP.js} +14 -3
- package/dist/chunk-EHR7R7YP.js.map +1 -0
- package/dist/{chunk-5J6Z4BWY.js → chunk-EXGDKG7B.js} +127 -5
- package/dist/chunk-EXGDKG7B.js.map +1 -0
- package/dist/{chunk-7K6U6FCN.js → chunk-F34LHBQI.js} +47 -12
- package/dist/chunk-F34LHBQI.js.map +1 -0
- package/dist/{chunk-IIQ2XIMU.js → chunk-F3PZGFEA.js} +32 -11
- package/dist/chunk-F3PZGFEA.js.map +1 -0
- package/dist/{chunk-3OP66VXU.js → chunk-FJMABKKV.js} +5 -3
- package/dist/chunk-FJMABKKV.js.map +1 -0
- package/dist/{chunk-B53PS2LE.js → chunk-FNJA4S6J.js} +7 -3
- package/dist/chunk-FNJA4S6J.js.map +1 -0
- package/dist/{chunk-YMUIQRWK.js → chunk-FQETQ7CM.js} +6 -2
- package/dist/chunk-FQETQ7CM.js.map +1 -0
- package/dist/{chunk-KCS6NJ3O.js → chunk-FR5G77K5.js} +2 -2
- package/dist/{chunk-KCS6NJ3O.js.map → chunk-FR5G77K5.js.map} +1 -1
- package/dist/chunk-GVII4JSD.js +153 -0
- package/dist/chunk-GVII4JSD.js.map +1 -0
- package/dist/chunk-HPOXLOVC.js +184 -0
- package/dist/chunk-HPOXLOVC.js.map +1 -0
- package/dist/{chunk-EKHDLBRP.js → chunk-JAC6AVZN.js} +21 -3
- package/dist/chunk-JAC6AVZN.js.map +1 -0
- package/dist/{chunk-CTQUDCY5.js → chunk-JG4ONAOI.js} +4 -2
- package/dist/{chunk-CTQUDCY5.js.map → chunk-JG4ONAOI.js.map} +1 -1
- package/dist/{chunk-K67XBCHG.js → chunk-JHUEYWWI.js} +6 -4
- package/dist/chunk-JHUEYWWI.js.map +1 -0
- package/dist/{chunk-GS2QD3N7.js → chunk-JZZVWTUB.js} +2 -2
- package/dist/{chunk-GS2QD3N7.js.map → chunk-JZZVWTUB.js.map} +1 -1
- package/dist/{chunk-XRZSK2WC.js → chunk-KACJOE2N.js} +16 -5
- package/dist/chunk-KACJOE2N.js.map +1 -0
- package/dist/chunk-KELWWCMX.js +426 -0
- package/dist/chunk-KELWWCMX.js.map +1 -0
- package/dist/{chunk-KDQZ3E5C.js → chunk-KLR3DCHH.js} +58 -4
- package/dist/chunk-KLR3DCHH.js.map +1 -0
- package/dist/{chunk-S3DCRI2M.js → chunk-LD6A6PYB.js} +43 -5
- package/dist/chunk-LD6A6PYB.js.map +1 -0
- package/dist/{chunk-BKUMG2KB.js → chunk-LET362AM.js} +13 -3
- package/dist/chunk-LET362AM.js.map +1 -0
- package/dist/{chunk-C2ZO3OZZ.js → chunk-LOW7J7SE.js} +4 -4
- package/dist/chunk-LOW7J7SE.js.map +1 -0
- package/dist/{chunk-ITENVZ6Q.js → chunk-M72QLDUO.js} +13 -4
- package/dist/chunk-M72QLDUO.js.map +1 -0
- package/dist/{chunk-OHPYT2BH.js → chunk-MLDO7WLA.js} +2 -2
- package/dist/{chunk-OHPYT2BH.js.map → chunk-MLDO7WLA.js.map} +1 -1
- package/dist/{chunk-D5RGM3XA.js → chunk-NA4LKVPX.js} +12 -2
- package/dist/chunk-NA4LKVPX.js.map +1 -0
- package/dist/chunk-NR3ZO4LK.js +67 -0
- package/dist/chunk-NR3ZO4LK.js.map +1 -0
- package/dist/{chunk-YPAQFBMN.js → chunk-NYNNNEAU.js} +44 -10
- package/dist/chunk-NYNNNEAU.js.map +1 -0
- package/dist/chunk-OKZTLRGG.js +34 -0
- package/dist/chunk-OKZTLRGG.js.map +1 -0
- package/dist/{chunk-ZX2QQJXD.js → chunk-PVKAIVKE.js} +95 -61
- package/dist/chunk-PVKAIVKE.js.map +1 -0
- package/dist/{chunk-Y6KT7ZTR.js → chunk-Q2CLQ3IJ.js} +21 -3
- package/dist/chunk-Q2CLQ3IJ.js.map +1 -0
- package/dist/{chunk-2J7XKAZX.js → chunk-Q2SLOMN6.js} +7 -6
- package/dist/chunk-Q2SLOMN6.js.map +1 -0
- package/dist/{chunk-S2XULQEK.js → chunk-Q5BPZPCO.js} +2 -2
- package/dist/{chunk-S2XULQEK.js.map → chunk-Q5BPZPCO.js.map} +1 -1
- package/dist/{chunk-ROEBKSIY.js → chunk-Q7RILH2D.js} +14 -6
- package/dist/chunk-Q7RILH2D.js.map +1 -0
- package/dist/chunk-QR7MGGOM.js +49 -0
- package/dist/chunk-QR7MGGOM.js.map +1 -0
- package/dist/{chunk-PS24PVR6.js → chunk-QXXLDY6I.js} +50 -10
- package/dist/chunk-QXXLDY6I.js.map +1 -0
- package/dist/chunk-QY77Q7RY.js +129 -0
- package/dist/chunk-QY77Q7RY.js.map +1 -0
- package/dist/{chunk-4OV272LF.js → chunk-R6FIXYAE.js} +4 -4
- package/dist/{chunk-4OV272LF.js.map → chunk-R6FIXYAE.js.map} +1 -1
- package/dist/{chunk-N2K3QGSX.js → chunk-RGB4DPMN.js} +16 -3
- package/dist/chunk-RGB4DPMN.js.map +1 -0
- package/dist/{chunk-TKNVL53O.js → chunk-RPJOLDSR.js} +11 -3
- package/dist/chunk-RPJOLDSR.js.map +1 -0
- package/dist/chunk-SBCXWGNP.js +256 -0
- package/dist/chunk-SBCXWGNP.js.map +1 -0
- package/dist/{chunk-WPNIKZMJ.js → chunk-SJBMKA4X.js} +2 -2
- package/dist/{chunk-WPNIKZMJ.js.map → chunk-SJBMKA4X.js.map} +1 -1
- package/dist/{chunk-RMWNO6BA.js → chunk-SNUDT6AX.js} +2 -2
- package/dist/{chunk-RMWNO6BA.js.map → chunk-SNUDT6AX.js.map} +1 -1
- package/dist/{chunk-NR6O74ST.js → chunk-SPI6VMIY.js} +14 -10
- package/dist/chunk-SPI6VMIY.js.map +1 -0
- package/dist/{chunk-ZN7KUMPY.js → chunk-SWXWLSUD.js} +17 -3
- package/dist/chunk-SWXWLSUD.js.map +1 -0
- package/dist/chunk-TBVSPSGX.js +14 -0
- package/dist/chunk-TBVSPSGX.js.map +1 -0
- package/dist/{chunk-UMNHJSIO.js → chunk-TPLVC5BE.js} +2 -2
- package/dist/{chunk-UMNHJSIO.js.map → chunk-TPLVC5BE.js.map} +1 -1
- package/dist/chunk-TRJS7M2H.js +39 -0
- package/dist/chunk-TRJS7M2H.js.map +1 -0
- package/dist/chunk-TXBNPEIJ.js +31 -0
- package/dist/chunk-TXBNPEIJ.js.map +1 -0
- package/dist/{chunk-VEME3D7K.js → chunk-UD5KHQOH.js} +27 -3
- package/dist/chunk-UD5KHQOH.js.map +1 -0
- package/dist/{chunk-5CLMV5YU.js → chunk-UPHPFKAD.js} +54 -18
- package/dist/chunk-UPHPFKAD.js.map +1 -0
- package/dist/{chunk-WVS6CUCT.js → chunk-V3IXAI4L.js} +6 -2
- package/dist/chunk-V3IXAI4L.js.map +1 -0
- package/dist/{chunk-CVD5IZGB.js → chunk-VBXKYT4O.js} +7 -2
- package/dist/chunk-VBXKYT4O.js.map +1 -0
- package/dist/{chunk-OZ6X76G5.js → chunk-VNT4MXR5.js} +4 -3
- package/dist/chunk-VNT4MXR5.js.map +1 -0
- package/dist/{chunk-K57NINLH.js → chunk-VPDSPD76.js} +54 -1
- package/dist/chunk-VPDSPD76.js.map +1 -0
- package/dist/chunk-VX3YF2UD.js +77 -0
- package/dist/chunk-VX3YF2UD.js.map +1 -0
- package/dist/chunk-WCMGPAY2.js +103 -0
- package/dist/chunk-WCMGPAY2.js.map +1 -0
- package/dist/{chunk-DZJ4GBSP.js → chunk-WSPXSWFG.js} +21 -4
- package/dist/chunk-WSPXSWFG.js.map +1 -0
- package/dist/{chunk-NB6POCFH.js → chunk-WVQDIOD7.js} +56 -11
- package/dist/chunk-WVQDIOD7.js.map +1 -0
- package/dist/{chunk-F653O57X.js → chunk-Y4VR6VNM.js} +6 -3
- package/dist/chunk-Y4VR6VNM.js.map +1 -0
- package/dist/{chunk-CEJ5FK6G.js → chunk-YHRJNKD5.js} +2 -2
- package/dist/{chunk-CEJ5FK6G.js.map → chunk-YHRJNKD5.js.map} +1 -1
- package/dist/{chunk-XWNXGFX3.js → chunk-Z3T24FX3.js} +2 -2
- package/dist/{chunk-XWNXGFX3.js.map → chunk-Z3T24FX3.js.map} +1 -1
- package/dist/collapsible-panel.d.ts +10 -3
- package/dist/collapsible-panel.js +45 -5
- package/dist/collapsible-panel.js.map +1 -1
- package/dist/color-field.js +2 -2
- package/dist/color-picker.js +1 -1
- package/dist/color-swatches.js +1 -1
- package/dist/column-explorer.d.ts +67 -0
- package/dist/column-explorer.js +140 -0
- package/dist/column-explorer.js.map +1 -0
- package/dist/column-track.d.ts +12 -3
- package/dist/column-track.js +1 -1
- package/dist/combobox.d.ts +5 -1
- package/dist/combobox.js +2 -1
- package/dist/content-item.d.ts +14 -4
- package/dist/content-item.js +2 -1
- package/dist/content-swap.d.ts +5 -1
- package/dist/content-swap.js +2 -1
- package/dist/corner-status.d.ts +5 -1
- package/dist/corner-status.js +2 -1
- package/dist/device-class.js +1 -101
- package/dist/device-class.js.map +1 -1
- package/dist/disclosure-arrow.d.ts +5 -1
- package/dist/disclosure-arrow.js +2 -1
- package/dist/disclosure.js +2 -2
- package/dist/edge-activity-indicator.d.ts +5 -1
- package/dist/edge-activity-indicator.js +2 -1
- package/dist/editor.d.ts +344 -0
- package/dist/editor.js +10076 -0
- package/dist/editor.js.map +1 -0
- package/dist/empty-state.d.ts +5 -1
- package/dist/empty-state.js +2 -1
- package/dist/{extension-attributes-mu8MFUl0.d.ts → extension-attributes-IJ4decoa.d.ts} +7 -1
- package/dist/file-picker.d.ts +25 -4
- package/dist/file-picker.js +2 -1
- package/dist/floating-toolbar.d.ts +5 -1
- package/dist/floating-toolbar.js +2 -1
- package/dist/form.d.ts +45 -0
- package/dist/form.js +4 -0
- package/dist/form.js.map +1 -0
- package/dist/framed-list.js +1 -1
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.js +82 -70
- package/dist/list-action-row.d.ts +1 -1
- package/dist/list-action-row.js +2 -1
- package/dist/list-detail-dialog.d.ts +10 -3
- package/dist/list-detail-dialog.js +15 -11
- package/dist/list-detail-dialog.js.map +1 -1
- package/dist/list-header.d.ts +11 -3
- package/dist/list-header.js +1 -1
- package/dist/list-inset-control.d.ts +5 -1
- package/dist/list-inset-control.js +2 -1
- package/dist/list-inset-text.js +1 -1
- package/dist/list-item.js +3 -1
- package/dist/list.d.ts +130 -11
- package/dist/list.js +1 -1
- package/dist/loading-spinner.d.ts +5 -1
- package/dist/loading-spinner.js +2 -1
- package/dist/lucide-icon.d.ts +5 -1
- package/dist/lucide-icon.js +2 -1
- package/dist/message-composer.js +1 -1
- package/dist/{nav-stack-CrZF95VO.d.ts → nav-stack-DwxpXxqJ.d.ts} +13 -2
- package/dist/nav-stack.d.ts +3 -2
- package/dist/nav-stack.js +4 -1
- package/dist/paged-view.d.ts +47 -0
- package/dist/paged-view.js +86 -0
- package/dist/paged-view.js.map +1 -0
- package/dist/pane.d.ts +42 -5
- package/dist/pane.js +2 -1
- package/dist/popup-menu-register.js +1 -1
- package/dist/popup-menu.d.ts +42 -2
- package/dist/popup-menu.js +2 -1
- package/dist/progress-bar.js +1 -1
- package/dist/progress-ring.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/resizable-region.d.ts +5 -1
- package/dist/resizable-region.js +2 -1
- package/dist/row.d.ts +7 -2
- package/dist/row.js +1 -1
- package/dist/scroll-effect.d.ts +86 -0
- package/dist/scroll-effect.js +5 -0
- package/dist/scroll-effect.js.map +1 -0
- package/dist/{search-field-CrGTN5sa.d.ts → search-field-5lNIszda.d.ts} +5 -1
- package/dist/search-field-model.d.ts +2 -1
- package/dist/search-field.d.ts +2 -1
- package/dist/search-field.js +2 -1
- package/dist/segmented-control.d.ts +5 -1
- package/dist/segmented-control.js +2 -1
- package/dist/select-register.js +9 -2
- package/dist/select-register.js.map +1 -1
- package/dist/select.d.ts +22 -1
- package/dist/select.js +1 -1
- package/dist/sized-region.d.ts +44 -0
- package/dist/sized-region.js +4 -0
- package/dist/sized-region.js.map +1 -0
- package/dist/skeleton.d.ts +5 -1
- package/dist/skeleton.js +2 -1
- package/dist/slider.js +1 -1
- package/dist/spacer.d.ts +5 -1
- package/dist/spacer.js +2 -1
- package/dist/split-button.js +1 -1
- package/dist/split-view.d.ts +7 -3
- package/dist/split-view.js +4 -1
- package/dist/state-banner.d.ts +7 -0
- package/dist/state-banner.js +1 -1
- package/dist/styles/backdrop-image.css +136 -70
- package/dist/styles/badge.css +31 -0
- package/dist/styles/button.css +103 -0
- package/dist/styles/choice-chips.css +45 -0
- package/dist/styles/column-explorer.css +6 -0
- package/dist/styles/components/actions/button/button.css +103 -0
- package/dist/styles/components/actions/popup-menu/popup-menu.css +154 -1
- package/dist/styles/components/actions/toolbar/toolbar.css +19 -11
- package/dist/styles/components/actions/toolbar-control-group/toolbar-control-group.css +38 -200
- package/dist/styles/components/collections/column-explorer/column-explorer.css +6 -0
- package/dist/styles/components/collections/list/list.css +6 -0
- package/dist/styles/components/collections/list-item/list-item.css +68 -2
- package/dist/styles/components/collections/summary-row/summary-row.css +39 -6
- package/dist/styles/components/collections/tree-list/tree-list.css +7 -0
- package/dist/styles/components/data-display/value-table/value-table.css +1 -1
- package/dist/styles/components/feedback/badge/badge.css +31 -0
- package/dist/styles/components/feedback/state-banner/state-banner.css +12 -7
- package/dist/styles/components/forms/choice-chips/choice-chips.css +45 -0
- package/dist/styles/components/forms/file-picker/file-picker.css +13 -2
- package/dist/styles/components/forms/form/form.css +6 -0
- package/dist/styles/components/forms/select/select.css +85 -2
- package/dist/styles/components/forms/text-field/text-field.css +44 -0
- package/dist/styles/components/layout/pane/pane.css +16 -0
- package/dist/styles/components/layout/resizable-region/resizable-region.css +0 -10
- package/dist/styles/components/layout/sized-region/sized-region.css +22 -0
- package/dist/styles/components/layout/workbench/workbench.css +0 -21
- package/dist/styles/components/navigation/nav-stack/nav-stack.css +2 -0
- package/dist/styles/components/navigation/paged-view/paged-view.css +160 -0
- package/dist/styles/components/navigation/tab-bar/tab-bar.css +9 -0
- package/dist/styles/components/navigation/tab-bar-item/tab-bar-item.css +110 -2
- package/dist/styles/components/navigation/tab-panel/tab-panel.css +7 -0
- package/dist/styles/components/surfaces/backdrop-image/backdrop-image.css +14 -70
- package/dist/styles/components/surfaces/scroll-effect/scroll-effect.css +121 -0
- package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +77 -29
- package/dist/styles/components/typography/text/text.css +4 -4
- package/dist/styles/content-item.css +551 -3
- package/dist/styles/document.css +1 -6
- package/dist/styles/editor/editor.css +530 -0
- package/dist/styles/editor.css +4 -0
- package/dist/styles/file-picker.css +13 -2
- package/dist/styles/form.css +6 -0
- package/dist/styles/foundation.css +55 -1
- package/dist/styles/list-item.css +68 -2
- package/dist/styles/list.css +6 -0
- package/dist/styles/nav-stack.css +2 -0
- package/dist/styles/overlay-sheet.css +7 -7
- package/dist/styles/paged-view.css +160 -0
- package/dist/styles/pane.css +16 -0
- package/dist/styles/popup-menu.css +154 -1
- package/dist/styles/resizable-region.css +0 -10
- package/dist/styles/scroll-effect.css +121 -0
- package/dist/styles/select.css +85 -2
- package/dist/styles/sized-region.css +22 -0
- package/dist/styles/state-banner.css +12 -7
- package/dist/styles/styles.css +11 -0
- package/dist/styles/summary-row.css +39 -6
- package/dist/styles/surface-scaffold.css +77 -29
- package/dist/styles/tab-bar-item.css +110 -2
- package/dist/styles/tab-bar.css +9 -0
- package/dist/styles/tab-panel.css +7 -0
- package/dist/styles/text-field.css +44 -0
- package/dist/styles/text.css +4 -4
- package/dist/styles/toolbar-control-group.css +38 -200
- package/dist/styles/toolbar.css +19 -11
- package/dist/styles/tree-list.css +7 -0
- package/dist/styles/value-table.css +1 -1
- package/dist/styles/webawesome.css +350 -6
- package/dist/styles/workbench.css +0 -21
- package/dist/summary-row.d.ts +9 -1
- package/dist/summary-row.js +1 -1
- package/dist/sunken-panel.d.ts +5 -1
- package/dist/sunken-panel.js +2 -1
- package/dist/surface-scaffold-register.js +1 -1
- package/dist/surface-scaffold.d.ts +37 -6
- package/dist/surface-scaffold.js +3 -2
- package/dist/switch.js +1 -1
- package/dist/tab-bar-item.d.ts +8 -1
- package/dist/tab-bar-item.js +1 -1
- package/dist/tab-bar.d.ts +15 -2
- package/dist/tab-bar.js +2 -1
- package/dist/tab-navigator.d.ts +25 -3
- package/dist/tab-navigator.js +42 -19
- package/dist/tab-navigator.js.map +1 -1
- package/dist/tab-panel.d.ts +35 -0
- package/dist/tab-panel.js +4 -0
- package/dist/tab-panel.js.map +1 -0
- package/dist/tag-field.d.ts +5 -1
- package/dist/tag-field.js +2 -1
- package/dist/text-field.d.ts +22 -4
- package/dist/text-field.js +1 -1
- package/dist/text.d.ts +37 -5
- package/dist/text.js +2 -1
- package/dist/toolbar-control-group.d.ts +83 -3
- package/dist/toolbar-control-group.js +4 -1
- package/dist/toolbar-text.d.ts +9 -1
- package/dist/toolbar-text.js +2 -1
- package/dist/toolbar.d.ts +6 -1
- package/dist/toolbar.js +2 -1
- package/dist/tree-list.d.ts +42 -0
- package/dist/tree-list.js +12 -0
- package/dist/tree-list.js.map +1 -0
- package/dist/tree-rows-eHnnGLGM.d.ts +65 -0
- package/dist/value-preview.d.ts +5 -1
- package/dist/value-preview.js +2 -1
- package/dist/value-table.d.ts +9 -2
- package/dist/value-table.js +2 -1
- package/dist/wire-catalog.d.ts +3 -2
- package/dist/wire-catalog.js +4 -3
- package/dist/wire-catalog.js.map +1 -1
- package/dist/wire-choice-chips.d.ts +3 -1
- package/dist/wire-choice-chips.js +1 -1
- package/dist/wire-color-fields.js +2 -73
- package/dist/wire-color-fields.js.map +1 -1
- package/dist/wire-color-pickers.js +1 -1
- package/dist/wire-column-explorer.d.ts +13 -0
- package/dist/wire-column-explorer.js +94 -0
- package/dist/wire-column-explorer.js.map +1 -0
- package/dist/wire-content-items.d.ts +10 -1
- package/dist/wire-content-items.js +1 -293
- package/dist/wire-content-items.js.map +1 -1
- package/dist/wire-forms.d.ts +14 -0
- package/dist/wire-forms.js +3 -0
- package/dist/wire-forms.js.map +1 -0
- package/dist/wire-nav-stack.js +1 -423
- package/dist/wire-nav-stack.js.map +1 -1
- package/dist/wire-paged-views.d.ts +27 -0
- package/dist/wire-paged-views.js +186 -0
- package/dist/wire-paged-views.js.map +1 -0
- package/dist/wire-resizable-regions.js +2 -1
- package/dist/wire-scroll-dividers.js +1 -1
- package/dist/wire-search-fields.d.ts +2 -1
- package/dist/wire-search-fields.js +2 -1
- package/dist/wire-sidebar.js +1 -229
- package/dist/wire-sidebar.js.map +1 -1
- package/dist/wire-sliders.js +1 -29
- package/dist/wire-sliders.js.map +1 -1
- package/dist/wire-summary-rows.d.ts +18 -0
- package/dist/wire-summary-rows.js +4 -0
- package/dist/wire-summary-rows.js.map +1 -0
- package/dist/wire-tab-bars.d.ts +1 -0
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-tab-navigator.js +1 -151
- package/dist/wire-tab-navigator.js.map +1 -1
- package/dist/wire-tag-fields.js +3 -252
- package/dist/wire-tag-fields.js.map +1 -1
- package/dist/wire-tree-list.d.ts +53 -0
- package/dist/wire-tree-list.js +3 -0
- package/dist/wire-tree-list.js.map +1 -0
- package/dist/wire-workbench.js +2 -1
- package/dist/workbench-dialog.d.ts +10 -3
- package/dist/workbench-dialog.js +13 -9
- package/dist/workbench-dialog.js.map +1 -1
- package/dist/workbench.d.ts +7 -3
- package/dist/workbench.js +4 -1
- package/docs/accessibility.md +52 -9
- package/docs/app-layouts.md +70 -1
- package/docs/backdrop-image.md +10 -0
- package/docs/button.md +30 -2
- package/docs/column-explorer.md +75 -0
- package/docs/component-contract.md +38 -8
- package/docs/component-selection.md +150 -107
- package/docs/data-tables-and-lists.md +1 -1
- package/docs/design/sketch/Kerf-UI.sketch +0 -0
- package/docs/design/sketch/README.md +1 -1
- package/docs/design/sketch/coverage.md +120 -118
- package/docs/design/sketch/lists/README.md +6 -6
- package/docs/design/sketch/unified/README.md +1 -1
- package/docs/design/sketch/unified/pages/lists.png +0 -0
- package/docs/design/templates/button/emphasis-dark.svg +1 -1
- package/docs/design/templates/button/emphasis.svg +1 -1
- package/docs/design/templates/button-dark.svg +1 -1
- package/docs/design/templates/button.svg +1 -1
- package/docs/design/templates/tree-list/files-dark.svg +1 -0
- package/docs/design/templates/tree-list/files.svg +1 -0
- package/docs/design/templates/tree-list/outline-dark.svg +1 -0
- package/docs/design/templates/tree-list/outline.svg +1 -0
- package/docs/design/templates/tree-list-dark.svg +1 -0
- package/docs/design/templates/tree-list.svg +1 -0
- package/docs/design/templates.md +2 -2
- package/docs/document-baseline.md +6 -3
- package/docs/editor-host.md +299 -0
- package/docs/forms-and-validation.md +39 -0
- package/docs/interaction-conventions.md +1 -0
- package/docs/layout.md +87 -4
- package/docs/list-detail-dialog.md +5 -0
- package/docs/manual-test-plan.md +32 -0
- package/docs/nav-stack.md +2 -1
- package/docs/paged-view.md +89 -0
- package/docs/scroll-effect.md +127 -0
- package/docs/split-view.md +4 -1
- package/docs/surface-scaffold.md +32 -2
- package/docs/tab-navigator.md +5 -4
- package/docs/tree-list.md +134 -0
- package/docs/ui-analyzer.md +43 -25
- package/docs/ui-doctor.md +4 -1
- package/docs/ui-evaluator.md +2 -0
- package/docs/webawesome-migration.md +32 -31
- package/docs/webawesome-theme.md +27 -17
- package/docs/workbench-dialog.md +4 -0
- package/evaluator/index.mjs +14 -2
- package/llms.txt +159 -18
- package/package.json +90 -3
- package/props/cli.d.mts +1 -0
- package/props/cli.mjs +116 -0
- package/props/component-props.d.mts +177 -0
- package/props/component-props.mjs +1208 -0
- package/scripts/lib/json-schema-subset.mjs +137 -0
- package/ux-demo/recipes/app-shell.tsx +20 -22
- package/ux-demo/recipes/collapsible-sidebar.tsx +2 -2
- package/ux-demo/recipes/compact-toolbar.tsx +26 -29
- package/ux-demo/recipes/composer-form.tsx +6 -5
- package/ux-demo/recipes/list-workspace-states.tsx +39 -39
- package/ux-demo/recipes/loading-inspector.tsx +8 -6
- package/ux-demo/recipes/media-detail.tsx +29 -15
- package/ux-demo/recipes/navigation-sidebar.tsx +18 -19
- package/ux-demo/recipes/navigation-stack.tsx +2 -2
- package/ux-demo/recipes/workspace-header.tsx +16 -16
- package/view/cli.d.mts +18 -0
- package/view/cli.mjs +262 -0
- package/view/contract.mjs +342 -0
- package/view/generate.mjs +639 -0
- package/view/index.d.mts +411 -0
- package/view/index.mjs +40 -0
- package/view/interpret.mjs +271 -0
- package/view/validate-move.mjs +317 -0
- package/view/validate.mjs +1864 -0
- package/vite-editor.d.mts +130 -0
- package/vite-editor.mjs +314 -0
- package/dist/chunk-2J7XKAZX.js.map +0 -1
- package/dist/chunk-3KFMLOTH.js.map +0 -1
- package/dist/chunk-3OP66VXU.js.map +0 -1
- package/dist/chunk-3V4OCDTL.js.map +0 -1
- package/dist/chunk-3WWX2O4G.js.map +0 -1
- package/dist/chunk-5CLMV5YU.js.map +0 -1
- package/dist/chunk-5J6Z4BWY.js.map +0 -1
- package/dist/chunk-6VVIW7VB.js.map +0 -1
- package/dist/chunk-7K6U6FCN.js.map +0 -1
- package/dist/chunk-AMIHGFLP.js.map +0 -1
- package/dist/chunk-AN5IWMTM.js.map +0 -1
- package/dist/chunk-B53PS2LE.js.map +0 -1
- package/dist/chunk-BKUMG2KB.js.map +0 -1
- package/dist/chunk-C2ZO3OZZ.js.map +0 -1
- package/dist/chunk-CVD5IZGB.js.map +0 -1
- package/dist/chunk-D5RGM3XA.js.map +0 -1
- package/dist/chunk-DZJ4GBSP.js.map +0 -1
- package/dist/chunk-EIET4QLK.js.map +0 -1
- package/dist/chunk-EKHDLBRP.js.map +0 -1
- package/dist/chunk-ETFP7HAR.js.map +0 -1
- package/dist/chunk-EYDXFOSH.js.map +0 -1
- package/dist/chunk-F653O57X.js.map +0 -1
- package/dist/chunk-G3J7JDP6.js.map +0 -1
- package/dist/chunk-HJXVVFBT.js.map +0 -1
- package/dist/chunk-IIQ2XIMU.js.map +0 -1
- package/dist/chunk-ITENVZ6Q.js.map +0 -1
- package/dist/chunk-ITUQC4FW.js.map +0 -1
- package/dist/chunk-K57NINLH.js.map +0 -1
- package/dist/chunk-K67XBCHG.js.map +0 -1
- package/dist/chunk-KDQZ3E5C.js.map +0 -1
- package/dist/chunk-KH4KEMSP.js.map +0 -1
- package/dist/chunk-LZUUUHNH.js.map +0 -1
- package/dist/chunk-N2K3QGSX.js.map +0 -1
- package/dist/chunk-NB6POCFH.js.map +0 -1
- package/dist/chunk-NR6O74ST.js.map +0 -1
- package/dist/chunk-OQP3PFKQ.js.map +0 -1
- package/dist/chunk-OZ6X76G5.js.map +0 -1
- package/dist/chunk-PS24PVR6.js.map +0 -1
- package/dist/chunk-QH5KOFNS.js.map +0 -1
- package/dist/chunk-QYMJHS4K.js.map +0 -1
- package/dist/chunk-ROEBKSIY.js.map +0 -1
- package/dist/chunk-S3DCRI2M.js.map +0 -1
- package/dist/chunk-S3ECMF23.js.map +0 -1
- package/dist/chunk-TKNVL53O.js.map +0 -1
- package/dist/chunk-VEME3D7K.js.map +0 -1
- package/dist/chunk-WPP5Q4A5.js.map +0 -1
- package/dist/chunk-WVS6CUCT.js.map +0 -1
- package/dist/chunk-XRZSK2WC.js.map +0 -1
- package/dist/chunk-Y6KT7ZTR.js.map +0 -1
- package/dist/chunk-YMUIQRWK.js.map +0 -1
- package/dist/chunk-YPAQFBMN.js.map +0 -1
- package/dist/chunk-YWLDLNAV.js.map +0 -1
- package/dist/chunk-ZN7KUMPY.js.map +0 -1
- package/dist/chunk-ZX2QQJXD.js.map +0 -1
|
@@ -5,7 +5,10 @@ import { ListInsetText } from '@kerfjs/ui/list-inset-text';
|
|
|
5
5
|
import { StateBanner } from '@kerfjs/ui/state-banner';
|
|
6
6
|
import { Text } from '@kerfjs/ui/text';
|
|
7
7
|
import { Toolbar } from '@kerfjs/ui/toolbar';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ToolbarButton,
|
|
10
|
+
ToolbarControlGroup,
|
|
11
|
+
} from '@kerfjs/ui/toolbar-control-group';
|
|
9
12
|
import { ToolbarText } from '@kerfjs/ui/toolbar-text';
|
|
10
13
|
|
|
11
14
|
import type { RecipeFactory, RecipePresentation } from './types.js';
|
|
@@ -54,27 +57,24 @@ export const createRecipe: RecipeFactory = (announce) => ({
|
|
|
54
57
|
buttonAppearance="push"
|
|
55
58
|
content="text"
|
|
56
59
|
>
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
data-
|
|
60
|
-
data-recipe-command="share"
|
|
60
|
+
<ToolbarButton
|
|
61
|
+
action="recipe-action"
|
|
62
|
+
rootAttributes={{ 'data-recipe-command': 'share' }}
|
|
61
63
|
>
|
|
62
64
|
Share
|
|
63
|
-
</
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
data-
|
|
67
|
-
data-recipe-command="more"
|
|
65
|
+
</ToolbarButton>
|
|
66
|
+
<ToolbarButton
|
|
67
|
+
action="recipe-action"
|
|
68
|
+
rootAttributes={{ 'data-recipe-command': 'more' }}
|
|
68
69
|
>
|
|
69
70
|
More Actions
|
|
70
|
-
</
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
data-
|
|
74
|
-
data-recipe-command="publish"
|
|
71
|
+
</ToolbarButton>
|
|
72
|
+
<ToolbarButton
|
|
73
|
+
action="recipe-action"
|
|
74
|
+
rootAttributes={{ 'data-recipe-command': 'publish' }}
|
|
75
75
|
>
|
|
76
76
|
Publish Update
|
|
77
|
-
</
|
|
77
|
+
</ToolbarButton>
|
|
78
78
|
</ToolbarControlGroup>
|
|
79
79
|
}
|
|
80
80
|
/>
|
package/view/cli.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function parseArguments(argv: readonly string[]): {
|
|
2
|
+
command: 'generate' | 'check' | 'diff';
|
|
3
|
+
documents: string[];
|
|
4
|
+
options: {
|
|
5
|
+
target: 'ts' | 'js';
|
|
6
|
+
declarationsOnly: boolean;
|
|
7
|
+
props: string[];
|
|
8
|
+
composition: string[];
|
|
9
|
+
/** Discover catalogs from .kerf-ui-profile.json (default true). */
|
|
10
|
+
profile: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export function run(argv: readonly string[]): { code: number; output: string };
|
|
14
|
+
/** Prop and composition catalog paths a document's profile layers declare (beyond @kerfjs/ui). */
|
|
15
|
+
export function profileCatalogPaths(documentPath: string): {
|
|
16
|
+
props: string[];
|
|
17
|
+
composition: string[];
|
|
18
|
+
};
|
package/view/cli.mjs
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// kerf-ui-view: generate, check, and diff read-only view modules from Kerf UI
|
|
3
|
+
// view documents (docs/26-ui-editor.md §6). An authoring step, like a
|
|
4
|
+
// formatter — never part of a consumer's build.
|
|
5
|
+
import { existsSync, readFileSync, realpathSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { createRequire } from 'node:module';
|
|
7
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
8
|
+
import process from 'node:process';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
|
|
11
|
+
import { contractOf, diffContracts } from './contract.mjs';
|
|
12
|
+
import { generateView, readViewHeader, viewModulePath } from './generate.mjs';
|
|
13
|
+
import { createViewCatalog, validateView } from './validate.mjs';
|
|
14
|
+
|
|
15
|
+
const USAGE = `Usage: kerf-ui-view <command> <document.kui.json...> [options]
|
|
16
|
+
|
|
17
|
+
Commands:
|
|
18
|
+
generate write each document's view module beside it
|
|
19
|
+
check fail when a module is missing, stale, or edited by hand
|
|
20
|
+
diff print the contract changes regenerating would make
|
|
21
|
+
|
|
22
|
+
Catalogs: @kerfjs/ui's own, plus every package catalog (props and
|
|
23
|
+
composition) the .kerf-ui-profile.json files above the document declare.
|
|
24
|
+
|
|
25
|
+
Options:
|
|
26
|
+
--target ts|js .view.ts (default) or .view.js + .view.d.ts
|
|
27
|
+
--declarations-only omit render<Name> (for runtime-interpreted documents)
|
|
28
|
+
--props <file> an extra component-props.json (repeatable)
|
|
29
|
+
--no-profile skip catalogs .kerf-ui-profile.json declares
|
|
30
|
+
--composition <file> an extra component-composition.json (repeatable)
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
34
|
+
const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
|
|
35
|
+
|
|
36
|
+
/** Parses argv into `{ command, documents, options }`, or throws a usage error. */
|
|
37
|
+
export function parseArguments(argv) {
|
|
38
|
+
const [command, ...rest] = argv;
|
|
39
|
+
const options = {
|
|
40
|
+
target: 'ts',
|
|
41
|
+
declarationsOnly: false,
|
|
42
|
+
props: [],
|
|
43
|
+
composition: [],
|
|
44
|
+
profile: true,
|
|
45
|
+
};
|
|
46
|
+
const documents = [];
|
|
47
|
+
for (let index = 0; index < rest.length; index += 1) {
|
|
48
|
+
const argument = rest[index];
|
|
49
|
+
const next = () => {
|
|
50
|
+
const value = rest[(index += 1)];
|
|
51
|
+
if (value === undefined) throw new Error(`${argument} needs a value`);
|
|
52
|
+
return value;
|
|
53
|
+
};
|
|
54
|
+
if (argument === '--target') {
|
|
55
|
+
options.target = next();
|
|
56
|
+
if (!['ts', 'js'].includes(options.target))
|
|
57
|
+
throw new Error('--target is ts or js');
|
|
58
|
+
} else if (argument === '--declarations-only')
|
|
59
|
+
options.declarationsOnly = true;
|
|
60
|
+
else if (argument === '--props') options.props.push(next());
|
|
61
|
+
else if (argument === '--composition') options.composition.push(next());
|
|
62
|
+
else if (argument === '--no-profile') options.profile = false;
|
|
63
|
+
else if (argument.startsWith('--'))
|
|
64
|
+
throw new Error(`unknown option ${argument}`);
|
|
65
|
+
else documents.push(argument);
|
|
66
|
+
}
|
|
67
|
+
if (!['generate', 'check', 'diff'].includes(command))
|
|
68
|
+
throw new Error(`unknown command ${command ?? '(none)'}`);
|
|
69
|
+
if (documents.length === 0)
|
|
70
|
+
throw new Error('name at least one .kui.json document');
|
|
71
|
+
return { command, documents, options };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const require = createRequire(import.meta.url);
|
|
75
|
+
const profiles = require('../ai/application-ui-profile-sync.cjs');
|
|
76
|
+
|
|
77
|
+
/** The nearest ancestor holding `.git`, else the filesystem root. */
|
|
78
|
+
function workspaceRootOf(directory) {
|
|
79
|
+
for (let current = directory; ; current = dirname(current)) {
|
|
80
|
+
if (existsSync(join(current, '.git')) || dirname(current) === current) {
|
|
81
|
+
return current;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The prop and composition catalogs a document's `.kerf-ui-profile.json`
|
|
88
|
+
* layers declare for packages other than @kerfjs/ui (KF-S61KAT: profile
|
|
89
|
+
* discovery of component-props.json), resolved relative to the profile file
|
|
90
|
+
* that declares each one.
|
|
91
|
+
*/
|
|
92
|
+
export function profileCatalogPaths(documentPath) {
|
|
93
|
+
const startDirectory = dirname(resolve(documentPath));
|
|
94
|
+
const files = profiles.discoverApplicationUiProfileFilesSync({
|
|
95
|
+
workspaceRoot: workspaceRootOf(startDirectory),
|
|
96
|
+
startDirectory,
|
|
97
|
+
packageProfile: resolve(
|
|
98
|
+
packageRoot,
|
|
99
|
+
'ai/application-ui-profile.defaults.json',
|
|
100
|
+
),
|
|
101
|
+
});
|
|
102
|
+
const resolved = profiles.mergeApplicationUiProfiles(
|
|
103
|
+
files.map((source) => ({ source, profile: readJson(source) })),
|
|
104
|
+
);
|
|
105
|
+
const paths = { props: [], composition: [] };
|
|
106
|
+
for (const catalog of resolved.profile.catalogs ?? []) {
|
|
107
|
+
const owner = resolved.provenance[`$catalogs.${catalog.package}`];
|
|
108
|
+
if (catalog.package === '@kerfjs/ui' || !owner) continue;
|
|
109
|
+
for (const kind of ['props', 'composition']) {
|
|
110
|
+
if (catalog[kind]?.path)
|
|
111
|
+
paths[kind].push(resolve(dirname(owner), catalog[kind].path));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return paths;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Reads a component-props.json and makes its relative component imports (app
|
|
119
|
+
* source components, `./src/x.js`) absolute against the catalog's folder, so
|
|
120
|
+
* the generator can write them relative to each document.
|
|
121
|
+
*/
|
|
122
|
+
function readPropsCatalog(path) {
|
|
123
|
+
const catalog = readJson(path);
|
|
124
|
+
for (const component of catalog.components ?? []) {
|
|
125
|
+
if (/^\.\.?\//.test(component.import ?? '')) {
|
|
126
|
+
component.import = resolve(dirname(path), component.import);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return catalog;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function loadCatalog(options, documentPath) {
|
|
133
|
+
const discovered = options.profile
|
|
134
|
+
? profileCatalogPaths(documentPath)
|
|
135
|
+
: { props: [], composition: [] };
|
|
136
|
+
return createViewCatalog({
|
|
137
|
+
props: [
|
|
138
|
+
readJson(resolve(packageRoot, 'ai/component-props.json')),
|
|
139
|
+
...[...discovered.props, ...options.props].map(readPropsCatalog),
|
|
140
|
+
],
|
|
141
|
+
composition: [
|
|
142
|
+
resolve(packageRoot, 'ai/component-composition.json'),
|
|
143
|
+
...discovered.composition,
|
|
144
|
+
...options.composition,
|
|
145
|
+
].map(readJson),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Loads composed documents relative to the composing document's folder. */
|
|
150
|
+
const viewResolver = (documentPath) => (src) => {
|
|
151
|
+
const path = resolve(dirname(documentPath), src);
|
|
152
|
+
return existsSync(path) ? readJson(path) : undefined;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/** Runs one command; returns `{ code, output }` instead of exiting, for tests. */
|
|
156
|
+
export function run(argv) {
|
|
157
|
+
let parsed;
|
|
158
|
+
try {
|
|
159
|
+
parsed = parseArguments(argv);
|
|
160
|
+
} catch (error) {
|
|
161
|
+
return { code: 2, output: `kerf-ui-view: ${error.message}\n\n${USAGE}` };
|
|
162
|
+
}
|
|
163
|
+
const { command, documents, options } = parsed;
|
|
164
|
+
const lines = [];
|
|
165
|
+
let failed = false;
|
|
166
|
+
for (const documentPath of documents) {
|
|
167
|
+
const catalog = loadCatalog(options, documentPath);
|
|
168
|
+
const document = readJson(documentPath);
|
|
169
|
+
const resolveView = viewResolver(documentPath);
|
|
170
|
+
const validation = validateView(document, catalog, { resolveView });
|
|
171
|
+
if (!validation.valid) {
|
|
172
|
+
failed = true;
|
|
173
|
+
for (const item of validation.diagnostics) {
|
|
174
|
+
lines.push(
|
|
175
|
+
`${documentPath}: ${item.code} ${item.path}: ${item.message}`,
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
// Hints are advice: printed, never a failure.
|
|
181
|
+
for (const item of validation.hints)
|
|
182
|
+
lines.push(
|
|
183
|
+
`${documentPath}: hint ${item.code} ${item.path}: ${item.message}`,
|
|
184
|
+
);
|
|
185
|
+
const modulePath = viewModulePath(documentPath, options.target);
|
|
186
|
+
const generated = generateView(document, catalog, {
|
|
187
|
+
source: basename(documentPath),
|
|
188
|
+
resolveView,
|
|
189
|
+
target: options.target,
|
|
190
|
+
declarationsOnly: options.declarationsOnly,
|
|
191
|
+
importFrom: dirname(resolve(documentPath)),
|
|
192
|
+
});
|
|
193
|
+
const outputs = [[modulePath, generated.code]];
|
|
194
|
+
if (generated.declarations)
|
|
195
|
+
outputs.push([
|
|
196
|
+
modulePath.replace(/\.js$/, '.d.ts'),
|
|
197
|
+
generated.declarations,
|
|
198
|
+
]);
|
|
199
|
+
|
|
200
|
+
if (command === 'generate') {
|
|
201
|
+
for (const [path, code] of outputs) writeFileSync(path, code);
|
|
202
|
+
lines.push(`${modulePath}: ${generated.digest}`);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const current = existsSync(modulePath)
|
|
206
|
+
? readFileSync(modulePath, 'utf8')
|
|
207
|
+
: undefined;
|
|
208
|
+
const header = current === undefined ? undefined : readViewHeader(current);
|
|
209
|
+
if (command === 'diff') {
|
|
210
|
+
const before = header?.contract ?? {
|
|
211
|
+
inputs: {},
|
|
212
|
+
actions: {},
|
|
213
|
+
slots: {},
|
|
214
|
+
refs: {},
|
|
215
|
+
};
|
|
216
|
+
const changes = diffContracts(
|
|
217
|
+
before,
|
|
218
|
+
contractOf(document, catalog, { resolveView }),
|
|
219
|
+
);
|
|
220
|
+
lines.push(
|
|
221
|
+
`${modulePath}: ${changes.length ? `${changes.length} contract change(s)` : 'contract unchanged'}`,
|
|
222
|
+
);
|
|
223
|
+
for (const change of changes) {
|
|
224
|
+
lines.push(
|
|
225
|
+
` ${change.breaking ? 'BREAKING' : 'compatible'} ${change.member} ${JSON.stringify(change.name)} ${change.change} (${change.detail})`,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
for (const [path, code] of outputs) {
|
|
231
|
+
const existing =
|
|
232
|
+
path === modulePath
|
|
233
|
+
? current
|
|
234
|
+
: existsSync(path)
|
|
235
|
+
? readFileSync(path, 'utf8')
|
|
236
|
+
: undefined;
|
|
237
|
+
const existingHeader =
|
|
238
|
+
path === modulePath ? header : existing && readViewHeader(existing);
|
|
239
|
+
if (existing === undefined) {
|
|
240
|
+
failed = true;
|
|
241
|
+
lines.push(`${path}: missing; run kerf-ui-view generate`);
|
|
242
|
+
} else if (!existingHeader?.intact) {
|
|
243
|
+
failed = true;
|
|
244
|
+
lines.push(`${path}: edited by hand; regenerate it instead of editing`);
|
|
245
|
+
} else if (existing !== code) {
|
|
246
|
+
failed = true;
|
|
247
|
+
lines.push(`${path}: stale; run kerf-ui-view generate`);
|
|
248
|
+
} else lines.push(`${path}: up to date`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return { code: failed ? 1 : 0, output: `${lines.join('\n')}\n` };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (
|
|
255
|
+
process.argv[1] &&
|
|
256
|
+
// npm runs bins through symlinks (node_modules/.bin), so compare real paths.
|
|
257
|
+
realpathSync(resolve(process.argv[1])) === fileURLToPath(import.meta.url)
|
|
258
|
+
) {
|
|
259
|
+
const result = run(process.argv.slice(2));
|
|
260
|
+
(result.code === 0 ? process.stdout : process.stderr).write(result.output);
|
|
261
|
+
process.exitCode = result.code;
|
|
262
|
+
}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
// The view contract (docs/26-ui-editor.md §4.6): the part of a view document
|
|
2
|
+
// application code compiles against — inputs, actions, slots, refs — with its
|
|
3
|
+
// layout-independent `kui1:` digest and a breaking/non-breaking diff. Shared
|
|
4
|
+
// by the generator and the runtime interpreter so both compute the same digest.
|
|
5
|
+
import { validateView } from './validate.mjs';
|
|
6
|
+
|
|
7
|
+
const MASK_64 = 0xffffffffffffffffn;
|
|
8
|
+
const FNV_OFFSET = 0xcbf29ce484222325n;
|
|
9
|
+
const FNV_PRIME = 0x100000001b3n;
|
|
10
|
+
|
|
11
|
+
const isObject = (value) =>
|
|
12
|
+
value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
13
|
+
|
|
14
|
+
/** JSON with object keys sorted at every level and no whitespace. */
|
|
15
|
+
export function canonicalJson(value) {
|
|
16
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(',')}]`;
|
|
17
|
+
if (isObject(value)) {
|
|
18
|
+
return `{${Object.keys(value)
|
|
19
|
+
.filter((key) => value[key] !== undefined)
|
|
20
|
+
.sort()
|
|
21
|
+
.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`)
|
|
22
|
+
.join(',')}}`;
|
|
23
|
+
}
|
|
24
|
+
return JSON.stringify(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* `kui1:` plus 16 hex digits of the 64-bit FNV-1a hash of `text`'s UTF-8
|
|
29
|
+
* bytes. A compatibility fingerprint, not a security measure: synchronous and
|
|
30
|
+
* dependency-free so Node and browsers compute it identically.
|
|
31
|
+
*/
|
|
32
|
+
export function viewDigest(text) {
|
|
33
|
+
let hash = FNV_OFFSET;
|
|
34
|
+
for (const byte of new TextEncoder().encode(text)) {
|
|
35
|
+
hash ^= BigInt(byte);
|
|
36
|
+
hash = (hash * FNV_PRIME) & MASK_64;
|
|
37
|
+
}
|
|
38
|
+
return `kui1:${hash.toString(16).padStart(16, '0')}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The TypeScript spelling of a document param or slot-input type. */
|
|
42
|
+
export function typeText(type) {
|
|
43
|
+
switch (type?.kind) {
|
|
44
|
+
case 'string':
|
|
45
|
+
case 'number':
|
|
46
|
+
case 'boolean':
|
|
47
|
+
return type.kind;
|
|
48
|
+
case 'literal':
|
|
49
|
+
return JSON.stringify(type.value);
|
|
50
|
+
case 'enum':
|
|
51
|
+
return type.values.map((value) => JSON.stringify(value)).join(' | ');
|
|
52
|
+
case 'content':
|
|
53
|
+
return 'SafeHtml';
|
|
54
|
+
// A component prop's own type (KF-H3CB2P); the generated module spells
|
|
55
|
+
// it from the component function it imports.
|
|
56
|
+
case 'prop':
|
|
57
|
+
return `PropOf<${JSON.stringify(type.component)}, ${JSON.stringify(type.prop)}>`;
|
|
58
|
+
case 'array': {
|
|
59
|
+
const item = typeText(type.items);
|
|
60
|
+
return `readonly ${/[|&]/.test(item) ? `(${item})` : item}[]`;
|
|
61
|
+
}
|
|
62
|
+
case 'object':
|
|
63
|
+
return type.props.length === 0
|
|
64
|
+
? 'Readonly<Record<string, never>>'
|
|
65
|
+
: `{ ${type.props
|
|
66
|
+
.map(
|
|
67
|
+
(prop) =>
|
|
68
|
+
`readonly ${propertyName(prop.name)}${prop.required ? '' : '?'}: ${typeText(prop.type)};`,
|
|
69
|
+
)
|
|
70
|
+
.join(' ')} }`;
|
|
71
|
+
default:
|
|
72
|
+
return 'unknown';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A property name as written in a TypeScript type or object literal. */
|
|
77
|
+
export function propertyName(name) {
|
|
78
|
+
return /^[A-Za-z_$][\w$]*$/.test(name) ? name : JSON.stringify(name);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const HTML_ELEMENTS = {
|
|
82
|
+
a: 'HTMLAnchorElement',
|
|
83
|
+
button: 'HTMLButtonElement',
|
|
84
|
+
div: 'HTMLDivElement',
|
|
85
|
+
fieldset: 'HTMLFieldSetElement',
|
|
86
|
+
label: 'HTMLLabelElement',
|
|
87
|
+
nav: 'HTMLElement',
|
|
88
|
+
ol: 'HTMLOListElement',
|
|
89
|
+
section: 'HTMLElement',
|
|
90
|
+
span: 'HTMLSpanElement',
|
|
91
|
+
svg: 'SVGSVGElement',
|
|
92
|
+
ul: 'HTMLUListElement',
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** The element type a named node's ref resolves to. */
|
|
96
|
+
function elementOf(catalog, node) {
|
|
97
|
+
if (node.type.includes('#')) return 'HTMLElement';
|
|
98
|
+
const entry = catalog.entries.get(node.type);
|
|
99
|
+
const tag = entry?.boundaries?.rootElement;
|
|
100
|
+
// A link-capable component renders <a> instead when given an href.
|
|
101
|
+
if (!tag || (isObject(node.props) && 'href' in node.props)) {
|
|
102
|
+
return 'HTMLElement';
|
|
103
|
+
}
|
|
104
|
+
return HTML_ELEMENTS[tag] ?? 'HTMLElement';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Walks every node and child, calling `visit(node, rowScoped)` for nodes. */
|
|
108
|
+
export function walkView(document, visit) {
|
|
109
|
+
const child = (item, row) => {
|
|
110
|
+
if (!isObject(item)) return;
|
|
111
|
+
if ('$each' in item) node(item.template, true);
|
|
112
|
+
else if ('$if' in item) {
|
|
113
|
+
child(item.then, row);
|
|
114
|
+
if ('else' in item) child(item.else, row);
|
|
115
|
+
} else if (!('$slot' in item)) node(item, row);
|
|
116
|
+
};
|
|
117
|
+
const node = (item, row) => {
|
|
118
|
+
if (!isObject(item)) return;
|
|
119
|
+
visit(item, row);
|
|
120
|
+
for (const children of Object.values(
|
|
121
|
+
isObject(item.zones) ? item.zones : {},
|
|
122
|
+
)) {
|
|
123
|
+
if (Array.isArray(children))
|
|
124
|
+
for (const entry of children) child(entry, row);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
// A `$slot` inside a prop value (KF-SXDM56: item slots), at any depth.
|
|
128
|
+
const valueSlots = (value, found) => {
|
|
129
|
+
if (Array.isArray(value)) for (const item of value) valueSlots(item, found);
|
|
130
|
+
else if (isObject(value)) {
|
|
131
|
+
if (typeof value.$slot === 'string') found.add(value.$slot);
|
|
132
|
+
else for (const item of Object.values(value)) valueSlots(item, found);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const slots = (item, found) => {
|
|
136
|
+
if (!isObject(item)) return;
|
|
137
|
+
valueSlots(item.props, found);
|
|
138
|
+
if ('$slot' in item) found.add(item.$slot);
|
|
139
|
+
else if ('$each' in item) slots(item.template, found);
|
|
140
|
+
else if ('$if' in item) {
|
|
141
|
+
slots(item.then, found);
|
|
142
|
+
slots(item.else, found);
|
|
143
|
+
}
|
|
144
|
+
for (const children of Object.values(
|
|
145
|
+
isObject(item.zones) ? item.zones : {},
|
|
146
|
+
)) {
|
|
147
|
+
if (Array.isArray(children))
|
|
148
|
+
for (const entry of children) slots(entry, found);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
node(document.root, false);
|
|
152
|
+
const found = new Set();
|
|
153
|
+
slots(document.root, found);
|
|
154
|
+
return found;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The contract of a valid view document:
|
|
159
|
+
* `{ inputs, actions, slots, refs }`, each keyed by name.
|
|
160
|
+
* Throws when the document does not validate; the generator and interpreter
|
|
161
|
+
* never derive a contract from an invalid document.
|
|
162
|
+
*/
|
|
163
|
+
export function contractOf(document, catalog, options = {}) {
|
|
164
|
+
const validation = validateView(document, catalog, options);
|
|
165
|
+
if (!validation.valid) {
|
|
166
|
+
const first = validation.diagnostics[0];
|
|
167
|
+
throw new Error(
|
|
168
|
+
`view document is invalid (${validation.diagnostics.length} diagnostics; first: ${first.code} at ${first.path}: ${first.message})`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
const inputs = {};
|
|
172
|
+
for (const [name, param] of Object.entries(document.params ?? {})) {
|
|
173
|
+
inputs[name] = {
|
|
174
|
+
type: typeText(param.type),
|
|
175
|
+
// A prop-typed input is optional exactly when that prop is.
|
|
176
|
+
optional:
|
|
177
|
+
'default' in param ||
|
|
178
|
+
(param.type.kind === 'prop' &&
|
|
179
|
+
!catalog.components
|
|
180
|
+
.get(param.type.component)
|
|
181
|
+
.component.props.find((prop) => prop.name === param.type.prop)
|
|
182
|
+
.required),
|
|
183
|
+
shape: param.type,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
const refs = {};
|
|
187
|
+
const used = walkView(document, (node, row) => {
|
|
188
|
+
if (typeof node.name === 'string') {
|
|
189
|
+
refs[node.name] = {
|
|
190
|
+
element: elementOf(catalog, node),
|
|
191
|
+
keyed: row,
|
|
192
|
+
id: node.id,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
const slots = {};
|
|
197
|
+
for (const name of [...used].sort()) {
|
|
198
|
+
const input = document.slots?.[name]?.input;
|
|
199
|
+
slots[name] = input ? typeText(input) : null;
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
inputs,
|
|
203
|
+
actions: Object.fromEntries(
|
|
204
|
+
[...validation.actions].sort(([a], [b]) => (a < b ? -1 : 1)),
|
|
205
|
+
),
|
|
206
|
+
slots,
|
|
207
|
+
refs,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** The canonical form a contract digest covers (no node ids or shapes). */
|
|
212
|
+
function digestForm(contract) {
|
|
213
|
+
return {
|
|
214
|
+
inputs: Object.fromEntries(
|
|
215
|
+
Object.entries(contract.inputs).map(([name, input]) => [
|
|
216
|
+
name,
|
|
217
|
+
{ type: input.type, optional: input.optional },
|
|
218
|
+
]),
|
|
219
|
+
),
|
|
220
|
+
actions: contract.actions,
|
|
221
|
+
slots: contract.slots,
|
|
222
|
+
refs: Object.fromEntries(
|
|
223
|
+
Object.entries(contract.refs).map(([name, ref]) => [
|
|
224
|
+
name,
|
|
225
|
+
{ element: ref.element, keyed: ref.keyed },
|
|
226
|
+
]),
|
|
227
|
+
),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** The contract's `kui1:` digest (§4.6): layout, literals, and ids excluded. */
|
|
232
|
+
export function contractDigest(contract) {
|
|
233
|
+
return viewDigest(canonicalJson(digestForm(contract)));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** The contract as it is recorded in a generated module's header. */
|
|
237
|
+
export function serializeContract(contract) {
|
|
238
|
+
return canonicalJson(digestForm(contract));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const enumValues = (text) => {
|
|
242
|
+
const parts = text.split(' | ');
|
|
243
|
+
return parts.every((part) => /^".*"$|^-?\d/.test(part))
|
|
244
|
+
? new Set(parts)
|
|
245
|
+
: undefined;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
/** Whether every value `before` allows is still allowed by `after`. */
|
|
249
|
+
function widens(before, after) {
|
|
250
|
+
if (before === after) return true;
|
|
251
|
+
const old = enumValues(before);
|
|
252
|
+
if (!old) return false;
|
|
253
|
+
if (after === 'string') return [...old].every((part) => part.startsWith('"'));
|
|
254
|
+
if (after === 'number')
|
|
255
|
+
return [...old].every((part) => !part.startsWith('"'));
|
|
256
|
+
const next = enumValues(after);
|
|
257
|
+
return next !== undefined && [...old].every((part) => next.has(part));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Compares two contracts (from `serializeContract`/`digestForm` shape or
|
|
262
|
+
* `contractOf`) and lists every change as
|
|
263
|
+
* `{ member, name, change, breaking, detail }` (§6). An empty list means the
|
|
264
|
+
* application needs no change.
|
|
265
|
+
*/
|
|
266
|
+
export function diffContracts(before, after) {
|
|
267
|
+
const changes = [];
|
|
268
|
+
const add = (member, name, change, breaking, detail) =>
|
|
269
|
+
changes.push({ member, name, change, breaking, detail });
|
|
270
|
+
const names = (a, b) =>
|
|
271
|
+
[...new Set([...Object.keys(a), ...Object.keys(b)])].sort();
|
|
272
|
+
|
|
273
|
+
for (const name of names(before.inputs, after.inputs)) {
|
|
274
|
+
const old = before.inputs[name];
|
|
275
|
+
const next = after.inputs[name];
|
|
276
|
+
if (!old)
|
|
277
|
+
add(
|
|
278
|
+
'input',
|
|
279
|
+
name,
|
|
280
|
+
'added',
|
|
281
|
+
!next.optional,
|
|
282
|
+
next.optional ? 'optional' : 'required',
|
|
283
|
+
);
|
|
284
|
+
else if (!next) add('input', name, 'removed', true, old.type);
|
|
285
|
+
else if (old.type !== next.type) {
|
|
286
|
+
add(
|
|
287
|
+
'input',
|
|
288
|
+
name,
|
|
289
|
+
widens(old.type, next.type) ? 'widened' : 'retyped',
|
|
290
|
+
!widens(old.type, next.type),
|
|
291
|
+
`${old.type} → ${next.type}`,
|
|
292
|
+
);
|
|
293
|
+
} else if (old.optional !== next.optional) {
|
|
294
|
+
add(
|
|
295
|
+
'input',
|
|
296
|
+
name,
|
|
297
|
+
next.optional ? 'made optional' : 'made required',
|
|
298
|
+
!next.optional,
|
|
299
|
+
old.type,
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
for (const name of names(before.actions, after.actions)) {
|
|
304
|
+
const old = before.actions[name];
|
|
305
|
+
const next = after.actions[name];
|
|
306
|
+
if (!old) add('action', name, 'added', true, next);
|
|
307
|
+
else if (!next) add('action', name, 'removed', true, old);
|
|
308
|
+
else if (old !== next)
|
|
309
|
+
add('action', name, 'rescoped', true, `${old} → ${next}`);
|
|
310
|
+
}
|
|
311
|
+
for (const name of names(before.slots, after.slots)) {
|
|
312
|
+
if (!(name in before.slots))
|
|
313
|
+
add('slot', name, 'added', true, after.slots[name] ?? 'no input');
|
|
314
|
+
else if (!(name in after.slots))
|
|
315
|
+
add('slot', name, 'removed', true, before.slots[name] ?? 'no input');
|
|
316
|
+
else if (before.slots[name] !== after.slots[name]) {
|
|
317
|
+
add(
|
|
318
|
+
'slot',
|
|
319
|
+
name,
|
|
320
|
+
'retyped',
|
|
321
|
+
true,
|
|
322
|
+
`${before.slots[name] ?? 'no input'} → ${after.slots[name] ?? 'no input'}`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
for (const name of names(before.refs, after.refs)) {
|
|
327
|
+
const old = before.refs[name];
|
|
328
|
+
const next = after.refs[name];
|
|
329
|
+
if (!old) add('ref', name, 'added', false, next.element);
|
|
330
|
+
else if (!next) add('ref', name, 'removed', true, old.element);
|
|
331
|
+
else if (old.element !== next.element || old.keyed !== next.keyed) {
|
|
332
|
+
add(
|
|
333
|
+
'ref',
|
|
334
|
+
name,
|
|
335
|
+
'retyped',
|
|
336
|
+
true,
|
|
337
|
+
`${old.keyed ? 'keyed ' : ''}${old.element} → ${next.keyed ? 'keyed ' : ''}${next.element}`,
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return changes;
|
|
342
|
+
}
|