@skyroc/scripts 2.5.0
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/LICENSE +21 -0
- package/README.md +508 -0
- package/dist/cli.mjs +78 -0
- package/dist/config-BKkdncJS.mjs +987 -0
- package/dist/index.mjs +14 -0
- package/package.json +83 -0
- package/templates/admin/.env +62 -0
- package/templates/admin/.env.prod +7 -0
- package/templates/admin/.env.test +7 -0
- package/templates/admin/.oxlintrc.json +6 -0
- package/templates/admin/README.md +508 -0
- package/templates/admin/index.html +14 -0
- package/templates/admin/package.json +105 -0
- package/templates/admin/public/favicon.svg +3 -0
- package/templates/admin/src/App.tsx +71 -0
- package/templates/admin/src/assets/audio/wechat-style-notification.wav +0 -0
- package/templates/admin/src/assets/imgs/skyroc.jpg +0 -0
- package/templates/admin/src/assets/svg-icon/activity.svg +1 -0
- package/templates/admin/src/assets/svg-icon/at-sign.svg +1 -0
- package/templates/admin/src/assets/svg-icon/avatar.svg +1 -0
- package/templates/admin/src/assets/svg-icon/banner.svg +1 -0
- package/templates/admin/src/assets/svg-icon/cast.svg +1 -0
- package/templates/admin/src/assets/svg-icon/chrome.svg +1 -0
- package/templates/admin/src/assets/svg-icon/copy.svg +1 -0
- package/templates/admin/src/assets/svg-icon/custom-icon.svg +1 -0
- package/templates/admin/src/assets/svg-icon/empty-data.svg +1 -0
- package/templates/admin/src/assets/svg-icon/error.svg +1 -0
- package/templates/admin/src/assets/svg-icon/expectation.svg +1 -0
- package/templates/admin/src/assets/svg-icon/heart.svg +1 -0
- package/templates/admin/src/assets/svg-icon/logo.svg +15 -0
- package/templates/admin/src/assets/svg-icon/network-error.svg +1 -0
- package/templates/admin/src/assets/svg-icon/no-icon.svg +1 -0
- package/templates/admin/src/assets/svg-icon/no-permission.svg +1 -0
- package/templates/admin/src/assets/svg-icon/not-found.svg +1 -0
- package/templates/admin/src/assets/svg-icon/service-error.svg +1 -0
- package/templates/admin/src/bootstrap.tsx +60 -0
- package/templates/admin/src/components/SkyrocAvatar.tsx +13 -0
- package/templates/admin/src/components/SystemLogo.tsx +7 -0
- package/templates/admin/src/config.ts +125 -0
- package/templates/admin/src/features/antd/AntdProvider.tsx +21 -0
- package/templates/admin/src/features/auth/components/UserAvatar.tsx +76 -0
- package/templates/admin/src/features/auth/use-auth-form-rules.ts +83 -0
- package/templates/admin/src/features/auth/use-auth.ts +96 -0
- package/templates/admin/src/features/auth/use-login.ts +72 -0
- package/templates/admin/src/features/effects/GlobalEffect.tsx +15 -0
- package/templates/admin/src/features/menus/dynamic-routes.ts +10 -0
- package/templates/admin/src/features/menus/extras.ts +3 -0
- package/templates/admin/src/features/menus/menu-category.ts +14 -0
- package/templates/admin/src/features/menus/menu-config.ts +5 -0
- package/templates/admin/src/features/router/RouterProvider.tsx +18 -0
- package/templates/admin/src/features/router/guard.ts +97 -0
- package/templates/admin/src/features/router/index.ts +52 -0
- package/templates/admin/src/features/router/routeTree.gen.ts +237 -0
- package/templates/admin/src/features/router/router-ref.ts +24 -0
- package/templates/admin/src/locales/antd.ts +8 -0
- package/templates/admin/src/locales/index.ts +22 -0
- package/templates/admin/src/locales/sync.ts +14 -0
- package/templates/admin/src/main.tsx +9 -0
- package/templates/admin/src/pages/(admin)/home/index.tsx +46 -0
- package/templates/admin/src/pages/(admin)/layout.tsx +44 -0
- package/templates/admin/src/pages/(auth)/login/index.tsx +102 -0
- package/templates/admin/src/pages/(auth)/login/layout.tsx +71 -0
- package/templates/admin/src/pages/(auth)/login-out.tsx +27 -0
- package/templates/admin/src/pages/(errors)/403.tsx +16 -0
- package/templates/admin/src/pages/(errors)/404.tsx +16 -0
- package/templates/admin/src/pages/(errors)/500.tsx +16 -0
- package/templates/admin/src/pages/__root.tsx +54 -0
- package/templates/admin/src/pages/error.tsx +19 -0
- package/templates/admin/src/pages/index.tsx +14 -0
- package/templates/admin/src/pages/loading.tsx +45 -0
- package/templates/admin/src/pages/not-found.tsx +9 -0
- package/templates/admin/src/plugins/app.tsx +47 -0
- package/templates/admin/src/plugins/assets.ts +4 -0
- package/templates/admin/src/plugins/index.ts +32 -0
- package/templates/admin/src/service/adapter.ts +63 -0
- package/templates/admin/src/service/api/auth/api.ts +31 -0
- package/templates/admin/src/service/api/auth/hooks.ts +28 -0
- package/templates/admin/src/service/api/auth/index.ts +10 -0
- package/templates/admin/src/service/api/auth/keys.ts +7 -0
- package/templates/admin/src/service/api/auth/urls.ts +7 -0
- package/templates/admin/src/service/api/index.ts +2 -0
- package/templates/admin/src/service/api/route/api.ts +7 -0
- package/templates/admin/src/service/api/route/hooks.ts +21 -0
- package/templates/admin/src/service/api/route/index.ts +10 -0
- package/templates/admin/src/service/api/route/keys.ts +3 -0
- package/templates/admin/src/service/api/route/urls.ts +5 -0
- package/templates/admin/src/service/queryClient.ts +13 -0
- package/templates/admin/src/service/request/index.ts +62 -0
- package/templates/admin/src/styles/scss/global.scss +1 -0
- package/templates/admin/src/styles/scss/scrollbar.scss +28 -0
- package/templates/admin/src/types/auto-imports.d.ts +186 -0
- package/templates/admin/src/types/global.d.ts +16 -0
- package/templates/admin/src/types/router.d.ts +14 -0
- package/templates/admin/src/types/storage.d.ts +17 -0
- package/templates/admin/src/types/vite-env.d.ts +117 -0
- package/templates/admin/src/utils/common.tsx +38 -0
- package/templates/admin/src/utils/icon.ts +9 -0
- package/templates/admin/src/utils/service.ts +75 -0
- package/templates/admin/src/utils/storage.ts +7 -0
- package/templates/admin/tsconfig.json +22 -0
- package/templates/admin/uno.config.ts +18 -0
- package/templates/admin/vite.config.ts +13 -0
- package/templates/admin-shell/i18n/atoms/lang.ts +20 -0
- package/templates/admin-shell/i18n/config/default.ts +11 -0
- package/templates/admin-shell/i18n/features/lang/LangEffect.tsx +25 -0
- package/templates/admin-shell/i18n/features/lang/LangSwitch.tsx +49 -0
- package/templates/admin-shell/i18n/hooks/use-lang.ts +47 -0
- package/templates/admin-shell/i18n/i18n.ts +116 -0
- package/templates/admin-shell/i18n/index.ts +23 -0
- package/templates/admin-shell/i18n/langs/en-us/common.json +49 -0
- package/templates/admin-shell/i18n/langs/en-us/datatable.json +8 -0
- package/templates/admin-shell/i18n/langs/en-us/dropdown.json +9 -0
- package/templates/admin-shell/i18n/langs/en-us/form.json +27 -0
- package/templates/admin-shell/i18n/langs/en-us/icon.json +13 -0
- package/templates/admin-shell/i18n/langs/en-us/notification.json +20 -0
- package/templates/admin-shell/i18n/langs/en-us/page.json +442 -0
- package/templates/admin-shell/i18n/langs/en-us/request.json +8 -0
- package/templates/admin-shell/i18n/langs/en-us/route.json +84 -0
- package/templates/admin-shell/i18n/langs/en-us/system.json +9 -0
- package/templates/admin-shell/i18n/langs/en-us/theme.json +173 -0
- package/templates/admin-shell/i18n/langs/index.ts +63 -0
- package/templates/admin-shell/i18n/langs/zh-cn/common.json +49 -0
- package/templates/admin-shell/i18n/langs/zh-cn/datatable.json +8 -0
- package/templates/admin-shell/i18n/langs/zh-cn/dropdown.json +9 -0
- package/templates/admin-shell/i18n/langs/zh-cn/form.json +27 -0
- package/templates/admin-shell/i18n/langs/zh-cn/icon.json +13 -0
- package/templates/admin-shell/i18n/langs/zh-cn/notification.json +20 -0
- package/templates/admin-shell/i18n/langs/zh-cn/page.json +442 -0
- package/templates/admin-shell/i18n/langs/zh-cn/request.json +8 -0
- package/templates/admin-shell/i18n/langs/zh-cn/route.json +84 -0
- package/templates/admin-shell/i18n/langs/zh-cn/system.json +9 -0
- package/templates/admin-shell/i18n/langs/zh-cn/theme.json +173 -0
- package/templates/admin-shell/i18n/types/i18n.ts +29 -0
- package/templates/admin-shell/i18n/types.ts +53 -0
- package/templates/admin-shell/i18n/utils/helpers.ts +18 -0
- package/templates/admin-shell/layouts/AdminLayout.tsx +161 -0
- package/templates/admin-shell/layouts/constant.ts +56 -0
- package/templates/admin-shell/layouts/context.tsx +101 -0
- package/templates/admin-shell/layouts/features/menus/MenuBadge.tsx +76 -0
- package/templates/admin-shell/layouts/features/menus/dynamic-routes.ts +146 -0
- package/templates/admin-shell/layouts/features/menus/menu-generator.tsx +444 -0
- package/templates/admin-shell/layouts/features/menus/menu-renderer.tsx +149 -0
- package/templates/admin-shell/layouts/features/menus/permissions.ts +28 -0
- package/templates/admin-shell/layouts/features/menus/use-menus.ts +98 -0
- package/templates/admin-shell/layouts/features/use-route.ts +30 -0
- package/templates/admin-shell/layouts/index.ts +44 -0
- package/templates/admin-shell/layouts/materials/index.ts +6 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css +63 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css.d.ts +18 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.tsx +238 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/shared.ts +67 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ButtonTab.tsx +44 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTab.tsx +54 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTabBg.tsx +30 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/SliderTab.tsx +44 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/SvgClose.tsx +51 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/hook.ts +34 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css +120 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css.d.ts +18 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.tsx +76 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/shared.ts +32 -0
- package/templates/admin-shell/layouts/materials/types/index.ts +322 -0
- package/templates/admin-shell/layouts/modules/AdminContent.tsx +285 -0
- package/templates/admin-shell/layouts/modules/AdminFooter.tsx +13 -0
- package/templates/admin-shell/layouts/modules/AdminLogo.tsx +28 -0
- package/templates/admin-shell/layouts/modules/AdminSider.tsx +50 -0
- package/templates/admin-shell/layouts/modules/admin-header/AdminHeader.tsx +132 -0
- package/templates/admin-shell/layouts/modules/admin-header/components/Breadcrumb.tsx +62 -0
- package/templates/admin-shell/layouts/modules/admin-header/components/ThemeButton.tsx +24 -0
- package/templates/admin-shell/layouts/modules/admin-menu/AdminMenu.tsx +37 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/FirstLevelMenu.tsx +156 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/HorizontalMenu.tsx +88 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/MenuPortal.tsx +28 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/VerticalMenu.tsx +123 -0
- package/templates/admin-shell/layouts/modules/admin-menu/enum.ts +47 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/Horizontal.tsx +22 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridHeaderFirst.tsx +15 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridSidebarFirst.tsx +18 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/Vertical.tsx +14 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalHybridHeaderFirst.tsx +18 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalMix.tsx +132 -0
- package/templates/admin-shell/layouts/modules/admin-search/AdminSearch.tsx +36 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchFooter.tsx +38 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchModal.tsx +171 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchResult.tsx +43 -0
- package/templates/admin-shell/layouts/modules/admin-tab/AdminTab.tsx +125 -0
- package/templates/admin-shell/layouts/modules/admin-tab/components/TabContextMenu.tsx +107 -0
- package/templates/admin-shell/layouts/modules/admin-tab/hooks/useTabScroll.ts +86 -0
- package/templates/admin-shell/layouts/modules/shared/logo.ts +42 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/ThemeDrawer.tsx +68 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedCollapse.tsx +36 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedItem.tsx +35 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/LayoutModeCard.tsx +110 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/SettingItem.tsx +31 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/ConfigOperation.tsx +53 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/CustomPicker.tsx +105 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeColor.tsx +58 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeSchema.tsx +42 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeToken.tsx +44 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/index.tsx +23 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/GlobalSettings.tsx +57 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/ThemeGeneral.tsx +20 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/WatermarkSettings.tsx +103 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ContentSettings.tsx +100 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/FooterSettings.tsx +71 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/HeaderSettings.tsx +63 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/LayoutMode.tsx +73 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/SiderSettings.tsx +124 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/TabSettings.tsx +95 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ThemeLayout.tsx +32 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/preset/ThemePreset.tsx +132 -0
- package/templates/admin-shell/layouts/options.tsx +79 -0
- package/templates/admin-shell/layouts/setup.ts +102 -0
- package/templates/admin-shell/layouts/state/AdminEffect.tsx +56 -0
- package/templates/admin-shell/layouts/state/AdminTabEffect.tsx +28 -0
- package/templates/admin-shell/layouts/state/index.ts +3 -0
- package/templates/admin-shell/layouts/state/menus/MenuToggler.tsx +53 -0
- package/templates/admin-shell/layouts/state/menus/use-admin-menu-badges.ts +46 -0
- package/templates/admin-shell/layouts/state/menus/use-admin-menus.tsx +164 -0
- package/templates/admin-shell/layouts/state/tabs/index.ts +1 -0
- package/templates/admin-shell/layouts/state/tabs/shared.tsx +148 -0
- package/templates/admin-shell/layouts/state/tabs/use-admin-tab.ts +377 -0
- package/templates/admin-shell/layouts/state/use-admin-state.ts +118 -0
- package/templates/admin-shell/layouts/types/router.d.ts +10 -0
- package/templates/admin-shell/layouts/types/storage.ts +18 -0
- package/templates/admin-shell/notification/NotificationButton.tsx +91 -0
- package/templates/admin-shell/notification/NotificationContext.ts +8 -0
- package/templates/admin-shell/notification/NotificationPanel.tsx +194 -0
- package/templates/admin-shell/notification/NotificationProvider.tsx +59 -0
- package/templates/admin-shell/notification/index.ts +12 -0
- package/templates/admin-shell/notification/mock.ts +59 -0
- package/templates/admin-shell/notification/notification-store.ts +438 -0
- package/templates/admin-shell/notification/notification.css +60 -0
- package/templates/admin-shell/notification/types.ts +104 -0
- package/templates/admin-shell/notification/use-notification.ts +51 -0
- package/templates/admin-shell/notification/useNotificationContext.ts +14 -0
- package/templates/admin-shell/runtime/app-update.ts +156 -0
- package/templates/admin-shell/runtime/dayjs.ts +20 -0
- package/templates/admin-shell/runtime/iconify.ts +17 -0
- package/templates/admin-shell/runtime/index.ts +10 -0
- package/templates/admin-shell/runtime/nprogress.ts +25 -0
- package/templates/admin-shell/runtime/plugins.ts +62 -0
- package/templates/admin-shell/styles/global.css +54 -0
- package/templates/admin-shell/styles/nprogress.css +85 -0
- package/templates/admin-shell/styles/reset.css +378 -0
- package/templates/admin-shell/theme/antd/AntdProvider.tsx +106 -0
- package/templates/admin-shell/theme/antd/index.ts +23 -0
- package/templates/admin-shell/theme/antd/shared.ts +80 -0
- package/templates/admin-shell/theme/antd/ui.ts +250 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/colors.ts +99 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/index.ts +87 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/colors.ts +91 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/index.ts +77 -0
- package/templates/admin-shell/theme/antd-algorithm/index.ts +80 -0
- package/templates/admin-shell/theme/antd-algorithm/seed/index.ts +41 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/colorAlgorithm.ts +10 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genColorMapToken.ts +165 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genCommonMapToken.ts +23 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genControlHeight.ts +14 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genFontMapToken.ts +274 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genRadiusMapToken.ts +139 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genSizeMapToken.ts +114 -0
- package/templates/admin-shell/theme/antd-algorithm/types/index.ts +20 -0
- package/templates/admin-shell/theme/components/ThemeEffect.tsx +55 -0
- package/templates/admin-shell/theme/components/ThemeSchemaSegmented.tsx +27 -0
- package/templates/admin-shell/theme/components/ThemeSchemaSwitch.tsx +77 -0
- package/templates/admin-shell/theme/components/shared.ts +5 -0
- package/templates/admin-shell/theme/config/default.ts +108 -0
- package/templates/admin-shell/theme/config/index.ts +1 -0
- package/templates/admin-shell/theme/hooks/index.ts +2 -0
- package/templates/admin-shell/theme/hooks/use-theme.ts +244 -0
- package/templates/admin-shell/theme/index.ts +78 -0
- package/templates/admin-shell/theme/presets/azir.json +39 -0
- package/templates/admin-shell/theme/presets/compact.json +38 -0
- package/templates/admin-shell/theme/presets/dark.json +93 -0
- package/templates/admin-shell/theme/presets/default.json +95 -0
- package/templates/admin-shell/theme/presets/index.ts +29 -0
- package/templates/admin-shell/theme/presets/shadcn.json +99 -0
- package/templates/admin-shell/theme/setup.ts +115 -0
- package/templates/admin-shell/theme/types/index.ts +27 -0
- package/templates/admin-shell/theme/types/theme.d.ts +316 -0
- package/templates/admin-shell/theme/utils/dark-mode.ts +46 -0
- package/templates/admin-shell/theme/utils/filters.ts +20 -0
- package/templates/admin-shell/theme/utils/index.ts +3 -0
- package/templates/admin-shell/theme/utils/settings.ts +43 -0
- package/templates/admin-shell/types/api/auth.d.ts +148 -0
- package/templates/admin-shell/types/api/common.d.ts +54 -0
- package/templates/admin-shell/types/api/route.d.ts +104 -0
- package/templates/admin-shell/types/api/service.d.ts +51 -0
- package/templates/admin-shell/types/api/system-manage.d.ts +160 -0
- package/templates/admin-shell/types/app/common.d.ts +31 -0
- package/templates/admin-shell/types/app/global.d.ts +71 -0
- package/templates/admin-shell/types/app/menu.d.ts +57 -0
- package/templates/admin-shell/types/app/router.d.ts +201 -0
- package/templates/admin-shell/types/app/storage.d.ts +10 -0
- package/templates/admin-shell/types/app/union-key.d.ts +156 -0
- package/templates/admin-shell/types/locales/i18n.d.ts +135 -0
- package/templates/admin-shell/ui/antd/components/AppTree.tsx +62 -0
- package/templates/admin-shell/ui/antd/components/BeyondHiding.tsx +42 -0
- package/templates/admin-shell/ui/antd/components/ButtonIcon.tsx +123 -0
- package/templates/admin-shell/ui/antd/components/ButtonLink.tsx +30 -0
- package/templates/admin-shell/ui/antd/components/ErrorBoundary.tsx +45 -0
- package/templates/admin-shell/ui/antd/components/ExceptionBase.tsx +69 -0
- package/templates/admin-shell/ui/antd/components/FullScreen.tsx +33 -0
- package/templates/admin-shell/ui/antd/components/PinToggler.tsx +35 -0
- package/templates/admin-shell/ui/antd/components/ReloadButton.tsx +20 -0
- package/templates/admin-shell/ui/antd/components/index.ts +12 -0
- package/templates/admin-shell/ui/antd/components/styles/button-icon-animations.css +246 -0
- package/templates/admin-shell/ui/antd/index.ts +1 -0
- package/templates/admin-shell/ui/antd/styles.d.ts +1 -0
- package/templates/admin-shell/ui/compose/animate-feature.ts +5 -0
- package/templates/admin-shell/ui/compose/components/BetterScroll.tsx +51 -0
- package/templates/admin-shell/ui/compose/components/DarkModeContainer.tsx +22 -0
- package/templates/admin-shell/ui/compose/components/FlipText.tsx +41 -0
- package/templates/admin-shell/ui/compose/components/I18nLabel.tsx +18 -0
- package/templates/admin-shell/ui/compose/components/LazyAnimate.tsx +10 -0
- package/templates/admin-shell/ui/compose/components/LookForward.tsx +24 -0
- package/templates/admin-shell/ui/compose/components/NumberTicker.tsx +105 -0
- package/templates/admin-shell/ui/compose/components/Portal.tsx +74 -0
- package/templates/admin-shell/ui/compose/components/SvgIcon.tsx +39 -0
- package/templates/admin-shell/ui/compose/components/TypingAnimation.tsx +83 -0
- package/templates/admin-shell/ui/compose/components/WaveBg.tsx +56 -0
- package/templates/admin-shell/ui/compose/components/index.ts +11 -0
- package/templates/admin-shell/ui/compose/index.ts +2 -0
- package/templates/admin-shell/ui/compose/table/DragContent.tsx +239 -0
- package/templates/admin-shell/ui/compose/table/TableHeaderOperation.tsx +210 -0
- package/templates/admin-shell/ui/compose/table/hooks.ts +196 -0
- package/templates/admin-shell/ui/compose/table/index.ts +16 -0
- package/templates/admin-shell/ui/compose/table/types.ts +244 -0
- package/templates/admin-shell/ui/compose/table/use-table-operate.ts +136 -0
- package/templates/admin-shell/ui/compose/table/use-table-scroll.ts +49 -0
- package/templates/admin-shell/ui/compose/table/use-table.ts +303 -0
- package/templates/admin.meta.json +756 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SeedToken } from 'antd/lib/theme/interface';
|
|
2
|
+
|
|
3
|
+
export const defaultPresetColors: Partial<SeedToken> = {
|
|
4
|
+
// Blue palette
|
|
5
|
+
blue: '#3B82F6', // Tailwind blue-500
|
|
6
|
+
geekblue: '#6366F1', // Indigo for better distinction from blue
|
|
7
|
+
cyan: '#06B6D4', // Tailwind cyan-500
|
|
8
|
+
|
|
9
|
+
// Purple/Pink palette
|
|
10
|
+
purple: '#8B5CF6', // Tailwind violet-500
|
|
11
|
+
magenta: '#D946EF', // Tailwind fuchsia-500
|
|
12
|
+
pink: '#EC4899', // Tailwind pink-500
|
|
13
|
+
|
|
14
|
+
// Red/Orange palette
|
|
15
|
+
red: '#EF4444', // Tailwind red-500
|
|
16
|
+
orange: '#F97316', // Tailwind orange-500
|
|
17
|
+
volcano: '#DC2626', // Tailwind red-600
|
|
18
|
+
|
|
19
|
+
// Yellow/Gold palette
|
|
20
|
+
yellow: '#EAB308', // Tailwind yellow-500
|
|
21
|
+
gold: '#D97706', // Tailwind amber-600
|
|
22
|
+
|
|
23
|
+
// Green palette
|
|
24
|
+
green: '#10B981', // Tailwind emerald-500
|
|
25
|
+
lime: '#84CC16', // Tailwind lime-500
|
|
26
|
+
|
|
27
|
+
// Main Colors
|
|
28
|
+
colorPrimary: '#6366F1',
|
|
29
|
+
colorInfo: '#0EA5E9',
|
|
30
|
+
colorSuccess: '#10B981',
|
|
31
|
+
colorWarning: '#F59E0B',
|
|
32
|
+
colorError: '#F43F5E'
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const seedToken: Partial<SeedToken> = {
|
|
36
|
+
...defaultPresetColors,
|
|
37
|
+
|
|
38
|
+
fontSize: 14,
|
|
39
|
+
|
|
40
|
+
borderRadius: 6
|
|
41
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color algorithm utilities
|
|
3
|
+
*
|
|
4
|
+
* Note: Most color operations have been moved to @skyroc/color package - mixColor: Mix two colors - adjustLightness:
|
|
5
|
+
* Adjust lightness - lightenColor / darkenColor: Lighten/darken color
|
|
6
|
+
*
|
|
7
|
+
* This file re-exports from @skyroc/color for convenience
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { adjustLightness, darkenColor, lightenColor, mixColor } from '@skyroc/color';
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { ColorMapToken, SeedToken } from 'antd/lib/theme/interface';
|
|
2
|
+
import type { ColorMap, PaletteGenerators } from '../types';
|
|
3
|
+
|
|
4
|
+
/** AntD 1-10 indexes */
|
|
5
|
+
export const ANTD_INDEXES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] as const;
|
|
6
|
+
|
|
7
|
+
/** Tailwind style 50-950 indexes */
|
|
8
|
+
export const TAILWIND_INDEXES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Semantic color mapping configuration
|
|
12
|
+
*
|
|
13
|
+
* Design principles: - 1-2 (50-100): Background - 3-4 (200-300): Border - 5 (400): Hover - 6 (500): Main color - 7
|
|
14
|
+
* (600): Active - 5-7 (400-600): Text related
|
|
15
|
+
*/
|
|
16
|
+
export interface SemanticColorConfig {
|
|
17
|
+
/** Active color */
|
|
18
|
+
active: number;
|
|
19
|
+
/** Background color */
|
|
20
|
+
bg: number;
|
|
21
|
+
/** Background hover color */
|
|
22
|
+
bgHover: number;
|
|
23
|
+
/** Border color */
|
|
24
|
+
border: number;
|
|
25
|
+
/** Border hover color */
|
|
26
|
+
borderHover: number;
|
|
27
|
+
/** Hover color */
|
|
28
|
+
hover: number;
|
|
29
|
+
/** Main color */
|
|
30
|
+
main: number;
|
|
31
|
+
/** Text color */
|
|
32
|
+
text: number;
|
|
33
|
+
/** Text active color */
|
|
34
|
+
textActive: number;
|
|
35
|
+
/** Text hover color */
|
|
36
|
+
textHover: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Primary color semantic configuration */
|
|
40
|
+
export const PRIMARY_SEMANTIC_CONFIG: SemanticColorConfig = {
|
|
41
|
+
active: 7,
|
|
42
|
+
bg: 1,
|
|
43
|
+
bgHover: 2,
|
|
44
|
+
border: 3,
|
|
45
|
+
borderHover: 4,
|
|
46
|
+
hover: 5,
|
|
47
|
+
main: 6,
|
|
48
|
+
text: 6,
|
|
49
|
+
textActive: 7,
|
|
50
|
+
textHover: 5
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** Functional color semantic configuration (success, warning, error, info) */
|
|
54
|
+
export const FUNCTIONAL_SEMANTIC_CONFIG: SemanticColorConfig = {
|
|
55
|
+
active: 7,
|
|
56
|
+
bg: 1,
|
|
57
|
+
bgHover: 2,
|
|
58
|
+
border: 3,
|
|
59
|
+
borderHover: 4,
|
|
60
|
+
hover: 4, // Functional color uses 4 for hover
|
|
61
|
+
main: 6,
|
|
62
|
+
text: 9,
|
|
63
|
+
textActive: 10,
|
|
64
|
+
textHover: 8
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
interface GenSemanticColorsOptions {
|
|
68
|
+
colors: ColorMap;
|
|
69
|
+
config: SemanticColorConfig;
|
|
70
|
+
/** Color name, supports 'colorPrimary' or 'Primary' format */
|
|
71
|
+
name: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Normalize color name - 'colorPrimary' → 'Primary' - 'Primary' → 'Primary' - 'primary' → 'Primary' */
|
|
75
|
+
function normalizeColorName(name: string): string {
|
|
76
|
+
// Remove 'color' prefix
|
|
77
|
+
let normalized = name.startsWith('color') ? name.slice(5) : name;
|
|
78
|
+
// First letter lowercase
|
|
79
|
+
normalized = normalized.charAt(0).toLocaleLowerCase() + normalized.slice(1);
|
|
80
|
+
return normalized;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Generate semantic colors for a single color
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // The following three calls are equivalent:
|
|
88
|
+
* genSemanticColors({ name: 'colorPrimary', ... })
|
|
89
|
+
* genSemanticColors({ name: 'Primary', ... })
|
|
90
|
+
* genSemanticColors({ name: 'primary', ... })
|
|
91
|
+
* // All generate: colorPrimary, colorPrimaryActive, colorPrimaryBg, ...
|
|
92
|
+
*/
|
|
93
|
+
export function genSemanticColors({ colors, config, name }: GenSemanticColorsOptions): Record<string, string> {
|
|
94
|
+
let colorName = name;
|
|
95
|
+
const isMainColor = name.startsWith('Color');
|
|
96
|
+
if (isMainColor) {
|
|
97
|
+
colorName = name.slice(5);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const extra = isMainColor
|
|
101
|
+
? { [colorName.charAt(0).toLocaleLowerCase() + colorName.slice(1)]: colors[config.main] }
|
|
102
|
+
: {};
|
|
103
|
+
return {
|
|
104
|
+
...extra,
|
|
105
|
+
[`color${colorName}`]: colors[config.main],
|
|
106
|
+
[`color${colorName}Active`]: colors[config.active],
|
|
107
|
+
[`color${colorName}Bg`]: colors[config.bg],
|
|
108
|
+
[`color${colorName}BgHover`]: colors[config.bgHover],
|
|
109
|
+
[`color${colorName}Border`]: colors[config.border],
|
|
110
|
+
[`color${colorName}BorderHover`]: colors[config.borderHover],
|
|
111
|
+
[`color${colorName}Hover`]: colors[config.hover],
|
|
112
|
+
[`color${colorName}Text`]: colors[config.text],
|
|
113
|
+
[`color${colorName}TextActive`]: colors[config.textActive],
|
|
114
|
+
[`color${colorName}TextHover`]: colors[config.textHover]
|
|
115
|
+
} as Record<string, string>;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Generate palette variables (1-10 and 50-950).
|
|
120
|
+
*
|
|
121
|
+
* AntD components read compact keys such as `blue1`, while UnoCSS and project styles use hyphenated keys such as
|
|
122
|
+
* `blue-1`. Both aliases must point to the same palette value.
|
|
123
|
+
*/
|
|
124
|
+
export function genPaletteVars(name: string, colors: ColorMap): Record<string, string> {
|
|
125
|
+
const colorName = normalizeColorName(name);
|
|
126
|
+
|
|
127
|
+
const result: Record<string, string> = {};
|
|
128
|
+
|
|
129
|
+
// AntD internal format: name1 to name10; project palette format: name-1 to name-10.
|
|
130
|
+
for (const i of ANTD_INDEXES) {
|
|
131
|
+
const color = colors[i] || '';
|
|
132
|
+
result[`${colorName}${i}`] = color;
|
|
133
|
+
result[`${colorName}-${i}`] = color;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Tailwind format: name-50 to name-950
|
|
137
|
+
for (const i of TAILWIND_INDEXES) {
|
|
138
|
+
result[`${colorName}-${i}`] = colors[i] || '';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Generate neutral color map token
|
|
146
|
+
*
|
|
147
|
+
* Only generates neutral colors (background, text, border, etc.) Theme colors are generated in the derivative function
|
|
148
|
+
* by iterating defaultPresetColors
|
|
149
|
+
*/
|
|
150
|
+
export default function genColorMapToken(
|
|
151
|
+
seed: SeedToken,
|
|
152
|
+
{ generateNeutralColorPalettes }: PaletteGenerators
|
|
153
|
+
): ColorMapToken {
|
|
154
|
+
const { colorBgBase, colorTextBase } = seed;
|
|
155
|
+
|
|
156
|
+
// Generate neutral colors
|
|
157
|
+
const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
...neutralColors,
|
|
161
|
+
// Mask and white
|
|
162
|
+
colorBgMask: 'rgba(0, 0, 0, 0.45)',
|
|
163
|
+
colorWhite: '#fff'
|
|
164
|
+
} as ColorMapToken;
|
|
165
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CommonMapToken } from 'antd/es/theme/interface';
|
|
2
|
+
import type { SeedToken } from 'antd/es/theme/internal';
|
|
3
|
+
import type { RadiusMapToken } from './genRadiusMapToken';
|
|
4
|
+
import { genRadiusMapToken } from './genRadiusMapToken';
|
|
5
|
+
|
|
6
|
+
export type SkyrocCommonMapToken = CommonMapToken & RadiusMapToken;
|
|
7
|
+
|
|
8
|
+
export default function genCommonMapToken(token: SeedToken): SkyrocCommonMapToken {
|
|
9
|
+
const { borderRadius, lineWidth, motionBase, motionUnit } = token;
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
// motion
|
|
13
|
+
motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
|
|
14
|
+
motionDurationMid: `${(motionBase + motionUnit * 2).toFixed(1)}s`,
|
|
15
|
+
motionDurationSlow: `${(motionBase + motionUnit * 3).toFixed(1)}s`,
|
|
16
|
+
|
|
17
|
+
// line
|
|
18
|
+
lineWidthBold: lineWidth + 1,
|
|
19
|
+
|
|
20
|
+
// radius
|
|
21
|
+
...genRadiusMapToken(borderRadius)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HeightMapToken } from 'antd/es/theme/interface';
|
|
2
|
+
import type { SeedToken } from 'antd/es/theme/internal';
|
|
3
|
+
|
|
4
|
+
const genControlHeight = (token: SeedToken): HeightMapToken => {
|
|
5
|
+
const { controlHeight } = token;
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
controlHeightSM: controlHeight * 0.75,
|
|
9
|
+
controlHeightXS: controlHeight * 0.5,
|
|
10
|
+
controlHeightLG: controlHeight * 1.25
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default genControlHeight;
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import type { FontMapToken } from 'antd/lib/theme/interface';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Font size configuration
|
|
5
|
+
*
|
|
6
|
+
* Based on UnoCSS text rules, using rem units Conversion: 1rem = 16px (browser default)
|
|
7
|
+
*
|
|
8
|
+
* | Name | rem | px | lineHeight rem | lineHeight px |
|
|
9
|
+
* | ---- | ----- | --- | -------------- | ------------- |
|
|
10
|
+
* | xs | 0.75 | 12 | 1.125 | 18 |
|
|
11
|
+
* | sm | 0.875 | 14 | 1.375 | 22 |
|
|
12
|
+
* | base | 1 | 16 | 1.5 | 24 |
|
|
13
|
+
* | lg | 1.125 | 18 | 1.625 | 26 |
|
|
14
|
+
* | xl | 1.25 | 20 | 1.75 | 28 |
|
|
15
|
+
* | 2xl | 1.5 | 24 | 2 | 32 |
|
|
16
|
+
* | 3xl | 1.875 | 30 | 2.375 | 38 |
|
|
17
|
+
* | 4xl | 2.25 | 36 | 2.75 | 44 |
|
|
18
|
+
* | 5xl | 3 | 48 | 3.5 | 56 |
|
|
19
|
+
* | 6xl | 3.75 | 60 | 4.25 | 68 |
|
|
20
|
+
* | 7xl | 4.5 | 72 | 5 | 80 |
|
|
21
|
+
* | 8xl | 6 | 96 | 6.5 | 104 |
|
|
22
|
+
* | 9xl | 8 | 128 | 8.5 | 136 |
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** Font size table (rem) */
|
|
26
|
+
export const FONT_SIZES = {
|
|
27
|
+
xs: 0.75, // 12px
|
|
28
|
+
sm: 0.875, // 14px
|
|
29
|
+
base: 1, // 16px
|
|
30
|
+
lg: 1.125, // 18px
|
|
31
|
+
xl: 1.25, // 20px
|
|
32
|
+
'2xl': 1.5, // 24px
|
|
33
|
+
'3xl': 1.875, // 30px
|
|
34
|
+
'4xl': 2.25, // 36px
|
|
35
|
+
'5xl': 3, // 48px
|
|
36
|
+
'6xl': 3.75, // 60px
|
|
37
|
+
'7xl': 4.5, // 72px
|
|
38
|
+
'8xl': 6, // 96px
|
|
39
|
+
'9xl': 8 // 128px
|
|
40
|
+
} as const;
|
|
41
|
+
|
|
42
|
+
/** Line height table (rem) */
|
|
43
|
+
export const LINE_HEIGHTS = {
|
|
44
|
+
xs: 1.125, // 18px
|
|
45
|
+
sm: 1.375, // 22px
|
|
46
|
+
base: 1.5, // 24px
|
|
47
|
+
lg: 1.625, // 26px
|
|
48
|
+
xl: 1.75, // 28px
|
|
49
|
+
'2xl': 2, // 32px
|
|
50
|
+
'3xl': 2.375, // 38px
|
|
51
|
+
'4xl': 2.75, // 44px
|
|
52
|
+
'5xl': 3.5, // 56px
|
|
53
|
+
'6xl': 4.25, // 68px
|
|
54
|
+
'7xl': 5, // 80px
|
|
55
|
+
'8xl': 6.5, // 104px
|
|
56
|
+
'9xl': 8.5 // 136px
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
export type FontSizeKey = keyof typeof FONT_SIZES;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Convert rem to px
|
|
63
|
+
*
|
|
64
|
+
* @param rem Rem value
|
|
65
|
+
* @param baseFontSize Base font size (default 16)
|
|
66
|
+
*/
|
|
67
|
+
export function remToPx(rem: number, baseFontSize = 16): number {
|
|
68
|
+
return Math.round(rem * baseFontSize);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Calculate line height ratio
|
|
73
|
+
*
|
|
74
|
+
* @param fontSize Font size (rem)
|
|
75
|
+
* @param lineHeight Line height (rem)
|
|
76
|
+
*/
|
|
77
|
+
export function getLineHeightRatio(fontSize: number, lineHeight: number): number {
|
|
78
|
+
return Number((lineHeight / fontSize).toFixed(3));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface FontSizePair {
|
|
82
|
+
lineHeight: number;
|
|
83
|
+
lineHeightRatio: number;
|
|
84
|
+
size: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Extended font map token with custom text sizes */
|
|
88
|
+
export interface ExtendedFontMapToken extends FontMapToken {
|
|
89
|
+
/** Base font height (px) */
|
|
90
|
+
fontHeight: number;
|
|
91
|
+
/** Large font height (px) */
|
|
92
|
+
fontHeightLG: number;
|
|
93
|
+
/** Small font height (px) */
|
|
94
|
+
fontHeightSM: number;
|
|
95
|
+
|
|
96
|
+
/** Heading level 1 font size generated in px */
|
|
97
|
+
fontSizeHeading1: number;
|
|
98
|
+
/** Heading level 2 font size generated in px */
|
|
99
|
+
fontSizeHeading2: number;
|
|
100
|
+
/** Heading level 3 font size generated in px */
|
|
101
|
+
fontSizeHeading3: number;
|
|
102
|
+
/** Heading level 4 font size generated in px */
|
|
103
|
+
fontSizeHeading4: number;
|
|
104
|
+
/** Heading level 5 font size generated in px */
|
|
105
|
+
fontSizeHeading5: number;
|
|
106
|
+
|
|
107
|
+
/** 2x large line height (px) */
|
|
108
|
+
LineHeight2xl: number;
|
|
109
|
+
/** 3x large line height (px) */
|
|
110
|
+
LineHeight3xl: number;
|
|
111
|
+
/** 4x large line height (px) */
|
|
112
|
+
LineHeight4xl: number;
|
|
113
|
+
/** 5x large line height (px) */
|
|
114
|
+
LineHeight5xl: number;
|
|
115
|
+
/** 6x large line height (px) */
|
|
116
|
+
LineHeight6xl: number;
|
|
117
|
+
/** 7x large line height (px) */
|
|
118
|
+
LineHeight7xl: number;
|
|
119
|
+
/** 8x large line height (px) */
|
|
120
|
+
LineHeight8xl: number;
|
|
121
|
+
/** 9x large line height (px) */
|
|
122
|
+
LineHeight9xl: number;
|
|
123
|
+
/** Base line height (px) */
|
|
124
|
+
LineHeightBase: number;
|
|
125
|
+
/** Large line height (px) */
|
|
126
|
+
LineHeightLg: number;
|
|
127
|
+
/** Small line height (px) */
|
|
128
|
+
LineHeightSm: number;
|
|
129
|
+
/** Extra large line height (px) */
|
|
130
|
+
LineHeightXl: number;
|
|
131
|
+
/** Extra small line height (px) */
|
|
132
|
+
LineHeightXs: number;
|
|
133
|
+
|
|
134
|
+
/** 2x large text size (24px) */
|
|
135
|
+
Text2xl: number;
|
|
136
|
+
/** 3x large text size (30px) */
|
|
137
|
+
Text3xl: number;
|
|
138
|
+
/** 4x large text size (36px) */
|
|
139
|
+
Text4xl: number;
|
|
140
|
+
/** 5x large text size (48px) */
|
|
141
|
+
Text5xl: number;
|
|
142
|
+
/** 6x large text size (60px) */
|
|
143
|
+
Text6xl: number;
|
|
144
|
+
/** 7x large text size (72px) */
|
|
145
|
+
Text7xl: number;
|
|
146
|
+
/** 8x large text size (96px) */
|
|
147
|
+
Text8xl: number;
|
|
148
|
+
/** 9x large text size (128px) */
|
|
149
|
+
Text9xl: number;
|
|
150
|
+
/** Base text size (16px) */
|
|
151
|
+
TextBase: number;
|
|
152
|
+
/** Large text size (18px) */
|
|
153
|
+
TextLg: number;
|
|
154
|
+
/** Small text size (14px) */
|
|
155
|
+
TextSm: number;
|
|
156
|
+
/** Extra large text size (20px) */
|
|
157
|
+
TextXl: number;
|
|
158
|
+
/** Extra small text size (12px) */
|
|
159
|
+
TextXs: number;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Generate font size pairs
|
|
164
|
+
*
|
|
165
|
+
* @param baseFontSize Base font size (px), default 16
|
|
166
|
+
*/
|
|
167
|
+
export function genFontSizes(baseFontSize = 16): FontSizePair[] {
|
|
168
|
+
const keys: FontSizeKey[] = ['xs', 'sm', 'base', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl', '8xl', '9xl'];
|
|
169
|
+
|
|
170
|
+
return keys.map(key => {
|
|
171
|
+
const fontSizeRem = FONT_SIZES[key];
|
|
172
|
+
const lineHeightRem = LINE_HEIGHTS[key];
|
|
173
|
+
const size = remToPx(fontSizeRem, baseFontSize);
|
|
174
|
+
const lineHeight = remToPx(lineHeightRem, baseFontSize);
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
lineHeight,
|
|
178
|
+
lineHeightRatio: getLineHeightRatio(fontSizeRem, lineHeightRem),
|
|
179
|
+
size
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Generate font map token
|
|
186
|
+
*
|
|
187
|
+
* Based on UnoCSS font rules, generate Ant Design style font tokens
|
|
188
|
+
*
|
|
189
|
+
* Mapping: - fontSizeSM: sm (14px) - fontSize: base (16px) - fontSizeLG: lg (18px) - fontSizeXL: xl (20px) -
|
|
190
|
+
* fontSizeHeading5: xl (20px) - fontSizeHeading4: 2xl (24px) - fontSizeHeading3: 3xl (30px) - fontSizeHeading2: 4xl
|
|
191
|
+
* (36px) - fontSizeHeading1: 5xl (48px)
|
|
192
|
+
*
|
|
193
|
+
* @param baseFontSize Base font size (px), default 16
|
|
194
|
+
*/
|
|
195
|
+
export function genFontMapToken(baseFontSize = 16): ExtendedFontMapToken {
|
|
196
|
+
const fontSizePairs = genFontSizes(baseFontSize);
|
|
197
|
+
|
|
198
|
+
// Index mapping: xs=0, sm=1, base=2, lg=3, xl=4, 2xl=5, 3xl=6, 4xl=7, 5xl=8
|
|
199
|
+
const fontSizes = fontSizePairs.map(pair => pair.size);
|
|
200
|
+
const lineHeights = fontSizePairs.map(pair => pair.lineHeightRatio);
|
|
201
|
+
const lineHeightsPx = fontSizePairs.map(pair => pair.lineHeight);
|
|
202
|
+
|
|
203
|
+
// SM = sm (index 1)
|
|
204
|
+
const fontSizeSM = fontSizes[1];
|
|
205
|
+
const lineHeightSM = lineHeights[1];
|
|
206
|
+
|
|
207
|
+
// MD = base (index 2)
|
|
208
|
+
const fontSizeMD = fontSizes[2];
|
|
209
|
+
const lineHeightMD = lineHeights[2];
|
|
210
|
+
|
|
211
|
+
// LG = lg (index 3)
|
|
212
|
+
const fontSizeLG = fontSizes[3];
|
|
213
|
+
const lineHeightLG = lineHeights[3];
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
// Base font sizes
|
|
217
|
+
fontSize: fontSizeMD,
|
|
218
|
+
fontSizeLG,
|
|
219
|
+
fontSizeSM,
|
|
220
|
+
fontSizeXL: fontSizes[4], // xl (20px)
|
|
221
|
+
TextXs: fontSizes[0],
|
|
222
|
+
TextSm: fontSizes[1],
|
|
223
|
+
TextBase: fontSizes[2],
|
|
224
|
+
TextLg: fontSizes[3],
|
|
225
|
+
TextXl: fontSizes[4],
|
|
226
|
+
Text2xl: fontSizes[5],
|
|
227
|
+
Text3xl: fontSizes[6],
|
|
228
|
+
Text4xl: fontSizes[7],
|
|
229
|
+
Text5xl: fontSizes[8],
|
|
230
|
+
Text6xl: fontSizes[9],
|
|
231
|
+
Text7xl: fontSizes[10],
|
|
232
|
+
Text8xl: fontSizes[11],
|
|
233
|
+
Text9xl: fontSizes[12],
|
|
234
|
+
LineHeightXs: lineHeightsPx[0],
|
|
235
|
+
LineHeightSm: lineHeightsPx[1],
|
|
236
|
+
LineHeightBase: lineHeightsPx[2],
|
|
237
|
+
LineHeightLg: lineHeightsPx[3],
|
|
238
|
+
LineHeightXl: lineHeightsPx[4],
|
|
239
|
+
LineHeight2xl: lineHeightsPx[5],
|
|
240
|
+
LineHeight3xl: lineHeightsPx[6],
|
|
241
|
+
LineHeight4xl: lineHeightsPx[7],
|
|
242
|
+
LineHeight5xl: lineHeightsPx[8],
|
|
243
|
+
LineHeight6xl: lineHeightsPx[9],
|
|
244
|
+
LineHeight7xl: lineHeightsPx[10],
|
|
245
|
+
LineHeight8xl: lineHeightsPx[11],
|
|
246
|
+
LineHeight9xl: lineHeightsPx[12],
|
|
247
|
+
|
|
248
|
+
// Heading font sizes (large to small)
|
|
249
|
+
fontSizeHeading1: fontSizes[8], // 5xl (48px)
|
|
250
|
+
fontSizeHeading2: fontSizes[7], // 4xl (36px)
|
|
251
|
+
fontSizeHeading3: fontSizes[6], // 3xl (30px)
|
|
252
|
+
fontSizeHeading4: fontSizes[5], // 2xl (24px)
|
|
253
|
+
fontSizeHeading5: fontSizes[4], // xl (20px)
|
|
254
|
+
|
|
255
|
+
// Line height ratios
|
|
256
|
+
lineHeight: lineHeightMD,
|
|
257
|
+
lineHeightLG,
|
|
258
|
+
lineHeightSM,
|
|
259
|
+
|
|
260
|
+
// Line heights (px)
|
|
261
|
+
fontHeight: Math.round(lineHeightMD * fontSizeMD),
|
|
262
|
+
fontHeightLG: Math.round(lineHeightLG * fontSizeLG),
|
|
263
|
+
fontHeightSM: Math.round(lineHeightSM * fontSizeSM),
|
|
264
|
+
|
|
265
|
+
// Heading line heights
|
|
266
|
+
lineHeightHeading1: lineHeights[8], // 5xl
|
|
267
|
+
lineHeightHeading2: lineHeights[7], // 4xl
|
|
268
|
+
lineHeightHeading3: lineHeights[6], // 3xl
|
|
269
|
+
lineHeightHeading4: lineHeights[5], // 2xl
|
|
270
|
+
lineHeightHeading5: lineHeights[4] // xl
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export default genFontMapToken;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { MapToken } from 'antd/lib/theme/interface';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Radius configuration
|
|
5
|
+
*
|
|
6
|
+
* Based on UnoCSS radius rules, using base radius value Default borderRadius = 6px
|
|
7
|
+
*
|
|
8
|
+
* | Name | Calculation | px (radius=6) |
|
|
9
|
+
* | ---- | ------------- | ------------- |
|
|
10
|
+
* | none | 0 | 0 |
|
|
11
|
+
* | xs | radius / 3 | 2 |
|
|
12
|
+
* | sm | radius * 2/3 | 4 |
|
|
13
|
+
* | md | radius | 6 (default) |
|
|
14
|
+
* | lg | radius * 4/3 | 8 |
|
|
15
|
+
* | xl | radius * 2 | 12 |
|
|
16
|
+
* | 2xl | radius * 8/3 | 16 |
|
|
17
|
+
* | 3xl | radius * 4 | 24 |
|
|
18
|
+
* | 4xl | radius * 16/3 | 32 |
|
|
19
|
+
* | full | 9999 | 9999 |
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** Radius multipliers (based on borderRadius) */
|
|
23
|
+
export const RADIUS_MULTIPLIERS = {
|
|
24
|
+
none: 0,
|
|
25
|
+
xs: 1 / 3, // 2px (radius / 3)
|
|
26
|
+
sm: 2 / 3, // 4px (radius * 2/3)
|
|
27
|
+
md: 1, // 6px (radius) - default
|
|
28
|
+
lg: 4 / 3, // 8px (radius * 4/3)
|
|
29
|
+
xl: 2, // 12px (radius * 2)
|
|
30
|
+
'2xl': 8 / 3, // 16px (radius * 8/3)
|
|
31
|
+
'3xl': 4, // 24px (radius * 4)
|
|
32
|
+
'4xl': 16 / 3, // 32px (radius * 16/3)
|
|
33
|
+
full: -1 // Special value for 9999px
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
export type RadiusSizeKey = keyof typeof RADIUS_MULTIPLIERS;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Calculate radius size
|
|
40
|
+
*
|
|
41
|
+
* @param multiplier Multiplier
|
|
42
|
+
* @param borderRadius Base radius (default 6)
|
|
43
|
+
*/
|
|
44
|
+
export function calcRadius(multiplier: number, borderRadius = 6): number {
|
|
45
|
+
if (multiplier < 0) return 9999; // full
|
|
46
|
+
return Math.round(borderRadius * multiplier);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Radius token type */
|
|
50
|
+
export type RadiusMapToken = Pick<
|
|
51
|
+
MapToken,
|
|
52
|
+
'borderRadius' | 'borderRadiusLG' | 'borderRadiusOuter' | 'borderRadiusSM' | 'borderRadiusXS'
|
|
53
|
+
>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Generate radius map token
|
|
57
|
+
*
|
|
58
|
+
* Based on base radius value, generate Ant Design style radius tokens
|
|
59
|
+
*
|
|
60
|
+
* Mapping (borderRadius = 6): - borderRadiusXS: xs (2px) = radius / 3 - borderRadiusSM: sm (4px) = radius * 2/3 -
|
|
61
|
+
* borderRadius: md (6px) = radius - borderRadiusLG: lg (8px) = radius * 4/3 - borderRadiusOuter: sm (4px) = radius *
|
|
62
|
+
* 2/3
|
|
63
|
+
*
|
|
64
|
+
* @param borderRadius Base radius value (px), default 6
|
|
65
|
+
*/
|
|
66
|
+
export function genRadiusMapToken(borderRadius = 6): RadiusMapToken {
|
|
67
|
+
return {
|
|
68
|
+
borderRadiusXS: calcRadius(RADIUS_MULTIPLIERS.xs, borderRadius), // 2px
|
|
69
|
+
borderRadiusSM: calcRadius(RADIUS_MULTIPLIERS.sm, borderRadius), // 4px
|
|
70
|
+
borderRadius, // 6px
|
|
71
|
+
borderRadiusLG: calcRadius(RADIUS_MULTIPLIERS.lg, borderRadius), // 8px
|
|
72
|
+
borderRadiusOuter: calcRadius(RADIUS_MULTIPLIERS.sm, borderRadius) // 4px
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Extended radius token (includes more sizes) */
|
|
77
|
+
export interface ExtendedRadiusToken extends RadiusMapToken {
|
|
78
|
+
/** 2xl - 16px */
|
|
79
|
+
borderRadius2XL: number;
|
|
80
|
+
/** 3xl - 24px */
|
|
81
|
+
borderRadius3XL: number;
|
|
82
|
+
/** 4xl - 32px */
|
|
83
|
+
borderRadius4XL: number;
|
|
84
|
+
/** Full - 9999px */
|
|
85
|
+
borderRadiusFull: number;
|
|
86
|
+
/** Xl - 12px */
|
|
87
|
+
borderRadiusXL: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Generate extended radius token
|
|
92
|
+
*
|
|
93
|
+
* Includes complete UnoCSS radius series
|
|
94
|
+
*
|
|
95
|
+
* @param borderRadius Base radius value (px), default 6
|
|
96
|
+
*/
|
|
97
|
+
export function genExtendedRadiusToken(borderRadius = 6): ExtendedRadiusToken {
|
|
98
|
+
return {
|
|
99
|
+
...genRadiusMapToken(borderRadius),
|
|
100
|
+
borderRadiusXL: calcRadius(RADIUS_MULTIPLIERS.xl, borderRadius), // 12px
|
|
101
|
+
borderRadius2XL: calcRadius(RADIUS_MULTIPLIERS['2xl'], borderRadius), // 16px
|
|
102
|
+
borderRadius3XL: calcRadius(RADIUS_MULTIPLIERS['3xl'], borderRadius), // 24px
|
|
103
|
+
borderRadius4XL: calcRadius(RADIUS_MULTIPLIERS['4xl'], borderRadius), // 32px
|
|
104
|
+
borderRadiusFull: 9999 // 9999px
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Generate complete radius table
|
|
110
|
+
*
|
|
111
|
+
* @param borderRadius Base radius value (px), default 6
|
|
112
|
+
*/
|
|
113
|
+
export function genRadiusSizes(borderRadius = 6): Record<RadiusSizeKey, number> {
|
|
114
|
+
return Object.entries(RADIUS_MULTIPLIERS).reduce(
|
|
115
|
+
(acc, [key, multiplier]) => {
|
|
116
|
+
acc[key as RadiusSizeKey] = calcRadius(multiplier, borderRadius);
|
|
117
|
+
return acc;
|
|
118
|
+
},
|
|
119
|
+
{} as Record<RadiusSizeKey, number>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Generate radius CSS variables
|
|
125
|
+
*
|
|
126
|
+
* @param borderRadius Base radius value (px), default 6
|
|
127
|
+
*/
|
|
128
|
+
export function genRadiusVars(borderRadius = 6): Record<string, string> {
|
|
129
|
+
const result: Record<string, string> = {};
|
|
130
|
+
|
|
131
|
+
for (const [key, multiplier] of Object.entries(RADIUS_MULTIPLIERS)) {
|
|
132
|
+
const px = calcRadius(multiplier, borderRadius);
|
|
133
|
+
result[`radius-${key}`] = `${px}px`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default genRadiusMapToken;
|