@cloudflare/kumo 1.19.0 → 2.0.1
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/CHANGELOG.md +248 -0
- package/ai/component-registry.json +764 -131
- package/ai/component-registry.md +1161 -163
- package/ai/schemas.ts +42 -14
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +153 -21
- package/dist/ai/schemas.d.ts.map +1 -1
- package/dist/ai/schemas.js +1994 -1956
- package/dist/ai/schemas.js.map +1 -1
- package/dist/blocks-source/resource-list/resource-list.tsx +1 -1
- package/dist/chunks/Legend-ibjxhfm9pn2vrb6f.js +430 -0
- package/dist/chunks/Legend-ibjxhfm9pn2vrb6f.js.map +1 -0
- package/dist/chunks/autocomplete-48aq0d244bs2e8zv.js +174 -0
- package/dist/chunks/autocomplete-48aq0d244bs2e8zv.js.map +1 -0
- package/dist/chunks/{breadcrumbs-ge20hcb3o5spswrk.js → breadcrumbs-cxcwf2l1ki3ffg5d.js} +2 -2
- package/dist/chunks/{breadcrumbs-ge20hcb3o5spswrk.js.map → breadcrumbs-cxcwf2l1ki3ffg5d.js.map} +1 -1
- package/dist/chunks/{button-oaqi7ykdisyskoos.js → button-6by9ntsa3nj553mq.js} +23 -24
- package/dist/chunks/button-6by9ntsa3nj553mq.js.map +1 -0
- package/dist/chunks/checkbox-hvxfvhtx1qjo2mww.js +210 -0
- package/dist/chunks/checkbox-hvxfvhtx1qjo2mww.js.map +1 -0
- package/dist/chunks/{clipboard-text-dxczqon3d27xp6f0.js → clipboard-text-hswydzx3iql369sd.js} +45 -41
- package/dist/chunks/{clipboard-text-dxczqon3d27xp6f0.js.map → clipboard-text-hswydzx3iql369sd.js.map} +1 -1
- package/dist/chunks/{code-cz0w1y5z4h29a9eg.js → code-f9v1ikwhekqw274q.js} +4 -4
- package/dist/chunks/{code-cz0w1y5z4h29a9eg.js.map → code-f9v1ikwhekqw274q.js.map} +1 -1
- package/dist/chunks/collapsible-k8urhi16pg90jvxa.js +71 -0
- package/dist/chunks/collapsible-k8urhi16pg90jvxa.js.map +1 -0
- package/dist/chunks/{combobox-eaowwt1xr4d23gsn.js → combobox-fq36ye0hstote16x.js} +90 -78
- package/dist/chunks/combobox-fq36ye0hstote16x.js.map +1 -0
- package/dist/chunks/{command-palette-maqtbmpfev9mysqd.js → command-palette-md65owxt5hv4rt9r.js} +68 -68
- package/dist/chunks/command-palette-md65owxt5hv4rt9r.js.map +1 -0
- package/dist/chunks/{date-range-picker-j318zxjyqz4o3dak.js → date-range-picker-o8uyril1kogvhoei.js} +11 -11
- package/dist/chunks/{date-range-picker-j318zxjyqz4o3dak.js.map → date-range-picker-o8uyril1kogvhoei.js.map} +1 -1
- package/dist/chunks/{dialog-e3m5bhs7fds26p9y.js → dialog-k3f1fbam6nt96k8x.js} +3 -3
- package/dist/chunks/{dialog-e3m5bhs7fds26p9y.js.map → dialog-k3f1fbam6nt96k8x.js.map} +1 -1
- package/dist/chunks/{dropdown-ewte287db3vyt8t5.js → dropdown-zbax0zowy6m9zhmt.js} +87 -87
- package/dist/chunks/dropdown-zbax0zowy6m9zhmt.js.map +1 -0
- package/dist/chunks/{empty-dr1eckm2z40euns6.js → empty-b82oer7npkhtkx7k.js} +14 -14
- package/dist/chunks/{empty-dr1eckm2z40euns6.js.map → empty-b82oer7npkhtkx7k.js.map} +1 -1
- package/dist/chunks/{field-bo5gmna16odrrb1q.js → field-c0wf94plit2gci59.js} +7 -7
- package/dist/chunks/{field-bo5gmna16odrrb1q.js.map → field-c0wf94plit2gci59.js.map} +1 -1
- package/dist/chunks/{input-area-jkkkjej6luumrqpa.js → input-area-bkyzu6f7gsck479h.js} +4 -4
- package/dist/chunks/{input-area-jkkkjej6luumrqpa.js.map → input-area-bkyzu6f7gsck479h.js.map} +1 -1
- package/dist/chunks/input-group-bidweffa0zyg8gt0.js +505 -0
- package/dist/chunks/input-group-bidweffa0zyg8gt0.js.map +1 -0
- package/dist/chunks/{input-cw05pbqdburghkus.js → input-ncfowphv81yq7fyy.js} +44 -44
- package/dist/chunks/input-ncfowphv81yq7fyy.js.map +1 -0
- package/dist/chunks/{label-cvyvbqmt4mt757ff.js → label-c3h9i3y4wiccelt7.js} +22 -22
- package/dist/chunks/{label-cvyvbqmt4mt757ff.js.map → label-c3h9i3y4wiccelt7.js.map} +1 -1
- package/dist/chunks/{layer-card-ljqth3yxgnk04v2o.js → layer-card-ikm31xemd70w3lru.js} +5 -5
- package/dist/chunks/{layer-card-ljqth3yxgnk04v2o.js.map → layer-card-ikm31xemd70w3lru.js.map} +1 -1
- package/dist/chunks/{link-fjnhtxvfe5ieamjf.js → link-kt74pxkud4olmcer.js} +4 -4
- package/dist/chunks/{link-fjnhtxvfe5ieamjf.js.map → link-kt74pxkud4olmcer.js.map} +1 -1
- package/dist/chunks/menubar-hwev159bm4rw9ixk.js +96 -0
- package/dist/chunks/menubar-hwev159bm4rw9ixk.js.map +1 -0
- package/dist/chunks/{meter-duj3micor1lqj3y2.js → meter-n34a7yb8c3rim26i.js} +3 -3
- package/dist/chunks/{meter-duj3micor1lqj3y2.js.map → meter-n34a7yb8c3rim26i.js.map} +1 -1
- package/dist/chunks/{pagination-olaypvwr8swsmn8m.js → pagination-jb3mncivbwsoi1se.js} +56 -56
- package/dist/chunks/pagination-jb3mncivbwsoi1se.js.map +1 -0
- package/dist/chunks/{popover-nv9cmzbo7mf6bky0.js → popover-iayd9ya5yhujz6ve.js} +5 -5
- package/dist/chunks/{popover-nv9cmzbo7mf6bky0.js.map → popover-iayd9ya5yhujz6ve.js.map} +1 -1
- package/dist/chunks/{radio-ihxbe37us2jnqtzf.js → radio-datzh3pilz8ojak1.js} +86 -74
- package/dist/chunks/radio-datzh3pilz8ojak1.js.map +1 -0
- package/dist/chunks/{select-nx6ded5swra74iar.js → select-g261chvosodu22i8.js} +64 -62
- package/dist/chunks/select-g261chvosodu22i8.js.map +1 -0
- package/dist/chunks/{sensitive-input-00fujb510rrn61v9.js → sensitive-input-cijagk551mesdtk4.js} +42 -42
- package/dist/chunks/sensitive-input-cijagk551mesdtk4.js.map +1 -0
- package/dist/chunks/{sidebar-ltbfius1eolkl8tb.js → sidebar-kb9kykqfgy5yzqwr.js} +132 -129
- package/dist/chunks/sidebar-kb9kykqfgy5yzqwr.js.map +1 -0
- package/dist/chunks/{surface-dfgurg5eu3et4vw1.js → surface-k0e8mq1x00b7i8r6.js} +2 -2
- package/dist/chunks/{surface-dfgurg5eu3et4vw1.js.map → surface-k0e8mq1x00b7i8r6.js.map} +1 -1
- package/dist/chunks/{switch-fbv3iawqo3o3jgap.js → switch-jdfsr3j3oa1qxegw.js} +86 -78
- package/dist/chunks/switch-jdfsr3j3oa1qxegw.js.map +1 -0
- package/dist/chunks/{table-olwwulga2l3hdwlx.js → table-iudje0lva0z68jto.js} +89 -71
- package/dist/chunks/table-iudje0lva0z68jto.js.map +1 -0
- package/dist/chunks/table-of-contents-fzyv7uhnnyr13dqu.js +102 -0
- package/dist/chunks/table-of-contents-fzyv7uhnnyr13dqu.js.map +1 -0
- package/dist/chunks/{tabs-lohcglgppp6gj0hp.js → tabs-mkhf1uemgr3ij0ps.js} +20 -20
- package/dist/chunks/{tabs-lohcglgppp6gj0hp.js.map → tabs-mkhf1uemgr3ij0ps.js.map} +1 -1
- package/dist/chunks/{text-nmyi1rkwdj37f30f.js → text-f7t467waymhb30sx.js} +8 -8
- package/dist/chunks/text-f7t467waymhb30sx.js.map +1 -0
- package/dist/chunks/{toast-dg52x89yd231mxhe.js → toast-h573o0tc7tefivk2.js} +11 -11
- package/dist/chunks/toast-h573o0tc7tefivk2.js.map +1 -0
- package/dist/chunks/{tooltip-hikjvdbg3xghnq1x.js → tooltip-odudhkxe282wxinq.js} +5 -5
- package/dist/chunks/{tooltip-hikjvdbg3xghnq1x.js.map → tooltip-odudhkxe282wxinq.js.map} +1 -1
- package/dist/chunks/vendor-base-ui-ie71jahf0czyf58j.js +24638 -0
- package/dist/chunks/vendor-base-ui-ie71jahf0czyf58j.js.map +1 -0
- package/dist/chunks/vendor-floating-ui-dwag5e88viikh2zs.js +1311 -0
- package/dist/chunks/vendor-floating-ui-dwag5e88viikh2zs.js.map +1 -0
- package/dist/chunks/vendor-utils-ixnhxmehwihk5tr7.js +534 -0
- package/dist/chunks/vendor-utils-ixnhxmehwihk5tr7.js.map +1 -0
- package/dist/code.js +31 -31
- package/dist/code.js.map +1 -1
- package/dist/components/autocomplete.js +9 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/code.js +1 -1
- package/dist/components/collapsible.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dropdown.js +1 -1
- package/dist/components/empty.js +1 -1
- package/dist/components/field.js +1 -1
- package/dist/components/input-group.js +8 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.js +9 -7
- package/dist/components/label.js +1 -1
- package/dist/components/layer-card.js +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sensitive-input.js +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/surface.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table-of-contents.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/toast.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/index.js +149 -144
- package/dist/index.js.map +1 -1
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/csp-provider.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/drawer.js +2 -2
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/otp-field.js +6 -0
- package/dist/primitives/otp-field.js.map +1 -0
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +2 -2
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +22 -21
- package/dist/scripts/theme-generator/config.d.ts.map +1 -1
- package/dist/scripts/theme-generator/config.js +21 -4
- package/dist/scripts/theme-generator/config.js.map +1 -1
- package/dist/src/components/autocomplete/autocomplete.d.ts +180 -0
- package/dist/src/components/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/src/components/autocomplete/index.d.ts +2 -0
- package/dist/src/components/autocomplete/index.d.ts.map +1 -0
- package/dist/src/components/button/button.d.ts +3 -3
- package/dist/src/components/button/button.d.ts.map +1 -1
- package/dist/src/components/chart/Color.d.ts +36 -52
- package/dist/src/components/chart/Color.d.ts.map +1 -1
- package/dist/src/components/checkbox/checkbox.d.ts +37 -14
- package/dist/src/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/src/components/checkbox/index.d.ts +1 -1
- package/dist/src/components/checkbox/index.d.ts.map +1 -1
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -1
- package/dist/src/components/code/code.d.ts +2 -2
- package/dist/src/components/collapsible/collapsible.d.ts +77 -40
- package/dist/src/components/collapsible/collapsible.d.ts.map +1 -1
- package/dist/src/components/collapsible/index.d.ts +1 -1
- package/dist/src/components/collapsible/index.d.ts.map +1 -1
- package/dist/src/components/combobox/combobox.d.ts +3 -1
- package/dist/src/components/combobox/combobox.d.ts.map +1 -1
- package/dist/src/components/command-palette/command-palette.d.ts +2 -11
- package/dist/src/components/command-palette/command-palette.d.ts.map +1 -1
- package/dist/src/components/command-palette/index.d.ts +1 -1
- package/dist/src/components/command-palette/index.d.ts.map +1 -1
- package/dist/src/components/command-palette/types.d.ts +13 -1
- package/dist/src/components/command-palette/types.d.ts.map +1 -1
- package/dist/src/components/input/index.d.ts +16 -1
- package/dist/src/components/input/index.d.ts.map +1 -1
- package/dist/src/components/input/input.d.ts +2 -2
- package/dist/src/components/input/input.d.ts.map +1 -1
- package/dist/src/components/input-group/context.d.ts +96 -0
- package/dist/src/components/input-group/context.d.ts.map +1 -0
- package/dist/src/components/input-group/index.d.ts +2 -0
- package/dist/src/components/input-group/index.d.ts.map +1 -0
- package/dist/src/components/input-group/input-group-addon.d.ts +15 -0
- package/dist/src/components/input-group/input-group-addon.d.ts.map +1 -0
- package/dist/src/components/input-group/input-group-button.d.ts +36 -0
- package/dist/src/components/input-group/input-group-button.d.ts.map +1 -0
- package/dist/src/components/input-group/input-group-input.d.ts +9 -0
- package/dist/src/components/input-group/input-group-input.d.ts.map +1 -0
- package/dist/src/components/input-group/input-group-suffix.d.ts +13 -0
- package/dist/src/components/input-group/input-group-suffix.d.ts.map +1 -0
- package/dist/src/components/input-group/input-group.d.ts +43 -0
- package/dist/src/components/input-group/input-group.d.ts.map +1 -0
- package/dist/src/components/menubar/menubar.d.ts.map +1 -1
- package/dist/src/components/radio/index.d.ts +1 -1
- package/dist/src/components/radio/index.d.ts.map +1 -1
- package/dist/src/components/radio/radio.d.ts +43 -7
- package/dist/src/components/radio/radio.d.ts.map +1 -1
- package/dist/src/components/select/select.d.ts +3 -3
- package/dist/src/components/select/select.d.ts.map +1 -1
- package/dist/src/components/sensitive-input/sensitive-input.d.ts +2 -2
- package/dist/src/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/components/switch/index.d.ts +1 -1
- package/dist/src/components/switch/index.d.ts.map +1 -1
- package/dist/src/components/switch/switch.d.ts +31 -3
- package/dist/src/components/switch/switch.d.ts.map +1 -1
- package/dist/src/components/table/table.d.ts +17 -2
- package/dist/src/components/table/table.d.ts.map +1 -1
- package/dist/src/components/table-of-contents/table-of-contents.d.ts +9 -7
- package/dist/src/components/table-of-contents/table-of-contents.d.ts.map +1 -1
- package/dist/src/components/text/text.d.ts +34 -6
- package/dist/src/components/text/text.d.ts.map +1 -1
- package/dist/src/components/text/text.type-spec.d.ts +44 -0
- package/dist/src/components/text/text.type-spec.d.ts.map +1 -0
- package/dist/src/components/toast/toast.d.ts +2 -2
- package/dist/src/components/toast/toast.d.ts.map +1 -1
- package/dist/src/index.d.ts +8 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/primitives/index.d.ts +1 -0
- package/dist/src/primitives/index.d.ts.map +1 -1
- package/dist/src/primitives/otp-field.d.ts +13 -0
- package/dist/src/primitives/otp-field.d.ts.map +1 -0
- package/dist/styles/kumo-binding.css +18 -0
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/kumo.css +2 -2
- package/dist/styles/theme-kumo.css +15 -8
- package/package.json +14 -2
- package/scripts/component-registry/discovery.ts +1 -0
- package/scripts/component-registry/index.test.ts +265 -0
- package/scripts/component-registry/index.ts +14 -0
- package/scripts/component-registry/metadata.ts +56 -8
- package/scripts/component-registry/sub-components.ts +81 -50
- package/scripts/component-registry/types.ts +2 -0
- package/scripts/theme-generator/config.ts +19 -9
- package/dist/chunks/Legend-ks7se6149vsa3tze.js +0 -430
- package/dist/chunks/Legend-ks7se6149vsa3tze.js.map +0 -1
- package/dist/chunks/button-oaqi7ykdisyskoos.js.map +0 -1
- package/dist/chunks/checkbox-mwgmohffm22ut13s.js +0 -211
- package/dist/chunks/checkbox-mwgmohffm22ut13s.js.map +0 -1
- package/dist/chunks/collapsible-jhzee3ks51d3xowb.js +0 -58
- package/dist/chunks/collapsible-jhzee3ks51d3xowb.js.map +0 -1
- package/dist/chunks/combobox-eaowwt1xr4d23gsn.js.map +0 -1
- package/dist/chunks/command-palette-maqtbmpfev9mysqd.js.map +0 -1
- package/dist/chunks/dropdown-ewte287db3vyt8t5.js.map +0 -1
- package/dist/chunks/input-cw05pbqdburghkus.js.map +0 -1
- package/dist/chunks/input-group-lfugneuz71g42n0w.js +0 -111
- package/dist/chunks/input-group-lfugneuz71g42n0w.js.map +0 -1
- package/dist/chunks/menubar-e5e4zwfagr0wx023.js +0 -96
- package/dist/chunks/menubar-e5e4zwfagr0wx023.js.map +0 -1
- package/dist/chunks/pagination-olaypvwr8swsmn8m.js.map +0 -1
- package/dist/chunks/radio-ihxbe37us2jnqtzf.js.map +0 -1
- package/dist/chunks/select-nx6ded5swra74iar.js.map +0 -1
- package/dist/chunks/sensitive-input-00fujb510rrn61v9.js.map +0 -1
- package/dist/chunks/sidebar-ltbfius1eolkl8tb.js.map +0 -1
- package/dist/chunks/switch-fbv3iawqo3o3jgap.js.map +0 -1
- package/dist/chunks/table-of-contents-f813ivi7ta23vqdm.js +0 -88
- package/dist/chunks/table-of-contents-f813ivi7ta23vqdm.js.map +0 -1
- package/dist/chunks/table-olwwulga2l3hdwlx.js.map +0 -1
- package/dist/chunks/text-nmyi1rkwdj37f30f.js.map +0 -1
- package/dist/chunks/toast-dg52x89yd231mxhe.js.map +0 -1
- package/dist/chunks/vendor-base-ui-m5pz3e8c4grg5qmj.js +0 -22813
- package/dist/chunks/vendor-base-ui-m5pz3e8c4grg5qmj.js.map +0 -1
- package/dist/chunks/vendor-floating-ui-gr9m6tsa1cpqwn99.js +0 -1286
- package/dist/chunks/vendor-floating-ui-gr9m6tsa1cpqwn99.js.map +0 -1
- package/dist/chunks/vendor-utils-fxk97j6xi1g42z2v.js +0 -740
- package/dist/chunks/vendor-utils-fxk97j6xi1g42z2v.js.map +0 -1
- package/dist/src/components/input/input-group.d.ts +0 -39
- package/dist/src/components/input/input-group.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudflare/kumo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Kumo - Cloudflare's component library for building modern web applications",
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
"types": "./dist/src/components/input/index.d.ts",
|
|
85
85
|
"import": "./dist/components/input.js"
|
|
86
86
|
},
|
|
87
|
+
"./components/input-group": {
|
|
88
|
+
"types": "./dist/src/components/input-group/index.d.ts",
|
|
89
|
+
"import": "./dist/components/input-group.js"
|
|
90
|
+
},
|
|
87
91
|
"./components/layer-card": {
|
|
88
92
|
"types": "./dist/src/components/layer-card/index.d.ts",
|
|
89
93
|
"import": "./dist/components/layer-card.js"
|
|
@@ -187,6 +191,10 @@
|
|
|
187
191
|
"types": "./dist/src/components/flow/index.d.ts",
|
|
188
192
|
"import": "./dist/components/flow.js"
|
|
189
193
|
},
|
|
194
|
+
"./components/autocomplete": {
|
|
195
|
+
"types": "./dist/src/components/autocomplete/index.d.ts",
|
|
196
|
+
"import": "./dist/components/autocomplete.js"
|
|
197
|
+
},
|
|
190
198
|
"./components/sidebar": {
|
|
191
199
|
"types": "./dist/src/components/sidebar/index.d.ts",
|
|
192
200
|
"import": "./dist/components/sidebar.js"
|
|
@@ -295,6 +303,10 @@
|
|
|
295
303
|
"types": "./dist/src/primitives/number-field.d.ts",
|
|
296
304
|
"import": "./dist/primitives/number-field.js"
|
|
297
305
|
},
|
|
306
|
+
"./primitives/otp-field": {
|
|
307
|
+
"types": "./dist/src/primitives/otp-field.d.ts",
|
|
308
|
+
"import": "./dist/primitives/otp-field.js"
|
|
309
|
+
},
|
|
298
310
|
"./primitives/popover": {
|
|
299
311
|
"types": "./dist/src/primitives/popover.d.ts",
|
|
300
312
|
"import": "./dist/primitives/popover.js"
|
|
@@ -425,7 +437,7 @@
|
|
|
425
437
|
}
|
|
426
438
|
},
|
|
427
439
|
"dependencies": {
|
|
428
|
-
"@base-ui/react": "^1.
|
|
440
|
+
"@base-ui/react": "^1.4.0",
|
|
429
441
|
"@shikijs/langs": "^4.0.0",
|
|
430
442
|
"@shikijs/themes": "^4.0.0",
|
|
431
443
|
"clsx": "^2.1.1",
|
|
@@ -678,3 +678,268 @@ describe("jsonSchemaTypeToString", () => {
|
|
|
678
678
|
);
|
|
679
679
|
});
|
|
680
680
|
});
|
|
681
|
+
|
|
682
|
+
// Tests for sub-component detection utilities
|
|
683
|
+
|
|
684
|
+
import { writeFileSync, unlinkSync, mkdtempSync } from "node:fs";
|
|
685
|
+
import { join } from "node:path";
|
|
686
|
+
import { tmpdir } from "node:os";
|
|
687
|
+
import {
|
|
688
|
+
detectSubComponents,
|
|
689
|
+
extractSubComponentProps,
|
|
690
|
+
extractPropsFromInterface,
|
|
691
|
+
} from "./sub-components.js";
|
|
692
|
+
|
|
693
|
+
function writeTempFile(content: string): {
|
|
694
|
+
filePath: string;
|
|
695
|
+
cleanup: () => void;
|
|
696
|
+
} {
|
|
697
|
+
const dir = mkdtempSync(join(tmpdir(), "kumo-test-"));
|
|
698
|
+
const filePath = join(dir, "test.tsx");
|
|
699
|
+
writeFileSync(filePath, content);
|
|
700
|
+
return { filePath, cleanup: () => unlinkSync(filePath) };
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
const cliFlags = {
|
|
704
|
+
includeInheritedProps: false,
|
|
705
|
+
noCache: true,
|
|
706
|
+
verbose: false,
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
describe("detectSubComponents", () => {
|
|
710
|
+
it("detects sub-components from Object.assign with function declarations", () => {
|
|
711
|
+
const { filePath, cleanup } = writeTempFile(`
|
|
712
|
+
function GroupComponent({ legend, children }: GroupProps) {
|
|
713
|
+
return <div>{children}</div>;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
const Root = () => <div />;
|
|
717
|
+
|
|
718
|
+
export const MyComponent = Object.assign(Root, {
|
|
719
|
+
Group: GroupComponent,
|
|
720
|
+
});
|
|
721
|
+
`);
|
|
722
|
+
|
|
723
|
+
try {
|
|
724
|
+
const result = detectSubComponents(filePath);
|
|
725
|
+
expect(result).toHaveLength(1);
|
|
726
|
+
expect(result[0].name).toBe("Group");
|
|
727
|
+
expect(result[0].valueName).toBe("GroupComponent");
|
|
728
|
+
expect(result[0].propsType).toBe("GroupProps");
|
|
729
|
+
} finally {
|
|
730
|
+
cleanup();
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
it("detects sub-components from Object.assign with multi-line forwardRef", () => {
|
|
735
|
+
const { filePath, cleanup } = writeTempFile(`
|
|
736
|
+
import { forwardRef } from "react";
|
|
737
|
+
|
|
738
|
+
export interface MyItemProps {
|
|
739
|
+
active?: boolean;
|
|
740
|
+
label: string;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const MyItem = forwardRef<
|
|
744
|
+
HTMLLIElement,
|
|
745
|
+
MyItemProps
|
|
746
|
+
>(({ active, label, ...props }, ref) => (
|
|
747
|
+
<li ref={ref} {...props}>{label}</li>
|
|
748
|
+
));
|
|
749
|
+
|
|
750
|
+
const Root = forwardRef<HTMLElement, {}>(
|
|
751
|
+
(props, ref) => <nav ref={ref} {...props} />
|
|
752
|
+
);
|
|
753
|
+
|
|
754
|
+
export const MyComponent = Object.assign(Root, {
|
|
755
|
+
Item: MyItem,
|
|
756
|
+
});
|
|
757
|
+
`);
|
|
758
|
+
|
|
759
|
+
try {
|
|
760
|
+
const result = detectSubComponents(filePath);
|
|
761
|
+
expect(result).toHaveLength(1);
|
|
762
|
+
expect(result[0].name).toBe("Item");
|
|
763
|
+
expect(result[0].valueName).toBe("MyItem");
|
|
764
|
+
expect(result[0].propsType).toBe("MyItemProps");
|
|
765
|
+
} finally {
|
|
766
|
+
cleanup();
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
it("detects sub-components with single-line forwardRef generics", () => {
|
|
771
|
+
const { filePath, cleanup } = writeTempFile(`
|
|
772
|
+
import { forwardRef } from "react";
|
|
773
|
+
|
|
774
|
+
export interface CellProps { span?: number; }
|
|
775
|
+
|
|
776
|
+
const TableCell = forwardRef<HTMLTableCellElement, CellProps>((props, ref) => (
|
|
777
|
+
<td ref={ref} {...props} />
|
|
778
|
+
));
|
|
779
|
+
|
|
780
|
+
const Root = forwardRef<HTMLTableElement, {}>((props, ref) => <table ref={ref} {...props} />);
|
|
781
|
+
|
|
782
|
+
export const Table = Object.assign(Root, {
|
|
783
|
+
Cell: TableCell,
|
|
784
|
+
});
|
|
785
|
+
`);
|
|
786
|
+
|
|
787
|
+
try {
|
|
788
|
+
const result = detectSubComponents(filePath);
|
|
789
|
+
expect(result).toHaveLength(1);
|
|
790
|
+
expect(result[0].name).toBe("Cell");
|
|
791
|
+
expect(result[0].valueName).toBe("TableCell");
|
|
792
|
+
expect(result[0].propsType).toBe("CellProps");
|
|
793
|
+
} finally {
|
|
794
|
+
cleanup();
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
it("populates valueName field for direct property assignment", () => {
|
|
799
|
+
const { filePath, cleanup } = writeTempFile(`
|
|
800
|
+
function Link({ href }: LinkProps) {
|
|
801
|
+
return <a href={href} />;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
const Breadcrumbs = () => <nav />;
|
|
805
|
+
Breadcrumbs.Link = Link;
|
|
806
|
+
`);
|
|
807
|
+
|
|
808
|
+
try {
|
|
809
|
+
const result = detectSubComponents(filePath);
|
|
810
|
+
expect(result).toHaveLength(1);
|
|
811
|
+
expect(result[0].name).toBe("Link");
|
|
812
|
+
expect(result[0].valueName).toBe("Link");
|
|
813
|
+
} finally {
|
|
814
|
+
cleanup();
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
describe("extractSubComponentProps", () => {
|
|
820
|
+
it("extracts props from interface via propsType (forwardRef pattern)", () => {
|
|
821
|
+
const { filePath, cleanup } = writeTempFile(`
|
|
822
|
+
import { forwardRef } from "react";
|
|
823
|
+
|
|
824
|
+
export interface ItemProps {
|
|
825
|
+
active?: boolean;
|
|
826
|
+
label: string;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
const MyItem = forwardRef<HTMLLIElement, ItemProps>(
|
|
830
|
+
({ active, label, ...props }, ref) => <li ref={ref} {...props}>{label}</li>
|
|
831
|
+
);
|
|
832
|
+
`);
|
|
833
|
+
|
|
834
|
+
try {
|
|
835
|
+
const props = extractSubComponentProps(
|
|
836
|
+
filePath,
|
|
837
|
+
{
|
|
838
|
+
name: "Item",
|
|
839
|
+
valueName: "MyItem",
|
|
840
|
+
propsType: "ItemProps",
|
|
841
|
+
description: "Item sub-component",
|
|
842
|
+
isPassThrough: false,
|
|
843
|
+
},
|
|
844
|
+
cliFlags,
|
|
845
|
+
);
|
|
846
|
+
|
|
847
|
+
expect(props).toHaveProperty("active");
|
|
848
|
+
expect(props.active).toEqual({ type: "boolean", optional: true });
|
|
849
|
+
expect(props).toHaveProperty("label");
|
|
850
|
+
expect(props.label).toEqual({ type: "string", required: true });
|
|
851
|
+
} finally {
|
|
852
|
+
cleanup();
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
it("skips pass-through sub-components", () => {
|
|
857
|
+
const { filePath, cleanup } = writeTempFile("export const Foo = {};");
|
|
858
|
+
|
|
859
|
+
try {
|
|
860
|
+
const props = extractSubComponentProps(
|
|
861
|
+
filePath,
|
|
862
|
+
{
|
|
863
|
+
name: "Root",
|
|
864
|
+
valueName: "DialogBase.Root",
|
|
865
|
+
propsType: null,
|
|
866
|
+
description: "Root sub-component (wraps DialogBase)",
|
|
867
|
+
isPassThrough: true,
|
|
868
|
+
baseComponent: "DialogBase.Root",
|
|
869
|
+
},
|
|
870
|
+
cliFlags,
|
|
871
|
+
);
|
|
872
|
+
|
|
873
|
+
expect(props).toEqual({});
|
|
874
|
+
} finally {
|
|
875
|
+
cleanup();
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
it("uses valueName for inline props lookup when name doesn't match", () => {
|
|
880
|
+
const { filePath, cleanup } = writeTempFile(`
|
|
881
|
+
function TableOfContentsGroup({ label, href }: { label: string; href?: string }) {
|
|
882
|
+
return <div>{label}</div>;
|
|
883
|
+
}
|
|
884
|
+
`);
|
|
885
|
+
|
|
886
|
+
try {
|
|
887
|
+
const props = extractSubComponentProps(
|
|
888
|
+
filePath,
|
|
889
|
+
{
|
|
890
|
+
name: "Group",
|
|
891
|
+
valueName: "TableOfContentsGroup",
|
|
892
|
+
propsType: null,
|
|
893
|
+
description: "Group sub-component",
|
|
894
|
+
isPassThrough: false,
|
|
895
|
+
},
|
|
896
|
+
cliFlags,
|
|
897
|
+
);
|
|
898
|
+
|
|
899
|
+
expect(props).toHaveProperty("label");
|
|
900
|
+
expect(props.label).toEqual({ type: "string", required: true });
|
|
901
|
+
expect(props).toHaveProperty("href");
|
|
902
|
+
expect(props.href).toEqual({ type: "string", optional: true });
|
|
903
|
+
} finally {
|
|
904
|
+
cleanup();
|
|
905
|
+
}
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
describe("extractPropsFromInterface", () => {
|
|
910
|
+
it("extracts props from a simple interface", () => {
|
|
911
|
+
const content = `
|
|
912
|
+
interface MyProps {
|
|
913
|
+
label: string;
|
|
914
|
+
active?: boolean;
|
|
915
|
+
count: number;
|
|
916
|
+
}
|
|
917
|
+
`;
|
|
918
|
+
const props = extractPropsFromInterface(content, "MyProps", cliFlags);
|
|
919
|
+
expect(props).toEqual({
|
|
920
|
+
label: { type: "string", required: true },
|
|
921
|
+
active: { type: "boolean", optional: true },
|
|
922
|
+
count: { type: "number", required: true },
|
|
923
|
+
});
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
it("extracts props from interface with extends", () => {
|
|
927
|
+
const content = `
|
|
928
|
+
interface GroupProps extends BaseProps {
|
|
929
|
+
label: string;
|
|
930
|
+
href?: string;
|
|
931
|
+
}
|
|
932
|
+
`;
|
|
933
|
+
const props = extractPropsFromInterface(content, "GroupProps", cliFlags);
|
|
934
|
+
expect(props).toEqual({
|
|
935
|
+
label: { type: "string", required: true },
|
|
936
|
+
href: { type: "string", optional: true },
|
|
937
|
+
});
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
it("returns empty object when interface not found", () => {
|
|
941
|
+
const content = "interface OtherProps { foo: string; }";
|
|
942
|
+
const props = extractPropsFromInterface(content, "MyProps", cliFlags);
|
|
943
|
+
expect(props).toEqual({});
|
|
944
|
+
});
|
|
945
|
+
});
|
|
@@ -611,6 +611,20 @@ async function processComponent(
|
|
|
611
611
|
let usageExamples: string[] | undefined;
|
|
612
612
|
let renderElement: string | undefined;
|
|
613
613
|
|
|
614
|
+
// Inject additional props for sub-components (e.g., "InputGroup.Input")
|
|
615
|
+
const subAdditionalProps =
|
|
616
|
+
ADDITIONAL_COMPONENT_PROPS[`${config.name}.${subComp.name}`];
|
|
617
|
+
if (subAdditionalProps) {
|
|
618
|
+
for (const [propName, propSchema] of Object.entries(
|
|
619
|
+
subAdditionalProps,
|
|
620
|
+
)) {
|
|
621
|
+
subProps[propName] = {
|
|
622
|
+
...subProps[propName],
|
|
623
|
+
...propSchema,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
|
|
614
628
|
if (subComp.isPassThrough && subComp.baseComponent) {
|
|
615
629
|
const passthroughDoc =
|
|
616
630
|
PASSTHROUGH_COMPONENT_DOCS[subComp.baseComponent];
|
|
@@ -254,10 +254,43 @@ export const ADDITIONAL_COMPONENT_PROPS: Record<
|
|
|
254
254
|
description: "Callback when collapsed state changes",
|
|
255
255
|
},
|
|
256
256
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
type: "
|
|
260
|
-
description: "
|
|
257
|
+
"InputGroup.Addon": {
|
|
258
|
+
align: {
|
|
259
|
+
type: '"start" | "end"',
|
|
260
|
+
description: "Position relative to the input.",
|
|
261
|
+
default: '"start"',
|
|
262
|
+
},
|
|
263
|
+
className: {
|
|
264
|
+
type: "string",
|
|
265
|
+
description: "Additional CSS classes.",
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
"InputGroup.Button": {
|
|
269
|
+
tooltip: {
|
|
270
|
+
type: "ReactNode",
|
|
271
|
+
description:
|
|
272
|
+
"When provided, wraps the button in a Tooltip. Automatically sets aria-label from a string value.",
|
|
273
|
+
},
|
|
274
|
+
tooltipSide: {
|
|
275
|
+
type: '"top" | "right" | "bottom" | "left"',
|
|
276
|
+
description: "Preferred side for the tooltip popup.",
|
|
277
|
+
default: '"bottom"',
|
|
278
|
+
},
|
|
279
|
+
variant: {
|
|
280
|
+
type: '"primary" | "secondary" | "ghost" | "destructive" | "secondary-destructive" | "outline"',
|
|
281
|
+
description: "Button visual style. Defaults to ghost.",
|
|
282
|
+
default: '"ghost"',
|
|
283
|
+
},
|
|
284
|
+
size: {
|
|
285
|
+
type: '"xs" | "sm" | "base" | "lg"',
|
|
286
|
+
description: "Button size.",
|
|
287
|
+
default: '"sm"',
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
"InputGroup.Suffix": {
|
|
291
|
+
className: {
|
|
292
|
+
type: "string",
|
|
293
|
+
description: "Additional CSS classes.",
|
|
261
294
|
},
|
|
262
295
|
},
|
|
263
296
|
};
|
|
@@ -318,7 +351,12 @@ export const COMPONENT_STYLING_METADATA: Record<string, ComponentStyling> = {
|
|
|
318
351
|
],
|
|
319
352
|
},
|
|
320
353
|
ClipboardText: {
|
|
321
|
-
baseTokens: [
|
|
354
|
+
baseTokens: [
|
|
355
|
+
"bg-kumo-base",
|
|
356
|
+
"text-kumo-default",
|
|
357
|
+
"ring-kumo-line",
|
|
358
|
+
"border-kumo-fill",
|
|
359
|
+
],
|
|
322
360
|
states: {
|
|
323
361
|
input: ["bg-kumo-control", "text-kumo-default", "ring-kumo-line"],
|
|
324
362
|
text: ["bg-kumo-base", "font-mono"],
|
|
@@ -382,7 +420,7 @@ export const COMPONENT_STYLING_METADATA: Record<string, ComponentStyling> = {
|
|
|
382
420
|
],
|
|
383
421
|
},
|
|
384
422
|
Code: {
|
|
385
|
-
baseTokens: ["text-kumo-
|
|
423
|
+
baseTokens: ["text-kumo-subtle"],
|
|
386
424
|
dimensions: "m-0 w-auto p-0",
|
|
387
425
|
borderRadius: "rounded-none",
|
|
388
426
|
states: {
|
|
@@ -403,7 +441,12 @@ export const COMPONENT_STYLING_METADATA: Record<string, ComponentStyling> = {
|
|
|
403
441
|
},
|
|
404
442
|
},
|
|
405
443
|
Input: {
|
|
406
|
-
baseTokens: [
|
|
444
|
+
baseTokens: [
|
|
445
|
+
"bg-kumo-control",
|
|
446
|
+
"text-kumo-default",
|
|
447
|
+
"text-kumo-subtle",
|
|
448
|
+
"ring-kumo-line",
|
|
449
|
+
],
|
|
407
450
|
sizeVariants: {
|
|
408
451
|
xs: {
|
|
409
452
|
height: 20,
|
|
@@ -473,7 +516,12 @@ export const COMPONENT_STYLING_METADATA: Record<string, ComponentStyling> = {
|
|
|
473
516
|
},
|
|
474
517
|
},
|
|
475
518
|
Dialog: {
|
|
476
|
-
baseTokens: [
|
|
519
|
+
baseTokens: [
|
|
520
|
+
"bg-kumo-base",
|
|
521
|
+
"text-kumo-default",
|
|
522
|
+
"border-kumo-line",
|
|
523
|
+
"shadow-m",
|
|
524
|
+
],
|
|
477
525
|
sizeVariants: {
|
|
478
526
|
sm: {
|
|
479
527
|
height: 0, // Dialog height is auto (content-driven)
|
|
@@ -97,6 +97,19 @@ export function detectSubComponents(filePath: string): SubComponentConfig[] {
|
|
|
97
97
|
propsType = `${value}Props`;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// Also check for forwardRef pattern:
|
|
101
|
+
// const Value = forwardRef<HTMLElement, PropsType>(...)
|
|
102
|
+
// Handles multi-line generics ([\s\S] matches newlines)
|
|
103
|
+
if (!propsType) {
|
|
104
|
+
const forwardRefPattern = new RegExp(
|
|
105
|
+
`const\\s+${value}\\s*=\\s*forwardRef<[\\s\\S]*?,\\s*(\\w+)\\s*>\\s*\\(`,
|
|
106
|
+
);
|
|
107
|
+
const forwardRefMatch = content.match(forwardRefPattern);
|
|
108
|
+
if (forwardRefMatch) {
|
|
109
|
+
propsType = forwardRefMatch[1];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
100
113
|
// Generate description
|
|
101
114
|
let description = `${subName} sub-component`;
|
|
102
115
|
if (isPassThrough) {
|
|
@@ -111,6 +124,7 @@ export function detectSubComponents(filePath: string): SubComponentConfig[] {
|
|
|
111
124
|
|
|
112
125
|
subComponents.push({
|
|
113
126
|
name: subName,
|
|
127
|
+
valueName: value,
|
|
114
128
|
propsType,
|
|
115
129
|
description,
|
|
116
130
|
isPassThrough,
|
|
@@ -150,6 +164,7 @@ export function detectSubComponents(filePath: string): SubComponentConfig[] {
|
|
|
150
164
|
|
|
151
165
|
subComponents.push({
|
|
152
166
|
name: subName,
|
|
167
|
+
valueName: value,
|
|
153
168
|
propsType,
|
|
154
169
|
description: `${subName} sub-component`,
|
|
155
170
|
isPassThrough: false,
|
|
@@ -186,60 +201,71 @@ export function extractSubComponentProps(
|
|
|
186
201
|
try {
|
|
187
202
|
const content = readFileSync(filePath, "utf-8");
|
|
188
203
|
const funcName = subComponent.name;
|
|
204
|
+
// valueName is the resolved variable name from Object.assign (e.g., "TableOfContentsTitle")
|
|
205
|
+
// while funcName is the short sub-component name (e.g., "Title")
|
|
206
|
+
const valueName = subComponent.valueName;
|
|
189
207
|
const props: Record<string, PropSchema> = {};
|
|
190
208
|
|
|
209
|
+
// Try both the short name and the resolved variable name for pattern matching
|
|
210
|
+
const namesToTry = [
|
|
211
|
+
funcName,
|
|
212
|
+
...(valueName !== funcName ? [valueName] : []),
|
|
213
|
+
];
|
|
214
|
+
|
|
191
215
|
// Pattern 1: Inline object type in function signature
|
|
192
216
|
// Matches: function Foo({ ... }: { prop: Type }) or ({ ... }: PropsWithChildren<{ prop: Type }>)
|
|
193
217
|
// Also matches arrow functions: const Foo = ({ ... }: { prop: Type }) =>
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
218
|
+
for (const name of namesToTry) {
|
|
219
|
+
const inlinePropsPatterns = [
|
|
220
|
+
// function Name({ destructured }: { inline props })
|
|
221
|
+
new RegExp(
|
|
222
|
+
`(?:function|const)\\s+${name}\\s*=?\\s*\\([^)]*:\\s*(?:PropsWithChildren<)?\\{([^}]+)\\}`,
|
|
223
|
+
),
|
|
224
|
+
// function Name({ destructured }: PropsWithChildren<InterfaceName>)
|
|
225
|
+
new RegExp(
|
|
226
|
+
`(?:function|const)\\s+${name}\\s*=?\\s*\\([^)]*:\\s*PropsWithChildren<(\\w+)>`,
|
|
227
|
+
),
|
|
228
|
+
];
|
|
204
229
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
230
|
+
for (const pattern of inlinePropsPatterns) {
|
|
231
|
+
const match = content.match(pattern);
|
|
232
|
+
if (match) {
|
|
233
|
+
const propsBlock = match[1];
|
|
234
|
+
|
|
235
|
+
// Check if it's an interface name (single word) or inline props
|
|
236
|
+
if (propsBlock.match(/^\w+$/)) {
|
|
237
|
+
// It's an interface name, try to find and parse it
|
|
238
|
+
const interfaceProps = extractPropsFromInterface(
|
|
239
|
+
content,
|
|
240
|
+
propsBlock,
|
|
241
|
+
cliFlags,
|
|
242
|
+
);
|
|
243
|
+
Object.assign(props, interfaceProps);
|
|
244
|
+
} else {
|
|
245
|
+
// Parse inline props: propName?: Type or propName: Type
|
|
246
|
+
const propPattern = /(\w+)(\?)?:\s*([^;,\n}]+)/g;
|
|
247
|
+
let propMatch: RegExpExecArray | null;
|
|
248
|
+
|
|
249
|
+
while ((propMatch = propPattern.exec(propsBlock)) !== null) {
|
|
250
|
+
const propName = propMatch[1];
|
|
251
|
+
const isOptional = propMatch[2] === "?";
|
|
252
|
+
let propType = propMatch[3].trim();
|
|
253
|
+
|
|
254
|
+
// Clean up type
|
|
255
|
+
propType = propType.replace(/[,;]$/, "").trim();
|
|
256
|
+
|
|
257
|
+
if (shouldSkipProp(propName, cliFlags)) continue;
|
|
258
|
+
|
|
259
|
+
props[propName] = {
|
|
260
|
+
type: propType,
|
|
261
|
+
...(isOptional ? { optional: true } : { required: true }),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
238
264
|
}
|
|
239
|
-
}
|
|
240
265
|
|
|
241
|
-
|
|
242
|
-
|
|
266
|
+
if (Object.keys(props).length > 0) {
|
|
267
|
+
return props;
|
|
268
|
+
}
|
|
243
269
|
}
|
|
244
270
|
}
|
|
245
271
|
}
|
|
@@ -260,12 +286,17 @@ export function extractSubComponentProps(
|
|
|
260
286
|
if (Object.keys(props).length === 0) {
|
|
261
287
|
// Use a more flexible approach: find the function definition and extract the type annotation
|
|
262
288
|
// This handles multi-line destructuring patterns
|
|
263
|
-
const funcDefPatterns = [
|
|
289
|
+
const funcDefPatterns: RegExp[] = [];
|
|
290
|
+
for (const name of namesToTry) {
|
|
264
291
|
// Arrow function: const Name = (...)
|
|
265
|
-
|
|
292
|
+
funcDefPatterns.push(
|
|
293
|
+
new RegExp(`const\\s+${name}\\s*=\\s*\\([\\s\\S]*?\\)\\s*=>`),
|
|
294
|
+
);
|
|
266
295
|
// Regular function: function Name(...)
|
|
267
|
-
|
|
268
|
-
|
|
296
|
+
funcDefPatterns.push(
|
|
297
|
+
new RegExp(`function\\s+${name}\\s*\\([\\s\\S]*?\\)\\s*\\{`),
|
|
298
|
+
);
|
|
299
|
+
}
|
|
269
300
|
|
|
270
301
|
for (const defPattern of funcDefPatterns) {
|
|
271
302
|
const defMatch = content.match(defPattern);
|
|
@@ -54,6 +54,8 @@ import type { ComponentStyling, ComponentType } from "../../src/registry/types";
|
|
|
54
54
|
export interface SubComponentConfig {
|
|
55
55
|
/** Sub-component name (e.g., "Root", "Trigger", "Content") */
|
|
56
56
|
name: string;
|
|
57
|
+
/** Resolved variable name from the Object.assign value (e.g., "TableOfContentsTitle") */
|
|
58
|
+
valueName: string;
|
|
57
59
|
/** Props type name if available */
|
|
58
60
|
propsType: string | null;
|
|
59
61
|
/** Description extracted from JSDoc or generated */
|