@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,78 @@
|
|
|
1
|
+
// Antd
|
|
2
|
+
export {
|
|
3
|
+
AntdProvider,
|
|
4
|
+
destroyMessage,
|
|
5
|
+
destroyNotification,
|
|
6
|
+
getAntdTheme,
|
|
7
|
+
showConfirmModal,
|
|
8
|
+
showErrorMessage,
|
|
9
|
+
showErrorModal,
|
|
10
|
+
showErrorNotification,
|
|
11
|
+
showInfoMessage,
|
|
12
|
+
showInfoModal,
|
|
13
|
+
showInfoNotification,
|
|
14
|
+
showLoadingMessage,
|
|
15
|
+
showMessage,
|
|
16
|
+
showModal,
|
|
17
|
+
showNotification,
|
|
18
|
+
showSuccessMessage,
|
|
19
|
+
showSuccessModal,
|
|
20
|
+
showSuccessNotification,
|
|
21
|
+
showWarningMessage,
|
|
22
|
+
showWarningModal,
|
|
23
|
+
showWarningNotification
|
|
24
|
+
} from './antd';
|
|
25
|
+
|
|
26
|
+
// Components
|
|
27
|
+
export { default as ThemeEffect } from './components/ThemeEffect';
|
|
28
|
+
export { default as ThemeSchemaSegmented } from './components/ThemeSchemaSegmented';
|
|
29
|
+
export { default as ThemeSchemaSwitch } from './components/ThemeSchemaSwitch';
|
|
30
|
+
|
|
31
|
+
// Config
|
|
32
|
+
export { defaultThemeSettings, themeSchemeIcons } from './config';
|
|
33
|
+
|
|
34
|
+
// Hooks
|
|
35
|
+
export { themeSettingsAtom, themeUserNameAtom, useTheme, useTheme as useSettingsTheme } from './hooks';
|
|
36
|
+
export type { UseThemeReturn } from './hooks';
|
|
37
|
+
|
|
38
|
+
// Presets
|
|
39
|
+
export { azir, compact, dark, defaultPreset, getAllPresets, getPreset, presets, shadcn } from './presets';
|
|
40
|
+
export type { PresetName } from './presets';
|
|
41
|
+
|
|
42
|
+
// Setup
|
|
43
|
+
export { defineThemeOverrides, setupTheme } from './setup';
|
|
44
|
+
|
|
45
|
+
// Types
|
|
46
|
+
export type {
|
|
47
|
+
BaseToken,
|
|
48
|
+
BaseWatermarkSettings,
|
|
49
|
+
ColorPaletteNumber,
|
|
50
|
+
OtherColor,
|
|
51
|
+
ThemeColor,
|
|
52
|
+
ThemeColorKey,
|
|
53
|
+
ThemeIcons,
|
|
54
|
+
ThemeLayoutMode,
|
|
55
|
+
ThemeMode,
|
|
56
|
+
ThemePageAnimateMode,
|
|
57
|
+
ThemePaletteColor,
|
|
58
|
+
ThemePreset,
|
|
59
|
+
ThemePresetMeta,
|
|
60
|
+
ThemeScrollMode,
|
|
61
|
+
ThemeSettingToken,
|
|
62
|
+
ThemeSettingTokenBoxShadow,
|
|
63
|
+
ThemeSettingTokenColor,
|
|
64
|
+
ThemeTabMode,
|
|
65
|
+
ThemeTokenColor,
|
|
66
|
+
ThemeTokenCSSVars
|
|
67
|
+
} from './types';
|
|
68
|
+
|
|
69
|
+
// Utils
|
|
70
|
+
export {
|
|
71
|
+
clearAuxiliaryColorModes,
|
|
72
|
+
getDefaultThemeSettings,
|
|
73
|
+
getThemeColors,
|
|
74
|
+
isDarkModeClass,
|
|
75
|
+
mergeThemeSettings,
|
|
76
|
+
toggleAuxiliaryColorModes,
|
|
77
|
+
toggleCssDarkMode
|
|
78
|
+
} from './utils';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Azir's Preset",
|
|
3
|
+
"desc": "It is a cold and elegant preset that Azir likes",
|
|
4
|
+
"i18nkey": "theme.appearance.preset.azir",
|
|
5
|
+
"version": "1.0.1",
|
|
6
|
+
"order": 4,
|
|
7
|
+
"themeScheme": "light",
|
|
8
|
+
"recommendColor": true,
|
|
9
|
+
"themeColor": "#78a878",
|
|
10
|
+
"otherColor": {
|
|
11
|
+
"info": "#89b989",
|
|
12
|
+
"success": "#99c299",
|
|
13
|
+
"warning": "#d4bb9d",
|
|
14
|
+
"error": "#c49a9a"
|
|
15
|
+
},
|
|
16
|
+
"isInfoFollowPrimary": true,
|
|
17
|
+
"tokens": {
|
|
18
|
+
"light": {
|
|
19
|
+
"colors": {
|
|
20
|
+
"container": "rgb(255, 255, 255)",
|
|
21
|
+
"layout": "rgb(247, 250, 252)",
|
|
22
|
+
"inverted": "rgb(0, 20, 40)",
|
|
23
|
+
"base-text": "rgb(31, 31, 31)"
|
|
24
|
+
},
|
|
25
|
+
"boxShadow": {
|
|
26
|
+
"header": "0 1px 2px rgb(0, 21, 41, 0.08)",
|
|
27
|
+
"sider": "2px 0 8px 0 rgb(29, 35, 41, 0.05)",
|
|
28
|
+
"tab": "0 1px 2px rgb(0, 21, 41, 0.08)"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dark": {
|
|
32
|
+
"colors": {
|
|
33
|
+
"container": "rgb(28, 28, 28)",
|
|
34
|
+
"layout": "rgb(18, 18, 18)",
|
|
35
|
+
"base-text": "rgb(224, 224, 224)"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Compact Preset",
|
|
3
|
+
"desc": "Compact layout preset for small screens",
|
|
4
|
+
"i18nkey": "theme.appearance.preset.compact",
|
|
5
|
+
"version": "1.0.1",
|
|
6
|
+
"order": 6,
|
|
7
|
+
"themeRadius": 6,
|
|
8
|
+
"header": {
|
|
9
|
+
"height": 48,
|
|
10
|
+
"breadcrumb": {
|
|
11
|
+
"visible": false
|
|
12
|
+
},
|
|
13
|
+
"multilingual": {
|
|
14
|
+
"visible": false
|
|
15
|
+
},
|
|
16
|
+
"globalSearch": {
|
|
17
|
+
"visible": false
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"tab": {
|
|
21
|
+
"visible": true,
|
|
22
|
+
"cache": true,
|
|
23
|
+
"height": 36,
|
|
24
|
+
"mode": "button",
|
|
25
|
+
"closeTabByMiddleClick": false
|
|
26
|
+
},
|
|
27
|
+
"sider": {
|
|
28
|
+
"inverted": false,
|
|
29
|
+
"width": 180,
|
|
30
|
+
"collapsedWidth": 48,
|
|
31
|
+
"mixWidth": 80,
|
|
32
|
+
"mixCollapsedWidth": 48,
|
|
33
|
+
"mixChildMenuWidth": 180
|
|
34
|
+
},
|
|
35
|
+
"footer": {
|
|
36
|
+
"visible": false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Dark Preset",
|
|
3
|
+
"desc": "Dark theme preset for night time usage",
|
|
4
|
+
"i18nkey": "theme.appearance.preset.dark",
|
|
5
|
+
"version": "1.0.1",
|
|
6
|
+
"order": 5,
|
|
7
|
+
"themeScheme": "dark",
|
|
8
|
+
"grayscale": false,
|
|
9
|
+
"colourWeakness": false,
|
|
10
|
+
"recommendColor": false,
|
|
11
|
+
"themeColor": "#646cff",
|
|
12
|
+
"otherColor": {
|
|
13
|
+
"info": "#2080f0",
|
|
14
|
+
"success": "#52c41a",
|
|
15
|
+
"warning": "#faad14",
|
|
16
|
+
"error": "#f5222d"
|
|
17
|
+
},
|
|
18
|
+
"themeRadius": 6,
|
|
19
|
+
"isInfoFollowPrimary": true,
|
|
20
|
+
"layout": {
|
|
21
|
+
"mode": "vertical",
|
|
22
|
+
"scrollMode": "content"
|
|
23
|
+
},
|
|
24
|
+
"page": {
|
|
25
|
+
"animate": true,
|
|
26
|
+
"animateMode": "fade-slide"
|
|
27
|
+
},
|
|
28
|
+
"header": {
|
|
29
|
+
"height": 56,
|
|
30
|
+
"breadcrumb": {
|
|
31
|
+
"visible": true,
|
|
32
|
+
"showIcon": true
|
|
33
|
+
},
|
|
34
|
+
"multilingual": {
|
|
35
|
+
"visible": true
|
|
36
|
+
},
|
|
37
|
+
"globalSearch": {
|
|
38
|
+
"visible": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"tab": {
|
|
42
|
+
"visible": true,
|
|
43
|
+
"cache": true,
|
|
44
|
+
"height": 44,
|
|
45
|
+
"mode": "chrome",
|
|
46
|
+
"closeTabByMiddleClick": false
|
|
47
|
+
},
|
|
48
|
+
"fixedHeaderAndTab": true,
|
|
49
|
+
"sider": {
|
|
50
|
+
"inverted": false,
|
|
51
|
+
"width": 220,
|
|
52
|
+
"collapsedWidth": 64,
|
|
53
|
+
"mixWidth": 90,
|
|
54
|
+
"mixCollapsedWidth": 64,
|
|
55
|
+
"mixChildMenuWidth": 200
|
|
56
|
+
},
|
|
57
|
+
"footer": {
|
|
58
|
+
"visible": true,
|
|
59
|
+
"fixed": false,
|
|
60
|
+
"height": 48,
|
|
61
|
+
"right": true
|
|
62
|
+
},
|
|
63
|
+
"watermark": {
|
|
64
|
+
"visible": false,
|
|
65
|
+
"text": "SoybeanAdmin",
|
|
66
|
+
"enableCustomText": true,
|
|
67
|
+
"enableUserName": false,
|
|
68
|
+
"enableTime": false,
|
|
69
|
+
"timeFormat": "YYYY-MM-DD HH:mm"
|
|
70
|
+
},
|
|
71
|
+
"tokens": {
|
|
72
|
+
"light": {
|
|
73
|
+
"colors": {
|
|
74
|
+
"container": "rgb(255, 255, 255)",
|
|
75
|
+
"layout": "rgb(247, 250, 252)",
|
|
76
|
+
"inverted": "rgb(0, 20, 40)",
|
|
77
|
+
"base-text": "rgb(31, 31, 31)"
|
|
78
|
+
},
|
|
79
|
+
"boxShadow": {
|
|
80
|
+
"header": "0 1px 2px rgb(0, 21, 41, 0.08)",
|
|
81
|
+
"sider": "2px 0 8px 0 rgb(29, 35, 41, 0.05)",
|
|
82
|
+
"tab": "0 1px 2px rgb(0, 21, 41, 0.08)"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"dark": {
|
|
86
|
+
"colors": {
|
|
87
|
+
"container": "rgb(28, 28, 28)",
|
|
88
|
+
"layout": "rgb(18, 18, 18)",
|
|
89
|
+
"base-text": "rgb(224, 224, 224)"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "default",
|
|
3
|
+
"desc": "Default theme preset with balanced settings",
|
|
4
|
+
"i18nkey": "theme.appearance.preset.default",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"order": 1,
|
|
7
|
+
"themeScheme": "light",
|
|
8
|
+
"grayscale": false,
|
|
9
|
+
"colourWeakness": false,
|
|
10
|
+
"recommendColor": false,
|
|
11
|
+
"themeColor": "#646cff",
|
|
12
|
+
"otherColor": {
|
|
13
|
+
"info": "#2080f0",
|
|
14
|
+
"success": "#52c41a",
|
|
15
|
+
"warning": "#faad14",
|
|
16
|
+
"error": "#f5222d"
|
|
17
|
+
},
|
|
18
|
+
"themeRadius": 6,
|
|
19
|
+
"isInfoFollowPrimary": true,
|
|
20
|
+
"themeTextSize": 16,
|
|
21
|
+
"layout": {
|
|
22
|
+
"mode": "vertical",
|
|
23
|
+
"scrollMode": "content"
|
|
24
|
+
},
|
|
25
|
+
"page": {
|
|
26
|
+
"animate": true,
|
|
27
|
+
"animateMode": "fade-slide"
|
|
28
|
+
},
|
|
29
|
+
"header": {
|
|
30
|
+
"height": 56,
|
|
31
|
+
"breadcrumb": {
|
|
32
|
+
"visible": true,
|
|
33
|
+
"showIcon": true
|
|
34
|
+
},
|
|
35
|
+
"multilingual": {
|
|
36
|
+
"visible": true
|
|
37
|
+
},
|
|
38
|
+
"globalSearch": {
|
|
39
|
+
"visible": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"tab": {
|
|
43
|
+
"visible": true,
|
|
44
|
+
"cache": true,
|
|
45
|
+
"height": 44,
|
|
46
|
+
"mode": "chrome",
|
|
47
|
+
"closeTabByMiddleClick": false
|
|
48
|
+
},
|
|
49
|
+
"fixedHeaderAndTab": true,
|
|
50
|
+
"sider": {
|
|
51
|
+
"inverted": false,
|
|
52
|
+
"width": 220,
|
|
53
|
+
"collapsedWidth": 64,
|
|
54
|
+
"mixWidth": 90,
|
|
55
|
+
"mixCollapsedWidth": 64,
|
|
56
|
+
"mixChildMenuWidth": 200,
|
|
57
|
+
"autoSelectFirstMenu": false
|
|
58
|
+
},
|
|
59
|
+
"footer": {
|
|
60
|
+
"visible": true,
|
|
61
|
+
"fixed": false,
|
|
62
|
+
"height": 48,
|
|
63
|
+
"right": true
|
|
64
|
+
},
|
|
65
|
+
"watermark": {
|
|
66
|
+
"visible": false,
|
|
67
|
+
"text": "SoybeanAdmin",
|
|
68
|
+
"enableCustomText": true,
|
|
69
|
+
"enableUserName": false,
|
|
70
|
+
"enableTime": false,
|
|
71
|
+
"timeFormat": "YYYY-MM-DD HH:mm"
|
|
72
|
+
},
|
|
73
|
+
"tokens": {
|
|
74
|
+
"light": {
|
|
75
|
+
"colors": {
|
|
76
|
+
"container": "rgb(255, 255, 255)",
|
|
77
|
+
"layout": "rgb(247, 250, 252)",
|
|
78
|
+
"inverted": "rgb(0, 20, 40)",
|
|
79
|
+
"base-text": "rgb(31, 31, 31)"
|
|
80
|
+
},
|
|
81
|
+
"boxShadow": {
|
|
82
|
+
"header": "0 1px 2px rgb(0, 21, 41, 0.08)",
|
|
83
|
+
"sider": "2px 0 8px 0 rgb(29, 35, 41, 0.05)",
|
|
84
|
+
"tab": "0 1px 2px rgb(0, 21, 41, 0.08)"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"dark": {
|
|
88
|
+
"colors": {
|
|
89
|
+
"container": "rgb(28, 28, 28)",
|
|
90
|
+
"layout": "rgb(18, 18, 18)",
|
|
91
|
+
"base-text": "rgb(224, 224, 224)"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import azir from './azir.json';
|
|
2
|
+
import compact from './compact.json';
|
|
3
|
+
import dark from './dark.json';
|
|
4
|
+
import defaultPreset from './default.json';
|
|
5
|
+
import shadcn from './shadcn.json';
|
|
6
|
+
|
|
7
|
+
/** All available presets */
|
|
8
|
+
export const presets = {
|
|
9
|
+
azir,
|
|
10
|
+
compact,
|
|
11
|
+
dark,
|
|
12
|
+
default: defaultPreset,
|
|
13
|
+
shadcn
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
/** Preset names */
|
|
17
|
+
export type PresetName = keyof typeof presets;
|
|
18
|
+
|
|
19
|
+
/** Get preset by name */
|
|
20
|
+
export function getPreset(name: PresetName): Theme.ThemePreset {
|
|
21
|
+
return presets[name] as Theme.ThemePreset;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Get all presets sorted by order */
|
|
25
|
+
export function getAllPresets(): Theme.ThemePreset[] {
|
|
26
|
+
return Object.values(presets).toSorted((a, b) => (a.order ?? 0) - (b.order ?? 0)) as Theme.ThemePreset[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { azir, compact, dark, defaultPreset, shadcn };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "shadcn",
|
|
3
|
+
"desc": "Modern and elegant theme inspired by shadcn/ui design system with neutral tones",
|
|
4
|
+
"i18nkey": "theme.appearance.preset.shadcn",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"order": 3,
|
|
7
|
+
"themeScheme": "light",
|
|
8
|
+
"grayscale": false,
|
|
9
|
+
"colourWeakness": false,
|
|
10
|
+
"recommendColor": false,
|
|
11
|
+
"themeColor": "#18181b",
|
|
12
|
+
"otherColor": {
|
|
13
|
+
"info": "#0ea5e9",
|
|
14
|
+
"success": "#10b981",
|
|
15
|
+
"warning": "#f59e0b",
|
|
16
|
+
"error": "#ef4444"
|
|
17
|
+
},
|
|
18
|
+
"themeRadius": 8,
|
|
19
|
+
"themeTextSize": 14,
|
|
20
|
+
"isInfoFollowPrimary": false,
|
|
21
|
+
"layout": {
|
|
22
|
+
"mode": "vertical",
|
|
23
|
+
"scrollMode": "content"
|
|
24
|
+
},
|
|
25
|
+
"page": {
|
|
26
|
+
"animate": true,
|
|
27
|
+
"animateMode": "fade-slide"
|
|
28
|
+
},
|
|
29
|
+
"header": {
|
|
30
|
+
"height": 56,
|
|
31
|
+
"breadcrumb": {
|
|
32
|
+
"visible": true,
|
|
33
|
+
"showIcon": true
|
|
34
|
+
},
|
|
35
|
+
"multilingual": {
|
|
36
|
+
"visible": true
|
|
37
|
+
},
|
|
38
|
+
"globalSearch": {
|
|
39
|
+
"visible": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"tab": {
|
|
43
|
+
"visible": true,
|
|
44
|
+
"cache": true,
|
|
45
|
+
"height": 44,
|
|
46
|
+
"mode": "chrome",
|
|
47
|
+
"closeTabByMiddleClick": true
|
|
48
|
+
},
|
|
49
|
+
"fixedHeaderAndTab": true,
|
|
50
|
+
"sider": {
|
|
51
|
+
"inverted": false,
|
|
52
|
+
"width": 240,
|
|
53
|
+
"collapsedWidth": 64,
|
|
54
|
+
"mixWidth": 90,
|
|
55
|
+
"mixCollapsedWidth": 64,
|
|
56
|
+
"mixChildMenuWidth": 200,
|
|
57
|
+
"autoSelectFirstMenu": true
|
|
58
|
+
},
|
|
59
|
+
"footer": {
|
|
60
|
+
"visible": true,
|
|
61
|
+
"fixed": false,
|
|
62
|
+
"height": 48,
|
|
63
|
+
"right": true
|
|
64
|
+
},
|
|
65
|
+
"watermark": {
|
|
66
|
+
"visible": false,
|
|
67
|
+
"text": "SoybeanAdmin",
|
|
68
|
+
"enableUserName": false,
|
|
69
|
+
"enableTime": false,
|
|
70
|
+
"timeFormat": "YYYY-MM-DD HH:mm"
|
|
71
|
+
},
|
|
72
|
+
"tokens": {
|
|
73
|
+
"light": {
|
|
74
|
+
"colors": {
|
|
75
|
+
"container": "rgb(255, 255, 255)",
|
|
76
|
+
"layout": "rgb(250, 250, 250)",
|
|
77
|
+
"inverted": "rgb(9, 9, 11)",
|
|
78
|
+
"base-text": "rgb(24, 24, 27)"
|
|
79
|
+
},
|
|
80
|
+
"boxShadow": {
|
|
81
|
+
"header": "0 1px 3px 0 rgb(0, 0, 0, 0.1), 0 1px 2px -1px rgb(0, 0, 0, 0.1)",
|
|
82
|
+
"sider": "1px 0 3px 0 rgb(0, 0, 0, 0.1)",
|
|
83
|
+
"tab": "0 1px 3px 0 rgb(0, 0, 0, 0.1), 0 1px 2px -1px rgb(0, 0, 0, 0.1)"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"dark": {
|
|
87
|
+
"colors": {
|
|
88
|
+
"container": "rgb(24, 24, 27)",
|
|
89
|
+
"layout": "rgb(9, 9, 11)",
|
|
90
|
+
"base-text": "rgb(250, 250, 250)"
|
|
91
|
+
},
|
|
92
|
+
"boxShadow": {
|
|
93
|
+
"header": "0 1px 3px 0 rgb(0, 0, 0, 0.3), 0 1px 2px -1px rgb(0, 0, 0, 0.3)",
|
|
94
|
+
"sider": "1px 0 3px 0 rgb(0, 0, 0, 0.3)",
|
|
95
|
+
"tab": "0 1px 3px 0 rgb(0, 0, 0, 0.3), 0 1px 2px -1px rgb(0, 0, 0, 0.3)"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { createStorage } from '@skyroc/utils/web';
|
|
2
|
+
import { defaultThemeSettings } from './config/default';
|
|
3
|
+
import { themeSettingsAtom } from './hooks';
|
|
4
|
+
import { mergeThemeSettings } from './utils/settings';
|
|
5
|
+
|
|
6
|
+
const DEFAULT_THEME_STORAGE_PREFIX = 'SR_';
|
|
7
|
+
|
|
8
|
+
interface ThemeStorageSchema {
|
|
9
|
+
darkMode: boolean;
|
|
10
|
+
overrideThemeFlag: string;
|
|
11
|
+
themeColor: string;
|
|
12
|
+
themeSettings: Theme.ThemeSetting;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Storage adapter interface
|
|
17
|
+
*
|
|
18
|
+
* 与 createStorage 返回的对象兼容,也可以传宿主自定义 storage。
|
|
19
|
+
*/
|
|
20
|
+
interface ThemeStorage {
|
|
21
|
+
get: (...args: any[]) => any;
|
|
22
|
+
set: (...args: any[]) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface SetupThemeOptions {
|
|
26
|
+
/** 当前构建时间,用于检测缓存覆盖(生产环境需要) */
|
|
27
|
+
buildTime?: string;
|
|
28
|
+
|
|
29
|
+
/** 是否生产环境(默认 import.meta.env.PROD) */
|
|
30
|
+
isProd?: boolean;
|
|
31
|
+
|
|
32
|
+
/** 主题配置覆盖项,发布新版本时可强制覆盖用户缓存的某些配置 */
|
|
33
|
+
overrides?: Partial<Theme.ThemeSetting>;
|
|
34
|
+
|
|
35
|
+
/** 存储适配器,用于读写缓存的主题配置;传入后会优先于 storagePrefix */
|
|
36
|
+
storage?: ThemeStorage;
|
|
37
|
+
|
|
38
|
+
/** 默认存储适配器的 key 前缀 */
|
|
39
|
+
storagePrefix?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let _storage: ThemeStorage | null = null;
|
|
43
|
+
|
|
44
|
+
export function getInternalStorage(): ThemeStorage | null {
|
|
45
|
+
return _storage;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 一次调用完成主题初始化
|
|
50
|
+
*
|
|
51
|
+
* 在 app 入口或 AntdProvider 之前调用,自动处理: - 默认配置加载 - localStorage 缓存读取(生产环境) - 版本覆盖检测 - Jotai atom 初始化
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { setupTheme } from '@shell/theme';
|
|
56
|
+
*
|
|
57
|
+
* setupTheme({
|
|
58
|
+
* buildTime: BUILD_TIME
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export function setupTheme(options: SetupThemeOptions = {}) {
|
|
63
|
+
const {
|
|
64
|
+
buildTime,
|
|
65
|
+
isProd = import.meta.env.PROD,
|
|
66
|
+
overrides,
|
|
67
|
+
storage,
|
|
68
|
+
storagePrefix = DEFAULT_THEME_STORAGE_PREFIX
|
|
69
|
+
} = options;
|
|
70
|
+
const themeStorage = storage ?? createDefaultStorage(storagePrefix);
|
|
71
|
+
|
|
72
|
+
_storage = themeStorage;
|
|
73
|
+
|
|
74
|
+
// 开发环境:直接使用默认配置
|
|
75
|
+
if (!isProd) {
|
|
76
|
+
themeSettingsAtom.init = defaultThemeSettings;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 生产环境:从缓存加载 + 版本覆盖检测
|
|
81
|
+
const cachedSettings = themeStorage.get('themeSettings');
|
|
82
|
+
|
|
83
|
+
let settings = mergeThemeSettings(cachedSettings, defaultThemeSettings);
|
|
84
|
+
|
|
85
|
+
const isOverride = buildTime ? themeStorage.get('overrideThemeFlag') === buildTime : false;
|
|
86
|
+
|
|
87
|
+
if (!isOverride) {
|
|
88
|
+
settings = mergeThemeSettings(overrides, settings);
|
|
89
|
+
|
|
90
|
+
if (buildTime) {
|
|
91
|
+
themeStorage.set('overrideThemeFlag', buildTime);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
themeSettingsAtom.init = settings;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function createDefaultStorage(storagePrefix: string) {
|
|
99
|
+
return createStorage<ThemeStorageSchema>('local', storagePrefix);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 类型安全的主题覆盖配置定义辅助函数
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* export const themeOverrides = defineThemeOverrides({
|
|
108
|
+
* themeColor: '#6366F1',
|
|
109
|
+
* themeScheme: 'dark'
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export function defineThemeOverrides(overrides: Partial<Theme.ThemeSetting>): Partial<Theme.ThemeSetting> {
|
|
114
|
+
return overrides;
|
|
115
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export types from the global Theme namespace
|
|
3
|
+
*
|
|
4
|
+
* This allows internal code (e.g. hooks, utils) to import types via standard ES module imports while the actual
|
|
5
|
+
* definitions live in the global Theme namespace (theme.d.ts).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export type BaseToken = Theme.BaseToken;
|
|
9
|
+
export type BaseWatermarkSettings = Theme.BaseWatermarkSettings;
|
|
10
|
+
export type ColorPaletteNumber = Theme.ColorPaletteNumber;
|
|
11
|
+
export type OtherColor = Theme.OtherColor;
|
|
12
|
+
export type ThemeColor = Theme.ThemeColor;
|
|
13
|
+
export type ThemeColorKey = Theme.ThemeColorKey;
|
|
14
|
+
export type ThemeIcons = Theme.ThemeIcons;
|
|
15
|
+
export type ThemeLayoutMode = Theme.ThemeLayoutMode;
|
|
16
|
+
export type ThemeMode = Theme.ThemeMode;
|
|
17
|
+
export type ThemePageAnimateMode = Theme.ThemePageAnimateMode;
|
|
18
|
+
export type ThemePaletteColor = Theme.ThemePaletteColor;
|
|
19
|
+
export type ThemePreset = Theme.ThemePreset;
|
|
20
|
+
export type ThemePresetMeta = Theme.ThemePresetMeta;
|
|
21
|
+
export type ThemeScrollMode = Theme.ThemeScrollMode;
|
|
22
|
+
export type ThemeSettingToken = Theme.ThemeSettingToken;
|
|
23
|
+
export type ThemeSettingTokenBoxShadow = Theme.ThemeSettingTokenBoxShadow;
|
|
24
|
+
export type ThemeSettingTokenColor = Theme.ThemeSettingTokenColor;
|
|
25
|
+
export type ThemeTabMode = Theme.ThemeTabMode;
|
|
26
|
+
export type ThemeTokenColor = Theme.ThemeTokenColor;
|
|
27
|
+
export type ThemeTokenCSSVars = Theme.ThemeTokenCSSVars;
|