@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
|
@@ -32,6 +32,8 @@ import type {
|
|
|
32
32
|
ZIndexOptions,
|
|
33
33
|
BorderRadiusOptions,
|
|
34
34
|
} from './types';
|
|
35
|
+
import { hexToRgb, getLuminance, getContrastText, lighten, darken, createSpacing } from './themeUtils';
|
|
36
|
+
import { deepMerge } from './composeTheme';
|
|
35
37
|
|
|
36
38
|
// ============================================================================
|
|
37
39
|
// Default Theme Values
|
|
@@ -39,116 +41,119 @@ import type {
|
|
|
39
41
|
|
|
40
42
|
const DEFAULT_PALETTE: Theme['palette'] = {
|
|
41
43
|
primary: {
|
|
42
|
-
main: '#
|
|
43
|
-
light: '#
|
|
44
|
-
dark: '#
|
|
45
|
-
contrastText: '#
|
|
44
|
+
main: '#7c3aed', // Primary-6
|
|
45
|
+
light: '#d0b2f5', // Primary-3
|
|
46
|
+
dark: '#3c1583', // Primary-9
|
|
47
|
+
contrastText: '#ffffff',
|
|
46
48
|
},
|
|
47
49
|
secondary: {
|
|
48
|
-
main: '#
|
|
49
|
-
light: '#
|
|
50
|
-
dark: '#
|
|
51
|
-
contrastText: '#
|
|
50
|
+
main: '#f3f4f6', // Gray-2
|
|
51
|
+
light: '#ffffff', // Gray-1
|
|
52
|
+
dark: '#e5e7eb', // Gray-3
|
|
53
|
+
contrastText: '#1f2937', // Gray-9
|
|
52
54
|
},
|
|
53
55
|
error: {
|
|
54
|
-
main: '#
|
|
55
|
-
light: '#
|
|
56
|
-
dark: '#
|
|
57
|
-
contrastText: '#
|
|
56
|
+
main: '#ef4444', // Red-6
|
|
57
|
+
light: '#fca5a5', // Red-4
|
|
58
|
+
dark: '#991b1b', // Red-9
|
|
59
|
+
contrastText: '#ffffff',
|
|
58
60
|
},
|
|
59
61
|
warning: {
|
|
60
|
-
main: '#
|
|
61
|
-
light: '#
|
|
62
|
-
dark: '#
|
|
62
|
+
main: '#eab308', // Yellow-6
|
|
63
|
+
light: '#fde047', // Yellow-4
|
|
64
|
+
dark: '#854d0e', // Yellow-9
|
|
63
65
|
contrastText: '#000000',
|
|
64
66
|
},
|
|
65
67
|
info: {
|
|
66
|
-
main: '#
|
|
67
|
-
light: '#
|
|
68
|
-
dark: '#
|
|
69
|
-
contrastText: '#
|
|
68
|
+
main: '#3b82f6', // Blue-6
|
|
69
|
+
light: '#93c5fd', // Blue-4
|
|
70
|
+
dark: '#1e40af', // Blue-9
|
|
71
|
+
contrastText: '#ffffff',
|
|
70
72
|
},
|
|
71
73
|
success: {
|
|
72
|
-
main: '#
|
|
73
|
-
light: '#
|
|
74
|
-
dark: '#
|
|
75
|
-
contrastText: '#
|
|
74
|
+
main: '#22c55e', // Green-6
|
|
75
|
+
light: '#86efac', // Green-4
|
|
76
|
+
dark: '#166534', // Green-9
|
|
77
|
+
contrastText: '#ffffff',
|
|
76
78
|
},
|
|
77
79
|
background: {
|
|
78
|
-
default: '#
|
|
79
|
-
paper: '#
|
|
80
|
-
subtle: '#
|
|
80
|
+
default: '#ffffff', // Primary-bg
|
|
81
|
+
paper: '#f3f4f6', // Secondary-bg
|
|
82
|
+
subtle: '#d1d5db', // Gray-4 (Tertiary-bg)
|
|
81
83
|
},
|
|
82
84
|
text: {
|
|
83
|
-
primary: '
|
|
84
|
-
secondary: '
|
|
85
|
-
disabled: '
|
|
85
|
+
primary: '#111827', // Gray-10
|
|
86
|
+
secondary: '#374151', // Gray-8
|
|
87
|
+
disabled: '#9ca3af', // Gray-5
|
|
86
88
|
},
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
const DEFAULT_TYPOGRAPHY: Theme['typography'] = {
|
|
90
|
-
fontFamily: '"
|
|
91
|
-
fontSize:
|
|
92
|
+
fontFamily: '"Roboto", "Helvetica Neue", "Helvetica", "Arial", sans-serif',
|
|
93
|
+
fontSize: 16, // 1rem
|
|
92
94
|
fontWeightLight: 300,
|
|
93
95
|
fontWeightRegular: 400,
|
|
94
96
|
fontWeightMedium: 500,
|
|
95
97
|
fontWeightSemiBold: 600,
|
|
96
98
|
fontWeightBold: 700,
|
|
99
|
+
fontWeightHeavy: 800,
|
|
100
|
+
fontWeightBlack: 900,
|
|
97
101
|
h1: {
|
|
98
|
-
fontSize: '2.5rem',
|
|
102
|
+
fontSize: '2.5rem', // 40px
|
|
99
103
|
fontWeight: 700,
|
|
100
|
-
lineHeight: 1.
|
|
101
|
-
letterSpacing: '-
|
|
104
|
+
lineHeight: 1.3,
|
|
105
|
+
letterSpacing: '-1px',
|
|
102
106
|
},
|
|
103
107
|
h2: {
|
|
104
|
-
fontSize: '2rem',
|
|
108
|
+
fontSize: '2rem', // 32px
|
|
105
109
|
fontWeight: 700,
|
|
106
110
|
lineHeight: 1.3,
|
|
107
|
-
letterSpacing: '-
|
|
111
|
+
letterSpacing: '-1px',
|
|
108
112
|
},
|
|
109
113
|
h3: {
|
|
110
|
-
fontSize: '1.
|
|
111
|
-
fontWeight:
|
|
112
|
-
lineHeight: 1.
|
|
113
|
-
letterSpacing: '
|
|
114
|
+
fontSize: '1.5rem', // 24px
|
|
115
|
+
fontWeight: 700,
|
|
116
|
+
lineHeight: 1.3,
|
|
117
|
+
letterSpacing: '-1px',
|
|
114
118
|
},
|
|
115
119
|
h4: {
|
|
116
|
-
fontSize: '1.
|
|
117
|
-
fontWeight:
|
|
118
|
-
lineHeight: 1.
|
|
119
|
-
letterSpacing: '0.
|
|
120
|
+
fontSize: '1.25rem', // 20px
|
|
121
|
+
fontWeight: 700,
|
|
122
|
+
lineHeight: 1.3,
|
|
123
|
+
letterSpacing: '-0.5px',
|
|
120
124
|
},
|
|
121
125
|
h5: {
|
|
122
|
-
fontSize: '1.
|
|
123
|
-
fontWeight:
|
|
124
|
-
lineHeight: 1.
|
|
125
|
-
letterSpacing: '
|
|
126
|
+
fontSize: '1.125rem', // 18px
|
|
127
|
+
fontWeight: 700,
|
|
128
|
+
lineHeight: 1.3,
|
|
129
|
+
letterSpacing: '-0.5px',
|
|
126
130
|
},
|
|
127
131
|
h6: {
|
|
128
|
-
fontSize: '1rem',
|
|
129
|
-
fontWeight:
|
|
130
|
-
lineHeight: 1.
|
|
131
|
-
letterSpacing: '0.
|
|
132
|
+
fontSize: '1rem', // 16px
|
|
133
|
+
fontWeight: 700,
|
|
134
|
+
lineHeight: 1.3,
|
|
135
|
+
letterSpacing: '-0.5px',
|
|
132
136
|
},
|
|
133
137
|
body1: {
|
|
134
|
-
fontSize: '1rem',
|
|
138
|
+
fontSize: '1rem', // 16px
|
|
135
139
|
fontWeight: 400,
|
|
136
|
-
lineHeight: 1.
|
|
140
|
+
lineHeight: 1.2,
|
|
137
141
|
},
|
|
138
142
|
body2: {
|
|
139
|
-
fontSize: '0.875rem',
|
|
143
|
+
fontSize: '0.875rem', // 14px
|
|
140
144
|
fontWeight: 400,
|
|
141
|
-
lineHeight: 1.
|
|
145
|
+
lineHeight: 1.2,
|
|
142
146
|
},
|
|
143
147
|
};
|
|
144
148
|
|
|
145
149
|
const DEFAULT_BREAKPOINTS: Theme['breakpoints'] = {
|
|
146
150
|
values: {
|
|
147
151
|
xs: 0,
|
|
148
|
-
sm:
|
|
149
|
-
md:
|
|
150
|
-
lg:
|
|
151
|
-
xl:
|
|
152
|
+
sm: 576,
|
|
153
|
+
md: 768,
|
|
154
|
+
lg: 992,
|
|
155
|
+
xl: 1200,
|
|
156
|
+
xxl: 1440,
|
|
152
157
|
},
|
|
153
158
|
unit: 'px',
|
|
154
159
|
up: (key) => {
|
|
@@ -167,12 +172,12 @@ const DEFAULT_BREAKPOINTS: Theme['breakpoints'] = {
|
|
|
167
172
|
};
|
|
168
173
|
|
|
169
174
|
const DEFAULT_SHADOWS: Theme['shadows'] = {
|
|
170
|
-
xs: '
|
|
171
|
-
sm: '0
|
|
172
|
-
md: '0 4px
|
|
173
|
-
lg: '0
|
|
174
|
-
xl: '
|
|
175
|
-
inset: 'inset 0 1px
|
|
175
|
+
xs: '0px 1px 2px 0px rgba(45, 54, 67, 0.04), 0px 2px 4px 0px rgba(45, 54, 67, 0.08)',
|
|
176
|
+
sm: '0 2px 4px rgba(0, 0, 0, 0.075)',
|
|
177
|
+
md: '0 4px 8px rgba(0, 0, 0, 0.1)',
|
|
178
|
+
lg: '0 16px 48px rgba(0, 0, 0, 0.175)',
|
|
179
|
+
xl: '0px 16px 64px -8px rgba(45, 54, 67, 0.14)',
|
|
180
|
+
inset: 'inset 0 1px 2px rgba(0, 0, 0, 0.075)',
|
|
176
181
|
};
|
|
177
182
|
|
|
178
183
|
const DEFAULT_TRANSITIONS: Theme['transitions'] = {
|
|
@@ -219,109 +224,6 @@ const DEFAULT_BORDER_RADIUS: Theme['borderRadius'] = {
|
|
|
219
224
|
// Helper Functions
|
|
220
225
|
// ============================================================================
|
|
221
226
|
|
|
222
|
-
/**
|
|
223
|
-
* Deep merge two objects
|
|
224
|
-
*/
|
|
225
|
-
function deepMerge<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T {
|
|
226
|
-
if (!sources.length) return target;
|
|
227
|
-
const source = sources.shift();
|
|
228
|
-
|
|
229
|
-
if (isObject(target) && isObject(source)) {
|
|
230
|
-
for (const key in source) {
|
|
231
|
-
if (!source.hasOwnProperty(key)) continue;
|
|
232
|
-
const sourceValue = source[key];
|
|
233
|
-
if (isObject(sourceValue)) {
|
|
234
|
-
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
235
|
-
deepMerge(target[key] as any, sourceValue as any);
|
|
236
|
-
} else {
|
|
237
|
-
Object.assign(target, { [key]: sourceValue });
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return deepMerge(target, ...sources);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Check if value is an object
|
|
247
|
-
*/
|
|
248
|
-
function isObject(item: any): item is Record<string, any> {
|
|
249
|
-
return item && typeof item === 'object' && !Array.isArray(item);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Convert hex color to RGB
|
|
254
|
-
*/
|
|
255
|
-
function hexToRgb(hex: string): { r: number; g: number; b: number } | null {
|
|
256
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
257
|
-
if (!result || !result[1] || !result[2] || !result[3]) {
|
|
258
|
-
return null;
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
r: parseInt(result[1], 16),
|
|
262
|
-
g: parseInt(result[2], 16),
|
|
263
|
-
b: parseInt(result[3], 16),
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Calculate relative luminance
|
|
269
|
-
*/
|
|
270
|
-
function getLuminance(color: string): number {
|
|
271
|
-
const rgb = hexToRgb(color);
|
|
272
|
-
if (!rgb) return 0;
|
|
273
|
-
|
|
274
|
-
const { r, g, b } = rgb;
|
|
275
|
-
const [rs, gs, bs] = [r ?? 0, g ?? 0, b ?? 0].map((c) => {
|
|
276
|
-
const val = c / 255;
|
|
277
|
-
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
return 0.2126 * (rs ?? 0) + 0.7152 * (gs ?? 0) + 0.0722 * (bs ?? 0);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Get contrast text color (black or white) based on background
|
|
285
|
-
*/
|
|
286
|
-
function getContrastText(background: string): string {
|
|
287
|
-
const luminance = getLuminance(background);
|
|
288
|
-
return luminance > 0.5 ? '#000000' : '#FFFFFF';
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Lighten a color
|
|
293
|
-
*/
|
|
294
|
-
function lighten(color: string, amount: number = 0.2): string {
|
|
295
|
-
const rgb = hexToRgb(color);
|
|
296
|
-
if (!rgb) return color;
|
|
297
|
-
|
|
298
|
-
const { r, g, b } = rgb;
|
|
299
|
-
const lightenValue = (val: number) => Math.min(255, Math.round(val + (255 - val) * amount));
|
|
300
|
-
|
|
301
|
-
const newR = lightenValue(r ?? 0).toString(16).padStart(2, '0');
|
|
302
|
-
const newG = lightenValue(g ?? 0).toString(16).padStart(2, '0');
|
|
303
|
-
const newB = lightenValue(b ?? 0).toString(16).padStart(2, '0');
|
|
304
|
-
|
|
305
|
-
return `#${newR}${newG}${newB}`;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Darken a color
|
|
310
|
-
*/
|
|
311
|
-
function darken(color: string, amount: number = 0.2): string {
|
|
312
|
-
const rgb = hexToRgb(color);
|
|
313
|
-
if (!rgb) return color;
|
|
314
|
-
|
|
315
|
-
const { r, g, b } = rgb;
|
|
316
|
-
const darkenValue = (val: number) => Math.max(0, Math.round(val * (1 - amount)));
|
|
317
|
-
|
|
318
|
-
const newR = darkenValue(r ?? 0).toString(16).padStart(2, '0');
|
|
319
|
-
const newG = darkenValue(g ?? 0).toString(16).padStart(2, '0');
|
|
320
|
-
const newB = darkenValue(b ?? 0).toString(16).padStart(2, '0');
|
|
321
|
-
|
|
322
|
-
return `#${newR}${newG}${newB}`;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
227
|
/**
|
|
326
228
|
* Create a complete palette color from partial configuration
|
|
327
229
|
*/
|
|
@@ -343,37 +245,6 @@ function createPaletteColor(color: Partial<PaletteColor> | string): PaletteColor
|
|
|
343
245
|
};
|
|
344
246
|
}
|
|
345
247
|
|
|
346
|
-
/**
|
|
347
|
-
* Create spacing function
|
|
348
|
-
*/
|
|
349
|
-
function createSpacing(spacingInput: SpacingOptions = 4): SpacingFunction {
|
|
350
|
-
// If it's already a function, return it
|
|
351
|
-
if (typeof spacingInput === 'function') {
|
|
352
|
-
return spacingInput;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// If it's a number, create a function that multiplies by that number
|
|
356
|
-
if (typeof spacingInput === 'number') {
|
|
357
|
-
return (...values: number[]) => {
|
|
358
|
-
if (values.length === 0) return '0px';
|
|
359
|
-
return values.map((value) => `${value * spacingInput}px`).join(' ');
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// If it's an array, use it as a scale
|
|
364
|
-
if (Array.isArray(spacingInput)) {
|
|
365
|
-
return (...values: number[]) => {
|
|
366
|
-
if (values.length === 0) return '0px';
|
|
367
|
-
return values.map((value) => `${spacingInput[value] || value}px`).join(' ');
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Default to 4px base
|
|
372
|
-
return (...values: number[]) => {
|
|
373
|
-
if (values.length === 0) return '0px';
|
|
374
|
-
return values.map((value) => `${value * 4}px`).join(' ');
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
248
|
|
|
378
249
|
/**
|
|
379
250
|
* Create breakpoints object
|
|
@@ -381,10 +252,11 @@ function createSpacing(spacingInput: SpacingOptions = 4): SpacingFunction {
|
|
|
381
252
|
function createBreakpoints(breakpointsInput?: BreakpointsOptions): Theme['breakpoints'] {
|
|
382
253
|
const values = {
|
|
383
254
|
xs: 0,
|
|
384
|
-
sm:
|
|
385
|
-
md:
|
|
386
|
-
lg:
|
|
387
|
-
xl:
|
|
255
|
+
sm: 576,
|
|
256
|
+
md: 768,
|
|
257
|
+
lg: 992,
|
|
258
|
+
xl: 1200,
|
|
259
|
+
xxl: 1440,
|
|
388
260
|
...breakpointsInput?.values,
|
|
389
261
|
};
|
|
390
262
|
|
|
@@ -431,6 +303,13 @@ export function createTheme(...options: ThemeOptions[]): Theme {
|
|
|
431
303
|
warning: createPaletteColor(mergedOptions.palette?.warning || DEFAULT_PALETTE.warning),
|
|
432
304
|
info: createPaletteColor(mergedOptions.palette?.info || DEFAULT_PALETTE.info),
|
|
433
305
|
success: createPaletteColor(mergedOptions.palette?.success || DEFAULT_PALETTE.success),
|
|
306
|
+
// Handle light and dark colors if provided
|
|
307
|
+
...(mergedOptions.palette?.light && {
|
|
308
|
+
light: createPaletteColor(mergedOptions.palette.light),
|
|
309
|
+
}),
|
|
310
|
+
...(mergedOptions.palette?.dark && {
|
|
311
|
+
dark: createPaletteColor(mergedOptions.palette.dark),
|
|
312
|
+
}),
|
|
434
313
|
background: {
|
|
435
314
|
default: mergedOptions.palette?.background?.default || DEFAULT_PALETTE.background.default,
|
|
436
315
|
paper: mergedOptions.palette?.background?.paper || DEFAULT_PALETTE.background.paper,
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS Variable Mapper
|
|
3
|
+
*
|
|
4
|
+
* Utilities for generating and managing CSS custom properties from SCSS tokens
|
|
5
|
+
* and component configurations.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for generating CSS variables for a component
|
|
10
|
+
*/
|
|
11
|
+
export interface CSSVariableConfig {
|
|
12
|
+
/** Component name (e.g., 'button', 'card') */
|
|
13
|
+
component: string;
|
|
14
|
+
/** Base properties for the component */
|
|
15
|
+
properties: Record<string, string | number>;
|
|
16
|
+
/** Part-specific properties (e.g., icon, label) */
|
|
17
|
+
parts?: Record<string, Record<string, string | number>>;
|
|
18
|
+
/** State-specific properties (e.g., hover, active, disabled) */
|
|
19
|
+
states?: Record<string, Record<string, string | number>>;
|
|
20
|
+
/** Variant-specific properties (e.g., primary, secondary) */
|
|
21
|
+
variants?: Record<string, Record<string, string | number>>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* CSS variable naming options
|
|
26
|
+
*/
|
|
27
|
+
export interface CSSVariableNamingOptions {
|
|
28
|
+
/** Prefix for all variables (default: 'atomix') */
|
|
29
|
+
prefix?: string;
|
|
30
|
+
/** Separator between parts (default: '-') */
|
|
31
|
+
separator?: string;
|
|
32
|
+
/** Whether to include component name in variable (default: true) */
|
|
33
|
+
includeComponent?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Generate CSS variable name from parts
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* generateCSSVariableName('button', 'bg', { prefix: 'atomix' })
|
|
41
|
+
* // Returns: '--atomix-button-bg'
|
|
42
|
+
*/
|
|
43
|
+
export function generateCSSVariableName(
|
|
44
|
+
component: string,
|
|
45
|
+
property: string,
|
|
46
|
+
options: CSSVariableNamingOptions = {}
|
|
47
|
+
): string {
|
|
48
|
+
const {
|
|
49
|
+
prefix = 'atomix',
|
|
50
|
+
separator = '-',
|
|
51
|
+
includeComponent = true,
|
|
52
|
+
} = options;
|
|
53
|
+
|
|
54
|
+
const parts = [prefix];
|
|
55
|
+
|
|
56
|
+
if (includeComponent) {
|
|
57
|
+
parts.push(component);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
parts.push(property);
|
|
61
|
+
|
|
62
|
+
return `--${parts.join(separator)}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Generate CSS variables object from configuration
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const vars = generateComponentCSSVars({
|
|
70
|
+
* component: 'button',
|
|
71
|
+
* properties: { bg: '#000', color: '#fff' }
|
|
72
|
+
* })
|
|
73
|
+
* // Returns: { '--atomix-button-bg': '#000', '--atomix-button-color': '#fff' }
|
|
74
|
+
*/
|
|
75
|
+
export function generateComponentCSSVars(
|
|
76
|
+
config: CSSVariableConfig,
|
|
77
|
+
options: CSSVariableNamingOptions = {}
|
|
78
|
+
): Record<string, string> {
|
|
79
|
+
const vars: Record<string, string> = {};
|
|
80
|
+
const { component, properties, parts, states, variants } = config;
|
|
81
|
+
|
|
82
|
+
// Base properties
|
|
83
|
+
Object.entries(properties).forEach(([key, value]) => {
|
|
84
|
+
const varName = generateCSSVariableName(component, key, options);
|
|
85
|
+
vars[varName] = String(value);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Part properties
|
|
89
|
+
if (parts) {
|
|
90
|
+
Object.entries(parts).forEach(([partName, partProps]) => {
|
|
91
|
+
Object.entries(partProps).forEach(([key, value]) => {
|
|
92
|
+
const varName = generateCSSVariableName(
|
|
93
|
+
component,
|
|
94
|
+
`${partName}-${key}`,
|
|
95
|
+
options
|
|
96
|
+
);
|
|
97
|
+
vars[varName] = String(value);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// State properties
|
|
103
|
+
if (states) {
|
|
104
|
+
Object.entries(states).forEach(([stateName, stateProps]) => {
|
|
105
|
+
Object.entries(stateProps).forEach(([key, value]) => {
|
|
106
|
+
const varName = generateCSSVariableName(
|
|
107
|
+
component,
|
|
108
|
+
`${stateName}-${key}`,
|
|
109
|
+
options
|
|
110
|
+
);
|
|
111
|
+
vars[varName] = String(value);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Variant properties
|
|
117
|
+
if (variants) {
|
|
118
|
+
Object.entries(variants).forEach(([variantName, variantProps]) => {
|
|
119
|
+
Object.entries(variantProps).forEach(([key, value]) => {
|
|
120
|
+
const varName = generateCSSVariableName(
|
|
121
|
+
component,
|
|
122
|
+
`${variantName}-${key}`,
|
|
123
|
+
options
|
|
124
|
+
);
|
|
125
|
+
vars[varName] = String(value);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return vars;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Map SCSS tokens to CSS custom properties
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* const tokens = { '$primary-color': '#7AFFD7', '$spacing-md': '16px' }
|
|
138
|
+
* const vars = mapSCSSTokensToCSSVars(tokens)
|
|
139
|
+
* // Returns: { '--primary-color': '#7AFFD7', '--spacing-md': '16px' }
|
|
140
|
+
*/
|
|
141
|
+
export function mapSCSSTokensToCSSVars(
|
|
142
|
+
tokens: Record<string, any>,
|
|
143
|
+
options: CSSVariableNamingOptions = {}
|
|
144
|
+
): Record<string, string> {
|
|
145
|
+
const vars: Record<string, string> = {};
|
|
146
|
+
const { prefix = 'atomix', separator = '-' } = options;
|
|
147
|
+
|
|
148
|
+
Object.entries(tokens).forEach(([key, value]) => {
|
|
149
|
+
// Remove $ prefix from SCSS variables
|
|
150
|
+
const cleanKey = key.startsWith('$') ? key.slice(1) : key;
|
|
151
|
+
|
|
152
|
+
// Convert underscores to separators
|
|
153
|
+
const normalizedKey = cleanKey.replace(/_/g, separator);
|
|
154
|
+
|
|
155
|
+
// Generate variable name
|
|
156
|
+
const varName = `--${prefix}${separator}${normalizedKey}`;
|
|
157
|
+
|
|
158
|
+
vars[varName] = String(value);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
return vars;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Apply CSS variables to an element
|
|
166
|
+
*
|
|
167
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
168
|
+
* @param vars - CSS variables to apply
|
|
169
|
+
*/
|
|
170
|
+
export function applyCSSVariables(
|
|
171
|
+
vars: Record<string, string | number>,
|
|
172
|
+
element: HTMLElement = document.documentElement
|
|
173
|
+
): void {
|
|
174
|
+
Object.entries(vars).forEach(([key, value]) => {
|
|
175
|
+
element.style.setProperty(key, String(value));
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Remove CSS variables from an element
|
|
181
|
+
*
|
|
182
|
+
* @param varNames - Variable names to remove
|
|
183
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
184
|
+
*/
|
|
185
|
+
export function removeCSSVariables(
|
|
186
|
+
varNames: string[],
|
|
187
|
+
element: HTMLElement = document.documentElement
|
|
188
|
+
): void {
|
|
189
|
+
varNames.forEach((varName) => {
|
|
190
|
+
element.style.removeProperty(varName);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Get CSS variable value from an element
|
|
196
|
+
*
|
|
197
|
+
* @param varName - Variable name to get
|
|
198
|
+
* @param element - Target element (defaults to document.documentElement)
|
|
199
|
+
* @returns Variable value or null if not found
|
|
200
|
+
*/
|
|
201
|
+
export function getCSSVariable(
|
|
202
|
+
varName: string,
|
|
203
|
+
element: HTMLElement = document.documentElement
|
|
204
|
+
): string | null {
|
|
205
|
+
return getComputedStyle(element).getPropertyValue(varName).trim() || null;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Convert CSS variable object to inline style object
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* const vars = { '--atomix-button-bg': '#000' }
|
|
213
|
+
* const style = cssVarsToStyle(vars)
|
|
214
|
+
* // Returns: { '--atomix-button-bg': '#000' } as React.CSSProperties
|
|
215
|
+
*/
|
|
216
|
+
export function cssVarsToStyle(
|
|
217
|
+
vars: Record<string, string | number>
|
|
218
|
+
): React.CSSProperties {
|
|
219
|
+
return Object.entries(vars).reduce((acc, [key, value]) => {
|
|
220
|
+
(acc as any)[key] = typeof value === 'number' ? `${value}px` : value;
|
|
221
|
+
return acc;
|
|
222
|
+
}, {} as React.CSSProperties);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Merge multiple CSS variable objects
|
|
227
|
+
* Later objects override earlier ones
|
|
228
|
+
*/
|
|
229
|
+
export function mergeCSSVars(
|
|
230
|
+
...varObjects: Array<Record<string, string | number> | undefined>
|
|
231
|
+
): Record<string, string | number> {
|
|
232
|
+
return varObjects.reduce<Record<string, string | number>>((acc, vars) => {
|
|
233
|
+
if (vars) {
|
|
234
|
+
Object.assign(acc, vars);
|
|
235
|
+
}
|
|
236
|
+
return acc;
|
|
237
|
+
}, {});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Validate CSS variable name format
|
|
242
|
+
*/
|
|
243
|
+
export function isValidCSSVariableName(name: string): boolean {
|
|
244
|
+
return /^--[a-z0-9-]+$/.test(name);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Extract component name from CSS variable name
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* extractComponentName('--atomix-button-bg')
|
|
252
|
+
* // Returns: 'button'
|
|
253
|
+
*/
|
|
254
|
+
export function extractComponentName(
|
|
255
|
+
varName: string,
|
|
256
|
+
prefix: string = 'atomix'
|
|
257
|
+
): string | null {
|
|
258
|
+
const regex = new RegExp(`^--${prefix}-([a-z0-9]+)-`);
|
|
259
|
+
const match = varName.match(regex);
|
|
260
|
+
return match ? (match[1] ?? null) : null;
|
|
261
|
+
}
|