@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,250 @@
|
|
|
1
|
+
import type { ArgsProps as MessageArgsProps, MessageInstance, TypeOpen } from 'antd/es/message/interface';
|
|
2
|
+
import type { ModalFunc } from 'antd/es/modal/confirm';
|
|
3
|
+
import type { HookAPI as ModalHookAPI } from 'antd/es/modal/useModal';
|
|
4
|
+
import type { ArgsProps, NotificationInstance } from 'antd/es/notification/interface';
|
|
5
|
+
|
|
6
|
+
/** 私有 UI 实例状态 —— 由 AntdProvider 内部的 ContextHolder 自动初始化 */
|
|
7
|
+
const _ui = {
|
|
8
|
+
message: null as MessageInstance | null,
|
|
9
|
+
modal: null as ModalHookAPI | null,
|
|
10
|
+
notification: null as NotificationInstance | null
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 初始化 Antd UI 组件实例(仅供 AntdProvider 内部使用)
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export function initAntdUI(message: MessageInstance, modal: ModalHookAPI, notification: NotificationInstance) {
|
|
19
|
+
_ui.message = message;
|
|
20
|
+
_ui.modal = modal;
|
|
21
|
+
_ui.notification = notification;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Internal getters
|
|
26
|
+
// ============================================================================
|
|
27
|
+
|
|
28
|
+
function getMessage(): MessageInstance {
|
|
29
|
+
if (!_ui.message) {
|
|
30
|
+
console.error('message is not initialized, please wrap your app with AntdProvider first');
|
|
31
|
+
throw new Error('message is not initialized');
|
|
32
|
+
}
|
|
33
|
+
return _ui.message;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getModal(): ModalHookAPI {
|
|
37
|
+
if (!_ui.modal) {
|
|
38
|
+
console.error('modal is not initialized, please wrap your app with AntdProvider first');
|
|
39
|
+
throw new Error('modal is not initialized');
|
|
40
|
+
}
|
|
41
|
+
return _ui.modal;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getNotification(): NotificationInstance {
|
|
45
|
+
if (!_ui.notification) {
|
|
46
|
+
console.error('notification is not initialized, please wrap your app with AntdProvider first');
|
|
47
|
+
throw new Error('notification is not initialized');
|
|
48
|
+
}
|
|
49
|
+
return _ui.notification;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// Notification
|
|
54
|
+
// ============================================================================
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 显示通知
|
|
58
|
+
*
|
|
59
|
+
* @param config - 通知配置
|
|
60
|
+
* @returns 通知实例
|
|
61
|
+
*/
|
|
62
|
+
export function showNotification(config: ArgsProps) {
|
|
63
|
+
return getNotification().open(config);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 销毁通知
|
|
68
|
+
*
|
|
69
|
+
* @param key - 通知的唯一标识,不传则销毁所有通知
|
|
70
|
+
*/
|
|
71
|
+
export function destroyNotification(key?: React.Key) {
|
|
72
|
+
return getNotification().destroy(key);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 显示成功通知
|
|
77
|
+
*
|
|
78
|
+
* @param config - 通知配置
|
|
79
|
+
* @returns 通知实例
|
|
80
|
+
*/
|
|
81
|
+
export function showSuccessNotification(config: ArgsProps) {
|
|
82
|
+
return getNotification().success(config);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 显示错误通知
|
|
87
|
+
*
|
|
88
|
+
* @param config - 通知配置
|
|
89
|
+
* @returns 通知实例
|
|
90
|
+
*/
|
|
91
|
+
export function showErrorNotification(config: ArgsProps) {
|
|
92
|
+
return getNotification().error(config);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 显示信息通知
|
|
97
|
+
*
|
|
98
|
+
* @param config - 通知配置
|
|
99
|
+
* @returns 通知实例
|
|
100
|
+
*/
|
|
101
|
+
export function showInfoNotification(config: ArgsProps) {
|
|
102
|
+
return getNotification().info(config);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 显示警告通知
|
|
107
|
+
*
|
|
108
|
+
* @param config - 通知配置
|
|
109
|
+
* @returns 通知实例
|
|
110
|
+
*/
|
|
111
|
+
export function showWarningNotification(config: ArgsProps) {
|
|
112
|
+
return getNotification().warning(config);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ============================================================================
|
|
116
|
+
// Message
|
|
117
|
+
// ============================================================================
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* 显示消息
|
|
121
|
+
*
|
|
122
|
+
* @param config - 消息配置
|
|
123
|
+
* @returns 消息实例
|
|
124
|
+
*/
|
|
125
|
+
export function showMessage(config: MessageArgsProps) {
|
|
126
|
+
return getMessage().open(config);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 销毁消息
|
|
131
|
+
*
|
|
132
|
+
* @param key - 消息的唯一标识,不传则销毁所有消息
|
|
133
|
+
*/
|
|
134
|
+
export function destroyMessage(key?: React.Key) {
|
|
135
|
+
return getMessage().destroy(key);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 显示成功消息
|
|
140
|
+
*
|
|
141
|
+
* @param args - 消息配置参数
|
|
142
|
+
* @returns 消息实例
|
|
143
|
+
*/
|
|
144
|
+
export const showSuccessMessage: TypeOpen = (...args) => {
|
|
145
|
+
return getMessage().success(...args);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 显示错误消息
|
|
150
|
+
*
|
|
151
|
+
* @param args - 消息配置参数
|
|
152
|
+
* @returns 消息实例
|
|
153
|
+
*/
|
|
154
|
+
export const showErrorMessage: TypeOpen = (...args) => {
|
|
155
|
+
return getMessage().error(...args);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* 显示信息消息
|
|
160
|
+
*
|
|
161
|
+
* @param args - 消息配置参数
|
|
162
|
+
* @returns 消息实例
|
|
163
|
+
*/
|
|
164
|
+
export const showInfoMessage: TypeOpen = (...args) => {
|
|
165
|
+
return getMessage().info(...args);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 显示警告消息
|
|
170
|
+
*
|
|
171
|
+
* @param args - 消息配置参数
|
|
172
|
+
* @returns 消息实例
|
|
173
|
+
*/
|
|
174
|
+
export const showWarningMessage: TypeOpen = (...args) => {
|
|
175
|
+
return getMessage().warning(...args);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 显示加载消息
|
|
180
|
+
*
|
|
181
|
+
* @param args - 消息配置参数
|
|
182
|
+
* @returns 消息实例
|
|
183
|
+
*/
|
|
184
|
+
export const showLoadingMessage: TypeOpen = (...args) => {
|
|
185
|
+
return getMessage().loading(...args);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// ============================================================================
|
|
189
|
+
// Modal
|
|
190
|
+
// ============================================================================
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 显示模态框
|
|
194
|
+
*
|
|
195
|
+
* @param args - 模态框配置参数
|
|
196
|
+
* @returns 模态框实例
|
|
197
|
+
*/
|
|
198
|
+
export const showModal: ModalFunc = (...args) => {
|
|
199
|
+
return getModal().confirm(...args);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 显示确认模态框
|
|
204
|
+
*
|
|
205
|
+
* @param args - 模态框配置参数
|
|
206
|
+
* @returns 模态框实例
|
|
207
|
+
*/
|
|
208
|
+
export const showConfirmModal: ModalFunc = (...args) => {
|
|
209
|
+
return getModal().confirm(...args);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* - 显示信息模态框
|
|
214
|
+
*
|
|
215
|
+
* @param args - 模态框配置参数
|
|
216
|
+
* @returns 模态框实例
|
|
217
|
+
*/
|
|
218
|
+
export const showInfoModal: ModalFunc = (...args) => {
|
|
219
|
+
return getModal().info(...args);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* 显示成功模态框
|
|
224
|
+
*
|
|
225
|
+
* @param args - 模态框配置参数
|
|
226
|
+
* @returns 模态框实例
|
|
227
|
+
*/
|
|
228
|
+
export const showSuccessModal: ModalFunc = (...args) => {
|
|
229
|
+
return getModal().success(...args);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* 显示错误模态框
|
|
234
|
+
*
|
|
235
|
+
* @param args - 模态框配置参数
|
|
236
|
+
* @returns 模态框实例
|
|
237
|
+
*/
|
|
238
|
+
export const showErrorModal: ModalFunc = (...args) => {
|
|
239
|
+
return getModal().error(...args);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 显示警告模态框
|
|
244
|
+
*
|
|
245
|
+
* @param args - 模态框配置参数
|
|
246
|
+
* @returns 模态框实例
|
|
247
|
+
*/
|
|
248
|
+
export const showWarningModal: ModalFunc = (...args) => {
|
|
249
|
+
return getModal().warning(...args);
|
|
250
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { adjustLightness, generateDarkModePalette, mixColor } from '@skyroc/color';
|
|
2
|
+
import type { ColorMap, GenerateColorMap, GenerateNeutralColorMap } from '../../types';
|
|
3
|
+
|
|
4
|
+
/** Dark mode default base colors */
|
|
5
|
+
export const DARK_BG_BASE = '#000';
|
|
6
|
+
export const DARK_TEXT_BASE = '#FFFFFF';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generate color palettes (dark mode)
|
|
10
|
+
*
|
|
11
|
+
* Uses generateDarkModePalette algorithm to replace antd's @ant-design/colors Reference Ant Design official dark
|
|
12
|
+
* algorithm, palette mapping needs special handling.
|
|
13
|
+
*
|
|
14
|
+
* 档位号语义与亮色一致——50 最亮、950 最暗。暗色主题需要深色背景,因此 antd 的 1-4 档取的是色板暗端(950-700),而不是靠翻转档位号来实现。
|
|
15
|
+
*
|
|
16
|
+
* Mapping strategy (reference antd dark theme): - 1-4: 取暗端 (950-700),用于背景与边框 - 5-7: 交叉映射中间亮区 (5→400, 6→500,
|
|
17
|
+
* 7→600),增强交互对比 - 8-10: 复用 5-7 (8→400, 9→500, 10→600),用于文字色
|
|
18
|
+
*/
|
|
19
|
+
export const generateColorPalettes: GenerateColorMap = (baseColor: string): ColorMap => {
|
|
20
|
+
const { palettes } = generateDarkModePalette(baseColor);
|
|
21
|
+
const [p50, p100, p200, p300, p400, p500, p600, p700, p800, p900, p950] = palettes;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
// antd 1-10 format (dark mode special mapping, reference antd official implementation)
|
|
25
|
+
1: p950.hex, // 950 - darkest background
|
|
26
|
+
2: p900.hex, // 900 - background hover
|
|
27
|
+
3: p800.hex, // 800 - border
|
|
28
|
+
4: p700.hex, // 700 - border hover
|
|
29
|
+
5: p400.hex, // 400 - hover color (dark mode needs brighter)
|
|
30
|
+
6: p500.hex, // 500 - main color
|
|
31
|
+
7: p600.hex, // 600 - active color
|
|
32
|
+
8: p400.hex, // 400 - text hover
|
|
33
|
+
9: p500.hex, // 500 - text color
|
|
34
|
+
10: p600.hex, // 600 - text active
|
|
35
|
+
// Tailwind 50-950 format (keep original mapping)
|
|
36
|
+
50: p50.hex,
|
|
37
|
+
100: p100.hex,
|
|
38
|
+
200: p200.hex,
|
|
39
|
+
300: p300.hex,
|
|
40
|
+
400: p400.hex,
|
|
41
|
+
500: p500.hex,
|
|
42
|
+
600: p600.hex,
|
|
43
|
+
700: p700.hex,
|
|
44
|
+
800: p800.hex,
|
|
45
|
+
900: p900.hex,
|
|
46
|
+
950: p950.hex
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generate neutral color palettes (dark mode)
|
|
52
|
+
*
|
|
53
|
+
* Reference Ant Design official dark theme implementation: - Uses solid color mixing algorithm (not transparency) -
|
|
54
|
+
* Background levels: Layout(base) → Container(+8) → Elevated(+12) - Text transparency: 85% / 65% / 45% / 25% - Fill
|
|
55
|
+
* transparency: 18% / 12% / 8% / 4% - Border uses fixed lightness increase (26 / 19)
|
|
56
|
+
*
|
|
57
|
+
* Base colors: - colorBgBase: #141414 (Ant Design dark background) - colorTextBase: #FFFFFF (pure white)
|
|
58
|
+
*/
|
|
59
|
+
export const generateNeutralColorPalettes: GenerateNeutralColorMap = (bgBaseColor: string, textBaseColor: string) => {
|
|
60
|
+
const colorBgBase = bgBaseColor || DARK_BG_BASE;
|
|
61
|
+
const colorTextBase = textBaseColor || DARK_TEXT_BASE;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
colorBgBase,
|
|
65
|
+
colorTextBase,
|
|
66
|
+
|
|
67
|
+
/** Text color levels Reference antd: Uses mixing algorithm to simulate transparency effect 85% / 65% / 45% / 25% */
|
|
68
|
+
colorText: mixColor(colorBgBase, colorTextBase, 0.85), // Primary text
|
|
69
|
+
colorTextSecondary: mixColor(colorBgBase, colorTextBase, 0.65), // Secondary text
|
|
70
|
+
colorTextTertiary: mixColor(colorBgBase, colorTextBase, 0.45), // Placeholder, disabled
|
|
71
|
+
colorTextQuaternary: mixColor(colorBgBase, colorTextBase, 0.25), // Very weak text
|
|
72
|
+
|
|
73
|
+
/** Fill color levels Reference antd: 18% / 12% / 8% / 4% For button hover, selected background, etc. */
|
|
74
|
+
colorFill: mixColor(colorBgBase, colorTextBase, 0.18), // Primary fill
|
|
75
|
+
colorFillSecondary: mixColor(colorBgBase, colorTextBase, 0.12), // Secondary fill
|
|
76
|
+
colorFillTertiary: mixColor(colorBgBase, colorTextBase, 0.08), // Divider background
|
|
77
|
+
colorFillQuaternary: mixColor(colorBgBase, colorTextBase, 0.04), // Weak fill
|
|
78
|
+
|
|
79
|
+
/** Solid background Reference antd: 95% / 100% / 90% For dark buttons, badges, etc. */
|
|
80
|
+
colorBgSolid: mixColor(colorBgBase, colorTextBase, 0.95), // Solid background
|
|
81
|
+
colorBgSolidHover: colorTextBase, // Solid hover (pure white)
|
|
82
|
+
colorBgSolidActive: mixColor(colorBgBase, colorTextBase, 0.9), // Solid active
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Background levels Reference antd: Layout(0) → Container(8) → Elevated(12) Dark mode floating layers need to be
|
|
86
|
+
* brighter to show hierarchy
|
|
87
|
+
*/
|
|
88
|
+
colorBgLayout: colorBgBase, // Page background (base color)
|
|
89
|
+
colorBgContainer: adjustLightness(colorBgBase, 8), // Card, container background (+8)
|
|
90
|
+
colorBgElevated: adjustLightness(colorBgBase, 12), // Popup, dropdown (+12)
|
|
91
|
+
colorBgSpotlight: adjustLightness(colorBgBase, 26), // Spotlight focus (+26)
|
|
92
|
+
colorBgBlur: mixColor(colorBgBase, colorTextBase, 0.04), // Blur background (4%)
|
|
93
|
+
|
|
94
|
+
/** Border colors Reference antd: Fixed lightness increase 26 / 26 / 19 */
|
|
95
|
+
colorBorder: adjustLightness(colorBgBase, 26), // Primary border
|
|
96
|
+
colorBorderDisabled: adjustLightness(colorBgBase, 26), // Disabled border (same as primary)
|
|
97
|
+
colorBorderSecondary: adjustLightness(colorBgBase, 19) // Secondary border, divider
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { mixColor } from '@skyroc/color';
|
|
2
|
+
import type { MapToken, PresetColorType, SeedToken } from 'antd/lib/theme/interface';
|
|
3
|
+
import { defaultPresetColors } from '../../seed';
|
|
4
|
+
import genColorMapToken, {
|
|
5
|
+
FUNCTIONAL_SEMANTIC_CONFIG,
|
|
6
|
+
genPaletteVars,
|
|
7
|
+
genSemanticColors
|
|
8
|
+
} from '../../shared/genColorMapToken';
|
|
9
|
+
import defaultAlgorithm from '../default';
|
|
10
|
+
import { generateColorPalettes, generateNeutralColorPalettes } from './colors';
|
|
11
|
+
|
|
12
|
+
// Export generator functions for external use
|
|
13
|
+
export { generateColorPalettes, generateNeutralColorPalettes };
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Dark mode theme algorithm
|
|
17
|
+
*
|
|
18
|
+
* Reference Ant Design official dark theme implementation: 1. Uses generateDarkModePalette algorithm to generate
|
|
19
|
+
* palettes (replaces @ant-design/colors) 2. Special color mapping strategy (1-4→950-700, 5→400, 6→500, 7→600) 3.
|
|
20
|
+
* Custom colorPrimaryBg to optimize selected item background
|
|
21
|
+
*
|
|
22
|
+
* Generated content: - Preset colors (blue, geekblue, etc.): palette vars only (blue-1 ... blue-10, blue-50 ...
|
|
23
|
+
* blue-950) - Functional colors (colorPrimary, colorInfo, etc.): palette vars + semantic colors (colorPrimaryBg,
|
|
24
|
+
* colorPrimaryHover, ...) - Neutral color system: colorText, colorBgContainer, colorBorder, etc.
|
|
25
|
+
*/
|
|
26
|
+
export default function derivativeDark(token: SeedToken, mapToken?: MapToken): MapToken {
|
|
27
|
+
const colorPalettes = Object.keys(defaultPresetColors)
|
|
28
|
+
.map(colorKey => {
|
|
29
|
+
const baseColor = token[colorKey as keyof PresetColorType];
|
|
30
|
+
|
|
31
|
+
if (!baseColor) return {};
|
|
32
|
+
|
|
33
|
+
const colors = generateColorPalettes(baseColor);
|
|
34
|
+
const isFunctionalColor = colorKey.startsWith('color');
|
|
35
|
+
|
|
36
|
+
// Preset colors: palette vars only, no semantic colors
|
|
37
|
+
if (!isFunctionalColor) {
|
|
38
|
+
return genPaletteVars(colorKey, colors);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Functional colors: palette vars + semantic colors
|
|
42
|
+
const result = genPaletteVars(colorKey, colors);
|
|
43
|
+
|
|
44
|
+
const capitalizedKey = colorKey.charAt(0).toUpperCase() + colorKey.slice(1);
|
|
45
|
+
const semanticColors = genSemanticColors({
|
|
46
|
+
colors,
|
|
47
|
+
config: FUNCTIONAL_SEMANTIC_CONFIG,
|
|
48
|
+
name: capitalizedKey
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (colorKey === 'colorError') {
|
|
52
|
+
result.colorErrorBgActive = colors[3];
|
|
53
|
+
result.colorErrorBgFilledHover = mixColor(colors[1], colors[3], 0.5);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Object.assign(result, semanticColors);
|
|
57
|
+
|
|
58
|
+
return result;
|
|
59
|
+
})
|
|
60
|
+
.reduce<MapToken>((prev, cur) => {
|
|
61
|
+
return { ...prev, ...cur };
|
|
62
|
+
}, {} as MapToken);
|
|
63
|
+
|
|
64
|
+
// Generate neutral color mapping (background, text, border, etc.)
|
|
65
|
+
const colorMapToken = genColorMapToken(token, {
|
|
66
|
+
generateNeutralColorPalettes
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const mergedMapToken = mapToken ?? defaultAlgorithm(token);
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
...mergedMapToken,
|
|
73
|
+
...colorPalettes,
|
|
74
|
+
|
|
75
|
+
// Neutral color mapping
|
|
76
|
+
...colorMapToken,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Dark mode special customization Reference Ant Design official implementation:
|
|
80
|
+
* https://github.com/ant-design/ant-design/issues/30524#issuecomment-871961867
|
|
81
|
+
*
|
|
82
|
+
* Uses colorPrimaryBorder as selected item background for better visual feedback
|
|
83
|
+
*/
|
|
84
|
+
colorPrimaryBg: colorMapToken.colorPrimaryBorder,
|
|
85
|
+
colorPrimaryBgHover: colorMapToken.colorPrimaryBorderHover
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { adjustLightness, generateOklchPaletteAnchored, mixColor } from '@skyroc/color';
|
|
2
|
+
import type { ColorMap, GenerateColorMap, GenerateNeutralColorMap } from '../../types';
|
|
3
|
+
|
|
4
|
+
/** Light mode default base colors */
|
|
5
|
+
export const LIGHT_BG_BASE = '#FFFFFF';
|
|
6
|
+
export const LIGHT_TEXT_BASE = '#1F1F1F';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generate color palettes (light mode)
|
|
10
|
+
*
|
|
11
|
+
* Uses generateOklchPaletteAnchored algorithm instead of antd's @ant-design/colors Outputs 11 colors (50-950), mapped to
|
|
12
|
+
* antd's 1-10 indexes
|
|
13
|
+
*/
|
|
14
|
+
export const generateColorPalettes: GenerateColorMap = (baseColor: string): ColorMap => {
|
|
15
|
+
const { palettes } = generateOklchPaletteAnchored(baseColor);
|
|
16
|
+
const [p50, p100, p200, p300, p400, p500, p600, p700, p800, p900, p950] = palettes;
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
1: p50.hex, // 50 - lightest background
|
|
20
|
+
2: p100.hex, // 100 - background hover
|
|
21
|
+
3: p200.hex, // 200 - border
|
|
22
|
+
4: p300.hex, // 300 - border hover
|
|
23
|
+
5: p400.hex, // 400 - hover color
|
|
24
|
+
6: p500.hex, // 500 - main color
|
|
25
|
+
7: p600.hex, // 600 - active color
|
|
26
|
+
8: p700.hex, // 700 - text hover
|
|
27
|
+
9: p800.hex, // 800 - text color
|
|
28
|
+
10: p900.hex, // 900 - text active
|
|
29
|
+
50: p50.hex,
|
|
30
|
+
100: p100.hex,
|
|
31
|
+
200: p200.hex,
|
|
32
|
+
300: p300.hex,
|
|
33
|
+
400: p400.hex,
|
|
34
|
+
500: p500.hex,
|
|
35
|
+
600: p600.hex,
|
|
36
|
+
700: p700.hex,
|
|
37
|
+
800: p800.hex,
|
|
38
|
+
900: p900.hex,
|
|
39
|
+
950: p950.hex
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Generate neutral color palettes (light mode)
|
|
45
|
+
*
|
|
46
|
+
* Uses solid color mixing algorithm instead of transparency Advantages: - Stable and predictable colors, not affected
|
|
47
|
+
* by background - Precise contrast control - Consistent with theme palette algorithm
|
|
48
|
+
*
|
|
49
|
+
* Base colors: - colorBgBase: #FAFAFA (soft white) - colorTextBase: #1F1F1F (dark gray)
|
|
50
|
+
*/
|
|
51
|
+
export const generateNeutralColorPalettes: GenerateNeutralColorMap = (bgBaseColor: string, textBaseColor: string) => {
|
|
52
|
+
const colorBgBase = bgBaseColor || LIGHT_BG_BASE;
|
|
53
|
+
const colorTextBase = textBaseColor || LIGHT_TEXT_BASE;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
colorBgBase,
|
|
57
|
+
colorTextBase,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Text color levels Uses bgBase and textBase mixing to generate solid colors Higher ratio = closer to textBase
|
|
61
|
+
* (darker)
|
|
62
|
+
*/
|
|
63
|
+
colorText: mixColor(colorBgBase, colorTextBase, 0.88), // Primary text
|
|
64
|
+
colorTextSecondary: mixColor(colorBgBase, colorTextBase, 0.65), // Secondary text
|
|
65
|
+
colorTextTertiary: mixColor(colorBgBase, colorTextBase, 0.45), // Placeholder, disabled
|
|
66
|
+
colorTextQuaternary: mixColor(colorBgBase, colorTextBase, 0.25), // Very weak text
|
|
67
|
+
|
|
68
|
+
/** Fill color levels For button hover, selected background, etc. */
|
|
69
|
+
colorFill: mixColor(colorBgBase, colorTextBase, 0.12), // Primary fill
|
|
70
|
+
colorFillSecondary: mixColor(colorBgBase, colorTextBase, 0.06), // Secondary fill
|
|
71
|
+
colorFillTertiary: mixColor(colorBgBase, colorTextBase, 0.04), // Divider background
|
|
72
|
+
colorFillQuaternary: mixColor(colorBgBase, colorTextBase, 0.02), // Weak fill
|
|
73
|
+
|
|
74
|
+
/** Solid background For dark buttons, badges, etc. */
|
|
75
|
+
colorBgSolid: colorTextBase, // Solid background
|
|
76
|
+
colorBgSolidHover: mixColor(colorTextBase, colorBgBase, 0.15), // Solid hover (lighter)
|
|
77
|
+
colorBgSolidActive: mixColor(colorTextBase, '#000000', 0.1), // Solid active (darker)
|
|
78
|
+
|
|
79
|
+
/** Background levels Layout(dark) → Container → Elevated(light) */
|
|
80
|
+
colorBgLayout: adjustLightness(colorBgBase, -3), // Page background (darker)
|
|
81
|
+
colorBgContainer: colorBgBase, // Card, container background
|
|
82
|
+
colorBgElevated: adjustLightness(colorBgBase, 2), // Popup, dropdown (lighter)
|
|
83
|
+
colorBgSpotlight: mixColor(colorBgBase, colorTextBase, 0.85), // Spotlight focus
|
|
84
|
+
colorBgBlur: 'transparent', // Blur background
|
|
85
|
+
|
|
86
|
+
/** Border colors */
|
|
87
|
+
colorBorder: mixColor(colorBgBase, colorTextBase, 0.15), // Primary border
|
|
88
|
+
colorBorderDisabled: mixColor(colorBgBase, colorTextBase, 0.1), // Disabled border
|
|
89
|
+
colorBorderSecondary: mixColor(colorBgBase, colorTextBase, 0.06) // Secondary border, divider
|
|
90
|
+
};
|
|
91
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { mixColor } from '@skyroc/color';
|
|
2
|
+
import type { MapToken, PresetColorType, SeedToken } from 'antd/lib/theme/interface';
|
|
3
|
+
import { defaultPresetColors } from '../../seed';
|
|
4
|
+
import genColorMapToken, {
|
|
5
|
+
FUNCTIONAL_SEMANTIC_CONFIG,
|
|
6
|
+
genPaletteVars,
|
|
7
|
+
genSemanticColors
|
|
8
|
+
} from '../../shared/genColorMapToken';
|
|
9
|
+
import genCommonMapToken from '../../shared/genCommonMapToken';
|
|
10
|
+
import genControlHeight from '../../shared/genControlHeight';
|
|
11
|
+
import { genFontMapToken } from '../../shared/genFontMapToken';
|
|
12
|
+
import { genSizeMapToken } from '../../shared/genSizeMapToken';
|
|
13
|
+
import { generateColorPalettes, generateNeutralColorPalettes } from './colors';
|
|
14
|
+
|
|
15
|
+
// Export generator functions for external use
|
|
16
|
+
export { generateColorPalettes, generateNeutralColorPalettes };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Light mode theme algorithm
|
|
20
|
+
*
|
|
21
|
+
* Uses generateOklchPaletteAnchored algorithm to replace antd's default @ant-design/colors Generates more modern
|
|
22
|
+
* design-compliant palettes
|
|
23
|
+
*
|
|
24
|
+
* Generated content: - Preset colors (blue, geekblue, etc.): palette vars only (blue-1 ... blue-10, blue-50 ...
|
|
25
|
+
* blue-950) - Functional colors (colorPrimary, colorInfo, etc.): palette vars + semantic colors (colorPrimaryBg,
|
|
26
|
+
* colorPrimaryHover, ...)
|
|
27
|
+
*/
|
|
28
|
+
export default function derivative(token: SeedToken): MapToken {
|
|
29
|
+
const colorPalettes = Object.keys(defaultPresetColors)
|
|
30
|
+
.map(colorKey => {
|
|
31
|
+
const baseColor = token[colorKey as keyof PresetColorType];
|
|
32
|
+
|
|
33
|
+
if (!baseColor) return {};
|
|
34
|
+
|
|
35
|
+
const colors = generateColorPalettes(baseColor);
|
|
36
|
+
const isFunctionalColor = colorKey.startsWith('color');
|
|
37
|
+
|
|
38
|
+
// Preset colors: palette vars only, no semantic colors
|
|
39
|
+
if (!isFunctionalColor) {
|
|
40
|
+
return genPaletteVars(colorKey, colors);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Functional colors: palette vars + semantic colors
|
|
44
|
+
const result = genPaletteVars(colorKey, colors);
|
|
45
|
+
|
|
46
|
+
const capitalizedKey = colorKey.charAt(0).toUpperCase() + colorKey.slice(1);
|
|
47
|
+
const semanticColors = genSemanticColors({
|
|
48
|
+
colors,
|
|
49
|
+
config: FUNCTIONAL_SEMANTIC_CONFIG,
|
|
50
|
+
name: capitalizedKey
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (colorKey === 'colorError') {
|
|
54
|
+
result.colorErrorBgActive = colors[3];
|
|
55
|
+
result.colorErrorBgFilledHover = mixColor(colors[1], colors[3], 0.5);
|
|
56
|
+
}
|
|
57
|
+
Object.assign(result, semanticColors);
|
|
58
|
+
|
|
59
|
+
return result;
|
|
60
|
+
})
|
|
61
|
+
.reduce<MapToken>((prev, cur) => {
|
|
62
|
+
return { ...prev, ...cur };
|
|
63
|
+
}, {} as MapToken);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
...token,
|
|
67
|
+
...colorPalettes,
|
|
68
|
+
...genFontMapToken(token.fontSize),
|
|
69
|
+
...genSizeMapToken(token.sizeUnit),
|
|
70
|
+
...genControlHeight(token),
|
|
71
|
+
...genCommonMapToken(token),
|
|
72
|
+
// Neutral color mapping (background, text, border, etc.)
|
|
73
|
+
...genColorMapToken(token, {
|
|
74
|
+
generateNeutralColorPalettes
|
|
75
|
+
})
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Dark theme algorithm
|
|
2
|
+
export { default as derivativeDark } from './algorithm/dark';
|
|
3
|
+
export {
|
|
4
|
+
DARK_BG_BASE,
|
|
5
|
+
DARK_TEXT_BASE,
|
|
6
|
+
generateColorPalettes as generateDarkColorPalettes,
|
|
7
|
+
generateNeutralColorPalettes as generateDarkNeutralColorPalettes
|
|
8
|
+
} from './algorithm/dark/colors';
|
|
9
|
+
|
|
10
|
+
// Default theme algorithm
|
|
11
|
+
export { default as derivative } from './algorithm/default';
|
|
12
|
+
export {
|
|
13
|
+
generateColorPalettes,
|
|
14
|
+
generateNeutralColorPalettes,
|
|
15
|
+
LIGHT_BG_BASE,
|
|
16
|
+
LIGHT_TEXT_BASE
|
|
17
|
+
} from './algorithm/default/colors';
|
|
18
|
+
|
|
19
|
+
// Seed tokens
|
|
20
|
+
export { defaultPresetColors, seedToken } from './seed';
|
|
21
|
+
|
|
22
|
+
// Color utilities (re-exported from @skyroc/color)
|
|
23
|
+
export { adjustLightness, darkenColor, lightenColor, mixColor } from './shared/colorAlgorithm';
|
|
24
|
+
|
|
25
|
+
// Color map token
|
|
26
|
+
export {
|
|
27
|
+
ANTD_INDEXES,
|
|
28
|
+
default as genColorMapToken,
|
|
29
|
+
FUNCTIONAL_SEMANTIC_CONFIG,
|
|
30
|
+
genPaletteVars,
|
|
31
|
+
genSemanticColors,
|
|
32
|
+
PRIMARY_SEMANTIC_CONFIG,
|
|
33
|
+
TAILWIND_INDEXES
|
|
34
|
+
} from './shared/genColorMapToken';
|
|
35
|
+
|
|
36
|
+
export type { SemanticColorConfig } from './shared/genColorMapToken';
|
|
37
|
+
|
|
38
|
+
// Common map token
|
|
39
|
+
export { default as genCommonMapToken } from './shared/genCommonMapToken';
|
|
40
|
+
|
|
41
|
+
// Control height
|
|
42
|
+
export { default as genControlHeight } from './shared/genControlHeight';
|
|
43
|
+
|
|
44
|
+
// Font map token
|
|
45
|
+
export {
|
|
46
|
+
default as genFontMapToken,
|
|
47
|
+
FONT_SIZES,
|
|
48
|
+
genFontSizes,
|
|
49
|
+
getLineHeightRatio,
|
|
50
|
+
LINE_HEIGHTS,
|
|
51
|
+
remToPx
|
|
52
|
+
} from './shared/genFontMapToken';
|
|
53
|
+
|
|
54
|
+
export type { FontSizeKey } from './shared/genFontMapToken';
|
|
55
|
+
|
|
56
|
+
// Radius map token
|
|
57
|
+
export {
|
|
58
|
+
calcRadius,
|
|
59
|
+
default as genRadiusMapToken,
|
|
60
|
+
genExtendedRadiusToken,
|
|
61
|
+
genRadiusSizes,
|
|
62
|
+
genRadiusVars,
|
|
63
|
+
RADIUS_MULTIPLIERS
|
|
64
|
+
} from './shared/genRadiusMapToken';
|
|
65
|
+
|
|
66
|
+
export type { ExtendedRadiusToken, RadiusMapToken, RadiusSizeKey } from './shared/genRadiusMapToken';
|
|
67
|
+
|
|
68
|
+
// Size map token
|
|
69
|
+
export {
|
|
70
|
+
calcSpacing,
|
|
71
|
+
default as genSizeMapToken,
|
|
72
|
+
genSpacingSizes,
|
|
73
|
+
genSpacingVars,
|
|
74
|
+
SPACING_MULTIPLIERS
|
|
75
|
+
} from './shared/genSizeMapToken';
|
|
76
|
+
|
|
77
|
+
export type { SpacingSizeKey } from './shared/genSizeMapToken';
|
|
78
|
+
|
|
79
|
+
// Types
|
|
80
|
+
export type * from './types';
|