@kerfjs/ui 5.0.0-beta.130 → 5.0.0-beta.132
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 +1 -13
- package/ai/application-ui-profile-sync.cjs +5 -14
- package/ai/application-ui-profile.d.ts +0 -2
- package/ai/application-ui-profile.defaults.json +0 -4
- package/ai/application-ui-profile.mjs +5 -14
- package/ai/application-ui-profile.schema.json +0 -4
- package/ai/component-catalog.json +24 -12
- package/ai/component-composition-rules.json +2 -10
- package/ai/component-composition.d.ts +0 -17
- package/ai/component-composition.json +10 -13
- package/ai/component-composition.schema.json +0 -59
- package/ai/components/column-track.md +5 -3
- package/ai/components/disclosure.md +2 -0
- package/ai/components/form.md +1 -2
- package/ai/components/tab-panel.md +0 -1
- package/ai/components/tabs.md +2 -1
- package/ai/components/toolbar-control-group.md +2 -2
- package/ai/public-api-signatures-v1.md +218 -202
- package/ai/skill.md +5 -22
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/backdrop-image.d.ts +1 -1
- package/dist/backdrop-image.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/button.js +1 -1
- package/dist/catalog-resources.d.ts +2 -2
- package/dist/catalog.d.ts +2 -2
- package/dist/catalog.js +17 -16
- 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 +3 -3
- package/dist/choice-chips.js +1 -1
- package/dist/{chunk-Q5BPZPCO.js → chunk-22T7FFCL.js} +2 -2
- package/dist/{chunk-Q5BPZPCO.js.map → chunk-22T7FFCL.js.map} +1 -1
- package/dist/{chunk-BCHK33XL.js → chunk-27NEAPV7.js} +2 -2
- package/dist/{chunk-BCHK33XL.js.map → chunk-27NEAPV7.js.map} +1 -1
- package/dist/{chunk-76BLSFEA.js → chunk-2OYMXGW2.js} +6 -5
- package/dist/chunk-2OYMXGW2.js.map +1 -0
- package/dist/{chunk-ASU4ODOH.js → chunk-2RDWKN3Y.js} +39 -8
- package/dist/chunk-2RDWKN3Y.js.map +1 -0
- package/dist/{chunk-EHR7R7YP.js → chunk-3DPHCZQB.js} +2 -2
- package/dist/{chunk-EHR7R7YP.js.map → chunk-3DPHCZQB.js.map} +1 -1
- package/dist/{chunk-RPJOLDSR.js → chunk-3UIZ36BP.js} +3 -3
- package/dist/{chunk-RPJOLDSR.js.map → chunk-3UIZ36BP.js.map} +1 -1
- package/dist/{chunk-OSL4LQ7T.js → chunk-42NLFCIN.js} +6 -6
- package/dist/{chunk-OSL4LQ7T.js.map → chunk-42NLFCIN.js.map} +1 -1
- package/dist/{chunk-UPHPFKAD.js → chunk-4GGIML4E.js} +2 -2
- package/dist/{chunk-UPHPFKAD.js.map → chunk-4GGIML4E.js.map} +1 -1
- package/dist/{chunk-LET362AM.js → chunk-4YXKDS6I.js} +2 -2
- package/dist/{chunk-LET362AM.js.map → chunk-4YXKDS6I.js.map} +1 -1
- package/dist/{chunk-5KWXM5O7.js → chunk-5C34PAUY.js} +2 -2
- package/dist/{chunk-5KWXM5O7.js.map → chunk-5C34PAUY.js.map} +1 -1
- package/dist/{chunk-S7QB5KMM.js → chunk-5L3MLWD5.js} +19 -55
- package/dist/chunk-5L3MLWD5.js.map +1 -0
- package/dist/{chunk-6PHG2DMG.js → chunk-6OH734CG.js} +2 -2
- package/dist/{chunk-6PHG2DMG.js.map → chunk-6OH734CG.js.map} +1 -1
- package/dist/{chunk-E7ZRBMVQ.js → chunk-7XIY7G4K.js} +3 -3
- package/dist/{chunk-E7ZRBMVQ.js.map → chunk-7XIY7G4K.js.map} +1 -1
- package/dist/{chunk-OKZTLRGG.js → chunk-B5Q3KE4Z.js} +2 -2
- package/dist/{chunk-OKZTLRGG.js.map → chunk-B5Q3KE4Z.js.map} +1 -1
- package/dist/{chunk-SGYBIKQA.js → chunk-BADEZQ3V.js} +4 -4
- package/dist/chunk-BADEZQ3V.js.map +1 -0
- package/dist/{chunk-CJAKN2KZ.js → chunk-BLBMUD2W.js} +2 -2
- package/dist/{chunk-CJAKN2KZ.js.map → chunk-BLBMUD2W.js.map} +1 -1
- package/dist/{chunk-TRJS7M2H.js → chunk-BNRH7XG5.js} +2 -2
- package/dist/{chunk-TRJS7M2H.js.map → chunk-BNRH7XG5.js.map} +1 -1
- package/dist/{chunk-NA4LKVPX.js → chunk-BNXJQB2Y.js} +2 -2
- package/dist/{chunk-NA4LKVPX.js.map → chunk-BNXJQB2Y.js.map} +1 -1
- package/dist/{chunk-CCPWJDRW.js → chunk-BQHGXQVA.js} +2 -2
- package/dist/{chunk-CCPWJDRW.js.map → chunk-BQHGXQVA.js.map} +1 -1
- package/dist/{chunk-COQI4OMZ.js → chunk-BRDTP3RT.js} +1 -1
- package/dist/chunk-BRDTP3RT.js.map +1 -0
- package/dist/{chunk-RGB4DPMN.js → chunk-DGYGRMES.js} +3 -3
- package/dist/chunk-DGYGRMES.js.map +1 -0
- package/dist/{chunk-V3IXAI4L.js → chunk-DNNHT7RB.js} +2 -2
- package/dist/{chunk-V3IXAI4L.js.map → chunk-DNNHT7RB.js.map} +1 -1
- package/dist/{chunk-UU37OR3D.js → chunk-DT7KOBQJ.js} +1 -1
- package/dist/chunk-DT7KOBQJ.js.map +1 -0
- package/dist/{chunk-WUVHP3UC.js → chunk-DUKE3PLH.js} +12 -3
- package/dist/chunk-DUKE3PLH.js.map +1 -0
- package/dist/{chunk-IPYQYLSX.js → chunk-EWCTBJ5O.js} +6 -6
- package/dist/{chunk-IPYQYLSX.js.map → chunk-EWCTBJ5O.js.map} +1 -1
- package/dist/{chunk-ECJHCPBN.js → chunk-F25UMYDX.js} +8 -3
- package/dist/chunk-F25UMYDX.js.map +1 -0
- package/dist/{chunk-C4FBYP2D.js → chunk-FJAAOIMP.js} +2 -2
- package/dist/{chunk-C4FBYP2D.js.map → chunk-FJAAOIMP.js.map} +1 -1
- package/dist/{chunk-RHMY45DK.js → chunk-H2XGWH4V.js} +5 -5
- package/dist/{chunk-RHMY45DK.js.map → chunk-H2XGWH4V.js.map} +1 -1
- package/dist/{chunk-76VCWWUA.js → chunk-HSMSTCNZ.js} +2 -2
- package/dist/{chunk-76VCWWUA.js.map → chunk-HSMSTCNZ.js.map} +1 -1
- package/dist/{chunk-ECVTRAXN.js → chunk-IQOO3ZQK.js} +2 -2
- package/dist/{chunk-ECVTRAXN.js.map → chunk-IQOO3ZQK.js.map} +1 -1
- package/dist/{chunk-DBP3N6E5.js → chunk-JBL6SCNN.js} +3 -3
- package/dist/{chunk-DBP3N6E5.js.map → chunk-JBL6SCNN.js.map} +1 -1
- package/dist/{chunk-7KN5OQVN.js → chunk-JNQBPRAA.js} +2 -2
- package/dist/{chunk-7KN5OQVN.js.map → chunk-JNQBPRAA.js.map} +1 -1
- package/dist/{chunk-CPTQABDQ.js → chunk-JNSPYECP.js} +2 -2
- package/dist/{chunk-CPTQABDQ.js.map → chunk-JNSPYECP.js.map} +1 -1
- package/dist/{chunk-E7Q6UNCB.js → chunk-KBDYXGYT.js} +2 -2
- package/dist/{chunk-E7Q6UNCB.js.map → chunk-KBDYXGYT.js.map} +1 -1
- package/dist/{chunk-WVQDIOD7.js → chunk-KKMZP3YL.js} +2 -2
- package/dist/{chunk-WVQDIOD7.js.map → chunk-KKMZP3YL.js.map} +1 -1
- package/dist/{chunk-WSPXSWFG.js → chunk-KZEHTRPC.js} +3 -3
- package/dist/chunk-KZEHTRPC.js.map +1 -0
- package/dist/{chunk-KACJOE2N.js → chunk-LH5V6XGH.js} +2 -2
- package/dist/{chunk-KACJOE2N.js.map → chunk-LH5V6XGH.js.map} +1 -1
- package/dist/{chunk-VBXKYT4O.js → chunk-LH7YRRY7.js} +2 -2
- package/dist/{chunk-VBXKYT4O.js.map → chunk-LH7YRRY7.js.map} +1 -1
- package/dist/{chunk-QXXLDY6I.js → chunk-LI7AQ5NQ.js} +4 -4
- package/dist/{chunk-QXXLDY6I.js.map → chunk-LI7AQ5NQ.js.map} +1 -1
- package/dist/chunk-LK3QJHVX.js +19 -0
- package/dist/chunk-LK3QJHVX.js.map +1 -0
- package/dist/{chunk-LETAE6SX.js → chunk-LSFPZR52.js} +4 -4
- package/dist/{chunk-LETAE6SX.js.map → chunk-LSFPZR52.js.map} +1 -1
- package/dist/{chunk-CRHKWHTA.js → chunk-LUWZ7UZQ.js} +4 -4
- package/dist/{chunk-CRHKWHTA.js.map → chunk-LUWZ7UZQ.js.map} +1 -1
- package/dist/{chunk-CMG4OZPV.js → chunk-LWWIBUDK.js} +2 -2
- package/dist/{chunk-CMG4OZPV.js.map → chunk-LWWIBUDK.js.map} +1 -1
- package/dist/{chunk-LOW7J7SE.js → chunk-MHF2NK7F.js} +4 -4
- package/dist/{chunk-LOW7J7SE.js.map → chunk-MHF2NK7F.js.map} +1 -1
- package/dist/{chunk-JHUEYWWI.js → chunk-MPM6YBOM.js} +2 -2
- package/dist/{chunk-JHUEYWWI.js.map → chunk-MPM6YBOM.js.map} +1 -1
- package/dist/{chunk-ALBFHXMZ.js → chunk-MPT6Y7Z2.js} +87 -2
- package/dist/chunk-MPT6Y7Z2.js.map +1 -0
- package/dist/{chunk-OZKBIPXU.js → chunk-NO2XO7S6.js} +3 -3
- package/dist/{chunk-OZKBIPXU.js.map → chunk-NO2XO7S6.js.map} +1 -1
- package/dist/{chunk-FQETQ7CM.js → chunk-NSNQWDJ4.js} +2 -2
- package/dist/{chunk-FQETQ7CM.js.map → chunk-NSNQWDJ4.js.map} +1 -1
- package/dist/{chunk-F34LHBQI.js → chunk-OW2ODKHN.js} +9 -17
- package/dist/chunk-OW2ODKHN.js.map +1 -0
- package/dist/{chunk-PVKAIVKE.js → chunk-P427MACE.js} +63 -74
- package/dist/chunk-P427MACE.js.map +1 -0
- package/dist/{chunk-FR5G77K5.js → chunk-PJKH2GZ3.js} +2 -2
- package/dist/{chunk-FR5G77K5.js.map → chunk-PJKH2GZ3.js.map} +1 -1
- package/dist/{chunk-FNJA4S6J.js → chunk-QNA27ABY.js} +3 -3
- package/dist/{chunk-FNJA4S6J.js.map → chunk-QNA27ABY.js.map} +1 -1
- package/dist/chunk-QYOPZ2XS.js +124 -0
- package/dist/chunk-QYOPZ2XS.js.map +1 -0
- package/dist/{chunk-6BXPN5SC.js → chunk-RO3TSZ5W.js} +3 -3
- package/dist/{chunk-6BXPN5SC.js.map → chunk-RO3TSZ5W.js.map} +1 -1
- package/dist/{chunk-4IXG6XCT.js → chunk-RUCUU7Z7.js} +2 -2
- package/dist/{chunk-4IXG6XCT.js.map → chunk-RUCUU7Z7.js.map} +1 -1
- package/dist/{chunk-2FA3SX57.js → chunk-RYBJ7OZB.js} +4 -4
- package/dist/{chunk-2FA3SX57.js.map → chunk-RYBJ7OZB.js.map} +1 -1
- package/dist/{chunk-QSJAIXLM.js → chunk-SDQZYSCA.js} +3 -3
- package/dist/{chunk-QSJAIXLM.js.map → chunk-SDQZYSCA.js.map} +1 -1
- package/dist/{chunk-3XSY5LAB.js → chunk-SXZTDJMG.js} +4 -4
- package/dist/{chunk-3XSY5LAB.js.map → chunk-SXZTDJMG.js.map} +1 -1
- package/dist/{chunk-UD5KHQOH.js → chunk-T7M5FKCE.js} +28 -4
- package/dist/chunk-T7M5FKCE.js.map +1 -0
- package/dist/{chunk-KS7EXW4P.js → chunk-TIRBSPP2.js} +2 -2
- package/dist/{chunk-KS7EXW4P.js.map → chunk-TIRBSPP2.js.map} +1 -1
- package/dist/{chunk-XO5IOPM5.js → chunk-TNJGPG6R.js} +8 -8
- package/dist/{chunk-XO5IOPM5.js.map → chunk-TNJGPG6R.js.map} +1 -1
- package/dist/{chunk-73LC3JAL.js → chunk-U5SQOZNK.js} +4 -4
- package/dist/{chunk-73LC3JAL.js.map → chunk-U5SQOZNK.js.map} +1 -1
- package/dist/{chunk-Y4VR6VNM.js → chunk-UPOS666Q.js} +2 -2
- package/dist/{chunk-Y4VR6VNM.js.map → chunk-UPOS666Q.js.map} +1 -1
- package/dist/{chunk-YE6KCAIN.js → chunk-USSGJ3MD.js} +2 -2
- package/dist/{chunk-YE6KCAIN.js.map → chunk-USSGJ3MD.js.map} +1 -1
- package/dist/{chunk-4UWLHKNU.js → chunk-UWLJ7UEK.js} +3 -3
- package/dist/{chunk-4UWLHKNU.js.map → chunk-UWLJ7UEK.js.map} +1 -1
- package/dist/{chunk-SNUDT6AX.js → chunk-VHAYQGWR.js} +2 -2
- package/dist/{chunk-SNUDT6AX.js.map → chunk-VHAYQGWR.js.map} +1 -1
- package/dist/{chunk-DV6GE57V.js → chunk-VWGRAE2Q.js} +2 -2
- package/dist/chunk-VWGRAE2Q.js.map +1 -0
- package/dist/{chunk-4L5ZIKDZ.js → chunk-W7J3MQNV.js} +2 -2
- package/dist/{chunk-4L5ZIKDZ.js.map → chunk-W7J3MQNV.js.map} +1 -1
- package/dist/{chunk-MVWR5WRX.js → chunk-WWDDKUDW.js} +3 -3
- package/dist/{chunk-MVWR5WRX.js.map → chunk-WWDDKUDW.js.map} +1 -1
- package/dist/{chunk-WEQNPYVA.js → chunk-XXKRHKFH.js} +2 -2
- package/dist/{chunk-WEQNPYVA.js.map → chunk-XXKRHKFH.js.map} +1 -1
- package/dist/{chunk-Q7RILH2D.js → chunk-XZ253TGP.js} +32 -6
- package/dist/chunk-XZ253TGP.js.map +1 -0
- package/dist/{chunk-3TBMGGTA.js → chunk-Y672Z7QY.js} +2 -2
- package/dist/{chunk-3TBMGGTA.js.map → chunk-Y672Z7QY.js.map} +1 -1
- package/dist/{chunk-MMOQR426.js → chunk-YS3H6DEQ.js} +2 -2
- package/dist/{chunk-MMOQR426.js.map → chunk-YS3H6DEQ.js.map} +1 -1
- package/dist/{chunk-QR7MGGOM.js → chunk-YVGHWCMY.js} +3 -3
- package/dist/{chunk-QR7MGGOM.js.map → chunk-YVGHWCMY.js.map} +1 -1
- package/dist/{chunk-4CYCJ3NY.js → chunk-Z4PGAYO7.js} +10 -10
- package/dist/{chunk-4CYCJ3NY.js.map → chunk-Z4PGAYO7.js.map} +1 -1
- package/dist/{chunk-JAC6AVZN.js → chunk-ZIZXXYXM.js} +3 -3
- package/dist/{chunk-JAC6AVZN.js.map → chunk-ZIZXXYXM.js.map} +1 -1
- package/dist/collapsible-panel.d.ts +5 -5
- package/dist/collapsible-panel.js +4 -4
- 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 +2 -2
- package/dist/column-explorer.js +166 -20
- package/dist/column-explorer.js.map +1 -1
- package/dist/column-track.d.ts +21 -3
- package/dist/column-track.js +1 -1
- package/dist/combobox.d.ts +3 -3
- package/dist/combobox.js +1 -1
- package/dist/content-item.d.ts +1 -1
- package/dist/content-item.js +1 -1
- package/dist/content-swap.d.ts +3 -3
- package/dist/content-swap.js +1 -1
- package/dist/corner-status.d.ts +3 -3
- package/dist/corner-status.js +1 -1
- package/dist/device-class.js +101 -1
- package/dist/device-class.js.map +1 -1
- package/dist/disclosure-arrow.d.ts +3 -3
- package/dist/disclosure-arrow.js +1 -1
- package/dist/disclosure.d.ts +14 -2
- package/dist/disclosure.js +13 -4
- package/dist/disclosure.js.map +1 -1
- package/dist/edge-activity-indicator.d.ts +3 -3
- package/dist/edge-activity-indicator.js +1 -1
- package/dist/empty-state.d.ts +3 -3
- package/dist/empty-state.js +1 -1
- package/dist/{extension-attributes-IJ4decoa.d.ts → extension-attributes-CnqvBmj3.d.ts} +1 -1
- package/dist/file-picker.d.ts +3 -3
- package/dist/file-picker.js +1 -1
- package/dist/floating-toolbar.d.ts +3 -3
- package/dist/floating-toolbar.js +1 -1
- package/dist/form.d.ts +3 -3
- package/dist/form.js +1 -1
- package/dist/framed-list.js +1 -1
- package/dist/gauge.js +1 -1
- package/dist/grid.js +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +70 -68
- package/dist/list-action-row.js +1 -1
- package/dist/list-detail-dialog.d.ts +3 -3
- package/dist/list-detail-dialog.js +7 -7
- package/dist/list-detail-dialog.js.map +1 -1
- package/dist/list-header.d.ts +1 -1
- package/dist/list-header.js +2 -1
- package/dist/list-inset-control.d.ts +3 -3
- package/dist/list-inset-control.js +1 -1
- package/dist/list-inset-text.js +1 -1
- package/dist/list-item.js +1 -1
- package/dist/list.d.ts +1 -1
- package/dist/list.js +1 -1
- package/dist/loading-spinner.d.ts +3 -3
- package/dist/loading-spinner.js +1 -1
- package/dist/lucide-icon.d.ts +3 -3
- package/dist/lucide-icon.js +1 -1
- package/dist/message-composer.js +2 -1
- package/dist/{nav-stack-DKrvqFjA.d.ts → nav-stack-IKSMxo2A.d.ts} +3 -3
- package/dist/nav-stack.d.ts +2 -2
- package/dist/nav-stack.js +1 -1
- package/dist/paged-view.d.ts +3 -3
- package/dist/paged-view.js +1 -1
- package/dist/paged-view.js.map +1 -1
- package/dist/pane.js +1 -1
- package/dist/popup-menu-register.js +1 -1
- package/dist/popup-menu.d.ts +1 -20
- package/dist/popup-menu.js +1 -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 +3 -3
- package/dist/resizable-region.js +1 -1
- package/dist/row.d.ts +1 -1
- package/dist/row.js +1 -1
- package/dist/scroll-effect.d.ts +1 -1
- package/dist/scroll-effect.js +1 -1
- package/dist/{search-field-5lNIszda.d.ts → search-field-BA48RaJY.d.ts} +13 -4
- package/dist/search-field-model.d.ts +2 -2
- package/dist/search-field.d.ts +2 -2
- package/dist/search-field.js +1 -1
- package/dist/segmented-control.d.ts +3 -3
- package/dist/segmented-control.js +1 -1
- package/dist/select-register.js +2 -2
- package/dist/select-register.js.map +1 -1
- package/dist/select.d.ts +3 -13
- package/dist/select.js +1 -1
- package/dist/sized-region.d.ts +3 -3
- package/dist/sized-region.js +1 -1
- package/dist/skeleton.d.ts +3 -3
- package/dist/skeleton.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/spacer.d.ts +3 -3
- package/dist/spacer.js +1 -1
- package/dist/split-button.js +1 -1
- package/dist/split-middle-De745N2j.d.ts +7 -0
- package/dist/split-view.d.ts +4 -4
- package/dist/split-view.js +1 -1
- package/dist/state-banner.js +1 -1
- package/dist/styles/components/actions/popup-menu/popup-menu.css +0 -124
- package/dist/styles/components/actions/toolbar/toolbar.css +0 -7
- package/dist/styles/components/actions/toolbar-control-group/toolbar-control-group.css +9 -1
- package/dist/styles/components/collections/framed-list/framed-list.css +7 -3
- package/dist/styles/components/collections/list-action-row/list-action-row.css +5 -1
- package/dist/styles/components/forms/radio-group/radio-group.css +8 -4
- package/dist/styles/components/forms/search-field/search-field.css +98 -0
- package/dist/styles/components/forms/select/select.css +0 -60
- package/dist/styles/components/forms/text-field/text-field.css +1 -1
- package/dist/styles/components/navigation/tab-bar-item/tab-bar-item.css +33 -3
- package/dist/styles/components/surfaces/disclosure/disclosure.css +24 -4
- package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +1 -1
- package/dist/styles/components/typography/text/text.css +2 -2
- package/dist/styles/disclosure.css +24 -4
- package/dist/styles/framed-list.css +7 -3
- package/dist/styles/list-action-row.css +5 -1
- package/dist/styles/popup-menu.css +0 -124
- package/dist/styles/radio-group.css +8 -4
- package/dist/styles/search-field.css +98 -0
- package/dist/styles/select.css +0 -60
- package/dist/styles/surface-scaffold.css +1 -1
- package/dist/styles/tab-bar-item.css +33 -3
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text.css +2 -2
- package/dist/styles/toolbar-control-group.css +9 -1
- package/dist/styles/toolbar.css +0 -7
- package/dist/styles/webawesome.css +7 -0
- package/dist/summary-row.js +1 -1
- package/dist/sunken-panel.d.ts +3 -3
- package/dist/sunken-panel.js +1 -1
- package/dist/surface-scaffold.d.ts +9 -5
- package/dist/surface-scaffold.js +1 -1
- package/dist/switch.js +1 -1
- package/dist/tab-bar-item.d.ts +26 -2
- package/dist/tab-bar-item.js +2 -1
- package/dist/tab-bar.d.ts +3 -3
- package/dist/tab-bar.js +1 -1
- package/dist/tab-navigator.d.ts +3 -3
- package/dist/tab-navigator.js +2 -2
- package/dist/tab-navigator.js.map +1 -1
- package/dist/tab-panel.d.ts +3 -3
- package/dist/tab-panel.js +1 -1
- package/dist/tag-field.d.ts +3 -3
- package/dist/tag-field.js +1 -1
- package/dist/text-field.d.ts +2 -2
- package/dist/text-field.js +1 -1
- package/dist/text.d.ts +3 -2
- package/dist/text.js +2 -1
- package/dist/toolbar-control-group.d.ts +7 -7
- package/dist/toolbar-control-group.js +1 -1
- package/dist/toolbar-text.d.ts +3 -3
- package/dist/toolbar-text.js +1 -1
- package/dist/toolbar.d.ts +3 -3
- package/dist/toolbar.js +1 -1
- package/dist/tree-list.d.ts +3 -3
- package/dist/tree-list.js +151 -3
- package/dist/tree-list.js.map +1 -1
- package/dist/{tree-rows-Bms5QJvG.d.ts → tree-rows-BXChApji.d.ts} +1 -1
- package/dist/value-preview.d.ts +3 -3
- package/dist/value-preview.js +1 -1
- package/dist/value-table.d.ts +5 -5
- package/dist/value-table.js +1 -1
- package/dist/wire-catalog.d.ts +2 -2
- package/dist/wire-catalog.js +2 -2
- package/dist/wire-color-fields.js +73 -2
- package/dist/wire-color-fields.js.map +1 -1
- package/dist/wire-color-pickers.js +1 -1
- package/dist/wire-column-explorer.js +92 -1
- package/dist/wire-column-explorer.js.map +1 -1
- package/dist/wire-column-tracks.d.ts +13 -0
- package/dist/wire-column-tracks.js +4 -0
- package/dist/wire-column-tracks.js.map +1 -0
- package/dist/wire-content-items.js +204 -1
- package/dist/wire-content-items.js.map +1 -1
- package/dist/wire-nav-stack.js +423 -1
- package/dist/wire-nav-stack.js.map +1 -1
- package/dist/wire-resizable-regions.js +1 -1
- package/dist/wire-search-fields.d.ts +2 -2
- package/dist/wire-search-fields.js +1 -1
- package/dist/wire-sidebar.js +228 -1
- package/dist/wire-sidebar.js.map +1 -1
- package/dist/wire-sliders.js +29 -1
- package/dist/wire-sliders.js.map +1 -1
- package/dist/wire-tab-bars.d.ts +1 -1
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-tab-navigator.js +150 -1
- package/dist/wire-tab-navigator.js.map +1 -1
- package/dist/wire-tag-fields.js +252 -2
- package/dist/wire-tag-fields.js.map +1 -1
- package/dist/wire-tree-list.js +186 -1
- package/dist/wire-tree-list.js.map +1 -1
- package/dist/wire-workbench.js +1 -1
- package/dist/workbench-dialog.d.ts +3 -3
- package/dist/workbench-dialog.js +5 -5
- package/dist/workbench-dialog.js.map +1 -1
- package/dist/workbench.d.ts +4 -4
- package/dist/workbench.js +1 -1
- package/docs/accessibility.md +18 -5
- package/docs/component-contract.md +4 -3
- package/docs/component-selection.md +14 -5
- package/docs/disclosure.md +22 -0
- package/docs/layout.md +11 -0
- package/docs/list-detail-dialog.md +2 -3
- package/docs/scroll-effect.md +2 -2
- package/docs/surface-scaffold.md +5 -6
- package/docs/workbench-dialog.md +2 -3
- package/llms.txt +10 -46
- package/package.json +7 -33
- package/ux-demo/recipes/app-shell.tsx +141 -48
- package/ux-demo/recipes/collapsible-sidebar.tsx +169 -43
- package/ux-demo/recipes/compact-toolbar.tsx +114 -22
- package/ux-demo/recipes/composer-form.tsx +104 -14
- package/ux-demo/recipes/list-detail-dialog.tsx +84 -38
- package/ux-demo/recipes/list-workspace-states.tsx +152 -29
- package/ux-demo/recipes/loading-inspector.tsx +174 -30
- package/ux-demo/recipes/media-detail.tsx +146 -29
- package/ux-demo/recipes/navigation-sidebar.tsx +113 -24
- package/ux-demo/recipes/navigation-stack.tsx +43 -7
- package/ux-demo/recipes/workspace-header.tsx +66 -2
- package/ai/component-props-overlay.json +0 -8892
- package/ai/component-props-overlay.schema.json +0 -82
- package/ai/component-props.json +0 -34203
- package/ai/component-props.schema.json +0 -408
- package/ai/view-document.schema.json +0 -467
- package/dist/browser/editor.js +0 -50
- package/dist/chunk-3K5V3ZSD.js +0 -77
- package/dist/chunk-3K5V3ZSD.js.map +0 -1
- package/dist/chunk-63TJH2RF.js +0 -231
- package/dist/chunk-63TJH2RF.js.map +0 -1
- package/dist/chunk-6V6UHPJD.js +0 -153
- package/dist/chunk-6V6UHPJD.js.map +0 -1
- package/dist/chunk-76BLSFEA.js.map +0 -1
- package/dist/chunk-ALBFHXMZ.js.map +0 -1
- package/dist/chunk-ASU4ODOH.js.map +0 -1
- package/dist/chunk-BMUYZKXW.js +0 -155
- package/dist/chunk-BMUYZKXW.js.map +0 -1
- package/dist/chunk-COQI4OMZ.js.map +0 -1
- package/dist/chunk-D2KHQNJ6.js +0 -155
- package/dist/chunk-D2KHQNJ6.js.map +0 -1
- package/dist/chunk-DV6GE57V.js.map +0 -1
- package/dist/chunk-ECJHCPBN.js.map +0 -1
- package/dist/chunk-F34LHBQI.js.map +0 -1
- package/dist/chunk-GHV36C6I.js +0 -94
- package/dist/chunk-GHV36C6I.js.map +0 -1
- package/dist/chunk-HHEBNP6Z.js +0 -256
- package/dist/chunk-HHEBNP6Z.js.map +0 -1
- package/dist/chunk-HPOXLOVC.js +0 -184
- package/dist/chunk-HPOXLOVC.js.map +0 -1
- package/dist/chunk-I2K4OQKB.js +0 -426
- package/dist/chunk-I2K4OQKB.js.map +0 -1
- package/dist/chunk-PVKAIVKE.js.map +0 -1
- package/dist/chunk-Q7RILH2D.js.map +0 -1
- package/dist/chunk-RGB4DPMN.js.map +0 -1
- package/dist/chunk-S7QB5KMM.js.map +0 -1
- package/dist/chunk-SGYBIKQA.js.map +0 -1
- package/dist/chunk-TXBNPEIJ.js +0 -31
- package/dist/chunk-TXBNPEIJ.js.map +0 -1
- package/dist/chunk-UD5KHQOH.js.map +0 -1
- package/dist/chunk-UU37OR3D.js.map +0 -1
- package/dist/chunk-WCMGPAY2.js +0 -103
- package/dist/chunk-WCMGPAY2.js.map +0 -1
- package/dist/chunk-WSPXSWFG.js.map +0 -1
- package/dist/chunk-WUVHP3UC.js.map +0 -1
- package/dist/chunk-X43QQWVC.js +0 -208
- package/dist/chunk-X43QQWVC.js.map +0 -1
- package/dist/editor.d.ts +0 -447
- package/dist/editor.js +0 -15604
- package/dist/editor.js.map +0 -1
- package/dist/styles/editor/editor.css +0 -585
- package/dist/styles/editor.css +0 -4
- package/dist/view-runtime.d.ts +0 -9
- package/dist/view-runtime.js +0 -8
- package/dist/view-runtime.js.map +0 -1
- package/docs/editor-host.md +0 -397
- package/docs/view.md +0 -314
- package/props/cli.d.mts +0 -1
- package/props/cli.mjs +0 -142
- package/props/component-props.d.mts +0 -180
- package/props/component-props.mjs +0 -1208
- package/view/catalog.mjs +0 -229
- package/view/child-kind.mjs +0 -22
- package/view/cli.d.mts +0 -18
- package/view/cli.mjs +0 -316
- package/view/contract.mjs +0 -418
- package/view/css-grammar.mjs +0 -93
- package/view/generate.d.mts +0 -16
- package/view/generate.mjs +0 -739
- package/view/index.d.mts +0 -491
- package/view/index.mjs +0 -36
- package/view/interpret.mjs +0 -339
- package/view/project-types-worker.mjs +0 -55
- package/view/project-types.d.mts +0 -43
- package/view/project-types.mjs +0 -618
- package/view/type-expression.d.mts +0 -15
- package/view/type-expression.mjs +0 -162
- package/view/types.mjs +0 -165
- package/view/validate-move.mjs +0 -353
- package/view/validate.mjs +0 -1649
- package/vite-editor.d.mts +0 -173
- package/vite-editor.mjs +0 -548
package/vite-editor.mjs
DELETED
|
@@ -1,548 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@kerfjs/ui/vite-editor` — run the Kerf UI editor inside an application's
|
|
3
|
-
* own Vite dev server (KF-6GT5QY: editor host), so the application's
|
|
4
|
-
* components preview with its real functions, CSS, and aliases.
|
|
5
|
-
*
|
|
6
|
-
* `kerfUiEditor()` serves the editor page at a dev-only route (default
|
|
7
|
-
* `/__kerf-ui-editor/`). Its generated entry imports `@kerfjs/ui/editor`,
|
|
8
|
-
* Kerf UI's catalogs, the catalogs the application's `.kerf-ui-profile.json`
|
|
9
|
-
* declares, and every module those catalogs name as a component's `import`,
|
|
10
|
-
* so each catalog key previews with its component function. An optional
|
|
11
|
-
* registry module (`export default { 'pkg:key': Component }`) adds or
|
|
12
|
-
* replaces functions. Nothing here imports Vite; it never runs in a
|
|
13
|
-
* production build.
|
|
14
|
-
*/
|
|
15
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
16
|
-
import { createRequire } from 'node:module';
|
|
17
|
-
import { mkdir, readdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
18
|
-
import {
|
|
19
|
-
basename,
|
|
20
|
-
dirname,
|
|
21
|
-
isAbsolute,
|
|
22
|
-
join,
|
|
23
|
-
relative,
|
|
24
|
-
resolve,
|
|
25
|
-
sep,
|
|
26
|
-
} from 'node:path';
|
|
27
|
-
import process from 'node:process';
|
|
28
|
-
import { URL } from 'node:url';
|
|
29
|
-
import { Worker } from 'node:worker_threads';
|
|
30
|
-
|
|
31
|
-
import { profileCatalogPaths } from './view/cli.mjs';
|
|
32
|
-
|
|
33
|
-
/** Where the editor is served unless `route` says otherwise. */
|
|
34
|
-
export const KERF_UI_EDITOR_ROUTE = '/__kerf-ui-editor/';
|
|
35
|
-
/** The registry module the plugin loads when it exists and none is named. */
|
|
36
|
-
export const DEFAULT_REGISTRY = 'src/kerf-ui-registry.ts';
|
|
37
|
-
/**
|
|
38
|
-
* The field editors module the plugin loads when it exists and none is
|
|
39
|
-
* named (KF-EXA2WH: field editor API).
|
|
40
|
-
*/
|
|
41
|
-
export const DEFAULT_FIELD_EDITORS = 'src/kerf-ui-field-editors.ts';
|
|
42
|
-
/** Library-only registration module loaded when present. */
|
|
43
|
-
export const DEFAULT_LIBRARY_PREVIEWS = 'src/kerf-ui-library-previews.ts';
|
|
44
|
-
|
|
45
|
-
/** Where the editor reads and writes documents (KF-0SY9M6: autosave). */
|
|
46
|
-
export const KERF_UI_EDITOR_FILE_API = '/__kerf-ui-editor/api/file';
|
|
47
|
-
/**
|
|
48
|
-
* Where the editor lists the project's documents (KF-PX5EVZ: insert an
|
|
49
|
-
* existing document): GET answers a JSON array of `.kui.json` paths.
|
|
50
|
-
*/
|
|
51
|
-
export const KERF_UI_EDITOR_LIST_API = '/__kerf-ui-editor/api/files';
|
|
52
|
-
/** Node-only project language-service endpoint; POST requires the editor header. */
|
|
53
|
-
export const KERF_UI_EDITOR_TYPES_API = '/__kerf-ui-editor/api/types';
|
|
54
|
-
/** The most documents the list answers. */
|
|
55
|
-
export const KERF_UI_EDITOR_LIST_LIMIT = 5000;
|
|
56
|
-
/** Folders the list never walks, beside every dot-folder. */
|
|
57
|
-
const UNLISTED = new Set(['node_modules', 'dist', 'test-results']);
|
|
58
|
-
/** The project folder unsaved drafts autosave into. */
|
|
59
|
-
export const KERF_UI_EDITOR_FOLDER = '.kerf-ui-editor';
|
|
60
|
-
/** The header every write carries; a cross-site page cannot send it. */
|
|
61
|
-
export const KERF_UI_EDITOR_HEADER = 'x-kerf-ui-editor';
|
|
62
|
-
|
|
63
|
-
const ENTRY_ID = 'virtual:kerf-ui-editor/entry';
|
|
64
|
-
const RESOLVED_ENTRY_ID = `\0${ENTRY_ID}`;
|
|
65
|
-
|
|
66
|
-
const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Reads a props catalog and makes its relative component imports (app source
|
|
70
|
-
* components, `./src/x.js`) absolute against the catalog's folder, without
|
|
71
|
-
* the `.js` a TypeScript source keeps, so Vite resolves the source file.
|
|
72
|
-
*/
|
|
73
|
-
export function readAppPropsCatalog(path) {
|
|
74
|
-
const catalog = readJson(path);
|
|
75
|
-
const folder = dirname(path);
|
|
76
|
-
return {
|
|
77
|
-
...catalog,
|
|
78
|
-
components: catalog.components.map((component) =>
|
|
79
|
-
component.import?.startsWith('.')
|
|
80
|
-
? {
|
|
81
|
-
...component,
|
|
82
|
-
import: resolve(folder, component.import).replace(/\.js$/, ''),
|
|
83
|
-
}
|
|
84
|
-
: component,
|
|
85
|
-
),
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* The catalogs an application declares for the editor: the props and
|
|
91
|
-
* composition catalogs its `.kerf-ui-profile.json` names (Kerf UI's own come
|
|
92
|
-
* from the package).
|
|
93
|
-
*/
|
|
94
|
-
export function applicationCatalogs(root) {
|
|
95
|
-
const paths = profileCatalogPaths(join(root, 'index.html'));
|
|
96
|
-
const composition = paths.composition.map(readJson);
|
|
97
|
-
const libraryPreviewModules = [
|
|
98
|
-
...new Set(
|
|
99
|
-
composition.flatMap((catalog, index) => {
|
|
100
|
-
if (
|
|
101
|
-
typeof catalog.libraryPreviewModule !== 'string' ||
|
|
102
|
-
!catalog.libraryPreviewModule
|
|
103
|
-
)
|
|
104
|
-
return [];
|
|
105
|
-
try {
|
|
106
|
-
const named = catalog.libraryPreviewModule;
|
|
107
|
-
const file =
|
|
108
|
-
named.startsWith('.') || isAbsolute(named)
|
|
109
|
-
? resolve(dirname(paths.composition[index]), named)
|
|
110
|
-
: createRequire(paths.composition[index]).resolve(named);
|
|
111
|
-
return existsSync(file) ? [file] : [];
|
|
112
|
-
} catch {
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
}),
|
|
116
|
-
),
|
|
117
|
-
];
|
|
118
|
-
return {
|
|
119
|
-
props: paths.props.map(readAppPropsCatalog),
|
|
120
|
-
composition,
|
|
121
|
-
libraryPreviewModules,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* The absolute file a request names: a `.kui.json` path inside `root`, outside
|
|
127
|
-
* `node_modules` and `.git`, or undefined for anything else.
|
|
128
|
-
*/
|
|
129
|
-
export function editorFilePath(root, path) {
|
|
130
|
-
if (typeof path !== 'string' || !path.endsWith('.kui.json')) return;
|
|
131
|
-
const file = resolve(root, path);
|
|
132
|
-
const inside = relative(root, file);
|
|
133
|
-
if (!inside || inside.startsWith('..') || isAbsolute(inside)) return;
|
|
134
|
-
const parts = inside.split(sep);
|
|
135
|
-
if (parts.includes('node_modules') || parts.includes('.git')) return;
|
|
136
|
-
return file;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* The project's documents: every `.kui.json` file under `root`, as sorted
|
|
141
|
-
* project-relative POSIX paths, outside `node_modules`, `dist`,
|
|
142
|
-
* `test-results`, and every dot-folder (`.git`, the drafts folder), at most
|
|
143
|
-
* `limit` of them.
|
|
144
|
-
*/
|
|
145
|
-
export async function editorDocuments(root, limit = KERF_UI_EDITOR_LIST_LIMIT) {
|
|
146
|
-
const found = [];
|
|
147
|
-
const walk = async (folder, prefix) => {
|
|
148
|
-
const entries = await readdir(folder, { withFileTypes: true });
|
|
149
|
-
for (const entry of entries) {
|
|
150
|
-
if (entry.isDirectory()) {
|
|
151
|
-
if (!entry.name.startsWith('.') && !UNLISTED.has(entry.name))
|
|
152
|
-
await walk(join(folder, entry.name), `${prefix}${entry.name}/`);
|
|
153
|
-
} else if (entry.isFile() && entry.name.endsWith('.kui.json'))
|
|
154
|
-
found.push(`${prefix}${entry.name}`);
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
await walk(root, '');
|
|
158
|
-
return found.sort().slice(0, limit);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const send = (response, status, body, type = 'text/plain; charset=utf-8') => {
|
|
162
|
-
response.statusCode = status;
|
|
163
|
-
response.setHeader('Content-Type', type);
|
|
164
|
-
response.end(body);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Connect middleware serving `KERF_UI_EDITOR_FILE_API` over `root`: GET reads
|
|
169
|
-
* a document, PUT writes one (creating folders). GET
|
|
170
|
-
* `KERF_UI_EDITOR_LIST_API` lists the project's documents. Writes need the
|
|
171
|
-
* `KERF_UI_EDITOR_HEADER` header, which a cross-site page cannot send without
|
|
172
|
-
* a preflight this middleware never answers. The drafts folder ignores
|
|
173
|
-
* itself in git.
|
|
174
|
-
*/
|
|
175
|
-
export function editorFileMiddleware(root) {
|
|
176
|
-
const types = projectTypeWorker(root);
|
|
177
|
-
const middleware = async (request, response, next) => {
|
|
178
|
-
const url = new URL(request.url ?? '/', 'http://localhost');
|
|
179
|
-
if (url.pathname === KERF_UI_EDITOR_TYPES_API) {
|
|
180
|
-
if (request.method !== 'POST') {
|
|
181
|
-
send(response, 405, 'Use POST.');
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (request.headers[KERF_UI_EDITOR_HEADER] !== '1') {
|
|
185
|
-
send(response, 403, 'Type requests come from the editor only.');
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
let text = '';
|
|
189
|
-
let body;
|
|
190
|
-
try {
|
|
191
|
-
for await (const chunk of request) {
|
|
192
|
-
text += chunk;
|
|
193
|
-
if (Buffer.byteLength(text) > 1024 * 1024) {
|
|
194
|
-
send(response, 413, 'Type request is too large.');
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
body = JSON.parse(text);
|
|
199
|
-
if (
|
|
200
|
-
!editorFilePath(root, body.source) ||
|
|
201
|
-
!['analyze', 'validate'].includes(body.action) ||
|
|
202
|
-
(body.action === 'analyze' &&
|
|
203
|
-
(typeof body.text !== 'string' ||
|
|
204
|
-
(body.cursor !== undefined && !Number.isInteger(body.cursor)) ||
|
|
205
|
-
(body.suggest !== undefined &&
|
|
206
|
-
typeof body.suggest !== 'boolean'))) ||
|
|
207
|
-
(body.action === 'validate' &&
|
|
208
|
-
(!body.document ||
|
|
209
|
-
typeof body.document !== 'object' ||
|
|
210
|
-
Array.isArray(body.document)))
|
|
211
|
-
) {
|
|
212
|
-
send(
|
|
213
|
-
response,
|
|
214
|
-
400,
|
|
215
|
-
'Name a project document and a valid type request.',
|
|
216
|
-
);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
} catch (error) {
|
|
220
|
-
send(
|
|
221
|
-
response,
|
|
222
|
-
400,
|
|
223
|
-
error instanceof Error ? error.message : String(error),
|
|
224
|
-
);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
// The analysis runs in the worker, so this server keeps answering
|
|
228
|
-
// every other request (a Play page, a file save) meanwhile.
|
|
229
|
-
const reply = await types.request(body);
|
|
230
|
-
if ('result' in reply)
|
|
231
|
-
send(response, 200, JSON.stringify(reply.result), 'application/json');
|
|
232
|
-
else send(response, reply.status, reply.error);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
if (url.pathname === KERF_UI_EDITOR_LIST_API) {
|
|
236
|
-
if (request.method !== 'GET') {
|
|
237
|
-
send(response, 405, 'Use GET.');
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
try {
|
|
241
|
-
send(
|
|
242
|
-
response,
|
|
243
|
-
200,
|
|
244
|
-
JSON.stringify(await editorDocuments(root)),
|
|
245
|
-
'application/json',
|
|
246
|
-
);
|
|
247
|
-
} catch (error) {
|
|
248
|
-
send(
|
|
249
|
-
response,
|
|
250
|
-
500,
|
|
251
|
-
error instanceof Error ? error.message : String(error),
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
if (url.pathname !== KERF_UI_EDITOR_FILE_API) {
|
|
257
|
-
next();
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const file = editorFilePath(root, url.searchParams.get('path'));
|
|
261
|
-
if (!file) {
|
|
262
|
-
send(response, 400, 'Name a .kui.json file inside the project.');
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
try {
|
|
266
|
-
if (request.method === 'GET') {
|
|
267
|
-
if (!existsSync(file)) {
|
|
268
|
-
send(response, 404, 'No such document.');
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
send(response, 200, await readFile(file, 'utf8'), 'application/json');
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if (request.method !== 'PUT') {
|
|
275
|
-
send(response, 405, 'Use GET or PUT.');
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (request.headers[KERF_UI_EDITOR_HEADER] !== '1') {
|
|
279
|
-
send(response, 403, 'Writes come from the editor only.');
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
let text = '';
|
|
283
|
-
for await (const chunk of request) text += chunk;
|
|
284
|
-
await mkdir(dirname(file), { recursive: true });
|
|
285
|
-
const folder = join(root, KERF_UI_EDITOR_FOLDER);
|
|
286
|
-
if (
|
|
287
|
-
file.startsWith(folder + sep) &&
|
|
288
|
-
!existsSync(join(folder, '.gitignore'))
|
|
289
|
-
)
|
|
290
|
-
await writeFile(join(folder, '.gitignore'), '*\n');
|
|
291
|
-
// Atomically: a read while autosave writes (the editor reading a
|
|
292
|
-
// composed document, a test checking the file) never sees a truncated
|
|
293
|
-
// file. The temp file sits beside the target, so the rename stays on
|
|
294
|
-
// one file system.
|
|
295
|
-
const temp = join(
|
|
296
|
-
dirname(file),
|
|
297
|
-
`.${basename(file)}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`,
|
|
298
|
-
);
|
|
299
|
-
await writeFile(temp, text);
|
|
300
|
-
await rename(temp, file);
|
|
301
|
-
send(response, 204, '');
|
|
302
|
-
} catch (error) {
|
|
303
|
-
send(
|
|
304
|
-
response,
|
|
305
|
-
500,
|
|
306
|
-
error instanceof Error ? error.message : String(error),
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
// Stops the type worker; the server calls it when it closes.
|
|
311
|
-
middleware.dispose = () => types.dispose();
|
|
312
|
-
return middleware;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* The project-type service in a worker thread for `root`, created on the
|
|
317
|
-
* first request and again after a crash (KF-EQFF9K: TypeScript's synchronous
|
|
318
|
-
* work used to run on the server's event loop, so every other response
|
|
319
|
-
* waited behind it). `request(body)` posts a validated type request and
|
|
320
|
-
* resolves `{ result }`, or `{ status, error }`: 400 for a request the
|
|
321
|
-
* service rejects, 500 when the worker fails. A crash fails the requests in
|
|
322
|
-
* flight. The worker never keeps the process alive. Internal; `entry`
|
|
323
|
-
* replaces the worker module in tests.
|
|
324
|
-
*/
|
|
325
|
-
export function projectTypeWorker(
|
|
326
|
-
root,
|
|
327
|
-
entry = new URL('./view/project-types-worker.mjs', import.meta.url),
|
|
328
|
-
) {
|
|
329
|
-
let worker;
|
|
330
|
-
let nextId = 0;
|
|
331
|
-
const pending = new Map();
|
|
332
|
-
const fail = (message) => {
|
|
333
|
-
for (const settle of pending.values())
|
|
334
|
-
settle({ status: 500, error: message });
|
|
335
|
-
pending.clear();
|
|
336
|
-
};
|
|
337
|
-
const start = () => {
|
|
338
|
-
const current = new Worker(entry, { workerData: { root } });
|
|
339
|
-
current.unref();
|
|
340
|
-
current.on('message', ({ id, result, error }) => {
|
|
341
|
-
const settle = pending.get(id);
|
|
342
|
-
pending.delete(id);
|
|
343
|
-
settle?.(error === undefined ? { result } : { status: 400, error });
|
|
344
|
-
});
|
|
345
|
-
const lost = (message) => {
|
|
346
|
-
if (worker !== current) return;
|
|
347
|
-
worker = undefined;
|
|
348
|
-
fail(message);
|
|
349
|
-
};
|
|
350
|
-
current.on('error', (error) =>
|
|
351
|
-
lost(`The type service failed: ${error.message}`),
|
|
352
|
-
);
|
|
353
|
-
current.on('exit', (code) =>
|
|
354
|
-
lost(`The type service stopped (exit code ${code}).`),
|
|
355
|
-
);
|
|
356
|
-
return current;
|
|
357
|
-
};
|
|
358
|
-
return {
|
|
359
|
-
request(body) {
|
|
360
|
-
worker ??= start();
|
|
361
|
-
const id = nextId++;
|
|
362
|
-
return new Promise((settle) => {
|
|
363
|
-
pending.set(id, settle);
|
|
364
|
-
worker.postMessage({ id, body });
|
|
365
|
-
});
|
|
366
|
-
},
|
|
367
|
-
dispose() {
|
|
368
|
-
const current = worker;
|
|
369
|
-
worker = undefined;
|
|
370
|
-
fail('The type service was disposed.');
|
|
371
|
-
return current?.terminate();
|
|
372
|
-
},
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/** The page the route serves; Vite injects its client into it. */
|
|
377
|
-
export function editorPage() {
|
|
378
|
-
return `<!doctype html>
|
|
379
|
-
<html lang="en">
|
|
380
|
-
<head>
|
|
381
|
-
<meta charset="utf-8" />
|
|
382
|
-
<meta
|
|
383
|
-
name="viewport"
|
|
384
|
-
content="width=device-width, initial-scale=1, viewport-fit=cover"
|
|
385
|
-
/>
|
|
386
|
-
<title>Kerf UI Editor</title>
|
|
387
|
-
</head>
|
|
388
|
-
<body>
|
|
389
|
-
<div id="kerf-ui-editor" class="kui-app-root"></div>
|
|
390
|
-
<script type="module" src="/@id/${ENTRY_ID}"></script>
|
|
391
|
-
</body>
|
|
392
|
-
</html>
|
|
393
|
-
`;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* The generated entry: imports the editor, the catalogs, and each module a
|
|
398
|
-
* catalog names, then mounts the editor over all of them.
|
|
399
|
-
*/
|
|
400
|
-
export function editorEntry({
|
|
401
|
-
app,
|
|
402
|
-
registry,
|
|
403
|
-
fieldEditors,
|
|
404
|
-
libraryPreviews,
|
|
405
|
-
devicePresets,
|
|
406
|
-
playHandlers,
|
|
407
|
-
}) {
|
|
408
|
-
const kerfProps = readJson(
|
|
409
|
-
resolve(import.meta.dirname, 'ai/component-props.json'),
|
|
410
|
-
);
|
|
411
|
-
const specifiers = [
|
|
412
|
-
...new Set(
|
|
413
|
-
[kerfProps, ...app.props].flatMap((catalog) =>
|
|
414
|
-
catalog.components.flatMap((component) =>
|
|
415
|
-
component.source !== 'webawesome' && component.import
|
|
416
|
-
? [component.import]
|
|
417
|
-
: [],
|
|
418
|
-
),
|
|
419
|
-
),
|
|
420
|
-
),
|
|
421
|
-
];
|
|
422
|
-
const lines = [
|
|
423
|
-
"import '@kerfjs/ui/document.css';",
|
|
424
|
-
"import '@kerfjs/ui/styles.css';",
|
|
425
|
-
"import '@kerfjs/ui/layout.css';",
|
|
426
|
-
"import '@kerfjs/ui/workbench.css';",
|
|
427
|
-
"import '@kerfjs/ui/editor.css';",
|
|
428
|
-
"import '@kerfjs/ui/popup-menu/register';",
|
|
429
|
-
"import '@kerfjs/ui/select/register';",
|
|
430
|
-
"import '@kerfjs/ui/surface-scaffold/register';",
|
|
431
|
-
"import { componentMap, createEditor, createEditorCatalog, devServerStorage } from '@kerfjs/ui/editor';",
|
|
432
|
-
"import kerfProps from '@kerfjs/ui/ai/component-props.json';",
|
|
433
|
-
"import kerfComposition from '@kerfjs/ui/ai/component-composition.json';",
|
|
434
|
-
"import kerfSelection from '@kerfjs/ui/ai/component-catalog.json';",
|
|
435
|
-
"import { mount } from 'kerfjs';",
|
|
436
|
-
...specifiers.map(
|
|
437
|
-
(specifier, index) =>
|
|
438
|
-
`import * as module${index} from ${JSON.stringify(specifier)};`,
|
|
439
|
-
),
|
|
440
|
-
registry
|
|
441
|
-
? `import registry from ${JSON.stringify(registry)};`
|
|
442
|
-
: 'const registry = {};',
|
|
443
|
-
...(app.libraryPreviewModules ?? []).map(
|
|
444
|
-
(module, index) =>
|
|
445
|
-
`import libraryPreview${index} from ${JSON.stringify(module)};`,
|
|
446
|
-
),
|
|
447
|
-
libraryPreviews
|
|
448
|
-
? `import libraryPreviews from ${JSON.stringify(libraryPreviews)};`
|
|
449
|
-
: 'const libraryPreviews = undefined;',
|
|
450
|
-
fieldEditors
|
|
451
|
-
? `import fieldEditors from ${JSON.stringify(fieldEditors)};`
|
|
452
|
-
: 'const fieldEditors = undefined;',
|
|
453
|
-
devicePresets
|
|
454
|
-
? `import devicePresets from ${JSON.stringify(devicePresets)};`
|
|
455
|
-
: 'const devicePresets = undefined;',
|
|
456
|
-
playHandlers
|
|
457
|
-
? `import playHandlers from ${JSON.stringify(playHandlers)};`
|
|
458
|
-
: 'const playHandlers = undefined;',
|
|
459
|
-
`const appProps = ${JSON.stringify(app.props)};`,
|
|
460
|
-
`const appComposition = ${JSON.stringify(app.composition)};`,
|
|
461
|
-
'const props = [kerfProps, ...appProps];',
|
|
462
|
-
`const modules = { ${specifiers
|
|
463
|
-
.map((specifier, index) => `${JSON.stringify(specifier)}: module${index}`)
|
|
464
|
-
.join(', ')} };`,
|
|
465
|
-
'const catalog = createEditorCatalog({',
|
|
466
|
-
' props,',
|
|
467
|
-
' composition: [kerfComposition, ...appComposition],',
|
|
468
|
-
' selection: [kerfSelection],',
|
|
469
|
-
' components: { ...componentMap(props, modules), ...registry },',
|
|
470
|
-
` libraryPreviews: { ${(app.libraryPreviewModules ?? []).map((_module, index) => `...libraryPreview${index}`).join(', ')} },`,
|
|
471
|
-
'});',
|
|
472
|
-
"const root = document.getElementById('kerf-ui-editor');",
|
|
473
|
-
'const editor = createEditor({ catalog, storage: devServerStorage(), fieldEditors, devicePresets, playHandlers, libraryPreviews });',
|
|
474
|
-
'mount(root, editor.render);',
|
|
475
|
-
'editor.wire(root);',
|
|
476
|
-
'',
|
|
477
|
-
];
|
|
478
|
-
return lines.join('\n');
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* The Vite plugin. `route` is where the editor is served; `registry` names a
|
|
483
|
-
* module (resolved against Vite's `root`) whose default export adds or
|
|
484
|
-
* replaces component functions, defaulting to `src/kerf-ui-registry.ts` when
|
|
485
|
-
* that file exists.
|
|
486
|
-
*/
|
|
487
|
-
export function kerfUiEditor(options = {}) {
|
|
488
|
-
const route = options.route ?? KERF_UI_EDITOR_ROUTE;
|
|
489
|
-
let root = process.cwd();
|
|
490
|
-
return {
|
|
491
|
-
name: 'kerf-ui-editor',
|
|
492
|
-
apply: 'serve',
|
|
493
|
-
configResolved(config) {
|
|
494
|
-
root = config.root;
|
|
495
|
-
},
|
|
496
|
-
resolveId(id) {
|
|
497
|
-
return id === ENTRY_ID ? RESOLVED_ENTRY_ID : null;
|
|
498
|
-
},
|
|
499
|
-
load(id) {
|
|
500
|
-
if (id !== RESOLVED_ENTRY_ID) return null;
|
|
501
|
-
// A module that is named or at its default path, when it exists.
|
|
502
|
-
const found = (named) => {
|
|
503
|
-
const path = isAbsolute(named) ? named : resolve(root, named);
|
|
504
|
-
return existsSync(path) ? path : undefined;
|
|
505
|
-
};
|
|
506
|
-
return editorEntry({
|
|
507
|
-
app: applicationCatalogs(root),
|
|
508
|
-
registry: found(options.registry ?? DEFAULT_REGISTRY),
|
|
509
|
-
fieldEditors: found(options.fieldEditors ?? DEFAULT_FIELD_EDITORS),
|
|
510
|
-
libraryPreviews: found(
|
|
511
|
-
options.libraryPreviews ?? DEFAULT_LIBRARY_PREVIEWS,
|
|
512
|
-
),
|
|
513
|
-
// KF-R7KXSN: play mode's extra or replacement device presets.
|
|
514
|
-
devicePresets: options.devicePresets
|
|
515
|
-
? found(options.devicePresets)
|
|
516
|
-
: undefined,
|
|
517
|
-
// KF-RF6RCS: play mode's mock action handlers, run in the play frame.
|
|
518
|
-
playHandlers: options.playHandlers
|
|
519
|
-
? found(options.playHandlers)
|
|
520
|
-
: undefined,
|
|
521
|
-
});
|
|
522
|
-
},
|
|
523
|
-
configureServer(server) {
|
|
524
|
-
const files = editorFileMiddleware(root);
|
|
525
|
-
server.httpServer?.once('close', files.dispose);
|
|
526
|
-
server.middlewares.use(files);
|
|
527
|
-
server.middlewares.use(async (request, response, next) => {
|
|
528
|
-
const path = (request.url ?? '').split(/[?#]/)[0];
|
|
529
|
-
if (path !== route && `${path}/` !== route) {
|
|
530
|
-
next();
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
try {
|
|
534
|
-
const html = await server.transformIndexHtml(
|
|
535
|
-
route,
|
|
536
|
-
editorPage(),
|
|
537
|
-
request.originalUrl,
|
|
538
|
-
);
|
|
539
|
-
response.statusCode = 200;
|
|
540
|
-
response.setHeader('Content-Type', 'text/html; charset=utf-8');
|
|
541
|
-
response.end(html);
|
|
542
|
-
} catch (error) {
|
|
543
|
-
next(error);
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
},
|
|
547
|
-
};
|
|
548
|
-
}
|