@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,530 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Validator
|
|
3
|
+
*
|
|
4
|
+
* Runtime theme validation including color contrast and accessibility checks
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Theme, ThemeMetadata } from '../types';
|
|
8
|
+
import { getContrastRatio, getLuminance } from '../themeUtils';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Validation result
|
|
12
|
+
*/
|
|
13
|
+
export interface ValidationResult {
|
|
14
|
+
/** Whether theme is valid */
|
|
15
|
+
valid: boolean;
|
|
16
|
+
/** Validation errors */
|
|
17
|
+
errors: string[];
|
|
18
|
+
/** Validation warnings */
|
|
19
|
+
warnings: string[];
|
|
20
|
+
/** Accessibility issues */
|
|
21
|
+
a11yIssues: A11yIssue[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Accessibility issue
|
|
26
|
+
*/
|
|
27
|
+
export interface A11yIssue {
|
|
28
|
+
/** Issue type */
|
|
29
|
+
type: 'contrast' | 'color' | 'missing';
|
|
30
|
+
/** Severity */
|
|
31
|
+
severity: 'error' | 'warning';
|
|
32
|
+
/** Issue message */
|
|
33
|
+
message: string;
|
|
34
|
+
/** Affected property */
|
|
35
|
+
property?: string;
|
|
36
|
+
/** Current value */
|
|
37
|
+
value?: string;
|
|
38
|
+
/** Recommended value */
|
|
39
|
+
recommended?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Theme Validator
|
|
44
|
+
*
|
|
45
|
+
* Validates themes for correctness and accessibility
|
|
46
|
+
*/
|
|
47
|
+
export class ThemeValidator {
|
|
48
|
+
/**
|
|
49
|
+
* Validate theme
|
|
50
|
+
*/
|
|
51
|
+
validate(theme: Theme, metadata?: ThemeMetadata): ValidationResult {
|
|
52
|
+
const errors: string[] = [];
|
|
53
|
+
const warnings: string[] = [];
|
|
54
|
+
const a11yIssues: A11yIssue[] = [];
|
|
55
|
+
|
|
56
|
+
// Validate palette
|
|
57
|
+
const paletteResult = this.validatePalette(theme.palette, metadata);
|
|
58
|
+
errors.push(...paletteResult.errors);
|
|
59
|
+
warnings.push(...paletteResult.warnings);
|
|
60
|
+
a11yIssues.push(...paletteResult.a11yIssues);
|
|
61
|
+
|
|
62
|
+
// Validate typography
|
|
63
|
+
const typographyResult = this.validateTypography(theme.typography);
|
|
64
|
+
errors.push(...typographyResult.errors);
|
|
65
|
+
warnings.push(...typographyResult.warnings);
|
|
66
|
+
|
|
67
|
+
// Validate spacing
|
|
68
|
+
const spacingResult = this.validateSpacing(theme.spacing);
|
|
69
|
+
errors.push(...spacingResult.errors);
|
|
70
|
+
warnings.push(...spacingResult.warnings);
|
|
71
|
+
|
|
72
|
+
// Validate breakpoints
|
|
73
|
+
const breakpointsResult = this.validateBreakpoints(theme.breakpoints);
|
|
74
|
+
errors.push(...breakpointsResult.errors);
|
|
75
|
+
warnings.push(...breakpointsResult.warnings);
|
|
76
|
+
|
|
77
|
+
// Validate transitions
|
|
78
|
+
const transitionsResult = this.validateTransitions(theme.transitions);
|
|
79
|
+
errors.push(...transitionsResult.errors);
|
|
80
|
+
warnings.push(...transitionsResult.warnings);
|
|
81
|
+
|
|
82
|
+
// Validate z-index
|
|
83
|
+
const zIndexResult = this.validateZIndex(theme.zIndex);
|
|
84
|
+
errors.push(...zIndexResult.errors);
|
|
85
|
+
warnings.push(...zIndexResult.warnings);
|
|
86
|
+
|
|
87
|
+
// Validate border radius
|
|
88
|
+
const borderRadiusResult = this.validateBorderRadius(theme.borderRadius);
|
|
89
|
+
errors.push(...borderRadiusResult.errors);
|
|
90
|
+
warnings.push(...borderRadiusResult.warnings);
|
|
91
|
+
|
|
92
|
+
// Validate custom properties
|
|
93
|
+
const customResult = this.validateCustom(theme.custom);
|
|
94
|
+
errors.push(...customResult.errors);
|
|
95
|
+
warnings.push(...customResult.warnings);
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
valid: errors.length === 0,
|
|
99
|
+
errors,
|
|
100
|
+
warnings,
|
|
101
|
+
a11yIssues,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Validate palette
|
|
107
|
+
*/
|
|
108
|
+
private validatePalette(
|
|
109
|
+
palette: Theme['palette'],
|
|
110
|
+
metadata?: ThemeMetadata
|
|
111
|
+
): ValidationResult {
|
|
112
|
+
const errors: string[] = [];
|
|
113
|
+
const warnings: string[] = [];
|
|
114
|
+
const a11yIssues: A11yIssue[] = [];
|
|
115
|
+
|
|
116
|
+
const contrastTarget = metadata?.a11y?.contrastTarget || 4.5;
|
|
117
|
+
|
|
118
|
+
// Validate primary color contrast
|
|
119
|
+
if (palette.primary) {
|
|
120
|
+
const primaryContrast = this.checkContrast(
|
|
121
|
+
palette.primary.main,
|
|
122
|
+
palette.primary.contrastText || '#000000'
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
if (primaryContrast < contrastTarget) {
|
|
126
|
+
const issue: A11yIssue = {
|
|
127
|
+
type: 'contrast',
|
|
128
|
+
severity: primaryContrast < 3 ? 'error' : 'warning',
|
|
129
|
+
message: `Primary color contrast ratio (${primaryContrast.toFixed(2)}) is below target (${contrastTarget})`,
|
|
130
|
+
property: 'palette.primary',
|
|
131
|
+
value: palette.primary.main,
|
|
132
|
+
};
|
|
133
|
+
a11yIssues.push(issue);
|
|
134
|
+
|
|
135
|
+
if (primaryContrast < 3) {
|
|
136
|
+
errors.push(issue.message);
|
|
137
|
+
} else {
|
|
138
|
+
warnings.push(issue.message);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Validate text colors on background
|
|
144
|
+
if (palette.text && palette.background) {
|
|
145
|
+
const textContrast = this.checkContrast(
|
|
146
|
+
palette.background.default,
|
|
147
|
+
palette.text.primary
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
if (textContrast < contrastTarget) {
|
|
151
|
+
const issue: A11yIssue = {
|
|
152
|
+
type: 'contrast',
|
|
153
|
+
severity: textContrast < 3 ? 'error' : 'warning',
|
|
154
|
+
message: `Text color contrast ratio (${textContrast.toFixed(2)}) is below target (${contrastTarget})`,
|
|
155
|
+
property: 'palette.text.primary',
|
|
156
|
+
value: palette.text.primary,
|
|
157
|
+
};
|
|
158
|
+
a11yIssues.push(issue);
|
|
159
|
+
|
|
160
|
+
if (textContrast < 3) {
|
|
161
|
+
errors.push(issue.message);
|
|
162
|
+
} else {
|
|
163
|
+
warnings.push(issue.message);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Validate all color values are valid
|
|
169
|
+
const colorKeys = ['primary', 'secondary', 'error', 'warning', 'info', 'success'] as const;
|
|
170
|
+
for (const key of colorKeys) {
|
|
171
|
+
const color = palette[key];
|
|
172
|
+
if (color) {
|
|
173
|
+
if (!this.isValidColor(color.main)) {
|
|
174
|
+
errors.push(`Invalid color value for ${key}.main: ${color.main}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Validate typography
|
|
184
|
+
*/
|
|
185
|
+
private validateTypography(typography: Theme['typography']): ValidationResult {
|
|
186
|
+
const errors: string[] = [];
|
|
187
|
+
const warnings: string[] = [];
|
|
188
|
+
const a11yIssues: A11yIssue[] = [];
|
|
189
|
+
|
|
190
|
+
if (!typography.fontFamily || typeof typography.fontFamily !== 'string') {
|
|
191
|
+
errors.push('Typography must have a fontFamily');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (!typography.fontSize || typeof typography.fontSize !== 'number' || typography.fontSize <= 0) {
|
|
195
|
+
errors.push('Typography must have a valid fontSize');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Check minimum font size for accessibility
|
|
199
|
+
if (typography.fontSize && typography.fontSize < 12) {
|
|
200
|
+
warnings.push('Font size is below recommended minimum (12px) for accessibility');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Validate spacing
|
|
208
|
+
*/
|
|
209
|
+
private validateSpacing(spacing: Theme['spacing']): ValidationResult {
|
|
210
|
+
const errors: string[] = [];
|
|
211
|
+
const warnings: string[] = [];
|
|
212
|
+
const a11yIssues: A11yIssue[] = [];
|
|
213
|
+
|
|
214
|
+
if (typeof spacing !== 'function') {
|
|
215
|
+
errors.push('Spacing must be a function');
|
|
216
|
+
} else {
|
|
217
|
+
// Test spacing function
|
|
218
|
+
try {
|
|
219
|
+
const test = spacing(1);
|
|
220
|
+
if (typeof test !== 'string') {
|
|
221
|
+
errors.push('Spacing function must return a string');
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
errors.push(`Spacing function error: ${error instanceof Error ? error.message : String(error)}`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Validate breakpoints
|
|
233
|
+
*/
|
|
234
|
+
private validateBreakpoints(breakpoints: Theme['breakpoints']): ValidationResult {
|
|
235
|
+
const errors: string[] = [];
|
|
236
|
+
const warnings: string[] = [];
|
|
237
|
+
const a11yIssues: A11yIssue[] = [];
|
|
238
|
+
|
|
239
|
+
if (!breakpoints.values) {
|
|
240
|
+
errors.push('Breakpoints must have values');
|
|
241
|
+
} else {
|
|
242
|
+
const required = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
243
|
+
for (const key of required) {
|
|
244
|
+
if (typeof breakpoints.values[key] !== 'number') {
|
|
245
|
+
errors.push(`Breakpoint ${key} must be a number`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Check breakpoint order
|
|
250
|
+
const values: number[] = [
|
|
251
|
+
breakpoints.values.xs,
|
|
252
|
+
breakpoints.values.sm,
|
|
253
|
+
breakpoints.values.md,
|
|
254
|
+
breakpoints.values.lg,
|
|
255
|
+
breakpoints.values.xl,
|
|
256
|
+
].filter((v): v is number => typeof v === 'number');
|
|
257
|
+
for (let i = 1; i < values.length; i++) {
|
|
258
|
+
const current = values[i];
|
|
259
|
+
const previous = values[i - 1];
|
|
260
|
+
if (current != null && previous != null && current <= previous) {
|
|
261
|
+
warnings.push(`Breakpoint values should be in ascending order`);
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Check color contrast ratio
|
|
272
|
+
*/
|
|
273
|
+
private checkContrast(foreground: string, background: string): number {
|
|
274
|
+
try {
|
|
275
|
+
return getContrastRatio(foreground, background);
|
|
276
|
+
} catch {
|
|
277
|
+
return 0;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Check if color is valid
|
|
283
|
+
*/
|
|
284
|
+
private isValidColor(color: string): boolean {
|
|
285
|
+
// Hex
|
|
286
|
+
if (/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/.test(color)) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
// RGB/RGBA
|
|
290
|
+
if (/^rgba?\(/.test(color)) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
// HSL/HSLA
|
|
294
|
+
if (/^hsla?\(/.test(color)) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Validate transitions
|
|
302
|
+
*/
|
|
303
|
+
private validateTransitions(transitions: Theme['transitions']): ValidationResult {
|
|
304
|
+
const errors: string[] = [];
|
|
305
|
+
const warnings: string[] = [];
|
|
306
|
+
const a11yIssues: A11yIssue[] = [];
|
|
307
|
+
|
|
308
|
+
if (!transitions) {
|
|
309
|
+
errors.push('Transitions configuration is required');
|
|
310
|
+
return { valid: false, errors, warnings, a11yIssues };
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Validate duration values
|
|
314
|
+
if (transitions.duration) {
|
|
315
|
+
const durationKeys: (keyof NonNullable<typeof transitions.duration>)[] = [
|
|
316
|
+
'shortest',
|
|
317
|
+
'shorter',
|
|
318
|
+
'short',
|
|
319
|
+
'standard',
|
|
320
|
+
'complex',
|
|
321
|
+
'enteringScreen',
|
|
322
|
+
'leavingScreen',
|
|
323
|
+
];
|
|
324
|
+
|
|
325
|
+
for (const key of durationKeys) {
|
|
326
|
+
const duration = transitions.duration[key];
|
|
327
|
+
if (duration !== undefined) {
|
|
328
|
+
if (typeof duration !== 'number' || duration < 0) {
|
|
329
|
+
errors.push(`Transition duration ${key} must be a non-negative number`);
|
|
330
|
+
} else if (duration > 10000) {
|
|
331
|
+
warnings.push(`Transition duration ${key} (${duration}ms) exceeds recommended maximum (10000ms)`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Validate easing functions
|
|
338
|
+
if (transitions.easing) {
|
|
339
|
+
const easingKeys: (keyof NonNullable<typeof transitions.easing>)[] = [
|
|
340
|
+
'easeInOut',
|
|
341
|
+
'easeOut',
|
|
342
|
+
'easeIn',
|
|
343
|
+
'sharp',
|
|
344
|
+
];
|
|
345
|
+
|
|
346
|
+
const validEasingPattern = /^(linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier\([^)]+\)|steps\([^)]+\))$/i;
|
|
347
|
+
|
|
348
|
+
for (const key of easingKeys) {
|
|
349
|
+
const easing = transitions.easing[key];
|
|
350
|
+
if (easing !== undefined) {
|
|
351
|
+
if (typeof easing !== 'string') {
|
|
352
|
+
errors.push(`Transition easing ${key} must be a string`);
|
|
353
|
+
} else if (!validEasingPattern.test(easing)) {
|
|
354
|
+
warnings.push(`Transition easing ${key} may not be a valid CSS easing function: ${easing}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Validate z-index
|
|
365
|
+
*/
|
|
366
|
+
private validateZIndex(zIndex: Theme['zIndex']): ValidationResult {
|
|
367
|
+
const errors: string[] = [];
|
|
368
|
+
const warnings: string[] = [];
|
|
369
|
+
const a11yIssues: A11yIssue[] = [];
|
|
370
|
+
|
|
371
|
+
if (!zIndex) {
|
|
372
|
+
errors.push('Z-index configuration is required');
|
|
373
|
+
return { valid: false, errors, warnings, a11yIssues };
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const numericEntries = Object.entries(zIndex).filter(([, value]) => typeof value === 'number') as Array<[
|
|
377
|
+
string,
|
|
378
|
+
number
|
|
379
|
+
]>;
|
|
380
|
+
|
|
381
|
+
for (const [key, value] of Object.entries(zIndex)) {
|
|
382
|
+
if (value !== undefined) {
|
|
383
|
+
if (typeof value !== 'number') {
|
|
384
|
+
errors.push(`Z-index ${key} must be a number, got ${typeof value}`);
|
|
385
|
+
} else if (value < 0) {
|
|
386
|
+
errors.push(`Z-index ${key} must be non-negative, got ${value}`);
|
|
387
|
+
} else if (value > 10000) {
|
|
388
|
+
warnings.push(`Z-index ${key} (${value}) exceeds recommended maximum (10000)`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
for (let i = 0; i < numericEntries.length; i++) {
|
|
394
|
+
for (let j = i + 1; j < numericEntries.length; j++) {
|
|
395
|
+
const [keyA, valueA] = numericEntries[i];
|
|
396
|
+
const [keyB, valueB] = numericEntries[j];
|
|
397
|
+
const diff = Math.abs(valueA - valueB);
|
|
398
|
+
if (diff < 10 && diff > 0) {
|
|
399
|
+
warnings.push(
|
|
400
|
+
`Z-index values ${keyA} (${valueA}) and ${keyB} (${valueB}) are very close, potential layering conflicts`
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Validate border radius
|
|
411
|
+
*/
|
|
412
|
+
private validateBorderRadius(borderRadius: Theme['borderRadius']): ValidationResult {
|
|
413
|
+
const errors: string[] = [];
|
|
414
|
+
const warnings: string[] = [];
|
|
415
|
+
const a11yIssues: A11yIssue[] = [];
|
|
416
|
+
|
|
417
|
+
if (!borderRadius) {
|
|
418
|
+
errors.push('Border radius configuration is required');
|
|
419
|
+
return { valid: false, errors, warnings, a11yIssues };
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Common border radius keys
|
|
423
|
+
const radiusKeys: (keyof typeof borderRadius)[] = [
|
|
424
|
+
'base',
|
|
425
|
+
'sm',
|
|
426
|
+
'md',
|
|
427
|
+
'lg',
|
|
428
|
+
'xl',
|
|
429
|
+
'xxl',
|
|
430
|
+
'3xl',
|
|
431
|
+
'4xl',
|
|
432
|
+
'pill',
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
for (const key of radiusKeys) {
|
|
436
|
+
const value = borderRadius[key];
|
|
437
|
+
if (value !== undefined) {
|
|
438
|
+
let numValue: number;
|
|
439
|
+
|
|
440
|
+
if (typeof value === 'number') {
|
|
441
|
+
numValue = value;
|
|
442
|
+
} else if (typeof value === 'string') {
|
|
443
|
+
// Parse string values like "4px", "0.5rem", etc.
|
|
444
|
+
const match = value.match(/^([\d.]+)(px|rem|em|%)?$/);
|
|
445
|
+
if (!match) {
|
|
446
|
+
errors.push(`Border radius ${key} has invalid format: ${value}`);
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
const [, numStr] = match;
|
|
450
|
+
if (!numStr) {
|
|
451
|
+
errors.push(`Border radius ${key} has invalid numeric value: ${value}`);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
numValue = parseFloat(numStr);
|
|
455
|
+
} else {
|
|
456
|
+
errors.push(`Border radius ${key} must be a number or string, got ${typeof value}`);
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
if (numValue < 0) {
|
|
461
|
+
errors.push(`Border radius ${key} must be non-negative, got ${numValue}`);
|
|
462
|
+
} else if (numValue > 1000) {
|
|
463
|
+
warnings.push(`Border radius ${key} (${value}) exceeds recommended maximum (1000px)`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Validate custom properties
|
|
473
|
+
*/
|
|
474
|
+
private validateCustom(custom: Theme['custom']): ValidationResult {
|
|
475
|
+
const errors: string[] = [];
|
|
476
|
+
const warnings: string[] = [];
|
|
477
|
+
const a11yIssues: A11yIssue[] = [];
|
|
478
|
+
|
|
479
|
+
if (!custom || typeof custom !== 'object') {
|
|
480
|
+
return { valid: true, errors, warnings, a11yIssues };
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// Check for circular references and validate structure
|
|
484
|
+
const visited = new WeakSet();
|
|
485
|
+
const maxDepth = 10;
|
|
486
|
+
let currentDepth = 0;
|
|
487
|
+
|
|
488
|
+
const validateObject = (obj: any, path: string = 'custom'): void => {
|
|
489
|
+
if (currentDepth > maxDepth) {
|
|
490
|
+
warnings.push(`Custom property path ${path} exceeds maximum depth (${maxDepth}), potential circular reference`);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (obj === null || typeof obj !== 'object') {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (visited.has(obj)) {
|
|
499
|
+
warnings.push(`Circular reference detected in custom property path: ${path}`);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
visited.add(obj);
|
|
504
|
+
currentDepth++;
|
|
505
|
+
|
|
506
|
+
try {
|
|
507
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
508
|
+
const currentPath = `${path}.${key}`;
|
|
509
|
+
|
|
510
|
+
// Validate property name
|
|
511
|
+
if (!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key)) {
|
|
512
|
+
warnings.push(`Custom property name "${key}" in ${path} does not follow naming conventions (should be valid identifier)`);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Validate value type
|
|
516
|
+
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
517
|
+
validateObject(value, currentPath);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
} finally {
|
|
521
|
+
currentDepth--;
|
|
522
|
+
visited.delete(obj);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
validateObject(custom);
|
|
527
|
+
|
|
528
|
+
return { valid: errors.length === 0, errors, warnings, a11yIssues };
|
|
529
|
+
}
|
|
530
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Core Module
|
|
3
|
+
*
|
|
4
|
+
* Core engine components for theme management
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { ThemeEngine } from './ThemeEngine';
|
|
8
|
+
export { ThemeRegistry } from './ThemeRegistry';
|
|
9
|
+
export { ThemeCache } from './ThemeCache';
|
|
10
|
+
export { ThemeValidator } from './ThemeValidator';
|
|
11
|
+
|
|
12
|
+
export type {
|
|
13
|
+
ThemeChangeEvent,
|
|
14
|
+
ThemeLoadOptions,
|
|
15
|
+
ThemeChangeListener,
|
|
16
|
+
ThemeLoadListener,
|
|
17
|
+
ThemeErrorListener,
|
|
18
|
+
ThemeEngineConfig,
|
|
19
|
+
} from './ThemeEngine';
|
|
20
|
+
|
|
21
|
+
export type {
|
|
22
|
+
ValidationResult,
|
|
23
|
+
A11yIssue,
|
|
24
|
+
} from './ThemeValidator';
|