@shohojdhara/atomix 0.3.1 → 0.3.3
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/CHANGELOG.md +0 -1
- package/README.md +41 -24
- package/dist/atomix.css +540 -666
- package/dist/atomix.min.css +3 -3
- package/dist/index.d.ts +7559 -5717
- package/dist/index.esm.js +5013 -2301
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5084 -2356
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/themes/applemix.css +1683 -722
- package/dist/themes/applemix.css.map +1 -0
- package/dist/themes/applemix.min.css +13 -10
- package/dist/themes/boomdevs.css +1358 -544
- package/dist/themes/boomdevs.css.map +1 -0
- package/dist/themes/boomdevs.min.css +13 -10
- package/dist/themes/esrar.css +1743 -718
- package/dist/themes/esrar.css.map +1 -0
- package/dist/themes/esrar.min.css +41 -7
- package/dist/themes/flashtrade.css +1735 -752
- package/dist/themes/flashtrade.css.map +1 -0
- package/dist/themes/flashtrade.min.css +19 -13
- package/dist/themes/mashroom.css +1765 -787
- package/dist/themes/mashroom.css.map +1 -0
- package/dist/themes/mashroom.min.css +87 -38
- package/dist/themes/shaj-default.css +1685 -713
- package/dist/themes/shaj-default.css.map +1 -0
- package/dist/themes/shaj-default.min.css +11 -7
- package/package.json +95 -26
- package/scripts/atomix-cli.js +1428 -0
- package/scripts/build-themes.js +208 -0
- package/scripts/cli/interactive-init.js +528 -0
- package/scripts/cli/migration-tools.js +603 -0
- package/scripts/cli/token-manager.js +519 -0
- package/scripts/sync-theme-config.js +309 -0
- package/src/components/List/ListGroup.tsx +1 -2
- package/src/components/Popover/Popover.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +49 -12
- package/src/components/Tooltip/Tooltip.tsx +32 -58
- package/src/lib/composables/useAtomixGlass.ts +46 -46
- package/src/lib/composables/useTooltip.ts +285 -0
- package/src/lib/constants/cssVariables.ts +390 -0
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +151 -0
- package/src/lib/hooks/index.ts +19 -0
- package/src/lib/hooks/useComponentCustomization.ts +175 -0
- package/src/lib/index.ts +10 -1
- package/src/lib/patterns/__tests__/slots.test.ts +108 -0
- package/src/lib/patterns/index.ts +35 -0
- package/src/lib/patterns/slots.tsx +421 -0
- package/src/lib/theme/__tests__/ThemeBuilder.test.ts +223 -0
- package/src/lib/theme/builders/ThemeBuilder.ts +372 -0
- package/src/lib/theme/config/index.ts +21 -0
- package/src/lib/theme/config/loader.ts +276 -0
- package/src/lib/theme/config/types.ts +98 -0
- package/src/lib/theme/config/validator.ts +326 -0
- package/src/lib/theme/constants.ts +183 -0
- package/src/lib/theme/core/ThemeCache.ts +283 -0
- package/src/lib/theme/core/ThemeEngine.test.ts +146 -0
- package/src/lib/theme/core/ThemeEngine.ts +657 -0
- package/src/lib/theme/core/ThemeRegistry.ts +284 -0
- package/src/lib/theme/core/ThemeValidator.ts +530 -0
- package/src/lib/theme/core/index.ts +24 -0
- package/src/lib/theme/createTheme.ts +83 -204
- package/src/lib/theme/cssVariableMapper.ts +261 -0
- package/src/lib/theme/devtools/CLI.ts +279 -0
- package/src/lib/theme/devtools/Inspector.tsx +594 -0
- package/src/lib/theme/devtools/Preview.tsx +392 -0
- package/src/lib/theme/devtools/index.ts +21 -0
- package/src/lib/theme/errors.test.ts +207 -0
- package/src/lib/theme/errors.ts +233 -0
- package/src/lib/theme/generateCSSVariables.ts +93 -9
- package/src/lib/theme/generators/CSSGenerator.ts +311 -0
- package/src/lib/theme/generators/ConfigGenerator.ts +287 -0
- package/src/lib/theme/generators/TypeGenerator.ts +228 -0
- package/src/lib/theme/generators/index.ts +21 -0
- package/src/lib/theme/i18n/index.ts +9 -0
- package/src/lib/theme/i18n/rtl.ts +325 -0
- package/src/lib/theme/index.ts +36 -109
- package/src/lib/theme/monitoring/ThemeAnalytics.ts +409 -0
- package/src/lib/theme/monitoring/index.ts +17 -0
- package/src/lib/theme/overrides/ComponentOverrides.ts +243 -0
- package/src/lib/theme/overrides/index.ts +15 -0
- package/src/lib/theme/runtime/ThemeApplicator.ts +252 -0
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +233 -0
- package/src/lib/theme/runtime/ThemeManager.test.ts +176 -0
- package/src/lib/theme/runtime/ThemeManager.ts +442 -0
- package/src/lib/theme/runtime/ThemeProvider.tsx +318 -0
- package/src/lib/theme/runtime/index.ts +17 -0
- package/src/lib/theme/runtime/useTheme.ts +52 -0
- package/src/lib/theme/themeUtils.ts +27 -5
- package/src/lib/theme/types.ts +62 -1
- package/src/lib/theme/utils.ts +23 -22
- package/src/lib/theme/whitelabel/WhiteLabelManager.ts +364 -0
- package/src/lib/theme/whitelabel/index.ts +13 -0
- package/src/lib/theme-tools.ts +185 -0
- package/src/lib/types/components.ts +194 -0
- package/src/lib/types/partProps.ts +426 -0
- package/src/lib/utils/__tests__/componentUtils.test.ts +144 -0
- package/src/lib/utils/componentUtils.ts +163 -0
- package/src/lib/utils/index.ts +17 -57
- package/src/styles/01-settings/_settings.badge.scss +1 -1
- package/src/styles/01-settings/_settings.callout.scss +1 -1
- package/src/styles/01-settings/_settings.card.scss +1 -1
- package/src/styles/01-settings/_settings.colors.scss +10 -10
- package/src/styles/01-settings/_settings.input.scss +1 -1
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/01-settings/_settings.upload.scss +1 -1
- package/src/styles/06-components/_components.chart.scss +2 -2
- package/src/styles/06-components/_components.tooltip.scss +31 -81
- package/src/styles/99-utilities/_utilities.border.scss +27 -58
- package/src/styles/99-utilities/_utilities.gradient.scss +12 -0
- package/src/styles/99-utilities/_utilities.position.scss +8 -15
- package/src/styles/99-utilities/_utilities.scss +2 -0
- package/src/styles/99-utilities/_utilities.spacing.scss +76 -121
- package/src/styles/99-utilities/_utilities.text.scss +30 -49
- package/src/themes/README.md +443 -0
- package/src/themes/THEME_CHECKLIST.md +74 -0
- package/src/themes/applemix/01-settings/_index.scss +24 -0
- package/src/themes/applemix/01-settings/_settings.animations.scss +0 -0
- package/src/themes/applemix/01-settings/_settings.background.scss +6 -0
- package/src/themes/applemix/01-settings/_settings.colors.scss +75 -0
- package/src/themes/applemix/01-settings/_settings.config.scss +15 -0
- package/src/themes/applemix/01-settings/_settings.typography.scss +30 -0
- package/src/themes/applemix/02-tools/_index.scss +4 -0
- package/src/themes/applemix/03-generic/_index.scss +7 -0
- package/src/themes/applemix/04-elements/_index.scss +7 -0
- package/src/themes/applemix/05-objects/_index.scss +7 -0
- package/src/themes/applemix/06-components/_index.scss +15 -0
- package/src/themes/applemix/99-utilities/_index.scss +7 -0
- package/src/themes/applemix/README.md +378 -0
- package/src/themes/applemix/index.scss +33 -0
- package/src/themes/boomdevs/01-settings/_index.scss +38 -0
- package/src/themes/boomdevs/01-settings/_settings.accordion.scss +12 -0
- package/src/themes/boomdevs/01-settings/_settings.animations.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.avatar.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.badge.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.border-radius.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.border.scss +10 -0
- package/src/themes/boomdevs/01-settings/_settings.box-shadow.scss +14 -0
- package/src/themes/boomdevs/01-settings/_settings.breadcrumb.scss +13 -0
- package/src/themes/boomdevs/01-settings/_settings.breakpoints.scss +15 -0
- package/src/themes/boomdevs/01-settings/_settings.button.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.callout.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.card.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.checkbox.scss +9 -0
- package/src/themes/boomdevs/01-settings/_settings.colors.scss +145 -0
- package/src/themes/boomdevs/01-settings/_settings.dropdown.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.grid.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.input.scss +14 -0
- package/src/themes/boomdevs/01-settings/_settings.link.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.list.scss +10 -0
- package/src/themes/boomdevs/01-settings/_settings.modal.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.navbar.scss +16 -0
- package/src/themes/boomdevs/01-settings/_settings.pagination.scss +13 -0
- package/src/themes/boomdevs/01-settings/_settings.progress.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.rating.scss +10 -0
- package/src/themes/boomdevs/01-settings/_settings.spacing.scss +33 -0
- package/src/themes/boomdevs/01-settings/_settings.spinner.scss +11 -0
- package/src/themes/boomdevs/01-settings/_settings.steps.scss +12 -0
- package/src/themes/boomdevs/01-settings/_settings.tabs.scss +12 -0
- package/src/themes/boomdevs/01-settings/_settings.todo.scss +15 -0
- package/src/themes/boomdevs/01-settings/_settings.toggle.scss +14 -0
- package/src/themes/boomdevs/01-settings/_settings.tooltip.scss +13 -0
- package/src/themes/boomdevs/01-settings/_settings.typography.scss +58 -0
- package/src/themes/boomdevs/01-settings/_settings.video-player.scss +12 -0
- package/src/themes/boomdevs/02-tools/_index.scss +7 -0
- package/src/themes/boomdevs/03-generic/_index.scss +7 -0
- package/src/themes/boomdevs/04-elements/_index.scss +7 -0
- package/src/themes/boomdevs/05-objects/_index.scss +7 -0
- package/src/themes/boomdevs/06-components/_components.button.scss +11 -0
- package/src/themes/boomdevs/06-components/_index.scss +11 -0
- package/src/themes/boomdevs/99-utilities/_index.scss +7 -0
- package/src/themes/boomdevs/index.scss +26 -0
- package/src/themes/esrar/01-settings/_index.scss +15 -0
- package/src/themes/esrar/01-settings/_settings.colors.scss +91 -0
- package/src/themes/esrar/02-tools/_index.scss +8 -0
- package/src/themes/esrar/02-tools/_tools.animations.scss +342 -0
- package/src/themes/esrar/06-components/_components.accordion.scss +49 -0
- package/src/themes/esrar/06-components/_components.avatar-group.scss +14 -0
- package/src/themes/esrar/06-components/_components.avatar.scss +61 -0
- package/src/themes/esrar/06-components/_components.badge.scss +117 -0
- package/src/themes/esrar/06-components/_components.breadcrumb.scss +65 -0
- package/src/themes/esrar/06-components/_components.btn-group.scss +19 -0
- package/src/themes/esrar/06-components/_components.button.scss +224 -0
- package/src/themes/esrar/06-components/_components.callout.scss +51 -0
- package/src/themes/esrar/06-components/_components.card.scss +134 -0
- package/src/themes/esrar/06-components/_components.chart.scss +24 -0
- package/src/themes/esrar/06-components/_components.checkbox-group.scss +26 -0
- package/src/themes/esrar/06-components/_components.checkbox.scss +71 -0
- package/src/themes/esrar/06-components/_components.color-mode-toggle.scss +29 -0
- package/src/themes/esrar/06-components/_components.countdown.scss +67 -0
- package/src/themes/esrar/06-components/_components.data-table.scss +22 -0
- package/src/themes/esrar/06-components/_components.datepicker.scss +20 -0
- package/src/themes/esrar/06-components/_components.dropdown.scss +272 -0
- package/src/themes/esrar/06-components/_components.edge-panel.scss +10 -0
- package/src/themes/esrar/06-components/_components.form-group.scss +15 -0
- package/src/themes/esrar/06-components/_components.form.scss +66 -0
- package/src/themes/esrar/06-components/_components.hero.scss +251 -0
- package/src/themes/esrar/06-components/_components.icon.scss +33 -0
- package/src/themes/esrar/06-components/_components.image-gallery.scss +29 -0
- package/src/themes/esrar/06-components/_components.input.scss +91 -0
- package/src/themes/esrar/06-components/_components.list-group.scss +26 -0
- package/src/themes/esrar/06-components/_components.modal.scss +148 -0
- package/src/themes/esrar/06-components/_components.notification.scss +80 -0
- package/src/themes/esrar/06-components/_components.pagination.scss +84 -0
- package/src/themes/esrar/06-components/_components.popover.scss +10 -0
- package/src/themes/esrar/06-components/_components.progress.scss +64 -0
- package/src/themes/esrar/06-components/_components.rating.scss +26 -0
- package/src/themes/esrar/06-components/_components.skeleton.scss +15 -0
- package/src/themes/esrar/06-components/_components.slider.scss +90 -0
- package/src/themes/esrar/06-components/_components.spinner.scss +71 -0
- package/src/themes/esrar/06-components/_components.steps.scss +76 -0
- package/src/themes/esrar/06-components/_components.tab.scss +58 -0
- package/src/themes/esrar/06-components/_components.tag.scss +21 -0
- package/src/themes/esrar/06-components/_components.timeline.scss +19 -0
- package/src/themes/esrar/06-components/_components.toast.scss +91 -0
- package/src/themes/esrar/06-components/_components.toggle.scss +74 -0
- package/src/themes/esrar/06-components/_components.tooltip.scss +45 -0
- package/src/themes/esrar/06-components/_components.upload.scss +102 -0
- package/src/themes/esrar/06-components/_index.scss +42 -0
- package/src/themes/esrar/index.scss +30 -0
- package/src/themes/flashtrade/01-settings/_index.scss +19 -0
- package/src/themes/flashtrade/01-settings/_settings.animations.scss +11 -0
- package/src/themes/flashtrade/01-settings/_settings.background.scss +9 -0
- package/src/themes/flashtrade/01-settings/_settings.colors.scss +79 -0
- package/src/themes/flashtrade/01-settings/_settings.config.scss +16 -0
- package/src/themes/flashtrade/01-settings/_settings.typography.scss +35 -0
- package/src/themes/flashtrade/02-tools/_index.scss +8 -0
- package/src/themes/flashtrade/03-generic/_index.scss +8 -0
- package/src/themes/flashtrade/04-elements/_index.scss +12 -0
- package/src/themes/flashtrade/05-objects/_index.scss +8 -0
- package/src/themes/flashtrade/06-components/_components.badge.scss +156 -0
- package/src/themes/flashtrade/06-components/_components.button.scss +135 -0
- package/src/themes/flashtrade/06-components/_components.card.scss +214 -0
- package/src/themes/flashtrade/06-components/_components.navbar.scss +227 -0
- package/src/themes/flashtrade/06-components/_index.scss +13 -0
- package/src/themes/flashtrade/99-utilities/_index.scss +9 -0
- package/src/themes/flashtrade/99-utilities/_utilities.trading.scss +187 -0
- package/src/themes/flashtrade/README.md +386 -0
- package/src/themes/flashtrade/demo.html +272 -0
- package/src/themes/flashtrade/index.scss +36 -0
- package/src/themes/mashroom/01-settings/_index.scss +69 -0
- package/src/themes/mashroom/01-settings/_settings.accordion.scss +32 -0
- package/src/themes/mashroom/01-settings/_settings.animations.scss +26 -0
- package/src/themes/mashroom/01-settings/_settings.avatar-group.scss +22 -0
- package/src/themes/mashroom/01-settings/_settings.avatar.scss +57 -0
- package/src/themes/mashroom/01-settings/_settings.badge.scss +19 -0
- package/src/themes/mashroom/01-settings/_settings.border-radius.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.border.scss +14 -0
- package/src/themes/mashroom/01-settings/_settings.box-shadow.scss +40 -0
- package/src/themes/mashroom/01-settings/_settings.breadcrumb.scss +0 -0
- package/src/themes/mashroom/01-settings/_settings.breakpoints.scss +17 -0
- package/src/themes/mashroom/01-settings/_settings.btn-group.scss +5 -0
- package/src/themes/mashroom/01-settings/_settings.button.scss +50 -0
- package/src/themes/mashroom/01-settings/_settings.callout.scss +81 -0
- package/src/themes/mashroom/01-settings/_settings.card.scss +52 -0
- package/src/themes/mashroom/01-settings/_settings.checkbox-group.scss +5 -0
- package/src/themes/mashroom/01-settings/_settings.checkbox.scss +23 -0
- package/src/themes/mashroom/01-settings/_settings.color-mode.scss +7 -0
- package/src/themes/mashroom/01-settings/_settings.colors.scss +180 -0
- package/src/themes/mashroom/01-settings/_settings.config.scss +4 -0
- package/src/themes/mashroom/01-settings/_settings.countdown.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.data-table.scss +56 -0
- package/src/themes/mashroom/01-settings/_settings.datepicker.scss +45 -0
- package/src/themes/mashroom/01-settings/_settings.design-tokens.scss +3 -0
- package/src/themes/mashroom/01-settings/_settings.dropdown.scss +45 -0
- package/src/themes/mashroom/01-settings/_settings.edge-panel.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.fonts.scss +8 -0
- package/src/themes/mashroom/01-settings/_settings.form-group.scss +14 -0
- package/src/themes/mashroom/01-settings/_settings.form.scss +6 -0
- package/src/themes/mashroom/01-settings/_settings.grid.scss +23 -0
- package/src/themes/mashroom/01-settings/_settings.hero.scss +41 -0
- package/src/themes/mashroom/01-settings/_settings.input.scss +51 -0
- package/src/themes/mashroom/01-settings/_settings.link.scss +13 -0
- package/src/themes/mashroom/01-settings/_settings.list-group.scss +16 -0
- package/src/themes/mashroom/01-settings/_settings.list.scss +13 -0
- package/src/themes/mashroom/01-settings/_settings.masonry-grid.scss +23 -0
- package/src/themes/mashroom/01-settings/_settings.menu.scss +50 -0
- package/src/themes/mashroom/01-settings/_settings.messages.scss +98 -0
- package/src/themes/mashroom/01-settings/_settings.modal.scss +41 -0
- package/src/themes/mashroom/01-settings/_settings.nav.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.navbar.scss +54 -0
- package/src/themes/mashroom/01-settings/_settings.pagination.scss +30 -0
- package/src/themes/mashroom/01-settings/_settings.photoviewer.scss +45 -0
- package/src/themes/mashroom/01-settings/_settings.popover.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.position.scss +9 -0
- package/src/themes/mashroom/01-settings/_settings.progress.scss +17 -0
- package/src/themes/mashroom/01-settings/_settings.rating.scss +11 -0
- package/src/themes/mashroom/01-settings/_settings.river.scss +50 -0
- package/src/themes/mashroom/01-settings/_settings.sectionintro.scss +31 -0
- package/src/themes/mashroom/01-settings/_settings.select.scss +47 -0
- package/src/themes/mashroom/01-settings/_settings.side-menu.scss +79 -0
- package/src/themes/mashroom/01-settings/_settings.skeleton.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.spacing.scss +66 -0
- package/src/themes/mashroom/01-settings/_settings.spinner.scss +34 -0
- package/src/themes/mashroom/01-settings/_settings.steps.scss +33 -0
- package/src/themes/mashroom/01-settings/_settings.tabs.scss +33 -0
- package/src/themes/mashroom/01-settings/_settings.testimonials.scss +24 -0
- package/src/themes/mashroom/01-settings/_settings.todo.scss +52 -0
- package/src/themes/mashroom/01-settings/_settings.toggle.scss +49 -0
- package/src/themes/mashroom/01-settings/_settings.tooltip.scss +20 -0
- package/src/themes/mashroom/01-settings/_settings.typography.scss +95 -0
- package/src/themes/mashroom/01-settings/_settings.upload.scss +96 -0
- package/src/themes/mashroom/01-settings/_settings.z-layers.scss +19 -0
- package/src/themes/mashroom/02-tools/_index.scss +8 -0
- package/src/themes/mashroom/02-tools/_tools.psychedelic-gradients.scss +78 -0
- package/src/themes/mashroom/02-tools/_tools.trippy-effects.scss +114 -0
- package/src/themes/mashroom/03-generic/_index.scss +6 -0
- package/src/themes/mashroom/04-elements/_index.scss +6 -0
- package/src/themes/mashroom/05-objects/_index.scss +6 -0
- package/src/themes/mashroom/06-components/_components.accordion.scss +187 -0
- package/src/themes/mashroom/06-components/_components.avatar-group.scss +276 -0
- package/src/themes/mashroom/06-components/_components.avatar.scss +114 -0
- package/src/themes/mashroom/06-components/_components.badge.scss +152 -0
- package/src/themes/mashroom/06-components/_components.breadcrumb.scss +162 -0
- package/src/themes/mashroom/06-components/_components.btn-group.scss +404 -0
- package/src/themes/mashroom/06-components/_components.button.scss +160 -0
- package/src/themes/mashroom/06-components/_components.callout.scss +140 -0
- package/src/themes/mashroom/06-components/_components.card.scss +225 -0
- package/src/themes/mashroom/06-components/_components.checkbox.scss +186 -0
- package/src/themes/mashroom/06-components/_components.color-mode-toggle.scss +308 -0
- package/src/themes/mashroom/06-components/_components.countdown.scss +402 -0
- package/src/themes/mashroom/06-components/_components.data-table.scss +354 -0
- package/src/themes/mashroom/06-components/_components.datepicker.scss +349 -0
- package/src/themes/mashroom/06-components/_components.dropdown.scss +334 -0
- package/src/themes/mashroom/06-components/_components.edge-panel.scss +413 -0
- package/src/themes/mashroom/06-components/_components.form-group.scss +433 -0
- package/src/themes/mashroom/06-components/_components.form.scss +358 -0
- package/src/themes/mashroom/06-components/_components.hero.scss +151 -0
- package/src/themes/mashroom/06-components/_components.input.scss +147 -0
- package/src/themes/mashroom/06-components/_components.list-group.scss +456 -0
- package/src/themes/mashroom/06-components/_components.list.scss +145 -0
- package/src/themes/mashroom/06-components/_components.menu.scss +497 -0
- package/src/themes/mashroom/06-components/_components.messages.scss +277 -0
- package/src/themes/mashroom/06-components/_components.modal.scss +264 -0
- package/src/themes/mashroom/06-components/_components.nav.scss +181 -0
- package/src/themes/mashroom/06-components/_components.navbar.scss +538 -0
- package/src/themes/mashroom/06-components/_components.pagination.scss +400 -0
- package/src/themes/mashroom/06-components/_components.photoviewer.scss +498 -0
- package/src/themes/mashroom/06-components/_components.popover.scss +383 -0
- package/src/themes/mashroom/06-components/_components.product-review.scss +408 -0
- package/src/themes/mashroom/06-components/_components.progress.scss +249 -0
- package/src/themes/mashroom/06-components/_components.rating.scss +300 -0
- package/src/themes/mashroom/06-components/_components.river.scss +570 -0
- package/src/themes/mashroom/06-components/_components.sectionintro.scss +546 -0
- package/src/themes/mashroom/06-components/_components.select.scss +455 -0
- package/src/themes/mashroom/06-components/_components.side-menu.scss +635 -0
- package/src/themes/mashroom/06-components/_components.skeleton.scss +447 -0
- package/src/themes/mashroom/06-components/_components.slider.scss +414 -0
- package/src/themes/mashroom/06-components/_components.spinner.scss +198 -0
- package/src/themes/mashroom/06-components/_components.steps.scss +350 -0
- package/src/themes/mashroom/06-components/_components.tabs.scss +269 -0
- package/src/themes/mashroom/06-components/_components.testimonials.scss +561 -0
- package/src/themes/mashroom/06-components/_components.toggle.scss +231 -0
- package/src/themes/mashroom/06-components/_components.tooltip.scss +167 -0
- package/src/themes/mashroom/06-components/_components.upload.scss +537 -0
- package/src/themes/mashroom/06-components/_components.video-player.scss +560 -0
- package/src/themes/mashroom/06-components/_index.scss +55 -0
- package/src/themes/mashroom/99-utilities/_index.scss +6 -0
- package/src/themes/mashroom/index.scss +26 -0
- package/src/themes/shaj-default/01-settings/_index.scss +69 -0
- package/src/themes/shaj-default/01-settings/_settings.accordion.scss +38 -0
- package/src/themes/shaj-default/01-settings/_settings.animations.scss +32 -0
- package/src/themes/shaj-default/01-settings/_settings.avatar-group.scss +28 -0
- package/src/themes/shaj-default/01-settings/_settings.avatar.scss +63 -0
- package/src/themes/shaj-default/01-settings/_settings.badge.scss +25 -0
- package/src/themes/shaj-default/01-settings/_settings.border-radius.scss +24 -0
- package/src/themes/shaj-default/01-settings/_settings.border.scss +20 -0
- package/src/themes/shaj-default/01-settings/_settings.box-shadow.scss +46 -0
- package/src/themes/shaj-default/01-settings/_settings.breadcrumb.scss +0 -0
- package/src/themes/shaj-default/01-settings/_settings.breakpoints.scss +23 -0
- package/src/themes/shaj-default/01-settings/_settings.btn-group.scss +11 -0
- package/src/themes/shaj-default/01-settings/_settings.button.scss +56 -0
- package/src/themes/shaj-default/01-settings/_settings.callout.scss +87 -0
- package/src/themes/shaj-default/01-settings/_settings.card.scss +52 -0
- package/src/themes/shaj-default/01-settings/_settings.checkbox-group.scss +11 -0
- package/src/themes/shaj-default/01-settings/_settings.checkbox.scss +29 -0
- package/src/themes/shaj-default/01-settings/_settings.color-mode.scss +13 -0
- package/src/themes/shaj-default/01-settings/_settings.colors.scss +91 -0
- package/src/themes/shaj-default/01-settings/_settings.config.scss +4 -0
- package/src/themes/shaj-default/01-settings/_settings.countdown.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.data-table.scss +62 -0
- package/src/themes/shaj-default/01-settings/_settings.datepicker.scss +51 -0
- package/src/themes/shaj-default/01-settings/_settings.design-tokens.scss +9 -0
- package/src/themes/shaj-default/01-settings/_settings.dropdown.scss +51 -0
- package/src/themes/shaj-default/01-settings/_settings.edge-panel.scss +30 -0
- package/src/themes/shaj-default/01-settings/_settings.fonts.scss +13 -0
- package/src/themes/shaj-default/01-settings/_settings.form-group.scss +20 -0
- package/src/themes/shaj-default/01-settings/_settings.form.scss +12 -0
- package/src/themes/shaj-default/01-settings/_settings.grid.scss +29 -0
- package/src/themes/shaj-default/01-settings/_settings.hero.scss +47 -0
- package/src/themes/shaj-default/01-settings/_settings.input.scss +57 -0
- package/src/themes/shaj-default/01-settings/_settings.link.scss +19 -0
- package/src/themes/shaj-default/01-settings/_settings.list-group.scss +22 -0
- package/src/themes/shaj-default/01-settings/_settings.list.scss +19 -0
- package/src/themes/shaj-default/01-settings/_settings.masonry-grid.scss +29 -0
- package/src/themes/shaj-default/01-settings/_settings.menu.scss +56 -0
- package/src/themes/shaj-default/01-settings/_settings.messages.scss +104 -0
- package/src/themes/shaj-default/01-settings/_settings.modal.scss +47 -0
- package/src/themes/shaj-default/01-settings/_settings.nav.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.navbar.scss +60 -0
- package/src/themes/shaj-default/01-settings/_settings.pagination.scss +36 -0
- package/src/themes/shaj-default/01-settings/_settings.photoviewer.scss +51 -0
- package/src/themes/shaj-default/01-settings/_settings.popover.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.position.scss +15 -0
- package/src/themes/shaj-default/01-settings/_settings.progress.scss +23 -0
- package/src/themes/shaj-default/01-settings/_settings.rating.scss +17 -0
- package/src/themes/shaj-default/01-settings/_settings.river.scss +56 -0
- package/src/themes/shaj-default/01-settings/_settings.sectionintro.scss +37 -0
- package/src/themes/shaj-default/01-settings/_settings.select.scss +53 -0
- package/src/themes/shaj-default/01-settings/_settings.side-menu.scss +85 -0
- package/src/themes/shaj-default/01-settings/_settings.skeleton.scss +30 -0
- package/src/themes/shaj-default/01-settings/_settings.spacing.scss +72 -0
- package/src/themes/shaj-default/01-settings/_settings.spinner.scss +24 -0
- package/src/themes/shaj-default/01-settings/_settings.steps.scss +39 -0
- package/src/themes/shaj-default/01-settings/_settings.tabs.scss +39 -0
- package/src/themes/shaj-default/01-settings/_settings.testimonials.scss +30 -0
- package/src/themes/shaj-default/01-settings/_settings.todo.scss +58 -0
- package/src/themes/shaj-default/01-settings/_settings.toggle.scss +55 -0
- package/src/themes/shaj-default/01-settings/_settings.tooltip.scss +26 -0
- package/src/themes/shaj-default/01-settings/_settings.typography.scss +101 -0
- package/src/themes/shaj-default/01-settings/_settings.upload.scss +102 -0
- package/src/themes/shaj-default/01-settings/_settings.z-layers.scss +25 -0
- 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 +2 -0
- 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 +55 -0
- package/src/themes/shaj-default/06-components/_components.card.scss +57 -0
- package/src/themes/shaj-default/06-components/_components.input.scss +58 -0
- package/src/themes/shaj-default/06-components/_components.navbar.scss +99 -0
- package/src/themes/shaj-default/06-components/_components.tooltip.scss +0 -0
- package/src/themes/shaj-default/06-components/_index.scss +13 -0
- package/src/themes/shaj-default/99-utilities/_index.scss +0 -0
- package/src/themes/shaj-default/index.scss +25 -0
- package/src/themes/themes.config.js +219 -0
- package/theme.config.ts +360 -0
- package/src/lib/theme/ThemeManager.integration.test.ts +0 -124
- package/src/lib/theme/ThemeManager.stories.tsx +0 -472
- package/src/lib/theme/ThemeManager.test.ts +0 -190
- package/src/lib/theme/ThemeManager.ts +0 -645
- package/src/lib/theme/ThemeProvider.tsx +0 -377
- package/src/lib/theme/createTheme.test.ts +0 -475
- package/src/lib/theme/useTheme.test.tsx +0 -67
- package/src/lib/theme/useTheme.ts +0 -64
- package/src/lib/theme/utils.test.ts +0 -140
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme System Error Handling
|
|
3
|
+
*
|
|
4
|
+
* Centralized error handling for the Atomix theme system.
|
|
5
|
+
* Provides custom error classes and logging utilities.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Theme error codes
|
|
10
|
+
*/
|
|
11
|
+
export enum ThemeErrorCode {
|
|
12
|
+
/** Theme not found in registry */
|
|
13
|
+
THEME_NOT_FOUND = 'THEME_NOT_FOUND',
|
|
14
|
+
/** Theme failed to load */
|
|
15
|
+
THEME_LOAD_FAILED = 'THEME_LOAD_FAILED',
|
|
16
|
+
/** Theme validation failed */
|
|
17
|
+
THEME_VALIDATION_FAILED = 'THEME_VALIDATION_FAILED',
|
|
18
|
+
/** Configuration loading failed */
|
|
19
|
+
CONFIG_LOAD_FAILED = 'CONFIG_LOAD_FAILED',
|
|
20
|
+
/** Configuration validation failed */
|
|
21
|
+
CONFIG_VALIDATION_FAILED = 'CONFIG_VALIDATION_FAILED',
|
|
22
|
+
/** Circular dependency detected */
|
|
23
|
+
CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY',
|
|
24
|
+
/** Missing dependency */
|
|
25
|
+
MISSING_DEPENDENCY = 'MISSING_DEPENDENCY',
|
|
26
|
+
/** Storage operation failed */
|
|
27
|
+
STORAGE_ERROR = 'STORAGE_ERROR',
|
|
28
|
+
/** Invalid theme name */
|
|
29
|
+
INVALID_THEME_NAME = 'INVALID_THEME_NAME',
|
|
30
|
+
/** CSS injection failed */
|
|
31
|
+
CSS_INJECTION_FAILED = 'CSS_INJECTION_FAILED',
|
|
32
|
+
/** Unknown error */
|
|
33
|
+
UNKNOWN_ERROR = 'UNKNOWN_ERROR',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Custom error class for theme-related errors
|
|
38
|
+
*/
|
|
39
|
+
export class ThemeError extends Error {
|
|
40
|
+
/** Error code */
|
|
41
|
+
public readonly code: ThemeErrorCode;
|
|
42
|
+
/** Additional context */
|
|
43
|
+
public readonly context?: Record<string, unknown>;
|
|
44
|
+
/** Timestamp */
|
|
45
|
+
public readonly timestamp: number;
|
|
46
|
+
|
|
47
|
+
constructor(
|
|
48
|
+
message: string,
|
|
49
|
+
code: ThemeErrorCode = ThemeErrorCode.UNKNOWN_ERROR,
|
|
50
|
+
context?: Record<string, unknown>
|
|
51
|
+
) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.name = 'ThemeError';
|
|
54
|
+
this.code = code;
|
|
55
|
+
this.context = context;
|
|
56
|
+
this.timestamp = Date.now();
|
|
57
|
+
|
|
58
|
+
// Maintains proper stack trace for where our error was thrown (only available on V8)
|
|
59
|
+
if (Error.captureStackTrace) {
|
|
60
|
+
Error.captureStackTrace(this, ThemeError);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Convert error to JSON for logging
|
|
66
|
+
*/
|
|
67
|
+
toJSON(): Record<string, unknown> {
|
|
68
|
+
return {
|
|
69
|
+
name: this.name,
|
|
70
|
+
message: this.message,
|
|
71
|
+
code: this.code,
|
|
72
|
+
context: this.context,
|
|
73
|
+
timestamp: this.timestamp,
|
|
74
|
+
stack: this.stack,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Log level
|
|
81
|
+
*/
|
|
82
|
+
export enum LogLevel {
|
|
83
|
+
ERROR = 0,
|
|
84
|
+
WARN = 1,
|
|
85
|
+
INFO = 2,
|
|
86
|
+
DEBUG = 3,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Logger configuration
|
|
91
|
+
*/
|
|
92
|
+
export interface LoggerConfig {
|
|
93
|
+
/** Minimum log level */
|
|
94
|
+
level?: LogLevel;
|
|
95
|
+
/** Enable console output */
|
|
96
|
+
enableConsole?: boolean;
|
|
97
|
+
/** Custom error handler */
|
|
98
|
+
onError?: (error: ThemeError | Error, context?: Record<string, unknown>) => void;
|
|
99
|
+
/** Custom warn handler */
|
|
100
|
+
onWarn?: (message: string, context?: Record<string, unknown>) => void;
|
|
101
|
+
/** Custom info handler */
|
|
102
|
+
onInfo?: (message: string, context?: Record<string, unknown>) => void;
|
|
103
|
+
/** Custom debug handler */
|
|
104
|
+
onDebug?: (message: string, context?: Record<string, unknown>) => void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Theme Logger
|
|
109
|
+
*
|
|
110
|
+
* Centralized logging for the theme system.
|
|
111
|
+
* Replaces console statements with structured logging.
|
|
112
|
+
*/
|
|
113
|
+
export class ThemeLogger {
|
|
114
|
+
private config: Required<Omit<LoggerConfig, 'onError' | 'onWarn' | 'onInfo' | 'onDebug'>> & {
|
|
115
|
+
onError?: LoggerConfig['onError'];
|
|
116
|
+
onWarn?: LoggerConfig['onWarn'];
|
|
117
|
+
onInfo?: LoggerConfig['onInfo'];
|
|
118
|
+
onDebug?: LoggerConfig['onDebug'];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
constructor(config: LoggerConfig = {}) {
|
|
122
|
+
this.config = {
|
|
123
|
+
level: config.level ?? (process.env.NODE_ENV === 'production' ? LogLevel.WARN : LogLevel.INFO),
|
|
124
|
+
enableConsole: config.enableConsole ?? true,
|
|
125
|
+
onError: config.onError,
|
|
126
|
+
onWarn: config.onWarn,
|
|
127
|
+
onInfo: config.onInfo,
|
|
128
|
+
onDebug: config.onDebug,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Log an error
|
|
134
|
+
*/
|
|
135
|
+
error(
|
|
136
|
+
message: string,
|
|
137
|
+
error?: Error | ThemeError,
|
|
138
|
+
context?: Record<string, unknown>
|
|
139
|
+
): void {
|
|
140
|
+
if (this.config.level < LogLevel.ERROR) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const errorObj = error instanceof Error ? error : new Error(message);
|
|
145
|
+
const themeError = error instanceof ThemeError
|
|
146
|
+
? error
|
|
147
|
+
: new ThemeError(message, ThemeErrorCode.UNKNOWN_ERROR, context);
|
|
148
|
+
|
|
149
|
+
if (this.config.enableConsole) {
|
|
150
|
+
console.error(`[ThemeError] ${message}`, {
|
|
151
|
+
error: errorObj,
|
|
152
|
+
context: { ...context, ...themeError.context },
|
|
153
|
+
code: themeError.code,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
this.config.onError?.(themeError, context);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Log a warning
|
|
162
|
+
*/
|
|
163
|
+
warn(message: string, context?: Record<string, unknown>): void {
|
|
164
|
+
if (this.config.level < LogLevel.WARN) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (this.config.enableConsole) {
|
|
169
|
+
console.warn(`[ThemeWarning] ${message}`, context || {});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
this.config.onWarn?.(message, context);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Log an info message
|
|
177
|
+
*/
|
|
178
|
+
info(message: string, context?: Record<string, unknown>): void {
|
|
179
|
+
if (this.config.level < LogLevel.INFO) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (this.config.enableConsole) {
|
|
184
|
+
console.info(`[ThemeInfo] ${message}`, context || {});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
this.config.onInfo?.(message, context);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Log a debug message
|
|
192
|
+
*/
|
|
193
|
+
debug(message: string, context?: Record<string, unknown>): void {
|
|
194
|
+
if (this.config.level < LogLevel.DEBUG) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (this.config.enableConsole) {
|
|
199
|
+
console.debug(`[ThemeDebug] ${message}`, context || {});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
this.config.onDebug?.(message, context);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Default logger instance
|
|
208
|
+
*/
|
|
209
|
+
let defaultLogger: ThemeLogger | null = null;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get or create default logger
|
|
213
|
+
*/
|
|
214
|
+
export function getLogger(): ThemeLogger {
|
|
215
|
+
if (!defaultLogger) {
|
|
216
|
+
defaultLogger = new ThemeLogger();
|
|
217
|
+
}
|
|
218
|
+
return defaultLogger;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Set default logger
|
|
223
|
+
*/
|
|
224
|
+
export function setLogger(logger: ThemeLogger): void {
|
|
225
|
+
defaultLogger = logger;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Create a logger with custom config
|
|
230
|
+
*/
|
|
231
|
+
export function createLogger(config: LoggerConfig): ThemeLogger {
|
|
232
|
+
return new ThemeLogger(config);
|
|
233
|
+
}
|
|
@@ -96,8 +96,8 @@ function generateColorScale(baseColor: string, prefix: string, colorName: string
|
|
|
96
96
|
function generatePaletteVariables(palette: Theme['palette'], prefix: string): Record<string, string> {
|
|
97
97
|
const vars: Record<string, string> = {};
|
|
98
98
|
|
|
99
|
-
// Primary, secondary, error, warning, info, success
|
|
100
|
-
const colorKeys = ['primary', 'secondary', 'error', 'warning', 'info', 'success'] as const;
|
|
99
|
+
// Primary, secondary, error, warning, info, success, light, dark
|
|
100
|
+
const colorKeys = ['primary', 'secondary', 'error', 'warning', 'info', 'success', 'light', 'dark'] as const;
|
|
101
101
|
colorKeys.forEach((key) => {
|
|
102
102
|
const color = palette[key];
|
|
103
103
|
if (color && typeof color === 'object') {
|
|
@@ -125,9 +125,11 @@ function generatePaletteVariables(palette: Theme['palette'], prefix: string): Re
|
|
|
125
125
|
// Border subtle: light version for borders
|
|
126
126
|
vars[`${prefix}-${key}-border-subtle`] = alpha(color.main, 0.2);
|
|
127
127
|
|
|
128
|
-
// Generate full color scale (1-10)
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
// Generate full color scale (1-10) - only for primary, not for light/dark
|
|
129
|
+
if (key !== 'light' && key !== 'dark') {
|
|
130
|
+
const colorScale = generateColorScale(color.main, prefix, key);
|
|
131
|
+
Object.assign(vars, colorScale);
|
|
132
|
+
}
|
|
131
133
|
}
|
|
132
134
|
});
|
|
133
135
|
|
|
@@ -160,11 +162,62 @@ function generatePaletteVariables(palette: Theme['palette'], prefix: string): Re
|
|
|
160
162
|
// Background mappings to SCSS body variables
|
|
161
163
|
if (palette.background) {
|
|
162
164
|
vars[`${prefix}-body-bg`] = palette.background.default;
|
|
165
|
+
|
|
166
|
+
// Generate background subtle variants
|
|
167
|
+
if (palette.background.default) {
|
|
168
|
+
vars[`${prefix}-primary-bg-subtle`] = palette.background.default;
|
|
169
|
+
}
|
|
170
|
+
if (palette.background.paper) {
|
|
171
|
+
vars[`${prefix}-secondary-bg-subtle`] = palette.background.paper;
|
|
172
|
+
vars[`${prefix}-tertiary-bg-subtle`] = palette.background.paper;
|
|
173
|
+
}
|
|
174
|
+
if (palette.background.subtle) {
|
|
175
|
+
vars[`${prefix}-invert-bg-subtle`] = palette.background.subtle;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Brand bg subtle (uses primary color with alpha)
|
|
179
|
+
if (palette.primary) {
|
|
180
|
+
vars[`${prefix}-brand-bg-subtle`] = alpha(palette.primary.main, 0.1);
|
|
181
|
+
}
|
|
163
182
|
}
|
|
164
183
|
|
|
165
184
|
// Text mappings to SCSS body variables
|
|
166
185
|
if (palette.text) {
|
|
167
186
|
vars[`${prefix}-body-color`] = palette.text.primary;
|
|
187
|
+
|
|
188
|
+
// Generate text emphasis variants
|
|
189
|
+
if (palette.text.primary) {
|
|
190
|
+
vars[`${prefix}-primary-text-emphasis`] = palette.text.primary;
|
|
191
|
+
}
|
|
192
|
+
if (palette.text.secondary) {
|
|
193
|
+
vars[`${prefix}-secondary-text-emphasis`] = palette.text.secondary;
|
|
194
|
+
vars[`${prefix}-tertiary-text-emphasis`] = palette.text.secondary;
|
|
195
|
+
}
|
|
196
|
+
if (palette.text.disabled) {
|
|
197
|
+
vars[`${prefix}-disabled-text-emphasis`] = palette.text.disabled;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Invert text emphasis (opposite of primary)
|
|
201
|
+
if (palette.text.primary) {
|
|
202
|
+
// Invert would be the opposite - for light themes, use dark; for dark themes, use light
|
|
203
|
+
// This is a simplified approach - actual inversion depends on theme mode
|
|
204
|
+
vars[`${prefix}-invert-text-emphasis`] = palette.text.primary;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Brand text emphasis (uses primary color)
|
|
209
|
+
if (palette.primary) {
|
|
210
|
+
vars[`${prefix}-brand-text-emphasis`] = palette.primary.main;
|
|
211
|
+
// Brand border subtle
|
|
212
|
+
vars[`${prefix}-brand-border-subtle`] = alpha(palette.primary.main, 0.2);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Light and dark border subtle (if light/dark colors exist)
|
|
216
|
+
if (palette.light && typeof palette.light === 'object') {
|
|
217
|
+
vars[`${prefix}-light-border-subtle`] = alpha(palette.light.main, 0.2);
|
|
218
|
+
}
|
|
219
|
+
if (palette.dark && typeof palette.dark === 'object') {
|
|
220
|
+
vars[`${prefix}-dark-border-subtle`] = alpha(palette.dark.main, 0.2);
|
|
168
221
|
}
|
|
169
222
|
|
|
170
223
|
// Heading color (defaults to text primary)
|
|
@@ -185,9 +238,8 @@ function generatePaletteVariables(palette: Theme['palette'], prefix: string): Re
|
|
|
185
238
|
if (linkHoverRgb) {
|
|
186
239
|
vars[`${prefix}-link-hover-color-rgb`] = `${linkHoverRgb.r}, ${linkHoverRgb.g}, ${linkHoverRgb.b}`;
|
|
187
240
|
}
|
|
188
|
-
// Link decoration (default:
|
|
189
|
-
vars[`${prefix}-link-decoration`] = '
|
|
190
|
-
vars[`${prefix}-link-hover-decoration`] = 'none';
|
|
241
|
+
// Link decoration (default: none, matching tokens list)
|
|
242
|
+
vars[`${prefix}-link-decoration`] = 'none';
|
|
191
243
|
}
|
|
192
244
|
|
|
193
245
|
// Border color (defaults to subtle gray)
|
|
@@ -224,6 +276,29 @@ function generatePaletteVariables(palette: Theme['palette'], prefix: string): Re
|
|
|
224
276
|
vars[`${prefix}-code-color`] = palette.text.secondary;
|
|
225
277
|
}
|
|
226
278
|
|
|
279
|
+
// Generate gradient tokens for all colors
|
|
280
|
+
// Gradients use the color scale (lighter to darker variations)
|
|
281
|
+
const gradientColors = ['primary', 'secondary', 'error', 'warning', 'info', 'success', 'light', 'dark'] as const;
|
|
282
|
+
gradientColors.forEach((key) => {
|
|
283
|
+
const color = palette[key];
|
|
284
|
+
if (color && typeof color === 'object') {
|
|
285
|
+
// Generate gradient using color scale steps
|
|
286
|
+
// Use steps 1, 3, 5 from the color scale for a smooth gradient
|
|
287
|
+
const color1 = lighten(color.main, 0.6);
|
|
288
|
+
const color2 = lighten(color.main, 0.3);
|
|
289
|
+
const color3 = color.main;
|
|
290
|
+
vars[`${prefix}-${key}-gradient`] = `linear-gradient(135deg, ${color1}, ${color2}, ${color3})`;
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
// Default gradient (uses gray scale)
|
|
295
|
+
if (palette.text?.primary) {
|
|
296
|
+
const gray1 = lighten(palette.text.primary, 0.8);
|
|
297
|
+
const gray2 = lighten(palette.text.primary, 0.6);
|
|
298
|
+
const gray3 = lighten(palette.text.primary, 0.4);
|
|
299
|
+
vars[`${prefix}-gradient`] = `linear-gradient(135deg, ${gray1}, ${gray2}, ${gray3})`;
|
|
300
|
+
}
|
|
301
|
+
|
|
227
302
|
return vars;
|
|
228
303
|
}
|
|
229
304
|
|
|
@@ -379,7 +454,16 @@ function generateTransitionVariables(
|
|
|
379
454
|
function generateZIndexVariables(zIndex: Theme['zIndex'], prefix: string): Record<string, string> {
|
|
380
455
|
const vars: Record<string, string> = {};
|
|
381
456
|
|
|
382
|
-
//
|
|
457
|
+
// Generate z-index scale (matching tokens list)
|
|
458
|
+
vars[`${prefix}-z-n1`] = '-1';
|
|
459
|
+
vars[`${prefix}-z-0`] = '0';
|
|
460
|
+
vars[`${prefix}-z-1`] = '1';
|
|
461
|
+
vars[`${prefix}-z-2`] = '2';
|
|
462
|
+
vars[`${prefix}-z-3`] = '3';
|
|
463
|
+
vars[`${prefix}-z-4`] = '4';
|
|
464
|
+
vars[`${prefix}-z-5`] = '5';
|
|
465
|
+
|
|
466
|
+
// Map to SCSS z-layers (semantic z-index values)
|
|
383
467
|
if (zIndex.mobileStepper) vars[`${prefix}-z-dropdown`] = String(zIndex.mobileStepper);
|
|
384
468
|
if (zIndex.appBar) vars[`${prefix}-z-sticky`] = String(zIndex.appBar);
|
|
385
469
|
vars[`${prefix}-z-fixed`] = '1030'; // Default fixed
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Generator
|
|
3
|
+
*
|
|
4
|
+
* Optimized CSS variable generation from theme objects
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Theme } from '../types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* CSS generation options
|
|
11
|
+
*/
|
|
12
|
+
export interface CSSGeneratorOptions {
|
|
13
|
+
/** CSS selector (default: ':root') */
|
|
14
|
+
selector?: string;
|
|
15
|
+
/** CSS variable prefix (default: 'atomix') */
|
|
16
|
+
prefix?: string;
|
|
17
|
+
/** Include comments */
|
|
18
|
+
includeComments?: boolean;
|
|
19
|
+
/** Minify output */
|
|
20
|
+
minify?: boolean;
|
|
21
|
+
/** Custom property formatter */
|
|
22
|
+
formatProperty?: (path: string[], value: any) => string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* CSS Generator
|
|
27
|
+
*
|
|
28
|
+
* Generates optimized CSS custom properties from theme objects
|
|
29
|
+
*/
|
|
30
|
+
export class CSSGenerator {
|
|
31
|
+
private options: Required<Omit<CSSGeneratorOptions, 'formatProperty'>> & {
|
|
32
|
+
formatProperty?: CSSGeneratorOptions['formatProperty'];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
constructor(options: CSSGeneratorOptions = {}) {
|
|
36
|
+
this.options = {
|
|
37
|
+
selector: options.selector || ':root',
|
|
38
|
+
prefix: options.prefix || 'atomix',
|
|
39
|
+
includeComments: options.includeComments ?? true,
|
|
40
|
+
minify: options.minify ?? false,
|
|
41
|
+
formatProperty: options.formatProperty,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Generate CSS from theme
|
|
47
|
+
*/
|
|
48
|
+
generate(theme: Theme): string {
|
|
49
|
+
const variables = this.extractVariables(theme);
|
|
50
|
+
return this.formatCSS(variables);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Extract CSS variables from theme
|
|
55
|
+
*/
|
|
56
|
+
private extractVariables(theme: Theme): Map<string, string> {
|
|
57
|
+
const variables = new Map<string, string>();
|
|
58
|
+
|
|
59
|
+
// Palette
|
|
60
|
+
this.extractPalette(theme.palette, variables);
|
|
61
|
+
|
|
62
|
+
// Typography
|
|
63
|
+
this.extractTypography(theme.typography, variables);
|
|
64
|
+
|
|
65
|
+
// Spacing (generate common values)
|
|
66
|
+
this.extractSpacing(theme.spacing, variables);
|
|
67
|
+
|
|
68
|
+
// Breakpoints
|
|
69
|
+
this.extractBreakpoints(theme.breakpoints, variables);
|
|
70
|
+
|
|
71
|
+
// Shadows
|
|
72
|
+
this.extractShadows(theme.shadows, variables);
|
|
73
|
+
|
|
74
|
+
// Transitions
|
|
75
|
+
this.extractTransitions(theme.transitions, variables);
|
|
76
|
+
|
|
77
|
+
// Z-index
|
|
78
|
+
this.extractZIndex(theme.zIndex, variables);
|
|
79
|
+
|
|
80
|
+
// Border radius
|
|
81
|
+
this.extractBorderRadius(theme.borderRadius, variables);
|
|
82
|
+
|
|
83
|
+
// Custom properties
|
|
84
|
+
this.extractCustom(theme.custom, variables);
|
|
85
|
+
|
|
86
|
+
return variables;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Extract palette variables
|
|
91
|
+
*/
|
|
92
|
+
private extractPalette(palette: Theme['palette'], variables: Map<string, string>): void {
|
|
93
|
+
const colors = ['primary', 'secondary', 'error', 'warning', 'info', 'success'] as const;
|
|
94
|
+
|
|
95
|
+
for (const color of colors) {
|
|
96
|
+
const colorObj = palette[color];
|
|
97
|
+
if (colorObj) {
|
|
98
|
+
variables.set(`palette-${color}-main`, colorObj.main);
|
|
99
|
+
if (colorObj.light) variables.set(`palette-${color}-light`, colorObj.light);
|
|
100
|
+
if (colorObj.dark) variables.set(`palette-${color}-dark`, colorObj.dark);
|
|
101
|
+
if (colorObj.contrastText) variables.set(`palette-${color}-contrast-text`, colorObj.contrastText);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Background
|
|
106
|
+
if (palette.background) {
|
|
107
|
+
variables.set('background-default', palette.background.default);
|
|
108
|
+
variables.set('background-paper', palette.background.paper);
|
|
109
|
+
variables.set('background-subtle', palette.background.subtle);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Text
|
|
113
|
+
if (palette.text) {
|
|
114
|
+
variables.set('text-primary', palette.text.primary);
|
|
115
|
+
variables.set('text-secondary', palette.text.secondary);
|
|
116
|
+
variables.set('text-disabled', palette.text.disabled);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Extract typography variables
|
|
122
|
+
*/
|
|
123
|
+
private extractTypography(typography: Theme['typography'], variables: Map<string, string>): void {
|
|
124
|
+
variables.set('font-family', typography.fontFamily);
|
|
125
|
+
variables.set('font-size', `${typography.fontSize}px`);
|
|
126
|
+
|
|
127
|
+
// Font weights
|
|
128
|
+
if (typography.fontWeightLight) variables.set('font-weight-light', String(typography.fontWeightLight));
|
|
129
|
+
if (typography.fontWeightRegular) variables.set('font-weight-regular', String(typography.fontWeightRegular));
|
|
130
|
+
if (typography.fontWeightMedium) variables.set('font-weight-medium', String(typography.fontWeightMedium));
|
|
131
|
+
if (typography.fontWeightSemiBold) variables.set('font-weight-semibold', String(typography.fontWeightSemiBold));
|
|
132
|
+
if (typography.fontWeightBold) variables.set('font-weight-bold', String(typography.fontWeightBold));
|
|
133
|
+
|
|
134
|
+
// Headings
|
|
135
|
+
const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;
|
|
136
|
+
for (const heading of headings) {
|
|
137
|
+
const h = typography[heading];
|
|
138
|
+
if (h) {
|
|
139
|
+
if (h.fontSize) variables.set(`typography-${heading}-font-size`, String(h.fontSize));
|
|
140
|
+
if (h.fontWeight) variables.set(`typography-${heading}-font-weight`, String(h.fontWeight));
|
|
141
|
+
if (h.lineHeight) variables.set(`typography-${heading}-line-height`, String(h.lineHeight));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Body
|
|
146
|
+
if (typography.body1) {
|
|
147
|
+
if (typography.body1.fontSize) variables.set('typography-body1-font-size', String(typography.body1.fontSize));
|
|
148
|
+
if (typography.body1.fontWeight) variables.set('typography-body1-font-weight', String(typography.body1.fontWeight));
|
|
149
|
+
if (typography.body1.lineHeight) variables.set('typography-body1-line-height', String(typography.body1.lineHeight));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (typography.body2) {
|
|
153
|
+
if (typography.body2.fontSize) variables.set('typography-body2-font-size', String(typography.body2.fontSize));
|
|
154
|
+
if (typography.body2.fontWeight) variables.set('typography-body2-font-weight', String(typography.body2.fontWeight));
|
|
155
|
+
if (typography.body2.lineHeight) variables.set('typography-body2-line-height', String(typography.body2.lineHeight));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Extract spacing variables
|
|
161
|
+
*/
|
|
162
|
+
private extractSpacing(spacing: Theme['spacing'], variables: Map<string, string>): void {
|
|
163
|
+
// Generate common spacing values
|
|
164
|
+
for (let i = 0; i <= 12; i++) {
|
|
165
|
+
try {
|
|
166
|
+
const value = spacing(i);
|
|
167
|
+
variables.set(`spacing-${i}`, value);
|
|
168
|
+
} catch {
|
|
169
|
+
// Ignore errors
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Extract breakpoint variables
|
|
176
|
+
*/
|
|
177
|
+
private extractBreakpoints(breakpoints: Theme['breakpoints'], variables: Map<string, string>): void {
|
|
178
|
+
const keys = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
179
|
+
for (const key of keys) {
|
|
180
|
+
const value = breakpoints.values[key];
|
|
181
|
+
if (value !== undefined) {
|
|
182
|
+
variables.set(`breakpoint-${key}`, `${value}px`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Extract shadow variables
|
|
189
|
+
*/
|
|
190
|
+
private extractShadows(shadows: Theme['shadows'], variables: Map<string, string>): void {
|
|
191
|
+
const keys = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
192
|
+
for (const key of keys) {
|
|
193
|
+
const shadow = shadows[key];
|
|
194
|
+
if (shadow) {
|
|
195
|
+
variables.set(`shadow-${key}`, shadow);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Extract transition variables
|
|
202
|
+
*/
|
|
203
|
+
private extractTransitions(transitions: Theme['transitions'], variables: Map<string, string>): void {
|
|
204
|
+
if (transitions.duration) {
|
|
205
|
+
const durations = ['shortest', 'shorter', 'short', 'standard', 'complex'] as const;
|
|
206
|
+
for (const key of durations) {
|
|
207
|
+
const value = transitions.duration[key];
|
|
208
|
+
if (value !== undefined) {
|
|
209
|
+
variables.set(`transition-duration-${key}`, `${value}ms`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (transitions.easing) {
|
|
215
|
+
const easings = ['easeInOut', 'easeOut', 'easeIn', 'sharp'] as const;
|
|
216
|
+
for (const key of easings) {
|
|
217
|
+
const value = transitions.easing[key];
|
|
218
|
+
if (value) {
|
|
219
|
+
variables.set(`transition-easing-${key}`, value);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Extract z-index variables
|
|
227
|
+
*/
|
|
228
|
+
private extractZIndex(zIndex: Theme['zIndex'], variables: Map<string, string>): void {
|
|
229
|
+
const keys = ['mobileStepper', 'speedDial', 'appBar', 'drawer', 'modal', 'snackbar', 'tooltip'] as const;
|
|
230
|
+
for (const key of keys) {
|
|
231
|
+
const value = zIndex[key];
|
|
232
|
+
if (value !== undefined) {
|
|
233
|
+
variables.set(`z-index-${key}`, String(value));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Extract border radius variables
|
|
240
|
+
*/
|
|
241
|
+
private extractBorderRadius(borderRadius: Theme['borderRadius'], variables: Map<string, string>): void {
|
|
242
|
+
const keys = ['base', 'sm', 'md', 'lg', 'xl', 'xxl', '3xl', '4xl', 'pill'] as const;
|
|
243
|
+
for (const key of keys) {
|
|
244
|
+
const value = borderRadius[key];
|
|
245
|
+
if (value !== undefined) {
|
|
246
|
+
variables.set(`border-radius-${key}`, String(value));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Extract custom properties
|
|
253
|
+
*/
|
|
254
|
+
private extractCustom(custom: Theme['custom'], variables: Map<string, string>): void {
|
|
255
|
+
for (const [key, value] of Object.entries(custom)) {
|
|
256
|
+
if (value !== undefined && value !== null) {
|
|
257
|
+
variables.set(`custom-${key}`, String(value));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Format CSS from variables
|
|
264
|
+
*/
|
|
265
|
+
private formatCSS(variables: Map<string, string>): string {
|
|
266
|
+
const { selector, prefix, includeComments, minify } = this.options;
|
|
267
|
+
const indent = minify ? '' : ' ';
|
|
268
|
+
const newline = minify ? '' : '\n';
|
|
269
|
+
const space = minify ? '' : ' ';
|
|
270
|
+
|
|
271
|
+
let css = '';
|
|
272
|
+
|
|
273
|
+
if (includeComments && !minify) {
|
|
274
|
+
css += `/* Atomix Theme CSS Variables */${newline}`;
|
|
275
|
+
css += `/* Generated from theme configuration */${newline}${newline}`;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
css += `${selector}${space}{${newline}`;
|
|
279
|
+
|
|
280
|
+
for (const [key, value] of variables.entries()) {
|
|
281
|
+
const property = this.formatPropertyName(key);
|
|
282
|
+
css += `${indent}--${prefix}-${property}:${space}${value};${newline}`;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
css += `}${newline}`;
|
|
286
|
+
|
|
287
|
+
return css;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Format property name
|
|
292
|
+
*/
|
|
293
|
+
private formatPropertyName(key: string): string {
|
|
294
|
+
if (this.options.formatProperty) {
|
|
295
|
+
return this.options.formatProperty(key.split('-'), key);
|
|
296
|
+
}
|
|
297
|
+
return key;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Generate CSS variables from theme
|
|
303
|
+
*
|
|
304
|
+
* @param theme - Theme object
|
|
305
|
+
* @param options - Generation options
|
|
306
|
+
* @returns CSS string
|
|
307
|
+
*/
|
|
308
|
+
export function generateCSS(theme: Theme, options: CSSGeneratorOptions = {}): string {
|
|
309
|
+
const generator = new CSSGenerator(options);
|
|
310
|
+
return generator.generate(theme);
|
|
311
|
+
}
|