@qlover/create-app 0.7.5 → 0.7.7

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.
Files changed (166) hide show
  1. package/CHANGELOG.md +257 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/templates/next-app/.env.template +22 -0
  5. package/dist/templates/next-app/.prettierignore +58 -0
  6. package/dist/templates/next-app/README.md +36 -0
  7. package/dist/templates/next-app/build/generateLocales.ts +25 -0
  8. package/dist/templates/next-app/config/IOCIdentifier.ts +45 -0
  9. package/dist/templates/next-app/config/Identifier/common.error.ts +34 -0
  10. package/dist/templates/next-app/config/Identifier/common.ts +62 -0
  11. package/dist/templates/next-app/config/Identifier/index.ts +10 -0
  12. package/dist/templates/next-app/config/Identifier/page.about.ts +181 -0
  13. package/dist/templates/next-app/config/Identifier/page.executor.ts +272 -0
  14. package/dist/templates/next-app/config/Identifier/page.home.ts +63 -0
  15. package/dist/templates/next-app/config/Identifier/page.identifiter.ts +39 -0
  16. package/dist/templates/next-app/config/Identifier/page.jsonStorage.ts +72 -0
  17. package/dist/templates/next-app/config/Identifier/page.login.ts +165 -0
  18. package/dist/templates/next-app/config/Identifier/page.register.ts +147 -0
  19. package/dist/templates/next-app/config/Identifier/page.request.ts +182 -0
  20. package/dist/templates/next-app/config/common.ts +34 -0
  21. package/dist/templates/next-app/config/i18n/PageI18nInterface.ts +51 -0
  22. package/dist/templates/next-app/config/i18n/i18nConfig.ts +12 -0
  23. package/dist/templates/next-app/config/i18n/index.ts +3 -0
  24. package/dist/templates/next-app/config/i18n/loginI18n.ts +42 -0
  25. package/dist/templates/next-app/config/theme.ts +23 -0
  26. package/dist/templates/next-app/docs/env.md +94 -0
  27. package/dist/templates/next-app/eslint.config.mjs +181 -0
  28. package/dist/templates/next-app/next.config.ts +21 -0
  29. package/dist/templates/next-app/package.json +58 -0
  30. package/dist/templates/next-app/plugins/eslint-plugin-testid.mjs +94 -0
  31. package/dist/templates/next-app/plugins/generateLocalesPlugin.ts +33 -0
  32. package/dist/templates/next-app/postcss.config.mjs +5 -0
  33. package/dist/templates/next-app/public/file.svg +1 -0
  34. package/dist/templates/next-app/public/globe.svg +1 -0
  35. package/dist/templates/next-app/public/locales/en/common.json +183 -0
  36. package/dist/templates/next-app/public/locales/zh/common.json +183 -0
  37. package/dist/templates/next-app/public/next.svg +1 -0
  38. package/dist/templates/next-app/public/vercel.svg +1 -0
  39. package/dist/templates/next-app/public/window.svg +1 -0
  40. package/dist/templates/next-app/src/app/[locale]/favicon.ico +0 -0
  41. package/dist/templates/next-app/src/app/[locale]/layout.tsx +44 -0
  42. package/dist/templates/next-app/src/app/[locale]/login/FeatureItem.tsx +13 -0
  43. package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +115 -0
  44. package/dist/templates/next-app/src/app/[locale]/login/page.tsx +73 -0
  45. package/dist/templates/next-app/src/app/[locale]/not-found.tsx +24 -0
  46. package/dist/templates/next-app/src/app/[locale]/page.tsx +106 -0
  47. package/dist/templates/next-app/src/base/cases/AppConfig.ts +15 -0
  48. package/dist/templates/next-app/src/base/cases/InversifyContainer.ts +33 -0
  49. package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +25 -0
  50. package/dist/templates/next-app/src/base/port/UserServiceInterface.ts +11 -0
  51. package/dist/templates/next-app/src/base/services/I18nService.ts +115 -0
  52. package/dist/templates/next-app/src/base/services/UserService.ts +23 -0
  53. package/dist/templates/next-app/src/core/IOC.ts +58 -0
  54. package/dist/templates/next-app/src/core/IocRegisterImpl.ts +100 -0
  55. package/dist/templates/next-app/src/core/bootstraps/BootstrapClient.ts +98 -0
  56. package/dist/templates/next-app/src/core/bootstraps/BootstrapsRegistry.ts +47 -0
  57. package/dist/templates/next-app/src/core/bootstraps/IocIdentifierTest.ts +26 -0
  58. package/dist/templates/next-app/src/core/bootstraps/PrintBootstrap.ts +18 -0
  59. package/dist/templates/next-app/src/core/globals.ts +21 -0
  60. package/dist/templates/next-app/src/i18n/request.ts +22 -0
  61. package/dist/templates/next-app/src/i18n/routing.ts +30 -0
  62. package/dist/templates/next-app/src/middleware.ts +22 -0
  63. package/dist/templates/next-app/src/server/getServerI18n.ts +26 -0
  64. package/dist/templates/next-app/src/styles/css/antd-themes/_default.css +239 -0
  65. package/dist/templates/next-app/src/styles/css/antd-themes/dark.css +178 -0
  66. package/dist/templates/next-app/src/styles/css/antd-themes/index.css +3 -0
  67. package/dist/templates/next-app/src/styles/css/antd-themes/no-context.css +34 -0
  68. package/dist/templates/next-app/src/styles/css/antd-themes/pink.css +204 -0
  69. package/dist/templates/next-app/src/styles/css/index.css +6 -0
  70. package/dist/templates/next-app/src/styles/css/page.css +19 -0
  71. package/dist/templates/next-app/src/styles/css/tailwind.css +5 -0
  72. package/dist/templates/next-app/src/styles/css/themes/_default.css +29 -0
  73. package/dist/templates/next-app/src/styles/css/themes/dark.css +29 -0
  74. package/dist/templates/next-app/src/styles/css/themes/index.css +3 -0
  75. package/dist/templates/next-app/src/styles/css/themes/pink.css +29 -0
  76. package/dist/templates/next-app/src/styles/css/zIndex.css +9 -0
  77. package/dist/templates/next-app/src/uikit/components/BaseHeader.tsx +42 -0
  78. package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +25 -0
  79. package/dist/templates/next-app/src/uikit/components/ComboProvider.tsx +45 -0
  80. package/dist/templates/next-app/src/uikit/components/LanguageSwitcher.tsx +52 -0
  81. package/dist/templates/next-app/src/uikit/components/LocaleLink.tsx +51 -0
  82. package/dist/templates/next-app/src/uikit/components/NextIntlProvider.tsx +21 -0
  83. package/dist/templates/next-app/src/uikit/components/ThemeSwitcher.tsx +86 -0
  84. package/dist/templates/next-app/src/uikit/context/IOCContext.ts +6 -0
  85. package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +28 -0
  86. package/dist/templates/next-app/src/uikit/hook/useIOC.ts +37 -0
  87. package/dist/templates/next-app/src/uikit/hook/useMountedClient.ts +11 -0
  88. package/dist/templates/next-app/src/uikit/hook/useStore.ts +15 -0
  89. package/dist/templates/next-app/tailwind.config.ts +8 -0
  90. package/dist/templates/next-app/tsconfig.json +36 -0
  91. package/dist/templates/react-app/.env.template +0 -2
  92. package/dist/templates/react-app/__tests__/src/base/services/I18nService.test.ts +1 -1
  93. package/dist/templates/react-app/__tests__/src/core/IOC.test.ts +6 -31
  94. package/dist/templates/react-app/__tests__/src/core/bootstraps/BootstrapsApp.test.ts +1 -1
  95. package/dist/templates/react-app/config/IOCIdentifier.ts +77 -5
  96. package/dist/templates/react-app/config/app.router.ts +2 -2
  97. package/dist/templates/react-app/package.json +4 -7
  98. package/dist/templates/react-app/public/locales/en/common.json +1 -1
  99. package/dist/templates/react-app/public/locales/zh/common.json +1 -1
  100. package/dist/templates/react-app/src/App.tsx +9 -4
  101. package/dist/templates/react-app/src/base/apis/userApi/UserApi.ts +1 -1
  102. package/dist/templates/react-app/src/base/apis/userApi/UserApiBootstarp.ts +4 -0
  103. package/dist/templates/react-app/src/base/cases/DialogHandler.ts +16 -13
  104. package/dist/templates/react-app/src/base/cases/I18nKeyErrorPlugin.ts +4 -3
  105. package/dist/templates/react-app/src/base/cases/InversifyContainer.ts +2 -2
  106. package/dist/templates/react-app/src/base/cases/RequestLanguages.ts +39 -0
  107. package/dist/templates/react-app/src/base/cases/RequestState.ts +20 -0
  108. package/dist/templates/react-app/src/base/cases/RequestStatusCatcher.ts +2 -2
  109. package/dist/templates/react-app/src/base/cases/RouterLoader.ts +8 -2
  110. package/dist/templates/react-app/src/base/port/AsyncStateInterface.ts +7 -0
  111. package/dist/templates/react-app/src/base/port/ExecutorPageBridgeInterface.ts +24 -0
  112. package/dist/templates/react-app/src/base/port/I18nServiceInterface.ts +10 -0
  113. package/dist/templates/react-app/src/base/port/JSONStoragePageBridgeInterface.ts +20 -0
  114. package/dist/templates/react-app/src/base/port/ProcesserExecutorInterface.ts +20 -0
  115. package/dist/templates/react-app/src/base/port/RequestPageBridgeInterface.ts +23 -0
  116. package/dist/templates/react-app/src/base/port/RequestStatusInterface.ts +5 -0
  117. package/dist/templates/react-app/src/base/port/RouteServiceInterface.ts +27 -0
  118. package/dist/templates/react-app/src/base/port/UserServiceInterface.ts +12 -0
  119. package/dist/templates/react-app/src/base/services/I18nService.ts +10 -6
  120. package/dist/templates/react-app/src/base/services/ProcesserExecutor.ts +23 -5
  121. package/dist/templates/react-app/src/base/services/RouteService.ts +25 -54
  122. package/dist/templates/react-app/src/base/services/UserService.ts +10 -20
  123. package/dist/templates/react-app/src/core/IOC.ts +1 -26
  124. package/dist/templates/react-app/src/core/IocRegisterImpl.ts +125 -0
  125. package/dist/templates/react-app/src/core/bootstraps/BootstrapApp.ts +4 -6
  126. package/dist/templates/react-app/src/core/bootstraps/BootstrapsRegistry.ts +8 -6
  127. package/dist/templates/react-app/src/core/bootstraps/IocIdentifierTest.ts +26 -0
  128. package/dist/templates/react-app/src/pages/auth/Layout.tsx +2 -2
  129. package/dist/templates/react-app/src/pages/auth/LoginPage.tsx +5 -6
  130. package/dist/templates/react-app/src/pages/auth/RegisterPage.tsx +8 -7
  131. package/dist/templates/react-app/src/pages/base/ExecutorPage.tsx +8 -19
  132. package/dist/templates/react-app/src/pages/base/{ErrorIdentifierPage.tsx → IdentifierPage.tsx} +1 -1
  133. package/dist/templates/react-app/src/pages/base/JSONStoragePage.tsx +11 -15
  134. package/dist/templates/react-app/src/pages/base/Layout.tsx +1 -1
  135. package/dist/templates/react-app/src/pages/base/RedirectPathname.tsx +2 -2
  136. package/dist/templates/react-app/src/pages/base/RequestPage.tsx +34 -46
  137. package/dist/templates/react-app/src/styles/css/antd-themes/_default.css +2 -2
  138. package/dist/templates/react-app/src/styles/css/antd-themes/dark.css +2 -2
  139. package/dist/templates/react-app/src/styles/css/antd-themes/pink.css +2 -2
  140. package/dist/templates/react-app/src/styles/css/index.css +1 -0
  141. package/dist/templates/react-app/src/styles/css/page.css +8 -0
  142. package/dist/templates/react-app/src/styles/css/zIndex.css +9 -0
  143. package/dist/templates/react-app/src/uikit/{controllers/ExecutorController.ts → bridges/ExecutorPageBridge.ts} +13 -36
  144. package/dist/templates/react-app/src/uikit/bridges/JSONStoragePageBridge.ts +41 -0
  145. package/dist/templates/react-app/src/uikit/bridges/NavigateBridge.ts +16 -0
  146. package/dist/templates/react-app/src/uikit/bridges/RequestPageBridge.ts +136 -0
  147. package/dist/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +3 -2
  148. package/dist/templates/react-app/src/uikit/components/LogoutButton.tsx +2 -2
  149. package/dist/templates/react-app/src/uikit/{providers → components}/ProcessExecutorProvider.tsx +4 -4
  150. package/dist/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +1 -1
  151. package/dist/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +3 -5
  152. package/dist/templates/react-app/src/uikit/{providers → components}/UserAuthProvider.tsx +3 -3
  153. package/dist/templates/react-app/src/uikit/hooks/useI18nGuard.ts +5 -2
  154. package/dist/templates/react-app/src/uikit/hooks/{userRouterService.ts → useNavigateBridge.ts} +3 -3
  155. package/dist/templates/react-app/src/uikit/hooks/useStore.ts +5 -2
  156. package/dist/templates/react-app/tsconfig.json +1 -4
  157. package/package.json +1 -1
  158. package/dist/templates/react-app/src/base/port/InteractionHubInterface.ts +0 -94
  159. package/dist/templates/react-app/src/base/port/UIDependenciesInterface.ts +0 -37
  160. package/dist/templates/react-app/src/core/registers/IocRegisterImpl.ts +0 -25
  161. package/dist/templates/react-app/src/core/registers/RegisterCommon.ts +0 -74
  162. package/dist/templates/react-app/src/core/registers/RegisterControllers.ts +0 -26
  163. package/dist/templates/react-app/src/core/registers/RegisterGlobals.ts +0 -30
  164. package/dist/templates/react-app/src/uikit/controllers/JSONStorageController.ts +0 -49
  165. package/dist/templates/react-app/src/uikit/controllers/RequestController.ts +0 -158
  166. /package/dist/templates/react-app/src/uikit/{providers → components}/BaseRouteProvider.tsx +0 -0
@@ -3,12 +3,12 @@ import {
3
3
  IOCContainerInterface,
4
4
  IOCFunctionInterface
5
5
  } from '@qlover/corekit-bridge';
6
+ import type { IOCIdentifierMap } from '@config/IOCIdentifier';
6
7
  import { envBlackList, envPrefix, browserGlobalsName } from '@config/common';
7
8
  import * as globals from '../globals';
8
- import { IocRegisterImpl } from '../registers/IocRegisterImpl';
9
+ import { IocRegisterImpl } from '../IocRegisterImpl';
9
10
  import { BootstrapsRegistry } from './BootstrapsRegistry';
10
11
  import { isObject } from 'lodash';
11
- import { IOCIdentifierMap } from '../IOC';
12
12
 
13
13
  export type BootstrapAppArgs = {
14
14
  /**
@@ -44,10 +44,9 @@ export class BootstrapApp {
44
44
  },
45
45
  envOptions: {
46
46
  target: appConfig,
47
- source: {
48
- ...import.meta.env,
47
+ source: Object.assign({}, import.meta.env, {
49
48
  [envPrefix + 'BOOT_HREF']: bootHref
50
- },
49
+ }),
51
50
  prefix: envPrefix,
52
51
  blackList: envBlackList
53
52
  },
@@ -67,7 +66,6 @@ export class BootstrapApp {
67
66
 
68
67
  await bootstrap.use(bootstrapsRegistry.register()).start();
69
68
  } catch (error) {
70
- console.log(error);
71
69
  logger.error(`${appConfig.appName} starup error:`, error);
72
70
  }
73
71
 
@@ -8,10 +8,8 @@ import { UserApiBootstarp } from '@/base/apis/userApi/UserApiBootstarp';
8
8
  import { FeApiBootstarp } from '@/base/apis/feApi/FeApiBootstarp';
9
9
  import { AiApiBootstarp } from '@/base/apis/AiApi';
10
10
  import { printBootstrap } from './PrintBootstrap';
11
- import { IOCIdentifier } from '@config/IOCIdentifier';
12
- import { I18nService } from '@/base/services/I18nService';
13
- import { I18nKeyErrorPlugin } from '@/base/cases/I18nKeyErrorPlugin';
14
- import { IOCIdentifierMap } from '../IOC';
11
+ import { IOCIdentifier, IOCIdentifierMap } from '@config/IOCIdentifier';
12
+ import { IocIdentifierTest } from './IocIdentifierTest';
15
13
 
16
14
  export class BootstrapsRegistry {
17
15
  constructor(
@@ -26,17 +24,21 @@ export class BootstrapsRegistry {
26
24
  const IOC = this.IOC;
27
25
 
28
26
  const bootstrapList = [
29
- IOC(I18nService),
27
+ IOC(IOCIdentifier.I18nServiceInterface),
30
28
  new UserApiBootstarp(),
31
29
  new FeApiBootstarp(),
32
30
  AiApiBootstarp,
33
- IOC(I18nKeyErrorPlugin)
31
+ IOC(IOCIdentifier.I18nKeyErrorPlugin)
34
32
  ];
35
33
 
36
34
  if (!this.appConfig.isProduction) {
37
35
  bootstrapList.push(printBootstrap);
38
36
  }
39
37
 
38
+ bootstrapList.push(IocIdentifierTest);
39
+ // TODO: 需要使用到
40
+ bootstrapList.push(IOC(IOCIdentifier.ProcesserExecutorInterface));
41
+
40
42
  return bootstrapList;
41
43
  }
42
44
  }
@@ -0,0 +1,26 @@
1
+ import { IOCIdentifier } from '@config/IOCIdentifier';
2
+ import { BootstrapExecutorPlugin } from '@qlover/corekit-bridge';
3
+
4
+ export const IocIdentifierTest: BootstrapExecutorPlugin = {
5
+ pluginName: 'IocIdentifierTest',
6
+ onSuccess({ parameters: { logger, ioc } }) {
7
+ const errorList: string[] = [];
8
+ const keyList: string[] = Object.keys(IOCIdentifier);
9
+ keyList.forEach((key) => {
10
+ try {
11
+ const value = ioc.get(key);
12
+ if (value === undefined) {
13
+ errorList.push(key);
14
+ }
15
+ } catch {
16
+ errorList.push(key);
17
+ }
18
+ });
19
+
20
+ if (errorList.length > 0) {
21
+ logger.warn(`IOC ${errorList.join(', ')} is not found`);
22
+ } else {
23
+ logger.info(`IOC all identifiers are found ${keyList.length}`);
24
+ }
25
+ }
26
+ };
@@ -1,11 +1,11 @@
1
1
  import { IOC } from '@/core/IOC';
2
- import { UserService } from '@/base/services/UserService';
3
2
  import { Navigate, Outlet } from 'react-router-dom';
4
3
  import { useStore } from '@/uikit/hooks/useStore';
5
4
  import BaseHeader from '../../uikit/components/BaseHeader';
5
+ import { IOCIdentifier } from '@config/IOCIdentifier';
6
6
 
7
7
  export default function Layout() {
8
- const userService = IOC(UserService);
8
+ const userService = IOC(IOCIdentifier.UserServiceInterface);
9
9
  useStore(userService.store);
10
10
 
11
11
  // If user is authenticated, redirect to home page
@@ -3,10 +3,9 @@ import { Form, Input, Button } from 'antd';
3
3
  import { UserOutlined, LockOutlined, GoogleOutlined } from '@ant-design/icons';
4
4
  import { IOC } from '@/core/IOC';
5
5
  import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
6
- import { RouteService } from '@/base/services/RouteService';
7
- import { UserService } from '@/base/services/UserService';
8
6
  import * as i18nKeys from '@config/Identifier/page.login';
9
7
  import LocaleLink from '@/uikit/components/LocaleLink';
8
+ import { IOCIdentifier } from '@config/IOCIdentifier';
10
9
 
11
10
  interface LoginFormData {
12
11
  email: string;
@@ -15,8 +14,8 @@ interface LoginFormData {
15
14
 
16
15
  export default function LoginPage() {
17
16
  const { t } = useBaseRoutePage();
18
- const userService = IOC(UserService);
19
- const AppConfig = IOC('AppConfig');
17
+ const userService = IOC(IOCIdentifier.UserServiceInterface);
18
+ const AppConfig = IOC(IOCIdentifier.AppConfig);
20
19
  const [loading, setLoading] = useState(false);
21
20
 
22
21
  const handleLogin = async (values: LoginFormData) => {
@@ -26,9 +25,9 @@ export default function LoginPage() {
26
25
  username: values.email,
27
26
  password: values.password
28
27
  });
29
- IOC(RouteService).replaceToHome();
28
+ IOC(IOCIdentifier.RouteServiceInterface).replaceToHome();
30
29
  } catch (error) {
31
- console.error(error);
30
+ IOC(IOCIdentifier.Logger).error(error);
32
31
  } finally {
33
32
  setLoading(false);
34
33
  }
@@ -3,14 +3,15 @@ import { Form, Input, Button, Checkbox } from 'antd';
3
3
  import { UserOutlined, LockOutlined, MailOutlined } from '@ant-design/icons';
4
4
  import { IOC } from '@/core/IOC';
5
5
  import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
6
- import { RouteService } from '@/base/services/RouteService';
7
- import { RegisterFormData, UserService } from '@/base/services/UserService';
6
+ import { RegisterFormData } from '@/base/services/UserService';
8
7
  import * as i18nKeys from '@config/Identifier/page.register';
8
+ import { IOCIdentifier } from '@config/IOCIdentifier';
9
9
 
10
10
  export default function RegisterPage() {
11
11
  const { t } = useBaseRoutePage();
12
- const userService = IOC(UserService);
13
- const AppConfig = IOC('AppConfig');
12
+ const AppConfig = IOC(IOCIdentifier.AppConfig);
13
+ const userService = IOC(IOCIdentifier.UserServiceInterface);
14
+ const routeService = IOC(IOCIdentifier.RouteServiceInterface);
14
15
  const [loading, setLoading] = useState(false);
15
16
  const [form] = Form.useForm();
16
17
 
@@ -18,9 +19,9 @@ export default function RegisterPage() {
18
19
  try {
19
20
  setLoading(true);
20
21
  await userService.register(values);
21
- IOC(RouteService).replaceToHome();
22
+ routeService.replaceToHome();
22
23
  } catch (error) {
23
- console.error(error);
24
+ IOC(IOCIdentifier.Logger).error(error);
24
25
  } finally {
25
26
  setLoading(false);
26
27
  }
@@ -28,7 +29,7 @@ export default function RegisterPage() {
28
29
 
29
30
  const handleLoginClick = (e: React.MouseEvent) => {
30
31
  e.preventDefault();
31
- IOC(RouteService).gotoLogin();
32
+ routeService.gotoLogin();
32
33
  };
33
34
 
34
35
  return (
@@ -2,10 +2,9 @@ import { Button, Progress, Tag, Space, Card, Input, Select } from 'antd';
2
2
  import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
3
3
  import { useState, useEffect } from 'react';
4
4
  import { IOC } from '@/core/IOC';
5
- import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
6
- import { ExecutorController } from '@/uikit/controllers/ExecutorController';
7
5
  import { useStore } from '@/uikit/hooks/useStore';
8
6
  import * as i18nKeys from '@config/Identifier/page.executor';
7
+ import { IOCIdentifier } from '@config/IOCIdentifier';
9
8
 
10
9
  interface Task {
11
10
  id: string;
@@ -22,17 +21,10 @@ interface Task {
22
21
 
23
22
  export default function ExecutorPage() {
24
23
  const { t } = useBaseRoutePage();
25
- const executorController = IOC(ExecutorController);
26
- const jSONStorageController = IOC(JSONStorageController);
27
- const requestTimeout = useStore(
28
- jSONStorageController,
29
- jSONStorageController.selector.requestTimeout
30
- );
31
-
32
- const helloState = useStore(
33
- executorController,
34
- executorController.selector.helloState
35
- );
24
+ const pageBridge = IOC(IOCIdentifier.ExecutorPageBridgeInterface);
25
+ const jspBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
26
+ const requestTimeout = useStore(jspBridge, jspBridge.selector.requestTimeout);
27
+ const helloState = useStore(pageBridge, pageBridge.selector.helloState);
36
28
 
37
29
  const [tasks, setTasks] = useState<Task[]>([
38
30
  {
@@ -164,7 +156,7 @@ export default function ExecutorPage() {
164
156
  );
165
157
 
166
158
  try {
167
- await executorController.onTestPlugins();
159
+ await pageBridge.onTestPlugins();
168
160
 
169
161
  setTasks((prevTasks) =>
170
162
  prevTasks.map((t) =>
@@ -256,10 +248,7 @@ export default function ExecutorPage() {
256
248
  {helloState.loading ? (
257
249
  <div className="text-text-secondary">Loading...</div>
258
250
  ) : (
259
- <Button
260
- type="primary"
261
- onClick={executorController.onTestPlugins}
262
- >
251
+ <Button type="primary" onClick={pageBridge.onTestPlugins}>
263
252
  {t(i18nKeys.PAGE_EXECUTOR_TEST_PLUGIN_TITLE)}
264
253
  </Button>
265
254
  )}
@@ -269,7 +258,7 @@ export default function ExecutorPage() {
269
258
  <div className="text-red-500">{helloState.error.message}</div>
270
259
  ) : (
271
260
  <pre className="text-text-secondary">
272
- {IOC('JSON').stringify(helloState.result?.data)}
261
+ {IOC('JSONSerializer').stringify(helloState.result?.data)}
273
262
  </pre>
274
263
  )}
275
264
  </div>
@@ -3,7 +3,7 @@ import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
3
3
  import * as ErrorIdentifierList from '@config/Identifier/common.error';
4
4
  import * as i18nKeys from '@config/Identifier/page.identifiter';
5
5
 
6
- export default function ErrorIdentifierPage() {
6
+ export default function IdentifierPage() {
7
7
  const { t } = useBaseRoutePage();
8
8
 
9
9
  return (
@@ -1,14 +1,14 @@
1
1
  import { IOC } from '@/core/IOC';
2
2
  import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
3
3
  import template from 'lodash/template';
4
- import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
5
4
  import { useStore } from '@/uikit/hooks/useStore';
6
5
  import { Button, Input } from 'antd';
7
6
  import * as i18nKeys from '@config/Identifier/page.jsonStorage';
7
+ import { IOCIdentifier } from '@config/IOCIdentifier';
8
8
 
9
9
  export default function JSONStoragePage() {
10
- const jsonStorageController = IOC(JSONStorageController);
11
- const controllerState = useStore(jsonStorageController);
10
+ const pageBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
11
+ const pageState = useStore(pageBridge);
12
12
  const { t } = useBaseRoutePage();
13
13
 
14
14
  return (
@@ -36,7 +36,7 @@ export default function JSONStoragePage() {
36
36
  <div className="flex flex-col items-center space-y-4">
37
37
  <Button
38
38
  type="primary"
39
- onClick={jsonStorageController.changeRandomTestKey1}
39
+ onClick={pageBridge.changeRandomTestKey1}
40
40
  >
41
41
  {t(i18nKeys.PAGE_JSONSTORAGE_SET_RANDOM)}
42
42
  </Button>
@@ -46,7 +46,7 @@ export default function JSONStoragePage() {
46
46
  {t(i18nKeys.PAGE_JSONSTORAGE_CURRENT_VALUE)}:{' '}
47
47
  </span>
48
48
  <span className="font-semibold text-text">
49
- {JSON.stringify(controllerState.testKey1)}
49
+ {JSON.stringify(pageState.testKey1)}
50
50
  </span>
51
51
  </div>
52
52
  </div>
@@ -69,11 +69,9 @@ export default function JSONStoragePage() {
69
69
  <div className="flex items-center space-x-4">
70
70
  <Input
71
71
  type="number"
72
- value={controllerState.expireTime}
72
+ value={pageState.expireTime}
73
73
  onChange={(e) =>
74
- jsonStorageController.changeExpireTime(
75
- Number(e.target.value)
76
- )
74
+ pageBridge.changeExpireTime(Number(e.target.value))
77
75
  }
78
76
  className="w-32"
79
77
  min="1000"
@@ -86,7 +84,7 @@ export default function JSONStoragePage() {
86
84
 
87
85
  <Button
88
86
  type="primary"
89
- onClick={jsonStorageController.onChangeRandomTestKey2}
87
+ onClick={pageBridge.onChangeRandomTestKey2}
90
88
  >
91
89
  {t(i18nKeys.PAGE_JSONSTORAGE_SET_EXPIRE)}
92
90
  </Button>
@@ -96,7 +94,7 @@ export default function JSONStoragePage() {
96
94
  {t(i18nKeys.PAGE_JSONSTORAGE_CURRENT_VALUE)}:{' '}
97
95
  </span>
98
96
  <span className="font-semibold text-text">
99
- {controllerState.testKey2}
97
+ {pageState.testKey2}
100
98
  </span>
101
99
  </div>
102
100
  </div>
@@ -110,11 +108,9 @@ export default function JSONStoragePage() {
110
108
  <div className="flex items-center space-x-4">
111
109
  <Input
112
110
  type="number"
113
- value={controllerState.requestTimeout}
111
+ value={pageState.requestTimeout}
114
112
  onChange={(e) =>
115
- jsonStorageController.changeRequestTimeout(
116
- Number(e.target.value)
117
- )
113
+ pageBridge.changeRequestTimeout(Number(e.target.value))
118
114
  }
119
115
  className="w-32"
120
116
  min="1000"
@@ -1,6 +1,6 @@
1
1
  import BaseHeader from '../../uikit/components/BaseHeader';
2
2
  import { Outlet } from 'react-router-dom';
3
- import { ProcessExecutorProvider } from '@/uikit/providers/ProcessExecutorProvider';
3
+ import { ProcessExecutorProvider } from '@/uikit/components/ProcessExecutorProvider';
4
4
 
5
5
  export default function Layout() {
6
6
  return (
@@ -1,5 +1,5 @@
1
- import { RouteService } from '@/base/services/RouteService';
2
1
  import { IOC } from '@/core/IOC';
2
+ import { IOCIdentifier } from '@config/IOCIdentifier';
3
3
  import { useEffect } from 'react';
4
4
  import { useNavigate } from 'react-router-dom';
5
5
 
@@ -8,7 +8,7 @@ const RedirectToDefault = () => {
8
8
 
9
9
  useEffect(() => {
10
10
  // Redirect to the default language path
11
- IOC(RouteService).redirectToDefault(navigate);
11
+ IOC(IOCIdentifier.RouteServiceInterface).redirectToDefault(navigate);
12
12
  }, [navigate]);
13
13
 
14
14
  return null;
@@ -1,12 +1,11 @@
1
1
  import { IOC } from '@/core/IOC';
2
2
  import { useBaseRoutePage } from '@/uikit/contexts/BaseRouteContext';
3
- import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
4
- import { RequestController } from '@/uikit/controllers/RequestController';
5
3
  import { useMemo } from 'react';
6
4
  import { useStore } from '@/uikit/hooks/useStore';
7
5
  import { Button } from 'antd';
8
6
  import { LoadingOutlined } from '@ant-design/icons';
9
7
  import * as i18nKeys from '@config/Identifier/page.request';
8
+ import { IOCIdentifier } from '@config/IOCIdentifier';
10
9
 
11
10
  function JSONValue({ value }: { value: unknown }) {
12
11
  const output = useMemo(() => {
@@ -24,9 +23,10 @@ function JSONValue({ value }: { value: unknown }) {
24
23
  }
25
24
 
26
25
  export default function RequestPage() {
27
- const requestController = IOC(RequestController);
28
- const requestControllerState = useStore(requestController);
29
- const jsonStorageControllerState = useStore(IOC(JSONStorageController));
26
+ const pageBridge = IOC(IOCIdentifier.RequestPageBridgeInterface);
27
+ const pageState = useStore(pageBridge);
28
+ const jsonStoragePageBridge = IOC(IOCIdentifier.JSONStoragePageInterface);
29
+ const jsonStoragePageState = useStore(jsonStoragePageBridge);
30
30
  const { t } = useBaseRoutePage();
31
31
 
32
32
  return (
@@ -38,7 +38,7 @@ export default function RequestPage() {
38
38
  {t(i18nKeys.PAGE_REQUEST_TIMEOUT)}
39
39
  </h2>
40
40
  <div className="text-sm text-text-secondary font-mono bg-base p-2 rounded">
41
- {jsonStorageControllerState.requestTimeout}
41
+ {jsonStoragePageState.requestTimeout}
42
42
  </div>
43
43
  </div>
44
44
 
@@ -53,10 +53,10 @@ export default function RequestPage() {
53
53
  </p>
54
54
  <Button
55
55
  type="primary"
56
- onClick={requestController.onHello}
57
- loading={requestControllerState.helloState.loading}
56
+ onClick={pageBridge.onHello}
57
+ loading={pageState.helloState.loading}
58
58
  >
59
- {requestControllerState.helloState.loading
59
+ {pageState.helloState.loading
60
60
  ? t(i18nKeys.REQUEST_LOADING)
61
61
  : t(i18nKeys.PAGE_REQUEST_HELLO_BUTTON)}
62
62
  </Button>
@@ -66,14 +66,14 @@ export default function RequestPage() {
66
66
  <p className="text-sm font-medium text-text">
67
67
  {t(i18nKeys.REQUEST_HELLO_RESULT)}:
68
68
  </p>
69
- <JSONValue value={requestControllerState.helloState.result} />
69
+ <JSONValue value={pageState.helloState.result} />
70
70
  </div>
71
71
 
72
72
  <div>
73
73
  <p className="text-sm font-medium text-text">
74
74
  {t(i18nKeys.REQUEST_HELLO_ERROR)}:
75
75
  </p>
76
- <JSONValue value={requestControllerState.helloState.error} />
76
+ <JSONValue value={pageState.helloState.error} />
77
77
  </div>
78
78
  </div>
79
79
  </div>
@@ -89,10 +89,10 @@ export default function RequestPage() {
89
89
  </p>
90
90
  <Button
91
91
  type="primary"
92
- onClick={requestController.onIpInfo}
93
- loading={requestControllerState.ipInfoState.loading}
92
+ onClick={pageBridge.onIpInfo}
93
+ loading={pageState.ipInfoState.loading}
94
94
  >
95
- {requestControllerState.ipInfoState.loading
95
+ {pageState.ipInfoState.loading
96
96
  ? t(i18nKeys.REQUEST_LOADING)
97
97
  : t(i18nKeys.REQUEST_IP_INFO)}
98
98
  </Button>
@@ -101,7 +101,7 @@ export default function RequestPage() {
101
101
  <p className="text-sm font-medium text-text">
102
102
  {t(i18nKeys.REQUEST_IP_INFO_RESULT)}:
103
103
  </p>
104
- <JSONValue value={requestControllerState.ipInfoState.result} />
104
+ <JSONValue value={pageState.ipInfoState.result} />
105
105
  </div>
106
106
  </div>
107
107
 
@@ -115,10 +115,10 @@ export default function RequestPage() {
115
115
  </p>
116
116
  <Button
117
117
  type="primary"
118
- onClick={requestController.onRandomUser}
119
- loading={requestControllerState.randomUserState.loading}
118
+ onClick={pageBridge.onRandomUser}
119
+ loading={pageState.randomUserState.loading}
120
120
  >
121
- {requestControllerState.randomUserState.loading
121
+ {pageState.randomUserState.loading
122
122
  ? t(i18nKeys.REQUEST_LOADING)
123
123
  : t(i18nKeys.REQUEST_RANDOM_USER)}
124
124
  </Button>
@@ -128,16 +128,14 @@ export default function RequestPage() {
128
128
  <p className="text-sm font-medium text-text">
129
129
  {t(i18nKeys.REQUEST_RANDOM_USER_RESULT)}:
130
130
  </p>
131
- <JSONValue
132
- value={requestControllerState.randomUserState.result}
133
- />
131
+ <JSONValue value={pageState.randomUserState.result} />
134
132
  </div>
135
133
 
136
134
  <div>
137
135
  <p className="text-sm font-medium text-text">
138
136
  {t(i18nKeys.REQUEST_RANDOM_USER_ERROR)}:
139
137
  </p>
140
- <JSONValue value={requestControllerState.randomUserState.error} />
138
+ <JSONValue value={pageState.randomUserState.error} />
141
139
  </div>
142
140
  </div>
143
141
  </div>
@@ -148,16 +146,12 @@ export default function RequestPage() {
148
146
  {t(i18nKeys.PAGE_REQUEST_API_CATCH_TITLE)}
149
147
  </h2>
150
148
  <Button
151
- type={
152
- requestControllerState.apiCatchResultState.loading
153
- ? 'primary'
154
- : 'primary'
155
- }
156
- danger={requestControllerState.apiCatchResultState.loading}
157
- onClick={requestController.onTriggerApiCatchResult}
158
- loading={requestControllerState.apiCatchResultState.loading}
149
+ type={pageState.apiCatchResultState.loading ? 'primary' : 'primary'}
150
+ danger={pageState.apiCatchResultState.loading}
151
+ onClick={pageBridge.onTriggerApiCatchResult}
152
+ loading={pageState.apiCatchResultState.loading}
159
153
  >
160
- {requestControllerState.apiCatchResultState.loading
154
+ {pageState.apiCatchResultState.loading
161
155
  ? t(i18nKeys.PAGE_REQUEST_STOP_API_CATCH)
162
156
  : t(i18nKeys.PAGE_REQUEST_TRIGGER_API_CATCH)}
163
157
  </Button>
@@ -167,18 +161,14 @@ export default function RequestPage() {
167
161
  <p className="text-sm font-medium text-text">
168
162
  {t(i18nKeys.REQUEST_ABORT_RESULT)}:
169
163
  </p>
170
- <JSONValue
171
- value={requestControllerState.apiCatchResultState.result}
172
- />
164
+ <JSONValue value={pageState.apiCatchResultState.result} />
173
165
  </div>
174
166
 
175
167
  <div>
176
168
  <p className="text-sm font-medium text-text">
177
169
  {t(i18nKeys.REQUEST_ABORT_ERROR)}:
178
170
  </p>
179
- <JSONValue
180
- value={requestControllerState.apiCatchResultState.error}
181
- />
171
+ <JSONValue value={pageState.apiCatchResultState.error} />
182
172
  </div>
183
173
  </div>
184
174
  </div>
@@ -189,14 +179,12 @@ export default function RequestPage() {
189
179
  {t(i18nKeys.PAGE_REQUEST_ABORT_TITLE)}
190
180
  </h2>
191
181
  <Button
192
- type={
193
- requestControllerState.abortState.loading ? 'primary' : 'primary'
194
- }
195
- danger={requestControllerState.abortState.loading}
196
- onClick={requestController.onTriggerAbortRequest}
182
+ type={pageState.abortState.loading ? 'primary' : 'primary'}
183
+ danger={pageState.abortState.loading}
184
+ onClick={pageBridge.onTriggerAbortRequest}
197
185
  >
198
- {requestControllerState.abortState.loading && <LoadingOutlined />}
199
- {requestControllerState.abortState.loading
186
+ {pageState.abortState.loading && <LoadingOutlined />}
187
+ {pageState.abortState.loading
200
188
  ? t(i18nKeys.PAGE_REQUEST_STOP_ABORT)
201
189
  : t(i18nKeys.PAGE_REQUEST_TRIGGER_ABORT)}
202
190
  </Button>
@@ -206,14 +194,14 @@ export default function RequestPage() {
206
194
  <p className="text-sm font-medium text-text">
207
195
  {t(i18nKeys.REQUEST_ABORT_RESULT)}:
208
196
  </p>
209
- <JSONValue value={requestControllerState.abortState.result} />
197
+ <JSONValue value={pageState.abortState.result} />
210
198
  </div>
211
199
 
212
200
  <div>
213
201
  <p className="text-sm font-medium text-text">
214
202
  {t(i18nKeys.REQUEST_ABORT_ERROR)}:
215
203
  </p>
216
- <JSONValue value={requestControllerState.abortState.error} />
204
+ <JSONValue value={pageState.abortState.error} />
217
205
  </div>
218
206
  </div>
219
207
  </div>
@@ -141,7 +141,7 @@ html,
141
141
  .ant-select,
142
142
  .ant-select-css-var {
143
143
  --fe-select-internal_fixed_item_margin: 2px;
144
- --fe-select-z-index-popup: 1050;
144
+ --fe-select-z-index-popup: var(--zi-select);
145
145
  --fe-select-option-selected-color: rgba(0, 0, 0, 0.88);
146
146
  --fe-select-option-selected-font-weight: 600;
147
147
  --fe-select-option-selected-bg: var(--fe-color-primary-bg);
@@ -222,7 +222,7 @@ html,
222
222
  /* Antd Message 组件变量 */
223
223
  .ant-message,
224
224
  .ant-message-css-var {
225
- --fe-message-z-index-popup: 2010;
225
+ --fe-message-z-index-popup: var(--zi-message);
226
226
  --fe-message-content-bg: var(--fe-color-bg-container);
227
227
  --fe-message-content-padding: 9px 12px;
228
228
  --fe-message-notice-content-padding: 10px 16px;
@@ -96,7 +96,7 @@
96
96
  .ant-select,
97
97
  .ant-select-css-var {
98
98
  --fe-select-internal_fixed_item_margin: 2px;
99
- --fe-select-z-index-popup: 1050;
99
+ --fe-select-z-index-popup: var(--zi-select);
100
100
  --fe-select-option-selected-color: rgba(255, 255, 255, 0.88);
101
101
  --fe-select-option-selected-font-weight: 600;
102
102
  --fe-select-option-selected-bg: var(--fe-color-primary-bg);
@@ -154,7 +154,7 @@
154
154
  /* Antd Message 组件变量 */
155
155
  .ant-message,
156
156
  .ant-message-css-var {
157
- --fe-message-z-index-popup: 2010;
157
+ --fe-message-z-index-popup: var(--zi-message);
158
158
  --fe-message-content-bg: rgb(51 65 85); /* slate-700,比容器背景色深一点 */
159
159
  --fe-message-content-padding: 9px 12px;
160
160
  --fe-message-notice-content-padding: 10px 16px;
@@ -100,7 +100,7 @@
100
100
  .ant-select,
101
101
  .ant-select-css-var {
102
102
  --fe-select-internal_fixed_item_margin: 2px;
103
- --fe-select-z-index-popup: 1050;
103
+ --fe-select-z-index-popup: var(--zi-select);
104
104
  --fe-select-option-selected-color: rgba(190, 18, 60, 0.88);
105
105
  --fe-select-option-selected-font-weight: 600;
106
106
  --fe-select-option-selected-bg: var(--fe-color-primary-bg);
@@ -158,7 +158,7 @@
158
158
  /* Antd Message 组件变量 */
159
159
  .ant-message,
160
160
  .ant-message-css-var {
161
- --fe-message-z-index-popup: 2010;
161
+ --fe-message-z-index-popup: var(--zi-message);
162
162
  --fe-message-content-bg: var(--ant-color-bg-container);
163
163
  --fe-message-content-padding: 9px 12px;
164
164
  --fe-message-notice-content-padding: 10px 16px;
@@ -1,4 +1,5 @@
1
1
  @import './tailwind.css';
2
+ @import './zIndex.css';
2
3
 
3
4
  @import './antd-themes/index.css';
4
5
 
@@ -1,3 +1,11 @@
1
+ /**
2
+ * This file is used to define the page styles for the app.
3
+ *
4
+ * @example --color-primary
5
+ * ```tsx
6
+ * <div className="bg-primary text-primary border-text-tertiary"></div>
7
+ * ```
8
+ */
1
9
  @theme {
2
10
  --color-primary: rgba(var(--color-bg-base));
3
11
  --color-secondary: rgba(var(--color-bg-secondary));
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file is used to define the z-index values for the app.
3
+ */
4
+ :root {
5
+ /* antd select popup zindex */
6
+ --zi-select: 1050;
7
+ /* antd message zindex */
8
+ --zi-message: 2010;
9
+ }