@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,378 @@
|
|
|
1
|
+
/*
|
|
2
|
+
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
3
|
+
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
4
|
+
2. [UnoCSS]: allow to override the default border color with css var `--un-default-border-color`
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
*,
|
|
8
|
+
::before,
|
|
9
|
+
::after {
|
|
10
|
+
box-sizing: border-box; /* 1 */
|
|
11
|
+
border-width: 0; /* 2 */
|
|
12
|
+
border-style: solid; /* 2 */
|
|
13
|
+
border-color: var(--un-default-border-color, #e5e7eb); /* 2 */
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
1. Use a consistent sensible line-height in all browsers.
|
|
18
|
+
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
19
|
+
3. Use a more readable tab size.
|
|
20
|
+
4. Use the user's configured `sans` font-family by default.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
html {
|
|
24
|
+
line-height: 1.5; /* 1 */
|
|
25
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
|
26
|
+
-moz-tab-size: 4; /* 3 */
|
|
27
|
+
tab-size: 4; /* 3 */
|
|
28
|
+
font-family:
|
|
29
|
+
ui-sans-serif,
|
|
30
|
+
system-ui,
|
|
31
|
+
-apple-system,
|
|
32
|
+
BlinkMacSystemFont,
|
|
33
|
+
'Segoe UI',
|
|
34
|
+
Roboto,
|
|
35
|
+
'Helvetica Neue',
|
|
36
|
+
Arial,
|
|
37
|
+
'Noto Sans',
|
|
38
|
+
sans-serif,
|
|
39
|
+
'Apple Color Emoji',
|
|
40
|
+
'Segoe UI Emoji',
|
|
41
|
+
'Segoe UI Symbol',
|
|
42
|
+
'Noto Color Emoji'; /* 4 */
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
1. Remove the margin in all browsers.
|
|
47
|
+
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
body {
|
|
51
|
+
margin: 0; /* 1 */
|
|
52
|
+
line-height: inherit; /* 2 */
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
1. Add the correct height in Firefox.
|
|
57
|
+
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
|
58
|
+
3. Ensure horizontal rules are visible by default.
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
hr {
|
|
62
|
+
height: 0; /* 1 */
|
|
63
|
+
color: inherit; /* 2 */
|
|
64
|
+
border-top-width: 1px; /* 3 */
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
abbr:where([title]) {
|
|
72
|
+
text-decoration: underline dotted;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
Remove the default font size and weight for headings.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
h1,
|
|
80
|
+
h2,
|
|
81
|
+
h3,
|
|
82
|
+
h4,
|
|
83
|
+
h5,
|
|
84
|
+
h6 {
|
|
85
|
+
font-size: inherit;
|
|
86
|
+
font-weight: inherit;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
Reset links to optimize for opt-in styling instead of opt-out.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
a {
|
|
94
|
+
color: inherit;
|
|
95
|
+
text-decoration: inherit;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/*
|
|
99
|
+
Add the correct font weight in Edge and Safari.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
b,
|
|
103
|
+
strong {
|
|
104
|
+
font-weight: bolder;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
1. Use the user's configured `mono` font family by default.
|
|
109
|
+
2. Correct the odd `em` font sizing in all browsers.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
code,
|
|
113
|
+
kbd,
|
|
114
|
+
samp,
|
|
115
|
+
pre {
|
|
116
|
+
font-family:
|
|
117
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; /* 1 */
|
|
118
|
+
font-size: 1em; /* 2 */
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/*
|
|
122
|
+
Add the correct font size in all browsers.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
small {
|
|
126
|
+
font-size: 80%;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/*
|
|
130
|
+
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
sub,
|
|
134
|
+
sup {
|
|
135
|
+
font-size: 75%;
|
|
136
|
+
line-height: 0;
|
|
137
|
+
position: relative;
|
|
138
|
+
vertical-align: baseline;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
sub {
|
|
142
|
+
bottom: -0.25em;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
sup {
|
|
146
|
+
top: -0.5em;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
|
151
|
+
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
|
152
|
+
3. Remove gaps between table borders by default.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
table {
|
|
156
|
+
text-indent: 0; /* 1 */
|
|
157
|
+
border-color: inherit; /* 2 */
|
|
158
|
+
border-collapse: collapse; /* 3 */
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/*
|
|
162
|
+
1. Change the font styles in all browsers.
|
|
163
|
+
2. Remove the margin in Firefox and Safari.
|
|
164
|
+
3. Remove default padding in all browsers.
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
button,
|
|
168
|
+
input,
|
|
169
|
+
optgroup,
|
|
170
|
+
select,
|
|
171
|
+
textarea {
|
|
172
|
+
font-family: inherit; /* 1 */
|
|
173
|
+
font-feature-settings: inherit; /* 1 */
|
|
174
|
+
font-variation-settings: inherit; /* 1 */
|
|
175
|
+
font-size: 100%; /* 1 */
|
|
176
|
+
font-weight: inherit; /* 1 */
|
|
177
|
+
line-height: inherit; /* 1 */
|
|
178
|
+
color: inherit; /* 1 */
|
|
179
|
+
margin: 0; /* 2 */
|
|
180
|
+
padding: 0; /* 3 */
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
Remove the inheritance of text transform in Edge and Firefox.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
button,
|
|
188
|
+
select {
|
|
189
|
+
text-transform: none;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/*
|
|
193
|
+
1. Correct the inability to style clickable types in iOS and Safari.
|
|
194
|
+
2. Remove default button styles.
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
button,
|
|
198
|
+
[type='button'],
|
|
199
|
+
[type='reset'],
|
|
200
|
+
[type='submit'] {
|
|
201
|
+
-webkit-appearance: button; /* 1 */
|
|
202
|
+
/* background-color: transparent; */
|
|
203
|
+
background-image: none; /* 2 */
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/*
|
|
207
|
+
Use the modern Firefox focus style for all focusable elements.
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
:-moz-focusring {
|
|
211
|
+
outline: auto;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
|
|
216
|
+
*/
|
|
217
|
+
|
|
218
|
+
:-moz-ui-invalid {
|
|
219
|
+
box-shadow: none;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/*
|
|
223
|
+
Add the correct vertical alignment in Chrome and Firefox.
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
progress {
|
|
227
|
+
vertical-align: baseline;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/*
|
|
231
|
+
Correct the cursor style of increment and decrement buttons in Safari.
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
::-webkit-inner-spin-button,
|
|
235
|
+
::-webkit-outer-spin-button {
|
|
236
|
+
height: auto;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/*
|
|
240
|
+
1. Correct the odd appearance in Chrome and Safari.
|
|
241
|
+
2. Correct the outline style in Safari.
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
[type='search'] {
|
|
245
|
+
-webkit-appearance: textfield; /* 1 */
|
|
246
|
+
outline-offset: -2px; /* 2 */
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/*
|
|
250
|
+
Remove the inner padding in Chrome and Safari on macOS.
|
|
251
|
+
*/
|
|
252
|
+
|
|
253
|
+
::-webkit-search-decoration {
|
|
254
|
+
-webkit-appearance: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/*
|
|
258
|
+
1. Correct the inability to style clickable types in iOS and Safari.
|
|
259
|
+
2. Change font properties to `inherit` in Safari.
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
::-webkit-file-upload-button {
|
|
263
|
+
-webkit-appearance: button; /* 1 */
|
|
264
|
+
font: inherit; /* 2 */
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/*
|
|
268
|
+
Add the correct display in Chrome and Safari.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
summary {
|
|
272
|
+
display: list-item;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/*
|
|
276
|
+
Removes the default spacing and border for appropriate elements.
|
|
277
|
+
*/
|
|
278
|
+
|
|
279
|
+
blockquote,
|
|
280
|
+
dl,
|
|
281
|
+
dd,
|
|
282
|
+
h1,
|
|
283
|
+
h2,
|
|
284
|
+
h3,
|
|
285
|
+
h4,
|
|
286
|
+
h5,
|
|
287
|
+
h6,
|
|
288
|
+
hr,
|
|
289
|
+
figure,
|
|
290
|
+
p,
|
|
291
|
+
pre {
|
|
292
|
+
margin: 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
fieldset {
|
|
296
|
+
margin: 0;
|
|
297
|
+
padding: 0;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
legend {
|
|
301
|
+
padding: 0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
ol,
|
|
305
|
+
ul,
|
|
306
|
+
menu {
|
|
307
|
+
list-style: none;
|
|
308
|
+
margin: 0;
|
|
309
|
+
padding: 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/*
|
|
313
|
+
Prevent resizing textareas horizontally by default.
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
textarea {
|
|
317
|
+
resize: vertical;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/*
|
|
321
|
+
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
|
|
322
|
+
2. Set the default placeholder color to the user's configured gray 400 color.
|
|
323
|
+
*/
|
|
324
|
+
|
|
325
|
+
input::placeholder,
|
|
326
|
+
textarea::placeholder {
|
|
327
|
+
opacity: 1; /* 1 */
|
|
328
|
+
color: #9ca3af; /* 2 */
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/*
|
|
332
|
+
Set the default cursor for buttons.
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
button,
|
|
336
|
+
[role='button'] {
|
|
337
|
+
cursor: pointer;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/*
|
|
341
|
+
Make sure disabled buttons don't get the pointer cursor.
|
|
342
|
+
*/
|
|
343
|
+
:disabled {
|
|
344
|
+
cursor: default;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/*
|
|
348
|
+
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
349
|
+
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
|
350
|
+
This can trigger a poorly considered lint error in some tools but is included by design.
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
img,
|
|
354
|
+
svg,
|
|
355
|
+
video,
|
|
356
|
+
canvas,
|
|
357
|
+
audio,
|
|
358
|
+
iframe,
|
|
359
|
+
embed,
|
|
360
|
+
object {
|
|
361
|
+
display: block; /* 1 */
|
|
362
|
+
vertical-align: middle; /* 2 */
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/*
|
|
366
|
+
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
img,
|
|
370
|
+
video {
|
|
371
|
+
max-width: 100%;
|
|
372
|
+
height: auto;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* Make elements with the HTML hidden attribute stay hidden by default */
|
|
376
|
+
[hidden] {
|
|
377
|
+
display: none;
|
|
378
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { App, ConfigProvider, Watermark } from 'antd';
|
|
2
|
+
import type { Locale } from 'antd/lib/locale';
|
|
3
|
+
import { useSetAtom } from 'jotai';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { themeUserNameAtom, useTheme } from '../hooks';
|
|
7
|
+
import { getAntdTheme } from './shared';
|
|
8
|
+
import { initAntdUI } from './ui';
|
|
9
|
+
|
|
10
|
+
interface AntdProviderProps {
|
|
11
|
+
/** 传送门内容 */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
|
|
14
|
+
/** Antd 国际化 locale 对象 */
|
|
15
|
+
locale?: Locale;
|
|
16
|
+
|
|
17
|
+
/** 用户名(用于水印显示,自动写入全局 atom) */
|
|
18
|
+
userName?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** ContextHolder — 利用 App.useApp() 获取 message/modal/notification 实例, 自动完成 UI 实例初始化,无需消费者手动调用 init 函数。 */
|
|
22
|
+
function ContextHolder() {
|
|
23
|
+
const { message, modal, notification } = App.useApp();
|
|
24
|
+
|
|
25
|
+
initAntdUI(message, modal, notification);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Antd 统一 Provider
|
|
31
|
+
*
|
|
32
|
+
* 整合 ConfigProvider + App + Watermark + ContextHolder, 内部自动通过 useTheme 获取主题状态。
|
|
33
|
+
*
|
|
34
|
+
* UserName 通过 themeUserNameAtom 全局共享, 所有 useTheme 调用者都能获取到完整的 watermarkContent。
|
|
35
|
+
*/
|
|
36
|
+
const AntdProvider = (props: AntdProviderProps) => {
|
|
37
|
+
const { children, locale, userName } = props;
|
|
38
|
+
|
|
39
|
+
// 将 userName 写入全局 atom,供所有 useTheme 调用者读取
|
|
40
|
+
const setUserName = useSetAtom(themeUserNameAtom);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setUserName(userName);
|
|
44
|
+
}, [userName, setUserName]);
|
|
45
|
+
|
|
46
|
+
const { darkMode, settings, themeColors, watermark, watermarkContent } = useTheme();
|
|
47
|
+
|
|
48
|
+
const antdTheme = getAntdTheme(themeColors, darkMode, settings);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<ConfigProvider
|
|
52
|
+
button={{
|
|
53
|
+
classNames: {
|
|
54
|
+
icon: 'align-1px text-icon'
|
|
55
|
+
}
|
|
56
|
+
}}
|
|
57
|
+
card={{
|
|
58
|
+
styles: {
|
|
59
|
+
body: { flex: 1, overflow: 'hidden', padding: '12px 16px ' }
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
62
|
+
locale={locale}
|
|
63
|
+
segmented={{
|
|
64
|
+
classNames: {
|
|
65
|
+
item: 'flex-1',
|
|
66
|
+
root: 'w-full [&_.ant-segmented-item-selected]:font-600'
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
modal={{
|
|
70
|
+
centered: true,
|
|
71
|
+
mask: { enabled: true, blur: true },
|
|
72
|
+
classNames: {
|
|
73
|
+
body: 'text-secondary',
|
|
74
|
+
footer: 'mt-0 py-13px px-22px',
|
|
75
|
+
header: 'px-22px',
|
|
76
|
+
container:
|
|
77
|
+
'[&_.ant-modal-confirm-btns]:(mt-0 py-13px border-t-1px border-border-secondary mt-22px px-22px) [&_.ant-modal-confirm-body]:px-22px pt-22px px-0 pb-0'
|
|
78
|
+
}
|
|
79
|
+
}}
|
|
80
|
+
drawer={{
|
|
81
|
+
closable: {
|
|
82
|
+
placement: 'end'
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
85
|
+
form={{
|
|
86
|
+
classNames: {
|
|
87
|
+
label: 'font-600 text-13px'
|
|
88
|
+
}
|
|
89
|
+
}}
|
|
90
|
+
theme={antdTheme}
|
|
91
|
+
>
|
|
92
|
+
<App style={{ height: '100%' }}>
|
|
93
|
+
<ContextHolder />
|
|
94
|
+
<Watermark
|
|
95
|
+
className="shadow-initial h-full bg-opacity-100 text-opacity-100"
|
|
96
|
+
content={watermarkContent}
|
|
97
|
+
{...watermark.settings}
|
|
98
|
+
>
|
|
99
|
+
{children}
|
|
100
|
+
</Watermark>
|
|
101
|
+
</App>
|
|
102
|
+
</ConfigProvider>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default AntdProvider;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { default as AntdProvider } from './AntdProvider';
|
|
2
|
+
export { getAntdTheme } from './shared';
|
|
3
|
+
export {
|
|
4
|
+
destroyMessage,
|
|
5
|
+
destroyNotification,
|
|
6
|
+
showConfirmModal,
|
|
7
|
+
showErrorMessage,
|
|
8
|
+
showErrorModal,
|
|
9
|
+
showErrorNotification,
|
|
10
|
+
showInfoMessage,
|
|
11
|
+
showInfoModal,
|
|
12
|
+
showInfoNotification,
|
|
13
|
+
showLoadingMessage,
|
|
14
|
+
showMessage,
|
|
15
|
+
showModal,
|
|
16
|
+
showNotification,
|
|
17
|
+
showSuccessMessage,
|
|
18
|
+
showSuccessModal,
|
|
19
|
+
showSuccessNotification,
|
|
20
|
+
showWarningMessage,
|
|
21
|
+
showWarningModal,
|
|
22
|
+
showWarningNotification
|
|
23
|
+
} from './ui';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { defaultPresetColors, derivative, derivativeDark } from '../antd-algorithm';
|
|
2
|
+
import { transformColorWithOpacity } from '@skyroc/color';
|
|
3
|
+
import type { ConfigProviderProps } from 'antd';
|
|
4
|
+
|
|
5
|
+
// 注册自定义 token,antd cssVar 会据此生成 --color-inverted
|
|
6
|
+
declare module 'antd/es/theme/interface' {
|
|
7
|
+
interface AliasToken {
|
|
8
|
+
colorInverted: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get antd theme
|
|
14
|
+
*
|
|
15
|
+
* @param colors Theme colors
|
|
16
|
+
* @param darkMode Is dark mode
|
|
17
|
+
* @param settings Theme settings
|
|
18
|
+
*/
|
|
19
|
+
export function getAntdTheme(colors: Theme.ThemeColor, darkMode: boolean, settings: Theme.ThemeSetting) {
|
|
20
|
+
const { themeRadius, themeTextSize, tokens } = settings;
|
|
21
|
+
|
|
22
|
+
const { error, info, primary, success, warning } = colors;
|
|
23
|
+
|
|
24
|
+
const bgColor = transformColorWithOpacity(primary, darkMode ? 0.3 : 0.1, darkMode ? '#000000' : '#fff');
|
|
25
|
+
const containerBgColor = darkMode ? '#1C1C1E' : tokens.light?.colors.container;
|
|
26
|
+
|
|
27
|
+
const borderColor = darkMode ? '#2E3138' : '#C6C6C8';
|
|
28
|
+
|
|
29
|
+
// inverted 是自定义 token,只在亮色下生效
|
|
30
|
+
const invertedColor = tokens.light.colors.inverted;
|
|
31
|
+
|
|
32
|
+
const theme: ConfigProviderProps['theme'] = {
|
|
33
|
+
algorithm: [darkMode ? derivativeDark : derivative],
|
|
34
|
+
cssVar: {
|
|
35
|
+
key: 'root',
|
|
36
|
+
prefix: ''
|
|
37
|
+
},
|
|
38
|
+
hashed: false,
|
|
39
|
+
components: {
|
|
40
|
+
Button: {
|
|
41
|
+
controlHeightSM: 28
|
|
42
|
+
},
|
|
43
|
+
Collapse: {
|
|
44
|
+
contentPadding: '16px 16px 24px 16px',
|
|
45
|
+
headerBg: containerBgColor
|
|
46
|
+
},
|
|
47
|
+
Segmented: {
|
|
48
|
+
trackPadding: 3,
|
|
49
|
+
itemSelectedColor: primary
|
|
50
|
+
},
|
|
51
|
+
Menu: {
|
|
52
|
+
darkItemBg: 'transparent',
|
|
53
|
+
darkSubMenuItemBg: 'transparent',
|
|
54
|
+
itemMarginInline: 8,
|
|
55
|
+
itemSelectedBg: bgColor,
|
|
56
|
+
subMenuItemBg: 'transparent'
|
|
57
|
+
},
|
|
58
|
+
Modal: {
|
|
59
|
+
borderRadiusLG: 13
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
token: {
|
|
63
|
+
colorBgContainer: containerBgColor,
|
|
64
|
+
colorInverted: invertedColor,
|
|
65
|
+
colorError: error,
|
|
66
|
+
colorInfo: info,
|
|
67
|
+
fontSize: themeTextSize,
|
|
68
|
+
colorBorder: borderColor,
|
|
69
|
+
controlHeight: 36,
|
|
70
|
+
colorPrimary: primary,
|
|
71
|
+
borderRadius: themeRadius,
|
|
72
|
+
colorSuccess: success,
|
|
73
|
+
colorWarning: warning,
|
|
74
|
+
// 使用预设的颜色
|
|
75
|
+
...defaultPresetColors
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return theme;
|
|
80
|
+
}
|