gladvn 0.2.22 → 0.2.27
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/LICENSE +21 -0
- package/README.md +70 -58
- package/bin/cli.js +352 -150
- package/llms.txt +7 -5
- package/package.json +14 -26
- package/src/blocks/auth-card.tsx +104 -0
- package/src/blocks/auth-dialog.tsx +116 -0
- package/src/blocks/auth-recovery.tsx +61 -0
- package/src/blocks/auth-split.tsx +132 -0
- package/src/blocks/dashboard.tsx +182 -0
- package/src/blocks/settings.tsx +104 -0
- package/src/components/macro/accordion-preset.tsx +2 -1
- package/src/components/macro/alert-dialog-preset.tsx +3 -2
- package/src/components/macro/alert-preset.tsx +2 -1
- package/src/components/macro/avatar-preset.tsx +2 -1
- package/src/components/macro/breadcrumb-preset.tsx +2 -1
- package/src/components/macro/card-preset.tsx +2 -1
- package/src/components/macro/carousel-preset.tsx +2 -1
- package/src/components/macro/checkbox-preset.tsx +2 -1
- package/src/components/macro/combobox-preset.tsx +5 -3
- package/src/components/macro/command-preset.tsx +7 -4
- package/src/components/macro/date-picker.tsx +3 -2
- package/src/components/macro/dialog-preset.tsx +3 -2
- package/src/components/macro/empty-preset.tsx +2 -1
- package/src/components/macro/field-preset.tsx +2 -1
- package/src/components/macro/input-otp-preset.tsx +2 -1
- package/src/components/macro/input-preset.tsx +2 -1
- package/src/components/macro/pagination-preset.tsx +2 -1
- package/src/components/macro/progress-preset.tsx +2 -1
- package/src/components/macro/select-preset.tsx +3 -2
- package/src/components/macro/slider-preset.tsx +2 -1
- package/src/components/macro/switch-preset.tsx +2 -1
- package/src/components/macro/tabs-preset.tsx +2 -1
- package/src/components/micro/accordion.test.tsx +96 -0
- package/src/components/micro/alert-dialog.tsx +1 -1
- package/src/components/micro/alert.test.tsx +77 -0
- package/src/components/micro/avatar.tsx +1 -1
- package/src/components/micro/badge.test.tsx +57 -0
- package/src/components/micro/breadcrumb.tsx +1 -1
- package/src/components/micro/button.test.tsx +101 -4
- package/src/components/micro/card.test.tsx +54 -0
- package/src/components/micro/card.tsx +1 -1
- package/src/components/micro/carousel.tsx +1 -1
- package/src/components/micro/chart.tsx +1 -1
- package/src/components/micro/checkbox.test.tsx +92 -0
- package/src/components/micro/combobox.tsx +1 -1
- package/src/components/micro/command.tsx +1 -1
- package/src/components/micro/context-menu.tsx +1 -1
- package/src/components/micro/dialog.test.tsx +127 -0
- package/src/components/micro/dialog.tsx +1 -1
- package/src/components/micro/direction.tsx +1 -1
- package/src/components/micro/drawer.tsx +2 -2
- package/src/components/micro/dropdown-menu.test.tsx +132 -0
- package/src/components/micro/dropdown-menu.tsx +1 -1
- package/src/components/micro/empty.tsx +1 -1
- package/src/components/micro/field.tsx +1 -1
- package/src/components/micro/input-group.tsx +1 -1
- package/src/components/micro/input.test.tsx +95 -0
- package/src/components/micro/item.tsx +1 -1
- package/src/components/micro/menubar.tsx +1 -1
- package/src/components/micro/navigation-menu.tsx +1 -1
- package/src/components/micro/pagination.tsx +1 -1
- package/src/components/micro/popover.test.tsx +83 -0
- package/src/components/micro/popover.tsx +1 -1
- package/src/components/micro/progress.tsx +1 -1
- package/src/components/micro/select.test.tsx +122 -0
- package/src/components/micro/select.tsx +1 -1
- package/src/components/micro/sheet.test.tsx +122 -0
- package/src/components/micro/sheet.tsx +1 -1
- package/src/components/micro/sidebar.tsx +1 -1
- package/src/components/micro/switch.test.tsx +108 -0
- package/src/components/micro/table.tsx +1 -1
- package/src/components/micro/tabs.test.tsx +90 -0
- package/src/components/micro/tooltip.test.tsx +107 -0
- package/src/components/micro/tooltip.tsx +1 -1
- package/src/dev/data.ts +8 -0
- package/src/dev/main.tsx +4 -0
- package/src/dev/showcase/accordion.tsx +4 -2
- package/src/dev/showcase/alert-dialog.tsx +7 -4
- package/src/dev/showcase/alert.tsx +6 -3
- package/src/dev/showcase/aspect-ratio.tsx +2 -1
- package/src/dev/showcase/avatar.tsx +6 -3
- package/src/dev/showcase/badge.tsx +2 -1
- package/src/dev/showcase/breadcrumb.tsx +7 -4
- package/src/dev/showcase/button.tsx +2 -1
- package/src/dev/showcase/calendar.tsx +2 -1
- package/src/dev/showcase/card.tsx +4 -2
- package/src/dev/showcase/carousel.tsx +4 -2
- package/src/dev/showcase/chart.tsx +4 -2
- package/src/dev/showcase/checkbox.tsx +4 -2
- package/src/dev/showcase/collapsible.tsx +4 -2
- package/src/dev/showcase/combobox.tsx +9 -5
- package/src/dev/showcase/command.tsx +6 -3
- package/src/dev/showcase/context-menu.tsx +5 -3
- package/src/dev/showcase/dialog.tsx +5 -3
- package/src/dev/showcase/drawer.tsx +5 -3
- package/src/dev/showcase/dropdown-menu.tsx +7 -4
- package/src/dev/showcase/empty.tsx +6 -3
- package/src/dev/showcase/hover-card.tsx +7 -4
- package/src/dev/showcase/input-group.tsx +6 -3
- package/src/dev/showcase/input-otp.tsx +6 -3
- package/src/dev/showcase/input.tsx +6 -3
- package/src/dev/showcase/item.tsx +4 -2
- package/src/dev/showcase/kbd.tsx +10 -6
- package/src/dev/showcase/label.tsx +2 -1
- package/src/dev/showcase/menubar.tsx +5 -3
- package/src/dev/showcase/navigation-menu.tsx +5 -3
- package/src/dev/showcase/overview.tsx +9 -5
- package/src/dev/showcase/pagination.tsx +4 -2
- package/src/dev/showcase/popover.tsx +5 -3
- package/src/dev/showcase/progress.tsx +4 -2
- package/src/dev/showcase/radio-group.tsx +2 -1
- package/src/dev/showcase/resizable.tsx +4 -2
- package/src/dev/showcase/scroll-area.tsx +2 -1
- package/src/dev/showcase/select.tsx +7 -4
- package/src/dev/showcase/separator.tsx +2 -1
- package/src/dev/showcase/sheet.tsx +5 -3
- package/src/dev/showcase/sidebar.tsx +4 -2
- package/src/dev/showcase/skeleton.tsx +2 -1
- package/src/dev/showcase/slider.tsx +6 -3
- package/src/dev/showcase/sonner.tsx +2 -1
- package/src/dev/showcase/spinner.tsx +2 -1
- package/src/dev/showcase/switch.tsx +2 -1
- package/src/dev/showcase/table.tsx +4 -2
- package/src/dev/showcase/tabs.tsx +4 -2
- package/src/dev/showcase/textarea.tsx +6 -3
- package/src/dev/showcase/toast.tsx +2 -1
- package/src/dev/showcase/toggle-group.tsx +6 -3
- package/src/dev/showcase/toggle.tsx +2 -1
- package/src/dev/showcase/tooltip.tsx +5 -3
- package/src/dev/showcase/why.tsx +271 -0
- package/src/hooks/use-mobile.test.ts +72 -0
- package/src/lib/utils.test.ts +26 -10
- package/src/styles/gladvn.css +0 -1
- package/src/styles/tokens.css +4 -0
- package/dist/components/macro/accordion-preset.d.ts +0 -14
- package/dist/components/macro/accordion-preset.d.ts.map +0 -1
- package/dist/components/macro/alert-dialog-preset.d.ts +0 -26
- package/dist/components/macro/alert-dialog-preset.d.ts.map +0 -1
- package/dist/components/macro/alert-preset.d.ts +0 -14
- package/dist/components/macro/alert-preset.d.ts.map +0 -1
- package/dist/components/macro/avatar-preset.d.ts +0 -11
- package/dist/components/macro/avatar-preset.d.ts.map +0 -1
- package/dist/components/macro/breadcrumb-preset.d.ts +0 -12
- package/dist/components/macro/breadcrumb-preset.d.ts.map +0 -1
- package/dist/components/macro/card-preset.d.ts +0 -10
- package/dist/components/macro/card-preset.d.ts.map +0 -1
- package/dist/components/macro/carousel-preset.d.ts +0 -18
- package/dist/components/macro/carousel-preset.d.ts.map +0 -1
- package/dist/components/macro/checkbox-preset.d.ts +0 -14
- package/dist/components/macro/checkbox-preset.d.ts.map +0 -1
- package/dist/components/macro/combobox-preset.d.ts +0 -27
- package/dist/components/macro/combobox-preset.d.ts.map +0 -1
- package/dist/components/macro/command-preset.d.ts +0 -16
- package/dist/components/macro/command-preset.d.ts.map +0 -1
- package/dist/components/macro/date-picker.d.ts +0 -62
- package/dist/components/macro/date-picker.d.ts.map +0 -1
- package/dist/components/macro/dialog-preset.d.ts +0 -24
- package/dist/components/macro/dialog-preset.d.ts.map +0 -1
- package/dist/components/macro/empty-preset.d.ts +0 -15
- package/dist/components/macro/empty-preset.d.ts.map +0 -1
- package/dist/components/macro/field-preset.d.ts +0 -15
- package/dist/components/macro/field-preset.d.ts.map +0 -1
- package/dist/components/macro/index.d.ts +0 -22
- package/dist/components/macro/index.d.ts.map +0 -1
- package/dist/components/macro/input-otp-preset.d.ts +0 -19
- package/dist/components/macro/input-otp-preset.d.ts.map +0 -1
- package/dist/components/macro/input-preset.d.ts +0 -21
- package/dist/components/macro/input-preset.d.ts.map +0 -1
- package/dist/components/macro/pagination-preset.d.ts +0 -13
- package/dist/components/macro/pagination-preset.d.ts.map +0 -1
- package/dist/components/macro/progress-preset.d.ts +0 -10
- package/dist/components/macro/progress-preset.d.ts.map +0 -1
- package/dist/components/macro/radio-group-preset.d.ts +0 -22
- package/dist/components/macro/radio-group-preset.d.ts.map +0 -1
- package/dist/components/macro/select-preset.d.ts +0 -42
- package/dist/components/macro/select-preset.d.ts.map +0 -1
- package/dist/components/macro/slider-preset.d.ts +0 -12
- package/dist/components/macro/slider-preset.d.ts.map +0 -1
- package/dist/components/macro/switch-preset.d.ts +0 -12
- package/dist/components/macro/switch-preset.d.ts.map +0 -1
- package/dist/components/macro/tabs-preset.d.ts +0 -17
- package/dist/components/macro/tabs-preset.d.ts.map +0 -1
- package/dist/components/macro/textarea-preset.d.ts +0 -17
- package/dist/components/macro/textarea-preset.d.ts.map +0 -1
- package/dist/components/micro/accordion.d.ts +0 -15
- package/dist/components/micro/accordion.d.ts.map +0 -1
- package/dist/components/micro/alert-dialog.d.ts +0 -33
- package/dist/components/micro/alert-dialog.d.ts.map +0 -1
- package/dist/components/micro/alert.d.ts +0 -35
- package/dist/components/micro/alert.d.ts.map +0 -1
- package/dist/components/micro/aspect-ratio.d.ts +0 -20
- package/dist/components/micro/aspect-ratio.d.ts.map +0 -1
- package/dist/components/micro/avatar.d.ts +0 -23
- package/dist/components/micro/avatar.d.ts.map +0 -1
- package/dist/components/micro/badge.d.ts +0 -23
- package/dist/components/micro/badge.d.ts.map +0 -1
- package/dist/components/micro/breadcrumb.d.ts +0 -31
- package/dist/components/micro/breadcrumb.d.ts.map +0 -1
- package/dist/components/micro/button.d.ts +0 -46
- package/dist/components/micro/button.d.ts.map +0 -1
- package/dist/components/micro/calendar.d.ts +0 -28
- package/dist/components/micro/calendar.d.ts.map +0 -1
- package/dist/components/micro/card.d.ts +0 -28
- package/dist/components/micro/card.d.ts.map +0 -1
- package/dist/components/micro/carousel.d.ts +0 -29
- package/dist/components/micro/carousel.d.ts.map +0 -1
- package/dist/components/micro/chart.d.ts +0 -49
- package/dist/components/micro/chart.d.ts.map +0 -1
- package/dist/components/micro/checkbox.d.ts +0 -17
- package/dist/components/micro/checkbox.d.ts.map +0 -1
- package/dist/components/micro/collapsible.d.ts +0 -15
- package/dist/components/micro/collapsible.d.ts.map +0 -1
- package/dist/components/micro/combobox.d.ts +0 -34
- package/dist/components/micro/combobox.d.ts.map +0 -1
- package/dist/components/micro/command.d.ts +0 -79
- package/dist/components/micro/command.d.ts.map +0 -1
- package/dist/components/micro/context-menu.d.ts +0 -58
- package/dist/components/micro/context-menu.d.ts.map +0 -1
- package/dist/components/micro/dialog.d.ts +0 -15
- package/dist/components/micro/dialog.d.ts.map +0 -1
- package/dist/components/micro/direction.d.ts +0 -2
- package/dist/components/micro/direction.d.ts.map +0 -1
- package/dist/components/micro/drawer.d.ts +0 -18
- package/dist/components/micro/drawer.d.ts.map +0 -1
- package/dist/components/micro/dropdown-menu.d.ts +0 -40
- package/dist/components/micro/dropdown-menu.d.ts.map +0 -1
- package/dist/components/micro/empty.d.ts +0 -30
- package/dist/components/micro/empty.d.ts.map +0 -1
- package/dist/components/micro/field.d.ts +0 -29
- package/dist/components/micro/field.d.ts.map +0 -1
- package/dist/components/micro/hover-card.d.ts +0 -18
- package/dist/components/micro/hover-card.d.ts.map +0 -1
- package/dist/components/micro/input-group.d.ts +0 -17
- package/dist/components/micro/input-group.d.ts.map +0 -1
- package/dist/components/micro/input-otp.d.ts +0 -44
- package/dist/components/micro/input-otp.d.ts.map +0 -1
- package/dist/components/micro/input.d.ts +0 -29
- package/dist/components/micro/input.d.ts.map +0 -1
- package/dist/components/micro/item.d.ts +0 -31
- package/dist/components/micro/item.d.ts.map +0 -1
- package/dist/components/micro/kbd.d.ts +0 -9
- package/dist/components/micro/kbd.d.ts.map +0 -1
- package/dist/components/micro/label.d.ts +0 -15
- package/dist/components/micro/label.d.ts.map +0 -1
- package/dist/components/micro/menubar.d.ts +0 -40
- package/dist/components/micro/menubar.d.ts.map +0 -1
- package/dist/components/micro/navigation-menu.d.ts +0 -26
- package/dist/components/micro/navigation-menu.d.ts.map +0 -1
- package/dist/components/micro/pagination.d.ts +0 -33
- package/dist/components/micro/pagination.d.ts.map +0 -1
- package/dist/components/micro/popover.d.ts +0 -24
- package/dist/components/micro/popover.d.ts.map +0 -1
- package/dist/components/micro/progress.d.ts +0 -19
- package/dist/components/micro/progress.d.ts.map +0 -1
- package/dist/components/micro/radio-group.d.ts +0 -13
- package/dist/components/micro/radio-group.d.ts.map +0 -1
- package/dist/components/micro/resizable.d.ts +0 -12
- package/dist/components/micro/resizable.d.ts.map +0 -1
- package/dist/components/micro/scroll-area.d.ts +0 -12
- package/dist/components/micro/scroll-area.d.ts.map +0 -1
- package/dist/components/micro/select.d.ts +0 -22
- package/dist/components/micro/select.d.ts.map +0 -1
- package/dist/components/micro/separator.d.ts +0 -9
- package/dist/components/micro/separator.d.ts.map +0 -1
- package/dist/components/micro/sheet.d.ts +0 -17
- package/dist/components/micro/sheet.d.ts.map +0 -1
- package/dist/components/micro/sidebar.d.ts +0 -28
- package/dist/components/micro/sidebar.d.ts.map +0 -1
- package/dist/components/micro/skeleton.d.ts +0 -16
- package/dist/components/micro/skeleton.d.ts.map +0 -1
- package/dist/components/micro/slider.d.ts +0 -21
- package/dist/components/micro/slider.d.ts.map +0 -1
- package/dist/components/micro/sonner.d.ts +0 -5
- package/dist/components/micro/sonner.d.ts.map +0 -1
- package/dist/components/micro/spinner.d.ts +0 -21
- package/dist/components/micro/spinner.d.ts.map +0 -1
- package/dist/components/micro/switch.d.ts +0 -13
- package/dist/components/micro/switch.d.ts.map +0 -1
- package/dist/components/micro/table.d.ts +0 -17
- package/dist/components/micro/table.d.ts.map +0 -1
- package/dist/components/micro/tabs.d.ts +0 -13
- package/dist/components/micro/tabs.d.ts.map +0 -1
- package/dist/components/micro/textarea.d.ts +0 -24
- package/dist/components/micro/textarea.d.ts.map +0 -1
- package/dist/components/micro/theme-provider.d.ts +0 -76
- package/dist/components/micro/theme-provider.d.ts.map +0 -1
- package/dist/components/micro/toggle-group.d.ts +0 -22
- package/dist/components/micro/toggle-group.d.ts.map +0 -1
- package/dist/components/micro/toggle.d.ts +0 -16
- package/dist/components/micro/toggle.d.ts.map +0 -1
- package/dist/components/micro/tooltip.d.ts +0 -21
- package/dist/components/micro/tooltip.d.ts.map +0 -1
- package/dist/dev/App.d.ts +0 -3
- package/dist/dev/App.d.ts.map +0 -1
- package/dist/dev/components/GladvnLogo.d.ts +0 -10
- package/dist/dev/components/GladvnLogo.d.ts.map +0 -1
- package/dist/dev/components/code-highlighter.d.ts +0 -5
- package/dist/dev/components/code-highlighter.d.ts.map +0 -1
- package/dist/dev/components/dev-context.d.ts +0 -12
- package/dist/dev/components/dev-context.d.ts.map +0 -1
- package/dist/dev/components/showcase.d.ts +0 -72
- package/dist/dev/components/showcase.d.ts.map +0 -1
- package/dist/dev/data.d.ts +0 -68
- package/dist/dev/data.d.ts.map +0 -1
- package/dist/dev/main.d.ts +0 -1
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/dev/sections/buttons.d.ts +0 -2
- package/dist/dev/sections/buttons.d.ts.map +0 -1
- package/dist/dev/sections/display.d.ts +0 -2
- package/dist/dev/sections/display.d.ts.map +0 -1
- package/dist/dev/sections/feedback.d.ts +0 -2
- package/dist/dev/sections/feedback.d.ts.map +0 -1
- package/dist/dev/sections/forms.d.ts +0 -2
- package/dist/dev/sections/forms.d.ts.map +0 -1
- package/dist/dev/sections/interactive.d.ts +0 -2
- package/dist/dev/sections/interactive.d.ts.map +0 -1
- package/dist/dev/sections/overview.d.ts +0 -2
- package/dist/dev/sections/overview.d.ts.map +0 -1
- package/dist/dev/showcase/accordion.d.ts +0 -2
- package/dist/dev/showcase/accordion.d.ts.map +0 -1
- package/dist/dev/showcase/alert-dialog.d.ts +0 -2
- package/dist/dev/showcase/alert-dialog.d.ts.map +0 -1
- package/dist/dev/showcase/alert.d.ts +0 -2
- package/dist/dev/showcase/alert.d.ts.map +0 -1
- package/dist/dev/showcase/aspect-ratio.d.ts +0 -2
- package/dist/dev/showcase/aspect-ratio.d.ts.map +0 -1
- package/dist/dev/showcase/avatar.d.ts +0 -2
- package/dist/dev/showcase/avatar.d.ts.map +0 -1
- package/dist/dev/showcase/badge.d.ts +0 -2
- package/dist/dev/showcase/badge.d.ts.map +0 -1
- package/dist/dev/showcase/breadcrumb.d.ts +0 -2
- package/dist/dev/showcase/breadcrumb.d.ts.map +0 -1
- package/dist/dev/showcase/button.d.ts +0 -2
- package/dist/dev/showcase/button.d.ts.map +0 -1
- package/dist/dev/showcase/calendar.d.ts +0 -2
- package/dist/dev/showcase/calendar.d.ts.map +0 -1
- package/dist/dev/showcase/card.d.ts +0 -2
- package/dist/dev/showcase/card.d.ts.map +0 -1
- package/dist/dev/showcase/carousel.d.ts +0 -2
- package/dist/dev/showcase/carousel.d.ts.map +0 -1
- package/dist/dev/showcase/chart.d.ts +0 -2
- package/dist/dev/showcase/chart.d.ts.map +0 -1
- package/dist/dev/showcase/checkbox.d.ts +0 -2
- package/dist/dev/showcase/checkbox.d.ts.map +0 -1
- package/dist/dev/showcase/collapsible.d.ts +0 -3
- package/dist/dev/showcase/collapsible.d.ts.map +0 -1
- package/dist/dev/showcase/combobox.d.ts +0 -2
- package/dist/dev/showcase/combobox.d.ts.map +0 -1
- package/dist/dev/showcase/command.d.ts +0 -2
- package/dist/dev/showcase/command.d.ts.map +0 -1
- package/dist/dev/showcase/context-menu.d.ts +0 -2
- package/dist/dev/showcase/context-menu.d.ts.map +0 -1
- package/dist/dev/showcase/dialog.d.ts +0 -2
- package/dist/dev/showcase/dialog.d.ts.map +0 -1
- package/dist/dev/showcase/drawer.d.ts +0 -2
- package/dist/dev/showcase/drawer.d.ts.map +0 -1
- package/dist/dev/showcase/dropdown-menu.d.ts +0 -2
- package/dist/dev/showcase/dropdown-menu.d.ts.map +0 -1
- package/dist/dev/showcase/empty.d.ts +0 -2
- package/dist/dev/showcase/empty.d.ts.map +0 -1
- package/dist/dev/showcase/hover-card.d.ts +0 -2
- package/dist/dev/showcase/hover-card.d.ts.map +0 -1
- package/dist/dev/showcase/input-group.d.ts +0 -2
- package/dist/dev/showcase/input-group.d.ts.map +0 -1
- package/dist/dev/showcase/input-otp.d.ts +0 -2
- package/dist/dev/showcase/input-otp.d.ts.map +0 -1
- package/dist/dev/showcase/input.d.ts +0 -2
- package/dist/dev/showcase/input.d.ts.map +0 -1
- package/dist/dev/showcase/item.d.ts +0 -2
- package/dist/dev/showcase/item.d.ts.map +0 -1
- package/dist/dev/showcase/kbd.d.ts +0 -2
- package/dist/dev/showcase/kbd.d.ts.map +0 -1
- package/dist/dev/showcase/label.d.ts +0 -2
- package/dist/dev/showcase/label.d.ts.map +0 -1
- package/dist/dev/showcase/menubar.d.ts +0 -2
- package/dist/dev/showcase/menubar.d.ts.map +0 -1
- package/dist/dev/showcase/navigation-menu.d.ts +0 -3
- package/dist/dev/showcase/navigation-menu.d.ts.map +0 -1
- package/dist/dev/showcase/overview.d.ts +0 -2
- package/dist/dev/showcase/overview.d.ts.map +0 -1
- package/dist/dev/showcase/pagination.d.ts +0 -2
- package/dist/dev/showcase/pagination.d.ts.map +0 -1
- package/dist/dev/showcase/popover.d.ts +0 -2
- package/dist/dev/showcase/popover.d.ts.map +0 -1
- package/dist/dev/showcase/progress.d.ts +0 -2
- package/dist/dev/showcase/progress.d.ts.map +0 -1
- package/dist/dev/showcase/radio-group.d.ts +0 -2
- package/dist/dev/showcase/radio-group.d.ts.map +0 -1
- package/dist/dev/showcase/resizable.d.ts +0 -2
- package/dist/dev/showcase/resizable.d.ts.map +0 -1
- package/dist/dev/showcase/scroll-area.d.ts +0 -2
- package/dist/dev/showcase/scroll-area.d.ts.map +0 -1
- package/dist/dev/showcase/select.d.ts +0 -2
- package/dist/dev/showcase/select.d.ts.map +0 -1
- package/dist/dev/showcase/separator.d.ts +0 -2
- package/dist/dev/showcase/separator.d.ts.map +0 -1
- package/dist/dev/showcase/sheet.d.ts +0 -2
- package/dist/dev/showcase/sheet.d.ts.map +0 -1
- package/dist/dev/showcase/sidebar.d.ts +0 -2
- package/dist/dev/showcase/sidebar.d.ts.map +0 -1
- package/dist/dev/showcase/skeleton.d.ts +0 -2
- package/dist/dev/showcase/skeleton.d.ts.map +0 -1
- package/dist/dev/showcase/slider.d.ts +0 -2
- package/dist/dev/showcase/slider.d.ts.map +0 -1
- package/dist/dev/showcase/sonner.d.ts +0 -2
- package/dist/dev/showcase/sonner.d.ts.map +0 -1
- package/dist/dev/showcase/spinner.d.ts +0 -2
- package/dist/dev/showcase/spinner.d.ts.map +0 -1
- package/dist/dev/showcase/switch.d.ts +0 -2
- package/dist/dev/showcase/switch.d.ts.map +0 -1
- package/dist/dev/showcase/table.d.ts +0 -2
- package/dist/dev/showcase/table.d.ts.map +0 -1
- package/dist/dev/showcase/tabs.d.ts +0 -2
- package/dist/dev/showcase/tabs.d.ts.map +0 -1
- package/dist/dev/showcase/textarea.d.ts +0 -2
- package/dist/dev/showcase/textarea.d.ts.map +0 -1
- package/dist/dev/showcase/toast.d.ts +0 -2
- package/dist/dev/showcase/toast.d.ts.map +0 -1
- package/dist/dev/showcase/toggle-group.d.ts +0 -2
- package/dist/dev/showcase/toggle-group.d.ts.map +0 -1
- package/dist/dev/showcase/toggle.d.ts +0 -2
- package/dist/dev/showcase/toggle.d.ts.map +0 -1
- package/dist/dev/showcase/tooltip.d.ts +0 -2
- package/dist/dev/showcase/tooltip.d.ts.map +0 -1
- package/dist/hooks/use-controllable-state.d.ts +0 -14
- package/dist/hooks/use-controllable-state.d.ts.map +0 -1
- package/dist/hooks/use-mobile.d.ts +0 -2
- package/dist/hooks/use-mobile.d.ts.map +0 -1
- package/dist/index.cjs +0 -5099
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -58
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4753
- package/dist/index.js.map +0 -1
- package/dist/lib/types.d.ts +0 -4
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -3
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/preset.d.ts +0 -18
- package/dist/preset.d.ts.map +0 -1
- package/dist/test/setup.d.ts +0 -1
- package/dist/test/setup.d.ts.map +0 -1
- package/scripts/add-icononly-prop.ts +0 -84
- package/scripts/audit-best-practices.ts +0 -114
- package/scripts/audit-showcase.ts +0 -262
- package/scripts/audit-showcases.ts +0 -83
- package/scripts/clean-imports.ts +0 -21
- package/scripts/count_missing.ts +0 -24
- package/scripts/find-css-vars.ts +0 -62
- package/scripts/fix-portals.ts +0 -90
- package/scripts/format-codestrings.ts +0 -87
- package/scripts/full-audit.ts +0 -89
- package/scripts/merge-components.cjs +0 -65
- package/scripts/merge-components.js +0 -64
- package/scripts/optimize-barrel.ts +0 -116
- package/scripts/organize-imports.ts +0 -21
- package/scripts/refactor_divs.ts +0 -39
- package/scripts/regex-format.cjs +0 -67
- package/scripts/remove_div_wrappers.ts +0 -17
- package/scripts/tmp.tsx +0 -25
- package/scripts/update-gaps.ts +0 -83
- package/scripts/update_showcase_codestrings.ts +0 -87
package/bin/cli.js
CHANGED
|
@@ -16,6 +16,8 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
|
16
16
|
console.log(`
|
|
17
17
|
Usage:
|
|
18
18
|
npx gladvn init [destination]
|
|
19
|
+
npx gladvn add <component> [destination]
|
|
20
|
+
npx gladvn add-block <block> [destination]
|
|
19
21
|
|
|
20
22
|
Options:
|
|
21
23
|
[destination] The folder where components will be copied. Defaults to "gladvn".
|
|
@@ -26,10 +28,28 @@ Options:
|
|
|
26
28
|
|
|
27
29
|
// Find destination
|
|
28
30
|
let userDest = "gladvn";
|
|
31
|
+
let command = "init";
|
|
32
|
+
let componentToAdd = null;
|
|
29
33
|
const args = process.argv.slice(2);
|
|
30
34
|
|
|
31
35
|
if (args[0] === "init") {
|
|
32
36
|
if (args[1]) userDest = args[1];
|
|
37
|
+
} else if (args[0] === "add") {
|
|
38
|
+
command = "add";
|
|
39
|
+
if (!args[1]) {
|
|
40
|
+
console.error(`\x1b[31m✖ Please specify a component to add (e.g. npx gladvn add button)\x1b[0m`);
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
componentToAdd = args[1];
|
|
44
|
+
if (args[2]) userDest = args[2];
|
|
45
|
+
} else if (args[0] === "add-block") {
|
|
46
|
+
command = "add-block";
|
|
47
|
+
if (!args[1]) {
|
|
48
|
+
console.error(`\x1b[31m✖ Please specify a block to add (e.g. npx gladvn add-block auth)\x1b[0m`);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
componentToAdd = args[1];
|
|
52
|
+
if (args[2]) userDest = args[2];
|
|
33
53
|
} else if (args[0]) {
|
|
34
54
|
userDest = args[0];
|
|
35
55
|
}
|
|
@@ -121,178 +141,287 @@ async function selectOption(message, options) {
|
|
|
121
141
|
});
|
|
122
142
|
}
|
|
123
143
|
|
|
144
|
+
async function selectMultipleOptions(message, options) {
|
|
145
|
+
return new Promise((resolve) => {
|
|
146
|
+
let selectedIndex = 0;
|
|
147
|
+
const selected = new Set();
|
|
148
|
+
|
|
149
|
+
const render = () => {
|
|
150
|
+
process.stdout.write('\x1B[?25l');
|
|
151
|
+
readline.cursorTo(process.stdout, 0);
|
|
152
|
+
readline.clearScreenDown(process.stdout);
|
|
153
|
+
|
|
154
|
+
console.log(`\x1b[33m?\x1b[0m \x1b[1m${message}\x1b[0m \x1b[90m(Press <space> to select, <enter> to confirm)\x1b[0m`);
|
|
155
|
+
options.forEach((opt, index) => {
|
|
156
|
+
const isChecked = selected.has(index);
|
|
157
|
+
const checkbox = isChecked ? '\x1b[32m◉\x1b[0m' : '\x1b[90m◯\x1b[0m';
|
|
158
|
+
if (index === selectedIndex) {
|
|
159
|
+
console.log(` \x1b[36m❯ ${checkbox} ${opt}\x1b[0m`);
|
|
160
|
+
} else {
|
|
161
|
+
console.log(` ${checkbox} ${opt}`);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
readline.moveCursor(process.stdout, 0, -(options.length + 1));
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
render();
|
|
168
|
+
|
|
169
|
+
const onKeyPress = (str, key) => {
|
|
170
|
+
if (key.name === 'up') {
|
|
171
|
+
selectedIndex = selectedIndex > 0 ? selectedIndex - 1 : options.length - 1;
|
|
172
|
+
render();
|
|
173
|
+
} else if (key.name === 'down') {
|
|
174
|
+
selectedIndex = selectedIndex < options.length - 1 ? selectedIndex + 1 : 0;
|
|
175
|
+
render();
|
|
176
|
+
} else if (key.name === 'space') {
|
|
177
|
+
if (selected.has(selectedIndex)) {
|
|
178
|
+
selected.delete(selectedIndex);
|
|
179
|
+
} else {
|
|
180
|
+
selected.add(selectedIndex);
|
|
181
|
+
}
|
|
182
|
+
render();
|
|
183
|
+
} else if (key.name === 'return' || key.name === 'enter') {
|
|
184
|
+
cleanup();
|
|
185
|
+
const results = Array.from(selected).map(idx => options[idx]);
|
|
186
|
+
console.log(`\x1b[32m✔\x1b[0m \x1b[1m${message}\x1b[0m \x1b[90m…\x1b[0m \x1b[36m${results.length} selected\x1b[0m`);
|
|
187
|
+
resolve(results);
|
|
188
|
+
} else if (key.name === 'c' && key.ctrl) {
|
|
189
|
+
cleanup();
|
|
190
|
+
console.log('\n\x1b[31m✖ Cancelled.\x1b[0m');
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const cleanup = () => {
|
|
196
|
+
process.stdin.removeListener('keypress', onKeyPress);
|
|
197
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(false);
|
|
198
|
+
process.stdin.pause();
|
|
199
|
+
readline.moveCursor(process.stdout, 0, options.length + 1);
|
|
200
|
+
process.stdout.write('\x1B[?25h');
|
|
201
|
+
readline.moveCursor(process.stdout, 0, -(options.length + 1));
|
|
202
|
+
readline.clearScreenDown(process.stdout);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
readline.emitKeypressEvents(process.stdin);
|
|
206
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
207
|
+
process.stdin.resume();
|
|
208
|
+
process.stdin.on('keypress', onKeyPress);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
124
212
|
async function main() {
|
|
125
213
|
console.log(`\n${cyan}╔══════════════════════════════════════════════════════════════════╗${reset}`);
|
|
126
|
-
|
|
214
|
+
if (command === "add") {
|
|
215
|
+
console.log(`${cyan}║ ${bold}gladvn${reset}${cyan} — Add Component ║${reset}`);
|
|
216
|
+
} else if (command === "add-block") {
|
|
217
|
+
console.log(`${cyan}║ ${bold}gladvn${reset}${cyan} — Add Block ║${reset}`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(`${cyan}║ ${bold}gladvn${reset}${cyan} — Initialization ║${reset}`);
|
|
220
|
+
}
|
|
127
221
|
console.log(`${cyan}╚══════════════════════════════════════════════════════════════════╝${reset}\n`);
|
|
128
222
|
|
|
129
|
-
let
|
|
130
|
-
const cssFilesFull = findCssFiles(process.cwd());
|
|
131
|
-
const cssFiles = cssFilesFull.map(f => path.relative(process.cwd(), f));
|
|
132
|
-
|
|
223
|
+
let hasErrors = false;
|
|
133
224
|
const isTTY = process.stdin.isTTY;
|
|
134
225
|
|
|
135
|
-
|
|
136
|
-
|
|
226
|
+
const componentsDir = path.join(srcDir, 'components');
|
|
227
|
+
let availableComponents = [];
|
|
228
|
+
|
|
229
|
+
if (fs.existsSync(componentsDir)) {
|
|
230
|
+
const subDirs = ['micro', 'macro'];
|
|
231
|
+
for (const sub of subDirs) {
|
|
232
|
+
const subPath = path.join(componentsDir, sub);
|
|
233
|
+
if (fs.existsSync(subPath)) {
|
|
234
|
+
const files = fs.readdirSync(subPath);
|
|
235
|
+
for (const file of files) {
|
|
236
|
+
if (file.endsWith('.tsx') || file.endsWith('.ts')) {
|
|
237
|
+
availableComponents.push(`${sub}/${file}`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
const blocksDir = path.join(srcDir, 'blocks');
|
|
245
|
+
let availableBlocks = [];
|
|
246
|
+
|
|
247
|
+
if (fs.existsSync(blocksDir)) {
|
|
248
|
+
const files = fs.readdirSync(blocksDir);
|
|
249
|
+
for (const file of files) {
|
|
250
|
+
if (file.endsWith('.tsx') || file.endsWith('.ts')) {
|
|
251
|
+
availableBlocks.push(file);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (command === "add") {
|
|
257
|
+
console.log(`\x1b[36mAdding ${componentToAdd} to ${userDest}...\x1b[0m`);
|
|
258
|
+
const compMatches = availableComponents.filter(c => c.endsWith(`/${componentToAdd}.tsx`) || c.endsWith(`/${componentToAdd}.ts`));
|
|
259
|
+
if (compMatches.length === 0) {
|
|
260
|
+
console.error(`\x1b[31m✖ Component "${componentToAdd}" not found.\x1b[0m`);
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
137
263
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
264
|
+
if (!fs.existsSync(destPath)) {
|
|
265
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
266
|
+
}
|
|
267
|
+
const comp = compMatches[0];
|
|
268
|
+
const sourcePath = path.join(componentsDir, comp);
|
|
269
|
+
const targetPath = path.join(destPath, 'components', comp);
|
|
270
|
+
const targetDir = path.dirname(targetPath);
|
|
271
|
+
if (!fs.existsSync(targetDir)) {
|
|
272
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
fs.cpSync(sourcePath, targetPath, { force: true });
|
|
276
|
+
console.log(`\x1b[32m✔ Added ${comp}\x1b[0m`);
|
|
277
|
+
} catch (err) {
|
|
278
|
+
console.error(`\x1b[31m✖ Failed to add ${comp}: ${err.message}\x1b[0m`);
|
|
279
|
+
hasErrors = true;
|
|
280
|
+
}
|
|
281
|
+
} else if (command === "add-block") {
|
|
282
|
+
console.log(`\x1b[36mAdding block ${componentToAdd} to ${userDest}...\x1b[0m`);
|
|
283
|
+
const blockMatches = availableBlocks.filter(b => b === `${componentToAdd}.tsx` || b === `${componentToAdd}.ts`);
|
|
284
|
+
if (blockMatches.length === 0) {
|
|
285
|
+
console.error(`\x1b[31m✖ Block "${componentToAdd}" not found.\x1b[0m`);
|
|
286
|
+
process.exit(1);
|
|
143
287
|
}
|
|
144
288
|
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
289
|
+
if (!fs.existsSync(destPath)) {
|
|
290
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
291
|
+
}
|
|
292
|
+
const block = blockMatches[0];
|
|
293
|
+
const sourcePath = path.join(blocksDir, block);
|
|
294
|
+
const targetPath = path.join(destPath, 'blocks', block);
|
|
295
|
+
const targetDir = path.dirname(targetPath);
|
|
296
|
+
if (!fs.existsSync(targetDir)) {
|
|
297
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
298
|
+
}
|
|
299
|
+
try {
|
|
300
|
+
fs.cpSync(sourcePath, targetPath, { force: true });
|
|
301
|
+
console.log(`\x1b[32m✔ Added block ${block}\x1b[0m`);
|
|
302
|
+
} catch (err) {
|
|
303
|
+
console.error(`\x1b[31m✖ Failed to add block ${block}: ${err.message}\x1b[0m`);
|
|
304
|
+
hasErrors = true;
|
|
155
305
|
}
|
|
156
|
-
} else if (!isTTY) {
|
|
157
|
-
const rl = readline.createInterface({
|
|
158
|
-
input: process.stdin,
|
|
159
|
-
output: process.stdout,
|
|
160
|
-
});
|
|
161
|
-
const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
|
|
162
|
-
const cssFile = await ask(
|
|
163
|
-
`${yellow} 📄 Path to your main CSS file? ${dim}(default: app/globals.css)${reset}\n > `
|
|
164
|
-
);
|
|
165
|
-
targetCss = cssFile.trim() || "app/globals.css";
|
|
166
|
-
rl.close();
|
|
167
|
-
} else if (cssFiles.length === 1) {
|
|
168
|
-
targetCss = cssFiles[0];
|
|
169
|
-
console.log(`\x1b[32m✔\x1b[0m \x1b[1mFound global CSS file\x1b[0m \x1b[90m…\x1b[0m \x1b[36m${targetCss}\x1b[0m`);
|
|
170
306
|
} else {
|
|
171
|
-
//
|
|
172
|
-
targetCss =
|
|
173
|
-
|
|
307
|
+
// === INIT COMMAND ===
|
|
308
|
+
let targetCss = "app/globals.css";
|
|
309
|
+
const cssFilesFull = findCssFiles(process.cwd());
|
|
310
|
+
const cssFiles = cssFilesFull.map(f => path.relative(process.cwd(), f));
|
|
174
311
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
312
|
+
if (cssFiles.length === 0) {
|
|
313
|
+
console.log(`\x1b[33m⚠ No CSS files found in the project.\x1b[0m`);
|
|
314
|
+
|
|
315
|
+
let answer = 'y';
|
|
316
|
+
if (isTTY) {
|
|
317
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
318
|
+
answer = await new Promise((resolve) => rl.question(`${yellow}? Do you want to create a new app/globals.css file? (Y/n)${reset} `, resolve));
|
|
319
|
+
rl.close();
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (answer.trim().toLowerCase() !== 'n') {
|
|
323
|
+
targetCss = "app/globals.css";
|
|
324
|
+
const newCssPath = path.resolve(process.cwd(), targetCss);
|
|
325
|
+
if (!fs.existsSync(path.dirname(newCssPath))) {
|
|
326
|
+
fs.mkdirSync(path.dirname(newCssPath), { recursive: true });
|
|
327
|
+
}
|
|
328
|
+
fs.writeFileSync(newCssPath, `@import "tailwindcss";\n`);
|
|
329
|
+
console.log(`\x1b[32m✔\x1b[0m \x1b[1mCreated\x1b[0m \x1b[36m${targetCss}\x1b[0m`);
|
|
330
|
+
} else {
|
|
331
|
+
targetCss = null;
|
|
332
|
+
}
|
|
333
|
+
} else if (!isTTY) {
|
|
334
|
+
const rl = readline.createInterface({
|
|
335
|
+
input: process.stdin,
|
|
336
|
+
output: process.stdout,
|
|
337
|
+
});
|
|
338
|
+
const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
|
|
339
|
+
const cssFile = await ask(
|
|
340
|
+
`${yellow} 📄 Path to your main CSS file? ${dim}(default: app/globals.css)${reset}\n > `
|
|
341
|
+
);
|
|
342
|
+
targetCss = cssFile.trim() || "app/globals.css";
|
|
343
|
+
rl.close();
|
|
344
|
+
} else if (cssFiles.length === 1) {
|
|
345
|
+
targetCss = cssFiles[0];
|
|
346
|
+
console.log(`\x1b[32m✔\x1b[0m \x1b[1mFound global CSS file\x1b[0m \x1b[90m…\x1b[0m \x1b[36m${targetCss}\x1b[0m`);
|
|
347
|
+
} else {
|
|
348
|
+
targetCss = await selectOption("Which CSS file should we inject gladvn styles into?", cssFiles);
|
|
349
|
+
}
|
|
179
350
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
dirsToCopy = fs.readdirSync(srcDir).filter(item => !excludeList.includes(item));
|
|
185
|
-
}
|
|
351
|
+
let cssFilePath = null;
|
|
352
|
+
if (targetCss) {
|
|
353
|
+
cssFilePath = path.resolve(process.cwd(), targetCss);
|
|
354
|
+
}
|
|
186
355
|
|
|
187
|
-
|
|
356
|
+
// 1. Copy files
|
|
357
|
+
console.log(`\n\x1b[36mInitializing gladvn components into ${userDest}...\x1b[0m`);
|
|
188
358
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
359
|
+
if (!fs.existsSync(destPath)) {
|
|
360
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
361
|
+
}
|
|
192
362
|
|
|
193
|
-
|
|
363
|
+
// Always copy core directories
|
|
194
364
|
|
|
195
|
-
|
|
365
|
+
const coreDirs = ['hooks', 'lib', 'styles'];
|
|
366
|
+
for (const dir of coreDirs) {
|
|
196
367
|
const sourcePath = path.join(srcDir, dir);
|
|
197
368
|
const targetPath = path.join(destPath, dir);
|
|
198
|
-
|
|
199
369
|
if (fs.existsSync(sourcePath)) {
|
|
200
370
|
try {
|
|
201
371
|
fs.cpSync(sourcePath, targetPath, { recursive: true, force: true });
|
|
202
|
-
console.log(`\x1b[32m✔ Copied ${dir}\x1b[0m`);
|
|
203
372
|
} catch (err) {
|
|
204
|
-
console.error(`\x1b[31m✖ Failed to copy ${dir}/: ${err.message}\x1b[0m`);
|
|
373
|
+
console.error(`\x1b[31m✖ Failed to copy core ${dir}/: ${err.message}\x1b[0m`);
|
|
205
374
|
hasErrors = true;
|
|
206
375
|
}
|
|
207
|
-
} else {
|
|
208
|
-
console.warn(`\x1b[33m⚠ Source directory src/${dir} not found in package.\x1b[0m`);
|
|
209
376
|
}
|
|
210
377
|
}
|
|
378
|
+
console.log(`\x1b[32m✔ Copied core files (lib, hooks, styles)\x1b[0m`);
|
|
211
379
|
|
|
212
|
-
// 2. Inject CSS
|
|
380
|
+
// 2. Inject CSS
|
|
213
381
|
if (cssFilePath && fs.existsSync(cssFilePath)) {
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
let relPath = path.relative(cssDir, gladvnCssPath);
|
|
382
|
+
const cssContent = fs.readFileSync(cssFilePath, 'utf8');
|
|
383
|
+
const cssTarget = path.join(destPath, 'styles', 'gladvn.css');
|
|
384
|
+
let relPath = path.relative(path.dirname(cssFilePath), cssTarget).replace(/\\/g, '/');
|
|
219
385
|
if (!relPath.startsWith('.')) relPath = './' + relPath;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
let content = fs.readFileSync(cssFilePath, "utf8");
|
|
227
|
-
|
|
228
|
-
if (content.includes(relPath)) {
|
|
229
|
-
console.log(`\x1b[90m⏭ CSS imports already exist in ${targetCss}\x1b[0m`);
|
|
230
|
-
} else {
|
|
231
|
-
const importStatement = `@import "${tokensRelPath}";\n@import "${relPath}";`;
|
|
232
|
-
|
|
233
|
-
const tailwindPattern = /@import\s+["']tailwindcss["'];?\s*\n?/;
|
|
234
|
-
if (tailwindPattern.test(content)) {
|
|
235
|
-
content = content.replace(tailwindPattern, (match) => match + importStatement + '\n');
|
|
386
|
+
const importStmt = `@import "${relPath}";`;
|
|
387
|
+
if (!cssContent.includes(importStmt) && !cssContent.includes('gladvn.css')) {
|
|
388
|
+
if (cssContent.includes('@import "tailwindcss";')) {
|
|
389
|
+
fs.writeFileSync(cssFilePath, cssContent.replace('@import "tailwindcss";', `@import "tailwindcss";\n${importStmt}`));
|
|
390
|
+
} else if (cssContent.includes('@tailwind base;')) {
|
|
391
|
+
fs.writeFileSync(cssFilePath, cssContent.replace('@tailwind base;', `@tailwind base;\n${importStmt}`));
|
|
236
392
|
} else {
|
|
237
|
-
|
|
393
|
+
fs.writeFileSync(cssFilePath, `${importStmt}\n${cssContent}`);
|
|
238
394
|
}
|
|
239
|
-
|
|
240
|
-
fs.writeFileSync(cssFilePath, content);
|
|
241
|
-
console.log(`\x1b[32m✔ Injected CSS imports into ${targetCss}\x1b[0m`);
|
|
395
|
+
console.log(`\x1b[32m✔ Injected gladvn CSS into ${path.basename(cssFilePath)}\x1b[0m`);
|
|
242
396
|
}
|
|
243
|
-
} else if (targetCss) {
|
|
244
|
-
console.log(`\x1b[33m⚠ CSS file not found at ${targetCss}. You will need to manually import ${userDest}/styles/gladvn.css\x1b[0m`);
|
|
245
|
-
} else {
|
|
246
|
-
console.log(`\x1b[33m⚠ No CSS file configured. You will need to manually import ${userDest}/styles/gladvn.css into your project.\x1b[0m`);
|
|
247
397
|
}
|
|
248
398
|
|
|
249
|
-
//
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
fs.writeFileSync(tsconfigPath, tsContent);
|
|
268
|
-
console.log(`\x1b[32m✔ Injected @gladvn alias alongside existing @gladvn/*\x1b[0m`);
|
|
269
|
-
}
|
|
270
|
-
} else {
|
|
271
|
-
console.log(`\x1b[90m⏭ @gladvn aliases already exist in tsconfig.json\x1b[0m`);
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
const pathsRegex = /"paths"\s*:\s*\{/;
|
|
275
|
-
if (pathsRegex.test(tsContent)) {
|
|
276
|
-
tsContent = tsContent.replace(pathsRegex, `"paths": {\n "@gladvn": ["${rootAliasPath}"],\n "@gladvn/*": ["${aliasPath}"],`);
|
|
277
|
-
fs.writeFileSync(tsconfigPath, tsContent);
|
|
278
|
-
console.log(`\x1b[32m✔ Injected @gladvn alias into existing paths\x1b[0m`);
|
|
279
|
-
} else {
|
|
280
|
-
const compilerOptionsRegex = /"compilerOptions"\s*:\s*\{/;
|
|
281
|
-
if (compilerOptionsRegex.test(tsContent)) {
|
|
282
|
-
tsContent = tsContent.replace(compilerOptionsRegex, `"compilerOptions": {\n "paths": {\n "@gladvn": ["${rootAliasPath}"],\n "@gladvn/*": ["${aliasPath}"]\n },`);
|
|
283
|
-
fs.writeFileSync(tsconfigPath, tsContent);
|
|
284
|
-
console.log(`\x1b[32m✔ Injected paths object and @gladvn alias\x1b[0m`);
|
|
285
|
-
} else {
|
|
286
|
-
console.log(`\x1b[33m⚠ Could not find compilerOptions in tsconfig.json. Please add manually.\x1b[0m`);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
} else {
|
|
291
|
-
console.log(`\x1b[33m⚠ tsconfig.json not found. Please configure alias manually if desired.\x1b[0m`);
|
|
399
|
+
// 3. Configure Path Alias
|
|
400
|
+
let tsconfigPath = path.join(process.cwd(), 'tsconfig.json');
|
|
401
|
+
if (!fs.existsSync(tsconfigPath)) tsconfigPath = path.join(process.cwd(), 'jsconfig.json');
|
|
402
|
+
|
|
403
|
+
if (fs.existsSync(tsconfigPath)) {
|
|
404
|
+
let content = fs.readFileSync(tsconfigPath, 'utf8');
|
|
405
|
+
if (!content.includes('@gladvn/*')) {
|
|
406
|
+
const pathsEmptyRegex = /"paths"\s*:\s*\{\s*\}/;
|
|
407
|
+
const compilerOptionsEmptyRegex = /"compilerOptions"\s*:\s*\{\s*\}/;
|
|
408
|
+
|
|
409
|
+
if (pathsEmptyRegex.test(content)) {
|
|
410
|
+
content = content.replace(pathsEmptyRegex, `"paths": {\n "@gladvn/*": ["./${userDest}/*"]\n }`);
|
|
411
|
+
} else if (content.match(/"paths"\s*:\s*\{/)) {
|
|
412
|
+
content = content.replace(/"paths"\s*:\s*\{/, `"paths": {\n "@gladvn/*": ["./${userDest}/*"],`);
|
|
413
|
+
} else if (compilerOptionsEmptyRegex.test(content)) {
|
|
414
|
+
content = content.replace(compilerOptionsEmptyRegex, `"compilerOptions": {\n "paths": {\n "@gladvn/*": ["./${userDest}/*"]\n }\n }`);
|
|
415
|
+
} else if (content.match(/"compilerOptions"\s*:\s*\{/)) {
|
|
416
|
+
content = content.replace(/"compilerOptions"\s*:\s*\{/, `"compilerOptions": {\n "paths": {\n "@gladvn/*": ["./${userDest}/*"]\n },`);
|
|
292
417
|
}
|
|
418
|
+
fs.writeFileSync(tsconfigPath, content);
|
|
419
|
+
console.log(`\x1b[32m✔ Configured path alias @gladvn/* in ${path.basename(tsconfigPath)}\x1b[0m`);
|
|
293
420
|
}
|
|
294
421
|
}
|
|
295
422
|
|
|
423
|
+
} // END OF INIT COMMAND
|
|
424
|
+
|
|
296
425
|
// 3. Install dependencies
|
|
297
426
|
try {
|
|
298
427
|
const pkgPath = path.resolve(__dirname, "../package.json");
|
|
@@ -301,27 +430,94 @@ async function main() {
|
|
|
301
430
|
const depsObj = pkg.dependencies || {};
|
|
302
431
|
|
|
303
432
|
if (Object.keys(depsObj).length > 0) {
|
|
304
|
-
|
|
433
|
+
// Scan copied files to determine which dependencies are actually used
|
|
434
|
+
function findSourceFiles(dir, fileList = []) {
|
|
435
|
+
if (!fs.existsSync(dir)) return fileList;
|
|
436
|
+
const files = fs.readdirSync(dir);
|
|
437
|
+
for (const file of files) {
|
|
438
|
+
const filePath = path.join(dir, file);
|
|
439
|
+
const stat = fs.statSync(filePath);
|
|
440
|
+
if (stat.isDirectory()) {
|
|
441
|
+
findSourceFiles(filePath, fileList);
|
|
442
|
+
} else if (file.match(/\.(tsx?|jsx?)$/)) {
|
|
443
|
+
fileList.push(filePath);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return fileList;
|
|
447
|
+
}
|
|
305
448
|
|
|
306
|
-
|
|
307
|
-
|
|
449
|
+
const sourceFiles = findSourceFiles(destPath);
|
|
450
|
+
const usedDeps = new Set();
|
|
451
|
+
const importRegex = /(?:import(?: type)?|from|require)\s*\(?\s*['"]([^'"]+)['"]/g;
|
|
308
452
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
453
|
+
for (const file of sourceFiles) {
|
|
454
|
+
let content = fs.readFileSync(file, 'utf-8');
|
|
455
|
+
// Naively strip out comments to prevent false positive imports
|
|
456
|
+
content = content.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g, '');
|
|
457
|
+
let match;
|
|
458
|
+
while ((match = importRegex.exec(content)) !== null) {
|
|
459
|
+
const importPath = match[1];
|
|
460
|
+
// Check if the import path matches any of our dependencies
|
|
461
|
+
for (const dep of Object.keys(depsObj)) {
|
|
462
|
+
if (importPath === dep || importPath.startsWith(dep + '/')) {
|
|
463
|
+
usedDeps.add(dep);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
318
467
|
}
|
|
468
|
+
|
|
469
|
+
if (usedDeps.size > 0) {
|
|
470
|
+
// Check user's package.json to see what is already installed
|
|
471
|
+
const userPkgPath = path.resolve(process.cwd(), 'package.json');
|
|
472
|
+
let userDeps = {};
|
|
473
|
+
if (fs.existsSync(userPkgPath)) {
|
|
474
|
+
try {
|
|
475
|
+
const userPkg = JSON.parse(fs.readFileSync(userPkgPath, 'utf8'));
|
|
476
|
+
userDeps = { ...userPkg.dependencies, ...userPkg.devDependencies };
|
|
477
|
+
} catch (e) {}
|
|
478
|
+
}
|
|
319
479
|
|
|
320
|
-
|
|
480
|
+
const depsToInstall = [];
|
|
481
|
+
for (const dep of usedDeps) {
|
|
482
|
+
if (!userDeps[dep]) {
|
|
483
|
+
depsToInstall.push(`${dep}@"${depsObj[dep]}"`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
321
486
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
487
|
+
if (depsToInstall.length > 0) {
|
|
488
|
+
let pm = "npm";
|
|
489
|
+
let installCmd = "install";
|
|
490
|
+
|
|
491
|
+
function hasLockfile(name) {
|
|
492
|
+
let dir = process.cwd();
|
|
493
|
+
while (true) {
|
|
494
|
+
if (fs.existsSync(path.join(dir, name))) return true;
|
|
495
|
+
const parent = path.dirname(dir);
|
|
496
|
+
if (parent === dir) return false;
|
|
497
|
+
dir = parent;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if (hasLockfile("pnpm-lock.yaml")) {
|
|
502
|
+
pm = "pnpm";
|
|
503
|
+
installCmd = "add";
|
|
504
|
+
} else if (hasLockfile("yarn.lock")) {
|
|
505
|
+
pm = "yarn";
|
|
506
|
+
installCmd = "add";
|
|
507
|
+
} else if (hasLockfile("bun.lockb")) {
|
|
508
|
+
pm = "bun";
|
|
509
|
+
installCmd = "add";
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
const fullCmd = `${pm} ${installCmd} ${depsToInstall.join(" ")}`;
|
|
513
|
+
|
|
514
|
+
console.log(`\n\x1b[36mInstalling missing dependencies using ${pm}...\x1b[0m`);
|
|
515
|
+
execSync(fullCmd, { stdio: "inherit", cwd: process.cwd() });
|
|
516
|
+
console.log(`\x1b[32m✔ Dependencies installed successfully!\x1b[0m`);
|
|
517
|
+
} else {
|
|
518
|
+
console.log(`\n\x1b[90m⏭ All required dependencies are already installed.\x1b[0m`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
325
521
|
}
|
|
326
522
|
} catch (err) {
|
|
327
523
|
console.error(`\x1b[31m✖ Failed to install dependencies: ${err.message}\x1b[0m`);
|
|
@@ -329,7 +525,13 @@ async function main() {
|
|
|
329
525
|
}
|
|
330
526
|
|
|
331
527
|
if (!hasErrors) {
|
|
332
|
-
|
|
528
|
+
if (command === "add") {
|
|
529
|
+
console.log(`\n\x1b[32m✨ Successfully added ${componentToAdd}!\x1b[0m`);
|
|
530
|
+
} else if (command === "add-block") {
|
|
531
|
+
console.log(`\n\x1b[32m✨ Successfully added block ${componentToAdd}!\x1b[0m`);
|
|
532
|
+
} else {
|
|
533
|
+
console.log(`\n\x1b[32m✨ Successfully initialized gladvn files in ${userDest}!\x1b[0m`);
|
|
534
|
+
}
|
|
333
535
|
}
|
|
334
536
|
}
|
|
335
537
|
|
package/llms.txt
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
You are an AI Coding Assistant helping a developer use the `gladvn` UI library.
|
|
4
4
|
`gladvn` is a React component library built on top of Radix UI and Tailwind CSS, focusing on beautiful, accessible, and highly composable components.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
### Installation
|
|
7
|
+
- Use `npx gladvn init` to scaffold components into a project.
|
|
8
|
+
- **NEVER** use `npm install gladvn`. The components are copied directly into the project's source code, typically under a `@gladvn/` alias (e.g., `src/gladvn/`).
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
- **
|
|
10
|
-
`import { Button
|
|
11
|
-
-
|
|
10
|
+
### Import Guidelines
|
|
11
|
+
- **ALWAYS** import components using the local alias path.
|
|
12
|
+
- Correct: `import { Button } from "@/gladvn/components/micro/button"` or `import { Button } from "@gladvn/components/micro/button"` (depending on the project's setup).
|
|
13
|
+
- Incorrect: `import { Button } from "gladvn"`
|
|
12
14
|
|
|
13
15
|
## 2. Composition over Configuration
|
|
14
16
|
`gladvn` heavily uses a composable architecture. When building complex UI, always use the provided sub-components rather than passing large configuration objects.
|