@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,519 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Token Manager for Atomix Design System
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { readFile, writeFile, readdir } from 'fs/promises';
|
|
6
|
+
import { join, basename } from 'path';
|
|
7
|
+
import { existsSync } from 'fs';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import ora from 'ora';
|
|
10
|
+
import boxen from 'boxen';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Token categories in the design system
|
|
14
|
+
*/
|
|
15
|
+
const tokenCategories = {
|
|
16
|
+
colors: {
|
|
17
|
+
path: 'src/styles/01-settings/_settings.colors.scss',
|
|
18
|
+
prefix: '--atomix-color',
|
|
19
|
+
description: 'Color palette tokens'
|
|
20
|
+
},
|
|
21
|
+
typography: {
|
|
22
|
+
path: 'src/styles/01-settings/_settings.typography.scss',
|
|
23
|
+
prefix: '--atomix-font',
|
|
24
|
+
description: 'Typography scale tokens'
|
|
25
|
+
},
|
|
26
|
+
spacing: {
|
|
27
|
+
path: 'src/styles/01-settings/_settings.spacing.scss',
|
|
28
|
+
prefix: '--atomix-space',
|
|
29
|
+
description: 'Spacing scale tokens'
|
|
30
|
+
},
|
|
31
|
+
radius: {
|
|
32
|
+
path: 'src/styles/01-settings/_settings.radius.scss',
|
|
33
|
+
prefix: '--atomix-radius',
|
|
34
|
+
description: 'Border radius tokens'
|
|
35
|
+
},
|
|
36
|
+
shadows: {
|
|
37
|
+
path: 'src/styles/01-settings/_settings.shadows.scss',
|
|
38
|
+
prefix: '--atomix-shadow',
|
|
39
|
+
description: 'Box shadow tokens'
|
|
40
|
+
},
|
|
41
|
+
breakpoints: {
|
|
42
|
+
path: 'src/styles/01-settings/_settings.breakpoints.scss',
|
|
43
|
+
prefix: '--atomix-breakpoint',
|
|
44
|
+
description: 'Responsive breakpoint tokens'
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Extract tokens from SCSS file
|
|
50
|
+
*/
|
|
51
|
+
async function extractTokensFromFile(filePath) {
|
|
52
|
+
if (!existsSync(filePath)) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const content = await readFile(filePath, 'utf8');
|
|
57
|
+
const tokens = {};
|
|
58
|
+
|
|
59
|
+
// Extract SCSS variables
|
|
60
|
+
const scssVarPattern = /\$([a-z-]+):\s*([^;!]+)(?:\s*!default)?;/gi;
|
|
61
|
+
let match;
|
|
62
|
+
while ((match = scssVarPattern.exec(content)) !== null) {
|
|
63
|
+
tokens[`$${match[1]}`] = {
|
|
64
|
+
type: 'scss',
|
|
65
|
+
name: match[1],
|
|
66
|
+
value: match[2].trim(),
|
|
67
|
+
line: content.substring(0, match.index).split('\n').length
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Extract CSS custom properties
|
|
72
|
+
const cssVarPattern = /--(atomix-[a-z-]+):\s*([^;]+);/gi;
|
|
73
|
+
while ((match = cssVarPattern.exec(content)) !== null) {
|
|
74
|
+
tokens[`--${match[1]}`] = {
|
|
75
|
+
type: 'css',
|
|
76
|
+
name: match[1],
|
|
77
|
+
value: match[2].trim(),
|
|
78
|
+
line: content.substring(0, match.index).split('\n').length
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return tokens;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* List all design tokens
|
|
87
|
+
*/
|
|
88
|
+
export async function listTokens(category = null) {
|
|
89
|
+
const spinner = ora('Loading design tokens...').start();
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const results = {};
|
|
93
|
+
|
|
94
|
+
// Get tokens from specified category or all categories
|
|
95
|
+
const categories = category
|
|
96
|
+
? [category]
|
|
97
|
+
: Object.keys(tokenCategories);
|
|
98
|
+
|
|
99
|
+
for (const cat of categories) {
|
|
100
|
+
if (!tokenCategories[cat]) {
|
|
101
|
+
spinner.warn(chalk.yellow(`Unknown category: ${cat}`));
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const { path, description } = tokenCategories[cat];
|
|
106
|
+
const fullPath = join(process.cwd(), path);
|
|
107
|
+
const tokens = await extractTokensFromFile(fullPath);
|
|
108
|
+
|
|
109
|
+
if (tokens) {
|
|
110
|
+
results[cat] = {
|
|
111
|
+
description,
|
|
112
|
+
path: path,
|
|
113
|
+
tokens: tokens,
|
|
114
|
+
count: Object.keys(tokens).length
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
spinner.stop();
|
|
120
|
+
|
|
121
|
+
// Display results
|
|
122
|
+
if (Object.keys(results).length === 0) {
|
|
123
|
+
console.log(chalk.yellow('\n⚠️ No design tokens found'));
|
|
124
|
+
console.log(chalk.gray('Make sure you are in an Atomix project directory'));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
console.log(chalk.bold.cyan('\n📐 Design Tokens\n'));
|
|
129
|
+
|
|
130
|
+
for (const [category, data] of Object.entries(results)) {
|
|
131
|
+
console.log(boxen(
|
|
132
|
+
chalk.bold(category.toUpperCase()) + '\n' +
|
|
133
|
+
chalk.gray(data.description) + '\n\n' +
|
|
134
|
+
chalk.cyan(`Tokens: ${data.count}\n`) +
|
|
135
|
+
chalk.gray(`File: ${data.path}`),
|
|
136
|
+
{
|
|
137
|
+
padding: 1,
|
|
138
|
+
margin: { top: 0, bottom: 1, left: 0, right: 0 },
|
|
139
|
+
borderStyle: 'round',
|
|
140
|
+
borderColor: 'gray'
|
|
141
|
+
}
|
|
142
|
+
));
|
|
143
|
+
|
|
144
|
+
// Show first 5 tokens as examples
|
|
145
|
+
const tokenEntries = Object.entries(data.tokens).slice(0, 5);
|
|
146
|
+
tokenEntries.forEach(([name, info]) => {
|
|
147
|
+
const value = info.value.length > 30
|
|
148
|
+
? info.value.substring(0, 30) + '...'
|
|
149
|
+
: info.value;
|
|
150
|
+
console.log(` ${chalk.green(name)}: ${chalk.white(value)}`);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if (Object.keys(data.tokens).length > 5) {
|
|
154
|
+
console.log(chalk.gray(` ... and ${Object.keys(data.tokens).length - 5} more\n`));
|
|
155
|
+
} else {
|
|
156
|
+
console.log();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return results;
|
|
161
|
+
|
|
162
|
+
} catch (error) {
|
|
163
|
+
spinner.fail(chalk.red('Failed to load tokens'));
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Validate design tokens
|
|
170
|
+
*/
|
|
171
|
+
export async function validateTokens(options = {}) {
|
|
172
|
+
const spinner = ora('Validating design tokens...').start();
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
const issues = [];
|
|
176
|
+
const warnings = [];
|
|
177
|
+
let totalTokens = 0;
|
|
178
|
+
|
|
179
|
+
for (const [category, config] of Object.entries(tokenCategories)) {
|
|
180
|
+
const fullPath = join(process.cwd(), config.path);
|
|
181
|
+
|
|
182
|
+
if (!existsSync(fullPath)) {
|
|
183
|
+
issues.push({
|
|
184
|
+
category,
|
|
185
|
+
issue: 'Token file missing',
|
|
186
|
+
file: config.path,
|
|
187
|
+
fix: `Create file: ${config.path}`
|
|
188
|
+
});
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const tokens = await extractTokensFromFile(fullPath);
|
|
193
|
+
if (tokens) {
|
|
194
|
+
totalTokens += Object.keys(tokens).length;
|
|
195
|
+
|
|
196
|
+
// Check for hardcoded values
|
|
197
|
+
const content = await readFile(fullPath, 'utf8');
|
|
198
|
+
|
|
199
|
+
// Check for hardcoded colors
|
|
200
|
+
if (category === 'colors') {
|
|
201
|
+
const hardcodedColors = content.match(/#[0-9a-fA-F]{3,8}(?![0-9a-fA-F])/g);
|
|
202
|
+
if (hardcodedColors) {
|
|
203
|
+
const uniqueColors = [...new Set(hardcodedColors)];
|
|
204
|
+
warnings.push({
|
|
205
|
+
category,
|
|
206
|
+
issue: `Found ${uniqueColors.length} hardcoded color values`,
|
|
207
|
+
values: uniqueColors.slice(0, 3),
|
|
208
|
+
fix: 'Use color tokens or CSS custom properties'
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Check for hardcoded pixel values
|
|
214
|
+
if (category === 'spacing' || category === 'typography') {
|
|
215
|
+
const hardcodedPixels = content.match(/\d+px/g);
|
|
216
|
+
if (hardcodedPixels) {
|
|
217
|
+
const uniquePixels = [...new Set(hardcodedPixels)];
|
|
218
|
+
warnings.push({
|
|
219
|
+
category,
|
|
220
|
+
issue: `Found ${uniquePixels.length} hardcoded pixel values`,
|
|
221
|
+
values: uniquePixels.slice(0, 3),
|
|
222
|
+
fix: 'Use spacing tokens or rem units'
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Check for missing !default flags
|
|
228
|
+
const scssVars = content.match(/\$[a-z-]+:\s*[^;]+;/gi);
|
|
229
|
+
const defaultFlags = content.match(/!default/g);
|
|
230
|
+
if (scssVars && (!defaultFlags || defaultFlags.length < scssVars.length)) {
|
|
231
|
+
warnings.push({
|
|
232
|
+
category,
|
|
233
|
+
issue: 'Some SCSS variables missing !default flag',
|
|
234
|
+
fix: 'Add !default to allow theme overrides'
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Check naming conventions
|
|
239
|
+
for (const [name, info] of Object.entries(tokens)) {
|
|
240
|
+
if (info.type === 'css' && !name.startsWith(config.prefix)) {
|
|
241
|
+
warnings.push({
|
|
242
|
+
category,
|
|
243
|
+
issue: `Token "${name}" doesn't follow naming convention`,
|
|
244
|
+
fix: `Should start with "${config.prefix}"`
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
spinner.stop();
|
|
252
|
+
|
|
253
|
+
// Display validation results
|
|
254
|
+
console.log(chalk.bold.cyan('\n🔍 Token Validation Report\n'));
|
|
255
|
+
|
|
256
|
+
if (issues.length === 0 && warnings.length === 0) {
|
|
257
|
+
console.log(boxen(
|
|
258
|
+
chalk.bold.green('✅ All tokens valid!\n\n') +
|
|
259
|
+
chalk.gray(`Total tokens: ${totalTokens}\n`) +
|
|
260
|
+
chalk.gray('All naming conventions followed\n') +
|
|
261
|
+
chalk.gray('No hardcoded values found'),
|
|
262
|
+
{
|
|
263
|
+
padding: 1,
|
|
264
|
+
borderStyle: 'round',
|
|
265
|
+
borderColor: 'green'
|
|
266
|
+
}
|
|
267
|
+
));
|
|
268
|
+
} else {
|
|
269
|
+
if (issues.length > 0) {
|
|
270
|
+
console.log(chalk.bold.red(`❌ Issues (${issues.length}):\n`));
|
|
271
|
+
issues.forEach((issue, i) => {
|
|
272
|
+
console.log(chalk.red(` ${i + 1}. [${issue.category}] ${issue.issue}`));
|
|
273
|
+
console.log(chalk.gray(` File: ${issue.file}`));
|
|
274
|
+
console.log(chalk.yellow(` Fix: ${issue.fix}\n`));
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (warnings.length > 0) {
|
|
279
|
+
console.log(chalk.bold.yellow(`⚠️ Warnings (${warnings.length}):\n`));
|
|
280
|
+
warnings.forEach((warning, i) => {
|
|
281
|
+
console.log(chalk.yellow(` ${i + 1}. [${warning.category}] ${warning.issue}`));
|
|
282
|
+
if (warning.values) {
|
|
283
|
+
console.log(chalk.gray(` Examples: ${warning.values.join(', ')}`));
|
|
284
|
+
}
|
|
285
|
+
console.log(chalk.cyan(` Fix: ${warning.fix}\n`));
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
290
|
+
console.log(chalk.cyan('\n💡 Run with --fix to attempt automatic fixes'));
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return { issues, warnings, totalTokens };
|
|
294
|
+
|
|
295
|
+
} catch (error) {
|
|
296
|
+
spinner.fail(chalk.red('Validation failed'));
|
|
297
|
+
throw error;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Export tokens to different formats
|
|
303
|
+
*/
|
|
304
|
+
export async function exportTokens(format = 'json', outputPath = null) {
|
|
305
|
+
const spinner = ora(`Exporting tokens as ${format.toUpperCase()}...`).start();
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
const allTokens = {};
|
|
309
|
+
|
|
310
|
+
// Collect all tokens
|
|
311
|
+
for (const [category, config] of Object.entries(tokenCategories)) {
|
|
312
|
+
const fullPath = join(process.cwd(), config.path);
|
|
313
|
+
const tokens = await extractTokensFromFile(fullPath);
|
|
314
|
+
|
|
315
|
+
if (tokens) {
|
|
316
|
+
allTokens[category] = {};
|
|
317
|
+
for (const [name, info] of Object.entries(tokens)) {
|
|
318
|
+
allTokens[category][name] = info.value;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
let output;
|
|
324
|
+
let filename;
|
|
325
|
+
|
|
326
|
+
switch (format.toLowerCase()) {
|
|
327
|
+
case 'json':
|
|
328
|
+
output = JSON.stringify(allTokens, null, 2);
|
|
329
|
+
filename = 'atomix-tokens.json';
|
|
330
|
+
break;
|
|
331
|
+
|
|
332
|
+
case 'css':
|
|
333
|
+
output = ':root {\n';
|
|
334
|
+
for (const [category, tokens] of Object.entries(allTokens)) {
|
|
335
|
+
output += ` /* ${category} */\n`;
|
|
336
|
+
for (const [name, value] of Object.entries(tokens)) {
|
|
337
|
+
if (name.startsWith('--')) {
|
|
338
|
+
output += ` ${name}: ${value};\n`;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
output += '}';
|
|
343
|
+
filename = 'atomix-tokens.css';
|
|
344
|
+
break;
|
|
345
|
+
|
|
346
|
+
case 'scss':
|
|
347
|
+
output = '// Atomix Design Tokens\n\n';
|
|
348
|
+
for (const [category, tokens] of Object.entries(allTokens)) {
|
|
349
|
+
output += `// ${category}\n`;
|
|
350
|
+
for (const [name, value] of Object.entries(tokens)) {
|
|
351
|
+
if (name.startsWith('$')) {
|
|
352
|
+
output += `${name}: ${value} !default;\n`;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
output += '\n';
|
|
356
|
+
}
|
|
357
|
+
filename = 'atomix-tokens.scss';
|
|
358
|
+
break;
|
|
359
|
+
|
|
360
|
+
case 'js':
|
|
361
|
+
case 'javascript':
|
|
362
|
+
output = '// Atomix Design Tokens\n';
|
|
363
|
+
output += 'export const tokens = ';
|
|
364
|
+
output += JSON.stringify(allTokens, null, 2);
|
|
365
|
+
output += ';\n\nexport default tokens;';
|
|
366
|
+
filename = 'atomix-tokens.js';
|
|
367
|
+
break;
|
|
368
|
+
|
|
369
|
+
case 'ts':
|
|
370
|
+
case 'typescript':
|
|
371
|
+
output = '// Atomix Design Tokens\n\n';
|
|
372
|
+
output += 'export interface AtomixTokens {\n';
|
|
373
|
+
for (const category of Object.keys(allTokens)) {
|
|
374
|
+
output += ` ${category}: Record<string, string>;\n`;
|
|
375
|
+
}
|
|
376
|
+
output += '}\n\n';
|
|
377
|
+
output += 'export const tokens: AtomixTokens = ';
|
|
378
|
+
output += JSON.stringify(allTokens, null, 2);
|
|
379
|
+
output += ';\n\nexport default tokens;';
|
|
380
|
+
filename = 'atomix-tokens.ts';
|
|
381
|
+
break;
|
|
382
|
+
|
|
383
|
+
default:
|
|
384
|
+
throw new Error(`Unsupported format: ${format}`);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Write to file
|
|
388
|
+
const finalPath = outputPath || filename;
|
|
389
|
+
await writeFile(finalPath, output, 'utf8');
|
|
390
|
+
|
|
391
|
+
spinner.succeed(chalk.green(`✓ Exported tokens to ${finalPath}`));
|
|
392
|
+
|
|
393
|
+
// Show summary
|
|
394
|
+
const categoryCount = Object.keys(allTokens).length;
|
|
395
|
+
const tokenCount = Object.values(allTokens).reduce(
|
|
396
|
+
(sum, cat) => sum + Object.keys(cat).length,
|
|
397
|
+
0
|
|
398
|
+
);
|
|
399
|
+
|
|
400
|
+
console.log(chalk.gray(`\n Categories: ${categoryCount}`));
|
|
401
|
+
console.log(chalk.gray(` Total tokens: ${tokenCount}`));
|
|
402
|
+
console.log(chalk.gray(` Format: ${format.toUpperCase()}`));
|
|
403
|
+
|
|
404
|
+
return { path: finalPath, tokens: allTokens };
|
|
405
|
+
|
|
406
|
+
} catch (error) {
|
|
407
|
+
spinner.fail(chalk.red('Export failed'));
|
|
408
|
+
throw error;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Import tokens from file
|
|
414
|
+
*/
|
|
415
|
+
export async function importTokens(filePath, options = {}) {
|
|
416
|
+
const spinner = ora('Importing design tokens...').start();
|
|
417
|
+
|
|
418
|
+
try {
|
|
419
|
+
if (!existsSync(filePath)) {
|
|
420
|
+
throw new Error(`File not found: ${filePath}`);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const content = await readFile(filePath, 'utf8');
|
|
424
|
+
const extension = filePath.split('.').pop().toLowerCase();
|
|
425
|
+
|
|
426
|
+
let tokens;
|
|
427
|
+
|
|
428
|
+
// Parse tokens based on file type
|
|
429
|
+
switch (extension) {
|
|
430
|
+
case 'json':
|
|
431
|
+
tokens = JSON.parse(content);
|
|
432
|
+
break;
|
|
433
|
+
|
|
434
|
+
case 'js':
|
|
435
|
+
case 'ts':
|
|
436
|
+
// Extract tokens from JS/TS export
|
|
437
|
+
const match = content.match(/export\s+(?:const|default)\s+\w*\s*=\s*({[\s\S]*})/);
|
|
438
|
+
if (match) {
|
|
439
|
+
// Simple eval (be careful in production)
|
|
440
|
+
tokens = eval(`(${match[1]})`);
|
|
441
|
+
} else {
|
|
442
|
+
throw new Error('Could not parse JavaScript/TypeScript tokens');
|
|
443
|
+
}
|
|
444
|
+
break;
|
|
445
|
+
|
|
446
|
+
default:
|
|
447
|
+
throw new Error(`Unsupported file type: ${extension}`);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
spinner.text = 'Updating token files...';
|
|
451
|
+
|
|
452
|
+
// Update token files
|
|
453
|
+
for (const [category, categoryTokens] of Object.entries(tokens)) {
|
|
454
|
+
if (!tokenCategories[category]) {
|
|
455
|
+
console.warn(chalk.yellow(`\n⚠️ Unknown category: ${category} (skipped)`));
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const config = tokenCategories[category];
|
|
460
|
+
const fullPath = join(process.cwd(), config.path);
|
|
461
|
+
|
|
462
|
+
// Generate SCSS content
|
|
463
|
+
let scssContent = `// ${config.description}\n`;
|
|
464
|
+
scssContent += `// Imported from: ${basename(filePath)}\n`;
|
|
465
|
+
scssContent += `// Date: ${new Date().toISOString()}\n\n`;
|
|
466
|
+
|
|
467
|
+
for (const [name, value] of Object.entries(categoryTokens)) {
|
|
468
|
+
if (name.startsWith('$')) {
|
|
469
|
+
scssContent += `${name}: ${value} !default;\n`;
|
|
470
|
+
} else if (name.startsWith('--')) {
|
|
471
|
+
scssContent += `:root {\n ${name}: ${value};\n}\n`;
|
|
472
|
+
} else {
|
|
473
|
+
// Convert to SCSS variable
|
|
474
|
+
scssContent += `$${name}: ${value} !default;\n`;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
if (options.dryRun) {
|
|
479
|
+
console.log(chalk.yellow(`\n Would update: ${config.path}`));
|
|
480
|
+
console.log(chalk.gray(scssContent.substring(0, 200) + '...'));
|
|
481
|
+
} else {
|
|
482
|
+
await writeFile(fullPath, scssContent, 'utf8');
|
|
483
|
+
console.log(chalk.green(` ✓ Updated ${config.path}`));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
spinner.succeed(chalk.green('✓ Tokens imported successfully'));
|
|
488
|
+
|
|
489
|
+
// Show summary
|
|
490
|
+
const categoryCount = Object.keys(tokens).length;
|
|
491
|
+
const tokenCount = Object.values(tokens).reduce(
|
|
492
|
+
(sum, cat) => sum + Object.keys(cat).length,
|
|
493
|
+
0
|
|
494
|
+
);
|
|
495
|
+
|
|
496
|
+
console.log(chalk.gray(`\n Categories imported: ${categoryCount}`));
|
|
497
|
+
console.log(chalk.gray(` Total tokens: ${tokenCount}`));
|
|
498
|
+
|
|
499
|
+
if (!options.dryRun) {
|
|
500
|
+
console.log(chalk.cyan('\n💡 Next steps:'));
|
|
501
|
+
console.log(chalk.gray(' 1. Review the updated token files'));
|
|
502
|
+
console.log(chalk.gray(' 2. Rebuild your themes: atomix build-theme <theme>'));
|
|
503
|
+
console.log(chalk.gray(' 3. Test your components with new tokens'));
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return { tokens, categoryCount, tokenCount };
|
|
507
|
+
|
|
508
|
+
} catch (error) {
|
|
509
|
+
spinner.fail(chalk.red('Import failed'));
|
|
510
|
+
throw error;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export default {
|
|
515
|
+
listTokens,
|
|
516
|
+
validateTokens,
|
|
517
|
+
exportTokens,
|
|
518
|
+
importTokens
|
|
519
|
+
};
|