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/scripts/find-css-vars.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
const SRC_DIR = path.join(process.cwd(), "src/components");
|
|
5
|
-
|
|
6
|
-
function walkDir(dir: string, callback: (filePath: string) => void) {
|
|
7
|
-
const files = fs.readdirSync(dir);
|
|
8
|
-
for (const file of files) {
|
|
9
|
-
const fullPath = path.join(dir, file);
|
|
10
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
11
|
-
walkDir(fullPath, callback);
|
|
12
|
-
} else if (fullPath.endsWith(".tsx") || fullPath.endsWith(".ts")) {
|
|
13
|
-
callback(fullPath);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const defRegex = /\[--([a-zA-Z0-9_-]+):([^\]]+)\]/g;
|
|
19
|
-
const usageRegex =
|
|
20
|
-
/(w|h|size|rounded|p|m|gap|space-[xy]|top|bottom|left|right)-\(--([a-zA-Z0-9_-]+)\)/g;
|
|
21
|
-
const genericUsageRegex = /var\(--([a-zA-Z0-9_-]+)\)/g;
|
|
22
|
-
|
|
23
|
-
const results: Record<string, { defs: Set<string>; usages: Set<string> }> = {};
|
|
24
|
-
|
|
25
|
-
walkDir(SRC_DIR, (filePath) => {
|
|
26
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
27
|
-
let match;
|
|
28
|
-
|
|
29
|
-
const relPath = path.relative(process.cwd(), filePath);
|
|
30
|
-
|
|
31
|
-
while ((match = defRegex.exec(content)) !== null) {
|
|
32
|
-
if (!results[relPath])
|
|
33
|
-
results[relPath] = { defs: new Set(), usages: new Set() };
|
|
34
|
-
results[relPath].defs.add(`--${match[1]}: ${match[2]}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
while ((match = usageRegex.exec(content)) !== null) {
|
|
38
|
-
if (!results[relPath])
|
|
39
|
-
results[relPath] = { defs: new Set(), usages: new Set() };
|
|
40
|
-
results[relPath].usages.add(`${match[1]}-(--${match[2]})`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
while ((match = genericUsageRegex.exec(content)) !== null) {
|
|
44
|
-
// Avoid double counting if it's already caught by defRegex
|
|
45
|
-
if (!results[relPath])
|
|
46
|
-
results[relPath] = { defs: new Set(), usages: new Set() };
|
|
47
|
-
results[relPath].usages.add(`var(--${match[1]})`);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
for (const [file, data] of Object.entries(results)) {
|
|
52
|
-
if (data.defs.size === 0 && data.usages.size === 0) continue;
|
|
53
|
-
console.log(`\nFile: ${file}`);
|
|
54
|
-
if (data.defs.size > 0) {
|
|
55
|
-
console.log(` Definitions:`);
|
|
56
|
-
for (const def of data.defs) console.log(` - ${def}`);
|
|
57
|
-
}
|
|
58
|
-
if (data.usages.size > 0) {
|
|
59
|
-
console.log(` Usages:`);
|
|
60
|
-
for (const usage of data.usages) console.log(` - ${usage}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
package/scripts/fix-portals.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Project, SyntaxKind, JsxElement } from "ts-morph";
|
|
2
|
-
|
|
3
|
-
const project = new Project({ tsConfigFilePath: "./tsconfig.json" });
|
|
4
|
-
const sourceFiles = [
|
|
5
|
-
...project.addSourceFilesAtPaths("src/dev/showcase/**/*.tsx"),
|
|
6
|
-
...project.addSourceFilesAtPaths("src/components/macro/**/*.tsx")
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
const map: Record<string, string> = {
|
|
10
|
-
"DropdownMenuContent": "DropdownMenuPortal",
|
|
11
|
-
"SelectContent": "SelectPortal",
|
|
12
|
-
"PopoverContent": "PopoverPortal",
|
|
13
|
-
"HoverCardContent": "HoverCardPortal",
|
|
14
|
-
"TooltipContent": "TooltipPortal",
|
|
15
|
-
"DialogContent": "DialogPortal",
|
|
16
|
-
"AlertDialogContent": "AlertDialogPortal",
|
|
17
|
-
"ContextMenuContent": "ContextMenuPortal",
|
|
18
|
-
"MenubarContent": "MenubarPortal",
|
|
19
|
-
"ComboboxContent": "ComboboxPortal"
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
for (const sf of sourceFiles) {
|
|
23
|
-
let changed = false;
|
|
24
|
-
|
|
25
|
-
// We loop until no more elements need wrapping to avoid AST node invalidation errors
|
|
26
|
-
let needsMoreWork = true;
|
|
27
|
-
while (needsMoreWork) {
|
|
28
|
-
needsMoreWork = false;
|
|
29
|
-
const elements = sf.getDescendantsOfKind(SyntaxKind.JsxElement);
|
|
30
|
-
|
|
31
|
-
for (const element of elements) {
|
|
32
|
-
// Check if it's already been deleted/replaced
|
|
33
|
-
if (element.wasForgotten()) continue;
|
|
34
|
-
|
|
35
|
-
const openingEl = element.getOpeningElement();
|
|
36
|
-
const tagName = openingEl.getTagNameNode().getText();
|
|
37
|
-
|
|
38
|
-
if (map[tagName]) {
|
|
39
|
-
const portalName = map[tagName];
|
|
40
|
-
const parent = element.getParent();
|
|
41
|
-
|
|
42
|
-
let needsWrap = true;
|
|
43
|
-
if (parent && parent.getKind() === SyntaxKind.JsxElement) {
|
|
44
|
-
const parentOpening = (parent as JsxElement).getOpeningElement().getTagNameNode().getText();
|
|
45
|
-
if (parentOpening === portalName || parentOpening === "ThemeWrapper") {
|
|
46
|
-
needsWrap = false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (needsWrap) {
|
|
51
|
-
element.replaceWithText(`<${portalName}>\n${element.getText()}\n</${portalName}>`);
|
|
52
|
-
changed = true;
|
|
53
|
-
needsMoreWork = true;
|
|
54
|
-
break; // Break the for loop and restart traversal on fresh AST
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Ensure imports are correct
|
|
61
|
-
if (changed) {
|
|
62
|
-
const importDecls = sf.getImportDeclarations();
|
|
63
|
-
// Gather all tags we need imports for in this file
|
|
64
|
-
const tagsInFile = new Set<string>();
|
|
65
|
-
sf.getDescendantsOfKind(SyntaxKind.JsxOpeningElement).forEach(el => {
|
|
66
|
-
const name = el.getTagNameNode().getText();
|
|
67
|
-
if (Object.values(map).includes(name)) tagsInFile.add(name);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
for (const portalName of tagsInFile) {
|
|
71
|
-
// Find the import declaration for this micro component
|
|
72
|
-
const primitiveName = portalName.replace('Portal', '').toLowerCase()
|
|
73
|
-
.replace('dropdownmenu', 'dropdown-menu')
|
|
74
|
-
.replace('alertdialog', 'alert-dialog')
|
|
75
|
-
.replace('hovercard', 'hover-card')
|
|
76
|
-
.replace('contextmenu', 'context-menu');
|
|
77
|
-
|
|
78
|
-
const matchingImport = importDecls.find(imp => imp.getModuleSpecifierValue().includes(`components/micro/${primitiveName}`));
|
|
79
|
-
if (matchingImport) {
|
|
80
|
-
const namedImports = matchingImport.getNamedImports();
|
|
81
|
-
if (!namedImports.some(n => n.getName() === portalName)) {
|
|
82
|
-
matchingImport.addNamedImport(portalName);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
sf.saveSync();
|
|
88
|
-
console.log("Fixed missing portals in", sf.getBaseName());
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Project, SyntaxKind, JsxAttribute, StringLiteral, NoSubstitutionTemplateLiteral } from "ts-morph";
|
|
2
|
-
import * as prettier from "prettier";
|
|
3
|
-
import path from "path";
|
|
4
|
-
import fs from "fs";
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
const project = new Project({
|
|
8
|
-
tsConfigFilePath: "tsconfig.json",
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const sourceFiles = project.getSourceFiles("src/dev/showcase/**/*.tsx");
|
|
12
|
-
console.log(`Found ${sourceFiles.length} showcase files to process.`);
|
|
13
|
-
|
|
14
|
-
let modifiedCount = 0;
|
|
15
|
-
|
|
16
|
-
for (const sourceFile of sourceFiles) {
|
|
17
|
-
let fileModified = false;
|
|
18
|
-
|
|
19
|
-
// Find all JSX attributes named 'codeString'
|
|
20
|
-
const jsxAttributes = sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute);
|
|
21
|
-
|
|
22
|
-
for (const attr of jsxAttributes) {
|
|
23
|
-
if (attr.asKind(SyntaxKind.JsxAttribute)?.getNameNode().getText() !== "codeString") continue;
|
|
24
|
-
|
|
25
|
-
const initializer = attr.asKind(SyntaxKind.JsxAttribute)?.getInitializer();
|
|
26
|
-
if (!initializer) continue;
|
|
27
|
-
|
|
28
|
-
let rawText = "";
|
|
29
|
-
|
|
30
|
-
// It can be a StringLiteral `<Example codeString="<div/>" />`
|
|
31
|
-
if (initializer.isKind(SyntaxKind.StringLiteral)) {
|
|
32
|
-
rawText = (initializer as StringLiteral).getLiteralText();
|
|
33
|
-
}
|
|
34
|
-
// Or a JSX Expression with a template literal `<Example codeString={`<div/>`} />`
|
|
35
|
-
else if (initializer.isKind(SyntaxKind.JsxExpression)) {
|
|
36
|
-
const expression = initializer.getExpression();
|
|
37
|
-
if (expression && expression.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)) {
|
|
38
|
-
rawText = (expression as NoSubstitutionTemplateLiteral).getLiteralText();
|
|
39
|
-
} else if (expression && expression.isKind(SyntaxKind.StringLiteral)) {
|
|
40
|
-
rawText = (expression as StringLiteral).getLiteralText();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!rawText) continue;
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
// Wrap in fragment to allow adjacent JSX elements to be parsed by prettier
|
|
48
|
-
const wrappedText = `<>\n${rawText}\n</>`;
|
|
49
|
-
|
|
50
|
-
// Format the wrappedText as JSX/TSX
|
|
51
|
-
let formatted = await prettier.format(wrappedText, {
|
|
52
|
-
parser: "babel-ts",
|
|
53
|
-
printWidth: 60,
|
|
54
|
-
tabWidth: 2,
|
|
55
|
-
semi: false,
|
|
56
|
-
singleQuote: false,
|
|
57
|
-
trailingComma: "all"
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// Remove the wrapping fragment (including any leading semicolons injected by prettier) and trim
|
|
61
|
-
formatted = formatted.replace(/^;?\s*<>\n?/, "").replace(/\n?<\/>;?\s*$/, "").trim();
|
|
62
|
-
|
|
63
|
-
if (formatted !== rawText.trim()) {
|
|
64
|
-
// Replace the initializer with the new formatted template literal
|
|
65
|
-
// Note: we use JSON.stringify or manual escaping if needed, but since it's a template literal
|
|
66
|
-
// we need to escape backticks and ${
|
|
67
|
-
const escaped = formatted.replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
|
|
68
|
-
attr.setInitializer(`{\`${escaped}\`}`);
|
|
69
|
-
fileModified = true;
|
|
70
|
-
}
|
|
71
|
-
} catch (err) {
|
|
72
|
-
console.error(`Failed to format codeString in ${sourceFile.getFilePath()} at line ${attr.getStartLineNumber()}`);
|
|
73
|
-
console.error(err);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (fileModified) {
|
|
78
|
-
sourceFile.saveSync();
|
|
79
|
-
modifiedCount++;
|
|
80
|
-
console.log(`Modified ${sourceFile.getBaseName()}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
console.log(`Successfully formatted codeStrings in ${modifiedCount} files.`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
main().catch(console.error);
|
package/scripts/full-audit.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import * as fs from "fs";
|
|
2
|
-
import * as path from "path";
|
|
3
|
-
|
|
4
|
-
const SRC_DIR = path.join(process.cwd(), "src/components");
|
|
5
|
-
|
|
6
|
-
function walkDir(dir: string, callback: (filePath: string) => void) {
|
|
7
|
-
const files = fs.readdirSync(dir);
|
|
8
|
-
for (const file of files) {
|
|
9
|
-
const fullPath = path.join(dir, file);
|
|
10
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
11
|
-
walkDir(fullPath, callback);
|
|
12
|
-
} else if (fullPath.endsWith(".tsx") || fullPath.endsWith(".ts")) {
|
|
13
|
-
callback(fullPath);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const results: Record<string, string[]> = {};
|
|
19
|
-
|
|
20
|
-
function addIssue(file: string, issue: string) {
|
|
21
|
-
const relPath = path.relative(process.cwd(), file);
|
|
22
|
-
if (!results[relPath]) results[relPath] = [];
|
|
23
|
-
results[relPath].push(issue);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
walkDir(SRC_DIR, (filePath) => {
|
|
27
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
28
|
-
|
|
29
|
-
// 1. Magic CSS Violations
|
|
30
|
-
if (/\[&_[a-zA-Z0-9]+\]/.test(content)) {
|
|
31
|
-
addIssue(
|
|
32
|
-
filePath,
|
|
33
|
-
"Magic CSS: Uses raw HTML tag descendant selectors (e.g. [&_div]) instead of data-slots.",
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
if (/has-\[/.test(content)) {
|
|
37
|
-
addIssue(
|
|
38
|
-
filePath,
|
|
39
|
-
"Magic CSS: Uses :has() combinator which may be fragile for encapsulation.",
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
if (/\*:/g.test(content)) {
|
|
43
|
-
addIssue(
|
|
44
|
-
filePath,
|
|
45
|
-
"Magic CSS: Uses universal selector (*:) which breaks encapsulation.",
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// 2. React Antipatterns
|
|
50
|
-
if (
|
|
51
|
-
/\.map\([^,]+,\s*(?:index|i)\s*\)\s*=>\s*[\s\S]*?key=\{?(?:index|i)\}?/m.test(
|
|
52
|
-
content,
|
|
53
|
-
)
|
|
54
|
-
) {
|
|
55
|
-
addIssue(filePath, "React: Uses array index as key in map().");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// 3. String manipulation Edge Cases
|
|
59
|
-
if (/\.substring\(/.test(content) || /\.charAt\(/.test(content)) {
|
|
60
|
-
addIssue(
|
|
61
|
-
filePath,
|
|
62
|
-
"Edge Case: Uses charAt or substring which breaks on Emojis/Surrogate pairs.",
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// 4. Props / Architecture
|
|
67
|
-
if (filePath.includes("micro") && content.includes("useState(")) {
|
|
68
|
-
addIssue(
|
|
69
|
-
filePath,
|
|
70
|
-
"Architecture: Micro component contains local state (useState). Micro components should generally be stateless wrappers.",
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
filePath.includes("macro") &&
|
|
76
|
-
content.includes("forwardRef") &&
|
|
77
|
-
!content.includes("asChild") &&
|
|
78
|
-
!content.includes("render=")
|
|
79
|
-
) {
|
|
80
|
-
// Just a heuristic, not always a bug.
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
for (const [file, issues] of Object.entries(results)) {
|
|
85
|
-
console.log(`\nFile: ${file}`);
|
|
86
|
-
for (const issue of issues) {
|
|
87
|
-
console.log(` - ${issue}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
const dataTsPath = path.resolve(__dirname, "../src/dev/data.ts");
|
|
5
|
-
let content = fs.readFileSync(dataTsPath, "utf8");
|
|
6
|
-
|
|
7
|
-
// Match MICRO_COMPONENTS array
|
|
8
|
-
const microMatch = content.match(
|
|
9
|
-
/export const MICRO_COMPONENTS = (\[[\s\S]*?\]);/,
|
|
10
|
-
);
|
|
11
|
-
// Match MACRO_COMPONENTS array
|
|
12
|
-
const macroMatch = content.match(
|
|
13
|
-
/export const MACRO_COMPONENTS = (\[[\s\S]*?\]);/,
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
if (!microMatch || !macroMatch) {
|
|
17
|
-
console.error("Could not find arrays");
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Safely evaluate arrays (since they only contain static objects)
|
|
22
|
-
const micro = eval(microMatch[1]);
|
|
23
|
-
const macro = eval(macroMatch[1]);
|
|
24
|
-
|
|
25
|
-
const componentMap = new Map();
|
|
26
|
-
|
|
27
|
-
micro.forEach((c) => {
|
|
28
|
-
componentMap.set(c.id, {
|
|
29
|
-
id: c.id,
|
|
30
|
-
label: c.label,
|
|
31
|
-
hasMicro: true,
|
|
32
|
-
hasMacro: false,
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
macro.forEach((c) => {
|
|
37
|
-
const baseId = c.id.replace("macro-", "");
|
|
38
|
-
if (componentMap.has(baseId)) {
|
|
39
|
-
componentMap.get(baseId).hasMacro = true;
|
|
40
|
-
} else {
|
|
41
|
-
componentMap.set(baseId, {
|
|
42
|
-
id: baseId,
|
|
43
|
-
label: c.label,
|
|
44
|
-
hasMicro: false,
|
|
45
|
-
hasMacro: true,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const merged = Array.from(componentMap.values()).sort((a, b) =>
|
|
51
|
-
a.label.localeCompare(b.label),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
let output = "export const COMPONENTS = [\n";
|
|
55
|
-
merged.forEach((c) => {
|
|
56
|
-
output += ` { id: "${c.id}", label: "${c.label}", hasMicro: ${c.hasMicro}, hasMacro: ${c.hasMacro} },\n`;
|
|
57
|
-
});
|
|
58
|
-
output += "];\n";
|
|
59
|
-
|
|
60
|
-
// Replace in content
|
|
61
|
-
content = content.replace(microMatch[0], output);
|
|
62
|
-
content = content.replace(macroMatch[0], ""); // Remove MACRO_COMPONENTS
|
|
63
|
-
|
|
64
|
-
fs.writeFileSync(dataTsPath, content);
|
|
65
|
-
console.log("Merged data.ts successfully.");
|
|
@@ -1,64 +0,0 @@
|
|
|
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.");
|
|
@@ -1,116 +0,0 @@
|
|
|
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
|
-
);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Project } from "ts-morph";
|
|
2
|
-
|
|
3
|
-
const project = new Project({
|
|
4
|
-
tsConfigFilePath: "tsconfig.json",
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
const files = project.getSourceFiles("src/**/*.{ts,tsx}");
|
|
8
|
-
console.log(`Found ${files.length} files. Organizing imports...`);
|
|
9
|
-
|
|
10
|
-
let updatedCount = 0;
|
|
11
|
-
|
|
12
|
-
for (const file of files) {
|
|
13
|
-
const originalText = file.getFullText();
|
|
14
|
-
file.organizeImports();
|
|
15
|
-
if (file.getFullText() !== originalText) {
|
|
16
|
-
updatedCount++;
|
|
17
|
-
await file.save();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
console.log(`Done! Organized imports in ${updatedCount} files.`);
|
package/scripts/refactor_divs.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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}`);
|