@shohojdhara/atomix 0.3.3 → 0.3.4
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 +13 -6
- package/dist/atomix.min.css +1 -1
- package/dist/index.d.ts +912 -505
- package/dist/index.esm.js +2924 -2133
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2719 -1916
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +11 -62
- package/scripts/atomix-cli.js +338 -2
- package/scripts/cli/interactive-init.js +36 -44
- package/scripts/cli/theme-bridge.js +129 -0
- package/scripts/sync-theme-config.js +22 -22
- package/src/components/Button/Button.tsx +36 -1
- package/src/lib/config/index.ts +275 -0
- package/src/lib/config/loader.ts +105 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/theme/composeTheme.ts +0 -5
- 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/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 +21 -6
- package/src/lib/theme/devtools/LiveEditor.tsx +393 -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 +79 -38
- package/src/lib/theme/index.ts +18 -2
- package/src/lib/theme/runtime/ThemeManager.test.ts +17 -1
- package/src/lib/theme/runtime/ThemeManager.ts +7 -7
- package/src/lib/theme/types.ts +42 -43
- package/src/lib/theme-tools.ts +7 -67
- package/src/lib/types/components.ts +69 -75
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/03-generic/_generated-root.css +5 -0
- package/src/styles/06-components/_components.navbar.scss +12 -5
- package/src/themes/README.md +1 -2
- package/src/themes/themes.config.js +10 -194
- 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/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,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomix Configuration System
|
|
3
|
+
*
|
|
4
|
+
* Tailwind-like configuration for customizing the Atomix Design System.
|
|
5
|
+
*
|
|
6
|
+
* External developers can create `atomix.config.ts` in their project root
|
|
7
|
+
* to customize design tokens, similar to Tailwind's tailwind.config.js
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // atomix.config.ts (in your project)
|
|
12
|
+
* import { defineConfig } from '@shohojdhara/atomix/config';
|
|
13
|
+
*
|
|
14
|
+
* export default defineConfig({
|
|
15
|
+
* theme: {
|
|
16
|
+
* extend: {
|
|
17
|
+
* colors: {
|
|
18
|
+
* primary: { main: '#7AFFD7' },
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* },
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import type { Theme } from '../theme/types';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Color Scale (1-10)
|
|
30
|
+
*/
|
|
31
|
+
export interface ColorScale {
|
|
32
|
+
1?: string;
|
|
33
|
+
2?: string;
|
|
34
|
+
3?: string;
|
|
35
|
+
4?: string;
|
|
36
|
+
5?: string;
|
|
37
|
+
6?: string;
|
|
38
|
+
7?: string;
|
|
39
|
+
8?: string;
|
|
40
|
+
9?: string;
|
|
41
|
+
10?: string;
|
|
42
|
+
[key: string]: string | undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Palette Color Options
|
|
47
|
+
*/
|
|
48
|
+
export interface PaletteColorOptions {
|
|
49
|
+
main: string;
|
|
50
|
+
light?: string;
|
|
51
|
+
dark?: string;
|
|
52
|
+
contrastText?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Design Tokens Schema (Tailwind-like)
|
|
57
|
+
*/
|
|
58
|
+
export interface ThemeTokens {
|
|
59
|
+
/** Color palette */
|
|
60
|
+
colors?: Record<string, string | PaletteColorOptions | ColorScale | Record<string, string>>;
|
|
61
|
+
/** Spacing scale */
|
|
62
|
+
spacing?: Record<string, string>;
|
|
63
|
+
/** Border radius scale */
|
|
64
|
+
borderRadius?: Record<string, string>;
|
|
65
|
+
/** Typography scale and settings */
|
|
66
|
+
typography?: {
|
|
67
|
+
fontFamilies?: Record<string, string>;
|
|
68
|
+
fontSizes?: Record<string, string>;
|
|
69
|
+
fontWeights?: Record<string, string | number>;
|
|
70
|
+
lineHeights?: Record<string, string | number>;
|
|
71
|
+
letterSpacings?: Record<string, string>;
|
|
72
|
+
};
|
|
73
|
+
/** Shadow scale */
|
|
74
|
+
shadows?: Record<string, string>;
|
|
75
|
+
/** Z-index scale */
|
|
76
|
+
zIndex?: Record<string, string | number>;
|
|
77
|
+
/** Breakpoints scale */
|
|
78
|
+
breakpoints?: Record<string, string | number>;
|
|
79
|
+
/** Transitions settings */
|
|
80
|
+
transitions?: {
|
|
81
|
+
durations?: Record<string, string>;
|
|
82
|
+
easings?: Record<string, string>;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* CSS Theme Definition
|
|
88
|
+
*/
|
|
89
|
+
export interface CSSThemeDefinition {
|
|
90
|
+
type: 'css';
|
|
91
|
+
name: string;
|
|
92
|
+
class?: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
author?: string;
|
|
95
|
+
version?: string;
|
|
96
|
+
tags?: string[];
|
|
97
|
+
supportsDarkMode?: boolean;
|
|
98
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
99
|
+
a11y?: {
|
|
100
|
+
contrastTarget?: number;
|
|
101
|
+
modes?: string[];
|
|
102
|
+
};
|
|
103
|
+
color?: string;
|
|
104
|
+
features?: string[];
|
|
105
|
+
dependencies?: string[];
|
|
106
|
+
cssPath?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* JavaScript Theme Definition
|
|
111
|
+
*/
|
|
112
|
+
export interface JSThemeDefinition {
|
|
113
|
+
type: 'js';
|
|
114
|
+
name: string;
|
|
115
|
+
class?: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
author?: string;
|
|
118
|
+
version?: string;
|
|
119
|
+
tags?: string[];
|
|
120
|
+
supportsDarkMode?: boolean;
|
|
121
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
122
|
+
a11y?: {
|
|
123
|
+
contrastTarget?: number;
|
|
124
|
+
modes?: string[];
|
|
125
|
+
};
|
|
126
|
+
color?: string;
|
|
127
|
+
features?: string[];
|
|
128
|
+
dependencies?: string[];
|
|
129
|
+
createTheme: () => Theme;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Theme Definition (CSS or JS)
|
|
134
|
+
*/
|
|
135
|
+
export type ThemeDefinition = CSSThemeDefinition | JSThemeDefinition;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Build configuration (migrated from theme.config.ts)
|
|
139
|
+
*/
|
|
140
|
+
export interface BuildConfig {
|
|
141
|
+
output?: {
|
|
142
|
+
directory?: string;
|
|
143
|
+
formats?: {
|
|
144
|
+
expanded?: string;
|
|
145
|
+
compressed?: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
sass?: {
|
|
149
|
+
style?: 'expanded' | 'compressed';
|
|
150
|
+
sourceMap?: boolean;
|
|
151
|
+
loadPaths?: string[];
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Runtime configuration (migrated from theme.config.ts)
|
|
157
|
+
*/
|
|
158
|
+
export interface RuntimeConfig {
|
|
159
|
+
basePath?: string;
|
|
160
|
+
cdnPath?: string | null;
|
|
161
|
+
preload?: string[];
|
|
162
|
+
lazy?: boolean;
|
|
163
|
+
defaultTheme?: string;
|
|
164
|
+
storageKey?: string;
|
|
165
|
+
dataAttribute?: string;
|
|
166
|
+
enablePersistence?: boolean;
|
|
167
|
+
useMinified?: boolean;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Integration settings (migrated from theme.config.ts)
|
|
172
|
+
*/
|
|
173
|
+
export interface IntegrationConfig {
|
|
174
|
+
cssVariables?: Record<string, string>;
|
|
175
|
+
classNames?: {
|
|
176
|
+
theme?: string;
|
|
177
|
+
colorMode?: string;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Atomix Configuration Interface
|
|
183
|
+
*
|
|
184
|
+
* Tailwind-like configuration for external developers.
|
|
185
|
+
* Focus on theme customization - build/runtime configs are internal only.
|
|
186
|
+
*/
|
|
187
|
+
export interface AtomixConfig {
|
|
188
|
+
/**
|
|
189
|
+
* CSS variable prefix (default: 'atomix')
|
|
190
|
+
*
|
|
191
|
+
* Change this to customize all CSS variable names.
|
|
192
|
+
* Example: prefix: 'myapp' → --myapp-primary instead of --atomix-primary
|
|
193
|
+
*/
|
|
194
|
+
prefix?: string;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Theme customization (Tailwind-like)
|
|
198
|
+
*
|
|
199
|
+
* Use `extend` to add or override design tokens.
|
|
200
|
+
* Use `tokens` to completely replace the default token system (advanced).
|
|
201
|
+
*/
|
|
202
|
+
theme?: {
|
|
203
|
+
/**
|
|
204
|
+
* Extend the default design tokens
|
|
205
|
+
*
|
|
206
|
+
* This is the recommended way to customize Atomix.
|
|
207
|
+
* Your values will override or extend the base tokens.
|
|
208
|
+
*/
|
|
209
|
+
extend?: ThemeTokens;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Override the default tokens entirely (advanced)
|
|
213
|
+
*
|
|
214
|
+
* Use with caution - this replaces the entire token system.
|
|
215
|
+
* Most users should use `extend` instead.
|
|
216
|
+
*/
|
|
217
|
+
tokens?: ThemeTokens;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Register custom themes (optional)
|
|
221
|
+
*
|
|
222
|
+
* Define CSS or JavaScript themes that can be loaded dynamically.
|
|
223
|
+
*/
|
|
224
|
+
themes?: Record<string, ThemeDefinition>;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Internal configurations (for library development only)
|
|
228
|
+
// These are not needed for external developers
|
|
229
|
+
/** @internal Build configuration (internal use only) */
|
|
230
|
+
build?: BuildConfig;
|
|
231
|
+
/** @internal Runtime configuration (internal use only) */
|
|
232
|
+
runtime?: RuntimeConfig;
|
|
233
|
+
/** @internal Integration settings (internal use only) */
|
|
234
|
+
integration?: IntegrationConfig;
|
|
235
|
+
/** @internal Theme dependencies mapping (internal use only) */
|
|
236
|
+
dependencies?: Record<string, string[]>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Helper function to define Atomix configuration with type safety
|
|
241
|
+
*
|
|
242
|
+
* @param config - Atomix configuration object
|
|
243
|
+
* @returns The configuration object
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* Helper function to define Atomix configuration with type safety
|
|
247
|
+
*
|
|
248
|
+
* Similar to Tailwind's defineConfig, provides autocomplete and type checking.
|
|
249
|
+
*
|
|
250
|
+
* @param config - Atomix configuration object
|
|
251
|
+
* @returns The configuration object
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* import { defineConfig } from '@shohojdhara/atomix/config';
|
|
256
|
+
*
|
|
257
|
+
* export default defineConfig({
|
|
258
|
+
* theme: {
|
|
259
|
+
* extend: {
|
|
260
|
+
* colors: {
|
|
261
|
+
* primary: { main: '#7AFFD7' },
|
|
262
|
+
* },
|
|
263
|
+
* },
|
|
264
|
+
* },
|
|
265
|
+
* });
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
export function defineConfig(config: AtomixConfig): AtomixConfig {
|
|
269
|
+
return config;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Export loader functions
|
|
273
|
+
export { loadAtomixConfig, resolveConfigPath } from './loader';
|
|
274
|
+
|
|
275
|
+
export default AtomixConfig;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Atomix Config Loader
|
|
3
|
+
*
|
|
4
|
+
* Helper functions to load atomix.config.ts from external projects.
|
|
5
|
+
* Similar to how Tailwind loads tailwind.config.js
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { AtomixConfig } from './index';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Load Atomix configuration from project root
|
|
12
|
+
*
|
|
13
|
+
* Attempts to load atomix.config.ts from the current working directory.
|
|
14
|
+
* Falls back to default config if file doesn't exist.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Loader options
|
|
17
|
+
* @returns Loaded configuration or default
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { loadAtomixConfig } from '@shohojdhara/atomix/config';
|
|
22
|
+
*
|
|
23
|
+
* const config = loadAtomixConfig();
|
|
24
|
+
* const theme = createThemeFromConfig(config);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function loadAtomixConfig(
|
|
28
|
+
options: {
|
|
29
|
+
/** Custom config path (default: 'atomix.config.ts') */
|
|
30
|
+
configPath?: string;
|
|
31
|
+
/** Whether to throw error if config not found (default: false) */
|
|
32
|
+
required?: boolean;
|
|
33
|
+
} = {}
|
|
34
|
+
): AtomixConfig {
|
|
35
|
+
const { configPath = 'atomix.config.ts', required = false } = options;
|
|
36
|
+
|
|
37
|
+
// Default config
|
|
38
|
+
const defaultConfig: AtomixConfig = {
|
|
39
|
+
prefix: 'atomix',
|
|
40
|
+
theme: {
|
|
41
|
+
extend: {},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// In browser environments, config loading is not supported
|
|
46
|
+
if (typeof window !== 'undefined') {
|
|
47
|
+
if (required) {
|
|
48
|
+
throw new Error('Config loading not supported in browser environment');
|
|
49
|
+
}
|
|
50
|
+
return defaultConfig;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Try to load config file
|
|
54
|
+
try {
|
|
55
|
+
// Use dynamic import for ESM compatibility
|
|
56
|
+
const configModule = require(configPath);
|
|
57
|
+
const config = configModule.default || configModule;
|
|
58
|
+
|
|
59
|
+
// Validate it's an AtomixConfig
|
|
60
|
+
if (config && typeof config === 'object') {
|
|
61
|
+
return config as AtomixConfig;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
throw new Error('Invalid config format');
|
|
65
|
+
} catch (error: any) {
|
|
66
|
+
if (required) {
|
|
67
|
+
throw new Error(`Failed to load config from ${configPath}: ${error.message}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Return default config if not required
|
|
71
|
+
return defaultConfig;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Resolve config path
|
|
77
|
+
*
|
|
78
|
+
* Finds atomix.config.ts in the project, checking common locations.
|
|
79
|
+
*/
|
|
80
|
+
export function resolveConfigPath(): string | null {
|
|
81
|
+
if (typeof process === 'undefined' || !process.cwd) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const fs = require('fs');
|
|
86
|
+
const path = require('path');
|
|
87
|
+
|
|
88
|
+
const cwd = process.cwd();
|
|
89
|
+
const possiblePaths = [
|
|
90
|
+
path.join(cwd, 'atomix.config.ts'),
|
|
91
|
+
path.join(cwd, 'atomix.config.js'),
|
|
92
|
+
path.join(cwd, 'atomix.config.mjs'),
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
for (const configPath of possiblePaths) {
|
|
96
|
+
if (fs.existsSync(configPath)) {
|
|
97
|
+
return configPath;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export default loadAtomixConfig;
|
|
105
|
+
|
package/src/lib/index.ts
CHANGED
|
@@ -185,7 +185,6 @@ export function createThemeVariants(baseTheme: ThemeOptions): {
|
|
|
185
185
|
...baseTheme.palette,
|
|
186
186
|
background: {
|
|
187
187
|
default: '#121212',
|
|
188
|
-
paper: '#1E1E1E',
|
|
189
188
|
subtle: '#2A2A2A',
|
|
190
189
|
...baseTheme.palette?.background,
|
|
191
190
|
},
|
|
@@ -304,7 +303,6 @@ export function createThemePreset(
|
|
|
304
303
|
secondary: { main: '#FFFFFF' },
|
|
305
304
|
background: {
|
|
306
305
|
default: '#FFFFFF',
|
|
307
|
-
paper: '#F5F5F5',
|
|
308
306
|
subtle: '#FAFAFA',
|
|
309
307
|
},
|
|
310
308
|
},
|
|
@@ -319,7 +317,6 @@ export function createThemePreset(
|
|
|
319
317
|
secondary: { main: '#FF5733' },
|
|
320
318
|
background: {
|
|
321
319
|
default: '#FAFAFA',
|
|
322
|
-
paper: '#FFFFFF',
|
|
323
320
|
subtle: '#F5F5F5',
|
|
324
321
|
},
|
|
325
322
|
},
|
|
@@ -334,7 +331,6 @@ export function createThemePreset(
|
|
|
334
331
|
secondary: { main: '#DC004E' },
|
|
335
332
|
background: {
|
|
336
333
|
default: '#FFFFFF',
|
|
337
|
-
paper: '#F5F5F5',
|
|
338
334
|
subtle: '#EEEEEE',
|
|
339
335
|
},
|
|
340
336
|
},
|
|
@@ -349,7 +345,6 @@ export function createThemePreset(
|
|
|
349
345
|
secondary: { main: '#4ECDC4' },
|
|
350
346
|
background: {
|
|
351
347
|
default: '#FFF8F0',
|
|
352
|
-
paper: '#FFFFFF',
|
|
353
348
|
subtle: '#FFF0E0',
|
|
354
349
|
},
|
|
355
350
|
},
|
|
@@ -13,7 +13,9 @@ import { validateConfig } from './validator';
|
|
|
13
13
|
import { ThemeError, ThemeErrorCode, getLogger } from '../errors';
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_CONFIG_PATH,
|
|
16
|
+
DEFAULT_ATOMIX_CONFIG_PATH,
|
|
16
17
|
DEFAULT_CONFIG_RELATIVE_PATH,
|
|
18
|
+
DEFAULT_LEGACY_CONFIG_RELATIVE_PATH,
|
|
17
19
|
DEFAULT_BASE_PATH,
|
|
18
20
|
DEFAULT_STORAGE_KEY,
|
|
19
21
|
DEFAULT_DATA_ATTRIBUTE,
|
|
@@ -50,7 +52,7 @@ export function loadThemeConfig(
|
|
|
50
52
|
options: ConfigLoaderOptions = {}
|
|
51
53
|
): LoadedThemeConfig {
|
|
52
54
|
const {
|
|
53
|
-
configPath =
|
|
55
|
+
configPath = DEFAULT_ATOMIX_CONFIG_PATH,
|
|
54
56
|
validate = true,
|
|
55
57
|
env = typeof process !== 'undefined' && process.env ? (process.env.NODE_ENV === 'production' ? 'production' : 'development') : 'development',
|
|
56
58
|
} = options;
|
|
@@ -62,67 +64,99 @@ export function loadThemeConfig(
|
|
|
62
64
|
|
|
63
65
|
// Try to load config dynamically
|
|
64
66
|
let config: LoadedThemeConfig;
|
|
65
|
-
|
|
67
|
+
|
|
66
68
|
try {
|
|
67
|
-
// In browser/Vite environment, we can't load
|
|
68
|
-
// This is expected and we'll use the fallback config
|
|
69
|
+
// In browser/Vite environment, we can't load config dynamically
|
|
69
70
|
if (typeof window !== 'undefined') {
|
|
70
71
|
throw new Error('Theme config loading not supported in browser environment');
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
// In
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
|
|
74
|
+
// In ESM environments, require might be undefined.
|
|
75
|
+
let nodeRequire: any;
|
|
76
|
+
try {
|
|
77
|
+
nodeRequire = require;
|
|
78
|
+
} catch {
|
|
79
|
+
// require is not defined
|
|
77
80
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
|
|
82
|
+
if (!nodeRequire) {
|
|
83
|
+
throw new Error('Theme config loading not supported in this environment (require is undefined)');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Type for config module
|
|
87
|
+
interface ConfigModule {
|
|
88
|
+
default?: any;
|
|
82
89
|
[key: string]: unknown;
|
|
83
90
|
}
|
|
84
|
-
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
// Try require (Node.js/CommonJS)
|
|
91
|
+
|
|
92
|
+
let configModule: ConfigModule;
|
|
93
|
+
|
|
94
|
+
// Try require (Node.js/CommonJS)
|
|
88
95
|
try {
|
|
89
|
-
// Try relative path first
|
|
96
|
+
// Try relative path first
|
|
90
97
|
try {
|
|
91
|
-
|
|
98
|
+
configModule = nodeRequire(DEFAULT_CONFIG_RELATIVE_PATH) as ConfigModule;
|
|
92
99
|
} catch {
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
// Try fallback to legacy relative path
|
|
101
|
+
try {
|
|
102
|
+
configModule = nodeRequire(DEFAULT_LEGACY_CONFIG_RELATIVE_PATH) as ConfigModule;
|
|
103
|
+
} catch {
|
|
104
|
+
// If relative paths fail, try to resolve from process.cwd()
|
|
105
|
+
const path = nodeRequire('path') as typeof import('path');
|
|
106
|
+
const fs = nodeRequire('fs') as typeof import('fs');
|
|
107
|
+
|
|
108
|
+
let configFilePath = path.resolve(process.cwd(), configPath);
|
|
109
|
+
|
|
110
|
+
// Fallback if atomix.config.ts not found
|
|
111
|
+
if (!fs.existsSync(configFilePath) && configPath === DEFAULT_ATOMIX_CONFIG_PATH) {
|
|
112
|
+
configFilePath = path.resolve(process.cwd(), DEFAULT_CONFIG_PATH);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (fs.existsSync(configFilePath)) {
|
|
116
|
+
const resolvedPath = nodeRequire.resolve(configFilePath);
|
|
117
|
+
if (nodeRequire.cache && nodeRequire.cache[resolvedPath]) {
|
|
118
|
+
delete nodeRequire.cache[resolvedPath];
|
|
119
|
+
}
|
|
120
|
+
configModule = nodeRequire(configFilePath) as ConfigModule;
|
|
121
|
+
} else {
|
|
122
|
+
throw new Error(`Config file not found: ${configFilePath}`);
|
|
104
123
|
}
|
|
105
|
-
themeConfigModule = require(configFilePath) as ThemeConfigModule;
|
|
106
|
-
} else {
|
|
107
|
-
throw new Error(`Config file not found: ${configFilePath}`);
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
126
|
} catch (requireError) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
? requireError.message
|
|
127
|
+
const errorMessage = requireError instanceof Error
|
|
128
|
+
? requireError.message
|
|
114
129
|
: String(requireError);
|
|
115
130
|
throw new ThemeError(
|
|
116
|
-
`Cannot load
|
|
131
|
+
`Cannot load config: ${errorMessage}`,
|
|
117
132
|
ThemeErrorCode.CONFIG_LOAD_FAILED,
|
|
118
133
|
{ configPath, error: errorMessage }
|
|
119
134
|
);
|
|
120
135
|
}
|
|
121
|
-
|
|
122
|
-
const rawConfig =
|
|
136
|
+
|
|
137
|
+
const rawConfig = configModule.default || configModule;
|
|
138
|
+
|
|
139
|
+
// Handle new AtomixConfig structure vs legacy ThemeConfig
|
|
140
|
+
let processedConfig: any;
|
|
141
|
+
if (rawConfig.theme && (rawConfig.theme.themes || rawConfig.theme.tokens || rawConfig.theme.extend)) {
|
|
142
|
+
// New AtomixConfig structure
|
|
143
|
+
processedConfig = {
|
|
144
|
+
themes: rawConfig.theme.themes || {},
|
|
145
|
+
build: rawConfig.build || {},
|
|
146
|
+
runtime: rawConfig.runtime || {},
|
|
147
|
+
integration: rawConfig.integration || {},
|
|
148
|
+
dependencies: rawConfig.dependencies || {},
|
|
149
|
+
// Store tokens for generator
|
|
150
|
+
__tokens: rawConfig.theme.tokens,
|
|
151
|
+
__extend: rawConfig.theme.extend,
|
|
152
|
+
};
|
|
153
|
+
} else {
|
|
154
|
+
// Legacy ThemeConfig structure
|
|
155
|
+
processedConfig = { ...rawConfig };
|
|
156
|
+
}
|
|
123
157
|
|
|
124
158
|
// Apply environment-specific overrides
|
|
125
|
-
|
|
159
|
+
processedConfig = applyEnvOverrides(processedConfig, env);
|
|
126
160
|
|
|
127
161
|
// Validate if requested
|
|
128
162
|
let validationResult: ConfigValidationResult | null = null;
|
|
@@ -143,7 +177,7 @@ export function loadThemeConfig(
|
|
|
143
177
|
configPath,
|
|
144
178
|
error: errorMessage,
|
|
145
179
|
});
|
|
146
|
-
|
|
180
|
+
|
|
147
181
|
config = {
|
|
148
182
|
themes: {},
|
|
149
183
|
build: {
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type {
|
|
8
|
-
|
|
9
|
-
ThemeDefinition,
|
|
10
|
-
CSSThemeDefinition,
|
|
11
|
-
JSThemeDefinition,
|
|
8
|
+
AtomixConfig,
|
|
12
9
|
BuildConfig,
|
|
13
10
|
RuntimeConfig,
|
|
14
11
|
IntegrationConfig,
|
|
15
|
-
|
|
12
|
+
ThemeDefinition,
|
|
13
|
+
CSSThemeDefinition,
|
|
14
|
+
JSThemeDefinition,
|
|
15
|
+
} from '../../config';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Configuration loader options
|
|
@@ -29,13 +29,27 @@ export interface ConfigLoaderOptions {
|
|
|
29
29
|
/**
|
|
30
30
|
* Loaded and validated theme configuration
|
|
31
31
|
*/
|
|
32
|
-
export interface LoadedThemeConfig
|
|
32
|
+
export interface LoadedThemeConfig {
|
|
33
|
+
/** Registered themes */
|
|
34
|
+
themes: Record<string, ThemeDefinition>;
|
|
35
|
+
/** Build configuration */
|
|
36
|
+
build: BuildConfig;
|
|
37
|
+
/** Runtime configuration */
|
|
38
|
+
runtime: RuntimeConfig;
|
|
39
|
+
/** Integration settings */
|
|
40
|
+
integration: IntegrationConfig;
|
|
41
|
+
/** Theme dependencies mapping */
|
|
42
|
+
dependencies: Record<string, string[]>;
|
|
33
43
|
/** Whether config was validated */
|
|
34
44
|
validated: boolean;
|
|
35
45
|
/** Validation errors (if any) */
|
|
36
46
|
errors?: string[];
|
|
37
47
|
/** Validation warnings (if any) */
|
|
38
48
|
warnings?: string[];
|
|
49
|
+
/** Internal tokens (for generator) */
|
|
50
|
+
__tokens?: any;
|
|
51
|
+
/** Internal extensions (for generator) */
|
|
52
|
+
__extend?: any;
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
/**
|
|
@@ -88,7 +102,7 @@ export interface ConfigValidationResult {
|
|
|
88
102
|
}
|
|
89
103
|
|
|
90
104
|
export type {
|
|
91
|
-
|
|
105
|
+
AtomixConfig,
|
|
92
106
|
ThemeDefinition,
|
|
93
107
|
CSSThemeDefinition,
|
|
94
108
|
JSThemeDefinition,
|
|
@@ -54,14 +54,24 @@ export const CSS_EXTENSIONS = {
|
|
|
54
54
|
} as const;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* Default config file path
|
|
57
|
+
* Default Atomix config file path
|
|
58
|
+
*/
|
|
59
|
+
export const DEFAULT_ATOMIX_CONFIG_PATH = 'atomix.config.ts';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Default config file path (legacy)
|
|
58
63
|
*/
|
|
59
64
|
export const DEFAULT_CONFIG_PATH = 'theme.config.ts';
|
|
60
65
|
|
|
61
66
|
/**
|
|
62
67
|
* Default config file path (relative)
|
|
63
68
|
*/
|
|
64
|
-
export const DEFAULT_CONFIG_RELATIVE_PATH = '../../../../
|
|
69
|
+
export const DEFAULT_CONFIG_RELATIVE_PATH = '../../../../atomix.config';
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Default legacy config file path (relative)
|
|
73
|
+
*/
|
|
74
|
+
export const DEFAULT_LEGACY_CONFIG_RELATIVE_PATH = '../../../../theme.config';
|
|
65
75
|
|
|
66
76
|
/**
|
|
67
77
|
* Validation thresholds
|