gladvn 0.2.14
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 +112 -0
- package/bin/cli.js +326 -0
- package/dist/components/macro/accordion-preset.d.ts +14 -0
- package/dist/components/macro/accordion-preset.d.ts.map +1 -0
- package/dist/components/macro/alert-dialog-preset.d.ts +26 -0
- package/dist/components/macro/alert-dialog-preset.d.ts.map +1 -0
- package/dist/components/macro/alert-preset.d.ts +14 -0
- package/dist/components/macro/alert-preset.d.ts.map +1 -0
- package/dist/components/macro/avatar-preset.d.ts +11 -0
- package/dist/components/macro/avatar-preset.d.ts.map +1 -0
- package/dist/components/macro/breadcrumb-preset.d.ts +12 -0
- package/dist/components/macro/breadcrumb-preset.d.ts.map +1 -0
- package/dist/components/macro/card-preset.d.ts +10 -0
- package/dist/components/macro/card-preset.d.ts.map +1 -0
- package/dist/components/macro/carousel-preset.d.ts +18 -0
- package/dist/components/macro/carousel-preset.d.ts.map +1 -0
- package/dist/components/macro/checkbox-preset.d.ts +14 -0
- package/dist/components/macro/checkbox-preset.d.ts.map +1 -0
- package/dist/components/macro/combobox-preset.d.ts +27 -0
- package/dist/components/macro/combobox-preset.d.ts.map +1 -0
- package/dist/components/macro/command-preset.d.ts +16 -0
- package/dist/components/macro/command-preset.d.ts.map +1 -0
- package/dist/components/macro/date-picker.d.ts +62 -0
- package/dist/components/macro/date-picker.d.ts.map +1 -0
- package/dist/components/macro/dialog-preset.d.ts +24 -0
- package/dist/components/macro/dialog-preset.d.ts.map +1 -0
- package/dist/components/macro/empty-preset.d.ts +15 -0
- package/dist/components/macro/empty-preset.d.ts.map +1 -0
- package/dist/components/macro/field-preset.d.ts +15 -0
- package/dist/components/macro/field-preset.d.ts.map +1 -0
- package/dist/components/macro/index.d.ts +22 -0
- package/dist/components/macro/index.d.ts.map +1 -0
- package/dist/components/macro/input-otp-preset.d.ts +13 -0
- package/dist/components/macro/input-otp-preset.d.ts.map +1 -0
- package/dist/components/macro/input-preset.d.ts +21 -0
- package/dist/components/macro/input-preset.d.ts.map +1 -0
- package/dist/components/macro/pagination-preset.d.ts +13 -0
- package/dist/components/macro/pagination-preset.d.ts.map +1 -0
- package/dist/components/macro/progress-preset.d.ts +10 -0
- package/dist/components/macro/progress-preset.d.ts.map +1 -0
- package/dist/components/macro/radio-group-preset.d.ts +22 -0
- package/dist/components/macro/radio-group-preset.d.ts.map +1 -0
- package/dist/components/macro/select-preset.d.ts +42 -0
- package/dist/components/macro/select-preset.d.ts.map +1 -0
- package/dist/components/macro/slider-preset.d.ts +12 -0
- package/dist/components/macro/slider-preset.d.ts.map +1 -0
- package/dist/components/macro/switch-preset.d.ts +12 -0
- package/dist/components/macro/switch-preset.d.ts.map +1 -0
- package/dist/components/macro/tabs-preset.d.ts +17 -0
- package/dist/components/macro/tabs-preset.d.ts.map +1 -0
- package/dist/components/macro/textarea-preset.d.ts +17 -0
- package/dist/components/macro/textarea-preset.d.ts.map +1 -0
- package/dist/components/micro/accordion.d.ts +8 -0
- package/dist/components/micro/accordion.d.ts.map +1 -0
- package/dist/components/micro/alert-dialog.d.ts +33 -0
- package/dist/components/micro/alert-dialog.d.ts.map +1 -0
- package/dist/components/micro/alert.d.ts +28 -0
- package/dist/components/micro/alert.d.ts.map +1 -0
- package/dist/components/micro/aspect-ratio.d.ts +13 -0
- package/dist/components/micro/aspect-ratio.d.ts.map +1 -0
- package/dist/components/micro/avatar.d.ts +23 -0
- package/dist/components/micro/avatar.d.ts.map +1 -0
- package/dist/components/micro/badge.d.ts +16 -0
- package/dist/components/micro/badge.d.ts.map +1 -0
- package/dist/components/micro/breadcrumb.d.ts +24 -0
- package/dist/components/micro/breadcrumb.d.ts.map +1 -0
- package/dist/components/micro/button.d.ts +39 -0
- package/dist/components/micro/button.d.ts.map +1 -0
- package/dist/components/micro/calendar.d.ts +28 -0
- package/dist/components/micro/calendar.d.ts.map +1 -0
- package/dist/components/micro/card.d.ts +28 -0
- package/dist/components/micro/card.d.ts.map +1 -0
- package/dist/components/micro/carousel.d.ts +29 -0
- package/dist/components/micro/carousel.d.ts.map +1 -0
- package/dist/components/micro/chart.d.ts +49 -0
- package/dist/components/micro/chart.d.ts.map +1 -0
- package/dist/components/micro/checkbox.d.ts +17 -0
- package/dist/components/micro/checkbox.d.ts.map +1 -0
- package/dist/components/micro/collapsible.d.ts +15 -0
- package/dist/components/micro/collapsible.d.ts.map +1 -0
- package/dist/components/micro/combobox.d.ts +33 -0
- package/dist/components/micro/combobox.d.ts.map +1 -0
- package/dist/components/micro/command.d.ts +79 -0
- package/dist/components/micro/command.d.ts.map +1 -0
- package/dist/components/micro/context-menu.d.ts +60 -0
- package/dist/components/micro/context-menu.d.ts.map +1 -0
- package/dist/components/micro/dialog.d.ts +14 -0
- package/dist/components/micro/dialog.d.ts.map +1 -0
- package/dist/components/micro/direction.d.ts +2 -0
- package/dist/components/micro/direction.d.ts.map +1 -0
- package/dist/components/micro/drawer.d.ts +17 -0
- package/dist/components/micro/drawer.d.ts.map +1 -0
- package/dist/components/micro/dropdown-menu.d.ts +37 -0
- package/dist/components/micro/dropdown-menu.d.ts.map +1 -0
- package/dist/components/micro/empty.d.ts +23 -0
- package/dist/components/micro/empty.d.ts.map +1 -0
- package/dist/components/micro/field.d.ts +29 -0
- package/dist/components/micro/field.d.ts.map +1 -0
- package/dist/components/micro/hover-card.d.ts +17 -0
- package/dist/components/micro/hover-card.d.ts.map +1 -0
- package/dist/components/micro/input-group.d.ts +17 -0
- package/dist/components/micro/input-group.d.ts.map +1 -0
- package/dist/components/micro/input-otp.d.ts +44 -0
- package/dist/components/micro/input-otp.d.ts.map +1 -0
- package/dist/components/micro/input.d.ts +22 -0
- package/dist/components/micro/input.d.ts.map +1 -0
- package/dist/components/micro/item.d.ts +31 -0
- package/dist/components/micro/item.d.ts.map +1 -0
- package/dist/components/micro/kbd.d.ts +9 -0
- package/dist/components/micro/kbd.d.ts.map +1 -0
- package/dist/components/micro/label.d.ts +15 -0
- package/dist/components/micro/label.d.ts.map +1 -0
- package/dist/components/micro/menubar.d.ts +41 -0
- package/dist/components/micro/menubar.d.ts.map +1 -0
- package/dist/components/micro/navigation-menu.d.ts +18 -0
- package/dist/components/micro/navigation-menu.d.ts.map +1 -0
- package/dist/components/micro/pagination.d.ts +33 -0
- package/dist/components/micro/pagination.d.ts.map +1 -0
- package/dist/components/micro/popover.d.ts +23 -0
- package/dist/components/micro/popover.d.ts.map +1 -0
- package/dist/components/micro/progress.d.ts +19 -0
- package/dist/components/micro/progress.d.ts.map +1 -0
- package/dist/components/micro/radio-group.d.ts +13 -0
- package/dist/components/micro/radio-group.d.ts.map +1 -0
- package/dist/components/micro/resizable.d.ts +12 -0
- package/dist/components/micro/resizable.d.ts.map +1 -0
- package/dist/components/micro/scroll-area.d.ts +12 -0
- package/dist/components/micro/scroll-area.d.ts.map +1 -0
- package/dist/components/micro/select.d.ts +21 -0
- package/dist/components/micro/select.d.ts.map +1 -0
- package/dist/components/micro/separator.d.ts +9 -0
- package/dist/components/micro/separator.d.ts.map +1 -0
- package/dist/components/micro/sheet.d.ts +17 -0
- package/dist/components/micro/sheet.d.ts.map +1 -0
- package/dist/components/micro/sidebar.d.ts +28 -0
- package/dist/components/micro/sidebar.d.ts.map +1 -0
- package/dist/components/micro/skeleton.d.ts +9 -0
- package/dist/components/micro/skeleton.d.ts.map +1 -0
- package/dist/components/micro/slider.d.ts +14 -0
- package/dist/components/micro/slider.d.ts.map +1 -0
- package/dist/components/micro/sonner.d.ts +5 -0
- package/dist/components/micro/sonner.d.ts.map +1 -0
- package/dist/components/micro/spinner.d.ts +21 -0
- package/dist/components/micro/spinner.d.ts.map +1 -0
- package/dist/components/micro/switch.d.ts +13 -0
- package/dist/components/micro/switch.d.ts.map +1 -0
- package/dist/components/micro/table.d.ts +17 -0
- package/dist/components/micro/table.d.ts.map +1 -0
- package/dist/components/micro/tabs.d.ts +13 -0
- package/dist/components/micro/tabs.d.ts.map +1 -0
- package/dist/components/micro/textarea.d.ts +17 -0
- package/dist/components/micro/textarea.d.ts.map +1 -0
- package/dist/components/micro/theme-provider.d.ts +76 -0
- package/dist/components/micro/theme-provider.d.ts.map +1 -0
- package/dist/components/micro/toggle-group.d.ts +22 -0
- package/dist/components/micro/toggle-group.d.ts.map +1 -0
- package/dist/components/micro/toggle.d.ts +16 -0
- package/dist/components/micro/toggle.d.ts.map +1 -0
- package/dist/components/micro/tooltip.d.ts +20 -0
- package/dist/components/micro/tooltip.d.ts.map +1 -0
- package/dist/dev/App.d.ts +3 -0
- package/dist/dev/App.d.ts.map +1 -0
- package/dist/dev/components/GladcnLogo.d.ts +10 -0
- package/dist/dev/components/GladcnLogo.d.ts.map +1 -0
- package/dist/dev/components/code-highlighter.d.ts +5 -0
- package/dist/dev/components/code-highlighter.d.ts.map +1 -0
- package/dist/dev/components/dev-context.d.ts +12 -0
- package/dist/dev/components/dev-context.d.ts.map +1 -0
- package/dist/dev/components/showcase.d.ts +72 -0
- package/dist/dev/components/showcase.d.ts.map +1 -0
- package/dist/dev/data.d.ts +68 -0
- package/dist/dev/data.d.ts.map +1 -0
- package/dist/dev/main.d.ts +1 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/dev/sections/buttons.d.ts +2 -0
- package/dist/dev/sections/buttons.d.ts.map +1 -0
- package/dist/dev/sections/display.d.ts +2 -0
- package/dist/dev/sections/display.d.ts.map +1 -0
- package/dist/dev/sections/feedback.d.ts +2 -0
- package/dist/dev/sections/feedback.d.ts.map +1 -0
- package/dist/dev/sections/forms.d.ts +2 -0
- package/dist/dev/sections/forms.d.ts.map +1 -0
- package/dist/dev/sections/interactive.d.ts +2 -0
- package/dist/dev/sections/interactive.d.ts.map +1 -0
- package/dist/dev/sections/overview.d.ts +2 -0
- package/dist/dev/sections/overview.d.ts.map +1 -0
- package/dist/dev/showcase/accordion.d.ts +2 -0
- package/dist/dev/showcase/accordion.d.ts.map +1 -0
- package/dist/dev/showcase/alert-dialog.d.ts +2 -0
- package/dist/dev/showcase/alert-dialog.d.ts.map +1 -0
- package/dist/dev/showcase/alert.d.ts +2 -0
- package/dist/dev/showcase/alert.d.ts.map +1 -0
- package/dist/dev/showcase/aspect-ratio.d.ts +2 -0
- package/dist/dev/showcase/aspect-ratio.d.ts.map +1 -0
- package/dist/dev/showcase/avatar.d.ts +2 -0
- package/dist/dev/showcase/avatar.d.ts.map +1 -0
- package/dist/dev/showcase/badge.d.ts +2 -0
- package/dist/dev/showcase/badge.d.ts.map +1 -0
- package/dist/dev/showcase/breadcrumb.d.ts +2 -0
- package/dist/dev/showcase/breadcrumb.d.ts.map +1 -0
- package/dist/dev/showcase/button.d.ts +2 -0
- package/dist/dev/showcase/button.d.ts.map +1 -0
- package/dist/dev/showcase/calendar.d.ts +2 -0
- package/dist/dev/showcase/calendar.d.ts.map +1 -0
- package/dist/dev/showcase/card.d.ts +2 -0
- package/dist/dev/showcase/card.d.ts.map +1 -0
- package/dist/dev/showcase/carousel.d.ts +2 -0
- package/dist/dev/showcase/carousel.d.ts.map +1 -0
- package/dist/dev/showcase/chart.d.ts +2 -0
- package/dist/dev/showcase/chart.d.ts.map +1 -0
- package/dist/dev/showcase/checkbox.d.ts +2 -0
- package/dist/dev/showcase/checkbox.d.ts.map +1 -0
- package/dist/dev/showcase/collapsible.d.ts +3 -0
- package/dist/dev/showcase/collapsible.d.ts.map +1 -0
- package/dist/dev/showcase/combobox.d.ts +2 -0
- package/dist/dev/showcase/combobox.d.ts.map +1 -0
- package/dist/dev/showcase/command.d.ts +2 -0
- package/dist/dev/showcase/command.d.ts.map +1 -0
- package/dist/dev/showcase/context-menu.d.ts +2 -0
- package/dist/dev/showcase/context-menu.d.ts.map +1 -0
- package/dist/dev/showcase/dialog.d.ts +2 -0
- package/dist/dev/showcase/dialog.d.ts.map +1 -0
- package/dist/dev/showcase/drawer.d.ts +2 -0
- package/dist/dev/showcase/drawer.d.ts.map +1 -0
- package/dist/dev/showcase/dropdown-menu.d.ts +2 -0
- package/dist/dev/showcase/dropdown-menu.d.ts.map +1 -0
- package/dist/dev/showcase/empty.d.ts +2 -0
- package/dist/dev/showcase/empty.d.ts.map +1 -0
- package/dist/dev/showcase/hover-card.d.ts +2 -0
- package/dist/dev/showcase/hover-card.d.ts.map +1 -0
- package/dist/dev/showcase/input-group.d.ts +2 -0
- package/dist/dev/showcase/input-group.d.ts.map +1 -0
- package/dist/dev/showcase/input-otp.d.ts +2 -0
- package/dist/dev/showcase/input-otp.d.ts.map +1 -0
- package/dist/dev/showcase/input.d.ts +2 -0
- package/dist/dev/showcase/input.d.ts.map +1 -0
- package/dist/dev/showcase/item.d.ts +2 -0
- package/dist/dev/showcase/item.d.ts.map +1 -0
- package/dist/dev/showcase/kbd.d.ts +2 -0
- package/dist/dev/showcase/kbd.d.ts.map +1 -0
- package/dist/dev/showcase/label.d.ts +2 -0
- package/dist/dev/showcase/label.d.ts.map +1 -0
- package/dist/dev/showcase/menubar.d.ts +2 -0
- package/dist/dev/showcase/menubar.d.ts.map +1 -0
- package/dist/dev/showcase/navigation-menu.d.ts +3 -0
- package/dist/dev/showcase/navigation-menu.d.ts.map +1 -0
- package/dist/dev/showcase/overview.d.ts +2 -0
- package/dist/dev/showcase/overview.d.ts.map +1 -0
- package/dist/dev/showcase/pagination.d.ts +2 -0
- package/dist/dev/showcase/pagination.d.ts.map +1 -0
- package/dist/dev/showcase/popover.d.ts +2 -0
- package/dist/dev/showcase/popover.d.ts.map +1 -0
- package/dist/dev/showcase/progress.d.ts +2 -0
- package/dist/dev/showcase/progress.d.ts.map +1 -0
- package/dist/dev/showcase/radio-group.d.ts +2 -0
- package/dist/dev/showcase/radio-group.d.ts.map +1 -0
- package/dist/dev/showcase/resizable.d.ts +2 -0
- package/dist/dev/showcase/resizable.d.ts.map +1 -0
- package/dist/dev/showcase/scroll-area.d.ts +2 -0
- package/dist/dev/showcase/scroll-area.d.ts.map +1 -0
- package/dist/dev/showcase/select.d.ts +2 -0
- package/dist/dev/showcase/select.d.ts.map +1 -0
- package/dist/dev/showcase/separator.d.ts +2 -0
- package/dist/dev/showcase/separator.d.ts.map +1 -0
- package/dist/dev/showcase/sheet.d.ts +2 -0
- package/dist/dev/showcase/sheet.d.ts.map +1 -0
- package/dist/dev/showcase/sidebar.d.ts +2 -0
- package/dist/dev/showcase/sidebar.d.ts.map +1 -0
- package/dist/dev/showcase/skeleton.d.ts +2 -0
- package/dist/dev/showcase/skeleton.d.ts.map +1 -0
- package/dist/dev/showcase/slider.d.ts +2 -0
- package/dist/dev/showcase/slider.d.ts.map +1 -0
- package/dist/dev/showcase/sonner.d.ts +2 -0
- package/dist/dev/showcase/sonner.d.ts.map +1 -0
- package/dist/dev/showcase/spinner.d.ts +2 -0
- package/dist/dev/showcase/spinner.d.ts.map +1 -0
- package/dist/dev/showcase/switch.d.ts +2 -0
- package/dist/dev/showcase/switch.d.ts.map +1 -0
- package/dist/dev/showcase/table.d.ts +2 -0
- package/dist/dev/showcase/table.d.ts.map +1 -0
- package/dist/dev/showcase/tabs.d.ts +2 -0
- package/dist/dev/showcase/tabs.d.ts.map +1 -0
- package/dist/dev/showcase/textarea.d.ts +2 -0
- package/dist/dev/showcase/textarea.d.ts.map +1 -0
- package/dist/dev/showcase/theme-provider.d.ts +2 -0
- package/dist/dev/showcase/theme-provider.d.ts.map +1 -0
- package/dist/dev/showcase/toast.d.ts +2 -0
- package/dist/dev/showcase/toast.d.ts.map +1 -0
- package/dist/dev/showcase/toggle-group.d.ts +2 -0
- package/dist/dev/showcase/toggle-group.d.ts.map +1 -0
- package/dist/dev/showcase/toggle.d.ts +2 -0
- package/dist/dev/showcase/toggle.d.ts.map +1 -0
- package/dist/dev/showcase/tooltip.d.ts +2 -0
- package/dist/dev/showcase/tooltip.d.ts.map +1 -0
- package/dist/hooks/use-controllable-state.d.ts +14 -0
- package/dist/hooks/use-controllable-state.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/index.cjs +5099 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4740 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/types.d.ts +4 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/preset.d.ts +18 -0
- package/dist/preset.d.ts.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/llms.txt +74 -0
- package/package.json +117 -0
- package/scripts/add-icononly-prop.ts +84 -0
- package/scripts/audit-best-practices.ts +114 -0
- package/scripts/audit-showcase.ts +262 -0
- package/scripts/audit-showcases.ts +83 -0
- package/scripts/clean-imports.ts +21 -0
- package/scripts/count_missing.ts +24 -0
- package/scripts/find-css-vars.ts +62 -0
- package/scripts/fix-portals.ts +90 -0
- package/scripts/full-audit.ts +89 -0
- package/scripts/merge-components.cjs +65 -0
- package/scripts/merge-components.js +64 -0
- package/scripts/optimize-barrel.ts +116 -0
- package/scripts/postinstall.cjs +228 -0
- package/scripts/refactor_divs.ts +39 -0
- package/scripts/remove_div_wrappers.ts +17 -0
- package/scripts/update-gaps.ts +83 -0
- package/scripts/update_showcase_codestrings.ts +87 -0
- package/src/components/macro/accordion-preset.test.tsx +37 -0
- package/src/components/macro/accordion-preset.tsx +41 -0
- package/src/components/macro/alert-dialog-preset.tsx +116 -0
- package/src/components/macro/alert-preset.tsx +94 -0
- package/src/components/macro/avatar-preset.tsx +54 -0
- package/src/components/macro/breadcrumb-preset.tsx +50 -0
- package/src/components/macro/card-preset.tsx +44 -0
- package/src/components/macro/carousel-preset.tsx +150 -0
- package/src/components/macro/checkbox-preset.test.tsx +49 -0
- package/src/components/macro/checkbox-preset.tsx +84 -0
- package/src/components/macro/combobox-preset.tsx +171 -0
- package/src/components/macro/command-preset.tsx +74 -0
- package/src/components/macro/date-picker.tsx +289 -0
- package/src/components/macro/dialog-preset.tsx +105 -0
- package/src/components/macro/empty-preset.tsx +46 -0
- package/src/components/macro/field-preset.test.tsx +69 -0
- package/src/components/macro/field-preset.tsx +65 -0
- package/src/components/macro/index.ts +21 -0
- package/src/components/macro/input-otp-preset.tsx +98 -0
- package/src/components/macro/input-preset.test.tsx +52 -0
- package/src/components/macro/input-preset.tsx +139 -0
- package/src/components/macro/pagination-preset.tsx +153 -0
- package/src/components/macro/progress-preset.test.tsx +65 -0
- package/src/components/macro/progress-preset.tsx +45 -0
- package/src/components/macro/radio-group-preset.tsx +115 -0
- package/src/components/macro/select-preset.tsx +168 -0
- package/src/components/macro/slider-preset.test.tsx +43 -0
- package/src/components/macro/slider-preset.tsx +86 -0
- package/src/components/macro/switch-preset.test.tsx +53 -0
- package/src/components/macro/switch-preset.tsx +70 -0
- package/src/components/macro/tabs-preset.test.tsx +31 -0
- package/src/components/macro/tabs-preset.tsx +51 -0
- package/src/components/macro/textarea-preset.test.tsx +39 -0
- package/src/components/macro/textarea-preset.tsx +55 -0
- package/src/components/micro/accordion.tsx +76 -0
- package/src/components/micro/alert-dialog.tsx +213 -0
- package/src/components/micro/alert.tsx +146 -0
- package/src/components/micro/aspect-ratio.tsx +38 -0
- package/src/components/micro/avatar.tsx +143 -0
- package/src/components/micro/badge.tsx +207 -0
- package/src/components/micro/breadcrumb.tsx +162 -0
- package/src/components/micro/button.test.tsx +25 -0
- package/src/components/micro/button.tsx +361 -0
- package/src/components/micro/calendar.tsx +383 -0
- package/src/components/micro/card.tsx +112 -0
- package/src/components/micro/carousel.tsx +341 -0
- package/src/components/micro/chart.tsx +392 -0
- package/src/components/micro/checkbox.tsx +74 -0
- package/src/components/micro/collapsible.tsx +65 -0
- package/src/components/micro/combobox.tsx +349 -0
- package/src/components/micro/command.tsx +238 -0
- package/src/components/micro/context-menu.tsx +285 -0
- package/src/components/micro/dialog.tsx +143 -0
- package/src/components/micro/direction.tsx +13 -0
- package/src/components/micro/drawer.tsx +149 -0
- package/src/components/micro/dropdown-menu.tsx +305 -0
- package/src/components/micro/empty.tsx +144 -0
- package/src/components/micro/field.tsx +311 -0
- package/src/components/micro/hover-card.tsx +86 -0
- package/src/components/micro/input-group.tsx +269 -0
- package/src/components/micro/input-otp.tsx +130 -0
- package/src/components/micro/input.tsx +56 -0
- package/src/components/micro/item.tsx +206 -0
- package/src/components/micro/kbd.tsx +38 -0
- package/src/components/micro/label.tsx +48 -0
- package/src/components/micro/menubar.tsx +302 -0
- package/src/components/micro/navigation-menu.tsx +197 -0
- package/src/components/micro/pagination.tsx +162 -0
- package/src/components/micro/popover.tsx +131 -0
- package/src/components/micro/progress.tsx +144 -0
- package/src/components/micro/radio-group.tsx +73 -0
- package/src/components/micro/resizable.tsx +64 -0
- package/src/components/micro/scroll-area.tsx +68 -0
- package/src/components/micro/select.tsx +234 -0
- package/src/components/micro/separator.tsx +37 -0
- package/src/components/micro/sheet.tsx +144 -0
- package/src/components/micro/sidebar.tsx +238 -0
- package/src/components/micro/skeleton.tsx +29 -0
- package/src/components/micro/slider.tsx +135 -0
- package/src/components/micro/sonner.tsx +85 -0
- package/src/components/micro/spinner.tsx +44 -0
- package/src/components/micro/switch.tsx +70 -0
- package/src/components/micro/table.tsx +210 -0
- package/src/components/micro/tabs.tsx +100 -0
- package/src/components/micro/textarea.tsx +53 -0
- package/src/components/micro/theme-provider.tsx +163 -0
- package/src/components/micro/toggle-group.tsx +121 -0
- package/src/components/micro/toggle.tsx +55 -0
- package/src/components/micro/tooltip.tsx +105 -0
- package/src/dev/App.tsx +322 -0
- package/src/dev/_debug_select.html +29 -0
- package/src/dev/components/GladcnLogo.tsx +80 -0
- package/src/dev/components/code-highlighter.tsx +67 -0
- package/src/dev/components/dev-context.tsx +31 -0
- package/src/dev/components/showcase.tsx +413 -0
- package/src/dev/data.ts +341 -0
- package/src/dev/index.css +55 -0
- package/src/dev/main.tsx +30 -0
- package/src/dev/sections/buttons.tsx +303 -0
- package/src/dev/sections/display.tsx +270 -0
- package/src/dev/sections/feedback.tsx +371 -0
- package/src/dev/sections/forms.tsx +652 -0
- package/src/dev/sections/interactive.tsx +51 -0
- package/src/dev/sections/overview.tsx +396 -0
- package/src/dev/showcase/accordion.tsx +947 -0
- package/src/dev/showcase/alert-dialog.tsx +1056 -0
- package/src/dev/showcase/alert.tsx +756 -0
- package/src/dev/showcase/aspect-ratio.tsx +339 -0
- package/src/dev/showcase/avatar.tsx +470 -0
- package/src/dev/showcase/badge.tsx +227 -0
- package/src/dev/showcase/breadcrumb.tsx +269 -0
- package/src/dev/showcase/button.tsx +309 -0
- package/src/dev/showcase/calendar.tsx +380 -0
- package/src/dev/showcase/card.tsx +448 -0
- package/src/dev/showcase/carousel.tsx +562 -0
- package/src/dev/showcase/chart.tsx +130 -0
- package/src/dev/showcase/checkbox.tsx +611 -0
- package/src/dev/showcase/collapsible.tsx +298 -0
- package/src/dev/showcase/combobox.tsx +777 -0
- package/src/dev/showcase/command.tsx +245 -0
- package/src/dev/showcase/context-menu.tsx +239 -0
- package/src/dev/showcase/dialog.tsx +1141 -0
- package/src/dev/showcase/drawer.tsx +392 -0
- package/src/dev/showcase/dropdown-menu.tsx +420 -0
- package/src/dev/showcase/empty.tsx +493 -0
- package/src/dev/showcase/hover-card.tsx +336 -0
- package/src/dev/showcase/input-group.tsx +511 -0
- package/src/dev/showcase/input-otp.tsx +404 -0
- package/src/dev/showcase/input.tsx +530 -0
- package/src/dev/showcase/item.tsx +295 -0
- package/src/dev/showcase/kbd.tsx +276 -0
- package/src/dev/showcase/label.tsx +121 -0
- package/src/dev/showcase/menubar.tsx +392 -0
- package/src/dev/showcase/navigation-menu.tsx +304 -0
- package/src/dev/showcase/overview.tsx +1106 -0
- package/src/dev/showcase/pagination.tsx +312 -0
- package/src/dev/showcase/popover.tsx +374 -0
- package/src/dev/showcase/progress.tsx +299 -0
- package/src/dev/showcase/radio-group.tsx +612 -0
- package/src/dev/showcase/resizable.tsx +237 -0
- package/src/dev/showcase/scroll-area.tsx +157 -0
- package/src/dev/showcase/select.tsx +628 -0
- package/src/dev/showcase/separator.tsx +126 -0
- package/src/dev/showcase/sheet.tsx +566 -0
- package/src/dev/showcase/sidebar.tsx +120 -0
- package/src/dev/showcase/skeleton.tsx +213 -0
- package/src/dev/showcase/slider.tsx +506 -0
- package/src/dev/showcase/sonner.tsx +376 -0
- package/src/dev/showcase/spinner.tsx +124 -0
- package/src/dev/showcase/switch.tsx +602 -0
- package/src/dev/showcase/table.tsx +196 -0
- package/src/dev/showcase/tabs.tsx +662 -0
- package/src/dev/showcase/textarea.tsx +498 -0
- package/src/dev/showcase/theme-provider.tsx +894 -0
- package/src/dev/showcase/toast.tsx +119 -0
- package/src/dev/showcase/toggle-group.tsx +223 -0
- package/src/dev/showcase/toggle.tsx +171 -0
- package/src/dev/showcase/tooltip.tsx +372 -0
- package/src/hooks/use-controllable-state.ts +87 -0
- package/src/hooks/use-mobile.ts +21 -0
- package/src/index.ts +62 -0
- package/src/lib/types.ts +14 -0
- package/src/lib/utils.test.ts +14 -0
- package/src/lib/utils.ts +6 -0
- package/src/preset.ts +17 -0
- package/src/styles/gladcn.css +116 -0
- package/src/styles/tokens.css +213 -0
- package/src/test/setup.ts +8 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
|
|
3
|
+
const dataTsPath = "./src/dev/data.ts";
|
|
4
|
+
let content = fs.readFileSync(dataTsPath, "utf8");
|
|
5
|
+
|
|
6
|
+
// Match MICRO_COMPONENTS array
|
|
7
|
+
const microMatch = content.match(
|
|
8
|
+
/export const MICRO_COMPONENTS = (\[[\s\S]*?\]);/,
|
|
9
|
+
);
|
|
10
|
+
// Match MACRO_COMPONENTS array
|
|
11
|
+
const macroMatch = content.match(
|
|
12
|
+
/export const MACRO_COMPONENTS = (\[[\s\S]*?\]);/,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
if (!microMatch || !macroMatch) {
|
|
16
|
+
console.error("Could not find arrays");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Safely evaluate arrays (since they only contain static objects)
|
|
21
|
+
const micro = eval(microMatch[1]);
|
|
22
|
+
const macro = eval(macroMatch[1]);
|
|
23
|
+
|
|
24
|
+
const componentMap = new Map();
|
|
25
|
+
|
|
26
|
+
micro.forEach((c) => {
|
|
27
|
+
componentMap.set(c.id, {
|
|
28
|
+
id: c.id,
|
|
29
|
+
label: c.label,
|
|
30
|
+
hasMicro: true,
|
|
31
|
+
hasMacro: false,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
macro.forEach((c) => {
|
|
36
|
+
const baseId = c.id.replace("macro-", "");
|
|
37
|
+
if (componentMap.has(baseId)) {
|
|
38
|
+
componentMap.get(baseId).hasMacro = true;
|
|
39
|
+
} else {
|
|
40
|
+
componentMap.set(baseId, {
|
|
41
|
+
id: baseId,
|
|
42
|
+
label: c.label,
|
|
43
|
+
hasMicro: false,
|
|
44
|
+
hasMacro: true,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const merged = Array.from(componentMap.values()).sort((a, b) =>
|
|
50
|
+
a.label.localeCompare(b.label),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
let output = "export const COMPONENTS = [\n";
|
|
54
|
+
merged.forEach((c) => {
|
|
55
|
+
output += ` { id: "${c.id}", label: "${c.label}", hasMicro: ${c.hasMicro}, hasMacro: ${c.hasMacro} },\n`;
|
|
56
|
+
});
|
|
57
|
+
output += "];\n";
|
|
58
|
+
|
|
59
|
+
// Replace in content
|
|
60
|
+
content = content.replace(microMatch[0], output);
|
|
61
|
+
content = content.replace(macroMatch[0], ""); // Remove MACRO_COMPONENTS
|
|
62
|
+
|
|
63
|
+
fs.writeFileSync(dataTsPath, content);
|
|
64
|
+
console.log("Merged data.ts successfully.");
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Project } from "ts-morph";
|
|
2
|
+
import { resolve, relative } from "path";
|
|
3
|
+
|
|
4
|
+
const project = new Project({
|
|
5
|
+
tsConfigFilePath: "tsconfig.json",
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const indexFile = project.getSourceFileOrThrow("src/index.ts");
|
|
9
|
+
const presetFile = project.getSourceFileOrThrow("src/preset.ts");
|
|
10
|
+
|
|
11
|
+
const exportMap = new Map<string, string>();
|
|
12
|
+
|
|
13
|
+
function populateExportMap(file: any) {
|
|
14
|
+
const exportedDeclarations = file.getExportedDeclarations();
|
|
15
|
+
for (const [name, declarations] of exportedDeclarations) {
|
|
16
|
+
const decl = declarations[0];
|
|
17
|
+
const sourceFile = decl.getSourceFile();
|
|
18
|
+
let relPath = relative(resolve("src"), sourceFile.getFilePath());
|
|
19
|
+
relPath = relPath.replace(/\\/g, "/");
|
|
20
|
+
relPath = relPath.replace(/\.tsx?$/, "");
|
|
21
|
+
exportMap.set(name, "@/" + relPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
populateExportMap(indexFile);
|
|
26
|
+
populateExportMap(presetFile);
|
|
27
|
+
|
|
28
|
+
// Find all dev files
|
|
29
|
+
const filesToProcess = project.getSourceFiles([
|
|
30
|
+
"src/dev/**/*.tsx",
|
|
31
|
+
"src/dev/**/*.ts",
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
let totalChanged = 0;
|
|
35
|
+
|
|
36
|
+
for (const file of filesToProcess) {
|
|
37
|
+
let changed = false;
|
|
38
|
+
const imports = file.getImportDeclarations();
|
|
39
|
+
|
|
40
|
+
for (const imp of imports) {
|
|
41
|
+
const specifier = imp.getModuleSpecifierValue();
|
|
42
|
+
// Catch both @/index and @/preset (and trailing semicolon typos like @/index;)
|
|
43
|
+
if (
|
|
44
|
+
specifier === "@/index" ||
|
|
45
|
+
specifier === "@/preset" ||
|
|
46
|
+
specifier === "@/preset;"
|
|
47
|
+
) {
|
|
48
|
+
const namedImports = imp.getNamedImports();
|
|
49
|
+
const importsByPath = new Map<
|
|
50
|
+
string,
|
|
51
|
+
{ name: string; alias?: string }[]
|
|
52
|
+
>();
|
|
53
|
+
|
|
54
|
+
for (const named of namedImports) {
|
|
55
|
+
const name = named.getName();
|
|
56
|
+
const alias = named.getAliasNode()?.getText();
|
|
57
|
+
|
|
58
|
+
const sourcePath = exportMap.get(name);
|
|
59
|
+
if (sourcePath) {
|
|
60
|
+
if (!importsByPath.has(sourcePath)) {
|
|
61
|
+
importsByPath.set(sourcePath, []);
|
|
62
|
+
}
|
|
63
|
+
importsByPath.get(sourcePath)!.push({ name, alias });
|
|
64
|
+
} else {
|
|
65
|
+
console.warn(
|
|
66
|
+
`Export not found for ${name} in index.ts/preset.ts for file ${file.getFilePath()}`,
|
|
67
|
+
);
|
|
68
|
+
if (!importsByPath.has(specifier)) {
|
|
69
|
+
importsByPath.set(specifier, []);
|
|
70
|
+
}
|
|
71
|
+
importsByPath.get(specifier)!.push({ name, alias });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
imp.remove();
|
|
76
|
+
|
|
77
|
+
for (const [sourcePath, namedList] of importsByPath) {
|
|
78
|
+
if (
|
|
79
|
+
sourcePath === "@/index" ||
|
|
80
|
+
sourcePath === "@/preset" ||
|
|
81
|
+
sourcePath === "@/preset;"
|
|
82
|
+
)
|
|
83
|
+
continue; // skip unmapped to avoid infinite loop or just add them back if we want to preserve. Wait, if I skip them, they are lost!
|
|
84
|
+
// Let's add them back correctly if they weren't found.
|
|
85
|
+
file.addImportDeclaration({
|
|
86
|
+
moduleSpecifier: sourcePath,
|
|
87
|
+
namedImports: namedList.map((n) =>
|
|
88
|
+
n.alias ? { name: n.name, alias: n.alias } : { name: n.name },
|
|
89
|
+
),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// If we had unmapped ones, put them back
|
|
93
|
+
if (importsByPath.has(specifier)) {
|
|
94
|
+
file.addImportDeclaration({
|
|
95
|
+
moduleSpecifier: specifier,
|
|
96
|
+
namedImports: importsByPath
|
|
97
|
+
.get(specifier)!
|
|
98
|
+
.map((n) =>
|
|
99
|
+
n.alias ? { name: n.name, alias: n.alias } : { name: n.name },
|
|
100
|
+
),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
changed = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (changed) {
|
|
109
|
+
totalChanged++;
|
|
110
|
+
file.saveSync();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
console.log(
|
|
115
|
+
`Processed ${filesToProcess.length} files. Changed imports in ${totalChanged} files.`,
|
|
116
|
+
);
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const readline = require("readline");
|
|
6
|
+
|
|
7
|
+
// Colors
|
|
8
|
+
const cyan = "\x1b[36m";
|
|
9
|
+
const green = "\x1b[32m";
|
|
10
|
+
const yellow = "\x1b[33m";
|
|
11
|
+
const bold = "\x1b[1m";
|
|
12
|
+
const dim = "\x1b[90m";
|
|
13
|
+
const reset = "\x1b[0m";
|
|
14
|
+
|
|
15
|
+
// Find the consumer's project root (where npm install was run)
|
|
16
|
+
function findProjectRoot() {
|
|
17
|
+
// During postinstall, CWD is the package dir inside node_modules
|
|
18
|
+
// The consumer's project root is the INIT_CWD env variable
|
|
19
|
+
const initCwd = process.env.INIT_CWD;
|
|
20
|
+
if (initCwd) return initCwd;
|
|
21
|
+
|
|
22
|
+
// Fallback: walk up from node_modules
|
|
23
|
+
let dir = __dirname;
|
|
24
|
+
while (dir !== path.dirname(dir)) {
|
|
25
|
+
if (path.basename(dir) === "node_modules") {
|
|
26
|
+
return path.dirname(dir);
|
|
27
|
+
}
|
|
28
|
+
dir = path.dirname(dir);
|
|
29
|
+
}
|
|
30
|
+
return process.cwd();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check if running in the package's own install (not consumer)
|
|
34
|
+
function isSelfInstall() {
|
|
35
|
+
const projectRoot = findProjectRoot();
|
|
36
|
+
try {
|
|
37
|
+
const pkg = JSON.parse(
|
|
38
|
+
fs.readFileSync(path.join(projectRoot, "package.json"), "utf8"),
|
|
39
|
+
);
|
|
40
|
+
return pkg.name === "gladvn";
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Copy tokens.css to the target directory
|
|
47
|
+
function copyTokens(projectRoot, targetDir) {
|
|
48
|
+
const tokensSource = path.join(
|
|
49
|
+
__dirname,
|
|
50
|
+
"..",
|
|
51
|
+
"src",
|
|
52
|
+
"styles",
|
|
53
|
+
"tokens.css",
|
|
54
|
+
);
|
|
55
|
+
const targetPath = path.join(projectRoot, targetDir, "tokens.css");
|
|
56
|
+
|
|
57
|
+
// Create directory if it doesn't exist
|
|
58
|
+
const dir = path.dirname(targetPath);
|
|
59
|
+
if (!fs.existsSync(dir)) {
|
|
60
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Don't overwrite if already exists
|
|
64
|
+
if (fs.existsSync(targetPath)) {
|
|
65
|
+
console.log(
|
|
66
|
+
`${dim} ⏭ tokens.css already exists at ${targetDir}/tokens.css — skipped${reset}`,
|
|
67
|
+
);
|
|
68
|
+
return targetPath;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
fs.copyFileSync(tokensSource, targetPath);
|
|
72
|
+
console.log(
|
|
73
|
+
`${green} ✅ Copied tokens.css → ${targetDir}/tokens.css${reset}`,
|
|
74
|
+
);
|
|
75
|
+
return targetPath;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Inject imports into the main CSS file
|
|
79
|
+
function injectImports(cssFilePath, tokensRelPath) {
|
|
80
|
+
if (!fs.existsSync(cssFilePath)) {
|
|
81
|
+
console.log(`${yellow} ⚠ File not found: ${cssFilePath}${reset}`);
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let content = fs.readFileSync(cssFilePath, "utf8");
|
|
86
|
+
|
|
87
|
+
// Check if already configured
|
|
88
|
+
if (content.includes("gladvn/gladcn.css")) {
|
|
89
|
+
console.log(
|
|
90
|
+
`${dim} ⏭ gladvn already configured in this file — skipped${reset}`,
|
|
91
|
+
);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Build the import lines
|
|
96
|
+
const sourceDirective = `@source "../node_modules/gladvn/dist";`;
|
|
97
|
+
const tokensImport = `@import "${tokensRelPath}";`;
|
|
98
|
+
const globalsImport = `@import "gladvn/gladcn.css";`;
|
|
99
|
+
|
|
100
|
+
const imports = `\n/* gladvn */\n${sourceDirective}\n${tokensImport}\n${globalsImport}\n`;
|
|
101
|
+
|
|
102
|
+
// Insert after @import "tailwindcss" if it exists, otherwise append
|
|
103
|
+
const tailwindPattern = /@import\s+["']tailwindcss["'];?\s*\n?/;
|
|
104
|
+
if (tailwindPattern.test(content)) {
|
|
105
|
+
content = content.replace(tailwindPattern, (match) => match + imports);
|
|
106
|
+
} else {
|
|
107
|
+
content = content + "\n" + imports;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
fs.writeFileSync(cssFilePath, content);
|
|
111
|
+
console.log(
|
|
112
|
+
`${green} ✅ Injected gladcn imports into ${path.basename(
|
|
113
|
+
cssFilePath,
|
|
114
|
+
)}${reset}`,
|
|
115
|
+
);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Interactive setup
|
|
120
|
+
async function interactiveSetup(projectRoot) {
|
|
121
|
+
const rl = readline.createInterface({
|
|
122
|
+
input: process.stdin,
|
|
123
|
+
output: process.stdout,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const ask = (question) =>
|
|
127
|
+
new Promise((resolve) => rl.question(question, resolve));
|
|
128
|
+
|
|
129
|
+
console.log(
|
|
130
|
+
`\n${cyan}╔══════════════════════════════════════════════════════════════════╗${reset}`,
|
|
131
|
+
);
|
|
132
|
+
console.log(
|
|
133
|
+
`${cyan}║ ${bold}gladvn${reset}${cyan} — Interactive Setup ║${reset}`,
|
|
134
|
+
);
|
|
135
|
+
console.log(
|
|
136
|
+
`${cyan}╚══════════════════════════════════════════════════════════════════╝${reset}\n`,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Step 1: Ask where to put tokens.css
|
|
140
|
+
const tokensDir = await ask(
|
|
141
|
+
`${yellow} 📁 Where to copy tokens.css? ${dim}(default: src/styles)${reset}\n > `,
|
|
142
|
+
);
|
|
143
|
+
const targetDir = tokensDir.trim() || "src/styles";
|
|
144
|
+
const tokensPath = copyTokens(projectRoot, targetDir);
|
|
145
|
+
|
|
146
|
+
// Step 2: Ask for main CSS file
|
|
147
|
+
const cssFile = await ask(
|
|
148
|
+
`\n${yellow} 📄 Path to your main CSS file? ${dim}(e.g. app/globals.css)${reset}\n > `,
|
|
149
|
+
);
|
|
150
|
+
const cssFileTrimmed = cssFile.trim();
|
|
151
|
+
|
|
152
|
+
if (cssFileTrimmed) {
|
|
153
|
+
const cssFilePath = path.resolve(projectRoot, cssFileTrimmed);
|
|
154
|
+
const cssDir = path.dirname(cssFilePath);
|
|
155
|
+
const tokensAbsPath = path.resolve(projectRoot, targetDir, "tokens.css");
|
|
156
|
+
const tokensRelPath = "./" + path.relative(cssDir, tokensAbsPath);
|
|
157
|
+
|
|
158
|
+
injectImports(cssFilePath, tokensRelPath);
|
|
159
|
+
} else {
|
|
160
|
+
console.log(`${dim} ⏭ Skipped CSS injection${reset}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
console.log(`\n${cyan} 🎉 Setup complete! Use components:${reset}`);
|
|
164
|
+
console.log(
|
|
165
|
+
`${green} import { Button, Card } from "gladvn"${reset}`,
|
|
166
|
+
);
|
|
167
|
+
console.log(
|
|
168
|
+
`\n${dim} 💡 Edit ${targetDir}/tokens.css to customize colors, radius, etc.${reset}\n`,
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
rl.close();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Show static message (for non-interactive environments)
|
|
175
|
+
function showStaticMessage() {
|
|
176
|
+
console.log(`
|
|
177
|
+
${cyan}╔══════════════════════════════════════════════════════════════════╗
|
|
178
|
+
║ ║
|
|
179
|
+
║ ${bold}gladvn${reset}${cyan} installed successfully! 🎉 ║
|
|
180
|
+
║ ║
|
|
181
|
+
║ ${yellow}1. Copy the default tokens into your CSS:${cyan} ║
|
|
182
|
+
║ ║
|
|
183
|
+
║ ${dim}cp node_modules/gladvn/src/styles/tokens.css \\${cyan} ║
|
|
184
|
+
║ ${dim} src/styles/tokens.css${cyan} ║
|
|
185
|
+
║ ║
|
|
186
|
+
║ ${yellow}2. Set up your main CSS file (e.g. app/globals.css):${cyan} ║
|
|
187
|
+
║ ║
|
|
188
|
+
║ ${green}@import "tailwindcss";${cyan} ║
|
|
189
|
+
║ ${green}@source "../node_modules/gladvn/dist";${cyan} ║
|
|
190
|
+
║ ${green}@import "./tokens.css";${cyan} ║
|
|
191
|
+
║ ${green}@import "gladvn/gladcn.css";${cyan} ║
|
|
192
|
+
║ ║
|
|
193
|
+
║ ${yellow}3. Use components:${cyan} ║
|
|
194
|
+
║ ║
|
|
195
|
+
║ ${green}import { Button, Card } from "gladvn"${cyan} ║
|
|
196
|
+
║ ║
|
|
197
|
+
║ ${dim}💡 Customize tokens.css to change colors, radius, etc.${cyan} ║
|
|
198
|
+
║ ║
|
|
199
|
+
╚══════════════════════════════════════════════════════════════════╝${reset}
|
|
200
|
+
`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Main
|
|
204
|
+
async function main() {
|
|
205
|
+
// Skip if this is the package's own install
|
|
206
|
+
if (isSelfInstall()) return;
|
|
207
|
+
|
|
208
|
+
const projectRoot = findProjectRoot();
|
|
209
|
+
|
|
210
|
+
// Check if running in interactive terminal
|
|
211
|
+
const isInteractive = process.stdin.isTTY && process.stdout.isTTY;
|
|
212
|
+
|
|
213
|
+
if (isInteractive) {
|
|
214
|
+
try {
|
|
215
|
+
await interactiveSetup(projectRoot);
|
|
216
|
+
} catch {
|
|
217
|
+
// Fallback to static message if interactive fails
|
|
218
|
+
showStaticMessage();
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
showStaticMessage();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
main().catch(() => {
|
|
226
|
+
// Never fail the install
|
|
227
|
+
process.exit(0);
|
|
228
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
const dir = 'src/dev/showcase';
|
|
5
|
+
const files = fs.readdirSync(dir).filter(f => f.endsWith('.tsx'));
|
|
6
|
+
|
|
7
|
+
let totalChanges = 0;
|
|
8
|
+
|
|
9
|
+
for (const file of files) {
|
|
10
|
+
const filePath = path.join(dir, file);
|
|
11
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
12
|
+
let original = content;
|
|
13
|
+
|
|
14
|
+
const selfClosingRegex = /<div className="(w-64|w-full)">\s*<([A-Z]\w*)([\s\S]*?)\/>\s*<\/div>/g;
|
|
15
|
+
content = content.replace(selfClosingRegex, (match, width, comp, rest) => {
|
|
16
|
+
if (rest.includes('className=')) {
|
|
17
|
+
// If it already has className, replace className="..." with className="... width"
|
|
18
|
+
return match.replace(/className="([^"]*)"/, `className="$1 ${width}"`).replace(/<div[^>]*>/, '').replace(/<\/div>/, '').trim();
|
|
19
|
+
}
|
|
20
|
+
totalChanges++;
|
|
21
|
+
return `<${comp} className="${width}"${rest}/>`;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const withChildrenRegex = /<div className="(w-64|w-full)">\s*<([A-Z]\w*)([^>]*?)>([\s\S]*?)<\/\2>\s*<\/div>/g;
|
|
25
|
+
content = content.replace(withChildrenRegex, (match, width, comp, rest, inner) => {
|
|
26
|
+
if (rest.includes('className=')) {
|
|
27
|
+
return match;
|
|
28
|
+
}
|
|
29
|
+
totalChanges++;
|
|
30
|
+
return `<${comp} className="${width}"${rest}>${inner}</${comp}>`;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (content !== original) {
|
|
34
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
35
|
+
console.log(`Updated ${file}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log(`Total wrappers removed: ${totalChanges}`);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Project, SyntaxKind, JsxElement, StringLiteral, NoSubstitutionTemplateLiteral } from "ts-morph";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
|
|
4
|
+
// We will only do this for specific known wrapper classes to be safe
|
|
5
|
+
const targetClasses = ["w-64", "w-full", "w-72", "w-96", "max-w-sm", "max-w-xs", "max-w-lg"];
|
|
6
|
+
|
|
7
|
+
function shouldRemoveWrapper(classNameAttrValue: string) {
|
|
8
|
+
const classes = classNameAttrValue.split(" ").map(c => c.trim());
|
|
9
|
+
// If it ONLY contains classes from our safe list, or simple combinations
|
|
10
|
+
const hasTarget = classes.some(c => targetClasses.includes(c));
|
|
11
|
+
const hasDangerous = classes.some(c => c.includes("flex") || c.includes("grid") || c.includes("relative") || c.includes("absolute") || c.includes("mx-auto"));
|
|
12
|
+
|
|
13
|
+
// Actually, if the wrapper is JUST a sizing wrapper, let's remove it.
|
|
14
|
+
return hasTarget && !hasDangerous;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Just printing instructions for manual replacement is safer, but let's try a regex approach for calendar.tsx first
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Project, SyntaxKind, PropertyAssignment } from "ts-morph";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const project = new Project({
|
|
6
|
+
tsConfigFilePath: "tsconfig.json",
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const sourceFiles = project.getSourceFiles("src/components/micro/*.tsx");
|
|
10
|
+
|
|
11
|
+
let changed = 0;
|
|
12
|
+
|
|
13
|
+
for (const sf of sourceFiles) {
|
|
14
|
+
let fileChanged = false;
|
|
15
|
+
|
|
16
|
+
// 1. Update Badge base class specifically
|
|
17
|
+
if (sf.getBaseName() === "badge.tsx") {
|
|
18
|
+
const varDecls = sf.getVariableDeclarations();
|
|
19
|
+
for (const v of varDecls) {
|
|
20
|
+
if (v.getName() === "badgeVariants") {
|
|
21
|
+
const init = v.getInitializer();
|
|
22
|
+
if (init && init.getKind() === SyntaxKind.CallExpression) {
|
|
23
|
+
const args = init.getArguments();
|
|
24
|
+
if (args.length > 0 && args[0].getKind() === SyntaxKind.StringLiteral) {
|
|
25
|
+
let str = args[0].getText();
|
|
26
|
+
str = str.replace(/gap-\d+(\.\d+)?/g, "gap-1");
|
|
27
|
+
args[0].replaceWithText(str);
|
|
28
|
+
fileChanged = true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 2. Update size variants for all components
|
|
36
|
+
const calls = sf.getDescendantsOfKind(SyntaxKind.CallExpression);
|
|
37
|
+
for (const call of calls) {
|
|
38
|
+
if (call.getExpression().getText() === "cva" || call.getExpression().getText() === "tv") {
|
|
39
|
+
const args = call.getArguments();
|
|
40
|
+
if (args.length > 1 && args[1].getKind() === SyntaxKind.ObjectLiteralExpression) {
|
|
41
|
+
const variantsProp = args[1].getProperty("variants");
|
|
42
|
+
if (variantsProp && variantsProp.getKind() === SyntaxKind.PropertyAssignment) {
|
|
43
|
+
const variantsInit = variantsProp.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);
|
|
44
|
+
if (variantsInit) {
|
|
45
|
+
const sizeProp = variantsInit.getProperty("size");
|
|
46
|
+
if (sizeProp && sizeProp.getKind() === SyntaxKind.PropertyAssignment) {
|
|
47
|
+
const sizeInit = sizeProp.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression);
|
|
48
|
+
if (sizeInit) {
|
|
49
|
+
// We have size: { sm: "...", md: "...", lg: "..." }
|
|
50
|
+
const sizes = ["sm", "md", "lg"];
|
|
51
|
+
const targetGaps = { sm: "gap-1", md: "gap-1.5", lg: "gap-2" };
|
|
52
|
+
|
|
53
|
+
for (const s of sizes) {
|
|
54
|
+
const prop = sizeInit.getProperty(s);
|
|
55
|
+
if (prop && prop.getKind() === SyntaxKind.PropertyAssignment) {
|
|
56
|
+
const init = prop.getInitializer();
|
|
57
|
+
if (init && init.getKind() === SyntaxKind.StringLiteral) {
|
|
58
|
+
let text = init.getText();
|
|
59
|
+
// Only replace if gap- exists
|
|
60
|
+
if (/gap-\d+(\.\d+)?/.test(text)) {
|
|
61
|
+
text = text.replace(/gap-\d+(\.\d+)?/g, targetGaps[s]);
|
|
62
|
+
init.replaceWithText(text);
|
|
63
|
+
fileChanged = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (fileChanged) {
|
|
77
|
+
sf.saveSync();
|
|
78
|
+
changed++;
|
|
79
|
+
console.log("Updated", sf.getFilePath());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
console.log(`Updated ${changed} files.`);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Project, SyntaxKind, JsxElement } from "ts-morph";
|
|
2
|
+
|
|
3
|
+
const project = new Project({
|
|
4
|
+
tsConfigFilePath: "tsconfig.json",
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const sourceFiles = project.getSourceFiles("src/dev/showcase/**/*.tsx");
|
|
8
|
+
|
|
9
|
+
let totalUpdates = 0;
|
|
10
|
+
|
|
11
|
+
function dedent(text: string): string {
|
|
12
|
+
const lines = text.split('\n');
|
|
13
|
+
// Remove first empty line if it exists (usually just newline after the opening tag)
|
|
14
|
+
if (lines.length > 0 && lines[0].trim() === '') {
|
|
15
|
+
lines.shift();
|
|
16
|
+
}
|
|
17
|
+
// Remove last empty line if it exists
|
|
18
|
+
if (lines.length > 0 && lines[lines.length - 1].trim() === '') {
|
|
19
|
+
lines.pop();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Find minimum indentation
|
|
23
|
+
let minIndent = Infinity;
|
|
24
|
+
for (const line of lines) {
|
|
25
|
+
if (line.trim().length === 0) continue;
|
|
26
|
+
const match = line.match(/^(\s*)/);
|
|
27
|
+
if (match) {
|
|
28
|
+
minIndent = Math.min(minIndent, match[1].length);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (minIndent === Infinity) return text.trim();
|
|
33
|
+
|
|
34
|
+
return lines.map(line => line.substring(minIndent)).join('\n');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
for (const sourceFile of sourceFiles) {
|
|
38
|
+
const exampleSections = sourceFile.getDescendantsOfKind(SyntaxKind.JsxElement)
|
|
39
|
+
.filter(element => {
|
|
40
|
+
const opening = element.getOpeningElement();
|
|
41
|
+
return opening.getTagNameNode().getText() === "ExampleSection";
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
let fileUpdated = false;
|
|
45
|
+
|
|
46
|
+
for (const section of exampleSections) {
|
|
47
|
+
const opening = section.getOpeningElement();
|
|
48
|
+
|
|
49
|
+
// Check if codeString already exists
|
|
50
|
+
const hasCodeString = opening.getAttributes().some(attr => {
|
|
51
|
+
return attr.getKind() === SyntaxKind.JsxAttribute &&
|
|
52
|
+
attr.asKind(SyntaxKind.JsxAttribute)?.getNameNode().getText() === "codeString";
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (!hasCodeString) {
|
|
56
|
+
// Get raw text of children
|
|
57
|
+
const childrenNodes = section.getJsxChildren();
|
|
58
|
+
if (childrenNodes.length === 0) continue;
|
|
59
|
+
|
|
60
|
+
const start = childrenNodes[0].getStart();
|
|
61
|
+
const end = childrenNodes[childrenNodes.length - 1].getEnd();
|
|
62
|
+
const rawText = sourceFile.getFullText().substring(start, end);
|
|
63
|
+
|
|
64
|
+
const cleanCode = dedent(rawText);
|
|
65
|
+
|
|
66
|
+
// Escape backticks and ${} to avoid template literal interpolation issues
|
|
67
|
+
const escapedCode = cleanCode
|
|
68
|
+
.replace(/`/g, '\\`')
|
|
69
|
+
.replace(/\$\{/g, '\\${');
|
|
70
|
+
|
|
71
|
+
opening.addAttribute({
|
|
72
|
+
name: "codeString",
|
|
73
|
+
initializer: `{\`${escapedCode}\`}`
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
fileUpdated = true;
|
|
77
|
+
totalUpdates++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (fileUpdated) {
|
|
82
|
+
console.log(`Updated ${sourceFile.getBaseName()}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
project.saveSync();
|
|
87
|
+
console.log(`Finished! Updated ${totalUpdates} ExampleSections.`);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { AccordionPreset } from "./accordion-preset";
|
|
4
|
+
|
|
5
|
+
const items = [
|
|
6
|
+
{ value: "item-1", title: "Section 1", content: "Content for section 1" },
|
|
7
|
+
{ value: "item-2", title: "Section 2", content: "Content for section 2" },
|
|
8
|
+
{
|
|
9
|
+
value: "item-3",
|
|
10
|
+
title: "Section 3",
|
|
11
|
+
content: "Content for section 3",
|
|
12
|
+
disabled: true,
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
describe("AccordionPreset", () => {
|
|
17
|
+
it("renders all accordion triggers", () => {
|
|
18
|
+
render(<AccordionPreset items={items} />);
|
|
19
|
+
expect(screen.getByText("Section 1")).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByText("Section 2")).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText("Section 3")).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("renders correct number of items", () => {
|
|
25
|
+
const { container } = render(<AccordionPreset items={items} />);
|
|
26
|
+
const accordionItems = container.querySelectorAll(
|
|
27
|
+
"[data-slot='accordion-item']",
|
|
28
|
+
);
|
|
29
|
+
expect(accordionItems.length).toBe(3);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("renders with empty items array", () => {
|
|
33
|
+
const { container } = render(<AccordionPreset items={[]} />);
|
|
34
|
+
const accordion = container.querySelector("[data-slot='accordion']");
|
|
35
|
+
expect(accordion).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
});
|