@shohojdhara/atomix 0.3.3 ā 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -28
- package/dist/atomix.css +15 -9
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15108 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6482 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3357 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2450 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4550 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5196 -4618
- package/dist/index.esm.js +4240 -2776
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4057 -2571
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +1992 -0
- package/dist/theme.js +5348 -0
- package/dist/theme.js.map +1 -0
- package/package.json +63 -68
- package/scripts/atomix-cli.js +879 -15
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +37 -45
- package/scripts/cli/theme-bridge.js +129 -0
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/scripts/sync-theme-config.js +22 -22
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Button/Button.tsx +36 -1
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -17
- package/src/components/Chart/AreaChart.tsx +5 -1
- package/src/components/Chart/BarChart.tsx +1 -0
- package/src/components/Chart/BubbleChart.tsx +6 -5
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/FunnelChart.tsx +1 -1
- package/src/components/Chart/RadarChart.tsx +19 -12
- package/src/components/Chart/ScatterChart.tsx +3 -3
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/List/List.stories.tsx +3 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Pagination/Pagination.tsx +6 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/index.ts +5 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/index.ts +275 -0
- package/src/lib/config/loader.ts +147 -0
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +10 -14
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/composeTheme.ts +1 -6
- package/src/lib/theme/config/index.ts +1 -1
- package/src/lib/theme/config/loader.ts +75 -41
- package/src/lib/theme/config/types.ts +21 -7
- package/src/lib/theme/config/validator.ts +1 -1
- package/src/lib/theme/constants.ts +12 -2
- package/src/lib/theme/core/ThemeEngine.ts +8 -0
- package/src/lib/theme/core/ThemeValidator.ts +5 -2
- package/src/lib/theme/createTheme.ts +0 -1
- package/src/lib/theme/createThemeFromConfig.ts +132 -0
- package/src/lib/theme/devtools/CLI.ts +161 -76
- package/src/lib/theme/devtools/Comparator.tsx +343 -0
- package/src/lib/theme/devtools/IMPROVEMENTS.md +429 -0
- package/src/lib/theme/devtools/Inspector.tsx +22 -7
- package/src/lib/theme/devtools/LiveEditor.tsx +399 -0
- package/src/lib/theme/devtools/README.md +433 -0
- package/src/lib/theme/devtools/index.ts +12 -11
- package/src/lib/theme/generateCSSVariables.ts +80 -39
- package/src/lib/theme/i18n/rtl.ts +2 -1
- package/src/lib/theme/index.ts +18 -2
- package/src/lib/theme/runtime/ThemeApplicator.ts +28 -11
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +3 -3
- package/src/lib/theme/runtime/ThemeManager.test.ts +17 -1
- package/src/lib/theme/runtime/ThemeManager.ts +11 -7
- package/src/lib/theme/types.ts +42 -43
- package/src/lib/theme-tools.ts +8 -68
- package/src/lib/types/components.ts +252 -109
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/03-generic/_generated-root.css +26 -0
- package/src/styles/06-components/_components.navbar.scss +6 -5
- package/src/themes/README.md +1 -2
- package/src/themes/themes.config.js +30 -181
- package/dist/themes/applemix.css +0 -16576
- package/dist/themes/applemix.css.map +0 -1
- package/dist/themes/applemix.min.css +0 -73
- package/dist/themes/boomdevs.css +0 -16007
- package/dist/themes/boomdevs.css.map +0 -1
- package/dist/themes/boomdevs.min.css +0 -406
- package/dist/themes/esrar.css +0 -18424
- package/dist/themes/esrar.css.map +0 -1
- package/dist/themes/esrar.min.css +0 -221
- package/dist/themes/flashtrade.css +0 -17596
- package/dist/themes/flashtrade.css.map +0 -1
- package/dist/themes/flashtrade.min.css +0 -196
- package/dist/themes/mashroom.css +0 -31082
- package/dist/themes/mashroom.css.map +0 -1
- package/dist/themes/mashroom.min.css +0 -450
- package/dist/themes/shaj-default.css +0 -17200
- package/dist/themes/shaj-default.css.map +0 -1
- package/dist/themes/shaj-default.min.css +0 -502
- package/scripts/build-themes.js +0 -208
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
- package/src/lib/theme/__tests__/ThemeBuilder.test.ts +0 -223
- package/src/lib/theme/builders/ThemeBuilder.ts +0 -372
- package/src/lib/theme/errors.test.ts +0 -207
- package/src/lib/theme/generators/CSSGenerator.ts +0 -311
- package/src/lib/theme/generators/ConfigGenerator.ts +0 -287
- package/src/lib/theme/generators/TypeGenerator.ts +0 -228
- package/src/lib/theme/generators/index.ts +0 -21
- package/src/lib/theme/monitoring/ThemeAnalytics.ts +0 -409
- package/src/lib/theme/monitoring/index.ts +0 -17
- package/src/lib/theme/overrides/ComponentOverrides.ts +0 -243
- package/src/lib/theme/overrides/index.ts +0 -15
- package/src/lib/theme/whitelabel/WhiteLabelManager.ts +0 -364
- package/src/lib/theme/whitelabel/index.ts +0 -13
- package/src/themes/THEME_CHECKLIST.md +0 -74
- package/src/themes/applemix/01-settings/_index.scss +0 -24
- package/src/themes/applemix/01-settings/_settings.animations.scss +0 -0
- package/src/themes/applemix/01-settings/_settings.background.scss +0 -6
- package/src/themes/applemix/01-settings/_settings.colors.scss +0 -75
- package/src/themes/applemix/01-settings/_settings.config.scss +0 -15
- package/src/themes/applemix/01-settings/_settings.typography.scss +0 -30
- package/src/themes/applemix/02-tools/_index.scss +0 -4
- package/src/themes/applemix/03-generic/_index.scss +0 -7
- package/src/themes/applemix/04-elements/_index.scss +0 -7
- package/src/themes/applemix/05-objects/_index.scss +0 -7
- package/src/themes/applemix/06-components/_index.scss +0 -15
- package/src/themes/applemix/99-utilities/_index.scss +0 -7
- package/src/themes/applemix/README.md +0 -378
- package/src/themes/applemix/index.scss +0 -33
- package/src/themes/boomdevs/01-settings/_index.scss +0 -38
- package/src/themes/boomdevs/01-settings/_settings.accordion.scss +0 -12
- package/src/themes/boomdevs/01-settings/_settings.animations.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.avatar.scss +0 -9
- package/src/themes/boomdevs/01-settings/_settings.badge.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.border-radius.scss +0 -16
- package/src/themes/boomdevs/01-settings/_settings.border.scss +0 -10
- package/src/themes/boomdevs/01-settings/_settings.box-shadow.scss +0 -14
- package/src/themes/boomdevs/01-settings/_settings.breadcrumb.scss +0 -13
- package/src/themes/boomdevs/01-settings/_settings.breakpoints.scss +0 -15
- package/src/themes/boomdevs/01-settings/_settings.button.scss +0 -9
- package/src/themes/boomdevs/01-settings/_settings.callout.scss +0 -9
- package/src/themes/boomdevs/01-settings/_settings.card.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.checkbox.scss +0 -9
- package/src/themes/boomdevs/01-settings/_settings.colors.scss +0 -145
- package/src/themes/boomdevs/01-settings/_settings.dropdown.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.grid.scss +0 -16
- package/src/themes/boomdevs/01-settings/_settings.input.scss +0 -14
- package/src/themes/boomdevs/01-settings/_settings.link.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.list.scss +0 -10
- package/src/themes/boomdevs/01-settings/_settings.modal.scss +0 -16
- package/src/themes/boomdevs/01-settings/_settings.navbar.scss +0 -16
- package/src/themes/boomdevs/01-settings/_settings.pagination.scss +0 -13
- package/src/themes/boomdevs/01-settings/_settings.progress.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.rating.scss +0 -10
- package/src/themes/boomdevs/01-settings/_settings.spacing.scss +0 -33
- package/src/themes/boomdevs/01-settings/_settings.spinner.scss +0 -11
- package/src/themes/boomdevs/01-settings/_settings.steps.scss +0 -12
- package/src/themes/boomdevs/01-settings/_settings.tabs.scss +0 -12
- package/src/themes/boomdevs/01-settings/_settings.todo.scss +0 -15
- package/src/themes/boomdevs/01-settings/_settings.toggle.scss +0 -14
- package/src/themes/boomdevs/01-settings/_settings.tooltip.scss +0 -13
- package/src/themes/boomdevs/01-settings/_settings.typography.scss +0 -58
- package/src/themes/boomdevs/01-settings/_settings.video-player.scss +0 -12
- package/src/themes/boomdevs/02-tools/_index.scss +0 -7
- package/src/themes/boomdevs/03-generic/_index.scss +0 -7
- package/src/themes/boomdevs/04-elements/_index.scss +0 -7
- package/src/themes/boomdevs/05-objects/_index.scss +0 -7
- package/src/themes/boomdevs/06-components/_components.button.scss +0 -11
- package/src/themes/boomdevs/06-components/_index.scss +0 -11
- package/src/themes/boomdevs/99-utilities/_index.scss +0 -7
- package/src/themes/boomdevs/index.scss +0 -26
- package/src/themes/esrar/01-settings/_index.scss +0 -15
- package/src/themes/esrar/01-settings/_settings.colors.scss +0 -91
- package/src/themes/esrar/02-tools/_index.scss +0 -8
- package/src/themes/esrar/02-tools/_tools.animations.scss +0 -342
- package/src/themes/esrar/06-components/_components.accordion.scss +0 -49
- package/src/themes/esrar/06-components/_components.avatar-group.scss +0 -14
- package/src/themes/esrar/06-components/_components.avatar.scss +0 -61
- package/src/themes/esrar/06-components/_components.badge.scss +0 -117
- package/src/themes/esrar/06-components/_components.breadcrumb.scss +0 -65
- package/src/themes/esrar/06-components/_components.btn-group.scss +0 -19
- package/src/themes/esrar/06-components/_components.button.scss +0 -224
- package/src/themes/esrar/06-components/_components.callout.scss +0 -51
- package/src/themes/esrar/06-components/_components.card.scss +0 -134
- package/src/themes/esrar/06-components/_components.chart.scss +0 -24
- package/src/themes/esrar/06-components/_components.checkbox-group.scss +0 -26
- package/src/themes/esrar/06-components/_components.checkbox.scss +0 -71
- package/src/themes/esrar/06-components/_components.color-mode-toggle.scss +0 -29
- package/src/themes/esrar/06-components/_components.countdown.scss +0 -67
- package/src/themes/esrar/06-components/_components.data-table.scss +0 -22
- package/src/themes/esrar/06-components/_components.datepicker.scss +0 -20
- package/src/themes/esrar/06-components/_components.dropdown.scss +0 -272
- package/src/themes/esrar/06-components/_components.edge-panel.scss +0 -10
- package/src/themes/esrar/06-components/_components.form-group.scss +0 -15
- package/src/themes/esrar/06-components/_components.form.scss +0 -66
- package/src/themes/esrar/06-components/_components.hero.scss +0 -251
- package/src/themes/esrar/06-components/_components.icon.scss +0 -33
- package/src/themes/esrar/06-components/_components.image-gallery.scss +0 -29
- package/src/themes/esrar/06-components/_components.input.scss +0 -91
- package/src/themes/esrar/06-components/_components.list-group.scss +0 -26
- package/src/themes/esrar/06-components/_components.modal.scss +0 -148
- package/src/themes/esrar/06-components/_components.notification.scss +0 -80
- package/src/themes/esrar/06-components/_components.pagination.scss +0 -84
- package/src/themes/esrar/06-components/_components.popover.scss +0 -10
- package/src/themes/esrar/06-components/_components.progress.scss +0 -64
- package/src/themes/esrar/06-components/_components.rating.scss +0 -26
- package/src/themes/esrar/06-components/_components.skeleton.scss +0 -15
- package/src/themes/esrar/06-components/_components.slider.scss +0 -90
- package/src/themes/esrar/06-components/_components.spinner.scss +0 -71
- package/src/themes/esrar/06-components/_components.steps.scss +0 -76
- package/src/themes/esrar/06-components/_components.tab.scss +0 -58
- package/src/themes/esrar/06-components/_components.tag.scss +0 -21
- package/src/themes/esrar/06-components/_components.timeline.scss +0 -19
- package/src/themes/esrar/06-components/_components.toast.scss +0 -91
- package/src/themes/esrar/06-components/_components.toggle.scss +0 -74
- package/src/themes/esrar/06-components/_components.tooltip.scss +0 -45
- package/src/themes/esrar/06-components/_components.upload.scss +0 -102
- package/src/themes/esrar/06-components/_index.scss +0 -42
- package/src/themes/esrar/index.scss +0 -30
- package/src/themes/flashtrade/01-settings/_index.scss +0 -19
- package/src/themes/flashtrade/01-settings/_settings.animations.scss +0 -11
- package/src/themes/flashtrade/01-settings/_settings.background.scss +0 -9
- package/src/themes/flashtrade/01-settings/_settings.colors.scss +0 -79
- package/src/themes/flashtrade/01-settings/_settings.config.scss +0 -16
- package/src/themes/flashtrade/01-settings/_settings.typography.scss +0 -35
- package/src/themes/flashtrade/02-tools/_index.scss +0 -8
- package/src/themes/flashtrade/03-generic/_index.scss +0 -8
- package/src/themes/flashtrade/04-elements/_index.scss +0 -12
- package/src/themes/flashtrade/05-objects/_index.scss +0 -8
- package/src/themes/flashtrade/06-components/_components.badge.scss +0 -156
- package/src/themes/flashtrade/06-components/_components.button.scss +0 -135
- package/src/themes/flashtrade/06-components/_components.card.scss +0 -214
- package/src/themes/flashtrade/06-components/_components.navbar.scss +0 -227
- package/src/themes/flashtrade/06-components/_index.scss +0 -13
- package/src/themes/flashtrade/99-utilities/_index.scss +0 -9
- package/src/themes/flashtrade/99-utilities/_utilities.trading.scss +0 -187
- package/src/themes/flashtrade/README.md +0 -386
- package/src/themes/flashtrade/demo.html +0 -272
- package/src/themes/flashtrade/index.scss +0 -36
- package/src/themes/mashroom/01-settings/_index.scss +0 -69
- package/src/themes/mashroom/01-settings/_settings.accordion.scss +0 -32
- package/src/themes/mashroom/01-settings/_settings.animations.scss +0 -26
- package/src/themes/mashroom/01-settings/_settings.avatar-group.scss +0 -22
- package/src/themes/mashroom/01-settings/_settings.avatar.scss +0 -57
- package/src/themes/mashroom/01-settings/_settings.badge.scss +0 -19
- package/src/themes/mashroom/01-settings/_settings.border-radius.scss +0 -24
- package/src/themes/mashroom/01-settings/_settings.border.scss +0 -14
- package/src/themes/mashroom/01-settings/_settings.box-shadow.scss +0 -40
- package/src/themes/mashroom/01-settings/_settings.breadcrumb.scss +0 -0
- package/src/themes/mashroom/01-settings/_settings.breakpoints.scss +0 -17
- package/src/themes/mashroom/01-settings/_settings.btn-group.scss +0 -5
- package/src/themes/mashroom/01-settings/_settings.button.scss +0 -50
- package/src/themes/mashroom/01-settings/_settings.callout.scss +0 -81
- package/src/themes/mashroom/01-settings/_settings.card.scss +0 -52
- package/src/themes/mashroom/01-settings/_settings.checkbox-group.scss +0 -5
- package/src/themes/mashroom/01-settings/_settings.checkbox.scss +0 -23
- package/src/themes/mashroom/01-settings/_settings.color-mode.scss +0 -7
- package/src/themes/mashroom/01-settings/_settings.colors.scss +0 -180
- package/src/themes/mashroom/01-settings/_settings.config.scss +0 -4
- package/src/themes/mashroom/01-settings/_settings.countdown.scss +0 -20
- package/src/themes/mashroom/01-settings/_settings.data-table.scss +0 -56
- package/src/themes/mashroom/01-settings/_settings.datepicker.scss +0 -45
- package/src/themes/mashroom/01-settings/_settings.design-tokens.scss +0 -3
- package/src/themes/mashroom/01-settings/_settings.dropdown.scss +0 -45
- package/src/themes/mashroom/01-settings/_settings.edge-panel.scss +0 -24
- package/src/themes/mashroom/01-settings/_settings.fonts.scss +0 -8
- package/src/themes/mashroom/01-settings/_settings.form-group.scss +0 -14
- package/src/themes/mashroom/01-settings/_settings.form.scss +0 -6
- package/src/themes/mashroom/01-settings/_settings.grid.scss +0 -23
- package/src/themes/mashroom/01-settings/_settings.hero.scss +0 -41
- package/src/themes/mashroom/01-settings/_settings.input.scss +0 -51
- package/src/themes/mashroom/01-settings/_settings.link.scss +0 -13
- package/src/themes/mashroom/01-settings/_settings.list-group.scss +0 -16
- package/src/themes/mashroom/01-settings/_settings.list.scss +0 -13
- package/src/themes/mashroom/01-settings/_settings.masonry-grid.scss +0 -23
- package/src/themes/mashroom/01-settings/_settings.menu.scss +0 -50
- package/src/themes/mashroom/01-settings/_settings.messages.scss +0 -98
- package/src/themes/mashroom/01-settings/_settings.modal.scss +0 -41
- package/src/themes/mashroom/01-settings/_settings.nav.scss +0 -20
- package/src/themes/mashroom/01-settings/_settings.navbar.scss +0 -54
- package/src/themes/mashroom/01-settings/_settings.pagination.scss +0 -30
- package/src/themes/mashroom/01-settings/_settings.photoviewer.scss +0 -45
- package/src/themes/mashroom/01-settings/_settings.popover.scss +0 -20
- package/src/themes/mashroom/01-settings/_settings.position.scss +0 -9
- package/src/themes/mashroom/01-settings/_settings.progress.scss +0 -17
- package/src/themes/mashroom/01-settings/_settings.rating.scss +0 -11
- package/src/themes/mashroom/01-settings/_settings.river.scss +0 -50
- package/src/themes/mashroom/01-settings/_settings.sectionintro.scss +0 -31
- package/src/themes/mashroom/01-settings/_settings.select.scss +0 -47
- package/src/themes/mashroom/01-settings/_settings.side-menu.scss +0 -79
- package/src/themes/mashroom/01-settings/_settings.skeleton.scss +0 -24
- package/src/themes/mashroom/01-settings/_settings.spacing.scss +0 -66
- package/src/themes/mashroom/01-settings/_settings.spinner.scss +0 -34
- package/src/themes/mashroom/01-settings/_settings.steps.scss +0 -33
- package/src/themes/mashroom/01-settings/_settings.tabs.scss +0 -33
- package/src/themes/mashroom/01-settings/_settings.testimonials.scss +0 -24
- package/src/themes/mashroom/01-settings/_settings.todo.scss +0 -52
- package/src/themes/mashroom/01-settings/_settings.toggle.scss +0 -49
- package/src/themes/mashroom/01-settings/_settings.tooltip.scss +0 -20
- package/src/themes/mashroom/01-settings/_settings.typography.scss +0 -95
- package/src/themes/mashroom/01-settings/_settings.upload.scss +0 -96
- package/src/themes/mashroom/01-settings/_settings.z-layers.scss +0 -19
- package/src/themes/mashroom/02-tools/_index.scss +0 -8
- package/src/themes/mashroom/02-tools/_tools.psychedelic-gradients.scss +0 -78
- package/src/themes/mashroom/02-tools/_tools.trippy-effects.scss +0 -114
- package/src/themes/mashroom/03-generic/_index.scss +0 -6
- package/src/themes/mashroom/04-elements/_index.scss +0 -6
- package/src/themes/mashroom/05-objects/_index.scss +0 -6
- package/src/themes/mashroom/06-components/_components.accordion.scss +0 -187
- package/src/themes/mashroom/06-components/_components.avatar-group.scss +0 -276
- package/src/themes/mashroom/06-components/_components.avatar.scss +0 -114
- package/src/themes/mashroom/06-components/_components.badge.scss +0 -152
- package/src/themes/mashroom/06-components/_components.breadcrumb.scss +0 -162
- package/src/themes/mashroom/06-components/_components.btn-group.scss +0 -404
- package/src/themes/mashroom/06-components/_components.button.scss +0 -160
- package/src/themes/mashroom/06-components/_components.callout.scss +0 -140
- package/src/themes/mashroom/06-components/_components.card.scss +0 -225
- package/src/themes/mashroom/06-components/_components.checkbox.scss +0 -186
- package/src/themes/mashroom/06-components/_components.color-mode-toggle.scss +0 -308
- package/src/themes/mashroom/06-components/_components.countdown.scss +0 -402
- package/src/themes/mashroom/06-components/_components.data-table.scss +0 -354
- package/src/themes/mashroom/06-components/_components.datepicker.scss +0 -349
- package/src/themes/mashroom/06-components/_components.dropdown.scss +0 -334
- package/src/themes/mashroom/06-components/_components.edge-panel.scss +0 -413
- package/src/themes/mashroom/06-components/_components.form-group.scss +0 -433
- package/src/themes/mashroom/06-components/_components.form.scss +0 -358
- package/src/themes/mashroom/06-components/_components.hero.scss +0 -151
- package/src/themes/mashroom/06-components/_components.input.scss +0 -147
- package/src/themes/mashroom/06-components/_components.list-group.scss +0 -456
- package/src/themes/mashroom/06-components/_components.list.scss +0 -145
- package/src/themes/mashroom/06-components/_components.menu.scss +0 -497
- package/src/themes/mashroom/06-components/_components.messages.scss +0 -277
- package/src/themes/mashroom/06-components/_components.modal.scss +0 -264
- package/src/themes/mashroom/06-components/_components.nav.scss +0 -181
- package/src/themes/mashroom/06-components/_components.navbar.scss +0 -538
- package/src/themes/mashroom/06-components/_components.pagination.scss +0 -400
- package/src/themes/mashroom/06-components/_components.photoviewer.scss +0 -498
- package/src/themes/mashroom/06-components/_components.popover.scss +0 -383
- package/src/themes/mashroom/06-components/_components.product-review.scss +0 -408
- package/src/themes/mashroom/06-components/_components.progress.scss +0 -249
- package/src/themes/mashroom/06-components/_components.rating.scss +0 -300
- package/src/themes/mashroom/06-components/_components.river.scss +0 -570
- package/src/themes/mashroom/06-components/_components.sectionintro.scss +0 -546
- package/src/themes/mashroom/06-components/_components.select.scss +0 -455
- package/src/themes/mashroom/06-components/_components.side-menu.scss +0 -635
- package/src/themes/mashroom/06-components/_components.skeleton.scss +0 -447
- package/src/themes/mashroom/06-components/_components.slider.scss +0 -414
- package/src/themes/mashroom/06-components/_components.spinner.scss +0 -198
- package/src/themes/mashroom/06-components/_components.steps.scss +0 -350
- package/src/themes/mashroom/06-components/_components.tabs.scss +0 -269
- package/src/themes/mashroom/06-components/_components.testimonials.scss +0 -561
- package/src/themes/mashroom/06-components/_components.toggle.scss +0 -231
- package/src/themes/mashroom/06-components/_components.tooltip.scss +0 -167
- package/src/themes/mashroom/06-components/_components.upload.scss +0 -537
- package/src/themes/mashroom/06-components/_components.video-player.scss +0 -560
- package/src/themes/mashroom/06-components/_index.scss +0 -55
- package/src/themes/mashroom/99-utilities/_index.scss +0 -6
- package/src/themes/mashroom/index.scss +0 -26
- package/src/themes/shaj-default/01-settings/_index.scss +0 -69
- package/src/themes/shaj-default/01-settings/_settings.accordion.scss +0 -38
- package/src/themes/shaj-default/01-settings/_settings.animations.scss +0 -32
- package/src/themes/shaj-default/01-settings/_settings.avatar-group.scss +0 -28
- package/src/themes/shaj-default/01-settings/_settings.avatar.scss +0 -63
- package/src/themes/shaj-default/01-settings/_settings.badge.scss +0 -25
- package/src/themes/shaj-default/01-settings/_settings.border-radius.scss +0 -24
- package/src/themes/shaj-default/01-settings/_settings.border.scss +0 -20
- package/src/themes/shaj-default/01-settings/_settings.box-shadow.scss +0 -46
- package/src/themes/shaj-default/01-settings/_settings.breadcrumb.scss +0 -0
- package/src/themes/shaj-default/01-settings/_settings.breakpoints.scss +0 -23
- package/src/themes/shaj-default/01-settings/_settings.btn-group.scss +0 -11
- package/src/themes/shaj-default/01-settings/_settings.button.scss +0 -56
- package/src/themes/shaj-default/01-settings/_settings.callout.scss +0 -87
- package/src/themes/shaj-default/01-settings/_settings.card.scss +0 -52
- package/src/themes/shaj-default/01-settings/_settings.checkbox-group.scss +0 -11
- package/src/themes/shaj-default/01-settings/_settings.checkbox.scss +0 -29
- package/src/themes/shaj-default/01-settings/_settings.color-mode.scss +0 -13
- package/src/themes/shaj-default/01-settings/_settings.colors.scss +0 -91
- package/src/themes/shaj-default/01-settings/_settings.config.scss +0 -4
- package/src/themes/shaj-default/01-settings/_settings.countdown.scss +0 -26
- package/src/themes/shaj-default/01-settings/_settings.data-table.scss +0 -62
- package/src/themes/shaj-default/01-settings/_settings.datepicker.scss +0 -51
- package/src/themes/shaj-default/01-settings/_settings.design-tokens.scss +0 -9
- package/src/themes/shaj-default/01-settings/_settings.dropdown.scss +0 -51
- package/src/themes/shaj-default/01-settings/_settings.edge-panel.scss +0 -30
- package/src/themes/shaj-default/01-settings/_settings.fonts.scss +0 -13
- package/src/themes/shaj-default/01-settings/_settings.form-group.scss +0 -20
- package/src/themes/shaj-default/01-settings/_settings.form.scss +0 -12
- package/src/themes/shaj-default/01-settings/_settings.grid.scss +0 -29
- package/src/themes/shaj-default/01-settings/_settings.hero.scss +0 -47
- package/src/themes/shaj-default/01-settings/_settings.input.scss +0 -57
- package/src/themes/shaj-default/01-settings/_settings.link.scss +0 -19
- package/src/themes/shaj-default/01-settings/_settings.list-group.scss +0 -22
- package/src/themes/shaj-default/01-settings/_settings.list.scss +0 -19
- package/src/themes/shaj-default/01-settings/_settings.masonry-grid.scss +0 -29
- package/src/themes/shaj-default/01-settings/_settings.menu.scss +0 -56
- package/src/themes/shaj-default/01-settings/_settings.messages.scss +0 -104
- package/src/themes/shaj-default/01-settings/_settings.modal.scss +0 -47
- package/src/themes/shaj-default/01-settings/_settings.nav.scss +0 -26
- package/src/themes/shaj-default/01-settings/_settings.navbar.scss +0 -60
- package/src/themes/shaj-default/01-settings/_settings.pagination.scss +0 -36
- package/src/themes/shaj-default/01-settings/_settings.photoviewer.scss +0 -51
- package/src/themes/shaj-default/01-settings/_settings.popover.scss +0 -26
- package/src/themes/shaj-default/01-settings/_settings.position.scss +0 -15
- package/src/themes/shaj-default/01-settings/_settings.progress.scss +0 -23
- package/src/themes/shaj-default/01-settings/_settings.rating.scss +0 -17
- package/src/themes/shaj-default/01-settings/_settings.river.scss +0 -56
- package/src/themes/shaj-default/01-settings/_settings.sectionintro.scss +0 -37
- package/src/themes/shaj-default/01-settings/_settings.select.scss +0 -53
- package/src/themes/shaj-default/01-settings/_settings.side-menu.scss +0 -85
- package/src/themes/shaj-default/01-settings/_settings.skeleton.scss +0 -30
- package/src/themes/shaj-default/01-settings/_settings.spacing.scss +0 -72
- package/src/themes/shaj-default/01-settings/_settings.spinner.scss +0 -24
- package/src/themes/shaj-default/01-settings/_settings.steps.scss +0 -39
- package/src/themes/shaj-default/01-settings/_settings.tabs.scss +0 -39
- package/src/themes/shaj-default/01-settings/_settings.testimonials.scss +0 -30
- package/src/themes/shaj-default/01-settings/_settings.todo.scss +0 -58
- package/src/themes/shaj-default/01-settings/_settings.toggle.scss +0 -55
- package/src/themes/shaj-default/01-settings/_settings.tooltip.scss +0 -26
- package/src/themes/shaj-default/01-settings/_settings.typography.scss +0 -101
- package/src/themes/shaj-default/01-settings/_settings.upload.scss +0 -102
- package/src/themes/shaj-default/01-settings/_settings.z-layers.scss +0 -25
- package/src/themes/shaj-default/02-tools/_index.scss +0 -0
- package/src/themes/shaj-default/03-generic/_generic.root.scss +0 -0
- package/src/themes/shaj-default/03-generic/_index.scss +0 -2
- package/src/themes/shaj-default/04-elements/_index.scss +0 -0
- package/src/themes/shaj-default/05-objects/_index.scss +0 -0
- package/src/themes/shaj-default/06-components/_components.button.scss +0 -55
- package/src/themes/shaj-default/06-components/_components.card.scss +0 -57
- package/src/themes/shaj-default/06-components/_components.input.scss +0 -58
- package/src/themes/shaj-default/06-components/_components.navbar.scss +0 -99
- package/src/themes/shaj-default/06-components/_components.tooltip.scss +0 -0
- package/src/themes/shaj-default/06-components/_index.scss +0 -13
- package/src/themes/shaj-default/99-utilities/_index.scss +0 -0
- package/src/themes/shaj-default/index.scss +0 -25
- package/theme.config.ts +0 -360
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
import { existsSync, mkdirSync, rmSync, readFileSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { dirname } from 'path';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
const CLI_PATH = join(__dirname, '../../atomix-cli.js');
|
|
11
|
+
const TEST_DIR = join(__dirname, 'test-output');
|
|
12
|
+
|
|
13
|
+
describe('Atomix CLI Commands', () => {
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
// Create test directory
|
|
16
|
+
if (!existsSync(TEST_DIR)) {
|
|
17
|
+
mkdirSync(TEST_DIR, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
afterEach(() => {
|
|
22
|
+
// Clean up test directory
|
|
23
|
+
if (existsSync(TEST_DIR)) {
|
|
24
|
+
rmSync(TEST_DIR, { recursive: true, force: true });
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('atomix --help', () => {
|
|
29
|
+
it('should display help information', () => {
|
|
30
|
+
const output = execSync(`node ${CLI_PATH} --help`).toString();
|
|
31
|
+
expect(output).toContain('Atomix Design System CLI');
|
|
32
|
+
expect(output).toContain('Commands:');
|
|
33
|
+
expect(output).toContain('build-theme');
|
|
34
|
+
expect(output).toContain('generate');
|
|
35
|
+
expect(output).toContain('validate');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('atomix --version', () => {
|
|
40
|
+
it('should display version number', () => {
|
|
41
|
+
const output = execSync(`node ${CLI_PATH} --version`).toString();
|
|
42
|
+
expect(output).toMatch(/\d+\.\d+\.\d+/);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('atomix generate component', () => {
|
|
47
|
+
const componentPath = join(TEST_DIR, 'TestComponent');
|
|
48
|
+
|
|
49
|
+
it('should create component files with valid name', () => {
|
|
50
|
+
execSync(`node ${CLI_PATH} generate component TestButton --path ${TEST_DIR}`, {
|
|
51
|
+
cwd: process.cwd()
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const buttonPath = join(TEST_DIR, 'TestButton');
|
|
55
|
+
|
|
56
|
+
// Check if files are created
|
|
57
|
+
expect(existsSync(join(buttonPath, 'TestButton.tsx'))).toBe(true);
|
|
58
|
+
expect(existsSync(join(buttonPath, 'index.ts'))).toBe(true);
|
|
59
|
+
expect(existsSync(join(buttonPath, '_testbutton.scss'))).toBe(true);
|
|
60
|
+
expect(existsSync(join(buttonPath, 'TestButton.stories.tsx'))).toBe(true);
|
|
61
|
+
|
|
62
|
+
// Check component content
|
|
63
|
+
const componentContent = readFileSync(join(buttonPath, 'TestButton.tsx'), 'utf8');
|
|
64
|
+
expect(componentContent).toContain('export const TestButton');
|
|
65
|
+
expect(componentContent).toContain('TestButtonProps');
|
|
66
|
+
expect(componentContent).toContain('forwardRef');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should reject invalid component names', () => {
|
|
70
|
+
expect(() => {
|
|
71
|
+
execSync(`node ${CLI_PATH} generate component test-button --path ${TEST_DIR}`, {
|
|
72
|
+
cwd: process.cwd()
|
|
73
|
+
});
|
|
74
|
+
}).toThrow();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should create test file when --test flag is used', () => {
|
|
78
|
+
execSync(`node ${CLI_PATH} generate component TestCard --test --path ${TEST_DIR}`, {
|
|
79
|
+
cwd: process.cwd()
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const cardPath = join(TEST_DIR, 'TestCard');
|
|
83
|
+
expect(existsSync(join(cardPath, 'TestCard.test.tsx'))).toBe(true);
|
|
84
|
+
|
|
85
|
+
const testContent = readFileSync(join(cardPath, 'TestCard.test.tsx'), 'utf8');
|
|
86
|
+
expect(testContent).toContain('describe(\'TestCard\'');
|
|
87
|
+
expect(testContent).toContain('vitest');
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('atomix generate token', () => {
|
|
92
|
+
it('should generate color tokens', () => {
|
|
93
|
+
const settingsPath = join(TEST_DIR, 'src/styles/01-settings');
|
|
94
|
+
mkdirSync(settingsPath, { recursive: true });
|
|
95
|
+
|
|
96
|
+
execSync(`node ${CLI_PATH} generate token colors`, {
|
|
97
|
+
cwd: TEST_DIR
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const tokenFile = join(settingsPath, '_settings.colors.custom.scss');
|
|
101
|
+
expect(existsSync(tokenFile)).toBe(true);
|
|
102
|
+
|
|
103
|
+
const content = readFileSync(tokenFile, 'utf8');
|
|
104
|
+
expect(content).toContain('Custom Color Tokens');
|
|
105
|
+
expect(content).toContain('$custom-primary-6');
|
|
106
|
+
expect(content).toContain('$custom-success');
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('should reject invalid token categories', () => {
|
|
110
|
+
expect(() => {
|
|
111
|
+
execSync(`node ${CLI_PATH} generate token invalid-category`, {
|
|
112
|
+
cwd: TEST_DIR
|
|
113
|
+
});
|
|
114
|
+
}).toThrow();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
describe('atomix validate', () => {
|
|
119
|
+
it('should validate tokens when --tokens flag is used', () => {
|
|
120
|
+
// This is a mock test - in real implementation, you'd set up token files
|
|
121
|
+
const output = execSync(`node ${CLI_PATH} validate --tokens`, {
|
|
122
|
+
cwd: process.cwd()
|
|
123
|
+
}).toString();
|
|
124
|
+
|
|
125
|
+
// Should complete without throwing
|
|
126
|
+
expect(output).toBeDefined();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe('atomix doctor', () => {
|
|
131
|
+
it('should run diagnostics successfully', () => {
|
|
132
|
+
const output = execSync(`node ${CLI_PATH} doctor`).toString();
|
|
133
|
+
expect(output).toContain('Atomix Doctor Report');
|
|
134
|
+
expect(output).toContain('Node.js Version');
|
|
135
|
+
expect(output).toContain('Atomix Installation');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe('atomix theme create', () => {
|
|
140
|
+
it('should create CSS theme with valid name', () => {
|
|
141
|
+
const themesPath = join(TEST_DIR, 'themes');
|
|
142
|
+
mkdirSync(themesPath, { recursive: true });
|
|
143
|
+
|
|
144
|
+
execSync(`node ${CLI_PATH} theme create test-theme --output ${themesPath}`, {
|
|
145
|
+
cwd: process.cwd()
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const themePath = join(themesPath, 'test-theme');
|
|
149
|
+
expect(existsSync(join(themePath, 'index.scss'))).toBe(true);
|
|
150
|
+
expect(existsSync(join(themePath, 'README.md'))).toBe(true);
|
|
151
|
+
|
|
152
|
+
const themeContent = readFileSync(join(themePath, 'index.scss'), 'utf8');
|
|
153
|
+
expect(themeContent).toContain('data-theme="test-theme"');
|
|
154
|
+
expect(themeContent).toContain('--atomix-color-primary');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should create JavaScript theme when --type js is used', () => {
|
|
158
|
+
const themesPath = join(TEST_DIR, 'themes');
|
|
159
|
+
mkdirSync(themesPath, { recursive: true });
|
|
160
|
+
|
|
161
|
+
execSync(`node ${CLI_PATH} theme create js-theme --type js --output ${themesPath}`, {
|
|
162
|
+
cwd: process.cwd()
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const themePath = join(themesPath, 'js-theme');
|
|
166
|
+
expect(existsSync(join(themePath, 'index.ts'))).toBe(true);
|
|
167
|
+
|
|
168
|
+
const themeContent = readFileSync(join(themePath, 'index.ts'), 'utf8');
|
|
169
|
+
expect(themeContent).toContain('jsTheme');
|
|
170
|
+
expect(themeContent).toContain('createTheme');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('should reject invalid theme names', () => {
|
|
174
|
+
expect(() => {
|
|
175
|
+
execSync(`node ${CLI_PATH} theme create InvalidTheme --output ${TEST_DIR}`, {
|
|
176
|
+
cwd: process.cwd()
|
|
177
|
+
});
|
|
178
|
+
}).toThrow();
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
describe('CLI Error Handling', () => {
|
|
184
|
+
it('should show suggestions for invalid commands', () => {
|
|
185
|
+
try {
|
|
186
|
+
execSync(`node ${CLI_PATH} invalidcommand`);
|
|
187
|
+
} catch (error) {
|
|
188
|
+
const output = error.stdout?.toString() || error.stderr?.toString();
|
|
189
|
+
expect(output).toContain('unknown command');
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should handle missing required arguments', () => {
|
|
194
|
+
expect(() => {
|
|
195
|
+
execSync(`node ${CLI_PATH} generate`);
|
|
196
|
+
}).toThrow();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should respect --debug flag', () => {
|
|
200
|
+
const output = execSync(`node ${CLI_PATH} --debug --help`).toString();
|
|
201
|
+
// Debug mode should be enabled
|
|
202
|
+
expect(process.env.ATOMIX_DEBUG).toBe('true');
|
|
203
|
+
});
|
|
204
|
+
});
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
validatePath,
|
|
4
|
+
validateComponentName,
|
|
5
|
+
validateThemeName,
|
|
6
|
+
sanitizeInput,
|
|
7
|
+
isValidColor,
|
|
8
|
+
checkNodeVersion,
|
|
9
|
+
formatFileSize
|
|
10
|
+
} from '../utils.js';
|
|
11
|
+
import { join, resolve } from 'path';
|
|
12
|
+
|
|
13
|
+
describe('CLI Utils', () => {
|
|
14
|
+
describe('validatePath', () => {
|
|
15
|
+
const basePath = '/home/user/project';
|
|
16
|
+
|
|
17
|
+
it('should validate safe paths within project', () => {
|
|
18
|
+
const result = validatePath('src/components', basePath);
|
|
19
|
+
expect(result.isValid).toBe(true);
|
|
20
|
+
expect(result.safePath).toBe(resolve(basePath, 'src/components'));
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should reject paths outside project directory', () => {
|
|
24
|
+
const result = validatePath('../../etc/passwd', basePath);
|
|
25
|
+
expect(result.isValid).toBe(false);
|
|
26
|
+
expect(result.error).toContain('outside the project directory');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should reject paths to sensitive files', () => {
|
|
30
|
+
const sensitiveFiles = ['.env', '.git/config', 'private/key.pem', 'secret.key'];
|
|
31
|
+
|
|
32
|
+
sensitiveFiles.forEach(file => {
|
|
33
|
+
const result = validatePath(file, basePath);
|
|
34
|
+
expect(result.isValid).toBe(false);
|
|
35
|
+
expect(result.error).toContain('sensitive path');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should handle absolute paths correctly', () => {
|
|
40
|
+
const absolutePath = join(basePath, 'src/components');
|
|
41
|
+
const result = validatePath(absolutePath, basePath);
|
|
42
|
+
expect(result.isValid).toBe(true);
|
|
43
|
+
expect(result.safePath).toBe(absolutePath);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('validateComponentName', () => {
|
|
48
|
+
it('should accept valid PascalCase names', () => {
|
|
49
|
+
const validNames = ['Button', 'CardHeader', 'MyComponent123'];
|
|
50
|
+
|
|
51
|
+
validNames.forEach(name => {
|
|
52
|
+
const result = validateComponentName(name);
|
|
53
|
+
expect(result.isValid).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should reject invalid component names', () => {
|
|
58
|
+
const invalidNames = [
|
|
59
|
+
'button', // lowercase
|
|
60
|
+
'Button-Test', // contains hyphen
|
|
61
|
+
'Button_Test', // contains underscore
|
|
62
|
+
'123Button', // starts with number
|
|
63
|
+
'A', // too short
|
|
64
|
+
'', // empty
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
invalidNames.forEach(name => {
|
|
68
|
+
const result = validateComponentName(name);
|
|
69
|
+
expect(result.isValid).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should reject reserved words', () => {
|
|
74
|
+
const reserved = ['Component', 'React', 'Fragment'];
|
|
75
|
+
|
|
76
|
+
reserved.forEach(name => {
|
|
77
|
+
const result = validateComponentName(name);
|
|
78
|
+
expect(result.isValid).toBe(false);
|
|
79
|
+
expect(result.error).toContain('reserved word');
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe('validateThemeName', () => {
|
|
85
|
+
it('should accept valid kebab-case names', () => {
|
|
86
|
+
const validNames = ['dark-theme', 'light-mode', 'custom-theme-2'];
|
|
87
|
+
|
|
88
|
+
validNames.forEach(name => {
|
|
89
|
+
const result = validateThemeName(name);
|
|
90
|
+
expect(result.isValid).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should reject invalid theme names', () => {
|
|
95
|
+
const invalidNames = [
|
|
96
|
+
'DarkTheme', // PascalCase
|
|
97
|
+
'dark_theme', // underscore
|
|
98
|
+
'123-theme', // starts with number
|
|
99
|
+
'theme-', // ends with hyphen
|
|
100
|
+
'theme--dark', // consecutive hyphens
|
|
101
|
+
'', // empty
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
invalidNames.forEach(name => {
|
|
105
|
+
const result = validateThemeName(name);
|
|
106
|
+
expect(result.isValid).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe('sanitizeInput', () => {
|
|
112
|
+
it('should remove dangerous shell characters', () => {
|
|
113
|
+
const dangerous = 'test; rm -rf /';
|
|
114
|
+
const sanitized = sanitizeInput(dangerous);
|
|
115
|
+
expect(sanitized).toBe('test rm -rf /');
|
|
116
|
+
expect(sanitized).not.toContain(';');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should remove multiple dangerous characters', () => {
|
|
120
|
+
const input = 'cmd1 && cmd2 | cmd3 `evil` $var > file < input \\ ';
|
|
121
|
+
const sanitized = sanitizeInput(input);
|
|
122
|
+
expect(sanitized).toBe('cmd1 cmd2 cmd3 evil var file input');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should handle non-string inputs', () => {
|
|
126
|
+
expect(sanitizeInput(123)).toBe('123');
|
|
127
|
+
expect(sanitizeInput(null)).toBe('null');
|
|
128
|
+
expect(sanitizeInput(undefined)).toBe('undefined');
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe('isValidColor', () => {
|
|
133
|
+
it('should validate hex colors', () => {
|
|
134
|
+
const validHex = ['#FFF', '#FFFF', '#FFFFFF', '#FFFFFFFF', '#abc123'];
|
|
135
|
+
|
|
136
|
+
validHex.forEach(color => {
|
|
137
|
+
expect(isValidColor(color)).toBe(true);
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('should validate CSS color functions', () => {
|
|
142
|
+
const validFunctions = [
|
|
143
|
+
'rgb(255, 255, 255)',
|
|
144
|
+
'rgba(0, 0, 0, 0.5)',
|
|
145
|
+
'hsl(120, 100%, 50%)',
|
|
146
|
+
'hsla(240, 100%, 50%, 0.3)',
|
|
147
|
+
'var(--atomix-color-primary)',
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
validFunctions.forEach(color => {
|
|
151
|
+
expect(isValidColor(color)).toBe(true);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should reject invalid colors', () => {
|
|
156
|
+
const invalid = ['#GGG', '#12', 'red', '255,255,255', 'notacolor'];
|
|
157
|
+
|
|
158
|
+
invalid.forEach(color => {
|
|
159
|
+
expect(isValidColor(color)).toBe(false);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe('checkNodeVersion', () => {
|
|
165
|
+
it('should check Node version compatibility', () => {
|
|
166
|
+
const currentVersion = process.version.substring(1);
|
|
167
|
+
const [major, minor, patch] = currentVersion.split('.').map(Number);
|
|
168
|
+
|
|
169
|
+
// Should pass for current version
|
|
170
|
+
const result1 = checkNodeVersion(currentVersion);
|
|
171
|
+
expect(result1.compatible).toBe(true);
|
|
172
|
+
|
|
173
|
+
// Should fail for higher version
|
|
174
|
+
const higherVersion = `${major + 1}.0.0`;
|
|
175
|
+
const result2 = checkNodeVersion(higherVersion);
|
|
176
|
+
expect(result2.compatible).toBe(false);
|
|
177
|
+
|
|
178
|
+
// Should pass for lower version
|
|
179
|
+
if (major > 0) {
|
|
180
|
+
const lowerVersion = `${major - 1}.0.0`;
|
|
181
|
+
const result3 = checkNodeVersion(lowerVersion);
|
|
182
|
+
expect(result3.compatible).toBe(true);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
describe('formatFileSize', () => {
|
|
188
|
+
it('should format file sizes correctly', () => {
|
|
189
|
+
expect(formatFileSize(0)).toBe('0 B');
|
|
190
|
+
expect(formatFileSize(512)).toBe('512.00 B');
|
|
191
|
+
expect(formatFileSize(1024)).toBe('1.00 KB');
|
|
192
|
+
expect(formatFileSize(1048576)).toBe('1.00 MB');
|
|
193
|
+
expect(formatFileSize(1073741824)).toBe('1.00 GB');
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('should handle decimal values', () => {
|
|
197
|
+
expect(formatFileSize(1536)).toBe('1.50 KB'); // 1.5 KB
|
|
198
|
+
expect(formatFileSize(2621440)).toBe('2.50 MB'); // 2.5 MB
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true,
|
|
6
|
+
environment: 'node',
|
|
7
|
+
coverage: {
|
|
8
|
+
provider: 'v8',
|
|
9
|
+
reporter: ['text', 'json', 'html'],
|
|
10
|
+
exclude: [
|
|
11
|
+
'node_modules/**',
|
|
12
|
+
'**/__tests__/**',
|
|
13
|
+
'**/test-output/**',
|
|
14
|
+
],
|
|
15
|
+
include: [
|
|
16
|
+
'../*.js',
|
|
17
|
+
],
|
|
18
|
+
thresholds: {
|
|
19
|
+
lines: 80,
|
|
20
|
+
functions: 80,
|
|
21
|
+
branches: 80,
|
|
22
|
+
statements: 80,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import chalk from 'chalk';
|
|
7
|
-
import { writeFile, mkdir } from 'fs/promises';
|
|
7
|
+
import { readFile, writeFile, mkdir } from 'fs/promises';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
import { existsSync } from 'fs';
|
|
10
10
|
import boxen from 'boxen';
|
|
@@ -73,7 +73,7 @@ body {
|
|
|
73
73
|
}`
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
nextjs: {
|
|
78
78
|
dependencies: [
|
|
79
79
|
'@shohojdhara/atomix',
|
|
@@ -125,7 +125,7 @@ body {
|
|
|
125
125
|
}`
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
vanilla: {
|
|
130
130
|
dependencies: [
|
|
131
131
|
'@shohojdhara/atomix'
|
|
@@ -203,7 +203,7 @@ const configTemplates = {
|
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
},
|
|
206
|
-
|
|
206
|
+
|
|
207
207
|
advanced: {
|
|
208
208
|
'atomix.config.js': `module.exports = {
|
|
209
209
|
// Theme configuration
|
|
@@ -260,7 +260,7 @@ export async function runInitWizard() {
|
|
|
260
260
|
borderColor: 'cyan'
|
|
261
261
|
}
|
|
262
262
|
));
|
|
263
|
-
|
|
263
|
+
|
|
264
264
|
try {
|
|
265
265
|
// Step 1: Project type
|
|
266
266
|
const { projectType } = await inquirer.prompt([
|
|
@@ -276,7 +276,7 @@ export async function runInitWizard() {
|
|
|
276
276
|
]
|
|
277
277
|
}
|
|
278
278
|
]);
|
|
279
|
-
|
|
279
|
+
|
|
280
280
|
// Step 2: Theme selection
|
|
281
281
|
const { themeChoice } = await inquirer.prompt([
|
|
282
282
|
{
|
|
@@ -291,27 +291,19 @@ export async function runInitWizard() {
|
|
|
291
291
|
]
|
|
292
292
|
}
|
|
293
293
|
]);
|
|
294
|
-
|
|
294
|
+
|
|
295
295
|
let selectedTheme = null;
|
|
296
296
|
if (themeChoice === 'prebuilt') {
|
|
297
297
|
const { theme } = await inquirer.prompt([
|
|
298
298
|
{
|
|
299
|
-
type: '
|
|
299
|
+
type: 'input',
|
|
300
300
|
name: 'theme',
|
|
301
|
-
message: '
|
|
302
|
-
choices: [
|
|
303
|
-
{ name: 'Shaj Default - Clean & Modern', value: 'shaj-default' },
|
|
304
|
-
{ name: 'FlashTrade - Crypto Trading', value: 'flashtrade' },
|
|
305
|
-
{ name: 'BoomDevs - Dark Mode', value: 'boomdevs' },
|
|
306
|
-
{ name: 'Esrar - Minimal Light', value: 'esrar' },
|
|
307
|
-
{ name: 'Mashroom - Colorful & Playful', value: 'mashroom' },
|
|
308
|
-
{ name: 'AppleMix - Glass Morphism', value: 'applemix' }
|
|
309
|
-
]
|
|
301
|
+
message: 'Enter the name of the pre-built theme:',
|
|
310
302
|
}
|
|
311
303
|
]);
|
|
312
304
|
selectedTheme = theme;
|
|
313
305
|
}
|
|
314
|
-
|
|
306
|
+
|
|
315
307
|
// Step 3: Features
|
|
316
308
|
const { features } = await inquirer.prompt([
|
|
317
309
|
{
|
|
@@ -328,7 +320,7 @@ export async function runInitWizard() {
|
|
|
328
320
|
]
|
|
329
321
|
}
|
|
330
322
|
]);
|
|
331
|
-
|
|
323
|
+
|
|
332
324
|
// Step 4: Configuration
|
|
333
325
|
const { configType } = await inquirer.prompt([
|
|
334
326
|
{
|
|
@@ -342,7 +334,7 @@ export async function runInitWizard() {
|
|
|
342
334
|
]
|
|
343
335
|
}
|
|
344
336
|
]);
|
|
345
|
-
|
|
337
|
+
|
|
346
338
|
// Step 5: Installation
|
|
347
339
|
const { shouldInstall } = await inquirer.prompt([
|
|
348
340
|
{
|
|
@@ -352,14 +344,14 @@ export async function runInitWizard() {
|
|
|
352
344
|
default: true
|
|
353
345
|
}
|
|
354
346
|
]);
|
|
355
|
-
|
|
347
|
+
|
|
356
348
|
// Generate files
|
|
357
349
|
console.log(chalk.cyan('\nš¦ Generating project files...\n'));
|
|
358
|
-
|
|
350
|
+
|
|
359
351
|
// Create project structure
|
|
360
352
|
if (projectType !== 'custom') {
|
|
361
353
|
const template = projectTemplates[projectType];
|
|
362
|
-
|
|
354
|
+
|
|
363
355
|
// Create directories
|
|
364
356
|
await mkdir('src', { recursive: true });
|
|
365
357
|
if (projectType === 'nextjs') {
|
|
@@ -370,32 +362,32 @@ export async function runInitWizard() {
|
|
|
370
362
|
} else if (projectType === 'vanilla') {
|
|
371
363
|
await mkdir('src/styles', { recursive: true });
|
|
372
364
|
}
|
|
373
|
-
|
|
365
|
+
|
|
374
366
|
// Write template files
|
|
375
367
|
for (const [path, content] of Object.entries(template.files)) {
|
|
376
368
|
const filePath = join(process.cwd(), path);
|
|
377
369
|
const dir = join(process.cwd(), path.substring(0, path.lastIndexOf('/')));
|
|
378
|
-
|
|
370
|
+
|
|
379
371
|
if (!existsSync(dir)) {
|
|
380
372
|
await mkdir(dir, { recursive: true });
|
|
381
373
|
}
|
|
382
|
-
|
|
374
|
+
|
|
383
375
|
await writeFile(filePath, content, 'utf8');
|
|
384
376
|
console.log(chalk.green(` ā Created ${path}`));
|
|
385
377
|
}
|
|
386
378
|
}
|
|
387
|
-
|
|
379
|
+
|
|
388
380
|
// Create configuration file
|
|
389
381
|
if (configType !== 'none') {
|
|
390
|
-
const configTemplate = configType === 'json'
|
|
391
|
-
? configTemplates.basic
|
|
382
|
+
const configTemplate = configType === 'json'
|
|
383
|
+
? configTemplates.basic
|
|
392
384
|
: configTemplates.advanced;
|
|
393
|
-
|
|
385
|
+
|
|
394
386
|
for (const [filename, content] of Object.entries(configTemplate)) {
|
|
395
|
-
const configContent = typeof content === 'object'
|
|
387
|
+
const configContent = typeof content === 'object'
|
|
396
388
|
? JSON.stringify(content, null, 2)
|
|
397
389
|
: content;
|
|
398
|
-
|
|
390
|
+
|
|
399
391
|
await writeFile(
|
|
400
392
|
join(process.cwd(), filename),
|
|
401
393
|
configContent,
|
|
@@ -404,11 +396,11 @@ export async function runInitWizard() {
|
|
|
404
396
|
console.log(chalk.green(` ā Created ${filename}`));
|
|
405
397
|
}
|
|
406
398
|
}
|
|
407
|
-
|
|
399
|
+
|
|
408
400
|
// Create custom theme if selected
|
|
409
401
|
if (themeChoice === 'custom') {
|
|
410
402
|
await mkdir('themes/custom', { recursive: true });
|
|
411
|
-
|
|
403
|
+
|
|
412
404
|
const themeContent = `// Custom Theme
|
|
413
405
|
// Generated by Atomix CLI
|
|
414
406
|
|
|
@@ -427,7 +419,7 @@ export async function runInitWizard() {
|
|
|
427
419
|
.custom-component {
|
|
428
420
|
// Custom component styles
|
|
429
421
|
}`;
|
|
430
|
-
|
|
422
|
+
|
|
431
423
|
await writeFile(
|
|
432
424
|
join(process.cwd(), 'themes/custom/index.scss'),
|
|
433
425
|
themeContent,
|
|
@@ -435,7 +427,7 @@ export async function runInitWizard() {
|
|
|
435
427
|
);
|
|
436
428
|
console.log(chalk.green(' ā Created custom theme'));
|
|
437
429
|
}
|
|
438
|
-
|
|
430
|
+
|
|
439
431
|
// Generate package.json scripts
|
|
440
432
|
const scripts = {
|
|
441
433
|
'dev': projectType === 'nextjs' ? 'next dev' : 'vite',
|
|
@@ -444,24 +436,24 @@ export async function runInitWizard() {
|
|
|
444
436
|
'generate:component': 'atomix generate component',
|
|
445
437
|
'validate': 'atomix validate --tokens --theme'
|
|
446
438
|
};
|
|
447
|
-
|
|
439
|
+
|
|
448
440
|
if (features.includes('storybook')) {
|
|
449
441
|
scripts['storybook'] = 'storybook dev -p 6006';
|
|
450
442
|
scripts['build:storybook'] = 'storybook build';
|
|
451
443
|
}
|
|
452
|
-
|
|
444
|
+
|
|
453
445
|
if (features.includes('testing')) {
|
|
454
446
|
scripts['test'] = 'vitest';
|
|
455
447
|
scripts['test:watch'] = 'vitest --watch';
|
|
456
448
|
scripts['test:coverage'] = 'vitest --coverage';
|
|
457
449
|
}
|
|
458
|
-
|
|
450
|
+
|
|
459
451
|
if (features.includes('linting')) {
|
|
460
452
|
scripts['lint'] = 'eslint . --ext .ts,.tsx,.js,.jsx';
|
|
461
453
|
scripts['lint:fix'] = 'eslint . --ext .ts,.tsx,.js,.jsx --fix';
|
|
462
454
|
scripts['format'] = 'prettier --write "src/**/*.{ts,tsx,js,jsx,json,css,scss}"';
|
|
463
455
|
}
|
|
464
|
-
|
|
456
|
+
|
|
465
457
|
// Update package.json if it exists
|
|
466
458
|
const packageJsonPath = join(process.cwd(), 'package.json');
|
|
467
459
|
if (existsSync(packageJsonPath)) {
|
|
@@ -473,7 +465,7 @@ export async function runInitWizard() {
|
|
|
473
465
|
default: true
|
|
474
466
|
}
|
|
475
467
|
]);
|
|
476
|
-
|
|
468
|
+
|
|
477
469
|
if (addScripts) {
|
|
478
470
|
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8'));
|
|
479
471
|
packageJson.scripts = { ...packageJson.scripts, ...scripts };
|
|
@@ -481,7 +473,7 @@ export async function runInitWizard() {
|
|
|
481
473
|
console.log(chalk.green(' ā Updated package.json scripts'));
|
|
482
474
|
}
|
|
483
475
|
}
|
|
484
|
-
|
|
476
|
+
|
|
485
477
|
// Success message
|
|
486
478
|
console.log(boxen(
|
|
487
479
|
chalk.bold.green('⨠Setup Complete!\n\n') +
|
|
@@ -499,12 +491,12 @@ export async function runInitWizard() {
|
|
|
499
491
|
borderColor: 'green'
|
|
500
492
|
}
|
|
501
493
|
));
|
|
502
|
-
|
|
494
|
+
|
|
503
495
|
// Install dependencies if requested
|
|
504
496
|
if (shouldInstall) {
|
|
505
497
|
console.log(chalk.cyan('\nš„ Installing dependencies...\n'));
|
|
506
498
|
const { execSync } = await import('child_process');
|
|
507
|
-
|
|
499
|
+
|
|
508
500
|
try {
|
|
509
501
|
execSync('npm install', { stdio: 'inherit' });
|
|
510
502
|
console.log(chalk.green('\nā
Dependencies installed successfully!'));
|
|
@@ -513,7 +505,7 @@ export async function runInitWizard() {
|
|
|
513
505
|
console.log(chalk.yellow('Please run: npm install'));
|
|
514
506
|
}
|
|
515
507
|
}
|
|
516
|
-
|
|
508
|
+
|
|
517
509
|
} catch (error) {
|
|
518
510
|
if (error.isTTYError) {
|
|
519
511
|
console.error(chalk.red('This environment doesn\'t support interactive prompts'));
|