@cloudraker/reki 2.6.1 → 2.7.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 +20 -0
- package/README.md +1 -1
- package/ai/component-registry.json +1271 -41
- package/ai/component-registry.md +1310 -34
- package/ai/schemas.ts +226 -2
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +554 -5
- package/dist/ai/schemas.d.ts.map +1 -1
- package/dist/ai/schemas.js +1699 -1405
- package/dist/ai/schemas.js.map +1 -1
- package/dist/chunks/{SankeyChart-jwwpwps4npqzbrvn.js → SankeyChart-gogf860o4u387kjn.js} +2 -2
- package/dist/chunks/{SankeyChart-jwwpwps4npqzbrvn.js.map → SankeyChart-gogf860o4u387kjn.js.map} +1 -1
- package/dist/chunks/actor-display-izds1bhw0yswurqm.js +35 -0
- package/dist/chunks/actor-display-izds1bhw0yswurqm.js.map +1 -0
- package/dist/chunks/address-input-g1la0xqrpg8ic6ak.js +80 -0
- package/dist/chunks/address-input-g1la0xqrpg8ic6ak.js.map +1 -0
- package/dist/chunks/array-display-lu1259ap3qrl847e.js +12 -0
- package/dist/chunks/array-display-lu1259ap3qrl847e.js.map +1 -0
- package/dist/chunks/{autocomplete-f4vetako14h2aqsw.js → autocomplete-htuy5t9ag29qhuwa.js} +4 -4
- package/dist/chunks/{autocomplete-f4vetako14h2aqsw.js.map → autocomplete-htuy5t9ag29qhuwa.js.map} +1 -1
- package/dist/chunks/avatar-g40cun6cn17fcxd4.js +57 -0
- package/dist/chunks/avatar-g40cun6cn17fcxd4.js.map +1 -0
- package/dist/chunks/avatar-group-fpcaziey1yu7226v.js +23 -0
- package/dist/chunks/avatar-group-fpcaziey1yu7226v.js.map +1 -0
- package/dist/chunks/{breadcrumbs-d6149hyct4puz3x4.js → breadcrumbs-mq1utzm0q4u2r5v5.js} +2 -2
- package/dist/chunks/{breadcrumbs-d6149hyct4puz3x4.js.map → breadcrumbs-mq1utzm0q4u2r5v5.js.map} +1 -1
- package/dist/chunks/{button-nc5p1h28cwes0tjw.js → button-fvlz1rzc3s1hpyxs.js} +14 -14
- package/dist/chunks/button-fvlz1rzc3s1hpyxs.js.map +1 -0
- package/dist/chunks/{checkbox-g2661n3eodgoispq.js → checkbox-h3kfhlron3b6sfhv.js} +3 -3
- package/dist/chunks/{checkbox-g2661n3eodgoispq.js.map → checkbox-h3kfhlron3b6sfhv.js.map} +1 -1
- package/dist/chunks/chip-iu7movvthovdurgb.js +69 -0
- package/dist/chunks/chip-iu7movvthovdurgb.js.map +1 -0
- package/dist/chunks/circular-progress-bar-ofg0ps2axad1wsr6.js +60 -0
- package/dist/chunks/circular-progress-bar-ofg0ps2axad1wsr6.js.map +1 -0
- package/dist/chunks/{clipboard-text-g3659lejx2d7i93e.js → clipboard-text-ogue8iq06n1z7q7v.js} +4 -4
- package/dist/chunks/{clipboard-text-g3659lejx2d7i93e.js.map → clipboard-text-ogue8iq06n1z7q7v.js.map} +1 -1
- package/dist/chunks/{collapsible-ndvmgo29s5iqfcor.js → collapsible-ivqat099ene9z3bv.js} +2 -2
- package/dist/chunks/{collapsible-ndvmgo29s5iqfcor.js.map → collapsible-ivqat099ene9z3bv.js.map} +1 -1
- package/dist/chunks/color-sample-h7hspma3rb91go3z.js +32 -0
- package/dist/chunks/color-sample-h7hspma3rb91go3z.js.map +1 -0
- package/dist/chunks/{combobox-i38w67netm8ukw4f.js → combobox-iytvpzp5poljxgek.js} +4 -4
- package/dist/chunks/{combobox-i38w67netm8ukw4f.js.map → combobox-iytvpzp5poljxgek.js.map} +1 -1
- package/dist/chunks/{command-palette-fe5cjfdgsg3t17vq.js → command-palette-k6vrx8ely8rmf4a5.js} +4 -4
- package/dist/chunks/command-palette-k6vrx8ely8rmf4a5.js.map +1 -0
- package/dist/chunks/data-grid-i7kfgm7zr5tj0e0a.js +3110 -0
- package/dist/chunks/data-grid-i7kfgm7zr5tj0e0a.js.map +1 -0
- package/dist/chunks/{dialog-m4go8xof25fospqo.js → dialog-ggx34i6k4eulfvgk.js} +3 -3
- package/dist/chunks/{dialog-m4go8xof25fospqo.js.map → dialog-ggx34i6k4eulfvgk.js.map} +1 -1
- package/dist/chunks/double-text-input-k0i5xnfq6khv01wu.js +39 -0
- package/dist/chunks/double-text-input-k0i5xnfq6khv01wu.js.map +1 -0
- package/dist/chunks/{dropdown-j5uht8mn4z7xc9fc.js → dropdown-bt1lfs2jli0khnex.js} +2 -2
- package/dist/chunks/{dropdown-j5uht8mn4z7xc9fc.js.map → dropdown-bt1lfs2jli0khnex.js.map} +1 -1
- package/dist/chunks/emails-display-nsbqzscr0f9bqimg.js +12 -0
- package/dist/chunks/emails-display-nsbqzscr0f9bqimg.js.map +1 -0
- package/dist/chunks/{empty-kazxr0248zjemw6n.js → empty-dxy8jti5bsxxh905.js} +2 -2
- package/dist/chunks/{empty-kazxr0248zjemw6n.js.map → empty-dxy8jti5bsxxh905.js.map} +1 -1
- package/dist/chunks/expandable-list-bjceh467ocazog53.js +26 -0
- package/dist/chunks/expandable-list-bjceh467ocazog53.js.map +1 -0
- package/dist/chunks/{field-fe5m8z3vbpvtctbe.js → field-b0aywboxuss4rpu7.js} +3 -3
- package/dist/chunks/{field-fe5m8z3vbpvtctbe.js.map → field-b0aywboxuss4rpu7.js.map} +1 -1
- package/dist/chunks/{input-area-ciw85g3fno06t4tw.js → input-area-cuijpofpark5w5qq.js} +4 -4
- package/dist/chunks/{input-area-ciw85g3fno06t4tw.js.map → input-area-cuijpofpark5w5qq.js.map} +1 -1
- package/dist/chunks/{input-i5nefqk213n4z7pr.js → input-eno4q26x68rx3i8q.js} +3 -3
- package/dist/chunks/{input-i5nefqk213n4z7pr.js.map → input-eno4q26x68rx3i8q.js.map} +1 -1
- package/dist/chunks/{input-group-mo7tq7jr19hmgor5.js → input-group-dl9htnza7kq4om4c.js} +5 -5
- package/dist/chunks/{input-group-mo7tq7jr19hmgor5.js.map → input-group-dl9htnza7kq4om4c.js.map} +1 -1
- package/dist/chunks/json-display-fy0t2khc4itn130p.js +31 -0
- package/dist/chunks/json-display-fy0t2khc4itn130p.js.map +1 -0
- package/dist/chunks/{label-fcho4757rbdess0c.js → label-ld57mr4ocdxsf06p.js} +3 -3
- package/dist/chunks/{label-fcho4757rbdess0c.js.map → label-ld57mr4ocdxsf06p.js.map} +1 -1
- package/dist/chunks/{layer-card-kzu48dhzxm3e9p4u.js → layer-card-iuquuc1w3116umfw.js} +2 -2
- package/dist/chunks/{layer-card-kzu48dhzxm3e9p4u.js.map → layer-card-iuquuc1w3116umfw.js.map} +1 -1
- package/dist/chunks/{link-j2gu5dr3nr4i4yf0.js → link-8pn6y27h3m3ud8fl.js} +2 -2
- package/dist/chunks/{link-j2gu5dr3nr4i4yf0.js.map → link-8pn6y27h3m3ud8fl.js.map} +1 -1
- package/dist/chunks/link-chip-cz5v6lw9icmcndzl.js +58 -0
- package/dist/chunks/link-chip-cz5v6lw9icmcndzl.js.map +1 -0
- package/dist/chunks/links-display-dfaehepz86s2wxx1.js +20 -0
- package/dist/chunks/links-display-dfaehepz86s2wxx1.js.map +1 -0
- package/dist/chunks/menu-item-kyqq7o2krghxbpw5.js +178 -0
- package/dist/chunks/menu-item-kyqq7o2krghxbpw5.js.map +1 -0
- package/dist/chunks/{menubar-ir5gbjmsizsddz7g.js → menubar-56kqktsa5a28xyzj.js} +2 -2
- package/dist/chunks/{menubar-ir5gbjmsizsddz7g.js.map → menubar-56kqktsa5a28xyzj.js.map} +1 -1
- package/dist/chunks/{meter-o5yd7ctjf80vvyjx.js → meter-b5rnmibceu4z8i6a.js} +2 -2
- package/dist/chunks/{meter-o5yd7ctjf80vvyjx.js.map → meter-b5rnmibceu4z8i6a.js.map} +1 -1
- package/dist/chunks/notification-counter-hiq85elmcydnhzoo.js +30 -0
- package/dist/chunks/notification-counter-hiq85elmcydnhzoo.js.map +1 -0
- package/dist/chunks/overflowing-text-mm8bkx7voc6h8ra4.js +49 -0
- package/dist/chunks/overflowing-text-mm8bkx7voc6h8ra4.js.map +1 -0
- package/dist/chunks/{pagination-bryw6rohfr7mm3km.js → pagination-iczb9ooenevbxslx.js} +3 -3
- package/dist/chunks/{pagination-bryw6rohfr7mm3km.js.map → pagination-iczb9ooenevbxslx.js.map} +1 -1
- package/dist/chunks/phones-display-cdsrl07dv6obf4eg.js +19 -0
- package/dist/chunks/phones-display-cdsrl07dv6obf4eg.js.map +1 -0
- package/dist/chunks/pill-pfpvgbcnqhtyksz5.js +22 -0
- package/dist/chunks/pill-pfpvgbcnqhtyksz5.js.map +1 -0
- package/dist/chunks/{popover-elxcmvv7mu7m7uk4.js → popover-ldqdlpv6sqvkjume.js} +2 -2
- package/dist/chunks/{popover-elxcmvv7mu7m7uk4.js.map → popover-ldqdlpv6sqvkjume.js.map} +1 -1
- package/dist/chunks/{radio-newyq331uk4lltr6.js → radio-lyeniil3x20cyb8z.js} +2 -2
- package/dist/chunks/{radio-newyq331uk4lltr6.js.map → radio-lyeniil3x20cyb8z.js.map} +1 -1
- package/dist/chunks/rating-yyd4t8e62ast4obo.js +48 -0
- package/dist/chunks/rating-yyd4t8e62ast4obo.js.map +1 -0
- package/dist/chunks/record-board-iapx3cw5rusehrta.js +3395 -0
- package/dist/chunks/record-board-iapx3cw5rusehrta.js.map +1 -0
- package/dist/chunks/{select-h5480mbro0ypxu0b.js → select-hmoccee4zagd34tq.js} +6 -6
- package/dist/chunks/{select-h5480mbro0ypxu0b.js.map → select-hmoccee4zagd34tq.js.map} +1 -1
- package/dist/chunks/{sensitive-input-lqugq6uvx0lkpu0u.js → sensitive-input-nkfx72rduc7aijaf.js} +4 -4
- package/dist/chunks/{sensitive-input-lqugq6uvx0lkpu0u.js.map → sensitive-input-nkfx72rduc7aijaf.js.map} +1 -1
- package/dist/chunks/{sidebar-noz668nhdu2gso12.js → sidebar-gwfibai76tw069d4.js} +34 -33
- package/dist/chunks/sidebar-gwfibai76tw069d4.js.map +1 -0
- package/dist/chunks/status-ot0itdwxloqgahi0.js +29 -0
- package/dist/chunks/status-ot0itdwxloqgahi0.js.map +1 -0
- package/dist/chunks/{surface-cyxme7mlr49l33f8.js → surface-fqmma34ju0agh5pe.js} +2 -2
- package/dist/chunks/{surface-cyxme7mlr49l33f8.js.map → surface-fqmma34ju0agh5pe.js.map} +1 -1
- package/dist/chunks/{switch-bigo96fyjlh7ivbi.js → switch-nhtmn65n5s7gg6vb.js} +3 -3
- package/dist/chunks/{switch-bigo96fyjlh7ivbi.js.map → switch-nhtmn65n5s7gg6vb.js.map} +1 -1
- package/dist/chunks/{table-mwcmwp6a80zvyrxw.js → table-cjj894o3niouq4tg.js} +2 -2
- package/dist/chunks/{table-mwcmwp6a80zvyrxw.js.map → table-cjj894o3niouq4tg.js.map} +1 -1
- package/dist/chunks/{tabs-e4pcjkw94kpe35x0.js → tabs-klj6wapad6fpd9at.js} +14 -16
- package/dist/chunks/tabs-klj6wapad6fpd9at.js.map +1 -0
- package/dist/chunks/tag-h5kwf5eh7dyyvc2c.js +58 -0
- package/dist/chunks/tag-h5kwf5eh7dyyvc2c.js.map +1 -0
- package/dist/chunks/timeline-lqurr2lcxkayomk2.js +109 -0
- package/dist/chunks/timeline-lqurr2lcxkayomk2.js.map +1 -0
- package/dist/chunks/{toast-ivr4097bstjcjotf.js → toast-j47dl441zpxa1yw3.js} +3 -3
- package/dist/chunks/{toast-ivr4097bstjcjotf.js.map → toast-j47dl441zpxa1yw3.js.map} +1 -1
- package/dist/chunks/{tooltip-ncaia8n1lavkyw8n.js → tooltip-bkgxuz77xzg5fooc.js} +2 -2
- package/dist/chunks/{tooltip-ncaia8n1lavkyw8n.js.map → tooltip-bkgxuz77xzg5fooc.js.map} +1 -1
- package/dist/chunks/{vendor-base-ui-bgl9g5nkvqy3tn36.js → vendor-base-ui-djdjrfuoxlb1lubi.js} +2358 -2358
- package/dist/chunks/{vendor-base-ui-bgl9g5nkvqy3tn36.js.map → vendor-base-ui-djdjrfuoxlb1lubi.js.map} +1 -1
- package/dist/code.js +1 -1
- package/dist/components/actor-display.js +6 -0
- package/dist/components/actor-display.js.map +1 -0
- package/dist/components/address-input.js +6 -0
- package/dist/components/address-input.js.map +1 -0
- package/dist/components/array-display.js +6 -0
- package/dist/components/array-display.js.map +1 -0
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/avatar-group.js +6 -0
- package/dist/components/avatar-group.js.map +1 -0
- package/dist/components/avatar.js +6 -0
- package/dist/components/avatar.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/chip.js +8 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/circular-progress-bar.js +6 -0
- package/dist/components/circular-progress-bar.js.map +1 -0
- package/dist/components/clipboard-text.js +1 -1
- package/dist/components/collapsible.js +1 -1
- package/dist/components/color-sample.js +6 -0
- package/dist/components/color-sample.js.map +1 -0
- package/dist/components/combobox.js +1 -1
- package/dist/components/command-palette.js +1 -1
- package/dist/components/data-grid.js +8 -0
- package/dist/components/data-grid.js.map +1 -0
- package/dist/components/dialog.js +1 -1
- package/dist/components/double-text-input.js +6 -0
- package/dist/components/double-text-input.js.map +1 -0
- package/dist/components/dropdown.js +1 -1
- package/dist/components/emails-display.js +6 -0
- package/dist/components/emails-display.js.map +1 -0
- package/dist/components/empty.js +1 -1
- package/dist/components/expandable-list.js +6 -0
- package/dist/components/expandable-list.js.map +1 -0
- package/dist/components/field.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input.js +3 -3
- package/dist/components/json-display.js +6 -0
- package/dist/components/json-display.js.map +1 -0
- package/dist/components/label.js +1 -1
- package/dist/components/layer-card.js +1 -1
- package/dist/components/link-chip.js +6 -0
- package/dist/components/link-chip.js.map +1 -0
- package/dist/components/link.js +1 -1
- package/dist/components/links-display.js +6 -0
- package/dist/components/links-display.js.map +1 -0
- package/dist/components/menu-item.js +11 -0
- package/dist/components/menu-item.js.map +1 -0
- package/dist/components/menubar.js +1 -1
- package/dist/components/meter.js +1 -1
- package/dist/components/notification-counter.js +6 -0
- package/dist/components/notification-counter.js.map +1 -0
- package/dist/components/overflowing-text.js +6 -0
- package/dist/components/overflowing-text.js.map +1 -0
- package/dist/components/pagination.js +1 -1
- package/dist/components/phones-display.js +6 -0
- package/dist/components/phones-display.js.map +1 -0
- package/dist/components/pill.js +6 -0
- package/dist/components/pill.js.map +1 -0
- package/dist/components/popover.js +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/rating.js +6 -0
- package/dist/components/rating.js.map +1 -0
- package/dist/components/record-board.js +8 -0
- package/dist/components/record-board.js.map +1 -0
- 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/status.js +6 -0
- package/dist/components/status.js.map +1 -0
- package/dist/components/surface.js +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/tag.js +10 -0
- package/dist/components/tag.js.map +1 -0
- package/dist/components/timeline.js +8 -0
- package/dist/components/timeline.js.map +1 -0
- package/dist/components/toast.js +2 -2
- package/dist/components/tooltip.js +1 -1
- package/dist/index.js +380 -251
- 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 +1 -1
- 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 +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- 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 +1 -1
- package/dist/scripts/theme-generator/config.d.ts.map +1 -1
- package/dist/scripts/theme-generator/config.js +229 -5
- package/dist/scripts/theme-generator/config.js.map +1 -1
- package/dist/src/components/actor-display/actor-display.d.ts +33 -0
- package/dist/src/components/actor-display/actor-display.d.ts.map +1 -0
- package/dist/src/components/actor-display/index.d.ts +2 -0
- package/dist/src/components/actor-display/index.d.ts.map +1 -0
- package/dist/src/components/address-input/address-input.d.ts +42 -0
- package/dist/src/components/address-input/address-input.d.ts.map +1 -0
- package/dist/src/components/address-input/index.d.ts +2 -0
- package/dist/src/components/address-input/index.d.ts.map +1 -0
- package/dist/src/components/array-display/array-display.d.ts +30 -0
- package/dist/src/components/array-display/array-display.d.ts.map +1 -0
- package/dist/src/components/array-display/index.d.ts +2 -0
- package/dist/src/components/array-display/index.d.ts.map +1 -0
- package/dist/src/components/avatar/avatar.d.ts +80 -0
- package/dist/src/components/avatar/avatar.d.ts.map +1 -0
- package/dist/src/components/avatar/index.d.ts +2 -0
- package/dist/src/components/avatar/index.d.ts.map +1 -0
- package/dist/src/components/avatar-group/avatar-group.d.ts +35 -0
- package/dist/src/components/avatar-group/avatar-group.d.ts.map +1 -0
- package/dist/src/components/avatar-group/index.d.ts +2 -0
- package/dist/src/components/avatar-group/index.d.ts.map +1 -0
- package/dist/src/components/button/button.d.ts +4 -4
- package/dist/src/components/chip/chip.d.ts +78 -0
- package/dist/src/components/chip/chip.d.ts.map +1 -0
- package/dist/src/components/chip/index.d.ts +2 -0
- package/dist/src/components/chip/index.d.ts.map +1 -0
- package/dist/src/components/circular-progress-bar/circular-progress-bar.d.ts +35 -0
- package/dist/src/components/circular-progress-bar/circular-progress-bar.d.ts.map +1 -0
- package/dist/src/components/circular-progress-bar/index.d.ts +2 -0
- package/dist/src/components/circular-progress-bar/index.d.ts.map +1 -0
- package/dist/src/components/color-sample/color-sample.d.ts +56 -0
- package/dist/src/components/color-sample/color-sample.d.ts.map +1 -0
- package/dist/src/components/color-sample/index.d.ts +2 -0
- package/dist/src/components/color-sample/index.d.ts.map +1 -0
- package/dist/src/components/data-grid/data-grid.d.ts +25 -0
- package/dist/src/components/data-grid/data-grid.d.ts.map +1 -0
- package/dist/src/components/data-grid/index.d.ts +3 -0
- package/dist/src/components/data-grid/index.d.ts.map +1 -0
- package/dist/src/components/data-grid/types.d.ts +103 -0
- package/dist/src/components/data-grid/types.d.ts.map +1 -0
- package/dist/src/components/data-grid/use-data-grid-edit.d.ts +34 -0
- package/dist/src/components/data-grid/use-data-grid-edit.d.ts.map +1 -0
- package/dist/src/components/double-text-input/double-text-input.d.ts +47 -0
- package/dist/src/components/double-text-input/double-text-input.d.ts.map +1 -0
- package/dist/src/components/double-text-input/index.d.ts +2 -0
- package/dist/src/components/double-text-input/index.d.ts.map +1 -0
- package/dist/src/components/emails-display/emails-display.d.ts +30 -0
- package/dist/src/components/emails-display/emails-display.d.ts.map +1 -0
- package/dist/src/components/emails-display/index.d.ts +2 -0
- package/dist/src/components/emails-display/index.d.ts.map +1 -0
- package/dist/src/components/expandable-list/expandable-list.d.ts +41 -0
- package/dist/src/components/expandable-list/expandable-list.d.ts.map +1 -0
- package/dist/src/components/expandable-list/index.d.ts +2 -0
- package/dist/src/components/expandable-list/index.d.ts.map +1 -0
- package/dist/src/components/json-display/index.d.ts +2 -0
- package/dist/src/components/json-display/index.d.ts.map +1 -0
- package/dist/src/components/json-display/json-display.d.ts +29 -0
- package/dist/src/components/json-display/json-display.d.ts.map +1 -0
- package/dist/src/components/link-chip/index.d.ts +2 -0
- package/dist/src/components/link-chip/index.d.ts.map +1 -0
- package/dist/src/components/link-chip/link-chip.d.ts +50 -0
- package/dist/src/components/link-chip/link-chip.d.ts.map +1 -0
- package/dist/src/components/links-display/index.d.ts +2 -0
- package/dist/src/components/links-display/index.d.ts.map +1 -0
- package/dist/src/components/links-display/links-display.d.ts +37 -0
- package/dist/src/components/links-display/links-display.d.ts.map +1 -0
- package/dist/src/components/menu-item/index.d.ts +2 -0
- package/dist/src/components/menu-item/index.d.ts.map +1 -0
- package/dist/src/components/menu-item/menu-item.d.ts +104 -0
- package/dist/src/components/menu-item/menu-item.d.ts.map +1 -0
- package/dist/src/components/notification-counter/index.d.ts +2 -0
- package/dist/src/components/notification-counter/index.d.ts.map +1 -0
- package/dist/src/components/notification-counter/notification-counter.d.ts +51 -0
- package/dist/src/components/notification-counter/notification-counter.d.ts.map +1 -0
- package/dist/src/components/overflowing-text/index.d.ts +2 -0
- package/dist/src/components/overflowing-text/index.d.ts.map +1 -0
- package/dist/src/components/overflowing-text/overflowing-text.d.ts +48 -0
- package/dist/src/components/overflowing-text/overflowing-text.d.ts.map +1 -0
- package/dist/src/components/phones-display/index.d.ts +2 -0
- package/dist/src/components/phones-display/index.d.ts.map +1 -0
- package/dist/src/components/phones-display/phones-display.d.ts +31 -0
- package/dist/src/components/phones-display/phones-display.d.ts.map +1 -0
- package/dist/src/components/pill/index.d.ts +2 -0
- package/dist/src/components/pill/index.d.ts.map +1 -0
- package/dist/src/components/pill/pill.d.ts +31 -0
- package/dist/src/components/pill/pill.d.ts.map +1 -0
- package/dist/src/components/rating/index.d.ts +2 -0
- package/dist/src/components/rating/index.d.ts.map +1 -0
- package/dist/src/components/rating/rating.d.ts +37 -0
- package/dist/src/components/rating/rating.d.ts.map +1 -0
- package/dist/src/components/record-board/index.d.ts +2 -0
- package/dist/src/components/record-board/index.d.ts.map +1 -0
- package/dist/src/components/record-board/record-board.d.ts +75 -0
- package/dist/src/components/record-board/record-board.d.ts.map +1 -0
- package/dist/src/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/components/status/index.d.ts +2 -0
- package/dist/src/components/status/index.d.ts.map +1 -0
- package/dist/src/components/status/status.d.ts +52 -0
- package/dist/src/components/status/status.d.ts.map +1 -0
- package/dist/src/components/tabs/tabs.d.ts.map +1 -1
- package/dist/src/components/tag/index.d.ts +2 -0
- package/dist/src/components/tag/index.d.ts.map +1 -0
- package/dist/src/components/tag/tag.d.ts +153 -0
- package/dist/src/components/tag/tag.d.ts.map +1 -0
- package/dist/src/components/timeline/index.d.ts +2 -0
- package/dist/src/components/timeline/index.d.ts.map +1 -0
- package/dist/src/components/timeline/timeline.d.ts +155 -0
- package/dist/src/components/timeline/timeline.d.ts.map +1 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/utils/use-is-dark-mode.d.ts +18 -0
- package/dist/src/utils/use-is-dark-mode.d.ts.map +1 -0
- package/dist/styles/reki-standalone.css +1 -1
- package/dist/styles/reki.css +19 -0
- package/dist/styles/theme-fedramp.css +6 -0
- package/dist/styles/theme-reki.css +164 -10
- package/package.json +118 -4
- package/scripts/component-registry/index.ts +6 -11
- package/scripts/extract-demo-examples.ts +323 -0
- package/scripts/generate-stories.ts +205 -0
- package/scripts/theme-generator/config.ts +230 -5
- package/dist/chunks/button-nc5p1h28cwes0tjw.js.map +0 -1
- package/dist/chunks/command-palette-fe5cjfdgsg3t17vq.js.map +0 -1
- package/dist/chunks/sidebar-noz668nhdu2gso12.js.map +0 -1
- package/dist/chunks/tabs-e4pcjkw94kpe35x0.js.map +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* Extract Demo Examples for AI/Agent Consumption
|
|
4
|
+
*
|
|
5
|
+
* This script parses *Demo.tsx files in `src/demos/` and extracts usable code
|
|
6
|
+
* examples for the component registry and the Storybook story generator. Demo
|
|
7
|
+
* files contain clean, production-ready examples suitable for AI consumption.
|
|
8
|
+
*
|
|
9
|
+
* Run: pnpm codegen:demos
|
|
10
|
+
* Output: .cache/demo-metadata.json
|
|
11
|
+
* (consumed by scripts/component-registry and scripts/generate-stories)
|
|
12
|
+
*
|
|
13
|
+
* Demo file naming convention:
|
|
14
|
+
* {Component}Demo.tsx -> exports functions like {Component}{Variant}Demo
|
|
15
|
+
* e.g., ButtonDemo.tsx -> ButtonBasicDemo, ButtonPrimaryDemo, etc.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
readFileSync,
|
|
20
|
+
writeFileSync,
|
|
21
|
+
readdirSync,
|
|
22
|
+
mkdirSync,
|
|
23
|
+
statSync,
|
|
24
|
+
} from "node:fs";
|
|
25
|
+
import { dirname, join, basename, sep } from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
import * as ts from "typescript";
|
|
28
|
+
|
|
29
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
30
|
+
const demosDir = join(__dirname, "../src/demos");
|
|
31
|
+
const outputDir = join(__dirname, "../.cache");
|
|
32
|
+
|
|
33
|
+
// =============================================================================
|
|
34
|
+
// Types
|
|
35
|
+
// =============================================================================
|
|
36
|
+
|
|
37
|
+
interface ExtractedDemo {
|
|
38
|
+
/** Function name (e.g., "ButtonPrimaryDemo") */
|
|
39
|
+
name: string;
|
|
40
|
+
/** The JSX code extracted from the return statement */
|
|
41
|
+
code: string;
|
|
42
|
+
/** Description extracted from JSDoc if present */
|
|
43
|
+
description?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface ComponentDemos {
|
|
47
|
+
/** Component name (e.g., "Button") */
|
|
48
|
+
componentName: string;
|
|
49
|
+
/** Source file name (e.g., "ButtonDemo.tsx") */
|
|
50
|
+
sourceFile: string;
|
|
51
|
+
/**
|
|
52
|
+
* Path relative to src/demos without extension, posix-style
|
|
53
|
+
* (e.g. "ButtonDemo" or "Chart/ChartDemo"). Used by the story generator to
|
|
54
|
+
* resolve the demo module import.
|
|
55
|
+
*/
|
|
56
|
+
relativePath: string;
|
|
57
|
+
/** Extracted demo examples */
|
|
58
|
+
demos: ExtractedDemo[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface DemoMetadata {
|
|
62
|
+
/** ISO timestamp of generation */
|
|
63
|
+
generatedAt: string;
|
|
64
|
+
/** Version for cache invalidation */
|
|
65
|
+
version: string;
|
|
66
|
+
/** Map of component name to its demos */
|
|
67
|
+
components: Record<string, ComponentDemos>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// AST Helpers
|
|
72
|
+
// =============================================================================
|
|
73
|
+
|
|
74
|
+
function getNodeText(node: ts.Node, sourceFile: ts.SourceFile): string {
|
|
75
|
+
return node.getText(sourceFile);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Extract JSDoc description from a function declaration
|
|
80
|
+
*/
|
|
81
|
+
function extractJSDocDescription(
|
|
82
|
+
node: ts.FunctionDeclaration,
|
|
83
|
+
sourceFile: ts.SourceFile,
|
|
84
|
+
): string | undefined {
|
|
85
|
+
const fullText = sourceFile.getFullText();
|
|
86
|
+
const nodeStart = node.getFullStart();
|
|
87
|
+
|
|
88
|
+
// Look for JSDoc comment before the function
|
|
89
|
+
const textBefore = fullText.slice(0, nodeStart);
|
|
90
|
+
const jsdocMatch = textBefore.match(/\/\*\*\s*\n([^]*?)\*\/\s*$/);
|
|
91
|
+
|
|
92
|
+
if (jsdocMatch) {
|
|
93
|
+
const jsdocContent = jsdocMatch[1];
|
|
94
|
+
const lines = jsdocContent
|
|
95
|
+
.split("\n")
|
|
96
|
+
.map((line) => line.replace(/^\s*\*\s?/, "").trim())
|
|
97
|
+
.filter((line) => line.length > 0 && !line.startsWith("@"));
|
|
98
|
+
|
|
99
|
+
if (lines.length > 0) {
|
|
100
|
+
return lines.join(" ");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Clean up extracted JSX code for readability
|
|
109
|
+
*/
|
|
110
|
+
function cleanupJSX(jsx: string): string {
|
|
111
|
+
jsx = jsx.trim();
|
|
112
|
+
|
|
113
|
+
// Remove wrapping parentheses (common in return statements)
|
|
114
|
+
if (jsx.startsWith("(") && jsx.endsWith(")")) {
|
|
115
|
+
jsx = jsx.slice(1, -1).trim();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return jsx;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Extract the return JSX from a function body
|
|
123
|
+
*/
|
|
124
|
+
function extractReturnJSX(
|
|
125
|
+
body: ts.Block,
|
|
126
|
+
sourceFile: ts.SourceFile,
|
|
127
|
+
): string | null {
|
|
128
|
+
let returnJSX: string | null = null;
|
|
129
|
+
|
|
130
|
+
ts.forEachChild(body, (child) => {
|
|
131
|
+
if (ts.isReturnStatement(child) && child.expression) {
|
|
132
|
+
returnJSX = cleanupJSX(getNodeText(child.expression, sourceFile));
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return returnJSX;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Extract the return JSX from an arrow function
|
|
141
|
+
*/
|
|
142
|
+
function extractArrowFunctionJSX(
|
|
143
|
+
node: ts.ArrowFunction,
|
|
144
|
+
sourceFile: ts.SourceFile,
|
|
145
|
+
): string | null {
|
|
146
|
+
// Block body: () => { return <JSX /> }
|
|
147
|
+
if (ts.isBlock(node.body)) {
|
|
148
|
+
return extractReturnJSX(node.body, sourceFile);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Expression body: () => <JSX />
|
|
152
|
+
return cleanupJSX(getNodeText(node.body, sourceFile));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// =============================================================================
|
|
156
|
+
// Demo File Parser
|
|
157
|
+
// =============================================================================
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Parse a demo file and extract all exported demo functions
|
|
161
|
+
*/
|
|
162
|
+
function parseDemoFile(filePath: string): ComponentDemos | null {
|
|
163
|
+
const relativePath = filePath
|
|
164
|
+
.slice(demosDir.length + 1)
|
|
165
|
+
.replace(/\.tsx$/, "")
|
|
166
|
+
.split(sep)
|
|
167
|
+
.join("/");
|
|
168
|
+
const content = readFileSync(filePath, "utf-8");
|
|
169
|
+
const sourceFile = ts.createSourceFile(
|
|
170
|
+
filePath,
|
|
171
|
+
content,
|
|
172
|
+
ts.ScriptTarget.Latest,
|
|
173
|
+
true,
|
|
174
|
+
ts.ScriptKind.TSX,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
// Extract component name from file path (e.g., ButtonDemo.tsx -> Button)
|
|
178
|
+
const fileName = basename(filePath, ".tsx");
|
|
179
|
+
const componentMatch = fileName.match(/^(.+)Demo$/);
|
|
180
|
+
if (!componentMatch) {
|
|
181
|
+
console.warn(`Skipping ${fileName}: doesn't match *Demo.tsx pattern`);
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const componentName = componentMatch[1];
|
|
186
|
+
const demos: ExtractedDemo[] = [];
|
|
187
|
+
|
|
188
|
+
// Find all exported function declarations
|
|
189
|
+
ts.forEachChild(sourceFile, (node) => {
|
|
190
|
+
// Handle: export function FooDemo() { ... }
|
|
191
|
+
if (
|
|
192
|
+
ts.isFunctionDeclaration(node) &&
|
|
193
|
+
node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) &&
|
|
194
|
+
node.name &&
|
|
195
|
+
node.body
|
|
196
|
+
) {
|
|
197
|
+
const funcName = node.name.text;
|
|
198
|
+
|
|
199
|
+
// Only include functions that end with "Demo"
|
|
200
|
+
if (!funcName.endsWith("Demo")) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const jsx = extractReturnJSX(node.body, sourceFile);
|
|
205
|
+
if (jsx) {
|
|
206
|
+
demos.push({
|
|
207
|
+
name: funcName,
|
|
208
|
+
code: jsx,
|
|
209
|
+
description: extractJSDocDescription(node, sourceFile),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Handle: export const FooDemo = () => { ... }
|
|
215
|
+
if (
|
|
216
|
+
ts.isVariableStatement(node) &&
|
|
217
|
+
node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)
|
|
218
|
+
) {
|
|
219
|
+
for (const decl of node.declarationList.declarations) {
|
|
220
|
+
if (
|
|
221
|
+
ts.isIdentifier(decl.name) &&
|
|
222
|
+
decl.initializer &&
|
|
223
|
+
ts.isArrowFunction(decl.initializer)
|
|
224
|
+
) {
|
|
225
|
+
const funcName = decl.name.text;
|
|
226
|
+
|
|
227
|
+
// Only include functions that end with "Demo"
|
|
228
|
+
if (!funcName.endsWith("Demo")) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const jsx = extractArrowFunctionJSX(decl.initializer, sourceFile);
|
|
233
|
+
if (jsx) {
|
|
234
|
+
demos.push({
|
|
235
|
+
name: funcName,
|
|
236
|
+
code: jsx,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
if (demos.length === 0) {
|
|
245
|
+
console.warn(`No demos found in ${fileName}`);
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
componentName,
|
|
251
|
+
sourceFile: basename(filePath),
|
|
252
|
+
relativePath,
|
|
253
|
+
demos,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// =============================================================================
|
|
258
|
+
// Main
|
|
259
|
+
// =============================================================================
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Recursively find all *Demo.tsx files in a directory
|
|
263
|
+
*/
|
|
264
|
+
function findDemoFiles(dir: string, baseDir: string = dir): string[] {
|
|
265
|
+
const entries = readdirSync(dir);
|
|
266
|
+
const files: string[] = [];
|
|
267
|
+
|
|
268
|
+
for (const entry of entries) {
|
|
269
|
+
if (entry.startsWith("_")) continue;
|
|
270
|
+
|
|
271
|
+
const fullPath = join(dir, entry);
|
|
272
|
+
const stat = statSync(fullPath);
|
|
273
|
+
|
|
274
|
+
if (stat.isDirectory()) {
|
|
275
|
+
files.push(...findDemoFiles(fullPath, baseDir));
|
|
276
|
+
} else if (entry.endsWith("Demo.tsx")) {
|
|
277
|
+
files.push(fullPath);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return files;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function main() {
|
|
285
|
+
console.log("Extracting demo examples from src/demos...\n");
|
|
286
|
+
|
|
287
|
+
// Find all demo files recursively
|
|
288
|
+
const files = findDemoFiles(demosDir);
|
|
289
|
+
|
|
290
|
+
console.log(`Found ${files.length} demo files\n`);
|
|
291
|
+
|
|
292
|
+
const metadata: DemoMetadata = {
|
|
293
|
+
generatedAt: new Date().toISOString(),
|
|
294
|
+
version: "1.0.0",
|
|
295
|
+
components: {},
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
let totalDemos = 0;
|
|
299
|
+
|
|
300
|
+
for (const filePath of files) {
|
|
301
|
+
const result = parseDemoFile(filePath);
|
|
302
|
+
|
|
303
|
+
if (result) {
|
|
304
|
+
metadata.components[result.componentName] = result;
|
|
305
|
+
totalDemos += result.demos.length;
|
|
306
|
+
console.log(
|
|
307
|
+
` ${result.componentName}: ${result.demos.length} demos extracted`,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Ensure output directory exists
|
|
313
|
+
mkdirSync(outputDir, { recursive: true });
|
|
314
|
+
|
|
315
|
+
// Write metadata file
|
|
316
|
+
const outputPath = join(outputDir, "demo-metadata.json");
|
|
317
|
+
writeFileSync(outputPath, JSON.stringify(metadata, null, 2));
|
|
318
|
+
|
|
319
|
+
console.log(`\n✓ Extracted ${totalDemos} demos from ${files.length} files`);
|
|
320
|
+
console.log(`✓ Wrote ${outputPath}`);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
main();
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env npx tsx
|
|
2
|
+
/**
|
|
3
|
+
* Generate Storybook stories from demo metadata.
|
|
4
|
+
*
|
|
5
|
+
* Reads `.cache/demo-metadata.json` (produced by `extract-demo-examples.ts`)
|
|
6
|
+
* and emits one colocated `<name>.stories.tsx` next to every demo file under
|
|
7
|
+
* `src/demos/`. Each exported `*Demo` function becomes a single story that
|
|
8
|
+
* renders the demo. Demos remain the single source of truth — never edit the
|
|
9
|
+
* generated stories by hand; edit the demo and re-run `pnpm codegen:stories`.
|
|
10
|
+
*
|
|
11
|
+
* Run: pnpm codegen:stories
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
readFileSync,
|
|
16
|
+
writeFileSync,
|
|
17
|
+
existsSync,
|
|
18
|
+
readdirSync,
|
|
19
|
+
unlinkSync,
|
|
20
|
+
} from "node:fs";
|
|
21
|
+
import { dirname, join, basename } from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
23
|
+
|
|
24
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const demosDir = join(__dirname, "../src/demos");
|
|
26
|
+
const indexPath = join(__dirname, "../src/index.ts");
|
|
27
|
+
const metadataPath = join(__dirname, "../.cache/demo-metadata.json");
|
|
28
|
+
|
|
29
|
+
interface ExtractedDemo {
|
|
30
|
+
name: string;
|
|
31
|
+
code: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
}
|
|
34
|
+
interface ComponentDemos {
|
|
35
|
+
componentName: string;
|
|
36
|
+
sourceFile: string;
|
|
37
|
+
relativePath: string;
|
|
38
|
+
demos: ExtractedDemo[];
|
|
39
|
+
}
|
|
40
|
+
interface DemoMetadata {
|
|
41
|
+
generatedAt: string;
|
|
42
|
+
version: string;
|
|
43
|
+
components: Record<string, ComponentDemos>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Collect the value (non-type) identifiers re-exported from the package
|
|
48
|
+
* barrel, so we only wire `component` + autodocs prop tables for demos whose
|
|
49
|
+
* component is actually exported.
|
|
50
|
+
*/
|
|
51
|
+
function loadExportedSymbols(): Set<string> {
|
|
52
|
+
const src = readFileSync(indexPath, "utf-8");
|
|
53
|
+
const symbols = new Set<string>();
|
|
54
|
+
const blockRe = /export\s*\{([^}]*)\}/g;
|
|
55
|
+
let m: RegExpExecArray | null;
|
|
56
|
+
while ((m = blockRe.exec(src))) {
|
|
57
|
+
for (const raw of m[1].split(",")) {
|
|
58
|
+
const part = raw.trim();
|
|
59
|
+
if (!part || part.startsWith("type ")) continue;
|
|
60
|
+
// Handle `Foo as Bar` -> exported name is the alias.
|
|
61
|
+
const name = part.includes(" as ")
|
|
62
|
+
? part.split(" as ")[1].trim()
|
|
63
|
+
: part;
|
|
64
|
+
if (/^[A-Za-z_$][\w$]*$/.test(name)) symbols.add(name);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return symbols;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Components exported as a compound "parts" namespace (e.g. `Toast.Provider`,
|
|
72
|
+
* `Toast.Root`) rather than a single renderable component. `satisfies
|
|
73
|
+
* Meta<typeof X>` rejects these, so we generate them render-only (no autodocs
|
|
74
|
+
* `component`, hence no prop table).
|
|
75
|
+
*/
|
|
76
|
+
const COMPOUND_NAMESPACE_EXPORTS = new Set<string>([
|
|
77
|
+
"Toast",
|
|
78
|
+
"CommandPalette",
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
/** Turn a demo function name into a readable, unique story label/identifier. */
|
|
82
|
+
function storyLabel(demoName: string, componentName: string): string {
|
|
83
|
+
let base = demoName.replace(/Demo$/, "");
|
|
84
|
+
if (base.startsWith(componentName)) base = base.slice(componentName.length);
|
|
85
|
+
if (!base) base = "Default";
|
|
86
|
+
return base;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Split a PascalCase identifier into spaced words for the sidebar name. */
|
|
90
|
+
function humanize(label: string): string {
|
|
91
|
+
return (
|
|
92
|
+
label
|
|
93
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
94
|
+
.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2")
|
|
95
|
+
.trim() || label
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function escapeForTemplate(text: string): string {
|
|
100
|
+
return text.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function generateStoryFile(
|
|
104
|
+
comp: ComponentDemos,
|
|
105
|
+
exported: Set<string>,
|
|
106
|
+
): string {
|
|
107
|
+
const { componentName, relativePath, demos } = comp;
|
|
108
|
+
const demoModule = `./${basename(relativePath)}`;
|
|
109
|
+
const hasComponent =
|
|
110
|
+
exported.has(componentName) &&
|
|
111
|
+
!COMPOUND_NAMESPACE_EXPORTS.has(componentName);
|
|
112
|
+
|
|
113
|
+
const lines: string[] = [];
|
|
114
|
+
lines.push(
|
|
115
|
+
"// AUTO-GENERATED by scripts/generate-stories.ts — do not edit.",
|
|
116
|
+
`// Source of truth: src/demos/${relativePath}.tsx`,
|
|
117
|
+
"// Edit the demo, then run \`pnpm codegen:stories\`.",
|
|
118
|
+
'import type { Meta, StoryObj } from "@storybook/react-vite";',
|
|
119
|
+
`import * as demos from "${demoModule}";`,
|
|
120
|
+
);
|
|
121
|
+
if (hasComponent) {
|
|
122
|
+
lines.push(`import { ${componentName} } from "@cloudraker/reki";`);
|
|
123
|
+
}
|
|
124
|
+
lines.push("");
|
|
125
|
+
|
|
126
|
+
// Explicit `: Meta` annotation (not `satisfies Meta<typeof X>`): keeps the
|
|
127
|
+
// exported `meta` type portable so compound components with attached
|
|
128
|
+
// subcomponents (e.g. `Autocomplete.Item`) don't leak private names into the
|
|
129
|
+
// emitted declarations, while still wiring `component` for autodocs.
|
|
130
|
+
lines.push("const meta: Meta = {", ` title: "Components/${componentName}",`);
|
|
131
|
+
if (hasComponent) lines.push(` component: ${componentName},`);
|
|
132
|
+
lines.push(' tags: ["autodocs"],', "};");
|
|
133
|
+
// Plain `StoryObj` (not bound to `typeof meta`) so render-only stories don't
|
|
134
|
+
// trip the "args required" rule for components with required props.
|
|
135
|
+
lines.push("", "export default meta;", "type Story = StoryObj;", "");
|
|
136
|
+
|
|
137
|
+
const usedIdents = new Set<string>();
|
|
138
|
+
for (const demo of demos) {
|
|
139
|
+
let ident = storyLabel(demo.name, componentName);
|
|
140
|
+
// Ensure a valid, unique export identifier.
|
|
141
|
+
if (!/^[A-Za-z_$]/.test(ident)) ident = `Story${ident}`;
|
|
142
|
+
let unique = ident;
|
|
143
|
+
let n = 2;
|
|
144
|
+
while (usedIdents.has(unique)) unique = `${ident}${n++}`;
|
|
145
|
+
usedIdents.add(unique);
|
|
146
|
+
|
|
147
|
+
const name = humanize(storyLabel(demo.name, componentName));
|
|
148
|
+
lines.push(`export const ${unique}: Story = {`);
|
|
149
|
+
lines.push(` name: "${escapeForTemplate(name)}",`);
|
|
150
|
+
lines.push(` render: () => <demos.${demo.name} />,`);
|
|
151
|
+
if (demo.description) {
|
|
152
|
+
lines.push(" parameters: {");
|
|
153
|
+
lines.push(" docs: {");
|
|
154
|
+
lines.push(
|
|
155
|
+
` description: { story: "${escapeForTemplate(demo.description)}" },`,
|
|
156
|
+
);
|
|
157
|
+
lines.push(" },");
|
|
158
|
+
lines.push(" },");
|
|
159
|
+
}
|
|
160
|
+
lines.push("};", "");
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return lines.join("\n");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Remove previously generated story files so deletions/renames don't linger. */
|
|
167
|
+
function cleanExistingStories(dir: string): void {
|
|
168
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
169
|
+
const full = join(dir, entry.name);
|
|
170
|
+
if (entry.isDirectory()) {
|
|
171
|
+
cleanExistingStories(full);
|
|
172
|
+
} else if (entry.name.endsWith(".stories.tsx")) {
|
|
173
|
+
unlinkSync(full);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function main() {
|
|
179
|
+
if (!existsSync(metadataPath)) {
|
|
180
|
+
console.error(
|
|
181
|
+
`demo-metadata.json not found at ${metadataPath}. Run 'pnpm codegen:demos' first.`,
|
|
182
|
+
);
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const metadata: DemoMetadata = JSON.parse(readFileSync(metadataPath, "utf-8"));
|
|
187
|
+
const exported = loadExportedSymbols();
|
|
188
|
+
|
|
189
|
+
cleanExistingStories(demosDir);
|
|
190
|
+
|
|
191
|
+
let count = 0;
|
|
192
|
+
let withComponent = 0;
|
|
193
|
+
for (const comp of Object.values(metadata.components)) {
|
|
194
|
+
const outPath = join(demosDir, `${comp.relativePath}.stories.tsx`);
|
|
195
|
+
writeFileSync(outPath, generateStoryFile(comp, exported));
|
|
196
|
+
count++;
|
|
197
|
+
if (exported.has(comp.componentName)) withComponent++;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
console.log(
|
|
201
|
+
`✓ Generated ${count} story files (${withComponent} with autodocs component, ${count - withComponent} render-only).`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
main();
|