@kerfjs/ui 5.0.0-beta.122 → 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 +1501 -218
- 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 -27
- 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 +12 -5
- 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 +9 -6
- 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 +1251 -132
- package/ai/skill.md +107 -40
- 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-7AK5I7U7.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-HJWFHJ3Z.js → chunk-ADMWT7FX.js} +28 -82
- 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-BSNKDW4X.js → chunk-Q7RILH2D.js} +14 -9
- 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-header/list-header.css +11 -25
- 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 +24 -17
- package/dist/styles/components/navigation/tab-bar-item/tab-bar-item.css +111 -60
- 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-header.css +11 -25
- 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 +111 -60
- package/dist/styles/tab-bar.css +24 -17
- 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 +9 -5
- package/dist/tab-bar-item.js +1 -1
- package/dist/tab-bar.d.ts +16 -3
- 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 +44 -15
- package/docs/component-selection.md +161 -126
- package/docs/data-tables-and-lists.md +1 -1
- package/docs/design/sketch/Kerf-UI.sketch +0 -0
- package/docs/design/sketch/README.md +73 -0
- package/docs/design/sketch/advanced/README.md +75 -0
- package/docs/design/sketch/button/README.md +270 -0
- package/docs/design/sketch/content/README.md +70 -0
- package/docs/design/sketch/coverage.md +159 -0
- package/docs/design/sketch/forms/README.md +97 -0
- package/docs/design/sketch/lists/README.md +65 -0
- package/docs/design/sketch/toolbar/README.md +73 -0
- package/docs/design/sketch/unified/README.md +69 -0
- package/docs/design/sketch/unified/pages/advanced.png +0 -0
- package/docs/design/sketch/unified/pages/button.png +0 -0
- package/docs/design/sketch/unified/pages/content.png +0 -0
- package/docs/design/sketch/unified/pages/forms.png +0 -0
- package/docs/design/sketch/unified/pages/lists.png +0 -0
- package/docs/design/sketch/unified/pages/toolbar.png +0 -0
- package/docs/design/sketch-runner.md +87 -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/list-header/action-dark.svg +1 -1
- package/docs/design/templates/list-header/action.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded.svg +1 -1
- package/docs/design/templates/list-header-dark.svg +1 -1
- package/docs/design/templates/list-header.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -1
- package/docs/design/templates/tab-bar-dark.svg +1 -1
- package/docs/design/templates/tab-bar.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 +10 -1
- 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 +2 -1
- package/docs/layout.md +94 -10
- 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/ux-demo.md +1 -1
- 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 +162 -21
- package/package.json +104 -6
- 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-7AK5I7U7.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-BSNKDW4X.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-HJWFHJ3Z.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-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-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-ZN7KUMPY.js.map +0 -1
- package/dist/chunk-ZX2QQJXD.js.map +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
// interpretView: renders a view document at runtime (docs/26-ui-editor.md §7)
|
|
2
|
+
// with exactly the generated module's semantics, after checking that the
|
|
3
|
+
// document's contract is the one the application compiled against. For
|
|
4
|
+
// server-driven screens; tree-shakes away when unused.
|
|
5
|
+
import { each, raw } from 'kerfjs';
|
|
6
|
+
import { jsx } from 'kerfjs/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
import * as cssValues from '../dist/css-values.js';
|
|
9
|
+
import { contractDigest, contractOf } from './contract.mjs';
|
|
10
|
+
import {
|
|
11
|
+
channelOf,
|
|
12
|
+
fieldZoneOf,
|
|
13
|
+
parseCssTree,
|
|
14
|
+
withFieldZones,
|
|
15
|
+
ZoneFill,
|
|
16
|
+
zonePropOf,
|
|
17
|
+
} from './validate.mjs';
|
|
18
|
+
|
|
19
|
+
const isObject = (value) =>
|
|
20
|
+
value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when a served document's contract differs from the one the
|
|
24
|
+
* application compiled against. `expected` and `actual` are digests;
|
|
25
|
+
* `contract` is the served document's full contract, so a host can log
|
|
26
|
+
* exactly which inputs, actions, slots, or refs it changed.
|
|
27
|
+
*/
|
|
28
|
+
export class KuiContractMismatch extends Error {
|
|
29
|
+
constructor(name, expected, actual, contract) {
|
|
30
|
+
super(
|
|
31
|
+
`view "${name}" has contract ${actual}, but the application was built against ${expected}; regenerate the app's view module or roll back the document`,
|
|
32
|
+
);
|
|
33
|
+
this.name = 'KuiContractMismatch';
|
|
34
|
+
this.expected = expected;
|
|
35
|
+
this.actual = actual;
|
|
36
|
+
this.contract = contract;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Evaluates a parsed `$css` call against the css-values builders. */
|
|
41
|
+
function evaluateCss(node) {
|
|
42
|
+
const builder = cssValues[node.name];
|
|
43
|
+
return builder(
|
|
44
|
+
...node.args.map((arg) =>
|
|
45
|
+
typeof arg === 'object' ? evaluateCss(arg) : arg,
|
|
46
|
+
),
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function readPath(root, path) {
|
|
51
|
+
return path.reduce((current, segment) => current?.[segment], root);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Renders a view document. Options:
|
|
56
|
+
* - `catalog`: from `createViewCatalog` (validation and zone bindings);
|
|
57
|
+
* - `components`: catalog key → component function (Kerf UI and app
|
|
58
|
+
* components the document uses; Web Awesome elements need none);
|
|
59
|
+
* - `inputs`, `slots`: as the generated `render<Name>` takes them;
|
|
60
|
+
* - `contract`: the `<name>Contract` digest the app compiled against;
|
|
61
|
+
* - `onMismatch(error)`: returns fallback `SafeHtml` instead of throwing;
|
|
62
|
+
* - `resolveView(src)`: loads composed documents synchronously.
|
|
63
|
+
* Throws on an invalid document or a component missing from `components`.
|
|
64
|
+
*/
|
|
65
|
+
export function interpretView(document, options) {
|
|
66
|
+
const { catalog, inputs = {}, slots = {}, resolveView } = options;
|
|
67
|
+
const contract = contractOf(document, catalog, { resolveView });
|
|
68
|
+
const actual = contractDigest(contract);
|
|
69
|
+
if (options.contract !== actual) {
|
|
70
|
+
const error = new KuiContractMismatch(
|
|
71
|
+
document.name,
|
|
72
|
+
options.contract,
|
|
73
|
+
actual,
|
|
74
|
+
contract,
|
|
75
|
+
);
|
|
76
|
+
if (options.onMismatch) return options.onMismatch(error);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
return renderDocument(document, inputs, slots, options);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Renders a document for an editor preview: no validation or contract check,
|
|
84
|
+
* and every node in `broken` (ids the caller's validation flagged), or whose
|
|
85
|
+
* evaluation throws, renders `placeholder(node, reason)` instead, so one bad
|
|
86
|
+
* node never blanks the rest. Options are interpretView's (without
|
|
87
|
+
* `contract`/`onMismatch`) plus `broken` (a Set of node ids) and
|
|
88
|
+
* `placeholder`. Not for applications: they render with interpretView, whose
|
|
89
|
+
* strictness is what keeps a served document from silently breaking them.
|
|
90
|
+
*/
|
|
91
|
+
export function previewView(document, options) {
|
|
92
|
+
const { inputs = {}, slots = {} } = options;
|
|
93
|
+
// KF-PK3GVY: an empty draft has no root yet, so it previews as nothing.
|
|
94
|
+
if (document.root === undefined) return raw('');
|
|
95
|
+
return renderDocument(document, inputs, slots, options);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function renderDocument(document, inputs, slots, options) {
|
|
99
|
+
const { catalog, components, resolveView } = options;
|
|
100
|
+
const params = document.params ?? {};
|
|
101
|
+
|
|
102
|
+
const value = (raw, scope) => {
|
|
103
|
+
// A field zone's children, in the content field it fills (KF-PD6QC5).
|
|
104
|
+
if (raw instanceof ZoneFill) return children(raw.children, scope);
|
|
105
|
+
if (isObject(raw) && '$param' in raw) {
|
|
106
|
+
// `??` as in the generated module: null and undefined take the default.
|
|
107
|
+
const read = inputs[raw.$param];
|
|
108
|
+
return 'default' in params[raw.$param]
|
|
109
|
+
? (read ?? params[raw.$param].default)
|
|
110
|
+
: read;
|
|
111
|
+
}
|
|
112
|
+
if (isObject(raw) && '$bind' in raw) {
|
|
113
|
+
const [head, ...rest] = raw.$bind.split('.');
|
|
114
|
+
// A head that is not an item is a param, read with its default as a
|
|
115
|
+
// `$param` is (KF-8P3H7F).
|
|
116
|
+
return readPath(
|
|
117
|
+
scope.has(head) ? scope.get(head) : value({ $param: head }, scope),
|
|
118
|
+
rest,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (isObject(raw) && '$action' in raw) return raw.$action;
|
|
122
|
+
if (isObject(raw) && '$icon' in raw) {
|
|
123
|
+
const icon = options.icons?.[raw.$icon];
|
|
124
|
+
if (!icon) {
|
|
125
|
+
throw new Error(
|
|
126
|
+
`interpretView: no icon data for "${raw.$icon}"; pass it in options.icons`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
return icon;
|
|
130
|
+
}
|
|
131
|
+
if (isObject(raw) && '$css' in raw)
|
|
132
|
+
return evaluateCss(parseCssTree(raw.$css));
|
|
133
|
+
// An item slot (KF-SXDM56): content the application fills, as a zone's.
|
|
134
|
+
if (isObject(raw) && '$slot' in raw) return slots[raw.$slot]();
|
|
135
|
+
if (isObject(raw)) {
|
|
136
|
+
return Object.fromEntries(
|
|
137
|
+
Object.keys(raw).map((key) => [key, value(raw[key], scope)]),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(raw)) return raw.map((item) => value(item, scope));
|
|
141
|
+
return raw;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const children = (list, scope, slot) => {
|
|
145
|
+
const items = list.map((child) => childValue(child, scope, slot));
|
|
146
|
+
// KF-YCM09F: an empty zone is an explicit null.
|
|
147
|
+
if (items.length === 0) return null;
|
|
148
|
+
return items.length === 1 ? items[0] : items;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const childValue = (child, scope, slot) => {
|
|
152
|
+
if ('$each' in child) {
|
|
153
|
+
// The key path starts with `as` (validation requires it); read the rest
|
|
154
|
+
// from the item.
|
|
155
|
+
const rest = child.key.split('.').slice(1);
|
|
156
|
+
const items = value(child.$each, scope);
|
|
157
|
+
const row = (item) =>
|
|
158
|
+
nodeValue(
|
|
159
|
+
child.template,
|
|
160
|
+
new Map(scope).set(child.as, item),
|
|
161
|
+
readPath(item, rest),
|
|
162
|
+
slot,
|
|
163
|
+
);
|
|
164
|
+
// Scope holds only `$each` items, so a non-empty scope is a row
|
|
165
|
+
// template. kerf never reconciles a list inside a row (the row is
|
|
166
|
+
// flattened to HTML, and a keyed each() there throws), so an inner
|
|
167
|
+
// repeat is a plain map that re-renders with its row, as the generated
|
|
168
|
+
// module writes it (KF-CFA1S1).
|
|
169
|
+
return scope.size
|
|
170
|
+
? items.map(row)
|
|
171
|
+
: each(items, row, { key: child.template.id });
|
|
172
|
+
}
|
|
173
|
+
if ('$if' in child) {
|
|
174
|
+
if (value(child.$if, scope)) return childValue(child.then, scope, slot);
|
|
175
|
+
return 'else' in child ? childValue(child.else, scope, slot) : null;
|
|
176
|
+
}
|
|
177
|
+
if ('$slot' in child) {
|
|
178
|
+
return isObject(child.input)
|
|
179
|
+
? slots[child.$slot](value(child.input, scope))
|
|
180
|
+
: slots[child.$slot]();
|
|
181
|
+
}
|
|
182
|
+
return nodeValue(child, scope, undefined, slot);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// A preview (previewView) swaps a node it cannot render for the caller's
|
|
186
|
+
// placeholder: one the caller already knows is broken, or one whose
|
|
187
|
+
// evaluation throws. The strict interpretView path never does.
|
|
188
|
+
const nodeValue = (node, scope, rowKey, slot) => {
|
|
189
|
+
const { placeholder, broken } = options;
|
|
190
|
+
if (!placeholder) return evaluateNode(node, scope, rowKey, slot);
|
|
191
|
+
if (broken?.has(node.id)) return placeholder(node, 'problem');
|
|
192
|
+
try {
|
|
193
|
+
return evaluateNode(node, scope, rowKey, slot);
|
|
194
|
+
} catch (error) {
|
|
195
|
+
return placeholder(
|
|
196
|
+
node,
|
|
197
|
+
error instanceof Error ? error.message : String(error),
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const evaluateNode = (node, scope, rowKey, slot) => {
|
|
203
|
+
if (node.type === '#text') {
|
|
204
|
+
const text = value(node.value, scope);
|
|
205
|
+
return slot ? jsx('span', { slot, children: text }) : text;
|
|
206
|
+
}
|
|
207
|
+
if (node.type === '#view') {
|
|
208
|
+
const child = resolveView(node.src);
|
|
209
|
+
return renderDocument(child, value(node.props ?? {}, scope), {}, options);
|
|
210
|
+
}
|
|
211
|
+
const { component: definition, definitions } = catalog.components.get(
|
|
212
|
+
node.type,
|
|
213
|
+
);
|
|
214
|
+
const zones = isObject(node.zones) ? node.zones : {};
|
|
215
|
+
const props = withFieldZones(
|
|
216
|
+
isObject(node.props) ? node.props : {},
|
|
217
|
+
zones,
|
|
218
|
+
definition,
|
|
219
|
+
definitions,
|
|
220
|
+
);
|
|
221
|
+
const out = {};
|
|
222
|
+
for (const name of Object.keys(props)) {
|
|
223
|
+
if (name !== 'rootAttributes') out[name] = value(props[name], scope);
|
|
224
|
+
}
|
|
225
|
+
if (definition.source === 'webawesome') {
|
|
226
|
+
out['data-kerf-node'] = node.id;
|
|
227
|
+
if (rowKey !== undefined) out['data-key'] = String(rowKey);
|
|
228
|
+
if (slot) out.slot = slot;
|
|
229
|
+
const parts = Object.keys(zones)
|
|
230
|
+
.sort()
|
|
231
|
+
.flatMap((key) =>
|
|
232
|
+
zones[key].map((child) =>
|
|
233
|
+
childValue(child, scope, key === 'default' ? undefined : key),
|
|
234
|
+
),
|
|
235
|
+
);
|
|
236
|
+
if (parts.length) out.children = parts.length === 1 ? parts[0] : parts;
|
|
237
|
+
return jsx(definition.tagName, out);
|
|
238
|
+
}
|
|
239
|
+
for (const key of Object.keys(zones)) {
|
|
240
|
+
if (fieldZoneOf(definition, definitions, key)) continue;
|
|
241
|
+
out[zonePropOf(catalog, definition, key)] = children(zones[key], scope);
|
|
242
|
+
}
|
|
243
|
+
if (slot && definition.props.some((prop) => prop.name === 'slot'))
|
|
244
|
+
out.slot = slot;
|
|
245
|
+
const channel = channelOf(definition);
|
|
246
|
+
if (channel === 'rootAttributes') {
|
|
247
|
+
const base =
|
|
248
|
+
props.rootAttributes === undefined
|
|
249
|
+
? {}
|
|
250
|
+
: value(props.rootAttributes, scope);
|
|
251
|
+
out.rootAttributes = {
|
|
252
|
+
...base,
|
|
253
|
+
'data-kerf-node': node.id,
|
|
254
|
+
...(rowKey === undefined ? {} : { 'data-key': String(rowKey) }),
|
|
255
|
+
};
|
|
256
|
+
} else if (channel === 'native') {
|
|
257
|
+
out['data-kerf-node'] = node.id;
|
|
258
|
+
if (rowKey !== undefined) out['data-key'] = String(rowKey);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const render = components[node.type];
|
|
262
|
+
if (typeof render !== 'function') {
|
|
263
|
+
throw new Error(
|
|
264
|
+
`interpretView: no component function for ${node.type}; pass it in options.components`,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
return render(out);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
return nodeValue(document.root, new Map(), undefined, undefined);
|
|
271
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
// createMoveCheck (KF-SFAA5R: scoped move validation): whether moving one
|
|
2
|
+
// node adds a problem, answered without validating the whole moved document
|
|
3
|
+
// per destination. A move changes no id, name, slot, or param, so only three
|
|
4
|
+
// places can gain or lose problems: the source parent, the target parent, and
|
|
5
|
+
// the moved subtree in its new place. Each is checked alone with the
|
|
6
|
+
// validator's own checkNode, and the result is the full validation's,
|
|
7
|
+
// adjusted. Where a check depends on more than those places (the order of
|
|
8
|
+
// action uses, duplicate ids; docs/26-ui-editor.md §8.1), the check answers `undefined`
|
|
9
|
+
// and the caller validates in full, so an answer is never a guess.
|
|
10
|
+
import {
|
|
11
|
+
childFacts,
|
|
12
|
+
createScopedCheck,
|
|
13
|
+
runView,
|
|
14
|
+
validateView,
|
|
15
|
+
} from './validate.mjs';
|
|
16
|
+
|
|
17
|
+
const isObject = (value) =>
|
|
18
|
+
value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
19
|
+
const keyOf = ({ code, message }) => `${code} ${message}`;
|
|
20
|
+
const conflictKey = (name) =>
|
|
21
|
+
`KUI-V009 action "${name}" is used with both row and view scope`;
|
|
22
|
+
|
|
23
|
+
function count(diagnostics, into = new Map(), sign = 1) {
|
|
24
|
+
for (const diagnostic of diagnostics) {
|
|
25
|
+
const key = keyOf(diagnostic);
|
|
26
|
+
into.set(key, (into.get(key) ?? 0) + sign);
|
|
27
|
+
}
|
|
28
|
+
return into;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether one `$slot` object sits at two places a prop value is checked
|
|
33
|
+
* from: the validator reports a malformed one once per document, by
|
|
34
|
+
* identity, so a piece checked alone would report it again.
|
|
35
|
+
*/
|
|
36
|
+
function sharedSlot(root) {
|
|
37
|
+
const seen = new WeakSet();
|
|
38
|
+
const value = (item) => {
|
|
39
|
+
if (item === null || typeof item !== 'object') return false;
|
|
40
|
+
if ('$slot' in item) {
|
|
41
|
+
if (seen.has(item)) return true;
|
|
42
|
+
seen.add(item);
|
|
43
|
+
}
|
|
44
|
+
return Object.values(item).some(value);
|
|
45
|
+
};
|
|
46
|
+
const child = (item) => {
|
|
47
|
+
if (!isObject(item)) return false;
|
|
48
|
+
if ('$each' in item) return node(item.template);
|
|
49
|
+
if ('$if' in item)
|
|
50
|
+
return value(item.$if) || child(item.then) || child(item.else);
|
|
51
|
+
if ('$slot' in item) return value(item.input);
|
|
52
|
+
return node(item);
|
|
53
|
+
};
|
|
54
|
+
const node = (item) =>
|
|
55
|
+
isObject(item) &&
|
|
56
|
+
(value(item.props) ||
|
|
57
|
+
value(item.value) ||
|
|
58
|
+
Object.values(isObject(item.zones) ? item.zones : {}).some(
|
|
59
|
+
(list) => Array.isArray(list) && list.some(child),
|
|
60
|
+
));
|
|
61
|
+
return node(root);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Every node by id and every node placed directly in a zone list, as the
|
|
66
|
+
* editor's edits find them. Undefined unless the tree is well formed, ids
|
|
67
|
+
* are distinct strings, and names are distinct: then no move can report a
|
|
68
|
+
* duplicate, and each id names one node.
|
|
69
|
+
*/
|
|
70
|
+
function indexDocument(document) {
|
|
71
|
+
const nodes = new Map();
|
|
72
|
+
const placements = new Map();
|
|
73
|
+
const names = new Set();
|
|
74
|
+
let ok = isObject(document) && !sharedSlot(document.root);
|
|
75
|
+
const node = (item) => {
|
|
76
|
+
if (!ok || !isObject(item) || !('type' in item)) return void (ok = false);
|
|
77
|
+
if (typeof item.id !== 'string' || nodes.has(item.id)) ok = false;
|
|
78
|
+
nodes.set(item.id, item);
|
|
79
|
+
if (typeof item.name === 'string') {
|
|
80
|
+
if (names.has(item.name)) ok = false;
|
|
81
|
+
names.add(item.name);
|
|
82
|
+
}
|
|
83
|
+
if (item.zones === undefined) return;
|
|
84
|
+
if (!isObject(item.zones)) return void (ok = false);
|
|
85
|
+
for (const [zone, list] of Object.entries(item.zones)) {
|
|
86
|
+
if (!Array.isArray(list)) return void (ok = false);
|
|
87
|
+
list.forEach((entry, index) => child(entry, item, zone, index, true));
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const child = (item, parent, zone, index, direct) => {
|
|
91
|
+
if (!isObject(item)) ok = false;
|
|
92
|
+
else if ('$each' in item) node(item.template);
|
|
93
|
+
else if ('$if' in item) {
|
|
94
|
+
child(item.then, parent, zone, index, false);
|
|
95
|
+
if ('else' in item) child(item.else, parent, zone, index, false);
|
|
96
|
+
} else if (!('$slot' in item)) {
|
|
97
|
+
if (direct) placements.set(item.id, { parent, zone, index });
|
|
98
|
+
node(item);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
if (ok) node(document.root);
|
|
102
|
+
return ok ? { nodes, placements } : undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** The ids of every node a zone child holds, itself included. */
|
|
106
|
+
function heldIds(item, ids = new Set()) {
|
|
107
|
+
if ('$slot' in item) return ids;
|
|
108
|
+
if ('$each' in item) return heldIds(item.template, ids);
|
|
109
|
+
if ('$if' in item) {
|
|
110
|
+
heldIds(item.then, ids);
|
|
111
|
+
if (item.else) heldIds(item.else, ids);
|
|
112
|
+
return ids;
|
|
113
|
+
}
|
|
114
|
+
ids.add(item.id);
|
|
115
|
+
for (const list of Object.values(item.zones ?? {}))
|
|
116
|
+
for (const inner of list) heldIds(inner, ids);
|
|
117
|
+
return ids;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* `node`'s tree with `prepare` applied to every node, sharing what it leaves
|
|
122
|
+
* alone; `map` records each node's prepared copy.
|
|
123
|
+
*/
|
|
124
|
+
function prepareTree(node, prepare, map) {
|
|
125
|
+
const prepared = prepare(node);
|
|
126
|
+
let changed = prepared !== node;
|
|
127
|
+
let zones;
|
|
128
|
+
if (node.zones) {
|
|
129
|
+
zones = {};
|
|
130
|
+
for (const [key, list] of Object.entries(node.zones)) {
|
|
131
|
+
zones[key] = list.map((item) => prepareChild(item, prepare, map));
|
|
132
|
+
changed ||= zones[key].some((item, index) => item !== list[index]);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const result = !changed ? node : zones ? { ...prepared, zones } : prepared;
|
|
136
|
+
map.set(node, result);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function prepareChild(item, prepare, map) {
|
|
141
|
+
if ('$each' in item) {
|
|
142
|
+
const template = prepareTree(item.template, prepare, map);
|
|
143
|
+
return template === item.template ? item : { ...item, template };
|
|
144
|
+
}
|
|
145
|
+
if ('$if' in item) {
|
|
146
|
+
const then = prepareChild(item.then, prepare, map);
|
|
147
|
+
const otherwise =
|
|
148
|
+
'else' in item ? prepareChild(item.else, prepare, map) : undefined;
|
|
149
|
+
return then === item.then && otherwise === item.else
|
|
150
|
+
? item
|
|
151
|
+
: { ...item, then, ...('else' in item ? { else: otherwise } : {}) };
|
|
152
|
+
}
|
|
153
|
+
if ('$slot' in item) return item;
|
|
154
|
+
return prepareTree(item, prepare, map);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Prepares to ask, for node `id`, whether moving it to the end of a zone adds
|
|
159
|
+
* a problem: whether `validateView(moved, catalog)` (with `prepare` applied
|
|
160
|
+
* to every node of the moved document) has a problem, by code and message,
|
|
161
|
+
* that `validateView(document, catalog)` lacks. `prepare` may change a
|
|
162
|
+
* node's own fields from its own fields and its zones' lengths, as the
|
|
163
|
+
* editor's field ownership does; it never changes zones.
|
|
164
|
+
*
|
|
165
|
+
* The returned function takes the target `parent` id and `zone` and answers
|
|
166
|
+
* `true` when the move changes the document and adds no problem, `false`
|
|
167
|
+
* when it adds one or moves nothing (into the node itself), and `undefined`
|
|
168
|
+
* when only a full validation can tell.
|
|
169
|
+
*/
|
|
170
|
+
export function createMoveCheck(document, catalog, id, options = {}) {
|
|
171
|
+
const prepare = options.prepare ?? ((node) => node);
|
|
172
|
+
const undecided = () => undefined;
|
|
173
|
+
const index = indexDocument(document);
|
|
174
|
+
const place = index?.placements.get(id);
|
|
175
|
+
if (!place) return undecided;
|
|
176
|
+
|
|
177
|
+
const map = new Map();
|
|
178
|
+
const root = prepareTree(document.root, prepare, map);
|
|
179
|
+
const prepared = root === document.root ? document : { ...document, root };
|
|
180
|
+
const trace = { entries: new Map(), notes: [] };
|
|
181
|
+
const base = runView(prepared, catalog, {}, trace).diagnostics;
|
|
182
|
+
const beforeCounts = count(
|
|
183
|
+
prepared === document ? base : validateView(document, catalog).diagnostics,
|
|
184
|
+
);
|
|
185
|
+
const baseCounts = count(base);
|
|
186
|
+
const excess = [...baseCounts].filter(
|
|
187
|
+
([key, total]) => total > (beforeCounts.get(key) ?? 0),
|
|
188
|
+
);
|
|
189
|
+
const baseUses = new Map();
|
|
190
|
+
for (const [name, scope] of trace.notes) {
|
|
191
|
+
const uses = baseUses.get(name) ?? { row: 0, view: 0 };
|
|
192
|
+
uses[scope] += 1;
|
|
193
|
+
baseUses.set(name, uses);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const check = createScopedCheck(prepared, catalog);
|
|
197
|
+
const shallow = (node, entry, zone) =>
|
|
198
|
+
check(node, entry, { shallow: true, zone });
|
|
199
|
+
const scopeIds = new Map();
|
|
200
|
+
let scopeCount = 0;
|
|
201
|
+
const subtreeRuns = new Map();
|
|
202
|
+
const subtree = (node, entry) => {
|
|
203
|
+
if (!scopeIds.has(entry[1])) scopeIds.set(entry[1], scopeCount++);
|
|
204
|
+
// An entry is checkNode's arguments (path, scope, row scope, parent,
|
|
205
|
+
// text zone) and the enclosing control; all but the path matter.
|
|
206
|
+
const [, scope, ...rest] = entry;
|
|
207
|
+
const key = JSON.stringify([scopeIds.get(scope), ...rest]);
|
|
208
|
+
if (!subtreeRuns.has(key))
|
|
209
|
+
subtreeRuns.set(key, check(node, entry, { asChild: true }));
|
|
210
|
+
return subtreeRuns.get(key);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const sourceDoc = place.parent;
|
|
214
|
+
const sourceZone = place.zone;
|
|
215
|
+
const movedDoc = index.nodes.get(id);
|
|
216
|
+
const moved = map.get(movedDoc);
|
|
217
|
+
const source = map.get(sourceDoc);
|
|
218
|
+
const held = heldIds(movedDoc);
|
|
219
|
+
const without = (zones) => ({
|
|
220
|
+
...zones,
|
|
221
|
+
[sourceZone]: zones[sourceZone].filter((_, at) => at !== place.index),
|
|
222
|
+
});
|
|
223
|
+
const leftDoc = { ...sourceDoc, zones: without(sourceDoc.zones) };
|
|
224
|
+
const left = { ...prepare(leftDoc), zones: without(source.zones) };
|
|
225
|
+
const sourceEntry = trace.entries.get(source);
|
|
226
|
+
const sourceBefore = sourceEntry && shallow(source, sourceEntry);
|
|
227
|
+
const sourceAfter = sourceEntry && shallow(left, sourceEntry);
|
|
228
|
+
const movedEntry = trace.entries.get(moved);
|
|
229
|
+
const movedBefore = movedEntry && check(moved, movedEntry, { asChild: true });
|
|
230
|
+
const shallowBefore = new Map();
|
|
231
|
+
// Same host for its children, same facts for its parent: else the move
|
|
232
|
+
// reaches past the three places.
|
|
233
|
+
const sameReach = (before, after, node, next) =>
|
|
234
|
+
before.hostAfter === after.hostAfter &&
|
|
235
|
+
childFacts(catalog, node) === childFacts(catalog, next);
|
|
236
|
+
|
|
237
|
+
return (parent, zone) => {
|
|
238
|
+
if (held.has(parent)) return false;
|
|
239
|
+
const targetDoc = index.nodes.get(parent);
|
|
240
|
+
if (!targetDoc || (targetDoc === sourceDoc && zone === sourceZone))
|
|
241
|
+
return undefined;
|
|
242
|
+
const list = targetDoc.zones?.[zone];
|
|
243
|
+
if (list !== undefined && !Array.isArray(list)) return undefined;
|
|
244
|
+
const same = targetDoc === sourceDoc;
|
|
245
|
+
const target = map.get(targetDoc);
|
|
246
|
+
const append = (zones, item) => ({
|
|
247
|
+
...(zones ?? {}),
|
|
248
|
+
[zone]: [...(zones?.[zone] ?? []), item],
|
|
249
|
+
});
|
|
250
|
+
const baseDoc = same ? leftDoc : targetDoc;
|
|
251
|
+
const landed = {
|
|
252
|
+
...prepare({ ...baseDoc, zones: append(baseDoc.zones, movedDoc) }),
|
|
253
|
+
zones: append(same ? left.zones : target.zones, moved),
|
|
254
|
+
};
|
|
255
|
+
const removed = movedBefore ? [movedBefore] : [];
|
|
256
|
+
const added = [];
|
|
257
|
+
if (sourceEntry && !same) {
|
|
258
|
+
if (!sameReach(sourceBefore, sourceAfter, source, left)) return undefined;
|
|
259
|
+
removed.push(sourceBefore);
|
|
260
|
+
added.push(sourceAfter);
|
|
261
|
+
}
|
|
262
|
+
const targetEntry = trace.entries.get(target);
|
|
263
|
+
if (targetEntry) {
|
|
264
|
+
if (!shallowBefore.has(target))
|
|
265
|
+
shallowBefore.set(target, shallow(target, targetEntry));
|
|
266
|
+
const before = shallowBefore.get(target);
|
|
267
|
+
const after = shallow(landed, targetEntry, zone);
|
|
268
|
+
if (!sameReach(before, after, target, landed)) return undefined;
|
|
269
|
+
removed.push(before);
|
|
270
|
+
added.push(after);
|
|
271
|
+
if (after.child) {
|
|
272
|
+
added.push(subtree(moved, after.child));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
const delta = new Map();
|
|
276
|
+
const uses = new Map();
|
|
277
|
+
for (const [runs, sign] of [
|
|
278
|
+
[removed, -1],
|
|
279
|
+
[added, 1],
|
|
280
|
+
]) {
|
|
281
|
+
for (const run of runs) {
|
|
282
|
+
count(run.diagnostics, delta, sign);
|
|
283
|
+
for (const [name, scope] of run.notes) {
|
|
284
|
+
const use = uses.get(name) ?? { row: 0, view: 0 };
|
|
285
|
+
use[scope] += sign;
|
|
286
|
+
uses.set(name, use);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// Each use of an action in the other scope than its first use reports a
|
|
291
|
+
// conflict. One scope reports none; with both, document order decides
|
|
292
|
+
// between the two counts, which matters only when they fall on either
|
|
293
|
+
// side of the count before the move.
|
|
294
|
+
const conflicts = new Map();
|
|
295
|
+
for (const [name, use] of uses) {
|
|
296
|
+
const total = baseUses.get(name) ?? { row: 0, view: 0 };
|
|
297
|
+
const row = total.row + use.row;
|
|
298
|
+
const view = total.view + use.view;
|
|
299
|
+
const key = conflictKey(name);
|
|
300
|
+
const before = beforeCounts.get(key) ?? 0;
|
|
301
|
+
if (!row || !view) conflicts.set(key, 0);
|
|
302
|
+
else if (Math.min(row, view) > before) return false;
|
|
303
|
+
else if (Math.max(row, view) <= before) conflicts.set(key, before);
|
|
304
|
+
else return undefined;
|
|
305
|
+
}
|
|
306
|
+
for (const key of new Set([
|
|
307
|
+
...delta.keys(),
|
|
308
|
+
...excess.map(([key]) => key),
|
|
309
|
+
])) {
|
|
310
|
+
const total =
|
|
311
|
+
conflicts.get(key) ??
|
|
312
|
+
(baseCounts.get(key) ?? 0) + (delta.get(key) ?? 0);
|
|
313
|
+
if (total > (beforeCounts.get(key) ?? 0)) return false;
|
|
314
|
+
}
|
|
315
|
+
return true;
|
|
316
|
+
};
|
|
317
|
+
}
|