@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,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Configuration Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the theme configuration system
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
ThemeConfig,
|
|
9
|
+
ThemeDefinition,
|
|
10
|
+
CSSThemeDefinition,
|
|
11
|
+
JSThemeDefinition,
|
|
12
|
+
BuildConfig,
|
|
13
|
+
RuntimeConfig,
|
|
14
|
+
IntegrationConfig,
|
|
15
|
+
} from '../../../../theme.config';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Configuration loader options
|
|
19
|
+
*/
|
|
20
|
+
export interface ConfigLoaderOptions {
|
|
21
|
+
/** Path to theme config file (default: 'theme.config.ts') */
|
|
22
|
+
configPath?: string;
|
|
23
|
+
/** Enable validation */
|
|
24
|
+
validate?: boolean;
|
|
25
|
+
/** Environment-specific overrides */
|
|
26
|
+
env?: 'development' | 'production' | 'test';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Loaded and validated theme configuration
|
|
31
|
+
*/
|
|
32
|
+
export interface LoadedThemeConfig extends ThemeConfig {
|
|
33
|
+
/** Whether config was validated */
|
|
34
|
+
validated: boolean;
|
|
35
|
+
/** Validation errors (if any) */
|
|
36
|
+
errors?: string[];
|
|
37
|
+
/** Validation warnings (if any) */
|
|
38
|
+
warnings?: string[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Theme metadata extracted from config
|
|
43
|
+
*/
|
|
44
|
+
export interface ThemeMetadata {
|
|
45
|
+
/** Theme identifier */
|
|
46
|
+
id: string;
|
|
47
|
+
/** Display name */
|
|
48
|
+
name: string;
|
|
49
|
+
/** Theme type */
|
|
50
|
+
type: 'css' | 'js';
|
|
51
|
+
/** Class name for CSS themes */
|
|
52
|
+
class?: string;
|
|
53
|
+
/** Description */
|
|
54
|
+
description?: string;
|
|
55
|
+
/** Author */
|
|
56
|
+
author?: string;
|
|
57
|
+
/** Version */
|
|
58
|
+
version?: string;
|
|
59
|
+
/** Tags */
|
|
60
|
+
tags?: string[];
|
|
61
|
+
/** Supports dark mode */
|
|
62
|
+
supportsDarkMode?: boolean;
|
|
63
|
+
/** Status */
|
|
64
|
+
status?: 'stable' | 'beta' | 'experimental' | 'deprecated';
|
|
65
|
+
/** Accessibility info */
|
|
66
|
+
a11y?: {
|
|
67
|
+
contrastTarget?: number;
|
|
68
|
+
modes?: string[];
|
|
69
|
+
};
|
|
70
|
+
/** Primary color */
|
|
71
|
+
color?: string;
|
|
72
|
+
/** Features */
|
|
73
|
+
features?: string[];
|
|
74
|
+
/** Dependencies */
|
|
75
|
+
dependencies?: string[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Configuration validation result
|
|
80
|
+
*/
|
|
81
|
+
export interface ConfigValidationResult {
|
|
82
|
+
/** Whether config is valid */
|
|
83
|
+
valid: boolean;
|
|
84
|
+
/** Validation errors */
|
|
85
|
+
errors: string[];
|
|
86
|
+
/** Validation warnings */
|
|
87
|
+
warnings: string[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type {
|
|
91
|
+
ThemeConfig,
|
|
92
|
+
ThemeDefinition,
|
|
93
|
+
CSSThemeDefinition,
|
|
94
|
+
JSThemeDefinition,
|
|
95
|
+
BuildConfig,
|
|
96
|
+
RuntimeConfig,
|
|
97
|
+
IntegrationConfig,
|
|
98
|
+
};
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Configuration Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates theme configuration structure and values
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
ThemeConfig,
|
|
9
|
+
ThemeDefinition,
|
|
10
|
+
CSSThemeDefinition,
|
|
11
|
+
JSThemeDefinition,
|
|
12
|
+
ConfigValidationResult,
|
|
13
|
+
} from './types';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Validate theme configuration
|
|
17
|
+
*
|
|
18
|
+
* @param config - Configuration to validate
|
|
19
|
+
* @returns Validation result with errors and warnings
|
|
20
|
+
*/
|
|
21
|
+
export function validateConfig(config: any): ConfigValidationResult {
|
|
22
|
+
const errors: string[] = [];
|
|
23
|
+
const warnings: string[] = [];
|
|
24
|
+
|
|
25
|
+
// Validate top-level structure
|
|
26
|
+
if (!config || typeof config !== 'object') {
|
|
27
|
+
errors.push('Configuration must be an object');
|
|
28
|
+
return { valid: false, errors, warnings };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Validate themes
|
|
32
|
+
if (!config.themes || typeof config.themes !== 'object') {
|
|
33
|
+
errors.push('Configuration must have a "themes" object');
|
|
34
|
+
} else {
|
|
35
|
+
const themeErrors = validateThemes(config.themes);
|
|
36
|
+
errors.push(...themeErrors.errors);
|
|
37
|
+
warnings.push(...themeErrors.warnings);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Validate build config
|
|
41
|
+
if (config.build) {
|
|
42
|
+
const buildErrors = validateBuildConfig(config.build);
|
|
43
|
+
errors.push(...buildErrors.errors);
|
|
44
|
+
warnings.push(...buildErrors.warnings);
|
|
45
|
+
} else {
|
|
46
|
+
warnings.push('No build configuration provided, using defaults');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Validate runtime config
|
|
50
|
+
if (config.runtime) {
|
|
51
|
+
const runtimeErrors = validateRuntimeConfig(config.runtime);
|
|
52
|
+
errors.push(...runtimeErrors.errors);
|
|
53
|
+
warnings.push(...runtimeErrors.warnings);
|
|
54
|
+
} else {
|
|
55
|
+
warnings.push('No runtime configuration provided, using defaults');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Validate integration config
|
|
59
|
+
if (config.integration) {
|
|
60
|
+
const integrationErrors = validateIntegrationConfig(config.integration);
|
|
61
|
+
errors.push(...integrationErrors.errors);
|
|
62
|
+
warnings.push(...integrationErrors.warnings);
|
|
63
|
+
} else {
|
|
64
|
+
warnings.push('No integration configuration provided, using defaults');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Validate dependencies
|
|
68
|
+
if (config.dependencies) {
|
|
69
|
+
const depErrors = validateDependencies(config.dependencies, config.themes || {});
|
|
70
|
+
errors.push(...depErrors.errors);
|
|
71
|
+
warnings.push(...depErrors.warnings);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
valid: errors.length === 0,
|
|
76
|
+
errors,
|
|
77
|
+
warnings,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Validate themes object
|
|
83
|
+
*/
|
|
84
|
+
function validateThemes(themes: Record<string, any>): ConfigValidationResult {
|
|
85
|
+
const errors: string[] = [];
|
|
86
|
+
const warnings: string[] = [];
|
|
87
|
+
|
|
88
|
+
if (Object.keys(themes).length === 0) {
|
|
89
|
+
warnings.push('No themes defined in configuration');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (const [themeId, theme] of Object.entries(themes)) {
|
|
93
|
+
// Validate theme ID
|
|
94
|
+
if (!themeId || typeof themeId !== 'string') {
|
|
95
|
+
errors.push(`Invalid theme ID: ${themeId}`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Validate theme object
|
|
100
|
+
if (!theme || typeof theme !== 'object') {
|
|
101
|
+
errors.push(`Theme "${themeId}" must be an object`);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Validate theme type
|
|
106
|
+
if (!theme.type || (theme.type !== 'css' && theme.type !== 'js')) {
|
|
107
|
+
errors.push(`Theme "${themeId}" must have type "css" or "js"`);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Validate required fields
|
|
112
|
+
if (!theme.name || typeof theme.name !== 'string') {
|
|
113
|
+
errors.push(`Theme "${themeId}" must have a "name" string`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Validate CSS theme
|
|
117
|
+
if (theme.type === 'css') {
|
|
118
|
+
const cssErrors = validateCSSTheme(themeId, theme);
|
|
119
|
+
errors.push(...cssErrors.errors);
|
|
120
|
+
warnings.push(...cssErrors.warnings);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Validate JS theme
|
|
124
|
+
if (theme.type === 'js') {
|
|
125
|
+
const jsErrors = validateJSTheme(themeId, theme);
|
|
126
|
+
errors.push(...jsErrors.errors);
|
|
127
|
+
warnings.push(...jsErrors.warnings);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Validate metadata
|
|
131
|
+
if (theme.version && !isValidSemver(theme.version)) {
|
|
132
|
+
warnings.push(`Theme "${themeId}" has invalid version format: ${theme.version}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (theme.status && !['stable', 'beta', 'experimental', 'deprecated'].includes(theme.status)) {
|
|
136
|
+
warnings.push(`Theme "${themeId}" has invalid status: ${theme.status}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Validate color format
|
|
140
|
+
if (theme.color && !isValidColor(theme.color)) {
|
|
141
|
+
warnings.push(`Theme "${themeId}" has invalid color format: ${theme.color}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Validate accessibility
|
|
145
|
+
if (theme.a11y) {
|
|
146
|
+
if (theme.a11y.contrastTarget && (theme.a11y.contrastTarget < 1 || theme.a11y.contrastTarget > 21)) {
|
|
147
|
+
warnings.push(`Theme "${themeId}" has invalid contrast target: ${theme.a11y.contrastTarget}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Validate CSS theme
|
|
157
|
+
*/
|
|
158
|
+
function validateCSSTheme(themeId: string, theme: any): ConfigValidationResult {
|
|
159
|
+
const errors: string[] = [];
|
|
160
|
+
const warnings: string[] = [];
|
|
161
|
+
|
|
162
|
+
// CSS themes don't require createTheme function
|
|
163
|
+
// But can have optional cssPath
|
|
164
|
+
|
|
165
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Validate JS theme
|
|
170
|
+
*/
|
|
171
|
+
function validateJSTheme(themeId: string, theme: any): ConfigValidationResult {
|
|
172
|
+
const errors: string[] = [];
|
|
173
|
+
const warnings: string[] = [];
|
|
174
|
+
|
|
175
|
+
// JS themes must have createTheme function
|
|
176
|
+
if (!theme.createTheme || typeof theme.createTheme !== 'function') {
|
|
177
|
+
errors.push(`JS theme "${themeId}" must have a "createTheme" function`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Validate build configuration
|
|
185
|
+
*/
|
|
186
|
+
function validateBuildConfig(build: any): ConfigValidationResult {
|
|
187
|
+
const errors: string[] = [];
|
|
188
|
+
const warnings: string[] = [];
|
|
189
|
+
|
|
190
|
+
if (!build.output || typeof build.output !== 'object') {
|
|
191
|
+
errors.push('Build config must have an "output" object');
|
|
192
|
+
} else {
|
|
193
|
+
if (!build.output.directory || typeof build.output.directory !== 'string') {
|
|
194
|
+
errors.push('Build output must have a "directory" string');
|
|
195
|
+
}
|
|
196
|
+
if (!build.output.formats || typeof build.output.formats !== 'object') {
|
|
197
|
+
errors.push('Build output must have a "formats" object');
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (!build.sass || typeof build.sass !== 'object') {
|
|
202
|
+
errors.push('Build config must have a "sass" object');
|
|
203
|
+
} else {
|
|
204
|
+
if (build.sass.style && !['expanded', 'compressed', 'compact', 'nested'].includes(build.sass.style)) {
|
|
205
|
+
warnings.push(`Invalid Sass style: ${build.sass.style}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Validate runtime configuration
|
|
214
|
+
*/
|
|
215
|
+
function validateRuntimeConfig(runtime: any): ConfigValidationResult {
|
|
216
|
+
const errors: string[] = [];
|
|
217
|
+
const warnings: string[] = [];
|
|
218
|
+
|
|
219
|
+
if (runtime.basePath && typeof runtime.basePath !== 'string') {
|
|
220
|
+
errors.push('Runtime basePath must be a string');
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (runtime.defaultTheme && typeof runtime.defaultTheme !== 'string') {
|
|
224
|
+
errors.push('Runtime defaultTheme must be a string');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (runtime.preload && !Array.isArray(runtime.preload)) {
|
|
228
|
+
errors.push('Runtime preload must be an array');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (runtime.storageKey && typeof runtime.storageKey !== 'string') {
|
|
232
|
+
errors.push('Runtime storageKey must be a string');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Validate integration configuration
|
|
240
|
+
*/
|
|
241
|
+
function validateIntegrationConfig(integration: any): ConfigValidationResult {
|
|
242
|
+
const errors: string[] = [];
|
|
243
|
+
const warnings: string[] = [];
|
|
244
|
+
|
|
245
|
+
if (!integration.classNames || typeof integration.classNames !== 'object') {
|
|
246
|
+
errors.push('Integration config must have a "classNames" object');
|
|
247
|
+
} else {
|
|
248
|
+
if (!integration.classNames.theme || typeof integration.classNames.theme !== 'string') {
|
|
249
|
+
errors.push('Integration classNames must have a "theme" string');
|
|
250
|
+
}
|
|
251
|
+
if (!integration.classNames.colorMode || typeof integration.classNames.colorMode !== 'string') {
|
|
252
|
+
errors.push('Integration classNames must have a "colorMode" string');
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Validate dependencies
|
|
261
|
+
*/
|
|
262
|
+
function validateDependencies(
|
|
263
|
+
dependencies: Record<string, string[]>,
|
|
264
|
+
themes: Record<string, any>
|
|
265
|
+
): ConfigValidationResult {
|
|
266
|
+
const errors: string[] = [];
|
|
267
|
+
const warnings: string[] = [];
|
|
268
|
+
|
|
269
|
+
for (const [themeId, deps] of Object.entries(dependencies)) {
|
|
270
|
+
// Check if theme exists
|
|
271
|
+
if (!themes[themeId]) {
|
|
272
|
+
warnings.push(`Dependencies defined for non-existent theme: ${themeId}`);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Validate dependencies array
|
|
277
|
+
if (!Array.isArray(deps)) {
|
|
278
|
+
errors.push(`Dependencies for "${themeId}" must be an array`);
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Check if all dependencies exist
|
|
283
|
+
for (const dep of deps) {
|
|
284
|
+
if (!themes[dep]) {
|
|
285
|
+
errors.push(`Theme "${themeId}" depends on non-existent theme: ${dep}`);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return { valid: errors.length === 0, errors, warnings };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Check if string is valid semver
|
|
295
|
+
*/
|
|
296
|
+
function isValidSemver(version: string): boolean {
|
|
297
|
+
const semverRegex = /^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/;
|
|
298
|
+
return semverRegex.test(version);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Check if string is valid color
|
|
303
|
+
*/
|
|
304
|
+
function isValidColor(color: string): boolean {
|
|
305
|
+
// Hex color
|
|
306
|
+
if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color)) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
// RGB/RGBA
|
|
310
|
+
if (/^rgba?\(/.test(color)) {
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
// HSL/HSLA
|
|
314
|
+
if (/^hsla?\(/.test(color)) {
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
// Named colors (basic check)
|
|
318
|
+
const namedColors = [
|
|
319
|
+
'black', 'white', 'red', 'green', 'blue', 'yellow', 'cyan', 'magenta',
|
|
320
|
+
'transparent', 'currentColor',
|
|
321
|
+
];
|
|
322
|
+
if (namedColors.includes(color.toLowerCase())) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme System Constants
|
|
3
|
+
*
|
|
4
|
+
* Centralized constants for the theme system to avoid magic numbers and strings.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Default storage key for theme persistence
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_STORAGE_KEY = 'atomix-theme';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Default data attribute name for theme
|
|
14
|
+
*/
|
|
15
|
+
export const DEFAULT_DATA_ATTRIBUTE = 'data-theme';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default base path for theme CSS files
|
|
19
|
+
*/
|
|
20
|
+
export const DEFAULT_BASE_PATH = '/themes';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Default style ID for injected JS theme CSS
|
|
24
|
+
*/
|
|
25
|
+
export const DEFAULT_STYLE_ID = 'atomix-js-theme-styles';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Default cache configuration
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_CACHE_CONFIG = {
|
|
31
|
+
maxSize: 50,
|
|
32
|
+
ttl: 0, // No expiration by default
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Default engine cache configuration
|
|
37
|
+
*/
|
|
38
|
+
export const DEFAULT_ENGINE_CACHE_CONFIG = {
|
|
39
|
+
maxSize: 10,
|
|
40
|
+
ttl: 0, // No expiration by default
|
|
41
|
+
} as const;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Theme link ID prefix
|
|
45
|
+
*/
|
|
46
|
+
export const THEME_LINK_ID_PREFIX = 'atomix-theme-';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* CSS file extensions
|
|
50
|
+
*/
|
|
51
|
+
export const CSS_EXTENSIONS = {
|
|
52
|
+
expanded: '.css',
|
|
53
|
+
compressed: '.min.css',
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Default config file path
|
|
58
|
+
*/
|
|
59
|
+
export const DEFAULT_CONFIG_PATH = 'theme.config.ts';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Default config file path (relative)
|
|
63
|
+
*/
|
|
64
|
+
export const DEFAULT_CONFIG_RELATIVE_PATH = '../../../../theme.config';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Validation thresholds
|
|
68
|
+
*/
|
|
69
|
+
export const VALIDATION_THRESHOLDS = {
|
|
70
|
+
/** Minimum contrast ratio for accessibility (WCAG AA) */
|
|
71
|
+
MIN_CONTRAST_RATIO: 4.5,
|
|
72
|
+
/** Critical contrast ratio threshold (below this is error) */
|
|
73
|
+
CRITICAL_CONTRAST_RATIO: 3.0,
|
|
74
|
+
/** Minimum font size for accessibility (px) */
|
|
75
|
+
MIN_FONT_SIZE: 12,
|
|
76
|
+
/** Maximum transition duration (ms) */
|
|
77
|
+
MAX_TRANSITION_DURATION: 10000,
|
|
78
|
+
/** Maximum z-index value */
|
|
79
|
+
MAX_Z_INDEX: 10000,
|
|
80
|
+
/** Maximum border radius (px) */
|
|
81
|
+
MAX_BORDER_RADIUS: 1000,
|
|
82
|
+
/** Maximum custom property depth */
|
|
83
|
+
MAX_CUSTOM_PROPERTY_DEPTH: 10,
|
|
84
|
+
} as const;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Default theme metadata
|
|
88
|
+
*/
|
|
89
|
+
export const DEFAULT_THEME_METADATA = {
|
|
90
|
+
status: 'stable' as const,
|
|
91
|
+
supportsDarkMode: false,
|
|
92
|
+
} as const;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* RTL locales (right-to-left languages)
|
|
96
|
+
*/
|
|
97
|
+
export const RTL_LOCALES = [
|
|
98
|
+
'ar', // Arabic
|
|
99
|
+
'he', // Hebrew
|
|
100
|
+
'fa', // Persian/Farsi
|
|
101
|
+
'ur', // Urdu
|
|
102
|
+
'yi', // Yiddish
|
|
103
|
+
'ku', // Kurdish
|
|
104
|
+
'sd', // Sindhi
|
|
105
|
+
] as const;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Default RTL configuration
|
|
109
|
+
*/
|
|
110
|
+
export const DEFAULT_RTL_CONFIG = {
|
|
111
|
+
enabled: false,
|
|
112
|
+
direction: 'ltr' as const,
|
|
113
|
+
dataAttribute: 'data-direction',
|
|
114
|
+
autoDetect: false,
|
|
115
|
+
} as const;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Analytics default configuration
|
|
119
|
+
*/
|
|
120
|
+
export const DEFAULT_ANALYTICS_CONFIG = {
|
|
121
|
+
enabled: true,
|
|
122
|
+
trackPerformance: true,
|
|
123
|
+
trackErrors: true,
|
|
124
|
+
bufferSize: 100,
|
|
125
|
+
flushInterval: 5000, // 5 seconds
|
|
126
|
+
} as const;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Logger default configuration
|
|
130
|
+
*/
|
|
131
|
+
export const DEFAULT_LOGGER_CONFIG = {
|
|
132
|
+
level: process.env.NODE_ENV === 'production' ? 1 : 2, // WARN in prod, INFO in dev
|
|
133
|
+
enableConsole: true,
|
|
134
|
+
} as const;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Environment-specific defaults
|
|
138
|
+
*/
|
|
139
|
+
export const ENV_DEFAULTS = {
|
|
140
|
+
development: {
|
|
141
|
+
useMinified: false,
|
|
142
|
+
lazy: false,
|
|
143
|
+
enableSourceMaps: true,
|
|
144
|
+
},
|
|
145
|
+
production: {
|
|
146
|
+
useMinified: true,
|
|
147
|
+
lazy: true,
|
|
148
|
+
enableSourceMaps: false,
|
|
149
|
+
},
|
|
150
|
+
test: {
|
|
151
|
+
enablePersistence: false,
|
|
152
|
+
preload: [],
|
|
153
|
+
},
|
|
154
|
+
} as const;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Integration default class names
|
|
158
|
+
*/
|
|
159
|
+
export const DEFAULT_INTEGRATION_CLASS_NAMES = {
|
|
160
|
+
theme: 'data-theme',
|
|
161
|
+
colorMode: 'data-atomix-color-mode',
|
|
162
|
+
} as const;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Integration default CSS variables
|
|
166
|
+
*/
|
|
167
|
+
export const DEFAULT_INTEGRATION_CSS_VARIABLES = {
|
|
168
|
+
colorMode: '--storybook-color-mode',
|
|
169
|
+
} as const;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Build default output directory
|
|
173
|
+
*/
|
|
174
|
+
export const DEFAULT_BUILD_OUTPUT_DIR = 'themes';
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Build default SASS configuration
|
|
178
|
+
*/
|
|
179
|
+
export const DEFAULT_SASS_CONFIG = {
|
|
180
|
+
style: 'expanded' as const,
|
|
181
|
+
sourceMap: true,
|
|
182
|
+
loadPaths: ['src'] as string[],
|
|
183
|
+
};
|